|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-09-13 12:28 UTC] jcortinap at googlemail dot com
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"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 12:00:01 2025 UTC |
Thank you for your reply. The problem we are having with this, is that when we call ini_set('SMTP', 'our_server') it returns a boolean FALSE which, also according to the manual, means failure, and then there is an error being generated in our application. How can we then differentiate a FALSE being returned from a failure or as the current value of the setting?