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

core/security PHP 5.5.x preg_replace(): The /e modifier is deprecated #2727

Closed
GDmac opened this issue Nov 14, 2013 · 2 comments
Closed

core/security PHP 5.5.x preg_replace(): The /e modifier is deprecated #2727

GDmac opened this issue Nov 14, 2013 · 2 comments

Comments

@GDmac
Copy link
Contributor

GDmac commented Nov 14, 2013

I'm getting notices on server with PHP 5.5
preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

i'm not sure but it seems the entity_decode method in core/security is a very legacy fix for a pre php 5 bug in html_entity_decode. is this still needed?

A quick fix i used is replacing the latter two with replace_callback as mention in this stackoverflow article (1).

// Numeric Entities

// $str = preg_replace('~&#x(0*[0-9a-f]{2,5});{0,1}~ei', 'chr(hexdec("\\1"))', $str);
// $str = preg_replace('~&#([0-9]{2,4});{0,1}~e', 'chr(\\1)', $str);

$str = preg_replace_callback('~&#x(0*[0-9a-f]{2,5});{0,1}~i',
  create_function ('$matches', 'return chr(hexdec($matches[1]));'), $str);

$str = preg_replace_callback('~&#([0-9]{2,4});{0,1}~',
  create_function ('$matches', 'return chr($matches[1]);'), $str);

(1) http://stackoverflow.com/questions/15454220/replace-preg-replace-e-modifier-with-preg-replace-callback

@narfbg
Copy link
Contributor

narfbg commented Nov 14, 2013

This was reported and fixed a month ago: #2681

@narfbg narfbg closed this as completed Nov 14, 2013
@GDmac
Copy link
Contributor Author

GDmac commented Nov 14, 2013

Great, i forgot EE is not importing codigniter anymore, grmbl, backporting fixes...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants