Bug #81424 [NEW]: Since PCRE 10.35, pc
| From: | nospam at briat dot org | Date: | Tue, 07 Sep 2021 17:11:14 +0000 |
| Subject: | Bug #81424 [NEW]: Since PCRE 10.35, pc | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-236446@lists.php.net to get a copy of this message | ||
From: nospam at briat dot org
Operating system: linux (centos,WSL docker alpine)
PHP version: 7.3Git-2021-09-07 (snap)
Package: PCRE related
Bug Type: Bug
Bug description:Since PCRE 10.35, pc
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 bug report at https://bugs.php.net/bug.php?id=81424&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81424&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81424&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81424&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81424&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81424&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81424&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81424&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81424&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81424&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81424&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81424&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81424&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81424&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81424&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81424&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81424&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81424&r=mysqlcfg