Bug #60064 [NEW]: constants SQLSRV_NULLABLE_YES, SQLSRV_NULLABLE_NO are reversed!
| From: | android at mikedev dot com | Date: | Fri, 14 Oct 2011 15:40:44 +0000 |
| Subject: | Bug #60064 [NEW]: constants SQLSRV_NULLABLE_YES, SQLSRV_NULLABLE_NO are reversed! | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-164327@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows 2003/2008
PHP version: 5.3.8
Package: sqlsrv
Bug Type: Bug
Bug description:constants SQLSRV_NULLABLE_YES, SQLSRV_NULLABLE_NO are reversed!
Description:
------------
---
From manual page:
http://www.php.net/function.sqlsrv-field-metadata#refsect1-function.sqlsrv-field-metadata-returnvalues
---
constants SQLSRV_NULLABLE_YES, SQLSRV_NULLABLE_NO are actually reversed!
in my database, I set a field that is 'NOT NULL',
sqlsrv_field_metadata() reports it is SQLSRV_NULLABLE_YES and vice versa
for the SQLSRV_NULLABLE_NO.
Test script:
---------------
// open database and make connection, etc.
// select * from mytable
// etc.
foreach( sqlsrv_field_metadata($stmt) as $fieldMetadata ) {
print($fieldMetadata['Name'] . " is ");
if ( $fieldMetadata['Nullable'] === SQLSRV_NULLABLE_YES )
print("NULLABLE_YES\n");
else if ( $fieldMetadata['Nullable'] === SQLSRV_NULLABLE_NO )
print("NULLABLE_NO\n");
else
print("NULLABLE_UNKNOWN\n");
}
Expected result:
----------------
field1 is NULLABLE_YES
field2 is NULLABLE_NO
field3 is NULLABLE_NO
Actual result:
--------------
field1 is NULLABLE_NO
field2 is NULLABLE_YES
field3 is NULLABLE_YES
--
Edit bug report at https://bugs.php.net/bug.php?id=60064&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60064&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60064&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60064&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=60064&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60064&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=60064&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=60064&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=60064&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=60064&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=60064&r=support
Expected behavior: https://bugs.php.net/fix.php?id=60064&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=60064&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=60064&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=60064&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60064&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60064&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=60064&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=60064&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=60064&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=60064&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=60064&r=mysqlcfg