From: Christoph M. Becker Date: Thu, 28 Jul 2016 13:35:56 +0000 (+0200) Subject: Merge branch 'PHP-7.0' into PHP-7.1 X-Git-Tag: php-7.1.0beta2~42 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=de755310b49dbf06dd03f7bf54c4377c37c7306b;p=php Merge branch 'PHP-7.0' into PHP-7.1 # Resolved conflicts: # ext/mbstring/php_mbregex.c --- de755310b49dbf06dd03f7bf54c4377c37c7306b diff --cc NEWS index 1e346f0640,63ffcee192..55258ed69e --- a/NEWS +++ b/NEWS @@@ -23,12 -61,14 +23,14 @@@ PH - mbstring: . Fixed bug #72691 (mb_ereg_search raises a warning if a match zero-width). (cmb) - . Fixed Bug #72693 (mb_ereg_search increments search position when a match + . Fixed bug #72693 (mb_ereg_search increments search position when a match zero-width). (cmb) + . Fixed bug #72694 (mb_ereg_search_setpos does not accept a string's last + position). (cmb) -- Opcache: - . Fixed bug #72590 (Opcache restart with kill_all_lockers does not work). - (Keyur) +- Mysqlnd: + . Fixed bug #71863 (Segfault when EXPLAIN with "Unknown column" error when + using MariaDB). (Andrey) - PCRE: . Fixed bug #72688 (preg_match missing group names in matches). (cmb) diff --cc ext/mbstring/php_mbregex.c index 3b5e857289,fc0b1d43e2..fd103abf19 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@@ -1441,12 -1408,7 +1441,12 @@@ PHP_FUNCTION(mb_ereg_search_setpos return; } + /* Accept negative position if length of search string can be determined */ + if ((position < 0) && (!Z_ISUNDEF(MBREX(search_str))) && (Z_TYPE(MBREX(search_str)) == IS_STRING)) { + position += Z_STRLEN(MBREX(search_str)); + } + - if (position < 0 || (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING && (size_t)position >= Z_STRLEN(MBREX(search_str)))) { + if (position < 0 || (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING && (size_t)position > Z_STRLEN(MBREX(search_str)))) { php_error_docref(NULL, E_WARNING, "Position is out of range"); MBREX(search_pos) = 0; RETURN_FALSE; diff --cc ext/mbstring/tests/mb_ereg_search_setpos.phpt index ec354309f3,0000000000..0a4c18473b mode 100644,000000..100644 --- a/ext/mbstring/tests/mb_ereg_search_setpos.phpt +++ b/ext/mbstring/tests/mb_ereg_search_setpos.phpt @@@ -1,70 -1,0 +1,70 @@@ +--TEST-- +mb_ereg_search_setpos() function +--SKIPIF-- + +--FILE-- + +==DONE== +--EXPECTF-- +bool(true) + +Warning: mb_ereg_search_setpos(): Position is out of range in %s on line %d +bool(false) + +* Position: 5 : +bool(true) +int(5) + - * Position: 19 : ++* Position: 20 : +bool(true) - int(19) ++int(20) + - * Position: 20 : ++* Position: 21 : + +Warning: mb_ereg_search_setpos(): Position is out of range in %s on line %d +bool(false) +int(0) + +* Position: 25 : + +Warning: mb_ereg_search_setpos(): Position is out of range in %s on line %d +bool(false) +int(0) + +* Position: 0 : +bool(true) +int(0) + +* Position: -5 : +bool(true) +int(15) + +* Position: -20 : +bool(true) +int(0) + +* Position: -30 : + +Warning: mb_ereg_search_setpos(): Position is out of range in %s on line %d +bool(false) +int(0) +==DONE== + +