php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54090 ReflectionClass::getStartLine reports wrong value for autoloaded classes.
Submitted: 2011-02-24 13:50 UTC Modified: -
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: mp at nanasoft dot hu Assigned:
Status: Open Package: Reflection related
PHP Version: 5.3.5 OS: GNU/Linux (Fedora 14)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-02-24 13:50 UTC] mp at nanasoft dot hu
Description:
------------
When a require_once call causes other files to be loaded, the ReflectionClass object of any of those classes loaded from an extra file via the __autoload method returns the classes' start line and end line incorrectly from the ReflectionClass::getStartLine() and ReflectionClass::getEndLine() methods. I think the start line and the end line values come from the class that caused the extra files to load.


Expected result:
----------------
The correct start line and end line values should be returned.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-06-07 10:22 UTC] tomas dot fejfar at gmail dot com
In my case the end line is incorrectly reported (+1). Unfortunatelly it's very hard to replicate. Whenever I try to isolate it, it starts working. 

Windows, PHP 7.1.5 (cli) (built: May  9 2017 19:52:16) ( ZTS MSVC14 (Visual C++ 2015) x86 )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.5, Copyright (c) 1999-2017, by Zend Technologies

Disabling opcache fixes the issue and endLine is correctly reported. Opcache related settings:

opcache.blacklist_filename => no value => no value
opcache.consistency_checks => 0 => 0
opcache.dups_fix => Off => Off
opcache.enable => On => On
opcache.enable_cli => On => On
opcache.enable_file_override => Off => Off
opcache.error_log => no value => no value
opcache.fast_shutdown => 0 => 0
opcache.file_cache => no value => no value
opcache.file_cache_consistency_checks => 1 => 1
opcache.file_cache_fallback => 1 => 1
opcache.file_cache_only => 0 => 0
opcache.file_update_protection => 2 => 2
opcache.force_restart_timeout => 180 => 180
opcache.inherited_hack => On => On
opcache.interned_strings_buffer => 8 => 8
opcache.log_verbosity_level => 1 => 1
opcache.max_accelerated_files => 10000 => 10000
opcache.max_file_size => 0 => 0
opcache.max_wasted_percentage => 5 => 5
opcache.memory_consumption => 128 => 128
opcache.mmap_base => no value => no value
opcache.opt_debug_level => 0 => 0
opcache.optimization_level => 0x7FFFBFFF => 0x7FFFBFFF
opcache.preferred_memory_model => no value => no value
opcache.protect_memory => 0 => 0
opcache.restrict_api => no value => no value
opcache.revalidate_freq => 2 => 2
opcache.revalidate_path => Off => Off
opcache.save_comments => 1 => 1
opcache.use_cwd => On => On
opcache.validate_permission => Off => Off
opcache.validate_timestamps => On => On
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 18:01:24 2019 UTC