Prestashop: preg_match(): Compilation failed

Created on 17 Jun 2019  路  48Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
When I activate "user friendly url" in seo settings i got a php warning "preg_match(): Compilation failed: two named subpatterns have the same name at offset 74 in /var/www/html/classes/Dispatcher.php on line 1041,"

To Reproduce
Steps to reproduce the behavior:

Screenshots

Additionnal information
PrestaShop version: 1.7.5.1
PHP version: 7.2

1.7.5.1 BO Bug Can't Reproduce SEO & URLs

Most helpful comment

@MarouaniALA, in your log file, you have this error

PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')

This is about SQL error syntax as described by @PierreRambaud.
Thanks!

All 48 comments

Hi @MarouaniALA,

Thanks for your report.
I did not manage to reproduce the issue with PS1.7.6.0beta1 & PS1.7.5.2.
I attached a screen record
https://drive.google.com/file/d/1edWVjTF_tYi6WQqL5aGy4lvynMYIsXmI/view
Thanks to check & feedback.

Hi @khouloudbelguith

Thanks for your reply. I see that you used presta 1.7.5.2, I upgraded my prestashop but the problem persist..

@MarouaniALA, no, I'm using PS1.7.5.2.
This error is displayed when debug mode enabled?

Thanks!

@khouloudbelguith , sorry i mean 1.7.5.2.
no it appears in the apache log if i disable debug mode
Thanks

@MarouaniALA, do you have any override of the Dispatcher class?

Thanks!

@khouloudbelguith, i didn't make any manual override but i don't know if presta make it on that file.

Thanks

It's because we use the old POSIX pattern for regex. And it's removed in the latest 7.3. We will update all regex for the next release (1.7.7 because of 7.3 compliancy)

hi @PierreRambaud
can this warning make my PS go down?

No, it's just a warning, not a fatal error.
But watchout if you update to PHP7.3, it will be a fatal error.

but when i set up php optimisation, in recompilation the server goes down

What do you mean by "set up php optimisation"?

sorry i forgot to past the link https://devdocs.prestashop.com/1.7/scale/optimizations/, i followed this link for the php optimisation

And what's happened when the server goes down? what logs say?

PS Enables maintaining mode and the access log displays 503 and the error log show preg_match(): compilation but the weird that the preg_match() warning always displays in the log

A 503 is a generic code to describe 503 Service Unavailable.
We need more information. We need logs, screenshots and everything that can help you.

after searching in logs i found this exception in /PATH/TO/PRESTA/var/logs/prod.log
a syntax error while execution SQL request :

[2019-06-18 11:16:59] request.INFO: Matched route "admin_metas_index". {"route":"admin_metas_index","route_parameters":{"_controller":"PrestaShopBundle\Controller\Admin\Configure\ShopParameters\MetaController::indexAction","_legacy_controller":"AdminMeta","_legacy_link":"AdminMeta","_route":"admin_metas_index"},"request_uri":"********","method":"GET"} []
[2019-06-18 11:16:59] security.DEBUG: Read existing security token from the session. {"key":"_security_main","token_class":"Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken"} []
[2019-06-18 11:16:59] security.DEBUG: User was reloaded from a user provider. {"provider":"PrestaShopBundle\Security\Admin\EmployeeProvider","username":"
*******"} []
[2019-06-18 11:16:59] security.DEBUG: Stored the security token in the session. {"key":"_security_main"} []

You have a SQL error syntax.

yes but i didn't send any SQL request manually what will cause this syntax error

@MarouaniALA, in your log file, you have this error

PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')

This is about SQL error syntax as described by @PierreRambaud.
Thanks!

yes I know that it is a syntax error, but did you know what can cause this error?

@MarouaniALA, what is the exact version of MariaDB did you use?

Thanks!

@khouloudbelguith mariadb Ver 15.1 Distrib 10.1.38-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

@MarouaniALA, could you please try to upgrade you MariaDB version 10.3.10, https://downloads.mariadb.org/mariadb/+releases/
It could be a MariaDB issue.
Thanks to check & feedback.

I don't think that this is the problem, the syntax error is that the request doesn't contain the id shop

SELECT m.id_meta, m.page, l.title, l.url_rewrite FROM ps_meta m INNER JOIN ps_meta_lang l ON m.id_meta = l.id_meta WHERE (l.id_lang=3) AND (l.id_shop=) AND (m.configurable=1) ORDER BY id_meta asc LIMIT 50 OFFSET 0

@MarouaniALA, could you please run this SQL request

Select * from ps_meta_lang where id_lang = 3

image

and provide me the exact result

Thanks!

@khouloudbelguith There is no error with this request

image

image

image
image

image
image

image

@MarouaniALA, so did you use the multishop context?
Thanks!

@khouloudbelguith, no i didn't.

@MarouaniALA, but in the last screenshots, you have different shop ids? is it?

Thanks!

@khouloudbelguith yes but it's disabled

@MarouaniALA, thanks for your feedback, I'm trying to reproduce the issue on my local.
When debug mode is enabled, try to navigate to the BO => Shop Parameters => Traffic & SEO page, is there any exception displayed?

Thanks!

@khouloudbelguith there is no exception!
image

@MarouaniALA, this SQL request

SELECT m.id_meta, m.page, l.title, l.url_rewrite FROM ps_meta m INNER JOIN ps_meta_lang l ON m.id_meta = l.id_meta WHERE (l.id_lang=3) AND (l.id_shop= 1) AND (m.configurable=1) ORDER BY id_meta asc LIMIT 50 OFFSET 0

image

is called on this page.

yes it is
image

@MarouaniALA, could you please provide me the new log file generated.

Thanks!

now there is no problem, log doesn't change

@MarouaniALA, so yesterday, this log "PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1064" is displayed also in your log file?

@khouloudbelguith , no but got an other error related to related to Doctrine exception and that causes my site also goes in maintaining mode

@MarouaniALA, have you any errors in your BO => Advanced Parameters => Logs page?
image

Thanks!

@khouloudbelguith no i don't have any error!

But this error
request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\DBALException: "An exception occurred while executing 'SELECT l., e.email, CONCAT(e.firstname, ' ', e.lastname) as employee FROM ps_log l LEFT JOIN ps_employee e ON l.id_employee = e.id_employee WHERE (severity LIKE :severity) AND (l.date_add BETWEEN :date_from AND :date_to) ORDER BY severity desc LIMIT 100 OFFSET 0' with params ["2019-06-18", "2019-06-19"]: Value for :severity not found in params array. Params array key should be "severity"" at
is related to the Logs page.

Thanks!

you can see the date of last error

image

@MarouaniALA, it is for 3 weeks later & now do you have the same error in your Logs page?

Thanks!

@khouloudbelguith no the last date of an error in the log page is 2019-05-27 16:47

@MarouaniALA, thanks for your feedback.
In my case, I did not manage to reproduce the issue with PS1.7.6.0beta1 & PS1.7.5.2 branch PS1.7.6.x.
ping @sarahdib could you please try to reproduce the issue?

Thanks!

Hello @MarouaniALA

Like @khouloudbelguith i didn't manage to reproduce. I activate multistore and disable it and try to activate friendly URL and it's working.

Thanks

Hi @MarouaniALA,

Despite our several trials, we could not reproduce your issue with the provided information.
It seems that your issue is not a PrestaShop's core bug but most likely a server configuration or customization problem.
I invite you to contact our support team: http://addons.prestashop.com/en/388-support to help you solve your issue.

Thanks for your understanding!

I have the same message, but I activated the debug mode, is there a link between them? Is it normal if debug activated?

Was this page helpful?
0 / 5 - 0 ratings