php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #66587 __DIR__ and other magic constants show trait data in trait
Submitted: 2014-01-27 15:24 UTC Modified: 2014-02-01 09:02 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: wim at wimgodden dot be Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
 [2014-01-27 15:24 UTC] wim at wimgodden dot be
Description:
------------
---
From manual page: http://www.php.net/language.constants.predefined
---

It might be useful to add information detailing that __DIR__ and __FILE__ and __LINE__ will show the directory, file and line number of the code in the trait definition file, not the location where the trait is being used. It is counterintuitive for non-core developers, so it's best to mention this in de docs.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-01 09:02 UTC] krakjoe@php.net
-Status: Open +Status: Not a bug
 [2014-02-01 09:02 UTC] krakjoe@php.net
I'm not sure why you would expect anything different, they are compiler constants, I'm convinced it doesn't need mentioning because it's obvious so closing the bug.
 [2014-02-01 15:52 UTC] wim at wimgodden dot be
I agree that this they are compiler constants, but most developers don't have a clue. I'm not asking to change the implementation, only to specify this in the docs, so it's clear for anyone who's not aware of the fact that these constants are replaced at compile time, not at run-time.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 13:01:28 2024 UTC