php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46700 abstract class public static function isset(): syntax error
Submitted: 2008-11-27 20:52 UTC Modified: 2008-11-28 18:46 UTC
From: the_djmaze at hotmail dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.6 OS: GNU/Linux
Private report: No CVE-ID: None
 [2008-11-27 20:52 UTC] the_djmaze at hotmail dot com
Description:
------------
Trying to add a method named "isset" to a class.
I know it's a language construct but shouldn't the parser check if isset() is called as a function?

Reproduce code:
---------------
<?php
abstract class anObject
{
	public static function isset($key) { return $key; }
}
?>

Expected result:
----------------
It works

Actual result:
--------------
Parse error: syntax error, unexpected T_ISSET, expecting T_STRING

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-27 21:24 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

isset() is a keyword, and as such you can\'t use it as a function name.
 [2008-11-28 18:46 UTC] the_djmaze at hotmail dot com
Ehm, i posted in "Feature/Change Request".
Marking as "bogus" and redirecting me to a manual i know from the inside out is not the answer i expected.

I will contact a few PHP developers in any way i can to pinpoint why it's marked "bogus" and not something like "not possible"
 [2011-03-05 16:44 UTC] agideonse at scanyours dot com
There is no documentation on a method called isset() in objects afaik. The 
following code shows this:

Reproduce code:
---------------
class FooBar {
}

$t = new FooBar();
$t->isset();

Expected result
---------------
Nothing

Actual result
-------------
Fatal error: Call to undefined method FooBar::isset()

get_class_methods('FooBar') also shows the non-existence of these methods. In 
addition adding a method 'unset' to an object throws the same error.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC