]> granicus.if.org Git - php/commitdiff
fix assert() in Unicode mode
authorAntony Dovgal <tony2001@php.net>
Wed, 12 Jul 2006 22:19:12 +0000 (22:19 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 12 Jul 2006 22:19:12 +0000 (22:19 +0000)
ext/standard/assert.c

index ed7b523d56ff868885399c292fc4c6b503c3e87c..2a3100464465679d9bb11a8f21177958eb384bc1 100644 (file)
@@ -125,7 +125,8 @@ PHP_MINFO_FUNCTION(assert)
 PHP_FUNCTION(assert)
 {
        zval **assertion;       
-       int val;
+       zval tmp;
+       int val, free_tmp = 0;
        char *myeval = NULL;
        char *compiled_string_description;
        
@@ -139,9 +140,7 @@ PHP_FUNCTION(assert)
 
        if (Z_TYPE_PP(assertion) == IS_STRING || Z_TYPE_PP(assertion) == IS_UNICODE) {
                zval retval;
-               zval tmp;
                int old_error_reporting = 0; /* shut up gcc! */
-               int free_tmp = 0;
 
                if (Z_TYPE_PP(assertion) == IS_UNICODE) {
                        tmp = **assertion;
@@ -167,9 +166,6 @@ PHP_FUNCTION(assert)
                        }
                        RETURN_FALSE;
                }
-               if (free_tmp) {
-                       zval_dtor(&tmp);
-               }
                efree(compiled_string_description);
 
                if (ASSERTG(quiet_eval)) {
@@ -226,6 +222,10 @@ PHP_FUNCTION(assert)
                }
        }
 
+       if (free_tmp) {
+               zval_dtor(&tmp);
+       }
+
        if (ASSERTG(bail)) {
                zend_bailout();
        }