Skip to content

ProcessBase::removeNonJsonJunk returns null when $data is longer than pcre.backtrack_limit #34

Closed
@edwinknl

Description

Describe the bug or behavior
While installing Drupal from the command line using Drush 9.6.0 the installation fails during the translation import phase. We tracked this issue down to the second preg_replace in ProcessBase::removeNonJsonJunk(). The failure is caused by the fact that the json string contained in $data is about 4 times longer than the pcre.backtrack_limit setting allows.

To Reproduce
set a low pcre.backtrack_limit and input a larger string then pcre.backtrack_limit into $data.
Run the method ProcessBase::removeNonJsonJunk()

Expected behavior
ProcessBase::removeNonJsonJunk() should not return NULL when valid json of any size is passed in.

Actual behavior
ProcessBase::removeNonJsonJunk() returns NULL when a large, but valid json string is entered.

Workaround
set an enormous pcre.backtrack_limit in php.ini

System Configuration

Q A
Drush version? 9.6.0
Drupal version? 8.6.12
PHP version 7.2.14-1
OS? Mac

Additional information
I will provide a PR that resolves this issue shortly.

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