php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41923 ini_set() gives incorrect result
Submitted: 2007-07-08 12:09 UTC Modified: 2007-07-08 13:35 UTC
From: zoe at uk dot ibm dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5CVS-2007-07-08 (CVS) OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: zoe at uk dot ibm dot com
New email:
PHP Version: OS:

 

 [2007-07-08 12:09 UTC] zoe at uk dot ibm dot com
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"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-08 13:35 UTC] zoe@php.net
Sorry - this is nonsense - willopen another with correct description
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 15:00:01 2026 UTC