Edit report at https://bugs.php.net/bug.php?id=55372&edit=1

 ID:                 55372
 Updated by:         [email protected]
 Reported by:        slowlychillin at yahoo dot com
 Summary:            Trait fails when method parameter has a default
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            Class/Object related
 Operating System:   Windows 7
 PHP Version:        5.4.0alpha3
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

I can't reproduce some problem.

<?php

trait example_trait {
    public function example_method($example_paramter = 1) {
        echo $example_paramter;
    }
}

class foo {
        use example_trait;
}

$x = new foo;
$x->example_method();


Previous Comments:
------------------------------------------------------------------------
[2011-08-05 22:20:42] slowlychillin at yahoo dot com

Description:
------------
My code that worked in php 5.4.0alpha2 is not working in 5.4.0alpha3. When I 
stripped down the code to nail down exactly where things were going wrong, it 
turns out that I have a trait with a method with a parameter that has a 
default. When I remove the default, the script works just fine. When the 
default is there, I get this error message showing up in my browser (Firefox 5):
"The connection was reset
The connection to the server was reset while the page was loading."


Test script:
---------------
// This does not work:
trait example_trait {
    public function example_method($example_paramter = 1) {
        echo $example_paramter;
    }
}

// This does work:
trait example_trait {
    public function example_method($example_paramter) {
        echo $example_paramter;
    }
}



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55372&edit=1

Reply via email to