From: w at lder dot de
Operating system: Linux 2.6.16.21-0.25-default
PHP version: 5.2.11
PHP Bug Type: MySQL related
Bug description: DEFAULT NULL Values in mysql_query('SHOW COLUMNS FROM `xx`');
Description:
------------
The attached Code results a wrong result.
MySQL:
Server Version: 5.0.26
MySQL-Client-Version: 5.0.26
Reproduce code:
---------------
<?php
/*
MySQL:
CREATE TABLE IF NOT EXISTS `test` (
`hereIsDefaultNULL` int(255) default NULL,
`defaultNULLvarchar` varchar(255) default NULL
)
*/
mysql_connect('localhost','user','');
mysql_select_db('test');
$columns_res = mysql_query('SHOW COLUMNS FROM `test`');
while ($fieldRow = mysql_fetch_assoc($columns_res)) {
print_r($fieldRow) ;
}
?>
Expected result:
----------------
Array
(
[Field] => hereIsDefaultNULL
[Type] => int(255)
[Null] => YES
[Key] =>
[Default] => NULL
[Extra] =>
)
Array
(
[Field] => defaultNULLvarchar
[Type] => varchar(255)
[Null] => YES
[Key] =>
[Default] => NULL
[Extra] =>
)
Actual result:
--------------
Array
(
[Field] => hereIsDefaultNULL
[Type] => int(255)
[Null] => YES
[Key] =>
[Default] =>
[Extra] =>
)
Array
(
[Field] => defaultNULLvarchar
[Type] => varchar(255)
[Null] => YES
[Key] =>
[Default] =>
[Extra] =>
)
--
Edit bug report at http://bugs.php.net/?id=50147&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50147&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50147&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50147&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50147&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50147&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50147&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50147&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50147&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50147&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50147&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50147&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50147&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50147&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50147&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50147&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50147&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50147&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50147&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50147&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50147&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50147&r=mysqlcfg