php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #33795 get_class argument not listed as optional
Submitted: 2005-07-21 05:12 UTC Modified: 2005-07-21 11:00 UTC
From: scott at slerman dot net Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
42 - 15 = ?
Subscribe to this entry?

 
 [2005-07-21 05:12 UTC] scott at slerman dot net
Description:
------------
The manual lists the function declaration as 

string get_class ( object obj )

In fact, the argument is optional. If no argument is given, get_class returns the name of the class that the current method is defined in (returning the parent class if the method is called as part of a child class).


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-21 05:33 UTC] sean@php.net
Seems this changed in PHP 5:
sean@iconoclast:~$ php -r 'class Foo { function bar() { echo get_class(); } } Foo::bar();'

Warning: Wrong parameter count for get_class() in Command line code on line 1
sean@iconoclast:~$ php5 -r 'class Foo { function bar() { echo get_class(); } } Foo::bar();'

I'd guess as part of #9, here: http://cvs.php.net/co.php/php-src/README.PHP4-TO-PHP5-THIN-CHANGES

S
 [2005-07-21 11:00 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

"Since PHP 5, obj is optional if called from the object's method."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 19:01:28 2024 UTC