preg_replace_callback() warning when running a CakePHP shell
-
20-04-2021 - |
Question
I am running: Apache 2 PHP 5.3.3 CentOS
And when I check pcre, I see:
pcretest -C
PCRE version 6.6 06-Feb-2006
Compiled with
UTF-8 support
Unicode properties support
Newline character is LF
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack
However, when trying to run a shell, I get the following:
Warning: preg_replace_callback(): Compilation failed: unrecognized character after (?< at offset 4 in /var/CakePHP/cakephp_2.0.5/lib/Cake/Console/ConsoleOutput.php on line 186
I have read all of the tickets about PHP version, making sure pcre is up-to-date, and ensuring pcre has unicode support on the cakephp bug list. Any ideas how to resolve this so I can run console commands in CakePHP 2.0.5?
UPDATE:
Sorry, here is the code on line 185:
return preg_replace_callback(
'/<(?<tag>[a-z0-9-_]+)>(?<text>.*?)<\/(\1)>/ims', array($this, '_replaceTags'), $text
);
Also note that this currently works elsewhere (i.e. running on my MacBook Pro)
Solution 2
It looks like an upgrade to the pcre is required.
OTHER TIPS
There is a simple one-line fix for this. Check out the diff at:
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow