-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
firebird exception with php 7.0.3 #231
Comments
Which version of ADOdb are you using ? |
I use ADOdb 5.20.4 on Windows 2012 / IIS also the same an windows 2008/ IIS I use a class-system for db access so I did extract the important code to reproduce the error. class mawDB {
/*****************************************************/
function __construct() {
$this->db = ADONewConnection('firebird');
$this->db->debug = true;
$this->db->dialect = 3;
$this->db->charSet = 'UTF8';
$this->db->Connect($servername . ':' . $databasefile ,$username,$password);
$this->db->SetFetchMode(ADODB_FETCH_ASSOC);
}
}
class mawDBChild1 extends mawDB {
public function select() {
$rs = $this->db->GetRow('Select * from Table1');
}
}
class mawDBChild2 extends mawDB {
public function select() {
$rs = $this->db->GetRow('Select * from table2');
}
}
$mawDb1 = new mawDBChild1();
$mawDb2 = new mawDBChild2();
$mawDb1->select(); This Code works on php 7.0.0 and throws an exception in php 7.0.3 and later versions.
So I did chnage the code: $mawDb1 = new mawDBChild1(); In the first dump In the second dump I think this is the reason for the exception. |
sorry, wrong button clicked. |
Is it possible that this problem with PHP is the cause of your problem. Perhaps you could try with PHP 7.0.5?
|
This throws an exception in 7.0.3 and works with 7.0.5 , so I think this is not the problem.
|
I think you are going to need to write a simple, pure php routine bypassing the ADOdb driver. If you are getting issues like the one above where the version of PHP affects the results of the code, then it is more than likely a problem with PHP itself. If in fact it is ADOdb that has the issue, then the php code you provide could help us determine the cause of the issue. |
Without ADOdb I cannot reproduce the error
Look at my second post, there you will find an example. |
Hi @mawouzo I finally got around to setting up Firebird on a PHP 7.0.4 test environment (on Ubuntu 16.10) to investigate this issue. I can indeed replicate the behavior you describe: include('adodb.inc.php');
$servername = 'localhost';
$databasefile = 'employee';
$username = 'SYSDBA';
$password = 'masterkey';
$sql = 'select * from country';
function init() {
global $servername, $databasefile, $username, $password;
$db = ADONewConnection('firebird');
$db->dialect = 3;
$db->charSet = 'UTF8';
$db->Connect($servername . ':' . $databasefile, $username, $password);
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$db->debug = true;
return $db;
}
$d1 = init();
$d2 = init();
print_r($d1->getRow($sql)); Fails with
Looking at what happens to the connection: echo "**** Open connection 1\n";
$d1 = init(); var_dump($d1->_connectionID);
echo "**** Open connection 2\n";
$d2 = init(); var_dump($d1->_connectionID, $d2->_connectionID); After opening the 2nd connection, the 1st one is no longer valid (as you pointed out before)
So far, we're on the same page. Now let's try to get ADOdb out of the equation, as per @mnewnham's suggestion:
Well... echo "**** Open connection 1\n"; $d1 = ibase_connect("$servername:$databasefile", $username, $password); var_dump($d1);
echo "**** Open connection 2\n"; $d2 = ibase_connect("$servername:$databasefile", $username, $password); var_dump($d1, $d2);
This proves that ADOdb has absolutely nothing to do with this error, it is a problem with PHP's interbase driver. Since the same code works just fine on PHP 5.6 (and according to you on PHP 7.0.0 as well, although I did not test that), I would assume that something was changed in the driver. I did a quick Google search to see if anyone else had experienced the same issue, and found this, which was opened a few days after your reported your issue here. The problem has also been logged on Launchpad (#1578600) and also upstream (PHP #72175). Since I've demonstrated that this is not an ADOdb issue, I will close this, and encourage you to monitor the upstream bugs. |
As pointed out on the StackOverflow question, this commit php/php-src@8bfa519 may be the one that introduced the bug (in release php-7.0.3RC1) |
On launchpad (#1578600) the bug has been found and fixed. Waiting for the upstream fix. |
Thanks for the update |
I will come back to this issue because this error is still alive in the windows php 7.1.0. in this discussion https://bugs.php.net/bug.php?id=72175 you can read that nobody really wants or can fix this. All my projects use AdoDB for Firebird and the way to update to php 7 is so not possible. |
Not possible within ADOdb, sorry.
Contributions are welcome. Don't hesitate to submit a pull request ! |
I'm using a class to do all the database operations, and I fixed this problem in my code using static variables to store the connection to the database. In my code I'm doing several connections to database due to chains of php calls, all of the connections use the same library.
|
@NetVicious , if you could provide us with a bigger code snippet, perhaps we could add it to the firebird ADOdb page with a pointer to this thread |
Hi mnewnham! My class it's a simple class for do BD actions. It was ripped from an old mysql class and changed to work with firebird. The original one for mysql it's this http://www.servielectronico.com/PhpShop/db/db_mysql.inc |
@NetVicious |
I got it from the Google cache ;-) Remember this script it's the original for mysql I modified to work with Firebird/Interbase. Fee free to modify it to work with adoDB, and remember to modify the $lid variable definition to
|
this exception is thrown with php 7.0.3 but works well with 7.0.0
PHP Warning: ibase_query(): supplied resource is not a valid Firebird/InterBase link resource in lib\adodb\drivers\adodb-ibase.inc.php on line 378
PHP Fatal error: Uncaught ADODB_Exception: firebird error: [0: ] in EXECUTE("Select * from xxx where x = ? ") in lib\adodb\adodb-exceptions.inc.php:80
The text was updated successfully, but these errors were encountered: