|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38726 __autoload miss for is_subclass_of
Submitted: 2006-09-05 16:58 UTC Modified: 2006-09-13 01:00 UTC
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: jiri dot brachtl at centrum dot cz Assigned:
Status: No Feedback Package: Class/Object related
PHP Version: 5.1.6 OS: Windows XP SP2
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 — but make sure to vote on the bug!
Your email address:
Solve the problem:
9 + 26 = ?
Subscribe to this entry?

 [2006-09-05 16:58 UTC] jiri dot brachtl at centrum dot cz
__autoload() fails to load class, when its name is used in the first parameter of is_sublass_of().

Reproduce code:
function __autoload($className) {
  require_once $className . ".php";

//Both ClassName1 and ClassName2 are defined in separate files

  is_sublass_of("ClassName1", "ClassName2")

Expected result:
0 or 1

Actual result:
//nothing, like void return type


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-05 17:04 UTC] jiri dot brachtl at centrum dot cz
Missing 'c' in function name is_subclass_of. Not so important.
 [2006-09-05 17:09 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

 [2006-09-05 17:10 UTC]
And please use var_dump() instead of print_r().
 [2006-09-13 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-09-10 18:06 UTC] dan dot marra at gmail dot com
The follow example was requested. This should reproduce the error:

   function __autoload($classname)

   // in include/foo.php
   class foo {
      private $myVar;
      private $myDerivedClass;

      function __construct()
         $this->myDerivedClass = new Bar();
      function getAllVars()
         $values = get_object_vars($this);
         foreach($values as $property => $value)
	     if(is_subclass_of($value, 'Foo'))
	         die('is a subclass!');

//in include/bar.php
class Bar extends Foo
      private $anotherValue

      function __construct()
           $this->anotherValue = 'foobar';

$myclass = new Foo();


this causes a fatal error where it cannot include 'test 1.php'.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 08 05:01:29 2023 UTC