Closed (fixed)
Project:
PHPExcel
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
3 Aug 2016 at 10:59 UTC
Updated:
17 Aug 2016 at 14:44 UTC
Jump to comment: Most recent
There is an undefined variable $match in phpexcel.module file.
Attached patch simply removes that. Please review.
| Comment | File | Size | Author |
|---|---|---|---|
| remove-undefined-variable--match-0.patch | 398 bytes | ey |
Comments
Comment #2
wadmiraal commentedIt'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.
Comment #3
ey commentedAs far as I know, for
preg_matchthe 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
$matchesvariable is being undefined onpreg_match.You can also see the usages in
preg_matchdocumentation page, none of them declare the$matchesvariable before passing it intopreg_matchfunction.Can you test it, if it is still the case that PHP is complaining about undefined variable
$matchif you remove that line?Comment #5
wadmiraal commentedGuess 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.