Re: cvs: php4 /ext/mysql php_mysql.c
| From: | Andi Gutmans | Date: | Thu, 26 Apr 2001 22:15:36 +0000 |
| Subject: | Re: cvs: php4 /ext/mysql php_mysql.c | ||
| References: | 1 2 3 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-5304@lists.php.net to get a copy of this message | ||
At 04:04 PM 4/26/2001 -0500, Matt McClanahan wrote:
On Thu, Apr 26, 2001 at 04:07:11AM -0400, Sterling Hughes wrote: On Thu, 26 Apr 2001, 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. AndiBecause 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() > expected_args_max) { WRONG_PARAM_COUNT; }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) {WRONG_PARAM_COUNT;} And possibly remove the default case from switch (ZEND_NUM_ARGS()) {case 1: ... case 2: ... default: WRONG_PARAM_COUNT; break;}