Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
[zendframework/zendframework#3376] Replace PCRE /e modifier with preg…
Browse files Browse the repository at this point in the history
…_replace_callback()

- Replaced usage of preg_replace with "/e" modifier with
  preg_replace_callback() using a closure
  • Loading branch information
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Converter/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ public static function ascToHex32($string)
*/
public static function hex32ToAsc($string)
{
$string = preg_replace('/\\\([0-9A-Fa-f]{2})/e', "''.chr(hexdec('\\1')).''", $string);
$string = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', function ($matches) {
return chr(hexdec($matches[1]));
}, $string);
return $string;
}

Expand Down

0 comments on commit 8517056

Please sign in to comment.