#41922 [Opn->WFx]: ini_get() gives ambiguous result
| From: | iliaa@php.net | Date: | Sun, 08 Jul 2007 15:19:01 +0000 |
| Subject: | #41922 [Opn->WFx]: ini_get() gives ambiguous result | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-114754@lists.php.net to get a copy of this message | ||
ID: 41922
Updated by: iliaa@php.net
Reported By: zoe at uk dot ibm dot com
-Status: Open
+Status: Wont fix
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 5CVS-2007-07-08 (CVS)
New Comment:
While this is a good idea, unfortunately it would introduce API break
and likely break many apps that utilize this function.
Previous Comments:
------------------------------------------------------------------------
[2007-07-08 11:44:10] zoe at uk dot ibm dot com
Description:
------------
The manual states "Returns the value of the configuration option as a
string on success, or an empty string on failure"
Some options (eg docref_ext, disable_classes) have default values of an
empty string, in these cases ini_get() will return an empty string when
the function has failed AND when it has succeeded.
The problem is in the following code:
ZEND_API char *zend_ini_string(char *name, uint name_length, int orig)
{
zend_ini_entry *ini_entry;
TSRMLS_FETCH();
if (zend_hash_find(EG(ini_directives), name, name_length, (void
**) &ini_entry)==SUCCESS) {
if (orig && ini_entry->modified) {
return ini_entry->orig_value;
} else {
return ini_entry->value;
}
}
return "";
}
Reproduce code:
---------------
Here is a test that will always pass even when ini_get fails.
--TEST--
ini_get returns value of the configuration option as a string on
success, empty string on failure
--FILE--
<?php
var_dump(ini_get("disable_classes"));
?>
--EXPECT--
string(0) ""
Expected result:
----------------
I would like to be able to see a failure - if ini_get() fails. For
example ini_get() could return FALSE on failure (as ini_set() does), if
there are no configuration options that have a default value of FALSE.
Actual result:
--------------
Always a null string.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41922&edit=1