|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patcheszend_API.c.diff (last revision 2011-01-12 09:06 UTC by klaus at triendl dot eu)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-01-12 23:17 UTC] felipe@php.net
[2011-01-12 23:18 UTC] felipe@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: felipe
[2011-01-12 23:18 UTC] felipe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 19:00:02 2025 UTC |
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