Opened 6 years ago

Closed 5 years ago

#208 closed defect (fixed)

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:
Application: PHP Version: 5.3.0RC2-dev
Other Exts: SAPI: FastCGI
Probability: Always Blocked By:
Blocking: #129

Description (last modified by moo)

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 (1)

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

Download all attachments as: .zip

Change History (8)

comment:1 Changed 6 years ago by moo

  • Status changed from new to accepted

Changed 6 years ago by moo

comment:2 Changed 6 years ago by moo

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

comment:3 Changed 6 years ago by moo

  • Description modified (diff)

comment:4 Changed 5 years ago by moo

  • PHP Version changed from 5.3.0alpha4-dev to 5.3.0RC2-dev

comment:5 Changed 5 years ago by moo

  • Milestone changed from 2.0.0 to 1.3.0

fixed in [588] for trunk. pending for 1.3

comment:6 Changed 5 years ago by moo

  • Blocking 129 added

comment:7 Changed 5 years ago by moo

  • Milestone changed from 1.3.1 to 1.3.0
  • Resolution set to fixed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.