php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35607 Crash with Update command
Submitted: 2005-12-08 20:49 UTC Modified: 2006-04-29 01:00 UTC
From: wseibert at hxcorp dot com Assigned: wez (profile)
Status: No Feedback Package: PDO related
PHP Version: 5CVS-2005-12-08 (snap) OS: Windows 2k
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: wseibert at hxcorp dot com
New email:
PHP Version: OS:

 

 [2005-12-08 20:49 UTC] wseibert at hxcorp dot com
Description:
------------
Running a UPDATE sql command via PDO crashes Apache.



Reproduce code:
---------------
try
{
     $dbh = new PDO('odbc:DSN=TEST;driver=Driver do Microsoft Access (*.mdb)','','');
     $results = $dbh->query('UPDATE xd17 SET xd17.CCDate = 20051207, xd17.CCTime = 1200, xd17.ModifiedDS = 200512071200 WHERE xd17.XTyp17 = 157 AND xd17.X15A = 51921 AND xd157.X105B = 3300');
} catch (PDOException $e) {
	print "Error!: ".$e->getMessage()."<br/>";
	die();
}


Expected result:
----------------
Expected to see changes in DB.

Using exec ($dbh->exec(....) ) instead of query has no effect.  Doesn't update the DB or crash anything.

SQL statement works find in MS Access.

Actual result:
--------------
Apache.exe - Application Error

The instruction at "0x7c5b97d4" referenced memory at "0x0000000c".  The memory could no be "written".

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-08 20:58 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.


 [2005-12-08 21:07 UTC] wseibert at hxcorp dot com
<?php
try
{
     $dbh = new PDO('odbc:DSN=TEST;driver=Driver do Microsoft Access
(*.mdb)','','');
     $results = $dbh->query('UPDATE xd17 SET xd17.CCDate = 20051207,
xd17.CCTime = 1200, xd17.ModifiedDS = 200512071200 WHERE xd17.XTyp17 =
157 AND xd17.X15A = 51921 AND xd157.X105B = 3300');
} catch (PDOException $e) {
	print "Error!: ".$e->getMessage()."<br/>";
	die();
}
?>
 [2005-12-08 21:12 UTC] wseibert at hxcorp dot com
Sorry, I know this is going to be difficult to duplicate as I'm connecting to a Access DB on my local machine via ODBC.  If you have a Access DB on your system, you just need to set it up in your ODBC Manager and point to that DSN in the script.  Once that is done, try doing a Update SQL command via PDO::query, Then try it via PDO::exec.  If it works (correctly), it should return the number of rows affected.  It crashes for me on the query, and does nothing on the exec.
 [2005-12-08 21:34 UTC] tony2001@php.net
Assigned to the maintainer.
 [2005-12-09 05:24 UTC] wez@php.net
Can you provide a CREATE TABLE statement or a small copy of your actual .mdb file, so that I can test against the same schema you're using?
 [2005-12-09 15:23 UTC] wseibert at hxcorp dot com
I think i found some more info out.

It seems to have a problem with the aliases of the tables.

This will work:
UPDATE tbl1 SET id=10 WHERE 1=1

This will crash:
UPDATE tbl1 SET tbl1.id=10 WHERE 1=1

Both are valid SQL statements...

I'm not sure if this is caused in one of the ext in PHP (PDO_odbc?) or where it's crashing from...

Can we get some error catching in PHP5 for this?
 [2006-04-21 04:04 UTC] wez@php.net
still waiting for the information I requested.
 [2006-04-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC