|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2001-11-06 16:09 UTC] lampa at fee dot vutbr dot cz
 Apache module mod_setenvif sets variables in r->subprocess_env. If variable name contains character ".", then mod_php4.c/sapi_apache_register_server_variables() will replace it with "_". This breaks internal variables like force-response-1.0 (php changes it to force-response-1_0). Solution: the key in the php_register_variable() call should be a copy of the real key. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 15:00:01 2025 UTC | 
Not fixed in 4.1.0. Why? To be clear, one call is neccessary: for (i = 0; i < arr->nelts; i++) { char *val,*key; if (elts[i].val) { val = elts[i].val; } else { val = empty_string; } key = estrdup(elts[i].key); /* HERE */ php_register_variable(key, val, track_vars_array ELS_CC PLS_CC) ; }This bug is still present in php 4.3.4 and may be harmful since all the BrowserMatch functionality to workaround browser bugs in Apache is essentially disabled. As a proof of concept i patched sapi/apache2handler/sapi_apache2.c (apache2filter is probably affected too) and the problem went away. Note that the patch may not be perfect as I don't know how Apache and PHP work internally very well. --- php-4.3.4/sapi/apache2handler/sapi_apache2.c 2003-10-02 05:24:43.000000000 +0200 +++ php-4.3.4-patched/sapi/apache2handler/sapi_apache2.c 2003-11-11 23:52:06.000000000 +0100 @@ -227,9 +227,14 @@ char *key, *val; zval **path_translated_zv; + char *t; + APR_ARRAY_FOREACH_OPEN(arr, key, val) if (!val) val = empty_string; - php_register_variable(key, val, track_vars_array TSRMLS_CC); + + t = estrndup(key, strlen(key)); + php_register_variable(t, val, track_vars_array TSRMLS_CC); + efree(t); APR_ARRAY_FOREACH_CLOSE()