Skip to content

fatal error backtrace suggests include is a function #25971

Backlog

Description

@bug-fix0r

Description

The following code:

<?php
ini_set("zend.exception_string_param_max_len", "1024");
if (!isset($test123))
{
  $test123 = 1;
  include __FILE__;
}
else
{
  function moh()
  {
    hey();
  }
  moh();
}

Resulted in this output:

PHP Fatal error:  Uncaught Error: Call to undefined function hey() in /home/user1/test.php:12
Stack trace:
#0 /home/user1/test.php(14): moh()
#1 /home/user1/test.php(6): include('/home/user1/test.php')
#2 {main}
  thrown in /home/user1/test.php on line 12

But I expected this output instead:

PHP Fatal error:  Uncaught Error: Call to undefined function hey() in /home/user1/test.php:12
Stack trace:
#0 /home/user1/test.php(14): moh()
#1 /home/user1/test.php(6): include '/home/user1/test.php'
#2 {main}
  thrown in /home/user1/test.php on line 12

The problem is it shows include in function style which makes users use it like a function e.g.
if (include("my.php") === 123)
which doesn't work because it has to be
if ((include "my.php") === 123)

If you're using 3v4l I don't know why but you have to hit eval, the live preview doesn't work.

PHP Version

PHP 8.4.28 (cli) (built: Nov 18 2026 10:55:31) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.28, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.28, Copyright (c), by Zend Technologies

Operating System

Debian trixie

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