dmitry                                   Tue, 14 Feb 2012 09:27:08 +0000

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

Log:
Added ability to reset user opcode handlers (Yoram)

Changed paths:
    U   php/php-src/branches/PHP_5_4/NEWS
    U   php/php-src/branches/PHP_5_4/Zend/zend_execute.c
    U   php/php-src/trunk/Zend/zend_execute.c

Modified: php/php-src/branches/PHP_5_4/NEWS
===================================================================
--- php/php-src/branches/PHP_5_4/NEWS   2012-02-14 09:26:38 UTC (rev 323203)
+++ php/php-src/branches/PHP_5_4/NEWS   2012-02-14 09:27:08 UTC (rev 323204)
@@ -2,6 +2,7 @@
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Feb 2012, PHP 5.4.0 RC 8
 - Core:
+  . Added ability to reset user opcode handlers (Yoram).
   . Improved max_input_vars directive to check nested variables (Dmitry).
   . Fixed bug #60965 (Buffer overflow on htmlspecialchars/entities with
     $double=false). (Gustavo)

Modified: php/php-src/branches/PHP_5_4/Zend/zend_execute.c
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/zend_execute.c    2012-02-14 09:26:38 UTC 
(rev 323203)
+++ php/php-src/branches/PHP_5_4/Zend/zend_execute.c    2012-02-14 09:27:08 UTC 
(rev 323204)
@@ -1512,7 +1512,12 @@
 ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, 
user_opcode_handler_t handler)
 {
        if (opcode != ZEND_USER_OPCODE) {
-               zend_user_opcodes[opcode] = ZEND_USER_OPCODE;
+               if (handler == NULL) {
+                       /* restore the original handler */
+                       zend_user_opcodes[opcode] = opcode;
+               } else {
+                       zend_user_opcodes[opcode] = ZEND_USER_OPCODE;
+               }
                zend_user_opcode_handlers[opcode] = handler;
                return SUCCESS;
        }

Modified: php/php-src/trunk/Zend/zend_execute.c
===================================================================
--- php/php-src/trunk/Zend/zend_execute.c       2012-02-14 09:26:38 UTC (rev 
323203)
+++ php/php-src/trunk/Zend/zend_execute.c       2012-02-14 09:27:08 UTC (rev 
323204)
@@ -1512,7 +1512,12 @@
 ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, 
user_opcode_handler_t handler)
 {
        if (opcode != ZEND_USER_OPCODE) {
-               zend_user_opcodes[opcode] = ZEND_USER_OPCODE;
+               if (handler == NULL) {
+                       /* restore the original handler */
+                       zend_user_opcodes[opcode] = opcode;
+               } else {
+                       zend_user_opcodes[opcode] = ZEND_USER_OPCODE;
+               }
                zend_user_opcode_handlers[opcode] = handler;
                return SUCCESS;
        }

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

Reply via email to