ZF-8652: Wrap parse_ini_file

Issue Type: Patch Created: 2009-12-29T00:19:40.000+0000 Last Updated: 2010-01-02T09:20:39.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Anthon Pang, VIP Software Technologies Inc. (vipsoft) Assignee: Rob Allen (rob) Tags: - Zend_Config

Related issues: Attachments:


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

<pre class="highlight">
--- 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
         // Check if there was a error while loading file
         if ($this->_loadFileErrorStr !== null) {


Posted by Rob Allen (rob) on 2009-12-29T02:10:09.000+0000

Why not just override _loadIniFile()?

Posted by Anthon Pang, VIP Software Technologies Inc. (vipsoft) on 2009-12-29T08:04:05.000+0000

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.

Posted by Anthon Pang, VIP Software Technologies Inc. (vipsoft) on 2009-12-29T18:59:36.000+0000

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

Posted by Rob Allen (rob) on 2010-01-02T09:20:39.000+0000

Fixed in SVN r20036.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.