关于php的preg_match正则问题,php7.1正常:
'([A-z\d-\/_.]+)?'
php7.3会报错,需要修改如下
'([A-z\d\-\/_.]+)?'
?
It’s probably a php 7.3 incompatibility issue with the plugin.
In php 7.3 PCRE (Perl Compatible Regular Expressions) has been updated to v2.
PCRE is a library that PHP uses for dealing with Regular Expressions.
PCRE2 is more strict in the pattern validations, so after php upgrade, some of the patterns that used to work may not compile anymore.
Now there isn’t a regular expression pattern visible on line 96 in the package-factory.php file … but there is a regular expression being executed:
95 if ( '@' === $search_path[0] ) {
96 if ( ! preg_match( $search_path, $file ) ) {
I’ve included the previous line as well in the code above, because it tells us what regex pattern to look for. One that starts with a @. There is only one match in the entire package-factory.php file:
32 $core_files = '@' . preg_quote( ABSPATH, '@' ) . '[\w-_]+\.@';
It’s the ‘[\w-_]+\.@’ part at the end where the problem is. The hyphen needs to be escaped. So it should be ‘[\w\-_]+\.@’.
Make a backup copy of the current package-factory.php file. Make the edit as described above and then see whether the warnings in the log disappear.
To prevent any confusion, I’m not iThemes.
|