}
/* FIXME: Unicode support??? */
if ((tmp = strstr(name_str.s, "::")) == NULL) {
+ zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Invalid method name %s", name_str);
return;
}
type = IS_STRING;
if (zend_u_lookup_class(Z_TYPE_P(classname), Z_UNIVAL_P(classname), Z_UNILEN_P(classname), &pce TSRMLS_CC) == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Class %v does not exist", Z_UNIVAL_P(classname));
+ if (classname == &ztmp) {
+ zval_dtor(&ztmp);
+ }
return;
}
ce = *pce;
break;
default:
+ if (classname == &ztmp) {
+ zval_dtor(&ztmp);
+ }
_DO_THROW("The parameter class is expected to be either a string or an object");
/* returns out of this function */
}
--- /dev/null
+--TEST--
+ReflectionMethod::__construct() tests
+--FILE--
+<?php
+
+$a = array("", 1, "::", "a::", "::b", "a::b");
+
+foreach ($a as $val) {
+ try {
+ new ReflectionMethod($val);
+ } catch (Exception $e) {
+ var_dump($e->getMessage());
+ }
+}
+
+$a = array("", 1, "");
+$b = array("", "", 1);
+
+foreach ($a as $key=>$val) {
+ try {
+ new ReflectionMethod($val, $b[$key]);
+ } catch (Exception $e) {
+ var_dump($e->getMessage());
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(20) "Invalid method name "
+string(21) "Invalid method name 1"
+string(21) "Class does not exist"
+string(22) "Class a does not exist"
+string(21) "Class does not exist"
+string(22) "Class a does not exist"
+string(21) "Class does not exist"
+string(66) "The parameter class is expected to be either a string or an object"
+string(21) "Class does not exist"
+Done