An interesting bug in ReflectionParameter object in PHP 5.2.1

12 thoughts on “An interesting bug in ReflectionParameter object in PHP 5.2.1”

  1. Hi,

    you already searched through the bug database., Why didn’t you continue with it and reported the issue as an bug? Reporting a bug increases the chances that we find these reports and fix them. You have a bit luck that Sebastian read your post and sent me the link, but still I ask you to report a bug so we can keep track of this problem and fix it.

    Blogs are nice for sharing opinions but they won’t work to manage bug reports and feature requests.


  2. However, I think putting non-optional params after optional params (i.e. with default values) is not good programming practice at all.

  3. Hi again,

    ok, after my first coffee and breakfast I took a look on your problem and saw that your assumption was wrong.

    In your first example $b and $c aren’t optional since an parameter without default value ($d) is present, too. We don’t store these values since the engine needs default values only for optional parameters.

    See also example 17.9 ant the note above it on that the parser doesn’t.

    Sorry for not seeing it the first time 🙂

  4. Your code is invalid PHP. As the manual ( says, “when using default arguments, any defaults should be on the right side of any non-default arguments; otherwise, things will not work as expected.” The problem you’re running into is that you’re mixing arguments without defaults with arguments having defaults. $d should occur before $c.

  5. it seems a true bug on PHP engine. if you ask where is the bug. i must say bug of not reporting the wrong coding.

    PHP interpreter should ended with throwing a runtime | interpretation time | compile time exception.

    developers are human and human are used to make wrong. if it is written over the documentation, it is absolutely the work of lazy developer who wrote that part of code on php engine.

    hope this problem will be resolved as soon as possible. and this kinda stuff won’t be excused as documented stuff..

    best regards,

  6. This is an off topic comment, I guess I should mark it as [OT]
    Anyway, I’ve been interviewed at escenic for j2ee developer, and from 25th of last month to 15th May I’ve visited somewherein office 4 times :D. But unfortunately my timing was so poor, that none of the occasions I had the chance to meet you, as you were not there at those times. 🙁
    Anyway stay well and pray for me. 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *