private function writeTmpIni(array $iniFiles, $tmpDir, &$error)
    {
        if (!$this->tmpIni = @tempnam($tmpDir, '')) {
            return false;
        }

        // $iniFiles has at least one item and it may be empty
        if (empty($iniFiles[0])) {
            array_shift($iniFiles);
        }

        $content = '';
        $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';

        foreach ($iniFiles as $file) {
            // Check for inaccessible ini files
            if (!$data = @file_get_contents($file)) {
                $error = 'Unable to read ini: '.$file;
                return false;
            }
            $content .= preg_replace($regex, ';$1', $data).PHP_EOL;
        }

        // Merge loaded settings into our ini content, if it is valid
        if ($config = parse_ini_string($content)) {
            $loaded = ini_get_all(null, false);
            $content .= $this->mergeLoadedConfig($loaded, $config);
        }

        // Work-around for https://bugs.php.net/bug.php?id=75932
        $content .= 'opcache.enable_cli=0'.PHP_EOL;

        return @file_put_contents($this->tmpIni, $content);
    }
private function writeTmpIni(array $iniFiles, $tmpDir, &$error)
    {
        if (!$this->tmpIni = @tempnam($tmpDir, '')) {
            return false;
        }

        // $iniFiles has at least one item and it may be empty
        if (empty($iniFiles[0])) {
            array_shift($iniFiles);
        }

        $content = '';
        $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';

        foreach ($iniFiles as $file) {
            // Check for inaccessible ini files
            if (!$data = @file_get_contents($file)) {
                $error = 'Unable to read ini: '.$file;
                return false;
            }
            $content .= preg_replace($regex, ';$1', $data).PHP_EOL;
        }

        // Merge loaded settings into our ini content, if it is valid
        if ($config = parse_ini_string($content)) {
            $loaded = ini_get_all(null, false);
            $content .= $this->mergeLoadedConfig($loaded, $config);
        }

        // Work-around for https://bugs.php.net/bug.php?id=75932
        $content .= 'opcache.enable_cli=0'.PHP_EOL;

        return @file_put_contents($this->tmpIni, $content);
    }
private function writeTmpIni ( array $ iniFiles , $ tmpDir , & $ error ) { if ( ! $ this -> tmpIni = @ tempnam ( $ tmpDir , '' ) ) { return false ; } // $iniFiles has at least one item and it may be empty if ( empty ( $ iniFiles [ 0 ] ) ) { array_shift ( $ iniFiles ) ; } $ content = '' ; $ regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi' ; foreach ( $ iniFiles as $ file ) { // Check for inaccessible ini files if ( ! $ data = @ file_get_contents ( $ file ) ) { $ error = 'Unable to read ini: ' . $ file ; return false ; } $ content .= preg_replace ( $ regex , ';$1' , $ data ) . PHP_EOL ; } // Merge loaded settings into our ini content, if it is valid if ( $ config = parse_ini_string ( $ content ) ) { $ loaded = ini_get_all ( null , false ) ; $ content .= $ this -> mergeLoadedConfig ( $ loaded , $ config ) ; } // Work-around for https://bugs.php.net/bug.php?id=75932 $ content .= 'opcache.enable_cli=0' . PHP_EOL ; return @ file_put_contents ( $ this -> tmpIni , $ content ) ; }
Returns true if the tmp ini file was written

@param array $iniFiles All ini files used in the current process
@param string $tmpDir The system temporary directory
@param string $error Set by method if ini file cannot be read

@return bool
Returns true if the tmp ini file was written