|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-02-16 21:56 UTC] neyman dot neil dot e at dol dot gov
Description:
------------
In ibm_driver.c, around line 985:
+#if PHP_MAJOR_VERSION >= 7
+ if (Z_TYPE(data) == IS_STRING) {
+#else
if (Z_TYPE_PP(data) == IS_STRING) {
+#endif
option_str = Z_STRVAL_PP(data);
} else {
The opt_str = Z_STR_PP(data) after the endif fails on php 7. The module compiles, but when I include the module in php.ini, there is an error when running php 7: "undefined symbol: Z_STRVAL_PP" and the pdo_ibm module will not load.
Test script:
---------------
I tried replacing with:
#if PHP_MAJOR_VERSION >= 7
if (Z_TYPE(data) == IS_STRING) {
option_str = Z_STRVAL_P(*data);
#else
if (Z_TYPE_PP(data) == IS_STRING) {
option_str = Z_STRVAL_PP(data);
#endif
} else {
And in this case the module loads without that error, but not sure if it is correct. It seems definitely must not have the Z_STRVAL_PP after the endif or it will still load in php version >= 7.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 03:00:01 2025 UTC |
Experiencing same problem. I can get the code to compile using: #if PHP_MAJOR_VERSION >= 7 if (Z_TYPE(data) == IS_STRING) { option_str = Z_STRVAL_P(*data); #else if (Z_TYPE_PP(data) == IS_STRING) { option_str = Z_STRVAL_PP(data); #endif } else { but then this causes segmentation fault... executing on the cli or in Apache Script: <?php try { $db= new PDO("ibm:DATABASE=GEN1;HOSTNAME=10.78.10.16;PORT=50000;", "admin", "bluebird456", array(PDO::ATTR_CASE=> PDO::CASE_NATURAL)); } catch(PDOException $e) { die("Connection error: ".$e->getMessage()); } $attributes = array( "AUTOCOMMIT", "ERRMODE", "CASE", "CLIENT_VERSION", "CONNECTION_STATUS", "ORACLE_NULLS", "PERSISTENT", "PREFETCH", "SERVER_INFO", "SERVER_VERSION", "TIMEOUT" ); foreach ($attributes as $val) { echo "PDO::ATTR_$val: "; echo $db->getAttribute(constant("PDO::ATTR_$val")) . "\n"; } ?> # strace php <script>.php ... access("/home/db2inst1/sqllib/cfg/db2dsdriver.cfg", F_OK) = -1 ENOENT (No such file or directory) open("/home/db2inst1/sqllib/cfg/db2cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory) open("/home/db2inst1/sqllib/cfg/db2cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory) open("/home/db2inst1/sqllib/cfg/db2cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory) open("/home/db2inst1/sqllib/cfg/db2cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory) open("/home/db2inst1/sqllib/cfg/db2cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory) open("/home/db2inst1/sqllib/cfg/db2cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory) open("/home/db2inst1/sqllib/cfg/db2cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory) open("/home/db2inst1/sqllib/cfg/db2cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory) open("/home/db2inst1/sqllib/cfg/db2cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory) open("/home/db2inst1/sqllib/cfg/db2cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory) semget(0x52dfa674, 1, 0) = -1 ENOENT (No such file or directory) mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f779d086000 mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f779d046000 semget(0x52dfa674, 1, 0) = -1 ENOENT (No such file or directory) semget(0x52dfa674, 1, 0) = -1 ENOENT (No such file or directory) semget(0x52dfa674, 1, 0) = -1 ENOENT (No such file or directory) semget(0x52dfa674, 1, 0) = -1 ENOENT (No such file or directory) --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} --- +++ killed by SIGSEGV (core dumped) +++ Segmentation fault (core dumped) In Apache I get: [Tue Feb 21 12:35:56.815597 2017] [core:notice] [pid 4737] AH00052: child pid 11607 exit signal Segmentation fault (11)Indeed without the options parameter from the connection string I can connect as well! Good catch :-) $ php DB2-Fred-Test.php PDO::ATTR_AUTOCOMMIT: 1 PDO::ATTR_ERRMODE: 0 PDO::ATTR_CASE: 1 PDO::ATTR_CLIENT_VERSION: 1.3.4 PDO::ATTR_CONNECTION_STATUS: PHP Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/freds/Downloads/DB2-Fred-Test.php on line 30 PHP Stack trace: PHP 1. {main}() /home/freds/Downloads/DB2-Fred-Test.php:0 PHP 2. PDO->getAttribute() /home/freds/Downloads/DB2-Fred-Test.php:30 Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/freds/Downloads/DB2-Fred-Test.php on line 30 Call Stack: 0.0005 353728 1. {main}() /home/freds/Downloads/DB2-Fred-Test.php:0 1.5188 357416 2. PDO->getAttribute() /home/freds/Downloads/DB2-Fred-Test.php:30 PDO::ATTR_ORACLE_NULLS: 0 PDO::ATTR_PERSISTENT: PDO::ATTR_PREFETCH: PHP Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/freds/Downloads/DB2-Fred-Test.php on line 30 PHP Stack trace: PHP 1. {main}() /home/freds/Downloads/DB2-Fred-Test.php:0 PHP 2. PDO->getAttribute() /home/freds/Downloads/DB2-Fred-Test.php:30 Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/freds/Downloads/DB2-Fred-Test.php on line 30 Call Stack: 0.0005 353728 1. {main}() /home/freds/Downloads/DB2-Fred-Test.php:0 1.5199 357416 2. PDO->getAttribute() /home/freds/Downloads/DB2-Fred-Test.php:30 PDO::ATTR_SERVER_INFO: DB2/NT64 PDO::ATTR_SERVER_VERSION: PHP Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/freds/Downloads/DB2-Fred-Test.php on line 30 PHP Stack trace: PHP 1. {main}() /home/freds/Downloads/DB2-Fred-Test.php:0 PHP 2. PDO->getAttribute() /home/freds/Downloads/DB2-Fred-Test.php:30 Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/freds/Downloads/DB2-Fred-Test.php on line 30 Call Stack: 0.0005 353728 1. {main}() /home/freds/Downloads/DB2-Fred-Test.php:0 1.5209 357416 2. PDO->getAttribute() /home/freds/Downloads/DB2-Fred-Test.php:30 PDO::ATTR_TIMEOUT: PHP Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/freds/Downloads/DB2-Fred-Test.php on line 30 PHP Stack trace: PHP 1. {main}() /home/freds/Downloads/DB2-Fred-Test.php:0 PHP 2. PDO->getAttribute() /home/freds/Downloads/DB2-Fred-Test.php:30 Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/freds/Downloads/DB2-Fred-Test.php on line 30 Call Stack: 0.0005 353728 1. {main}() /home/freds/Downloads/DB2-Fred-Test.php:0 1.5210 357416 2. PDO->getAttribute() /home/freds/Downloads/DB2-Fred-Test.php:30 The question is when will this get fixed?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 }