replaced deprecated option /e with callable function #1309

Closed
wants to merge 3 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+2 −2
Diff settings

Always

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

yurii-github Jun 20, 2013

Contributor

better way to convert to 0x / hex ?

@yurii-github

yurii-github Jun 20, 2013

Contributor

better way to convert to 0x / hex ?

This comment has been minimized.

@IhabH

IhabH Jul 9, 2013

And for decimal?

@IhabH

IhabH Jul 9, 2013

And for decimal?

This comment has been minimized.

@Royrms

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

@Royrms

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

drakozip22 Sep 14, 2015

EXCELENT!
WORKS FINE!
THANKS

@drakozip22

drakozip22 Sep 14, 2015

EXCELENT!
WORKS FINE!
THANKS

This comment has been minimized.

@marcoaureliojf

marcoaureliojf Jan 16, 2016

Great!!
Works like a charm!
Thanks a lot!

@marcoaureliojf

marcoaureliojf Jan 16, 2016

Great!!
Works like a charm!
Thanks a lot!

This comment has been minimized.

@mfarooqi

mfarooqi Oct 14, 2016

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

@mfarooqi

mfarooqi Oct 14, 2016

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

return $source;
}