#41922 [NEW]: ini_get() gives ambiguous result

From: Date: Sun, 08 Jul 2007 11:44:10 +0000
Subject: #41922 [NEW]: ini_get() gives ambiguous result
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-114750@lists.php.net to get a copy of this message
From: zoe at uk dot ibm dot com Operating system: Linux PHP version: 5CVS-2007-07-08 (CVS) PHP Bug Type: Scripting Engine problem Bug description: ini_get() gives ambiguous result Description: ------------ The manual states "Returns the value of the configuration option as a string on success, or an empty string on failure" Some options (eg docref_ext, disable_classes) have default values of an empty string, in these cases ini_get() will return an empty string when the function has failed AND when it has succeeded. The problem is in the following code: ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) { zend_ini_entry *ini_entry; TSRMLS_FETCH(); if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) { if (orig && ini_entry->modified) { return ini_entry->orig_value; } else { return ini_entry->value; } } return ""; } Reproduce code: --------------- Here is a test that will always pass even when ini_get fails. --TEST-- ini_get returns value of the configuration option as a string on success, empty string on failure --FILE-- <?php var_dump(ini_get("disable_classes")); ?> --EXPECT-- string(0) "" Expected result: ---------------- I would like to be able to see a failure - if ini_get() fails. For example ini_get() could return FALSE on failure (as ini_set() does), if there are no configuration options that have a default value of FALSE. Actual result: -------------- Always a null string. -- Edit bug report at http://bugs.php.net/?id=41922&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41922&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41922&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41922&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41922&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41922&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41922&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41922&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41922&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41922&r=support Expected behavior: http://bugs.php.net/fix.php?id=41922&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41922&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41922&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41922&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41922&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41922&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41922&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41922&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41922&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41922&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41922&r=mysqlcfg

« previous php.bugs (#114750) next »