{"record":{"id":"4d19c1a7779f2f2e","repo":"symfony/process","slug":"unable-to-parse-ini-data","errorCode":null,"errorMessage":"Unable to parse ini data.","messagePattern":"Unable to parse ini data\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"PhpSubprocess.php","lineNumber":126,"sourceCode":"        foreach ($iniFiles as $file) {\n            // Check for inaccessible ini files\n            if (($data = @file_get_contents($file)) === false) {\n                throw new RuntimeException('Unable to read ini: '.$file);\n            }\n            // Check and remove directives after HOST and PATH sections\n            if (preg_match('/^\\s*\\[(?:PATH|HOST)\\s*=/mi', $data, $matches, \\PREG_OFFSET_CAPTURE)) {\n                $data = substr($data, 0, $matches[0][1]);\n            }\n\n            $content .= $data.\"\\n\";\n        }\n\n        // Merge loaded settings into our ini content, if it is valid\n        $config = parse_ini_string($content);\n        $loaded = ini_get_all(null, false);\n\n        if (false === $config || false === $loaded) {\n            throw new RuntimeException('Unable to parse ini data.');\n        }\n\n        $content .= $this->mergeLoadedConfig($loaded, $config);\n\n        // Work-around for https://bugs.php.net/bug.php?id=75932\n        $content .= \"opcache.enable_cli=0\\n\";\n\n        if (false === @file_put_contents($tmpfile, $content)) {\n            throw new RuntimeException('Unable to write temporary ini file.');\n        }\n\n        return $tmpfile;\n    }\n\n    private function mergeLoadedConfig(array $loadedConfig, array $iniConfig): string\n    {\n        $content = '';\n","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/symfony/process/blob/99b85026db14a68f02c6f3eeb01a1170ca25c491/PhpSubprocess.php#L108-L144","documentation":"PhpSubprocess builds a temporary INI file that clones the parent PHP process's configuration so the child process runs with identical settings. It validates the assembled content by round-tripping it through parse_ini_string and also checks that ini_get_all succeeded; if either returns false the merged config would be corrupt or incomplete, so it throws RuntimeException instead of launching a broken child.","triggerScenarios":"writeTmpIni is called from the PhpSubprocess constructor and throws when parse_ini_string($content) returns false (the generated ini text is malformed) or when ini_get_all(null, false) returns false (the ini directive cache is unavailable, e.g. ini directives blocked or an exotic SAPI).","commonSituations":"Running under a restricted/embedded PHP build where ini_get_all is disabled or fails; exotic PHP versions/patches whose ini parsing rejects the generated content; configs containing values that do not survive the parse round-trip (unbalanced quotes, control characters in ini values inherited from the environment).","solutions":["Check that ini_get_all is not in disable_functions and works in your SAPI (php -r 'var_dump(ini_get_all(null,false));').","Inspect the generated ini content for characters that break parse_ini_string (unbalanced quotes, newlines inside values) and fix the source of those values.","Print/load each ini setting with ini_get and sanitize problematic values before constructing PhpSubprocess.","Upgrade/downgrade PHP to a version where ini parsing handles your configuration."],"exampleFix":"// before (debugging the failure)\n$subprocess = new PhpSubprocess($phpBinary);\n\n// after (pre-check the ini cache works)\nif (false === @ini_get_all(null, false)) {\n    throw new \\RuntimeException('ini_get_all unavailable; PhpSubprocess cannot snapshot config');\n}\n$subprocess = new PhpSubprocess($phpBinary);","handlingStrategy":"validation","validationCode":"if (!function_exists('ini_get_all') || false === @ini_get_all(null, false)) {\n    throw new \\RuntimeException('ini_get_all unavailable; PhpSubprocess cannot snapshot PHP config');\n}","typeGuard":null,"tryCatchPattern":"try {\n    $proc = new PhpSubprocess($phpBinary);\n} catch (\\RuntimeException $e) {\n    if ($e->getMessage() === 'Unable to parse ini data.') {\n        // fall back to plain PHP binary or log config snapshot failure\n    }\n    throw $e;\n}","preventionTips":["Verify ini_get_all is not disabled in disable_functions for the runtime SAPI.","Avoid exotic ini values (unbalanced quotes, control chars) in php.ini that break parse_ini_string round-trips.","Test PhpSubprocess construction in CI on the same PHP build used in production.","Keep PHP version aligned with versions known to work with the library."],"tags":["php","ini","configuration","subprocess"],"backgroundTag":"invalid-config-value","analyzedSha":"99b85026db14a68f02c6f3eeb01a1170ca25c491","analyzedAt":"2026-09-14T11:23:33.683Z","contentChangedAt":"2026-09-14T11:23:33.683Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}