Re: com php-src: Promote warnings to errors in str_repeat(): ext/mbstring/tests/bug73646.phpt ext/opcache/tests/bug70207.phpt ext/standard/string.c
ext/standard/tests/strings/str_repeat.phpt ext/standard/tests/strings/str_repeat_variation1.phpt
| From: | Christoph M. Becker | Date: | Fri, 23 Aug 2019 21:15:02 +0000 |
| Subject: | Re: com php-src: Promote warnings to errors in str_repeat(): ext/mbstring/tests/bug73646.phpt ext/opcache/tests/bug70207.phpt ext/standard/string.c ext/standard/tests/strings/str_repeat.phpt ext/standard/tests/strings/str_repeat_variation1.phpt |
||
| References: | 1 2 3 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-108024@lists.php.net to get a copy of this message | ||
On 23.08.2019 at 20:42, G. P. B. wrote:
> On Fri, 23 Aug 2019 at 20:29, Peter Cowburn <petercowburn@gmail.com> wrote:
>
>> On Fri, 23 Aug 2019 at 19:02, George Peter Banyard <girgias@php.net>
>> wrote:
>>
>>> Commit: 1059e3dc39b65719c414ec0f31f65a77192034ab
>>> Author: George Peter Banyard <girgias@php.net> Thu, 22 Aug
>>> 2019 11:28:22 +0200
>>> Parents: bba7f38c4f8cbdbac391739b0fc905aaa8a09ce9
>>> Branches: master
>>>
>>> Link:
>>>
>>> http://git.php.net/?p=php-src.git;a=commitdiff;h=1059e3dc39b65719c414ec0f31f65a77192034ab
>>>
>>> Log:
>>> Promote warnings to errors in str_repeat()
>>>
>>> Changed paths:
>>> M ext/mbstring/tests/bug73646.phpt
>>> M ext/opcache/tests/bug70207.phpt
>>> M ext/standard/string.c
>>> M ext/standard/tests/strings/str_repeat.phpt
>>> A ext/standard/tests/strings/str_repeat_variation1.phpt
>>>
>>>
>>> Diff:
>>> diff --git a/ext/mbstring/tests/bug73646.phpt
>>> b/ext/mbstring/tests/bug73646.phpt
>>> index 7ac824d..ea57017 100644
>>> --- a/ext/mbstring/tests/bug73646.phpt
>>> +++ b/ext/mbstring/tests/bug73646.phpt
>>> @@ -7,10 +7,7 @@ if (!function_exists('mb_ereg')) die('skip mbregex
>>> support not available');
>>> ?>
>>> --FILE--
>>> <?php
>>> -
>>> -$v1=str_repeat("#", -1);
>>> -var_dump(mb_ereg_search_init($v1));
>>> +var_dump(mb_ereg_search_init(NULL));
>>>
>>
>> This no longer repeats the scenario in the original bug.
>
> Ah crap, forgot about that bit, @Christoph M. Becker <cmbecker69@gmx.de>
> did tell me that this replacement should be alright but I forgot to test it
> in PHP 7.1 (when this bug test was introduced) as I couldn't manage to
> figure out how to get PHP to compile with Oniguruma to be able to test it
> (on WSL1).
With PHP 7.1 you can use the bundled liboniguruma, which is used by
default when you configure --with-mbregex.
> From my understanding of the bug is that mb_ereg_search_init expected a
> string but didn't make any check, this seems to be resolved with the commit
> which introduced the bug test (see [1]).
Yes. In the ticket the OP mentioned later that passing a float would
trigger an illegal memory access; that happened because IS_STRING was
assumed, but not enforced.
> So what would be the best way to fix this regression test ?
As it's now, it's a ZPP test, so could even be removed.
> [1]
>
> https://git.php.net/?p=php-src.git;a=blobdiff;f=ext/mbstring/php_mbregex.c;h=50f6210b306e565ae1f9ad63834dc9020b6d064c;hp=cf341d3599a44d3ac1f9aea716a5397e43d4d14e;hb=6a43c61bcdedf54b1736e608f0919bacdba6ed00;hpb=4faa540b45fce018252cd00751d3a5002ad3d00a�dOß
> Š<tØÍ½R
Thanks,
Christoph