Jump to content

PHP Warning: preg_replace(): Compilation failed:


Recommended Posts

My prestashop version is 1.5.2

The error msg as below:

[15-Sep-2014 05:05:21 Europe/Paris] PHP Warning:  preg_replace(): Compilation failed: invalid range in character class at offset 24 in /home//public_html/x.com/classes/Tools.php on line 982

 

How to solve this problem 

Please help

  • Like 1
Link to comment
Share on other sites

My prestashop version is 1.5.2

The error msg as below:

[15-Sep-2014 05:05:21 Europe/Paris] PHP Warning:  preg_replace(): Compilation failed: invalid range in character class at offset 24 in /home//public_html/x.com/classes/Tools.php on line 982

 

How to solve this problem 

Please help

 

Hello @docrun,
 
Maybe we have same problem but i'm not sure.
 
Warning: preg_replace() [function.preg-replace]: Compilation failed: invalid range in character class at offset 24 in /home//public_html/shop/classes/Tools.php on line 990
 
It happens if i want to open the module in from backoffice.
 
I'm very grateful if anyone could help me...please
 
Thanks in advance

post-839130-0-03144300-1410886967_thumb.png

Link to comment
Share on other sites

  • 2 weeks later...

Same problem here.

 
Today I noticed that my error_log file was 980 Mb. When I checked, there is only one error that is reported practically every second. The error is: [26-Sep-2014 01:48:28 Europe / Lisbon] PHP Warning: preg_replace (): Compilation failed: invalid range in character class at offset 24 in /home/lisintec/public_html/classes/Tools.php on line 1150.
 
The 1150 line of my tools.php file is as follows:
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL]/u', '', $str);
I can not understand what is wrong here.
Any help would be greatly appreciated!
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...

Hi Nimo,

These errors i keep getting:

 

preg_replace(): Compilation failed: invalid range in character class at offset 24 in /home/ohmzad/public_html/classes/Tools.php on line 1151

 

 

and

 

 

Cannot modify header information - headers already sent by (output started at /home/ohmzad/public_html/classes/Tools.php:1) in /home/ohmzad/public_html/classes/controller/FrontController.php on line 793

 

 

any other help?

Link to comment
Share on other sites

  • 2 months later...
  • 3 weeks later...
  • 1 month later...

Hello Nemo

 

I followed your tip since all others had success with it.

 

Problem is, each time I edit the tools.php my site does not load any more. Even if I redo this step?!

 

I deletes this class_index.php manually since I figured may be that...

 

But to no avail. I always have to make a whole shop file roll back / "re-backup" on the server to get back into bo/fo :((

 

What is the matter with editin tools.php?

I never had a problem like this before and do no unterstand it.

Link to comment
Share on other sites

No, that is not the case.

 

I even deleted tools.php and uploaded it from the 1.6.0.9 install zip. The problem remains the same:

 

I can not get into my modules tab!

 

some times after nearly a minute it loads but all from modules tab (module positions..) remain deadly slow.

 

 

All I can say is this:

 

The shop ran this whole year flawlessly. No problems.

Only the day before yesterday I followed your tips to block away third party modules in the modules tab list. I did this now on a clone and two different local shops; 1.6.09 and 1.6.14. No problem at all.

I also buyed and installed two new modules. All went fine. As far as I could tell. But suddenly I could not get into my modules tab any more as said.

 

So I enabled debug mode. No problems to see. I checked the log...no issues. I enabled logging on my server ... no problems...

I tried to do some JS debugging with Chrome console but I am a noob...

I cloned the live server. Deleted the two new modules via FTP. No going into modules tab... :(

I went into modules positions, showed hidden hooks and deleted this in displayBackOfficeTop & displayBackOfficeHeader but help... :(

I even cloned the shop and did an update 1.6.09 to 1.6.14 in the hope that some misspellings anywhere or inconsistencies might be overridden by the fresh files. But remained the same: No modules tab (only sometimes as said after a minute or more...).

 

 

 

I do not know what else I can do to get back into my modules tab?!

Edited by Kornblume (see edit history)
Link to comment
Share on other sites

HI Nemo

 

the problem came by chance to my knowledge at the same time as editing file. The problem was causes by a module that contacts extern services. So my host told me.

Something I could never check or debug myself they told me too! :(

the module is a price listing module...

 

So, green lights for Presta and your tipps.

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

For me the good solution was :

 

to remplace "$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL]/u', '', $str);"

 

by "$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]\-\pL]/u', '', $str);" with a "\" after the "[\]"

 

Thanks

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...
  • 5 months later...

I am not a regex [spam-filter], but can you try removing the second opening square bracket? And the matching as well

 

$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\        this one->  [         \]-\pL]/u', '', $str);

 

 

Hello !

 

Thanks for your sharing, this solve also another issue: double slash on products URLs

 

Maybe it will be simple write

 

change line: 

 

from 

 

$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL]/u', '', $str);

 

to

 

$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\-\pL]/u', '', $str);

 

Thanks a lot !

Link to comment
Share on other sites

  • 3 weeks later...

I faced an error showing
PHP Warning:  preg_replace(): Compilation failed: missing terminating ] for character class at offset 3 in /tools/smarty/plugins/modifier.regex_replace.php on line 32

Does anyone have faced this problem? Any help will be greatly appreciated.

 

Thank you

Link to comment
Share on other sites

I faced an error showing

PHP Warning:  preg_replace(): Compilation failed: missing terminating ] for character class at offset 3 in /tools/smarty/plugins/modifier.regex_replace.php on line 32

Does anyone have faced this problem? Any help will be greatly appreciated.

 

Thank you

 

 

The php-version you are using on your server cannot handle the code, so it is a php-version error. Try to change the php-version.

 

BTW: which php-version are you using ? which Prestashop version ?

Link to comment
Share on other sites

×
×
  • Create New...