Closed koltsov4 closed 1 year ago
@koltsov4 I tried to reproduce your problem. The error handling is related to the used PHP version. The behavior is correct. ibase_query() returns TRUE or FALSE. The function expects a resource as argument. Therefore it cannot handle it. Since PHP 8.0 this is declared as an incompatibility and throws a fatal error.
Maybe you can also use a shorthand syntax like this.
$host = 'localhost:test.fdb';
$username = 'sysdba';
$password = 'masterkey';
$dbh = ibase_connect($host, $username, $password);
$sql = 'select * from MON$DATABASE p where p.mon$database_name =';
$res = ibase_query($dbh, $sql) or die(ibase_errmsg());
$prom = ibase_fetch_row($res);
I get Fatal error in ibase_fetch_row on error in ibase_query in php8.0. Php7.3 had "Warning".
For example, there is a deliberately erroneous request to take $sql = 'select * from MON$DATABASE p where p.mon$database_name ='; $res = ibase_query($dbh, $sql); $prom = ibase_fetch_row($res);
Then we get "Warning: ibase_query()" in ibase_query. Further there would be an empty ibase_fetch_row. But the script crashes completely with "Fatal error: Uncaught TypeError: ibase_fetch_row(): Argument # 1 ($result) must be of type resource, bool given"
This problem is solved, for example, by the following construction if (ibase_errmsg()=='') $prom = ibase_fetch_row($res); but this is extremely inconvenient, since a huge amount of code will have to be rewritten.
Tell me, could you fix the "Fatal error" on "Warning" as it was in php7.3?