From:             paul at quakenet dot org
Operating system: NA
PHP version:      5.3.0beta1
PHP Bug Type:     ODBC related
Bug description:  odbc_fetch_into - BC in php 5.3.0

Description:
------------
odbc_fetch_into reuses objects in php 5.3.0

The repro code belows works correctly with PHP 5.2.3, 5.2.5, 5.2.8,
5.2.9rc

And behaves 'incorrectly' in PHP 5.3a2, 5.3b1, 5.3a3.

This issue was spotted whilst investigating why an application utilising
the adodb db abstraction library started behaving incorrectly when using
php 5.3

Reproduce code:
---------------
<?php

$dbname = 'bugtracker';
$dbuser = 'sa';
$dbpass = 'pass';
$g_hostname = "Driver={SQL Server};SERVER=.\sqlexpress;DATABASE=" .
$dbname . ";";
$metaTablesSQL="select name,case when type='U' then 'T' else 'V' end from
sysobjects where (type='U' or type='V') and (name not in
('sysallocations','syscolumns','syscomments','sysdepends','sysfilegroups','sysfiles','sysfiles1','sysforeignkeys','sysfulltextcatalogs','sysindexes','sysindexkeys','sysmembers','sysobjects','syspermissions','sysprotects','sysreferences','systypes','sysusers','sysalternates','sysconstraints','syssegments','REFERENTIAL_CONSTRAINTS','CHECK_CONSTRAINTS','CONSTRAINT_TABLE_USAGE','CONSTRAINT_COLUMN_USAGE','VIEWS','VIEW_TABLE_USAGE','VIEW_COLUMN_USAGE','SCHEMATA','TABLES','TABLE_CONSTRAINTS','TABLE_PRIVILEGES','COLUMNS','COLUMN_DOMAIN_USAGE','COLUMN_PRIVILEGES','DOMAINS','DOMAIN_CONSTRAINTS','KEY_COLUMN_USAGE'))";

class testcase {
        var $fields = array();
        var $odbc;

        function testcase() {
                global $g_hostname, $dbuser, $dbpass, $metaTablesSQL;
                $this->odbc = odbc_connect($g_hostname,$dbuser,$dbpass);
                $res = odbc_exec($this->odbc, $metaTablesSQL);

                $foo = array();
                
                echo "First Set (these should match 2nd set):\n";
                while (odbc_fetch_into($res, $this->fields)) {
                        //var_dump($this->fields);die;
                        $foo[] = $this->fields;
                        echo $this->fields[0] . "\n";
                }
                echo "Second Set (should match 1st set):\n";
                foreach($foo as $bar) {
                        echo $bar[0] . "\n";
                }
        }
}
$f = new testcase();

Expected result:
----------------
table1
table2
table3
---
table1
table2
table3

Actual result:
--------------
table1
table2
table3
----
table3
table3
table3

-- 
Edit bug report at http://bugs.php.net/?id=47390&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47390&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47390&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47390&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47390&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47390&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47390&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47390&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47390&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47390&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47390&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47390&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47390&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47390&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47390&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47390&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47390&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47390&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47390&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47390&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47390&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47390&r=mysqlcfg

Reply via email to