Skip to content

Incorrect line number when requiring/including files #16509

Closed
@YuanchengJiang

Description

@YuanchengJiang

Description

The following code:

<?php
include 'test_lineno.inc';
include 'test_lineno.inc';

test_lineno.inc:

<?php 

function testtest() {
	for($i=0;$i<100;$i++){
		$i++;
	}
	echo($i);
	echo($i);
}

Resulted in this output (line 8):

Fatal error: Cannot redeclare function testtest() (previously declared in /tmp/test_lineno.inc:4) in /tmp/test_lineno.inc on line 8

In JIT (line 4):

Fatal error: Cannot redeclare function testtest() (previously declared in /tmp/test_lineno.inc:4) in /tmp/test_lineno.inc on line 4

Expected (line 3??):

Fatal error: Cannot redeclare function testtest() (previously declared in /tmp/test_lineno.inc:4) in /tmp/test_lineno.inc on line 3

Related: #16508 #16499 #16495

PHP Version

nightly

Operating System

ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions