|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-12-16 05:43 UTC] bestgen at us dot ibm dot com
[2012-01-17 09:59 UTC] martin dot hieden at hieden dot at
-Status: Open
+Status: Closed
[2012-01-17 09:59 UTC] martin dot hieden at hieden dot at
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 20 03:00:01 2025 UTC |
Description: ------------ When trying to insert an empty string into a varchar field, the field is filled with blanks, i.e. the length isn't set to zero. This happens regardless of allowing null for this field or not. Reproduce code: --------------- Assuming there's the table 'blank_tbl' in library 'blank' containing of a single varchar field with maximum length 10. A R PHPS A BLANK_FLD 10 VARLEN <?php $dbname = '*'; $username = '*'; $password = '*'; if (($database = db2_connect($dbname, $username, $password)) === false) die(db2_conn_errormsg()); $sql = <<<EOT INSERT INTO blank.blank_tbl(blank_fld) VALUES (?) EOT; $data = array(''); if (($stmt = db2_prepare($database, $sql)) === false) print_r(db2_stmt_errormsg()); if ($stmt && db2_execute($stmt, $data) === false) print_r(db2_stmt_errormsg($stmt)); db2_close($database); ?> Expected result: ---------------- A row should be inserted into the table, with the single field beeing an empty string. Actual result: -------------- The row is inserted, but the string consists of blanks, filled up to the maximum length. Taking a look at the data directly (aka PDM) shows these hex contents: 004444444444 0A0000000000