Re: cvs: php4 /ext/mysql php_mysql.c
| From: | Sterling Hughes | Date: | Thu, 26 Apr 2001 08:07:11 +0000 |
| Subject: | Re: cvs: php4 /ext/mysql php_mysql.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-5302@lists.php.net to get a copy of this message | ||
On Thu, 26 Apr 2001, Matt McClanahan wrote:
> On Thu, Apr 26, 2001 at 02:53:24AM -0400, Sterling Hughes wrote:
>
> > On Thu, 26 Apr 2001, Matt McClanahan wrote:
> >
> > > On Thu, Apr 26, 2001 at 07:00:10AM -0400, Sean R. Bright wrote:
> > >
> > > > I should think that should be:
> > > >
> > > > if (ZEND_NUM_ARGS() != expected_args) {
> > > >
> > > > rather than less than.
> > > >
> > > > Sean
> > >
> > > Then mysql_fetch_object and mysql_fetch_array would require two args,
> > > when they're supposed to accept either one or two.
> > >
> > > I'll be the first to admit it's a lousy soluiton, but.. there it is.
> > >
> >
> > why not:
> >
> > if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2) {
> > WRONG_PARAM_COUNT;
> > }
>
> 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;
}
-Sterling