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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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 11:01:33 2025 UTC