Download | Plain Text | No Line Numbers


  1. --- php-5.3.2.orig/main/php_ini.c 2010-02-03 21:13:18.000000000 +0100
  2. +++ php-5.3.2/main/php_ini.c 2010-06-12 21:09:14.000000000 +0200
  3. @@ -687,6 +687,48 @@
  4. php_ini_scanned_path = NULL;
  5. }
  6.  
  7. + char *php_ini_extra = getenv("PHP_INI_EXTRA");
  8. + if (!sapi_module.php_ini_ignore && php_ini_extra) {
  9. + struct stat sb;
  10. + zend_file_handle fh;
  11. + RESET_ACTIVE_INI_HASH();
  12. + memset(&fh, 0, sizeof(fh));
  13. +
  14. + if (VCWD_STAT(php_ini_extra, &sb) == 0) {
  15. + if (S_ISREG(sb.st_mode)) {
  16. + if ((fh.handle.fp = VCWD_FOPEN(php_ini_extra, "r"))) {
  17. + fh.filename = php_ini_extra;
  18. + fh.type = ZEND_HANDLE_FP;
  19. +
  20. + /* add an fake-host section so our settings will be changed to PHP_INI_SYSTEM during merge */
  21. + zval fakehost;
  22. + Z_STRLEN(fakehost) = sizeof("HOST=\%fake\%") - 1;
  23. + Z_STRVAL(fakehost) = zend_strndup("HOST=\%fake\%", Z_STRLEN(fakehost));
  24. + Z_TYPE(fakehost) = IS_STRING;
  25. + php_ini_parser_cb(&fakehost, NULL, NULL, ZEND_INI_PARSER_SECTION, &configuration_hash TSRMLS_CC);
  26. +
  27. + if (zend_parse_ini_file(&fh, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, &configuration_hash TSRMLS_CC) == SUCCESS) {
  28. + /* Here, add it to the list of ini files read */
  29. + int add_len = strlen(php_ini_extra) + 2;
  30. +
  31. + int php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0;
  32. + php_ini_scanned_files = (char *) realloc(php_ini_scanned_files, php_ini_scanned_files_len + add_len + 1);
  33. + if (!php_ini_scanned_files_len) {
  34. + *php_ini_scanned_files = '\0';
  35. + }
  36. + add_len += php_ini_scanned_files_len;
  37. + if (php_ini_scanned_files_len) {
  38. + php_ini_scanned_files[php_ini_scanned_files_len - 2] = '\0';
  39. + strlcat(php_ini_scanned_files, ",\n", add_len);
  40. + }
  41. + strlcat(php_ini_scanned_files, php_ini_extra, add_len);
  42. + strlcat(php_ini_scanned_files, "\n", add_len);
  43. + }
  44. + }
  45. + }
  46. + }
  47. + }
  48. +
  49. if (sapi_module.ini_entries) {
  50. /* Reset active ini section */
  51. RESET_ACTIVE_INI_HASH();
  52. diff -Naur php-5.3.2.orig/sapi/cgi/cgi_main.c php-5.3.2/sapi/cgi/cgi_main.c
  53. --- php-5.3.2.orig/sapi/cgi/cgi_main.c 2012-09-06 13:37:47.599471003 +0200
  54. +++ php-5.3.2/sapi/cgi/cgi_main.c 2012-09-06 14:06:10.504809677 +0200
  55. @@ -832,6 +832,9 @@
  56. }
  57.  
  58. if (php_ini_has_per_host_config()) {
  59. + /* activate our fake host entries. lowercase string required! */
  60. + php_ini_activate_per_host_config("\%fake\%", sizeof("\%fake\%") TSRMLS_CC);
  61. +
  62. /* Activate per-host-system-configuration defined in php.ini and stored into configuration_hash during startup */
  63. if (fcgi_is_fastcgi()) {
  64. fcgi_request *request = (fcgi_request*) SG(server_context);
  65.