There is an undefined variable $match in phpexcel.module file.

Attached patch simply removes that. Please review.

CommentFileSizeAuthor
remove-undefined-variable--match-0.patch398 bytesey

Comments

Елин Й. created an issue. See original summary.

wadmiraal’s picture

Status: Needs review » Closed (works as designed)

It's not undefined. 2 lines down, $match is passed by reference to preg_match(). If a previously undeclared variable is passed to preg_match(), we get a PHP Notice saying we are using an undefined variable. By simply declaring it (even though we're not giving it an explicit value), we suppress the PHP Notice. That's why it's there.

ey’s picture

Status: Closed (works as designed) » Needs review

As far as I know, for preg_match the passed variable doesn't have to be defined before.

Which PHP version are you using? I have never seen before that PHP complains for the $matches variable is being undefined on preg_match.

You can also see the usages in preg_match documentation page, none of them declare the $matches variable before passing it into preg_match function.

Can you test it, if it is still the case that PHP is complaining about undefined variable $match if you remove that line?

wadmiraal’s picture

Status: Needs review » Fixed

Guess you are right. I took this habit in the past, perhaps with the release of PHP 5.0? I don't remember. You are right though, it does't trigger a Notice, even in strict mode.

Removed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.