#36870 [Opn->Bgs]: odbc_execute can't insert a string that starts and ends with a single quote

From: Date: Mon, 10 Apr 2006 00:40:41 +0000
Subject: #36870 [Opn->Bgs]: odbc_execute can't insert a string that starts and ends with a single quote
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95511@lists.php.net to get a copy of this message
ID: 36870 Updated by: edink@php.net Reported By: mjs at beebo dot org -Status: Open +Status: Bogus Bug Type: ODBC related Operating System: Windows PHP Version: 5.1.2 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php This is documented limitation. See http://www.php.net/manual/en/function.odbc-execute.php Previous Comments: ------------------------------------------------------------------------ [2006-03-27 12:08:11] mjs at beebo dot org Description: ------------ odbc_execute has a feature whereby if the string to be inserted starts and ends with a single quote, the string is interpreted as a filename whose contents are interpreted as the value of the placeholder. There does not appear to be a way to insert a string that begins and ends with a single quote--neither backslashing nor double-quoting works, and it appears from reading the source (php_odbc.c:1014) that nothing else will either. Reproduce code: --------------- $sth = odbc_prepare($dbh, "INSERT INTO people(name) VALUES(?)"); $res = odbc_execute($sth, array('\'The Count\'')); Expected result: ---------------- The string \'The Count\' inserted into the database. Actual result: -------------- The string is interpreded as a filename, resulting in the erro "Can't open file XXX" in the error log. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36870&edit=1

« previous php.bugs (#95511) next »