Skip to content

Incorrect line number when requiring/including files #16509

Closed

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

Activity

  1. added 2 commits that reference this issue on Oct 21, 2024
    c3d231f
    de7ef3f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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