Created
June 24, 2013 11:02
-
-
Save samartioli/5849302 to your computer and use it in GitHub Desktop.
hhvm [HipHop VM v2.1.0-dev (rel)] syntax error, unexpected $end, expecting TC_DOLLAR_CURLY or TC_QUOTED_STRING when executing parse_ini_file. Issue occurs when an ini value ends with a dollar sign: somekey = "value$" but does not error if the dollar sign is in the middle of the string: anotherkey = "value$value"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$filename = 'test.ini'; | |
$iniArray = parse_ini_file($filename, true); | |
var_dump($iniArray); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[global] | |
fonts.trackingUrl = "https://fast.fonts.com/t/1.css?apiType=css&projectid=123" | |
serviceCache.1.cacheable = "true" | |
anotherkey = "value$value" | |
somekey = "value$" |
Output with dollar sign escaped ( somekey = "value$" ) :
$ php loadConfig.php
array(1) {
["global"]=>
array(4) {
["fonts.trackingUrl"]=>
string(56) "https://fast.fonts.com/t/1.css?apiType=css&projectid=123"
["serviceCache.1.cacheable"]=>
string(4) "true"
["anotherkey"]=>
string(11) "value$value"
["somekey"]=>
string(6) "value$"
}
}
$ hhvm loadConfig.php
array(1) {
["global"]=>
array(4) {
["fonts.trackingUrl"]=>
string(56) "https://fast.fonts.com/t/1.css?apiType=css&projectid=123"
["serviceCache.1.cacheable"]=>
string(4) "true"
["anotherkey"]=>
string(11) "value$value"
["somekey"]=>
string(6) "value$"
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: