From:             
Operating system: 
PHP version:      5.3.5
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:checking the number of arguments is wrong in 
zend_parse_method_parameters_ex()

Description:
------------
Starting with PHP 5.3.0, zend_parse_method_parameters() and
zend_parse_method_parameters_ex() check the number of passed arguments not
to be 0.

However, zend_parse_method_parameters_ex() passes num_args-1 to
RETURN_IF_ZERO_ARGS, yielding immediate function return with return code
FAILURE - checking the passed arguments fails incorrectly.



See the 'test script' code for an idea how the problem scenario looks
like.

Note: the code for the 'test script' isn't php script code but rather C++
code for a class exposed from a custom php extension.

Test script:
---------------
/* {{{ proto void MySample::__destruct() */

ZEND_METHOD(mysample_class, __destruct)

{

        zval* objid;

#if 1   // fails: zend_parse_method_parameters_ex() returns FAILURE

        if (zend_parse_method_parameters_ex(0, ZEND_NUM_ARGS() TSRMLS_CC,
getThis(), "O", &objid, mysample_class_entry) == FAILURE)

                return;

#else   // ... whereas zend_parse_method_parameters() returns SUCCESS

        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
"O", &objid, mysample_class_entry) == FAILURE)

                return;

#endif



        mysample_class* pobj = (mysample_class*)
zend_object_store_get_object(objid TSRMLS_CC);

        

        // ...

}

/* }}} */



Expected result:
----------------
zend_parse_method_parameters_ex() should return SUCCESS just as
zend_parse_method_parameters() does

Actual result:
--------------
zend_parse_method_parameters_ex() returns FAILURE

-- 
Edit bug report at http://bugs.php.net/bug.php?id=53717&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=53717&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=53717&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=53717&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=53717&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53717&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=53717&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=53717&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=53717&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=53717&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=53717&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=53717&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=53717&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=53717&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=53717&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53717&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53717&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=53717&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=53717&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=53717&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=53717&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=53717&r=mysqlcfg

Reply via email to