docrun Posted September 15, 2014 Share Posted September 15, 2014 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 1 Link to comment Share on other sites More sharing options...
docrun Posted September 15, 2014 Author Share Posted September 15, 2014 Who can Help. Link to comment Share on other sites More sharing options...
NemoPS Posted September 15, 2014 Share Posted September 15, 2014 How does that line look exactly? Link to comment Share on other sites More sharing options...
vekia Posted September 15, 2014 Share Posted September 15, 2014 where you see this error? on what page? 1 Link to comment Share on other sites More sharing options...
Mike Rafael Jr. Posted September 16, 2014 Share Posted September 16, 2014 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 Link to comment Share on other sites More sharing options...
mbrodrigues Posted September 26, 2014 Share Posted September 26, 2014 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 More sharing options...
NemoPS Posted September 26, 2014 Share Posted September 26, 2014 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); 5 Link to comment Share on other sites More sharing options...
jaychennai Posted October 8, 2014 Share Posted October 8, 2014 this should be reported as bug , even i had this issue and thanks to Nemo it got solved 1 Link to comment Share on other sites More sharing options...
Luis 00 Posted January 9, 2015 Share Posted January 9, 2015 Hello I have now the same issue but I can't fix it with your recommendations, are there something else that I can do. Thank you Link to comment Share on other sites More sharing options...
NemoPS Posted January 10, 2015 Share Posted January 10, 2015 Same preg_replace issue? Can your post that line spawning the error? 1 Link to comment Share on other sites More sharing options...
Luis 00 Posted January 12, 2015 Share Posted January 12, 2015 Same preg_replace issue? Can your post that line spawning the error? Thank you Nemo, I've already resolved this issue with your past post. Regards Link to comment Share on other sites More sharing options...
picrasma Posted January 15, 2015 Share Posted January 15, 2015 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 More sharing options...
NemoPS Posted January 16, 2015 Share Posted January 16, 2015 Hi there, could you please share that line of tools.php? Link to comment Share on other sites More sharing options...
picrasma Posted January 16, 2015 Share Posted January 16, 2015 Hi Nimo, Thanks for your reply. Somehow it got resolved by, consider this post closed. Thanks Link to comment Share on other sites More sharing options...
deli-cart Posted March 18, 2015 Share Posted March 18, 2015 Had the same issuse, solved it with Nemo's method, thank you! here is the link for the post: https://www.prestashop.com/forums/topic/359686-php-warning-preg-replace-compilation-failed/?p=1811893 Link to comment Share on other sites More sharing options...
needhelpguys Posted April 7, 2015 Share Posted April 7, 2015 have same problem here Warning: preg_replace() [function.preg-replace]: Compilation failed: invalid range in character class at offset 24 in [...]classes/Tools.php on line 990 what exactly I need to change? Link to comment Share on other sites More sharing options...
NemoPS Posted April 8, 2015 Share Posted April 8, 2015 Did you try what I suggested above, already? https://www.prestashop.com/forums/topic/359686-php-warning-preg-replace-compilation-failed/?p=1811893 Link to comment Share on other sites More sharing options...
needhelpguys Posted April 8, 2015 Share Posted April 8, 2015 (edited) please fix for me, i dont know... have try but dont working :-( Tools.php Edited April 8, 2015 by needhelpguys (see edit history) Link to comment Share on other sites More sharing options...
needhelpguys Posted April 8, 2015 Share Posted April 8, 2015 i have fix, all ok Link to comment Share on other sites More sharing options...
Kornblume Posted May 23, 2015 Share Posted May 23, 2015 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 More sharing options...
NemoPS Posted May 25, 2015 Share Posted May 25, 2015 You might be adding a spelling mistake, turn on dev mode when you do Link to comment Share on other sites More sharing options...
Kornblume Posted May 25, 2015 Share Posted May 25, 2015 (edited) 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 May 25, 2015 by Kornblume (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted May 27, 2015 Share Posted May 27, 2015 So no error displaying, just blank page, even with debug mode enabled?Errors might be disabled server-wise, can you check that? Or maybe upload a broken file and see if the error is displayed Link to comment Share on other sites More sharing options...
Kornblume Posted May 31, 2015 Share Posted May 31, 2015 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 More sharing options...
vincent_g Posted June 8, 2015 Share Posted June 8, 2015 This is a PHP problem Unless a rep of the company has a fix for it then just set your version to of PHP to 5.2 and the error is no more. 2 Link to comment Share on other sites More sharing options...
rider3i1 Posted August 3, 2015 Share Posted August 3, 2015 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 3 1 Link to comment Share on other sites More sharing options...
Yenibosnaweb Posted January 30, 2017 Share Posted January 30, 2017 This is a PHP problem Unless a rep of the company has a fix for it then just set your version to of PHP to 5.2 and the error is no more. This is solution thanks Link to comment Share on other sites More sharing options...
Gipielle Posted July 10, 2017 Share Posted July 10, 2017 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 More sharing options...
alisha12 Posted July 28, 2017 Share Posted July 28, 2017 I faced an error showingPHP 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 More sharing options...
selectshop.at Posted July 28, 2017 Share Posted July 28, 2017 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 More sharing options...
Recommended Posts