Bug #74076 [Com]: ibase_affected_rows with non resource as parameter causes Segmentation Fault
| From: | lester at lsces dot co dot uk | Date: | Sat, 23 Mar 2019 18:06:27 +0000 |
| Subject: | Bug #74076 [Com]: 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-220153@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
Comment by: lester at lsces dot co dot uk
Reported by: netvicious at gmail dot com
Summary: ibase_affected_rows with non resource as parameter
causes Segmentation Fault
Status: Open
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:
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.
Previous Comments:
------------------------------------------------------------------------
[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