Req #67546 [NEW]: Environment variables passed via php-fpm are hardlimited to 1024 chars

From: Date: Mon, 30 Jun 2014 11:42:23 +0000
Subject: Req #67546 [NEW]: Environment variables passed via php-fpm are hardlimited to 1024 chars
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186392@lists.php.net to get a copy of this message
From: m at ttias dot be Operating system: n/a PHP version: 5.4.30 Package: FPM related Bug Type: Feature/Change Request Bug description:Environment variables passed via php-fpm are hardlimited to 1024 chars Description: ------------ The current php-fpm implementation limits the size of environment variables, passed via the FPM pool configurations, to 1024 chars. This limit is defined in $src/sapi/fpm/fpm/fpm_conf.c around line 1467, where fpm_conf_load_ini_file() is called. If larger environment variables are passed through the FPM config to PHP, it will silently truncate them and more than likely cause a configuration error because a trailing quote, to limit strings, will be missing. The resulting error, when trying to start the PHP-FPM service, looks like this. Stopping php-fpm2: [FAILED] Starting php-fpm: PHP: syntax error, unexpected $end in Unknown on line 1 [30-Jun-2014 13:24:36] ERROR: failed to load configuration file '/etc/php-fpm.d/pool-site.conf' [30-Jun-2014 13:24:36] ERROR: FPM initialization failed Test script: --------------- The "bug" is simple to reproduce, by defining an environment variable in the pool configuration that exceeds 1024 chars. A pool configuration with the following details causes this. [global] ... [site] listen = /var/run/php-fpm/site.socket listen.backlog = 128 listen.allowed_clients = 127.0.0.1 env[TEST_VAR] = '{"variable":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx! xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx! xxxxxxxxxxxxxxxxxxxxxxx"}}' Expected result: ---------------- One of two things should happen: - either throw a clear warning that more than 1024 characters were found, but they have been silently removed (not optimal) - throw a warning but allow the maximum PHP environment variables to be configured through a PHP.INI setting Actual result: -------------- The pool fails to start, trigger the error: Stopping php-fpm: [FAILED] Starting php-fpm: PHP: syntax error, unexpected $end in Unknown on line 1 [30-Jun-2014 13:40:01] ERROR: failed to load configuration file '/etc/php-fpm.d/pool-site.conf' [30-Jun-2014 13:40:01] ERROR: FPM initialization failed [FAILED] -- Edit bug report at https://bugs.php.net/bug.php?id=67546&edit=1 --

« previous php.bugs (#186392) next »