| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [2001-07-06 06:03 UTC] flying at dom dot natm dot ru
 It seems to be a problem when ibase_execute called indirectly, through call_user_func_array().
Look at the following piece of code:
$args = array('some text','amother text');
$query = ibase_prepare($conn,"insert into MY_TABLE (INT_FIELD, STR_FIELD) values (?,?)");
array_unshift($args,$query);
print_r($args);
$rs = call_user_func_array('ibase_execute',$args);
print_r($args);
ibase_free_query($query);
MY_TABLE table contains two columns:
INT_FIELD INTEGER,
STR_FIELD VARCHAR(50)
 Imagine, that we're make an error, and pass string values for both fields. 
No error will be given, but at second print_r() first item inro $args array 
will be equal to 0 instead of 'some text'.
 As I can understand, all query parameters are replaced by values, actually 
stored into database (like they are passed by reference, 
but allow_call_time_pass_reference options is turned off). 
 If it is not a bug, but a "feature", it must be documented, to avoid future misunderstandings.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 13:00:02 2025 UTC | 
Here is full information, test database creation script included: test.sql ======== SET SQL DIALECT 3; SET NAMES NONE; CREATE DATABASE 'C:\TEST.GDB' USER 'SYSDBA' PASSWORD 'masterkey' PAGE_SIZE 4096 DEFAULT CHARACTER SET NONE; CREATE GENERATOR GEN_MY_TABLE_ID; CREATE TABLE MY_TABLE ( ID INTEGER NOT NULL, STR_FIELD VARCHAR(50), INT_FIELD INTEGER); ALTER TABLE MY_TABLE ADD CONSTRAINT PK__MY_TABLE PRIMARY KEY (ID); SET TERM ^ ; CREATE TRIGGER MY_TABLE_BI FOR MY_TABLE ACTIVE BEFORE INSERT POSITION 0 AS BEGIN IF (NEW.ID IS NULL) THEN NEW.ID = GEN_ID(GEN_MY_TABLE_ID,1); END ^ SET TERM ; ^ test.php ======== <?php ibase_connect('localhost:c:\test.gdb','SYSDBA','masterkey'); $args = array('some text','another text'); $query = ibase_prepare('insert into MY_TABLE (INT_FIELD, STR_FIELD) values (?,?)'); array_unshift($args,$query); print_r($args); $rs = call_user_func_array('ibase_execute',$args); print_r($args); ibase_free_query($query); ibase_close(); ?> Expected results: ================= Array ( [0] => Resource id #2 [1] => some text [2] => another text ) Array ( [0] => Resource id #2 [1] => some text [2] => another text ) Actual results: =============== Array ( [0] => Resource id #2 [1] => some text [2] => another text ) Array ( [0] => Resource id #2 [1] => 0 [2] => another text ) --------------------------------------- As you can see - after calling call_user_func_array() data into $args[1] has been changed, while it should stay the same.