|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-03-21 02:30 UTC] 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] sniper@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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 06:00:01 2025 UTC |
It seems issue is fixed. <?php $blah = ini_set("user_agent", "Mozilla"); var_dump($blah); outputs string(0) ""