Edit report at https://bugs.php.net/bug.php?id=36810&edit=1

 ID:                 36810
 Updated by:         yohg...@php.net
 Reported by:        djslakor at hotmail dot com
 Summary:            ini_set() returns FALSE, even upon success, if the
                     option wasn't set in php.ini
-Status:             Open
+Status:             Closed
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   win32
 PHP Version:        4CVS-2006-03-21 (snap)
-Assigned To:        
+Assigned To:        yohgaki
 Block user comment: N
 Private report:     N

 New Comment:

It seems issue is fixed.

<?php
$blah = ini_set("user_agent", "Mozilla");

var_dump($blah);

outputs

string(0) ""


Previous Comments:
------------------------------------------------------------------------
[2006-03-21 02:30:17] djslakor at hotmail dot com

Description:
------------
In my example, I wanted to modify the user_agent fopen wrapper option in order 
to spoof a user_agent (obviously).  In my current php.ini configuration, the 
user_agent line is commented out.  When issuing ini_set("user_agent", 
"Mozilla"), for example, the function returns false, although it succeeds.  

The documentation states the function is to return the previous value for the 
option, however, in this case, since the option was not set to begin with, it 
returns false, which indicates failure (although the call was a success).  This 
does not make sense.

Reproduce code:
---------------
Pre-req: user_agent must be commented out in php.ini

$blah = ini_set("user_agent", "Mozilla");

var_dump($blah);

Expected result:
----------------
I expect the function to successfully set user_agent to "Mozilla", which in 
this case it does, and return something other than false, which indicates 
failure.

[3 Sep 2002 3:54pm CEST] sni...@php.net

What's the bug here? If some ini setting is not set at all, what should be 
returned else than false?

Response:

Perhaps if the option is not already set, instead of returning false, it should 
simply return the value you just set the option to.  This would be better than 
indicating a failure when one doesn't exist.

Actual result:
--------------
Returns false.


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=36810&edit=1

Reply via email to