Re: cvs: php4 /ext/mysql php_mysql.c
| From: | Zeev Suraski | Date: | Fri, 27 Apr 2001 00:19:37 +0000 |
| Subject: | Re: cvs: php4 /ext/mysql php_mysql.c | ||
| References: | 1 2 3 4 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-5305@lists.php.net to get a copy of this message | ||
I'd actually refrain from passing around any additional arguments, and simply perform this check in the wrapper functions. They 'know best' how many arguments they expect, so there's no point in relaying this to the inner function...
Zeev
At 01:15 27/4/2001, Andi Gutmans wrote:
At 04:04 PM 4/26/2001 -0500, Matt McClanahan wrote:I think if that does the trick it's good. No reason to make it more flexible than it needs to be. After your change if it ever needs the second argument it will be even quicker to add. Andi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-cvs-unsubscribe@lists.php.net For additional commands, e-mail: php-cvs-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Zeev Suraski <zeev@zend.com> CTO & co-founder, Zend Technologies Ltd. http://www.zend.com/On Thu, Apr 26, 2001 at 04:07:11AM -0400, Sterling Hughes wrote:On Thu, 26 Apr 2001, Matt McClanahan wrote:Because that won't catch a call to mysql_fetch_assoc or mysql_fetch_row that had two parameters, which was the bug being addressed in the first place. (#9839) That's the catch, php_mysql_fetch_hash needs to behave differently depending on which function called it.So do as andi said then:if (ZEND_NUM_ARGS() < expected_args_min || ZEND_NUM_ARGS() >That'd give _fetch_hash flexibility, but is it needed? The minimum expected args is constant (for now): 1. The default case in the switch loop that follows will catch < 1 args. So, how about if (ZEND_NUM_ARGS() > expected_args || ZEND_NUM_ARGS < 1) {expected_args_max) {WRONG_PARAM_COUNT; }WRONG_PARAM_COUNT;} And possibly remove the default case from switch (ZEND_NUM_ARGS()) {case 1: ... case 2: ... default: WRONG_PARAM_COUNT; break;}