Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running php spark serve (spaces in folder names) #1880

Closed
louisl opened this issue Mar 27, 2019 · 1 comment
Closed

Error when running php spark serve (spaces in folder names) #1880

louisl opened this issue Mar 27, 2019 · 1 comment

Comments

@louisl
Copy link
Contributor

louisl commented Mar 27, 2019

I was following the Dev Starter installation and noticed a little gotcha when running php spark serve.

If you have any folder with spaces in it leading up to the project you get an error from the passthru function in system/Commands/Server/Serve.php.

So If our path is /Users/louis/Documents/CodeIgniter Tests/codeigniter4test/devstarter.

We get the error due to unescaped spaces:-

Directory /Users/louis/Documents/CodeIgniter does not exist.

I've figured out this can fixed by adding escapeshellarg to the paths being supplied to that command. Ref https://www.php.net/manual/en/function.passthru.php

// Set the Front Controller path as Document Root
$docroot = escapeshellarg(FCPATH);

// Mimic Apache's mod_rewrite functionality with user settings
$rewrite = escapeshellarg(__DIR__ . '/rewrite.php');

I'll send A PR as soon as I get my CodeIgniter4 git fork properly set up, unless someone wants to slip it in.

CodeIgniter: Version 4.0.0-beta.1
PHP 7.2.14
Mac OS 10.14.3

Next job - fix the coding-standard, sorry been soooooo busy!

louisl added a commit to louisl/CodeIgniter4 that referenced this issue Mar 27, 2019
jim-parry added a commit that referenced this issue Mar 28, 2019
Fixed issue #1880, fixed a few typos and updated code style
@mierol16
Copy link

mierol16 commented Nov 5, 2020

Fatal error: Uncaught Error: Class 'CodeIgniter\Autoloader\FileLocator' not found in C:\Users\M!3R0L\Desktop\framework-4.0.4\system\Config\BaseService.php:171
Stack trace:
#0 C:\Users\M!3R0L\Desktop\framework-4.0.4\system\Common.php(539): CodeIgniter\Config\BaseService::locator(true)
#1 C:\Users\M!3R0L\Desktop\framework-4.0.4\system\bootstrap.php(167): helper('url')
#2 C:\Users\M!3R0L\Desktop\framework-4.0.4\spark(44): require('C:\Users\M!3R0L...')
#3 {main}
thrown in C:\Users\M!3R0L\Desktop\framework-4.0.4\system\Config\BaseService.php on line 171

This is the error I get when run 'php spark serve'. Can you identify the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants