Merge pull request #605 from aidantwoods/fix/this-php5.3-compat

Explicitly capture $this for PHP 5.3
This commit is contained in:
Aidan Woods 2018-04-06 20:44:32 +01:00 committed by GitHub
commit 48b9f71bdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -1648,10 +1648,13 @@ class Parsedown
protected function elementsApplyRecursive($closure, array $Elements)
{
# PHP 5.3 compat
$instance = $this;
return array_reduce(
$Elements,
function (array $Elements, array $Element) use ($closure) {
$Elements[] = $this->elementApplyRecursive($closure, $Element);
function (array $Elements, array $Element) use ($instance, $closure) {
$Elements[] = $instance->elementApplyRecursive($closure, $Element);
return $Elements;
},
array()