Skip to content

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

Description

@louisl

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions