php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81631 ::class with dynamic class name may yield wrong line number
Submitted: 2021-11-17 13:40 UTC Modified: 2021-11-17 14:22 UTC
From: shaohua dot li at inf dot ethz dot ch Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 8.1Git-2021-11-17 (Git) OS: Ubuntu 20.04.3 LTS
Private report: No CVE-ID: None
 [2021-11-17 13:40 UTC] shaohua dot li at inf dot ethz dot ch
Description:
------------
Hi there,

I compiled php-src with clang13 and gcc11. For the following script, `sapi/cli/php` emits warning message "Warning: Undefined variable $b", but

For clang13 compiled one, the warning says the error happens on line 3.
For gcc11 compiled one, the warning says the error happens on line 2.

Test script:
---------------
<?php
$a = 0;
var_dump($b::class);
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-17 14:22 UTC] cmb@php.net
-Summary: Incorrect warning messages. +Summary: ::class with dynamic class name may yield wrong line number
 [2021-11-17 14:22 UTC] cmb@php.net
Indeed: <https://3v4l.org/u2PV1>.  Line 3 would be correct.
 [2021-11-17 14:22 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2021-11-17 15:07 UTC] git@php.net
Automatic comment on behalf of nikic
Revision: https://github.com/php/php-src/commit/4d4fe7639f3c217d169155b3f4217f5fe12ae114
Log: Fixed bug #81631
 [2021-11-17 15:07 UTC] git@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Sep 26 09:05:56 2022 UTC