michelf / php-markdown

Parser for Markdown and Markdown Extra derived from the original Markdown.pl by John Gruber.
http://michelf.ca/projects/php-markdown/
Other
3.43k stars 528 forks source link

pass by reference? #163

Open fruitl00p opened 10 years ago

fruitl00p commented 10 years ago

Might be an issue, might not, but haven't seen any mentioning of it here: I've run the PHPCompatibility Codesniffer and have this found the usage of i.e. $this->doExtraAttributes("h$level", $dummy =& $matches[2]); as Using a call-time pass-by-reference is prohibited since php 5.4 (doing a quick search for $dummy finds all occurences)

If i'm not mistaken the use of $dummy in all those cases is superfluous is it not?

michelf commented 10 years ago

No issue here. That's not a call-time pass by reference. $dummy =& $matches[2] is a reference assignment of $matches[2] to local variable $dummy, local variable which is then passed as an argument to doExtraAttributes. The reason I'm doing it this way is to avoid the more complicated expression (isset($matches[2]) ? $matches[2] : null).