Bug #74076 [Opn->Sus]: ibase_affected_rows with non resource as parameter causes Segmentation Fault
| From: | cmb@php.net | Date: | Wed, 31 Mar 2021 11:38:54 +0000 |
| Subject: | Bug #74076 [Opn->Sus]: ibase_affected_rows with non resource as parameter causes Segmentation Fault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-233093@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74076&edit=1
ID: 74076
Updated by: cmb@php.net
Reported by: netvicious at gmail dot com
Summary: ibase_affected_rows with non resource as parameter
causes Segmentation Fault
-Status: Open
+Status: Suspended
Type: Bug
Package: InterBase related
Operating System: Ubuntu 16.04.2 LTS
PHP Version: 7.0.15
Block user comment: N
Private report: N
New Comment:
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>
Previous Comments:
------------------------------------------------------------------------
[2019-03-23 18:06:27] 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.
------------------------------------------------------------------------
[2017-02-10 12:43:56] 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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74076&edit=1