I have setup new CodeIgniter but i have getting this issue |
when I have run this command in CLI php spark serve then display this message
PHP Parse error: syntax error, unexpected '?' in E:\xampp7\htdocs\project\CodeIgniter4\system\ Common.php on line 924
It looks like you have modified Common.php, as there is no "?" on line 924.
Which CI 4 version are you using, and which install method did you use? You might want to post lines 920-930 of your Common.php
(09-17-2019, 10:07 AM)ciadmin Wrote: It looks like you have modified Common.php, as there is no "?" on line 924. I have not any changed in common.php There is Code is if (!function_exists('slash_item')) { //Unlike CI3, this function is placed here because //it's not a config, or part of a config. /** * Fetch a config file item with slash appended (if not empty) * * @param string $item Config item name * * @return string|null The configuration item or NULL if * the item doesn't exist */ function slash_item(string $item): ?string { $config = config(App::class); $configItem = $config->{$item}; if (!isset($configItem) || empty(trim($configItem))) { return $configItem; } return rtrim($configItem, '/') . '/'; } } I have bold this string there is an issue is display
Make sure your PHP version is 7.2 or higher.
Something is definitely out of whack: line 924 in the latest, rc.1, is in the middle of the stringify_attributes function, not slash_item. You didn't say which version you are running, but it doesn't look like the latest.
The line you bolded has a nullable return type declared, i.e. slash_item can return either a string or null. This sounds more like a PHP version compatibility problem ... the git bash shell can have issues with PHP, from what I have seen. Possible workaround: https://superuser.com/questions/1238410/...t-git-bash |
Welcome Guest, Not a member yet? Register Sign In |