php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26695 Reflection API does not recognize mixed-case class hints
Submitted: 2003-12-22 13:52 UTC Modified: 2003-12-22 14:59 UTC
From: hans at velum dot net Assigned: helly (profile)
Status: Closed Package: Class/Object related
PHP Version: 5.0.0b3 OS: *
Private report: No CVE-ID: None
 [2003-12-22 13:52 UTC] hans at velum dot net
Description:
------------
This is a problem in PHP 5.0.0b3 (distro), which wasn't an option in the bug report select list.

Basically, upon upgrading to PHP5.0.0b3 our application generated runtime Reflection_Exceptions claiming to be unable to find the class specified by a class hint.

E.g. when calling

$params = $method->getParameters();
$hint = $params[0]->getClass();

Changing the class hint to lowercase fixes this problem.

Reproduce code:
---------------
class Foo {
}

class Bar {
  function demo(Foo $f) {
    // nothing
  }
}

$class = new Reflection_Class('Bar');
$methods = $class->getMethods();
$params = $methods[0]->getParameters();
$hint = $params[0]->getClass(); 
// reflection_exception was thrown

print "Class expected is: ". $hint . "\n";

Expected result:
----------------
Class expected is: Foo

Actual result:
--------------
<b>Fatal error</b>:  Uncaught exception 'reflection_exception' with message 'Class Foo does not exist' in ...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-22 14:59 UTC] helly@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 11:01:28 2024 UTC