#50147 [NEW]: DEFAULT NULL Values in mysql_query('SHOW COLUMNS FROM `xx`');
| From: | w at lder dot de | Date: | Wed, 11 Nov 2009 10:35:02 +0000 |
| Subject: | #50147 [NEW]: DEFAULT NULL Values in mysql_query('SHOW COLUMNS FROM `xx`'); | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-144452@lists.php.net to get a copy of this message | ||
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