php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60064 constants SQLSRV_NULLABLE_YES, SQLSRV_NULLABLE_NO are reversed!
Submitted: 2011-10-14 15:40 UTC Modified: 2011-12-29 00:57 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: android at mikedev dot com Assigned: jguerin (profile)
Status: Closed Package: sqlsrv (PECL)
PHP Version: 5.3.8 OS: Windows 2003/2008
Private report: No CVE-ID: None
 [2011-10-14 15:40 UTC] android at mikedev dot com
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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-15 17:35 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: jguerin
 [2011-10-17 20:12 UTC] jguerin@php.net
Hi,

Many thanks for your feedback. I have filed a bug in our internal system and will report the results of our investigation.

Thanks!

Jonathan
 [2011-12-29 00:56 UTC] jguerin@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php

We have verified this bug, and have identified a fix. Will be releasing this fix in our next release of our driver.
 [2011-12-29 00:56 UTC] jguerin@php.net
-Status: Assigned +Status: Verified
 [2011-12-29 00:57 UTC] jguerin@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 09:01:29 2024 UTC