Browse Source

zend_parse_parameters 'O' works the way we need here

PEAR_1_4DEV
Marcus Boerger 23 years ago
parent
commit
96d4ac7a3f
  1. 17
      Zend/zend_reflection_api.c
  2. 17
      ext/reflection/php_reflection.c

17
Zend/zend_reflection_api.c

@ -490,18 +490,10 @@ ZEND_METHOD(reflection, export)
int result;
zend_bool return_output = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|b", &object, &return_output) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &object, reflector_ptr, &return_output) == FAILURE) {
return;
}
/* Verify we are being passed a correct object. This is effectively
* the C counterpart of type hinting. We cannot use "O" to zend_parse_parameters
* as "O" only checks for inheritance, not for interfaces. */
if (!instanceof_function(Z_OBJCE_P(object), reflector_ptr TSRMLS_CC)) {
_DO_THROW("Argument must implement interface reflector");
/* Returns from this function */
}
/* Invoke the toString() method */
MAKE_STD_ZVAL(fname);
ZVAL_STRINGL(fname, "tostring", sizeof("tostring") - 1, 1);
@ -1710,15 +1702,10 @@ ZEND_METHOD(reflection_class, issubclassof)
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(ce);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &object) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", reflection_class_ptr, &object) == FAILURE) {
return;
}
if (!instanceof_function(Z_OBJCE_P(object), reflection_class_ptr TSRMLS_CC)) {
_DO_THROW("Argument must be an instance of Reflection_Class");
/* Returns from this function */
}
argument = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if (argument == NULL || argument->ptr == NULL) {
zend_error(E_ERROR, "Internal error: Failed to retrieve the argument's reflection object");

17
ext/reflection/php_reflection.c

@ -490,18 +490,10 @@ ZEND_METHOD(reflection, export)
int result;
zend_bool return_output = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|b", &object, &return_output) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &object, reflector_ptr, &return_output) == FAILURE) {
return;
}
/* Verify we are being passed a correct object. This is effectively
* the C counterpart of type hinting. We cannot use "O" to zend_parse_parameters
* as "O" only checks for inheritance, not for interfaces. */
if (!instanceof_function(Z_OBJCE_P(object), reflector_ptr TSRMLS_CC)) {
_DO_THROW("Argument must implement interface reflector");
/* Returns from this function */
}
/* Invoke the toString() method */
MAKE_STD_ZVAL(fname);
ZVAL_STRINGL(fname, "tostring", sizeof("tostring") - 1, 1);
@ -1710,15 +1702,10 @@ ZEND_METHOD(reflection_class, issubclassof)
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(ce);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &object) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", reflection_class_ptr, &object) == FAILURE) {
return;
}
if (!instanceof_function(Z_OBJCE_P(object), reflection_class_ptr TSRMLS_CC)) {
_DO_THROW("Argument must be an instance of Reflection_Class");
/* Returns from this function */
}
argument = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if (argument == NULL || argument->ptr == NULL) {
zend_error(E_ERROR, "Internal error: Failed to retrieve the argument's reflection object");

Loading…
Cancel
Save