]> granicus.if.org Git - php/commitdiff
Fixed NULL pointer dereference
authorXinchen Hui <laruence@gmail.com>
Tue, 25 Feb 2014 10:14:22 +0000 (18:14 +0800)
committerXinchen Hui <laruence@gmail.com>
Tue, 25 Feb 2014 10:14:22 +0000 (18:14 +0800)
Zend/zend_execute_API.c
ext/standard/incomplete_class.c

index 7fb89bc04605b48e6f083265cfc4b68548b2e9f3..425a04756bb8058a1d02c527e1f13c964e3ce3a6 100644 (file)
@@ -371,10 +371,10 @@ ZEND_API const char *get_active_function_name(TSRMLS_D) /* {{{ */
        }
        switch (EG(current_execute_data)->function_state.function->type) {
                case ZEND_USER_FUNCTION: {
-                               const char *function_name = ((zend_op_array *) EG(current_execute_data)->function_state.function)->function_name->val;
+                               zend_string *function_name = ((zend_op_array *) EG(current_execute_data)->function_state.function)->function_name;
 
                                if (function_name) {
-                                       return function_name;
+                                       return function_name->val;
                                } else {
                                        return "main";
                                }
index d8aa461b05d7a2d67a0cc0c532dff62149c631c7..3cbe70479de5a2b59ef1f5c3627cc07b0d02793c 100644 (file)
@@ -41,10 +41,10 @@ static void incomplete_class_message(zval *object, int error_type TSRMLS_DC)
        class_name = php_lookup_class_name(object);
 
        if (class_name) {
-               php_error_docref(NULL TSRMLS_CC, error_type, INCOMPLETE_CLASS_MSG, "unknown");
-       } else {
                php_error_docref(NULL TSRMLS_CC, error_type, INCOMPLETE_CLASS_MSG, class_name->val);
                STR_RELEASE(class_name);
+       } else {
+               php_error_docref(NULL TSRMLS_CC, error_type, INCOMPLETE_CLASS_MSG, "unknown");
        }
 }
 /* }}} */