php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80278 RE (?:[\d\D])* and (?:[\s\S])* not working in UTF-8 mode (u)
Submitted: 2020-10-23 16:19 UTC Modified: 2020-10-27 15:01 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: vicreal at yandex dot ru Assigned: sjon (profile)
Status: Not a bug Package: PCRE related
PHP Version: 7.4.11 OS: Debian 10 x64 (4.19.132-1)
Private report: No CVE-ID: None
 [2020-10-23 16:19 UTC] vicreal at yandex dot ru
Description:
------------
Regular expressions "|(?:[\d\D])*|u" and "|(?:[\s\S])*|u" not working in UTF-8 mode: returns empty occurrence.

Test script:
---------------
$str = base64_decode('ZnVuY3Rpb24oYSl7ZnVuY3Rpb24gYigpe31mdW5jdGlvbiBjKGwpe3ZhciBtPXR5cGVvZiBsO3JldHVybiJvYmplY3QiPT09bSYmbnVsbCE9PWx8fCJmdW5jdGlvbiI9PT1tfWZ1bmN0aW9uIGQobCl7aWYoIXNhKGwsZikpe3ZhciBtPW5ldyBiO2JhKGwsZix7dmFsdWU6bX0pfX1mdW5jdGlvbiBlKGwpe3ZhciBtPU9iamVjdFtsXTttJiYoT2JqZWN0W2xdPWZ1bmN0aW9uKHIpe2lmKHIgaW5zdGFuY2VvZiBiKXJldHVybiByO2Qocik7cmV0dXJuIG0ocil9KX1pZihmdW5jdGlvbigpe2lmKCFhfHwhT2JqZWN0LnNlYWwpcmV0dXJuITE7dHJ5e3ZhciBsPU9iamVjdC5zZWFsKHt9KSxtPU9iamVjdC5zZWFsKHt9KSxyPW5ldyBhKFtbbCwyXSxbbSwzXV0pO2lmKDIhPXIuZ2V0KGwpfHwzIT1yLmdldChtKSlyZXR1cm4hMTtyLmRlbGV0ZShsKTtyLnNldChtLDQpO3JldHVybiFyLmhhcyhsKSYmND09ci5nZXQobSl9Y2F0Y2godCl7cmV0dXJuITF9fSgpKXJld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NWU5ZjU1ODYwYjBhNzQ2NjYzNDQ0NSIsY3AsbWwpICAgX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX181ZTlmNTU4NjBiMGE3NDY2NjM0NDQ1IixjcCxyYykgICBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXzVlOWY1NTg2MGIwYTc0NjY2MzQ0NDUiLGNwLHJlbCkgIGVsYSBlbGMgZWxoIGdwY2EgZ3BjciBsR0MgbFBXRiBsZGIgbWxzIG5vYW0gcGFhIHBjIHBjYSBwY20gIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fNWU5ZjU1ODYwYjBhNzQ2NjYzNDQ0NSIscHcsY2xrKSAgIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fNWU5ZjU1ODYwYjBhNzQ2NjYzNDQ0NSIscHcsaHZyKSAgcWZhYWUgcWZhYXMgcWZhYXUgcWZhZSBxZmFzIHFmYXUgcWZoaSBxbSBxcyBxc2kgcnRsIHNhIHNldENvbnRpbnVlQ2Igc25hdyBzbmN3IHNvbSBzcCBzcGQgc3BuIHNwcCBzcHMgdHNsIHRzdCAgX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX181ZTlmNTU4NjBiMGE3NDY2NjM0NDQ1Iix1cCxhZWgpICAgX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX181ZTlmNTU4NjBiMGE3NDY2NjM0NDQ1Iix1cCxhb3ApICAgX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX181ZTlmNTU4NjBiMGE3NDY2NjM0NDQ1Iix1cCxkcGMpICAgX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX181ZTlmNTU4NjBiMGE3NDY2NjM0NDQ1Iix1cCxpaWMpICAgX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX181ZTlmNTU4NjBiMGE3NDY2NjM0NDQ1Iix1cCxuYXApICAgIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fNWU5ZjU1ODYwYjBhNzQ2NjYzNDQ0NSIsX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX181ZTlmNTU4NjBiMGE3NDY2NjM0NDQ1Iix1cCx1cCksc2wpICAgX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX181ZTlmNTU4NjBiMGE3NDY2NjM0NDQ1Iix1cCxzcGQpICAgX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX181ZTlmNTU4NjBiMGE3NDY2NjM0NDQ1Iix1cCx0cCkgIHVwZWwgdXBlcyB1cGV0Ii5zcGxpdCgiICIpLmNvbmNhdChfLkhjKSxLYz0oMCxfLnApKEljLkIsSWMpLExjPTA7TGM8SmMubGVuZ3RoO0xjKyspe3ZhciBNYz0iIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fNWU5ZjU1ODYwYjBhNzQ2NjYzNDQ0NSIsZ2JhciwiK0pjW0xjXTtudWxsPT1fLndhKE1jLHdpbmRvdykmJl8ucShNYyxLYyhNYykpfV8ucSgiKSAgIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fNWU5ZjU1ODYwYjBhNzQ2NjYzNDQ0NSIsX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX181ZTlmNTU4NjBiMGE3NDY2NjM0NDQ1IixnYmFyLHVwKSxncGQpICIsZnVuY3Rpb24oKXtyZXR1cm4iIn0pOw0KdmFyIE5jPW5ldyBmdW5jdGlvbigpe3RoaXMubz1fLksoXy5FYygpLF8ud2MsOCl8fG5ldyBfLndjfTtfLnEoIiBfX19fX19fX19fX19fXzVlOWY1NTg2MGIwYTc0NjY2MzQ0NDUiLGdiYXIsYnYpICIse246Xy5BKF8uRihOYy5vLDIpKSxyOl8ueihfLkYoTmMubyw0KSksZjpfLnooXy5GKE5jLm8sMykpLGU6Xy56KF8uRihOYy5vLDUpKSxtOl8uQShfLkgoTmMubywxLDEpLDEpfSk7Xy5xKCIgX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX181ZTlmNTU4NjBiMGE3NDY2NjM0NDQ1IixnYmFyLGtuKSAiLGZ1bmN0aW9uKCl7cmV0dXJuITB9KTtfLnEoIiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXzVlOWY1NTg2MGIwYTc0NjY2MzQ0NDUiLGdiYXIsc2IpICIsZnVuY3Rpb24oKXtyZXR1cm4hMX0pOw0KfWNhdGNoKGUpe18uX0R1bXBFeGNlcHRpb24oZSl9DQp0cnl7DQpfLnEoIiBwaHA6ZnVuY3Rpb24oIl9fX19fX19fX19fX186OiIsIl9fX19fX19fX19fX19fX19fNWU5ZjU1ODYwYjBhNzQ2NjYzNDQ0NSIsZ2JhcixlbHIpICIsZnVuY3Rpb24oKXtyZXR1cm57ZXM6e2Y6MTUyLGg6NjAsbTozMH0sbW86Im1kIix2aDogX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX181ZTlmNTU4NjBiMGE3NDY2NjM0NDQ1Iix3aW5kb3csaW5uZXJIZWlnaHQpICBvciAwLHZ3OiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXzVlOWY1NTg2MGIwYTc0NjY2MzQ0NDUiLHdpbmRvdyxpbm5lcldpZHRoKSAgb3IgMH19KQ==');

Example 1 (always returns an empty occurrence)
preg_match_all("|(?:[\d\D])*|u", $str, $matches);
var_dump($matches);

Example 2 (returns an empty occurrence time after that)
ini_set('pcre.jit', 'On');  // off => work correctly
preg_match_all("|(?:[\s\S])*|u", str_repeat($str, 2), $matches);  // repeat 1 => work correctly
var_dump($matches);

Expected result:
----------------
Array
(
    [0] => Array
        (
            [0] => "(hole string)"
            [1] => ""
        )
)

Actual result:
--------------
Array
(
    [0] => Array
        (
        )
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-23 16:22 UTC] vicreal at yandex dot ru
Expected result:
----------------
Array
(
    [0] => Array
        (
            [0] => "(entire string)"
            [1] => ""
        )
)
Tested in php 7.4.10
 [2020-10-26 15:52 UTC] sjon@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: sjon
 [2020-10-26 15:52 UTC] sjon@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

I can confirm this behavior; see https://3v4l.org/c9VuW#v730 where there are no matches and https://3v4l.org/qrIOi where it does match.

However - this is not a bug - the JIT stack limit is simply reached. The reporter could check preg_last_error() which will report this properly.

This is a somewhat known issue, see https://externals.io/message/87245 and Bug #70110
 [2020-10-26 16:01 UTC] sjon@php.net
-Status: Verified +Status: Not a bug
 [2020-10-26 16:01 UTC] sjon@php.net
nab
 [2020-10-27 15:01 UTC] vicreal at yandex dot ru
Yes, indeed. The problem is PREG_JIT_STACKLIMIT_ERROR. Too bad that:
1) there are no warnings for pcre errors
2) there is no PHP-INI setting "pcre.jit_stack_max_size" (similar to "pcre.backtrack_limit" and "pcre.recursion_limit")

Discussion of the parameter PREG_JIT_STACKLIMIT_ERROR for JIT:
https://externals.io/message/87245
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Nov 28 14:01:23 2020 UTC