Doc #52684 [Opn->Fbk]: document problem with class_exists function
| From: | salathe@php.net | Date: | Tue, 24 Aug 2010 07:49:31 +0000 |
| Subject: | Doc #52684 [Opn->Fbk]: document problem with class_exists function | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4916@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52684&edit=1
ID: 52684
Updated by: salathe@php.net
Reported by: chinawolfs at hotmail dot com
Summary: document problem with class_exists function
-Status: Open
+Status: Feedback
Type: Documentation Problem
Package: Documentation problem
Operating System: window xp
PHP Version: 5.2.14
Block user comment: N
New Comment:
Your sample code will raise a warning on line 4 (Missing argument 1 for
php::home()) and a notice on line 5 (Undefined variable: url); it will
create a
new instance of the php class. If a value is passed along to the method
call,
your script works fine.
Could you elaborate on the nature of the documentation bug, please? I
don't see
it.
Previous Comments:
------------------------------------------------------------------------
[2010-08-24 08:03:09] chinawolfs at hotmail dot com
Description:
------------
<?php
class php {
private $_url = null;
public function home($url) {
$this->_url = $url;
return $this->_url;
}
}
if(class_exists('php')) {
$php = new php();
}
print_r($php->home());
?>
when class_exists('php') eq true .the code have to process $php = new
php();
but I see php manual "Returns TRUE if class_name is a defined class,
FALSE
otherwise"
if the class_name is a defined or true,and I don't new a object.
Test script:
---------------
<?php
class php {
private $_url = null;
public function home($url) {
$this->_url = $url;
return $this->_url;
}
}
if(class_exists('php')) {
$php = new php();
}
print_r($php->home());
?>
Expected result:
----------------
$php is a new object and print_r home() method
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52684&edit=1