Bug #74076 [NEW]: ibase_affected_rows with non resource as parameter causes Segmentation Fault
From: netvicious at gmail dot com
Operating system: Ubuntu 16.04.2 LTS
PHP version: 7.0.15
Package: InterBase related
Bug Type: Bug
Bug description:ibase_affected_rows with non resource as parameter causes Segmentation Fault
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 bug report at https://bugs.php.net/bug.php?id=74076&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74076&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74076&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74076&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74076&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74076&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74076&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74076&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74076&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74076&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74076&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74076&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74076&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74076&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74076&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74076&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74076&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74076&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74076&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74076&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74076&r=mysqlcfg
Thread (3 messages)
- netvicious at gmail dot com