#42657 [NEW]: ini_get returns an unexpected value

From: Date: Thu, 13 Sep 2007 12:28:56 +0000
Subject: #42657 [NEW]: ini_get returns an unexpected value
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-117523@lists.php.net to get a copy of this message
From: jcortinap at googlemail dot com Operating system: Win XP Pro / Win 2003 Server PHP version: 5.2.4 PHP Bug Type: *Configuration Issues Bug description: ini_get returns an unexpected value Description: ------------ This problem was found trying to set the sendmail_from directive from a script. This directive is intentionally NOT set on the php.ini (it is commented out). According to the documentation, ini_get should return an empty string since the directive is not set, but it returns a boolean false. When calling ini_set to set the value, it is expected to get the old value on success or FALSE on failure, and what we experience is that the setting is correctly set, but FALSE is returned. My theory is that ini_set is working correctly returning the "old" value of the setting, but since the old value is being returned as FALSE from ini_get, this is what we get as a return from ini_set, so the problem seems to be in the ini_get function. Tested with the same results on both 4.4.7 and 5.2.4. Reproduce code: --------------- // sendmail_from not set in php.ini. This should return an empty string $value = ini_get('sendmail_from'); var_dump($value); // sendmail_from is correctly set, so an empty string should be returned $old_value = ini_set('sendmail_from', 'from@example.com'); var_dump($old_value); // new value of the sendmail_from directive is correctly set $value = ini_get('sendmail_from'); var_dump($value); Expected result: ---------------- string(0) "" string(0) "" string(16) "from@example.com" Actual result: -------------- bool(false) bool(false) string(16) "from@example.com" -- Edit bug report at http://bugs.php.net/?id=42657&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42657&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42657&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42657&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42657&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42657&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42657&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42657&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42657&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42657&r=support Expected behavior: http://bugs.php.net/fix.php?id=42657&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42657&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42657&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42657&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42657&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42657&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42657&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42657&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42657&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42657&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42657&r=mysqlcfg

« previous php.bugs (#117523) next »