jani Mon Oct 1 13:41:57 2007 UTC Modified files: /php-src/ext/standard string.c Log: MFB: fix bug #42142 and cs+ws http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.652&r2=1.653&diff_format=u Index: php-src/ext/standard/string.c diff -u php-src/ext/standard/string.c:1.652 php-src/ext/standard/string.c:1.653 --- php-src/ext/standard/string.c:1.652 Mon Oct 1 12:04:09 2007 +++ php-src/ext/standard/string.c Mon Oct 1 13:41:57 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.652 2007/10/01 12:04:09 jani Exp $ */ +/* $Id: string.c,v 1.653 2007/10/01 13:41:57 jani Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -3317,7 +3317,7 @@ if (*f > str_codepts || (*f < 0 && -(*f) > str_codepts)) { ret = 0; } else if (*l > str_codepts || (*l < 0 && -(*l) > str_codepts)) { - ret = 0; + *l = str_codepts; } if (((unsigned)(*f) + (unsigned)(*l)) > str_codepts) { *l = str_codepts - *f; @@ -3414,6 +3414,7 @@ f = Z_LVAL_PP(from); } if (argc > 3) { + SEPARATE_ZVAL(len); if (Z_TYPE_PP(len) != IS_ARRAY) { convert_to_long_ex(len); l = Z_LVAL_PP(len); @@ -3425,8 +3426,10 @@ } if (Z_TYPE_PP(str) != IS_ARRAY) { - if ( (argc == 3 && Z_TYPE_PP(from) == IS_ARRAY) || - (argc == 4 && Z_TYPE_PP(from) != Z_TYPE_PP(len)) ) { + if ( + (argc == 3 && Z_TYPE_PP(from) == IS_ARRAY) || + (argc == 4 && Z_TYPE_PP(from) != Z_TYPE_PP(len)) + ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "'from' and 'len' should be of same type - numerical or array"); RETURN_ZVAL(*str, 1, 0); } @@ -3438,7 +3441,6 @@ } } - if (Z_TYPE_PP(str) != IS_ARRAY) { if (Z_TYPE_PP(from) != IS_ARRAY ) { if (Z_TYPE_PP(repl) == IS_ARRAY) { @@ -7919,12 +7921,12 @@ offset = (offset < 0) ? 0 : offset; } - if(offset > s1_len) { + if (offset > s1_len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The start position cannot exceed initial string length"); RETURN_FALSE; } - if(len > s1_len - offset) { + if (len > s1_len - offset) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The specified segment exceeds string length"); RETURN_FALSE; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php