mollie / thirtybees

Mollie Payments module for thirty bees, a fork of Prestashop
BSD 2-Clause "Simplified" License
3 stars 0 forks source link

Notice about how it is checking overrides #2

Open Smiles-v opened 4 years ago

Smiles-v commented 4 years ago

Expected behavior

Opening the module from the BO causes this error to be shown. We found this error in ThirtyBees 1.1.0 but expect it also to be happening in Prestashop.

Actual behavior

Warning op lijn 5392 in bestand /var/www/vhosts/shopurl.com/httpdocs/modules/mollie/mollie.php [2] preg_match(): Compilation failed: syntax error in subpattern name (missing terminator) at offset 40

Steps to reproduce the behavior

Disable debugging mode under caching (advanced parameters -> performance)

Environment

willemstuursma commented 4 years ago

Hi @Smiles-v. Is it possible for you to retrieve the file and the contents of line 5392?

The only pregmatch() in this lib is: ```'/^[a-z]{2}(?:[-][A-Z]{2})?$/iu'```

I tested it: https://3v4l.org/lWV0N. Works fine in all PHP versions.

I guess the escaping is not completely there, it could be improved:

'/^[a-z]{2}(?:[\\-_][A-Z]{2})?$/iu'

Weirdly the pattern is only 32 chars not 40 as in the error.

Smiles-v commented 4 years ago

Sure.

line 5295 if (preg_match($pattern, $content, $m)) {

Please notice I use Mollie module PS version: 3.4.6

Smiles-v commented 4 years ago

Send you an email with the file.

willemstuursma commented 4 years ago

Ok, the pattern there is:

$pattern = '#\W((abstract\s+)?class|interface)\s+(?P' . $this->display(__FILE__, 'views/templates/front/classname.tpl') . basename($file, '.php').'(?:Core)?)'.'(?:\s+extends\s+'.$namespacePattern.'[a-z][a-z0-9_]*)?(?:\s+implements\s+'.$namespacePattern.'[a-z][\\a-z0-9_]*(?:\s*,\s*'.$namespacePattern.'[a-z][\\a-z0-9_]*)*)?\s*\{#i';
willemstuursma commented 4 years ago

That's not from our library. I'm not sure what we can do here.

Dh42 commented 4 years ago

Where is it from? I can see it in the library.

https://github.com/mollie/PrestaShop/blob/master/mollie.php#L5403

willemstuursma commented 4 years ago

Oh I must have missed that one!