• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I have setup new CodeIgniter but i have getting this issue

#1
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


Attached Files Thumbnail(s)
   
Reply

#2
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
Reply

#3
(09-17-2019, 10:07 AM)ciadmin Wrote: 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

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
Reply

#4
Make sure your PHP version is 7.2 or higher.
Support Development  • Practical CodeIgniter 3  •
Myth:AuthVulcan - CLI Tools for CI4
Reply

#5
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
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.