#47832 [Fbk->Opn]: Garbled associative array indices

2009-03-30 Thread r dot borschel at gmx dot net
 ID:   47832
 User updated by:  r dot borschel at gmx dot net
 Reported By:  r dot borschel at gmx dot net
-Status:   Feedback
+Status:   Open
 Bug Type: PDO related
 Operating System: OS X 10.5.6
 PHP Version:  5.3CVS-2009-03-29 (snap)
 Assigned To:  mysql
 New Comment:

That's interesting. Here is the output:

$ otool -L sapi/cli/php | grep mysql
/sw/lib/mysql/libmysqlclient.15.dylib (compatibility version 16.0.0,
current version 16.0.0)

So the libmysql getting loaded is from Fink (/sw is the root directory
of Fink). Clearly this is not what I wanted. Here is my complete
configure listing:

'./configure' \
'--prefix=/usr/local/php-5.3' \
'--with-apxs2=/usr/local/apache2.2.9/bin/apxs' \
'--enable-exif' \
'--with-gd' \
'--with-jpeg-dir=/sw' \
'--with-png-dir=/sw' \
'--enable-mbstring' \
'--with-mcrypt=/sw' \
'--with-mhash=/sw' \
'--with-iconv' \
'--with-mysql=/usr/local/mysql-5.1.32-osx10.5-x86' \
'--with-pdo-mysql=/usr/local/mysql-5.1.32-osx10.5-x86' \
'--with-pdo-pgsql=/usr/local/pgsql' \
'--with-pgsql=/usr/local/pgsql/' \
'--with-curl=/sw' \
'--with-zlib-dir=/sw' \
'--enable-soap' \
'--enable-sqlite-utf8' \
'--enable-zip' \

As you can see I'm using Fink libraries for some of the dependencies
but clearly not for mysql. It seems, however, that the Fink libmysql is
chosen anyway for whatever reason (/sw paths are prepended to the $PATH
so maybe that has something to do with it)

It's good to see that this issue is rather caused by a "version mess"
on my side even though the resulting behavior is a bit scary because it
does not indicate any errors, just garbled results.

Thanks for helping me resolve this issue. As far as I am concerned this
does not seem like a PHP-related issue and I guess unpredictable
behavior is supposed to be expected when using incompatible versions.

Feel free to close this issue if you think it does not deserve any
further attention.


Previous Comments:


[2009-03-30 14:35:49] johan...@php.net

don't have a mac at hand, if ldd doesn't work try "otool -L" ("which is
part of the developer tools")

----

[2009-03-30 14:27:23] johan...@php.net

hm, interesting mixup, can you try doing

ldd sapi/cli/php | grep mysql

to see which libmysql is being loaded?



[2009-03-30 12:35:27] r dot borschel at gmx dot net

$ sapi/cli/php --ri pdo_mysql

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => 5.0.38

Thats a bit strange, isnt it? My configure looks like this:

'./configure' \
...
'--with-mysql=/usr/local/mysql-5.1.32-osx10.5-x86' \
'--with-pdo-mysql=/usr/local/mysql-5.1.32-osx10.5-x86' \
...
 
That version mismatch may be the problem? Am I doing something
obviously wrong?

Thanks for your help.



[2009-03-30 11:44:41] johan...@php.net

Which MySQL server and client library versions are you using? - I
tested using 5.1.31 worked for me:

$ sapi/cli/php --ri pdo_mysql

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => 5.1.31

$ sapi/cli/php bug47832.php
array(4) {
  ["c0__id"]=>
  string(1) "1"
  ["c0__status"]=>
  string(9) "developer"
  ["c0__username"]=>
  string(6) "romanb"
  ["c0__name"]=>
  string(5) "Roman"
}




[2009-03-29 20:19:46] r dot borschel at gmx dot net

The INSERT statement should of course read:

INSERT INTO `testdb`.`cms_users` (
`id` ,
`status` ,
`username` ,
`name`
) VALUES (NULL , 'developer', 'romanb', 'Roman');



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/47832

-- 
Edit this bug report at http://bugs.php.net/?id=47832&edit=1



#47832 [Fbk->Opn]: Garbled associative array indices

2009-03-30 Thread r dot borschel at gmx dot net
 ID:   47832
 User updated by:  r dot borschel at gmx dot net
 Reported By:  r dot borschel at gmx dot net
-Status:   Feedback
+Status:   Open
 Bug Type: PDO related
 Operating System: OS X 10.5.6
 PHP Version:  5.3CVS-2009-03-29 (snap)
 Assigned To:  mysql
 New Comment:

$ sapi/cli/php --ri pdo_mysql

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => 5.0.38

Thats a bit strange, isnt it? My configure looks like this:

'./configure' \
...
'--with-mysql=/usr/local/mysql-5.1.32-osx10.5-x86' \
'--with-pdo-mysql=/usr/local/mysql-5.1.32-osx10.5-x86' \
...
 
That version mismatch may be the problem? Am I doing something
obviously wrong?

Thanks for your help.


Previous Comments:


[2009-03-30 11:44:41] johan...@php.net

Which MySQL server and client library versions are you using? - I
tested using 5.1.31 worked for me:

$ sapi/cli/php --ri pdo_mysql

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => 5.1.31

$ sapi/cli/php bug47832.php
array(4) {
  ["c0__id"]=>
  string(1) "1"
  ["c0__status"]=>
  string(9) "developer"
  ["c0__username"]=>
  string(6) "romanb"
  ["c0__name"]=>
  string(5) "Roman"
}




[2009-03-29 20:19:46] r dot borschel at gmx dot net

The INSERT statement should of course read:

INSERT INTO `testdb`.`cms_users` (
`id` ,
`status` ,
`username` ,
`name`
) VALUES (NULL , 'developer', 'romanb', 'Roman');



[2009-03-29 20:17:04] r dot borschel at gmx dot net

Description:

Associative array indices are getting garbled when usind pdo_mysql when
mysql & pdo_mysql were compiled against libmysql. Compiling against
mysqlnd fixes the issue.

Reproduce code:
---
#
# SQL
#

CREATE TABLE IF NOT EXISTS `cms_users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT INTO `doctrinetests`.`cms_users` (
`id` ,
`status` ,
`username` ,
`name`
) VALUES (NULL , 'developer', 'romanb', 'Roman');

#
# PHP
#
$pdo = new PDO("mysql:host=localhost;dbname=testdb", "xxx", "xxx");

$stmt = $pdo->prepare("SELECT c0.id AS c0__id, c0.status AS c0__status,
c0.username AS c0__username, c0.name AS c0__name FROM cms_users c0");

$stmt->execute();

while ($data = $stmt->fetch(PDO::FETCH_ASSOC)) {
var_dump($data);
}

Expected result:

array(6) {
  ["c0__id"]=>  string(2) "16"
  ["c0__status"]=>  string(9) "developer"
  ["c0__username"]=>  string(6) "romanb"
  ["c0__name"]=>  string(5) "Roman"
}  

Actual result:
--
array(6) {
  ["c0__id"]=>  string(2) "16"
  ["status"]=>  string(9) "developer"
  ["c0"]=>  string(6) "romanb"
  ["cms_users"]=>  string(5) "Roman"
}  





-- 
Edit this bug report at http://bugs.php.net/?id=47832&edit=1



#47832 [Com]: Garbled associative array indices

2009-03-29 Thread r dot borschel at gmx dot net
 ID:   47832
 Comment by:   r dot borschel at gmx dot net
 Reported By:  r dot borschel at gmx dot net
 Status:   Open
 Bug Type: PDO related
 Operating System: OS X 10.5.6
 PHP Version:  5.3CVS-2009-03-29 (snap)
 New Comment:

The INSERT statement should of course read:

INSERT INTO `testdb`.`cms_users` (
`id` ,
`status` ,
`username` ,
`name`
) VALUES (NULL , 'developer', 'romanb', 'Roman');


Previous Comments:
--------

[2009-03-29 20:17:04] r dot borschel at gmx dot net

Description:

Associative array indices are getting garbled when usind pdo_mysql when
mysql & pdo_mysql were compiled against libmysql. Compiling against
mysqlnd fixes the issue.

Reproduce code:
---
#
# SQL
#

CREATE TABLE IF NOT EXISTS `cms_users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT INTO `doctrinetests`.`cms_users` (
`id` ,
`status` ,
`username` ,
`name`
) VALUES (NULL , 'developer', 'romanb', 'Roman');

#
# PHP
#
$pdo = new PDO("mysql:host=localhost;dbname=testdb", "xxx", "xxx");

$stmt = $pdo->prepare("SELECT c0.id AS c0__id, c0.status AS c0__status,
c0.username AS c0__username, c0.name AS c0__name FROM cms_users c0");

$stmt->execute();

while ($data = $stmt->fetch(PDO::FETCH_ASSOC)) {
var_dump($data);
}

Expected result:

array(6) {
  ["c0__id"]=>  string(2) "16"
  ["c0__status"]=>  string(9) "developer"
  ["c0__username"]=>  string(6) "romanb"
  ["c0__name"]=>  string(5) "Roman"
}  

Actual result:
--
array(6) {
  ["c0__id"]=>  string(2) "16"
  ["status"]=>  string(9) "developer"
  ["c0"]=>  string(6) "romanb"
  ["cms_users"]=>  string(5) "Roman"
}  





-- 
Edit this bug report at http://bugs.php.net/?id=47832&edit=1



#47832 [NEW]: Garbled associative array indices

2009-03-29 Thread r dot borschel at gmx dot net
From: r dot borschel at gmx dot net
Operating system: OS X 10.5.6
PHP version:  5.3CVS-2009-03-29 (snap)
PHP Bug Type: PDO related
Bug description:  Garbled associative array indices

Description:

Associative array indices are getting garbled when usind pdo_mysql when
mysql & pdo_mysql were compiled against libmysql. Compiling against mysqlnd
fixes the issue.

Reproduce code:
---
#
# SQL
#

CREATE TABLE IF NOT EXISTS `cms_users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT INTO `doctrinetests`.`cms_users` (
`id` ,
`status` ,
`username` ,
`name`
) VALUES (NULL , 'developer', 'romanb', 'Roman');

#
# PHP
#
$pdo = new PDO("mysql:host=localhost;dbname=testdb", "xxx", "xxx");

$stmt = $pdo->prepare("SELECT c0.id AS c0__id, c0.status AS c0__status,
c0.username AS c0__username, c0.name AS c0__name FROM cms_users c0");

$stmt->execute();

while ($data = $stmt->fetch(PDO::FETCH_ASSOC)) {
var_dump($data);
}

Expected result:

array(6) {
  ["c0__id"]=>  string(2) "16"
  ["c0__status"]=>  string(9) "developer"
  ["c0__username"]=>  string(6) "romanb"
  ["c0__name"]=>  string(5) "Roman"
}  

Actual result:
--
array(6) {
  ["c0__id"]=>  string(2) "16"
  ["status"]=>  string(9) "developer"
  ["c0"]=>  string(6) "romanb"
  ["cms_users"]=>  string(5) "Roman"
}  

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