Re: pdo: patch to make leading colon unneeded for bound variables without breaking BC.

From: Date: Fri, 25 Mar 2005 15:08:07 +0000
Subject: Re: pdo: patch to make leading colon unneeded for bound variables without breaking BC.
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-15604@lists.php.net to get a copy of this message
Am 25.03.2005 um 15:28 schrieb Derrell.Lipman@UnwiredUniverse.com:
"Thies C. Arntzen" <thies@thieso.net> writes:
diff -u -w -r1.95 pdo_stmt.c --- ext/pdo/pdo_stmt.c 24 Mar 2005 12:32:06 -0000 1.95 +++ ext/pdo/pdo_stmt.c 25 Mar 2005 13:13:18 -0000 @@ -242,6 +242,13 @@ hash = is_param ? stmt->bound_params : stmt->bound_columns; + if (param->name) { + if (param->name[0] == ':') { + param->name = param->name + 1;
Sanity check... Without researching thoroughly, this "appears" to warrant further inspection. The field param->name is clearly a pointer since you're able to increment it. It seems likely, then, that param->name was dynamically allocated. If that's not the case, then you can stop reading. If it is, though, then by incrementing param->name, what happens when param->name is freed? I didn't see any place in the patch where it is marked as having been incremented nor anyplace where it is decremented in order to be freed.
acutally i did a bit of checking... really_register_bound_param is called from two places... and at the end it does:
    if (param->name) {
        param->name = estrndup(param->name, param->namelen);
so i believe my patch is safe. i agree that it could|should be done nicer... -tc

« previous php.internals (#15604) next »