From: Hartmut Holzgraefe Date: Fri, 11 Apr 2003 04:29:28 +0000 (+0000) Subject: parameter count for bind stuff is different in OO interface X-Git-Tag: RELEASE_0_5~61 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f26d2b6937bbdc098f2eec821042553868025db;p=php parameter count for bind stuff is different in OO interface --- diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index fa1aed7474..b82543ff22 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -96,12 +96,22 @@ PHP_FUNCTION(mysqli_bind_param) PR_COMMAND *prcommand; unsigned long rc; - /* check if number of parameters > 2 and odd */ - if (argc < 3 || !(argc & 1)) { + /* calculate and check number of parameters */ + num_vars = argc; + if (!getThis()) { + /* ignore handle parameter in procedural interface*/ + --num_vars; + } + if (num_vars % 2) { + /* we need variable/type pairs */ + WRONG_PARAM_COUNT; + } + if (num_vars < 2) { + /* there has to be at least one pair */ WRONG_PARAM_COUNT; - } else { - num_vars = (argc - 1) / 2; } + num_vars /= 2; + args = (zval ***)emalloc(argc * sizeof(zval **)); @@ -229,7 +239,7 @@ PHP_FUNCTION(mysqli_bind_result) PR_STMT *prstmt; PR_COMMAND *prcommand; - if (argc < 2) { + if (argc < (getThis() ? 1 : 2)) { WRONG_PARAM_COUNT; }