|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71305 Crash when optional resource is omitted
Submitted: 2016-01-07 18:04 UTC Modified: 2016-01-13 20:49 UTC
From: mikedeweese at hotmail dot com Assigned: ab (profile)
Status: Closed Package: InterBase related
PHP Version: 7.0.2 OS: Windows 10 x64
Private report: No CVE-ID: None
 [2016-01-07 18:04 UTC] mikedeweese at hotmail dot com
Calling ibase_query without a database link identifier crashes PHP.

In PHP5 and according to the manual, if omitted, the last opened link is assumed.  

functions ibase_trans and ibase_prepare also take an optional database link id and will also crash if one is not given in php7.

Test script:
$db = ibase_connect("", 'sysdba', 'masterkey');
$q = ibase_query("SELECT * FROM UTUSERS WHERE FUSERID = 'MJD'");
print "ok";

Expected result:
ok should print to the screen

Actual result:
A windows dialog with php icon. "CLI has stopped working.  A problem caused the program to stop working correctly.  Please close the program."

If I put $db as the first param, there is no crash and ok prints as expected.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-08 03:12 UTC]
interbase is know broken in somehow. :<

please read:
 [2016-01-11 15:51 UTC]
-Status: Open +Status: Feedback
 [2016-01-11 15:51 UTC]
@mikedeweese please test the current development 7.0 branch. Several fixes was applied. Please fetch this or any later snapshot.

 [2016-01-11 21:24 UTC] mikedeweese at hotmail dot com
It is closer to working like it used to.

This now works

$db = ibase_connect("", 'sysdba', 'masterkey');
$t = ibase_trans();  // This line crashes in the 7.0.2
$r = ibase_fetch_object($q);

but this still crashes

$db = ibase_connect("", 'sysdba', 'masterkey');
$q = ibase_query("SELECT * FROM UTUSERS WHERE FUSERID = 'MJD'");
print "at end";
 [2016-01-11 21:37 UTC] mikedeweese at hotmail dot com
Ok, my second test does work if I connect to a DB that actually exists.

However, it still isn't 100%, as it crashes when I try to open a database that does not exist.  In PHP 5.6 it exits gracefully with these warnings:

PHP Warning:  ibase_connect(): I/O error during "CreateFile (open)" operation for file "TESTDB" Error while trying to open file The system cannot find the file specified.   in C:\work\php7_ibase_failure2.php on line 3
PHP Warning:  ibase_query(): no Firebird/InterBase link resource supplied in C:\work\php7_ibase_failure2.php on line 4
PHP Warning:  ibase_fetch_object() expects parameter 1 to be resource, boolean given in C:\work\php7_ibase_failure2.php on line 5
 [2016-01-12 14:18 UTC]
@mikedeweese thanks for checking. Here's a new build (or any later snapshot).

 [2016-01-13 12:51 UTC] mikedeweese at hotmail dot com
Yes, I now have 3 small tests that all complete as expected.

I tested with the snapshot in the r2b4625d directory.
 [2016-01-13 20:49 UTC]
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: ab
 [2016-01-13 20:49 UTC]
@mikedeweese thanks for staying on the matter. I would consider this one to be over. There are still some issues there, and it's known. If you have simple repro cases for those, please file another ticket.

Many thanks to Hui for the huge patch to ext/interbase.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 06:01:29 2024 UTC