php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56308 Semicolon detector needs to trim
Submitted: 2005-02-18 21:31 UTC Modified: 2005-02-19 16:54 UTC
From: sean at caedmon dot net Assigned:
Status: Not a bug Package: PDO_MYSQL (PECL)
PHP Version: 5.0.3 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sean at caedmon dot net
New email:
PHP Version: OS:

 

 [2005-02-18 21:31 UTC] sean at caedmon dot net
Description:
------------
or at least that's my guess.

when calling $PDObj->exec()
"sql statement here;" works as expected
"sql statement here; " causes a MySQL syntax error
(note the trailing space)

Reproduce code:
---------------
$sql = "SELECT * FROM some_table; ";
if (FALSE === $res = $PDO->exec($sql)) {
  $err = $PDO->errorInfo();
  echo "Error: {$err[1]}: {$err[2]}\n";
}



Expected result:
----------------
no error

Actual result:
--------------
Error: 1064: You have an error in your SQL syntax near '; ' at line 1


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-19 16:54 UTC] wez@php.net
Don't do that ;-)
The query is passed on to mysql, and it doesn't like what you said.
Not a PDO problem.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 06:01:30 2025 UTC