php7mar icon indicating copy to clipboard operation
php7mar copied to clipboard

Wrong line numbers

Open pierrocknroll opened this issue 9 years ago • 5 comments

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.

pierrocknroll avatar Aug 01 '16 13:08 pierrocknroll

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

Alexia avatar Aug 01 '16 14:08 Alexia

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) {`

pierrocknroll avatar Aug 03 '16 14:08 pierrocknroll

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

AndrzejFR avatar Dec 22 '16 16:12 AndrzejFR

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.

mbomb007 avatar Feb 01 '19 20:02 mbomb007

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

pierrocknroll avatar Feb 01 '19 20:02 pierrocknroll