cvs: ZendEngine2 / zend_reflection_api.c
| From: | Sebastian Bergmann | Date: | Mon, 19 Jul 2004 19:14:12 +0000 |
| Subject: | cvs: ZendEngine2 / zend_reflection_api.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-2778@lists.php.net to get a copy of this message | ||
sebastian Mon Jul 19 15:14:12 2004 EDT
Modified files:
/ZendEngine2 zend_reflection_api.c
Log:
Make ReflectionClass::getMethod() and ReflectionClass::getProperty() raise an ReflectionException
instead of returning NULL on failure.
http://cvs.php.net/diff.php/ZendEngine2/zend_reflection_api.c?r1=1.112&r2=1.113&ty=u
Index: ZendEngine2/zend_reflection_api.c
diff -u ZendEngine2/zend_reflection_api.c:1.112 ZendEngine2/zend_reflection_api.c:1.113
--- ZendEngine2/zend_reflection_api.c:1.112 Mon Jul 19 15:02:11 2004
+++ ZendEngine2/zend_reflection_api.c Mon Jul 19 15:14:10 2004
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_reflection_api.c,v 1.112 2004/07/19 19:02:11 sebastian Exp $ */
+/* $Id: zend_reflection_api.c,v 1.113 2004/07/19 19:14:10 sebastian Exp $ */
#include "zend.h"
#include "zend_API.h"
#include "zend_exceptions.h"
@@ -2152,7 +2152,7 @@
}
/* }}} */
-/* {{{ proto public ReflectionMethod Reflection_Class::getMethod(string name)
+/* {{{ proto public ReflectionMethod Reflection_Class::getMethod(string name) throws
ReflectionException
Returns the class' method specified by it's name */
ZEND_METHOD(reflection_class, getMethod)
{
@@ -2172,7 +2172,9 @@
if (zend_hash_find(&ce->function_table, name, name_len + 1, (void**) &mptr) == SUCCESS)
{
reflection_method_factory(ce, mptr, return_value TSRMLS_CC);
} else {
- RETURN_NULL();
+ zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ "Method %s does not exist", name);
+ return;
}
}
/* }}} */
@@ -2221,7 +2223,7 @@
}
/* }}} */
-/* {{{ proto public ReflectionProperty Reflection_Class::getProperty(string name)
+/* {{{ proto public ReflectionProperty Reflection_Class::getProperty(string name) throws
ReflectionException
Returns the class' property specified by it's name */
ZEND_METHOD(reflection_class, getProperty)
{
@@ -2240,7 +2242,9 @@
if (zend_hash_find(&ce->properties_info, name, name_len + 1, (void**) &property_info)
== SUCCESS) {
reflection_property_factory(ce, property_info, return_value TSRMLS_CC);
} else {
- RETURN_NULL();
+ zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ "Property %s does not exist", name);
+ return;
}
}
/* }}} */