andrei Tue Jan 13 19:23:31 2009 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/pcre php_pcre.c
Log:
Fix bug #44336 in PHP 5.2 as well.
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/php_pcre.c?r1=1.168.2.9.2.29&r2=1.168.2.9.2.30&diff_format=u
Index: php-src/ext/pcre/php_pcre.c
diff -u php-src/ext/pcre/php_pcre.c:1.168.2.9.2.29
php-src/ext/pcre/php_pcre.c:1.168.2.9.2.30
--- php-src/ext/pcre/php_pcre.c:1.168.2.9.2.29 Wed Dec 31 11:17:41 2008
+++ php-src/ext/pcre/php_pcre.c Tue Jan 13 19:23:31 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pcre.c,v 1.168.2.9.2.29 2008/12/31 11:17:41 sebastian Exp $ */
+/* $Id: php_pcre.c,v 1.168.2.9.2.30 2009/01/13 19:23:31 andrei Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -48,7 +48,8 @@
PHP_PCRE_INTERNAL_ERROR,
PHP_PCRE_BACKTRACK_LIMIT_ERROR,
PHP_PCRE_RECURSION_LIMIT_ERROR,
- PHP_PCRE_BAD_UTF8_ERROR
+ PHP_PCRE_BAD_UTF8_ERROR,
+ PHP_PCRE_BAD_UTF8_OFFSET_ERROR
};
@@ -72,6 +73,10 @@
preg_code = PHP_PCRE_BAD_UTF8_ERROR;
break;
+ case PCRE_ERROR_BADUTF8_OFFSET:
+ preg_code = PHP_PCRE_BAD_UTF8_OFFSET_ERROR;
+ break;
+
default:
preg_code = PHP_PCRE_INTERNAL_ERROR;
break;
@@ -145,6 +150,7 @@
REGISTER_LONG_CONSTANT("PREG_BACKTRACK_LIMIT_ERROR",
PHP_PCRE_BACKTRACK_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PREG_RECURSION_LIMIT_ERROR",
PHP_PCRE_RECURSION_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PREG_BAD_UTF8_ERROR", PHP_PCRE_BAD_UTF8_ERROR,
CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PREG_BAD_UTF8_OFFSET_ERROR",
PHP_PCRE_BAD_UTF8_OFFSET_ERROR, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("PCRE_VERSION", (char *)pcre_version(),
CONST_CS | CONST_PERSISTENT);
return SUCCESS;
@@ -615,6 +621,9 @@
count = pcre_exec(pce->re, extra, subject, subject_len,
start_offset,
exoptions|g_notempty,
offsets, size_offsets);
+ /* the string was already proved to be valid UTF-8 */
+ exoptions |= PCRE_NO_UTF8_CHECK;
+
/* Check for too many substrings condition. */
if (count == 0) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Matched,
but too many substrings");
@@ -1036,6 +1045,9 @@
count = pcre_exec(pce->re, extra, subject, subject_len,
start_offset,
exoptions|g_notempty,
offsets, size_offsets);
+ /* the string was already proved to be valid UTF-8 */
+ exoptions |= PCRE_NO_UTF8_CHECK;
+
/* Check for too many substrings condition. */
if (count == 0) {
php_error_docref(NULL TSRMLS_CC,E_NOTICE, "Matched, but
too many substrings");
@@ -1473,6 +1485,9 @@
subject_len, start_offset,
exoptions|g_notempty,
offsets, size_offsets);
+ /* the string was already proved to be valid UTF-8 */
+ exoptions |= PCRE_NO_UTF8_CHECK;
+
/* Check for too many substrings condition. */
if (count == 0) {
php_error_docref(NULL TSRMLS_CC,E_NOTICE, "Matched, but
too many substrings");
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php