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: -
From: netvicious at gmail dot com Assigned:
Status: Open 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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: netvicious at gmail dot com
New email:
PHP Version: OS:

 

 [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

 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Wed Oct 17 12:01:26 2018 UTC