nikic                                    Sun, 04 Mar 2012 13:39:12 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=323862

Log:
Deprecate /e modifier

See https://wiki.php.net/rfc/remove_preg_replace_eval_modifier.

Changed paths:
    U   php/php-src/trunk/ext/pcre/php_pcre.c
    U   php/php-src/trunk/ext/pcre/tests/002.phpt
    U   php/php-src/trunk/ext/pcre/tests/004.phpt
    U   php/php-src/trunk/tests/lang/bug24403.phpt

Modified: php/php-src/trunk/ext/pcre/php_pcre.c
===================================================================
--- php/php-src/trunk/ext/pcre/php_pcre.c       2012-03-04 13:31:04 UTC (rev 
323861)
+++ php/php-src/trunk/ext/pcre/php_pcre.c       2012-03-04 13:39:12 UTC (rev 
323862)
@@ -1019,6 +1019,10 @@
                replace_end = replace + replace_len;
        }

+       if (eval) {
+               php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "The /e modifier 
is deprecated, use preg_replace_callback instead");
+       }
+
        /* Calculate the size of the offsets array, and allocate memory for it. 
*/
        rc = pcre_fullinfo(pce->re, extra, PCRE_INFO_CAPTURECOUNT, 
&num_subpats);
        if (rc < 0) {

Modified: php/php-src/trunk/ext/pcre/tests/002.phpt
===================================================================
--- php/php-src/trunk/ext/pcre/tests/002.phpt   2012-03-04 13:31:04 UTC (rev 
323861)
+++ php/php-src/trunk/ext/pcre/tests/002.phpt   2012-03-04 13:39:12 UTC (rev 
323862)
@@ -34,6 +34,8 @@
 Warning: preg_replace(): Compilation failed: missing terminating ] for 
character class at offset 8 in %s002.php on line 11
 NULL

+Deprecated: preg_replace(): The /e modifier is deprecated, use 
preg_replace_callback instead in %s on line 12
+
 Parse error: %s in %s002.php(12) : regexp code on line 1

 Fatal error: preg_replace(): Failed evaluating code:

Modified: php/php-src/trunk/ext/pcre/tests/004.phpt
===================================================================
--- php/php-src/trunk/ext/pcre/tests/004.phpt   2012-03-04 13:31:04 UTC (rev 
323861)
+++ php/php-src/trunk/ext/pcre/tests/004.phpt   2012-03-04 13:39:12 UTC (rev 
323862)
@@ -16,7 +16,7 @@

 
var_dump(preg_split('/PHP_(?:NAMED_)?(?:FUNCTION|METHOD)\s*\((\w+(?:,\s*\w+)?)\)/S',
 "PHP_FUNCTION(s, preg_match)\n{\nlalala", -1, PREG_SPLIT_DELIM_CAPTURE | 
PREG_SPLIT_OFFSET_CAPTURE));
 ?>
---EXPECT--
+--EXPECTF--
 int(2)
 array(2) {
   [0]=>
@@ -117,6 +117,8 @@
     }
   }
 }
+
+Deprecated: preg_replace(): The /e modifier is deprecated, use 
preg_replace_callback instead in %s on line %d
 string(9) "hello



Modified: php/php-src/trunk/tests/lang/bug24403.phpt
===================================================================
--- php/php-src/trunk/tests/lang/bug24403.phpt  2012-03-04 13:31:04 UTC (rev 
323861)
+++ php/php-src/trunk/tests/lang/bug24403.phpt  2012-03-04 13:39:12 UTC (rev 
323862)
@@ -17,4 +17,5 @@
 }
 new a();
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: preg_replace(): The /e modifier is deprecated, use 
preg_replace_callback instead in %s on line %d

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

Reply via email to