PHP 5.4 preg_match error

See all posts Reply

PHP 5.4 preg_match error new!
by Neena, 8 years, 8 months ago
Hi,

After upgrading to PHP 5.4, there are errors on preg_match function, any idea on how to edit it? Thanks!


Warning: preg_match(): Compilation failed: invalid range in character class at offset 7 in D:\AppServ\www\laura\foundationreview\func\class.upload.php on line 2525



Warning: preg_match(): Compilation failed: invalid range in character class at offset 7 in D:\AppServ\www\laura\foundationreview\func\class.upload.php on line 2543

25380.jpgReply
Re: PHP 5.4 preg_match error new!
by colin, 8 years, 8 months ago
Please use the latest version, available on GitHub.Reply
Re: PHP 5.4 preg_match error new!
by barney, 8 years, 4 months ago
HI, im also getting the same error. Ive class.upload.php to version 0.32, however im still getting the same problem....does the actual upload class (referring to $handle etc) need to be edited also?Reply
Re: PHP 5.4 preg_match error new!
by barney, 8 years, 4 months ago
HI, im also getting the same error. Ive class.upload.php to version 0.32, however im still getting the same problem....does the actual upload class (referring to $handle etc) need to be edited also?Reply
Re: PHP 5.4 preg_match error new!
by Vladimir, 8 years ago
Hi,

PHP 5.4+ versions are very sensitive to regular expressions and in this case gives warning message on not valid range expression part [\.-\w]
Dash symbol means some kind of range like a-z or 0-9, but here symbols "." to "w" does not make any sense. I assume that dash should come on first or last position inside brackets.
Search for all "preg_match" expressions through "class.upload.php" file and change [\.-\w] to [\.\w-] and it will work for all newer PHP versions.

It worked more me already.Reply
Re: PHP 5.4 preg_match error new!
by colin, 8 years ago