com php-src: Merge remote-tracking branch 'origin/PHP-5.6' into str_size_and_int64_56_backport: Zend/zend _exceptions.c
ext/pdo_firebird/firebird_driver.c ext/pdo_firebird/pdo_firebird.c ext/standard/string.c ext/standard/tests/strings/substr_compare.phpt
| From: | Anatol Belski | Date: | Wed, 09 Apr 2014 09:04:50 +0000 |
| Subject: | com php-src: Merge remote-tracking branch 'origin/PHP-5.6' into str_size_and_int64_56_backport: Zend/zend _exceptions.c ext/pdo_firebird/firebird_driver.c ext/pdo_firebird/pdo_firebird.c ext/standard/string.c ext/standard/tests/strings/substr_compare.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-76732@lists.php.net to get a copy of this message | ||
Commit: abad64c50e0ab36d23be4feb465fb5b3a8099a36
Author: Anatol Belski <ab@php.net> Wed, 9 Apr 2014 11:04:50 +0200
Parents: d308724d199d0a2742cd7477e97eac4eb97e9662 2cdf38b7a0a9c697885f9fdfb3d5f04f5186a3ec
Branches: str_size_and_int64_56_backport
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=abad64c50e0ab36d23be4feb465fb5b3a8099a36
Log:
Merge remote-tracking branch 'origin/PHP-5.6' into str_size_and_int64_56_backport
* origin/PHP-5.6:
Updated NEWS for #67043
Fixed bug 67043
cleanup
Fixes bug #66071: isc_interprete is unsafe and deprecated , it is replaced with fb_iterpret
updated libs versions
fixed the test for ICI >= 52.1
Fix Linux specific fail in error traces Linux apparently does not like memcpy in overlapping
regions....
add missing skip to the output, so we actually skip this test
fix the test according to how new date code does it
fix to work on different ICU versions
multibytes tests still fail, put them in XFAIL
Conflicts:
ext/standard/string.c
Bugs:
https://bugs.php.net/67043
https://bugs.php.net/66071
Changed paths:
MM Zend/zend_exceptions.c
MM ext/pdo_firebird/firebird_driver.c
MM ext/pdo_firebird/pdo_firebird.c
MM ext/standard/string.c
MM ext/standard/tests/strings/substr_compare.phpt
Diff:
diff --cc ext/pdo_firebird/firebird_driver.c
index 7052b3f,72595de..736a364
--- a/ext/pdo_firebird/firebird_driver.c
+++ b/ext/pdo_firebird/firebird_driver.c
@@@ -607,14 -607,14 +607,14 @@@ static int firebird_handle_get_attribut
static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS_DC)
/* {{{ */
{
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
- ISC_STATUS *s = H->isc_status;
+ const ISC_STATUS *s = H->isc_status;
char buf[400];
- long i = 0, l, sqlcode = isc_sqlcode(s);
+ php_int_t i = 0, l, sqlcode = isc_sqlcode(s);
if (sqlcode) {
- add_next_index_long(info, sqlcode);
+ add_next_index_int(info, sqlcode);
- while ((l = isc_interprete(&buf[i],&s))) {
+ while ((sizeof(buf)>(i+2))&&(l = fb_interpret(&buf[i],(sizeof(buf)-i-2),&s)))
{
i += l;
strcpy(&buf[i++], " ");
}
diff --cc ext/standard/string.c
index a98cbe9,9139906..c47b144
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@@ -5584,17 -5582,22 +5584,22 @@@ PHP_FUNCTION(strpbrk
PHP_FUNCTION(substr_compare)
{
char *s1, *s2;
- int s1_len, s2_len;
- long offset, len=0;
+ php_size_t s1_len, s2_len;
+ php_int_t offset, len=0;
zend_bool cs=0;
+ uint cmp_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl|lb", &s1, &s1_len,
&s2, &s2_len, &offset, &len, &cs) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSi|ib", &s1, &s1_len,
&s2, &s2_len, &offset, &len, &cs) == FAILURE) {
RETURN_FALSE;
}
- if (ZEND_NUM_ARGS() >= 4 && len < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length must be greater than or equal to
zero");
- RETURN_FALSE;
+ if (ZEND_NUM_ARGS() >= 4 && len <= 0) {
+ if (len == 0) {
- RETURN_LONG(0L);
++ RETURN_INT(0L);
+ } else {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length must be greater than or equal to
zero");
+ RETURN_FALSE;
+ }
}
if (offset < 0) {
@@@ -5607,10 -5610,12 +5612,12 @@@
RETURN_FALSE;
}
+ cmp_len = (uint) (len ? len : MAX(s2_len, (s1_len - offset)));
+
if (!cs) {
- RETURN_INT(zend_binary_strncmp(s1 + offset, (s1_len - offset), s2, s2_len, (php_size_t)len));
- RETURN_LONG(zend_binary_strncmp(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len));
++ RETURN_INT(zend_binary_strncmp(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len));
} else {
- RETURN_INT(zend_binary_strncasecmp_l(s1 + offset, (s1_len - offset), s2, s2_len,
(php_size_t)len));
- RETURN_LONG(zend_binary_strncasecmp_l(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len));
++ RETURN_INT(zend_binary_strncasecmp_l(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len));
}
}
/* }}} */