Zend Framework

Wrap parse_ini_file

Details

  • Type: Patch Patch
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9.6
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Config
  • Labels:
    None

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) {

Activity

Hide
Rob Allen added a comment -

Why not just override _loadIniFile()?

Show
Rob Allen added a comment - Why not just override _loadIniFile()?
Hide
Anthon Pang, VIP Software Technologies Inc. added a comment -

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.

Show
Anthon Pang, VIP Software Technologies Inc. added a comment - 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.
Hide
Anthon Pang, VIP Software Technologies Inc. added a comment -

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

Show
Anthon Pang, VIP Software Technologies Inc. added a comment - Ok. Let's close this ticket. We no longer require this patch.
Hide
Rob Allen added a comment -

Fixed in SVN r20036.

Show
Rob Allen added a comment - Fixed in SVN r20036.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: