Edit report at https://pear.php.net/bugs/bug.php?id=20219&edit=1
ID: 20219
Updated by: [email protected]
Reported By: [email protected]
Summary: Deprecated: preg_replace(): The /e modifier is
deprecated, use preg_replace_cal
Status: Open
Type: Bug
Package: HTML_Safe
PHP Version: 5.5.8
Roadmap Versions:
New Comment:
Hi,
Could I get you to open up a pull request with that patch?
Previous Comments:
------------------------------------------------------------------------
[2014-03-15 14:45:53] wackowiki
Description:
------------
http://www.php.net/manual/en/migration55.deprecated.php
Replace preg_replace() e modifier with preg_replace_callback
diff --git a/lib/safehtml/safehtml.php b/lib/safehtml/safehtml.php
--- a/lib/safehtml/safehtml.php
+++ b/lib/safehtml/safehtml.php
@@ -350,10 +350,10 @@
}
}
- $tempval = preg_replace('/&#(\d+);?/me', "chr('\\1')",
$value); //"'
- $tempval = preg_replace(
- '/&#x([0-9a-f]+);?/mei',
- "chr(hexdec('\\1'))",
+ $tempval = preg_replace_callback('/&#(\d+);?/m',
function ($matches) { return chr($matches[1]); }, $value); //"'
+ $tempval = preg_replace_callback(
+ '/&#x([0-9a-f]+);?/mi',
+ function ($matches) { return chr(hexdec($matches[1]));
},
$tempval
);
------------------------------------------------------------------------