From: Marcus Boerger Date: Sun, 5 Sep 2004 17:40:54 +0000 (+0000) Subject: MFH bugfix 299885 X-Git-Tag: php-5.0.2RC1~41 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2074b6ceeebea55696dca2c3ee2e0e7a8d0b9184;p=php MFH bugfix 299885 --- diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index 911491c951..7f45cd88f3 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -26,39 +26,33 @@ #define INCOMPLETE_CLASS_MSG \ "The script tried to execute a method or " \ "access a property of an incomplete object. " \ - "Please ensure that the class definition %s of the object " \ + "Please ensure that the class definition \"%s\" of the object " \ "you are trying to operate on was loaded _before_ " \ - "the session was started" + "unserialize() gets called or provide a __autoload() function " \ + "to load the class definition " static zend_object_handlers php_incomplete_object_handlers; /* {{{ incomplete_class_message */ -static void incomplete_class_message(int error_type TSRMLS_DC) +static void incomplete_class_message(zval *object, int error_type TSRMLS_DC) { - char buf[1024]; - char *class_name = NULL; + char *class_name; - if(EG(This)) { - class_name = php_lookup_class_name(EG(This), NULL); - } + class_name = php_lookup_class_name(object, NULL); if (!class_name) { - class_name = estrndup("unknown", sizeof("unknown")-1); + class_name = "unknown"; } - snprintf(buf, sizeof(buf)-1, INCOMPLETE_CLASS_MSG, class_name); - - efree(class_name); - - php_error_docref(NULL TSRMLS_CC, error_type, "%s", buf); + php_error_docref(NULL TSRMLS_CC, error_type, INCOMPLETE_CLASS_MSG, class_name); } /* }}} */ static zval *incomplete_class_get_property(zval *object, zval *member, int type TSRMLS_DC) { - incomplete_class_message(E_NOTICE TSRMLS_CC); + incomplete_class_message(object, E_NOTICE TSRMLS_CC); if(type == BP_VAR_W || type == BP_VAR_RW) { return EG(error_zval_ptr); } else { @@ -68,28 +62,28 @@ static zval *incomplete_class_get_property(zval *object, zval *member, int type static void incomplete_class_write_property(zval *object, zval *member, zval *value TSRMLS_DC) { - incomplete_class_message(E_NOTICE TSRMLS_CC); + incomplete_class_message(object, E_NOTICE TSRMLS_CC); } static zval **incomplete_class_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) { - incomplete_class_message(E_NOTICE TSRMLS_CC); + incomplete_class_message(object, E_NOTICE TSRMLS_CC); return &EG(error_zval_ptr); } static void incomplete_class_unset_property(zval *object, zval *member TSRMLS_DC) { - incomplete_class_message(E_NOTICE TSRMLS_CC); + incomplete_class_message(object, E_NOTICE TSRMLS_CC); } static int incomplete_class_has_property(zval *object, zval *member, int check_empty TSRMLS_DC) { - incomplete_class_message(E_NOTICE TSRMLS_CC); + incomplete_class_message(object, E_NOTICE TSRMLS_CC); return 0; } static union _zend_function *incomplete_class_get_method(zval *object, char *method, int method_len TSRMLS_DC) { - incomplete_class_message(E_ERROR TSRMLS_CC); + incomplete_class_message(object, E_ERROR TSRMLS_CC); return NULL; }