Skip to content

Bug: Cannot pass a string param with a space to a custom parser plugin #2318

Description

@SteeveDroz

Describe the bug
When passing parameters to a custom made plugin in the parser, if a space is present, each word is a different value in the array.

CodeIgniter 4 version
v4.0.0-rc.2.1

Affected module(s)
Parser

Expected behavior, and steps to reproduce if appropriate

Here is my code:

app/Views/pages/home.html

{+header title="My website"+}
<h1>Welcome to m website!</h1>
{+footer+}

in app/Config/View.php

public $plugins = [
    'header' => 'App\Controllers\BaseController::header',
    'footer' => 'App\Controllers\BaseController::footer'
];

in app/Controllers/BaseController.php

public static function header($params = [])
{
    var_dump($params);
    …
}

Value of the var_dump()

array(2) {
    ["title"]=>
    string(4) ""My"
    [0]=>
    string(8) "website""
}

Expected value of the var_dump()

array(1) {
    ["title"]=>
    string(10) "My website"
}

Context

  • OS: Linux Fedora 30
  • Web server Apache 2.4.41
  • PHP version 7.3.10

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

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions