Closed IamSwap closed 7 years ago
Getting error while using php 7. preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead. By further digging, problem is this method.
preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
function xmlentities($string) { $string = preg_replace('/[^a-zA-Z0-9 _\-\.\'\r\n]/e', '_uePhpLibPrivateXMLEntities("$0")', $string); return $string; }
But by changing method to following, fixes the problem with php7. But not sure if it's safe.
function xmlentities($string) { $string = preg_replace_callback('[^a-zA-Z0-9 _\-\.\'\r\n]', function($matches) { return '_uePhpLibPrivateXMLEntities("$matches[1]")'; }, $string); return $string; }
Any help?
It can be fixed by using preg_replace_callback, and dropping the /e modifier.
$string = preg_replace_callback('/[^a-zA-Z0-9 _\-\.\'\r\n]/', '_uePhpLibPrivateXMLEntities("$0")', $string);
Getting error while using php 7.
preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
. By further digging, problem is this method.But by changing method to following, fixes the problem with php7. But not sure if it's safe.
Any help?