#41923 [NEW]: ini_set() gives incorrect result
| From: | zoe at uk dot ibm dot com | Date: | Sun, 08 Jul 2007 12:09:31 +0000 |
| Subject: | #41923 [NEW]: ini_set() gives incorrect result | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-114751@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_set() gives incorrect result
Description:
------------
The manual states that ini_set() "returns the old value on success, FALSE
on failure".
When the initial value of a configuration option is an empty string
ini_set() will give a misleading result as shown on the test case below.
This bug is related to 41922.
The ini_set() code which causes the problem is:
old_value = zend_ini_string(Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1,
0);
/* copy to return here, because alter might free it! */
if (old_value) {
RETVAL_STRING(old_value, 1);
} else {
RETVAL_FALSE;
}
So if response is NULL we set a return code of FALSE.
Reproduce code:
---------------
--TEST--
Test to make sure that ini_set returns old value on success, false on
failure
--FILE--
<?php
var_dump(ini_get("error_log"));
var_dump(ini_set("error_log","/tmp/log"));
var_dump(ini_get("error_log"));
?>
--EXPECT--
string(0) ""
string(0) ""
string(8) "/tmp/log"
Expected result:
----------------
See above
Actual result:
--------------
bool(false) <-- see bug 41922
bool(false) <-- implies ini_set() failure, it actually succeeds.
string(8) "/tmp/log"
--
Edit bug report at http://bugs.php.net/?id=41923&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41923&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41923&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41923&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41923&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41923&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41923&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41923&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41923&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41923&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41923&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41923&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41923&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41923&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41923&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41923&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41923&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41923&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41923&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41923&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41923&r=mysqlcfg