Issues

ZF-8652: Wrap parse_ini_file

Description

Use cases: - subclass calls parse_ini_file($filename, $process_sections, INI_SCANNER_RAW) -- introduced in php 5.3.0 - subclass implements a parse_ini_file() replacement, e.g., supporting a richer syntax and/or where parse_ini_file is disabled


--- Ini.php.bak 2009-12-29 02:54:22.000000000 -0500
+++ Ini.php 2009-12-29 03:03:02.000000000 -0500
@@ -159,6 +159,17 @@
     }
 
     /**
+     * Parse the settings in the ini file, processing [sections].
+     *
+     * @param string $filename
+     * @return array
+     */
+    protected function _parseIniFile($filename)
+    {
+        return parse_ini_file($filename, true);
+    }
+
+    /**
      * Load the ini file and preprocess the section separator (':' in the
      * section name (that is used for section extension) so that the resultant
      * array has the correct section names and the extension information is
@@ -173,7 +184,7 @@
     protected function _loadIniFile($filename)
     {
         set_error_handler(array($this, '_loadFileErrorHandler'));
-        $loaded = parse_ini_file($filename, true); // Warnings and errors are suppressed
+        $loaded = $this->_parseIniFile($filename); // Warnings and errors are suppressed
         restore_error_handler();
         // Check if there was a error while loading file
         if ($this->_loadFileErrorStr !== null) {

Comments

Why not just override _loadIniFile()?

I can. I'm just too lazy to rewrite _loadIniFile. (IANAL but I didn't want to copy the _loadIniFile implementation -- ZF New BSD licensed code -- into our GPL project.

Ok. Let's close this ticket. We no longer require this patch.

Fixed in SVN r20036.