Edit report at http://bugs.php.net/bug.php?id=53717&edit=1
ID: 53717 Updated by: fel...@php.net Reported by: klaus at triendl dot eu Summary: checking the number of arguments is wrong in zend_parse_method_parameters_ex() -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem PHP Version: 5.3.5 -Assigned To: +Assigned To: felipe Block user comment: N Private report: N New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2011-01-12 23:17:12] fel...@php.net Automatic comment from SVN on behalf of felipe Revision: http://svn.php.net/viewvc/?view=revision&revision=307424 Log: - Fixed bug #53717 (checking the number of arguments is wrong in zend_parse_method_parameters_ex()) patch by: klaus at triendl dot eu ------------------------------------------------------------------------ [2011-01-12 10:05:50] klaus at triendl dot eu 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 this bug report at http://bugs.php.net/bug.php?id=53717&edit=1