#25865 [Opn->Bgs]: ini_get returns 0 not "" for boolean?

From: Date: Thu, 08 Jul 2004 11:42:14 +0000
Subject: #25865 [Opn->Bgs]: ini_get returns 0 not "" for boolean?
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969361764@lists.php.net to get a copy of this message
ID: 25865 User updated by: php dot net at b-a-l-u dot de Reported By: php dot net at b-a-l-u dot de -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: Linux PHP Version: Irrelevant New Comment: As I said in my opening message the documentation says "When querying boolean values: A boolean ini value of off will be returned as an empty string while a boolean ini value of on will be returned as "1". " So it IS a documentation problem if PHP<5 returns "" or 0 depending on where it got set. I'd expect at least a warning like PHP versions before PHP5 return an empty string or 0 to specify a boolean value of false. The best way to test the return value is to cast it - e.g. $register_globals = (bool) ini_get('register_gobals'); Balu Previous Comments: ------------------------------------------------------------------------ [2004-07-08 13:33:52] nlopess@php.net It's a doc problem, at least! Did you read my message on internals? (which nobody answered till now) http://marc.theaimsgroup.com/?l=php-dev&m=108922680605154&w=2 ------------------------------------------------------------------------ [2004-07-08 08:57:21] derick@php.net Not a bug, nor a doc problem. It depends on where the option is set to return an empty string or 0. ------------------------------------------------------------------------ [2004-07-07 20:54:54] nlopess@php.net re-open this. reference: http://news.php.net/php.doc/969361748 ------------------------------------------------------------------------ [2004-07-07 18:48:56] a-konovalenko at yandex dot ru This is not bogus! I can reproduce it when the option comes from the .htaccess file (set with php_flag). ini_get() returns "0" instead of "" for the options that are off. I'm using PHP 4.3.4 under Apache 1.3.31. (Even if this is fixed in the latest version of PHP, the documentation should be updated for the older ones.) P.S. Will my comment reopen this bug automatically or should I do something special? ------------------------------------------------------------------------ [2003-10-14 12:38:32] sniper@php.net # php -r "var_dump(ini_get('register_globals'));" string(0) "" ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/25865 -- Edit this bug report at http://bugs.php.net/?id=25865&edit=1

« previous php.doc (#969361764) next »