dmitry          Tue Jul 10 09:11:35 2007 UTC

  Modified files:              
    /php-src/ext/pcre   php_pcre.c 
    /php-src/ext/pcre/tests     bug21732.phpt 
  Log:
  Fixed preg_replace_callback() with callback defined by array
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/php_pcre.c?r1=1.214&r2=1.215&diff_format=u
Index: php-src/ext/pcre/php_pcre.c
diff -u php-src/ext/pcre/php_pcre.c:1.214 php-src/ext/pcre/php_pcre.c:1.215
--- php-src/ext/pcre/php_pcre.c:1.214   Fri Jul  6 23:06:51 2007
+++ php-src/ext/pcre/php_pcre.c Tue Jul 10 09:11:35 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_pcre.c,v 1.214 2007/07/06 23:06:51 dmitry Exp $ */
+/* $Id: php_pcre.c,v 1.215 2007/07/10 09:11:35 dmitry Exp $ */
 
 /*  TODO
  *  php_pcre_replace_impl():
@@ -1422,7 +1422,9 @@
        }
 
        if (is_callable_replace) {
-               convert_to_text(replace);
+               if (Z_TYPE_P(replace) != IS_ARRAY) {
+                       convert_to_text(replace);
+               }
                if (!zend_is_callable(replace, 0, &callback_name)) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires 
argument 2, '%R', to be a valid callback", Z_TYPE(callback_name), 
Z_UNIVAL(callback_name));
                        zval_dtor(&callback_name);
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/bug21732.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/pcre/tests/bug21732.phpt
diff -u php-src/ext/pcre/tests/bug21732.phpt:1.2 
php-src/ext/pcre/tests/bug21732.phpt:1.3
--- php-src/ext/pcre/tests/bug21732.phpt:1.2    Thu Jan 23 18:48:43 2003
+++ php-src/ext/pcre/tests/bug21732.phpt        Tue Jul 10 09:11:35 2007
@@ -27,3 +27,16 @@
   string(1) "e"
 }
 string(4) "yes!"
+--UEXPECT--
+bool(false)
+array(4) {
+  [0]=>
+  unicode(5) "abcde"
+  [1]=>
+  unicode(2) "ab"
+  [2]=>
+  unicode(2) "cd"
+  [3]=>
+  unicode(1) "e"
+}
+unicode(4) "yes!"

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to