Re: cvs: php4 /ext/mysql php_mysql.c
| From: | Matt McClanahan | Date: | Thu, 26 Apr 2001 21:04:46 +0000 |
| Subject: | Re: cvs: php4 /ext/mysql php_mysql.c | ||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-5303@lists.php.net to get a copy of this message | ||
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() > 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;
}
Matt