Bug #80569 [NEW]: preg_match no empty (null or "") values in matches
| From: | shardlow dot a at gmail dot com | Date: | Thu, 31 Dec 2020 17:08:08 +0000 |
| Subject: | Bug #80569 [NEW]: preg_match no empty (null or "") values in matches | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-231321@lists.php.net to get a copy of this message | ||
From: shardlow dot a at gmail dot com
Operating system: OSX Catalina
PHP version: 7.4.13
Package: *Regular Expressions
Bug Type: Bug
Bug description:preg_match no empty (null or "") values in matches
Description:
------------
---
From manual page: https://php.net/function.preg-match
---
Test script:
---------------
//print_r($_GET);
//$value = '1:2.3';
//$value = '1:2';
$value = '2';
$matches = '';
preg_match('/^(\d{1,2}:)?(\d{1,2})(\.\d{1,2})?$/', $value,
$matches);
echo '<br>';
echo '<br>';
print_r($matches);
echo '<br>';
echo phpversion();
Expected result:
----------------
Array ( [0] => 2 [1] => [2] => 2 [3]=>)
7.3.11
Actual result:
--------------
Array ( [0] => 2 [1] => [2] => 2 )
7.3.11
--
Edit bug report at https://bugs.php.net/bug.php?id=80569&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80569&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80569&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80569&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80569&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80569&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80569&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80569&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80569&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80569&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80569&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80569&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80569&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80569&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80569&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80569&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80569&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80569&r=mysqlcfg