|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-07-28 13:04 UTC] cmb@php.net
-Status: Open
+Status: Verified
-Assigned To:
+Assigned To: cmb
[2016-07-28 13:04 UTC] cmb@php.net
[2016-07-28 13:58 UTC] cmb@php.net
[2016-07-28 13:58 UTC] cmb@php.net
-Status: Verified
+Status: Closed
[2016-07-28 14:01 UTC] cmb@php.net
[2016-10-17 10:10 UTC] bwoebi@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 11:00:01 2025 UTC |
Description: ------------ When calling `mb_ereg_search_setpos` with the end position of a string as argument, it raises a warning and returns false and resets the search position to zero. This prevents `mb_ereg_search` to match at the end of the string (for example zero-width assertions like '\Z', '$' or lookbehinds). The correct behavior should be to not throw a warning, and set the position accordingly. What's more, once you call `mb_ereg_search_setpos(strlen($str))`, the `mb_ereg_search` behavior seems to be erratic, see the test script, where the '\Z' assertion matches and sets position to 3 eventhough `mb_ereg_search_getpos` just returned 0 ! Test script: --------------- mb_ereg_search_init('foo'); var_dump(mb_ereg_search_setpos(3)); var_dump(mb_ereg_search_getpos()); var_dump(mb_ereg_search('\Z')); var_dump(mb_ereg_search_getpos()); Expected result: ---------------- bool(true) int(3) bool(true) int(3) Actual result: -------------- Warning: mb_ereg_search_setpos(): Position is out of range in ... bool(false) int(0) Warning: mb_ereg_search(): Empty regular expression in ... bool(true) int(3)