Alexia / php7mar

PHP 7 Migration Assistant Report (MAR)
GNU General Public License v3.0
795 stars 133 forks source link

Wrong line numbers #23

Open pierrocknroll opened 8 years ago

pierrocknroll commented 8 years ago

Hi,

The line numbers in the logs are all wrong (approximatly 30 lines less).

#### /blabla.ph
* foreachByReference
 * Line 195: `    foreach ($aStats as $sKey => &$mValue)`

This foreach is in line 235, not 195.

Alexia commented 8 years ago

I would need an example file that causes the issue to properly investigate this.

pierrocknroll commented 8 years ago

https://dl.dropboxusercontent.com/u/11081723/test.php

# nuance
#### /home/pmartel/test.php
* funcGetArg
 * Line 19: `  $a = func_get_arg(0);`
 * Line 21: `  var_dump($a, func_get_arg(0), func_get_args());`
* foreachByReference
 * Line 26: `foreach ($aTab as $sKey => &$sValue) {`
 * Line 33: `foreach ($aTab2 as &$sValue2) {`
 * Line 40: `foreach ($array as &$val) {`
AndrzejFR commented 7 years ago

Empty lines are not counted. That will be because of FILE_SKIP_EMPTY_LINES flag here https://github.com/Alexia/php7mar/blob/7f6cf631f01c8dcbfd78f309e983aac17d13d6e4/classes/scanner.php#L101

mbomb007 commented 5 years ago

Bump. This needs to be fixed. Just get rid of the flag. Otherwise, skip printing the line number. Better to not have it than to print it wrong every time.

pierrocknroll commented 5 years ago

Pfiou. Forget it I'm afraid. This project was when PHP7 was released.