dmitry          Fri Feb 16 13:12:10 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/standard       assert.c basic_functions.c 
  Log:
  Fixed return value of assert_options(ASSERT_CALLBACK) and possible crash 
(Andy Wharmby)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/assert.c?r1=1.60.2.3.2.4&r2=1.60.2.3.2.5&diff_format=u
Index: php-src/ext/standard/assert.c
diff -u php-src/ext/standard/assert.c:1.60.2.3.2.4 
php-src/ext/standard/assert.c:1.60.2.3.2.5
--- php-src/ext/standard/assert.c:1.60.2.3.2.4  Mon Jan  1 09:36:08 2007
+++ php-src/ext/standard/assert.c       Fri Feb 16 13:12:10 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: assert.c,v 1.60.2.3.2.4 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: assert.c,v 1.60.2.3.2.5 2007/02/16 13:12:10 dmitry Exp $ */
 
 /* {{{ includes/startup/misc */
 
@@ -114,6 +114,16 @@
        return SUCCESS;
 }
 
+PHP_RINIT_FUNCTION(assert)
+{
+       if (ASSERTG(cb)) {
+               MAKE_STD_ZVAL(ASSERTG(callback));
+               ZVAL_STRING(ASSERTG(callback), ASSERTG(cb), 1);
+       }
+
+       return SUCCESS;
+}
+
 PHP_RSHUTDOWN_FUNCTION(assert)
 {
        if (ASSERTG(callback)) { 
@@ -187,11 +197,6 @@
                RETURN_TRUE;
        }
 
-       if (!ASSERTG(callback) && ASSERTG(cb)) {
-               MAKE_STD_ZVAL(ASSERTG(callback));
-               ZVAL_STRING(ASSERTG(callback), ASSERTG(cb), 1);
-       }
-
        if (ASSERTG(callback)) {
                zval *args[3];
                zval *retval;
@@ -286,6 +291,11 @@
                break;
 
        case ASSERT_CALLBACK:
+               if (ASSERTG(callback) != NULL) {
+                       RETVAL_ZVAL(ASSERTG(callback), 1, 0);
+               } else {
+                       RETVAL_NULL();
+               }
                if (ac == 2) {
                        if (ASSERTG(callback)) {
                                zval_ptr_dtor(&ASSERTG(callback));
@@ -293,7 +303,7 @@
                        ASSERTG(callback) = *value;
                        zval_add_ref(value);
                }
-               RETURN_TRUE;
+               return;
                break;
 
        default:
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.39&r2=1.725.2.31.2.40&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.39 
php-src/ext/standard/basic_functions.c:1.725.2.31.2.40
--- php-src/ext/standard/basic_functions.c:1.725.2.31.2.39      Mon Jan  1 
09:36:08 2007
+++ php-src/ext/standard/basic_functions.c      Fri Feb 16 13:12:10 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.725.2.31.2.39 2007/01/01 09:36:08 sebastian Exp 
$ */
+/* $Id: basic_functions.c,v 1.725.2.31.2.40 2007/02/16 13:12:10 dmitry Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -4132,6 +4132,7 @@
 #ifdef HAVE_SYSLOG_H
        PHP_RINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU);
 #endif
+       PHP_RINIT(assert) (INIT_FUNC_ARGS_PASSTHRU);
        PHP_RINIT(dir)(INIT_FUNC_ARGS_PASSTHRU);
        PHP_RINIT(url_scanner_ex)(INIT_FUNC_ARGS_PASSTHRU);
 

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

Reply via email to