php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #23663 ini_get bug when directives come from .htaccess
Submitted: 2003-05-16 14:06 UTC Modified: 2003-05-18 21:33 UTC
From: jdell_nv at yahoo dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.2RC2 OS: Linux 2.4.20smp (RH9)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jdell_nv at yahoo dot com
New email:
PHP Version: OS:

 

 [2003-05-16 14:06 UTC] jdell_nv at yahoo dot com
Hi,

I'm running apache 1.3.27 and PHP 4.3.2 RC2 (both compiled from source).

I found a problem when you setup apache to 'AllowOverride All' and then set php directives from the .htacess file. For example, the magic_quotes_gpc directive:

With php.ini configs, the ini_get value:
magic_quotes_gpc = 1 or blank

With .htacess configs, the ini_get value:
magic_quotes_gpc = On or Off

So (as per php.net docs) ini_get is converting the "On/Off" values in php.ini to "1" or blank, but if the value comes from .htaccess, it is not converted (they stay as "On/Off" values).

This causes problems when developers assume ini_get returns boolean and can be used in an expression such as
"if (ini_get('magic_quotes_gpc'))..." because ini_get can return "Off" which will evaluate to TRUE.

I think this is a bug in ini_get or is an undocumented behavior.

Please let me know if any other information would be helpful in figuring this out!

Thanks,
John

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-18 11:47 UTC] sniper@php.net
You should be using php_flag instead.
With php_value, you should use 1 or 0 for such options.
Not bug, but could be clarified a bit at 

http://www.php.net/manual/en/configuration.changes.php

 [2003-05-18 15:37 UTC] jdell_nv at yahoo dot com
Thanks Sniper!

added clarifying comments at:

http://www.php.net/manual/en/configuration.changes.php
 [2003-05-18 16:32 UTC] derick@php.net
Let's leave it open for the Doc people to 'fix' this.
 [2003-05-18 21:33 UTC] alindeman@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

I shortened the note a bit, as IMO a deep explanation isn't needed.
 [2020-02-07 06:12 UTC] phpdocbot@php.net
Automatic comment on behalf of alindeman
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=0cd6b030a5a7073a2f045ddb2f75e4d25c089c0c
Log: integrate note and fix bug #23663
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 14:00:01 2026 UTC