Ticket #194 (closed defect: worksforme)

Opened 5 years ago

Last modified 2 years ago

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:
Blocked By: PHP Version: 5.3-alpha2
Application: Need User Feedback: no
Other Exts: SAPI: FastCGI
Probability: Always Blocking:

Description (last modified by moo) (diff)

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

Changed 5 years ago by moo

  • status changed from new to assigned
  • description modified (diff)

Changed 2 years ago by moo

  • status changed from assigned to closed
  • resolution set to worksforme

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

Note: See TracTickets for help on using tickets.