php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26776 keywords parent:: and self:: do no more work in caps
Submitted: 2004-01-03 09:13 UTC Modified: 2004-01-03 09:29 UTC
From: ganfset-php at dreams4net dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5CVS-2004-01-03 (dev) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ganfset-php at dreams4net dot com
New email:
PHP Version: OS:

 

 [2004-01-03 09:13 UTC] ganfset-php at dreams4net dot com
Description:
------------
In PHP4 and first PHP5 betas you could ask a parent method form a object with the following syntax : parent::method(). It was possible to use parent:: or PARENT::
Use of caps is important as it make possible to better distinguish the keyword from a classname

In the last betas (tested in php-5.0.0b3 and php5-200401031230) PARENT:: in caps output an error (Fatal error:  Class 'PARENT' not found). Same error comes with SELF:: in caps (while parent:: and self:: are OK)

Reproduce code:
---------------
<?php
class foo {
 function min() { echo "parent::method OK" ; }
 function maj() { echo "PARENT::method OK" ; }
}
class bar extends foo {
 function min() { parent::min() ; }
 function maj() { PARENT::maj() ; }
}

$obj = new bar ;
$obj->min() ; // ok in PHP4 and last PHP5
echo "\n" ;
$obj->maj() ; // error on last PHP5 snaps

Expected result:
----------------
parent::method OK
PARENT::method OK

Actual result:
--------------
parent::method OK
<br />
<b>Fatal error</b>:  Class 'PARENT' not found in <b>-</b> on line <b>8</b><br />

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-03 09:29 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 [2004-01-03 10:05 UTC] manico-php at wdmedia dot net
And what is it if it's not a bug ? a feature ?!? So there will be keywords that work only in lowercase and some others (like if, echo) wont be case sensitive ? or parent and self aren't keywords ? this seems to be strange...
 [2004-04-27 23:47 UTC] jerome dot dury at cegedim dot fr
I do really think it's a bug. And what else would you it to be ? Actually, it is a regression bug : something what was working in older versions (<5) is no more available in the new one.

I'm ok that 'parent' is THE good way to call that functionnality. But if it was possible to make the call without case sensitivity, it should be the same in PHP5. 

What I'm sure for now is that all websites that me and my developement group are not compatible with PHP5. And I think it's a serious regression. What do you think ?
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 17 20:03:37 2021 UTC