get_cfg_var and phpinfo disagree
| From: | Flavien LEBARBE | Date: | Mon, 21 Feb 2000 12:16:43 +0000 |
| Subject: | get_cfg_var and phpinfo disagree | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-10565@lists.php.net to get a copy of this message | ||
Hello,
Here's the problem I had :
Running php4b3 on a linux-box as an apache 1.3.11 module,
phpinfo() displays all environment variables correctly, but
get_cfg_var doesn't.
We had a look at the code and discovered the following :
*phpinfo calls
php_print_info which calls
display_ini_entries which calls
zend_ash_apply_with_argument (
&known_directives, php_ini_displayer)
*get_cfg_var calls
cfg_get_string which calls
zend_hash_find(&configuration_hash, varname)
configuration_hash and known_directives are of type HashTable
and are declared static in different files.
The problem I see is that configuration_hash is not initialized
if there's no php.ini file. And that's where my problem was. Yes,
I know, I should have had one, but... Isn't it written in the
source :
return SUCCESS; /* having no configuration file is ok */
?? ;-)
Zeev, what do you think of this ?
Would you consider a patch to change this behaviour, so that
get_cfg_var returns the current value whatever a php.ini file
exists or not ?
Flavien Lebarbé.
---
Open Care