PHP > v7.2.18 preg_match returns 2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

just found out, that function preg_match() returns not only 1 or boolean values. I did not find any documentation about
some changes of this method and also the documentation is still the same. So either there are undocumented changes or it
is a small bug.

Documentation: https://www.php.net/manual/en/function.preg-match.php#refsect1-function.preg-match-returnvalues

Tested locally with PHP 7.3.11-1+0~20191026.48+debian10~1.gbpf71ca0

    <?php
    var_dump(preg_match('/^|\d{1,2}$/', "7"));  // expected: int(1), got: int(2)


Also a small test at http://sandbox.onlinephpfunctions.com/ showed a result change between PHP v7.2.18 and v7.3.5. I
have checked the bugs and the changelog but could not find any notes.

Best regards,

Falko



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux