Skip to content

Commit

Permalink
Fix(deprecation) preg_match_all requires string parameter (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
iricketson authored Dec 30, 2023
1 parent 21c70f1 commit 1fe8979
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/util/sfToolkit.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public static function stringToArray($string)
\s*(?:
(?=\w+\s*=) | \s*$ # followed by another key= or the end of the string
)
/x', $string, $matches, PREG_SET_ORDER);
/x', (string) $string, $matches, PREG_SET_ORDER);

$attributes = array();
foreach ($matches as $val) {
Expand Down
4 changes: 3 additions & 1 deletion test/unit/util/sfToolkitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

$t = new lime_test(95);
$t = new lime_test(96);

// ::stringToArray()
$t->diag('::stringToArray()');
Expand All @@ -34,6 +34,8 @@
$t->is(sfToolkit::stringToArray($string), $attributes, '->stringToArray()');
}

$t->is(sfToolkit::stringToArray(null), array(), '->stringToArray() can accept a null value');

// ::isUTF8()
$t->diag('::isUTF8()');
$t->is(sfToolkit::isUTF8('été'), true, '::isUTF8() returns true if the parameter is an UTF-8 encoded string');
Expand Down

0 comments on commit 1fe8979

Please sign in to comment.