Ticket #208 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

null as default value for parameters with array type hint produces a fatal error

Reported by: romain.lalaut@… Owned by: moo
Priority: critical Milestone: 1.3.0
Component: cacher Version: 2.0.0
Keywords: null hint Cc:
Blocked By: PHP Version: 5.3.0RC2-dev
Application: Need User Feedback: no
Other Exts: SAPI: FastCGI
Probability: Always Blocking: 129

Description (last modified by moo) (diff)

To reproduce the error :

test.php

<?php

class A
{
        public function __construct( array $a = NULL)
        {
          echo 'Fooo';
        }
}

new A();

test2.php

<?php
namespace My\NS;

use My\NS;

class A
{
        public function __construct( array $a = NULL)
        {
          echo 'Fooo';
        }
}

new A();

Actually it returns

$ php-cgi test.php
X-Powered-By: PHP/5.3.0alpha4-dev
Content-type: text/html

<br />
<b>Fatal error</b>:  Default value for parameters with array type hint can only be an array or NULL in <b>/home/romain/aubonticket/dev/tmp/bug.php</b> on line <b>5</b><br />

It must be (and it works with CLI SAPI) :

$ php-cgi test.php
Fooo

Attachments

constant.diff Download (4.6 KB) - added by moo 4 years ago.

Change History

Changed 4 years ago by moo

  • status changed from new to accepted

Changed 4 years ago by moo

Changed 4 years ago by moo

patch pending, i haven't test it enough yet. maybe you can try it with something too

Changed 4 years ago by moo

  • description modified (diff)

Changed 4 years ago by moo

  • phpversion changed from 5.3.0alpha4-dev to 5.3.0RC2-dev

Changed 4 years ago by moo

  • milestone changed from 2.0.0 to 1.3.0

fixed in [588] for trunk. pending for 1.3

Changed 4 years ago by moo

  • blocking set to 129

Changed 4 years ago by moo

  • status changed from accepted to closed
  • resolution set to fixed
  • milestone changed from 1.3.1 to 1.3.0
Note: See TracTickets for help on using tickets.