File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ public static function formattedConstruct($args): array
79
79
{
80
80
$ code = 0 ;
81
81
$ previous = null ;
82
- $ format = array_shift ($ args );
82
+ $ format = array_shift ($ args ) ?? '' ;
83
83
84
84
if (is_array ($ format ))
85
85
{
Original file line number Diff line number Diff line change @@ -104,6 +104,42 @@ public function testFormattingMissingArgs1(): void
104
104
}
105
105
}
106
106
107
+ //--------------------------------------------------------------------------------------------------------------------
108
+ /**
109
+ * Test formatting null string.
110
+ */
111
+ public function testFormattingNull1 (): void
112
+ {
113
+ try
114
+ {
115
+ $ format = null ;
116
+
117
+ throw new self::$ class ($ format );
118
+ }
119
+ catch (Exception $ e )
120
+ {
121
+ self ::assertSame ('' , $ e ->getMessage ());
122
+ }
123
+ }
124
+
125
+ //--------------------------------------------------------------------------------------------------------------------
126
+ /**
127
+ * Test formatting null string and bogus arguments.
128
+ */
129
+ public function testFormattingNull2 (): void
130
+ {
131
+ try
132
+ {
133
+ $ format = null ;
134
+
135
+ throw new self::$ class ($ format , 'bogus ' , 123 );
136
+ }
137
+ catch (Exception $ e )
138
+ {
139
+ self ::assertSame ('' , $ e ->getMessage ());
140
+ }
141
+ }
142
+
107
143
//--------------------------------------------------------------------------------------------------------------------
108
144
/**
109
145
* Test formatting string with missing arguments.
You can’t perform that action at this time.
0 commit comments