php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47390 odbc_fetch_into - BC in php 5.3.0
Submitted: 2009-02-14 22:38 UTC Modified: 2009-02-17 12:04 UTC
From: paul at quakenet dot org Assigned:
Status: Closed Package: ODBC related
PHP Version: 5.3.0beta1 OS: NA
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
16 - 3 = ?
Subscribe to this entry?

 
 [2009-02-14 22:38 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-17 12:04 UTC] felipe@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 04:01:30 2024 UTC