php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74076 ibase_affected_rows with non resource as parameter causes Segmentation Fault
Submitted: 2017-02-10 12:43 UTC Modified: 2021-03-31 11:38 UTC
From: netvicious at gmail dot com Assigned:
Status: Suspended Package: InterBase related
PHP Version: 7.0.15 OS: Ubuntu 16.04.2 LTS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
44 - 35 = ?
Subscribe to this entry?

 
 [2017-02-10 12:43 UTC] netvicious at gmail dot com
Description:
------------
The ibase_affected_rows function has one optional parameter which it's a resource link to a Interbase/Firebird database.

If we pass a non-resource link to this function it generates a Segmentation Fault

Test script:
---------------
// Bad parameter in ibase_affected_rows

$conx = ibase_connect($bd_file, $bd_user, $bd_pass, 'NONE');
$sql = 'UPDATE some_table SET some_field = ? WHERE some_id = xx';
$prep = ibase_prepare( $sql );		
$query = ibase_execute( $prep, $field_value);
if (ibase_affected_rows($query) != 1) ) {
echo "ok"
} else {
echo "error";
}

// Correct way
$conx = ibase_connect($bd_file, $bd_user, $bd_pass, 'NONE');
$sql = 'UPDATE some_table SET some_field = ? WHERE some_id = xx';
$prep = ibase_prepare( $sql );		
$query = ibase_execute( $prep, $field_value);
if (ibase_affected_rows($conx) != 1) ) {
echo "ok"
} else {
echo "error";
}

Expected result:
----------------
PHP should check if the passed variable it's a resource link, and in case it's not, it should generate one error, instead of a segmentation fault which gives no information to the developer for fix the problem.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-23 18:06 UTC] lester at lsces dot co dot uk
Putting anything other than a resource link in as a parameter simply gives an error. Using the wrong resource link gives a crash, so using $prep rather than $conx causes a problem rather than the $query in the test script.
 [2021-03-31 11:38 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2021-03-31 11:38 UTC] cmb@php.net
The interbase extension is moved to PECL[1] as of PHP 7.4.0, and
is looking for a new maintainer.  Until a new maintainer is found,
I suspend this ticket.

Consider to use the bundled PDO_Firebird extension, or the
php-firebird package[2] instead.

[1] <https://pecl.php.net/package/interbase>
[2] <https://github.com/FirebirdSQL/php-firebird>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 11:01:27 2024 UTC