#47390 [Opn->Csd]: odbc_fetch_into - BC in php 5.3.0
| From: | felipe@php.net | Date: | Tue, 17 Feb 2009 12:04:12 +0000 |
| Subject: | #47390 [Opn->Csd]: odbc_fetch_into - BC in php 5.3.0 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-133904@lists.php.net to get a copy of this message | ||
ID: 47390
Updated by: felipe@php.net
Reported By: paul at quakenet dot org
-Status: Open
+Status: Closed
Bug Type: ODBC related
Operating System: NA
PHP Version: 5.3.0beta1
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2009-02-14 22:38:55] paul at quakenet dot org
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 this bug report at http://bugs.php.net/?id=47390&edit=1