Skip to content

Commit 1fe8979

Browse files
authored
Fix(deprecation) preg_match_all requires string parameter (#298)
1 parent 21c70f1 commit 1fe8979

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/util/sfToolkit.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public static function stringToArray($string)
254254
\s*(?:
255255
(?=\w+\s*=) | \s*$ # followed by another key= or the end of the string
256256
)
257-
/x', $string, $matches, PREG_SET_ORDER);
257+
/x', (string) $string, $matches, PREG_SET_ORDER);
258258

259259
$attributes = array();
260260
foreach ($matches as $val) {

test/unit/util/sfToolkitTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
require_once __DIR__.'/../../bootstrap/unit.php';
1212

13-
$t = new lime_test(95);
13+
$t = new lime_test(96);
1414

1515
// ::stringToArray()
1616
$t->diag('::stringToArray()');
@@ -34,6 +34,8 @@
3434
$t->is(sfToolkit::stringToArray($string), $attributes, '->stringToArray()');
3535
}
3636

37+
$t->is(sfToolkit::stringToArray(null), array(), '->stringToArray() can accept a null value');
38+
3739
// ::isUTF8()
3840
$t->diag('::isUTF8()');
3941
$t->is(sfToolkit::isUTF8('été'), true, '::isUTF8() returns true if the parameter is an UTF-8 encoded string');

0 commit comments

Comments
 (0)