|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-04-04 11:58 UTC] ushida100 at gmail dot com
Description:
------------
PHP Version 7.2.15
Module Name : ibm_db2
Module release : 2.0.6-zs1
Running db2_exec with db2_bind_param causes an error.
It's not a class and runs fine.
But when used in class, an error occurs.
This happened in previous versions, but it was resolved at that time.
Variable scope problem ?
The message is as follows.
PHP Warning: db2_execute(): Value Not Bound in foo.class.php on line 51
PHP Warning: db2_execute(): Binding Error 3 in foo.class.php on line 51
This occurs with the following code.
<?php
$hoge = new Hoge();
$row2 = $hoge->getRow();
var_dump($row2);
class Hoge {
public function getRow(){
$db = db2_connect("DB2" ,"USER" ,"PASS");
$sql = "set schema PHPDEMO" ;
$result = db2_exec($db,$sql);
$sql="select * from empl where code = ?";
$result = db2_prepare($db,$sql);
$code2 = 110 ;
db2_bind_param($result ,1 ,"code2",DB2_PARAM_IN);
//**** ERROR
$stmt = db2_execute($result) ;
$row = db2_fetch_assoc($result) ;
db2_close($db);
return $row ;
}
}
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 02:00:01 2025 UTC |
I tried ibm_db2 in some environments. PHP V7.2 fails when executing "_php_db2_hash_find_ind ()". In PHP V7.1, it can be executed normally. Variables of Class or Function will be "NULL" in the following steps. static int _php_db2_hash_find_ind(char * varname, int varlen, zval **temp, zval ***bind_data, zend_array ** symbol_table_used TSRMLS_DC) { int rc = FAILURE; zend_array * symbol_table_local; /* php 5.3+, php 7+ */ #if PHP_MAJOR_VERSION >= 7 /* Fetch data from symbol table (local scope) */ symbol_table_local = zend_rebuild_symbol_table(); *temp = zend_hash_str_find_ind(symbol_table_local, varname, varlen ); /*************** Not really NULL!!!! **************/ if (*temp != NULL) { *bind_data = temp; *symbol_table_used = symbol_table_local; rc = SUCCESS; /* Fetch data from symbol table (global scope ... mmm??) */ } else { *temp = zend_hash_str_find_ind(&EG(symbol_table), varname, varlen ); if (*temp != NULL) { *bind_data = temp; *symbol_table_used = &EG(symbol_table); rc = SUCCESS; } } Is it a problem with the Zend API?