note 19874 modified in function.ini-set by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 00:42:28 +0000 |
| Subject: | note 19874 modified in function.ini-set by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141859@lists.php.net to get a copy of this message | ||
[[[Editors note: Just because you're able to set something
doesn't mean it will work as expected. Depends on the
setting. For example. setting register_globals at
runtime will be of little use as its job has already
been completed by the time it reaches your script.
]]]
When a setting can not be changed in a user script, the return value of ini_set is
"empty", not "false" as you may expect.
If you check in your script for return value is "false" the script will continue
processing, although the setting has not been set.
The boolean return value is used for settings that can be changed in a script. Otherwise the empty
value is returned.
To test for both error conditions use:
<?php
if (empty($blnResult) or (!$blnResult)) {
echo "setting cannot be set";
exit;
}
?>
--was--
[[[Editors note: Just because you're able to set something
doesn't mean it will work as expected. Depends on the
setting. For example. setting register_globals at
runtime will be of little use as its job has already
been completed by the time it reaches your script.
]]]
When a setting can not be changed in a user script, the return value of ini_set is
"empty", not "false" as you may expect.
If you check in your script for return value is "false" the script will continue
processing, although the setting has not been set.
The boolean return value is used for settings that can be changed in a script. Otherwise the empty
value is returned.
To test for both error conditions use:
if (empty($blnResult) or (!$blnResult)) {
echo "setting cannot be set";
exit;
}
http://php.net/manual/en/function.ini-set.php