|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-01-16 13:56 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
-Assigned To:
+Assigned To: cmb
[2017-01-16 13:56 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 08 01:00:02 2025 UTC |
Description: ------------ Optional patterns, if not matched, seem to return NULL instead of empty strings in certain situations. Test script: --------------- var_dump([preg_match("!([a-z]+)://([^@]+@)?([a-z]+)!", "http://domain", $matches), $matches]); Expected result: ---------------- array(2) { [0]=> int(1) [1]=> array(4) { [0]=> string(13) "http://domain" [1]=> string(4) "http" [2]=> string(0) "" [3]=> string(6) "domain" } } Actual result: -------------- array(2) { [0]=> int(1) [1]=> array(4) { [0]=> string(13) "http://domain" [1]=> string(4) "http" [2]=> NULL [3]=> string(6) "domain" } }