php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28878 Setting of inikey's in obj.conf fails
Submitted: 2004-06-22 05:34 UTC Modified: 2004-06-24 05:53 UTC
From: michaelw at webcentral dot com dot au Assigned:
Status: Closed Package: iPlanet related
PHP Version: 4.3.7 OS: Solaris 9
Private report: No CVE-ID: None
 [2004-06-22 05:34 UTC] michaelw at webcentral dot com dot au
Description:
------------
Attempting to set ini values within the obj.conf file (or vserver.obj.conf if thats where your virtual hosts are pointed) fails silently. 


This appears to be caused by the logic in sapi/nsapi/nsapi.c ( static void nsapi_php_ini_entries(NSLS_D TSRMLS_DC) ) , in particular the following snippet:

--- SNIP ---
ok=1;
for (j=0; nsapi_exclude_from_ini_entries[j]; j++) {
ok&=(!strcasecmp(entry->param->name,nsapi_exclude_from_ini_entries[j])); 
}

if (ok) {
--- SNIP ---

It appears that ok is never returning as TRUE, and thus the code never enters the if (ok) block. 

I modified it as follows (although I'm sure there are better ways..):

--- SNIP ---
ok=1;
for (j=0; nsapi_exclude_from_ini_entries[j]; j++) {
  if (!strcasecmp(entry->param->name,nsapi_exclude_from_ini_entries[j]))        
    {
      ok = 0;
    }
  }
if (ok) {
--- SNIP ---

Additionally, the code that actually updates the ini value in the same method):

--- SNIP ---
if (ok) {
  /* change the ini entry */
  if (zend_alter_ini_entry(entry->param->name,strlen(entry->param->name)+1,entry->param->value,strlen(entry->param->value),PHP_INI_USER,PHP_INI_STAGE_RUNTIME)==FAILURE)   
    {
      log_error(LOG_WARN, pblock_findval("fn", NSG(pb)),NSG(sn), NSG(rq), "Cannot change php.ini key \"%s\" to \"%s\"", entry->param->name, entry->param->value);
    }
}
--- SNIP ---

checks the method to see if it is PHP_INI_USER allowed, whilst since it is in a system file (obj.conf or vserver.obj.conf) I would expect it to test against PHP_INI_SYSTEM ?




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-22 16:24 UTC] iliaa@php.net
Does it work if you change  
ok&=(!strcasecmp(entry->param->name,nsapi_exclude_from_ini_entries[j])); 
to 
ok=(!strcasecmp(entry->param->name,nsapi_exclude_from_ini_entries[j])); 
 [2004-06-22 17:38 UTC] thetaphi@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

The logic here is incorrect, could be better to change code to yours or the following -- sorry:
ok&=(strcasecmp(entry->param->name,nsapi_exclude_from_ini_entries[j])!=0);

What should be checked:
there is a list of values that should not be ini-values because they are normal parameters of the php4_execute function ("script", "type",...). This for loop goes through the list of this entries, if one of the entries is entry->param->name (strcasecmp==0) then this should turn to "FALSE".

Ilia: Your thing works, but will not do what is wanted.
 [2004-06-23 02:19 UTC] michaelw at webcentral dot com dot au
I've done a quick test, and the latest CVS STABLE release appears to work correctly with regards to the ok &= line, although I haven't got time to test it as fully as I would like to, so it would be nice if someone else can confirm this... 

The latest CVS STABLE release still checks the key you are attempting to set against PHP_INI_USER (and thus won't allow you to set things such as open_basedir and doc_root), when I believe (as it is being set in a system level file) that it should allow everything from PHP_INI_SYSTEM (which will allow you to set open_basedir and doc_root) ?
 [2004-06-23 12:03 UTC] thetaphi@php.net
We are discussing that at the moment. The problem is that SYSTEM values are for the whole PHP library and are not thread specific (I think so), so changing this in a php4_execute directive changes that value for all currently running requests -> problem.

After discussing that i will decide to change this. All other multithreaded SAPIs do it in that way (PHP_INI_USER)

doc_root can in PHP scripts accessed via $_SERVER['DOCUMENT_ROOT']
 [2004-06-23 15:09 UTC] thetaphi@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

You can set all php.ini settings now.

Also:
* Using of "bucket" parameter to php4_execute for performance tests will not write warning message to server-log from now on
* Double CONTENT_TYPE server variables in POST request eleminated
 [2004-06-24 05:53 UTC] michaelw at webcentral dot com dot au
The php4-STABLE-latest.tar.gz appears to work correctly, and allows me to set open_basedir as I would expect. 

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC