TheWebs
TheWebs

Reputation: 12933

Zend Framework is throwing a strange error in Firefox and IE about the PDO?

At work we are using Zend 1.10.7 and were getting a weird error:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[08P01]: <<Unknown error>>: 7 ERROR:  bind message supplies 0 parameters, but prepared statement "pdo_stmt_00000015" requires 1' in /var/www/ZendFramework-1.10.7/library/Zend/Db/Statement/Pdo.php:228
Stack trace:

#0 /var/www/ZendFramework-1.10.7/library/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /var/www/ZendFramework-1.10.7/library/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array)
#2 /var/www/ZendFramework-1.10.7/library/Zend/Db/Adapter/Abstract.php(468): Zend_Db_Statement->execute(Array)
#3 /var/www/ZendFramework-1.10.7/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select), Array)
#4 /var/www/ZendFramework-1.10.7/library/Zend/Db/Table/Abstract.php(1505): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Table_Select))
#5 /var/www/ZendFramework-1.10.7/library/Zend/Db/Table/Abstract.php(1321): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Select))
#6 /var/w in /var/www/ZendFramework-1.10.7/library/Zend/Db/Statement/Pdo.php on line 234

Has any one ever seen this before? and if so what's the cause? it only does this in Firefox and IE 9. But chrome is fine, the site works.

Any thoughts? Too me, and my Google mind its one of my inserts or select statements, but again in chrome it works, selects, inserts and updates information in the database.

we are using PostgreSQL as a database

Upvotes: 0

Views: 993

Answers (1)

AlexP
AlexP

Reputation: 9857

The PDO query is looking for a bound parameter, with this said there should be no reason why different browsers are giving different results unless the values passed to this query are dynamically generated -

If your query looks like this:

SELECT * FROM users WHERE id = ?

You need to ensure you bind one parameter.

$stmt->bindParam(1, $idValue);

If $idValue is the result of a function that for some reason returns NULL or the bindParam method call itself is wrapped in a conditional statement that only evaluate true on Christmas day you will have an exception like yours. This is because the value is missing when the statement is executed.

Edit: My guess is that the Array value here PDOStatement->execute(Array) is empty.

Upvotes: 1

Related Questions