|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2009-02-17 12:04 UTC] felipe@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 05:00:02 2025 UTC | 
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