php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72424 Getting segmentation fault when using options for PDO driver
Submitted: 2016-06-15 20:16 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: arif at dreamfactory dot com Assigned:
Status: Open Package: PDO_IBM (PECL)
PHP Version: 7.0.7 OS: Ubuntu 14.04.4 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.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: arif at dreamfactory dot com
New email:
PHP Version: OS:

 

 [2016-06-15 20:16 UTC] arif at dreamfactory dot com
Description:
------------
When creating a new instance of PDO (for PDO_IBM) using any options parameter I get segmentation fault but this works perfectly on php5.6.
The test script provided gives me segmentation fault when using php 7.0.7 but works fine using php 5.6.
However, if I remove the options parameter then it works in php 7.0.7. I get segmentation fault for using any options not just the ones shown in this code.

Test script:
---------------
$ibm = new PDO("ibm:DRIVER={IBM DB2 ODBC DRIVER};HOSTNAME=192.168.1.11;DATABASE=TEST;", "user", "password", [
   PDO::ATTR_CASE => PDO::CASE_NATURAL,
   PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
]);


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-07 14:55 UTC] ronyan at outlook dot com
See a workaround: ( pdo_ibm 1.3.5 ) ibm_driver.c:



980 #if PHP_MAJOR_VERSION >= 7
981                         if (Z_TYPE_P(data) == IS_STRING) {
982 #else	
983 			if (Z_TYPE_PP(data) == IS_STRING) {
984 #endif
985 				option_str = Z_STRVAL_PP(data); // <--- this line
986 			} else {
987 #if PHP_MAJOR_VERSION >= 7
988 				option_num = Z_LVAL_P(data);
989 #else
990 				option_num = Z_LVAL_PP(data);
991 #endif
992 			}

FIX:

981 #if PHP_MAJOR_VERSION >= 7
982                         if (Z_TYPE_P(data) == IS_STRING) {
983 #else	
984 			if (Z_TYPE_PP(data) == IS_STRING) {
985 #endif
986 //------------- fix ---------------
987 #if PHP_MAJOR_VERSION >= 7
988 				option_str = Z_STRVAL_P(data);
989 #else
990 				option_str = Z_STRVAL_PP(data);
991 #endif
    //------------- end fix ---------------
992 			} else {
993 #if PHP_MAJOR_VERSION >= 7
994 				option_num = Z_LVAL_P(data);
995 #else
996 				option_num = Z_LVAL_PP(data);
997 #endif
998 			}
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon May 20 17:01:26 2019 UTC