Re: pdo: cannot send NULL values thru bound parameters.

From: Date: Thu, 24 Mar 2005 11:28:18 +0000
Subject: Re: pdo: cannot send NULL values thru bound parameters.
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-15575@lists.php.net to get a copy of this message
Hello Thies, may i kindly ask you to provide a test case as a .inc file in pdo/tests. I'll then look into the details? Thursday, March 24, 2005, 12:19:02 PM, you wrote: > as we convert "incoming" zvals to strings in pdo_stmt.c "no matter what"... > $stmt = $this->prepareStatement('insert into bla (name) values (:name)'); > $name = NULL; > var_dump($name); // $name is NULL > $stmt->bindParam(':name', $name); > var_dump($name); // $name is an empty string > am i overlooking something obvious? > attached patch "fixes" it for me (NULL is a valid "value" for a string)... > re, tc > Index: pdo_stmt.c > =================================================================== > RCS file: /repository/php-src/ext/pdo/pdo_stmt.c,v > retrieving revision 1.94 > diff -u -w -r1.94 pdo_stmt.c > --- pdo_stmt.c 21 Mar 2005 00:29:06 -0000 1.94 > +++ pdo_stmt.c 24 Mar 2005 11:13:31 -0000 > @@ -253,7 +253,7 @@ > } > } > - if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_STR && > param->max_value_len <= 0) { > + if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_STR && > param->max_value_len <= 0 && ! ZVAL_IS_NULL(param->parameter)) { > convert_to_string(param->parameter); > } -- Best regards, Marcus mailto:mail@marcus-boerger.de

« previous php.internals (#15575) next »