php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60304 Can't create class function myObject::unset()
Submitted: 2011-11-15 01:09 UTC Modified: 2011-11-15 01:37 UTC
From: matty023 at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.4.0RC1 OS: Win 7 64-bit
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: matty023 at gmail dot com
New email:
PHP Version: OS:

 

 [2011-11-15 01:09 UTC] matty023 at gmail dot com
Description:
------------
There is no way to create an "unset" function in a class even if the class is in it's own namespace.

This should be corrected/changed.

myObject->unset()
should not conflict with
unset()

Examples:

<?php

class unsetTest{
	function unset($whatever){
		
	}
}

//Parse error: syntax error, unexpected 'unset' (T_UNSET), expecting identifier (T_STRING) in E:\_www\x.php on line #

==============================================

<?php
namespace whatever;
class unsetTest{
	function unset($whatever){
		
	}
}

//Parse error: syntax error, unexpected 'unset' (T_UNSET), expecting identifier (T_STRING) in E:\_www\x.php on line #

Test script:
---------------
<?php

class unsetTest{
	function unset($whatever){
		
	}
}

Expected result:
----------------
A happy function in my class that will do what it is told.

Actual result:
--------------
//Parse error: syntax error, unexpected 'unset' (T_UNSET), expecting identifier (T_STRING) in E:\_www\x.php on line #

Seemingly conflicting with the native PHP unset.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-15 01:37 UTC] johannes@php.net
-Status: Open +Status: Bogus
 [2011-11-15 01:37 UTC] johannes@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

Keywords may not be used as identifiers.

http://php.net/manual/en/reserved.keywords.php
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 04:01:34 2025 UTC