mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-22 08:21:52 +00:00
Remove unnecessary reference assigment (#301)
* Remove unnecessary reference assigment Proposed code is PHP5 and PHP7 compatible. PHP5 interpreted `$e->$type[$attr]` as `$e->{$type[$attr]}`, but the expected behavior based on workaround is consistent with PHP7 interpretation: `($e->$type)[$attr]`. By using curly braces `{$e->$type}[$attr]` there is a forced interpretation order working for both versions. Details can be found on https://www.php.net/manual/en/migration70.incompatible.php (section "Changes to the handling of indirect variables, properties, and methods") * Fix syntax Use correct syntax for indirect variable evaluation order change.
This commit is contained in:
parent
c97bb93223
commit
996eaf4331
@ -146,10 +146,7 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
|
|||||||
$type = "info_$type";
|
$type = "info_$type";
|
||||||
$e = $this;
|
$e = $this;
|
||||||
}
|
}
|
||||||
// PHP does some weird parsing when I do
|
$e->{$type}[$attr] = $fix;
|
||||||
// $e->$type[$attr], so I have to assign a ref.
|
|
||||||
$f =& $e->$type;
|
|
||||||
$f[$attr] = $fix;
|
|
||||||
break;
|
break;
|
||||||
case 'tag_transform':
|
case 'tag_transform':
|
||||||
$this->info_tag_transform[$params['element']] = $fix;
|
$this->info_tag_transform[$params['element']] = $fix;
|
||||||
|
Loading…
Reference in New Issue
Block a user