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

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/joomla/filter/input.php
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better way to convert to 0x / hex ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And for decimal?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EXCELENT!
WORKS FINE!
THANKS

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

return $source;
}

Expand Down