We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Exception when file .ini key is number[phalcon v2.0.7]

Exception when file .ini key is number,phalcon v2.0.7

[error]
200 = success
404 = notfound

What exception are you getting?



585
edited Sep '15

My Code

$config = new Phalcon\Config\Adapter\Ini('./config.ini');
var_dump($config);
exit;
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Parameter 'path' must be a string' 
Stack trace:
#0 [internal function]: Phalcon\Config\Adapter\Ini->_parseIniString(200, 'success') 
#1 index.php(8): Phalcon\Config\Adapter\Ini->__construct('./config.ini') 
#2 {main} thrown in index.php on line 8

Keys are being parsed as integers which is not allowed by Phalcon\Config. Maybe you can add a prefix:

[error]
C200 = success
C404 = notfound


585

thanks for your reply.

I found,phalcon 1.3.4 can parse successful,but phalcon 2.0.7 not parse

Keys are being parsed as integers which is not allowed by Phalcon\Config. Maybe you can add a prefix:

[error]
C200 = success
C404 = notfound