Problem with constants in application.ini after PHP upgrade

Posted by Marek on Stack Overflow See other posts from Stack Overflow or by Marek
Published on 2010-06-18T08:50:30Z Indexed on 2010/06/18 12:03 UTC
Read the original article Hit count: 459

Filed under:
|

Hi,

I've upgraded PHP on my local dev system to version 5.3.0, and there is some problem when I use constants in application.ini - following manual http://framework.zend.com/manual/en/learning.quickstart.create-project.html I have:

bootstrap.path = APPLICATION_PATH "/Bootstrap.php"

which leads to:

Warning: require_once(APPLICATION_PATH/Bootstrap.php) [function.require-once]: failed to open stream: No such file or directory in Zend\Application.php on line 320

any ideas?


SOLVED:

Actually name of my constant was _DIR_APPLICATION (code above was copied from ZF manual) - problem lies in this underscore at the begining - it seems that parse_ini_file() in PHP 5.3.0 doesn't replace constants named like this.

Short test - you need two files:

test.ini

bootstrap.path = _DIR_APPLICATION "/Bootstrap.php"
bootstrap.class = "Bootstrap"

and test.php

<?php

define('_DIR_APPLICATION', 'test');

$data = parse_ini_file('test.ini');
print_r($data);

try to run, then change constant name to 'DIR_APPLICATION' (in both files) and compare result ;)

© Stack Overflow or respective owner

Related posts about php

Related posts about zend-framework