]> granicus.if.org Git - php/commitdiff
zend_parse_parameters 'O' works the way we need here
authorMarcus Boerger <helly@php.net>
Sun, 24 Aug 2003 11:34:01 +0000 (11:34 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 24 Aug 2003 11:34:01 +0000 (11:34 +0000)
Zend/zend_reflection_api.c
ext/reflection/php_reflection.c

index 7074c76cf433de6112d6a037770c161bafe76622..5f4683d5dd5c42ff4a2c1049a47c75b4796e39f0 100644 (file)
@@ -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");
index 7074c76cf433de6112d6a037770c161bafe76622..5f4683d5dd5c42ff4a2c1049a47c75b4796e39f0 100644 (file)
@@ -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");