Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replaced deprecated option /e with callable function #1309

wants to merge 3 commits into from
Changes from all commits
File filter
Filter file types
Failed to load comments.
Jump to
Jump to file
Failed to load files.


Just for now

@@ -661,10 +661,10 @@ protected function _decode($source)
$source = strtr($source, $ttr);

// Convert decimal
$source = preg_replace('/&#(\d+);/me', "utf8_encode(chr(\\1))", $source); // decimal notation
$source = preg_replace_callback('/&#(\d+);/m', function($m){return utf8_encode(chr($m[1]));}, $source); // decimal notation

// Convert hex
$source = preg_replace('/&#x([a-f0-9]+);/mei', "utf8_encode(chr(0x\\1))", $source); // hex notation
$source = preg_replace_callback('/&#x([a-f0-9]+);/mi', function($m){return utf8_encode(chr('0x'.$m[1]));}, $source); // hex notation

This comment has been minimized.


yurii-github Jun 20, 2013
Author Contributor

better way to convert to 0x / hex ?

This comment has been minimized.


IhabH Jul 9, 2013

And for decimal?

This comment has been minimized.


Royrms Aug 6, 2013

i think you can add this
$source = preg_replace_callback('/&#x(\d+);/mi', function($m){return utf8_encode(chr('0x'.$m[1]));}, $source); // decimal notation

This comment has been minimized.


drakozip22 Sep 14, 2015


This comment has been minimized.


marcoaureliojf Jan 16, 2016

Works like a charm!
Thanks a lot!

This comment has been minimized.


mfarooqi Oct 14, 2016

Thanks.. reaching up to this solution took... more than 1.5 week(s) :)

return $source;