Opened 6 years ago

Closed 4 years ago

#194 closed defect (worksforme)

PHP 5.3 class type hint must be null error with namespaces

Reported by: tom@… Owned by: moo
Priority: minor Milestone: 1.3.2
Component: cacher Version:
Keywords: namespace type hint Cc:
Application: PHP Version: 5.3-alpha2
Other Exts: SAPI: FastCGI
Probability: Always Blocked By:
Blocking:

Description (last modified by moo)

Using xcache from svn trunk, once any class that uses class type hints in a method definition with null as the default value has been cached, php engine will throw a fatal error complaining that the default value is *not* null, if you "use" the same namespace as the one you are working in.

trivial example:

<?php
namespace My::NS;

use My::NS;

class A {
    public function test(A $obj=null) {
        var_dump($obj);
    }
}

actual result: "Fatal error: Default value for parameters with a class type hint can only be NULL in ..."

expected: no errors

Change History (2)

comment:1 Changed 6 years ago by moo

  • Description modified (diff)
  • Status changed from new to assigned

comment:2 Changed 4 years ago by moo

  • Resolution set to worksforme
  • Status changed from assigned to closed

works for me in branches/1.3 (1.3.2-dev)

Note: See TracTickets for help on using tickets.