Including variables inside curly braces in ini config file in Zend file on Linux

I'm trying to include a variable in an .ini file, enclosing it with curly braces, and Zend complains that it cannot parse it correctly on Linux. It works correctly on Windows:

welcome_message = Welcome, {0}. 

This is the error that occurs on Linux:

 : Uncaught exception 'Zend_Config_Exception' with message 'Error parsing /var/www/html/portal/application/configs/language/messages.ini on line 10 ' in /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php:181 Stack trace: 0 /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php(201): Zend_Config_Ini->_parseIniFile('/var/www/html/p...') 1 /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php(125): Zend_Config_Ini->_loadIniFile('/var/www/html/p...') 2 /var/www/html/portal/library/Ingrain/Language/Base.php(49): Zend_Config_Ini->__construct('/var/www/html/p...', NULL) 3 /var/www/html/portal/library/Ingrain/Language/Base.php(23): Ingrain_Language_Base->setConfig('messages.ini', NULL, NULL) 4 /var/www/html/portal/library/Ingrain/Language/Messages.php(7): Ingrain_Language_Base->__construct('messages.ini', NULL, NULL, NULL) 5 /var/www/html/portal/library/Ingrain/Helper/Language.php(38): Ingrain_Language_Messages->__construct() 6 /usr/local/zend/share/ZendFramework/library/Zend/Contr in 

We may get an error to get away on Linux if we surround the braces with quotes, but this seems like a strange solution:

 welcome_message = Welcome, "{"0"}". 

Is there a better way to solve this problem for all platforms? Thank you for your help.

Dave

+4
source share
1 answer

How about having the whole message between quotation marks?

A bit like this:

 welcome_message = "Welcome, {0}." 


Assigning parse_ini_file documentation (which can use Zend_Config_Ini ):

Note. If the value in the ini file contains any non-alphanumeric characters that must be enclosed in double quotation marks ( " ).

And also (my attention):

Note. There are reserved words that should not be used as keys for ini files. These include: null , yes , no , true , false , on , off , none .
The values null , no and false lead to "" , and the true results are to "1" .
The characters {}|&~![()^" Cannot be used anywhere in the key and there is a special meaning in the value .

+7
source

Source: https://habr.com/ru/post/1304789/


All Articles