Bug #81424 [Fbk->Opn]: Since PCRE 10.35, pc
| From: | nospam at briat dot org | Date: | Tue, 07 Sep 2021 21:02:28 +0000 |
| Subject: | Bug #81424 [Fbk->Opn]: Since PCRE 10.35, pc | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236449@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81424&edit=1
ID: 81424
User updated by: nospam at briat dot org
Reported by: nospam at briat dot org
Summary: Since PCRE 10.35, pc
-Status: Feedback
+Status: Open
Type: Bug
Package: PCRE related
Operating System: linux (centos,WSL docker alpine)
PHP Version: 7.3Git-2021-09-07 (snap)
Block user comment: N
Private report: N
New Comment:
Yes sorry, it' goes up to 7.4.23 and 8.0.8.
Previous Comments:
------------------------------------------------------------------------
[2021-09-07 20:37:17] dharman@php.net
PHP 7.3 isn't actively maintained anymore. Do you see this problem with PHP 7.4.23 or with PHP
8.0.10? If the problem can't be reproduced with active PHP versions then I think this bug
report should be closed. The issue could have been fixed in the meantime.
------------------------------------------------------------------------
[2021-09-07 17:11:14] nospam at briat dot org
Description:
------------
When debugging a sudden slow down (20 time slow) in https://www.drupal.org/project/advagg module for
Drupal 7 which use this cssmin.php v2.4.8-4, I discover that its massive uses of preg_replace was
the core of the problem.
I notice that I have the problem with some versions of PHP:
PHP 7.3.27-9+0~20210227.82+debian9~1.gbpa4a3d6 (cli) (built: Feb 27 2021 15:51:31) or
php:7.4.12-cli-alpine
but not with PHP 7.3.12 (cli) (built: Nov 22 2019 16:32:31) ( NTS ) or php:7.4.11-cli-alpine
I made a small script that run different version of php with docker and the gap occur on
php:7.4.12-cli-alpine or +.
Since it not quite related to the PHP version, I could be related to the PCRE Library Version 10.35
or + or the #81243.
Test script:
---------------
# Create a huge css file with one selector of 15k char on the first line
# following by some rules
composer require tubalmartin/cssmin
<?php
require './vendor/autoload.php';
use tubalmartin\CssMin\Minifier as CSSmin;
$my_cssmin = new CSSmin(true);
$data = file_get_contents('test.css');
$time_start = microtime(true);
$data = $my_cssmin->run($data, 4096);
echo PHP_EOL . strlen($data) . ' char. in ' . ( microtime(true) - $time_start ) .
's.' . PHP_EOL;
Expected result:
----------------
the two docker executions should have similar execution times
Actual result:
--------------
docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp
php:7.4.11-cli-alpine php test.php
17091 char. in 0.0034229755401611s.
docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp
php:7.4.11-cli-alpine php -i |egrep "(PCRE|reg)"
register_argc_argv => On => On
Multibyte (japanese) regex support => enabled
Multibyte regex (oniguruma) version => 6.9.5
mbstring.regex_retry_limit => 1000000 => 1000000
mbstring.regex_stack_limit => 100000 => 100000
PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 10.34 2019-11-21
PCRE Unicode Version => 12.1.0
PCRE JIT Support => enabled
PCRE JIT Target => x86 64bit (little endian + unaligned)
Phar fully realized by Gregory Beaver and Marcus Boerger.
docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp
php:7.4.12-cli-alpine php test.php
lorem: 17091char. in 0.20809006690979s.
docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp
php:7.4.12-cli-alpine php -i |egrep "(PCRE|reg)"
register_argc_argv => On => On
Multibyte (japanese) regex support => enabled
Multibyte regex (oniguruma) version => 6.9.5
mbstring.regex_retry_limit => 1000000 => 1000000
mbstring.regex_stack_limit => 100000 => 100000
PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 10.35 2020-05-09
PCRE Unicode Version => 13.0.0
PCRE JIT Support => enabled
PCRE JIT Target => x86 64bit (little endian + unaligned)
Phar fully realized by Gregory Beaver and Marcus Boerger.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81424&edit=1