| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2015-09-28 20:45 UTC] requinix@php.net
 
-Status: Open
+Status: Not a bug
  [2015-09-28 20:45 UTC] requinix@php.net
  [2015-09-29 15:12 UTC] root at jusme dot org
  [2015-09-29 20:38 UTC] requinix@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 03:00:01 2025 UTC | 
Description: ------------ The documentation states that shmop_open() will return FALSE on failure, but I have discovered at least one error condition (albeit a programmer error) for which it returns NULL. Test script: --------------- var_dump(shmop_open('invalid', 'n', 0660, 1)); // Returns NULL /* The implication is that code such as this doesn't work as intended: $shmid = shmop_open('invalid', 'n', 0660, 1); if ($shmid !== false) { // Success! } elseif ($shmid === false) { // Failure! } The way things stand now a developer would really need to do: if ($shmid !== false && !is_null($shmid)) { // Success! } elseif ($shmid === false || is_null($shmid)) { // Failure! } Which is quite inelegant. Or one could do: if ($shmid) { // Success! } elseif (!$shmid) { // Failure! } But since a success returns an int, I am worried that 0 could be a valid, successful return value, which would cause issues with not using strict type checking. Expected result: ---------------- I expect shmop_open() to ONLY return false on failure so that strict type checking can be employed in case 0 is a valid return value on success. Actual result: -------------- shmop_open() can return NULL if the first parameter is not of the correct type, but I am concerned there could be other failure conditions which also return a value other than false.