ID:               46373
 User updated by:  phpbugs at sevenlight dot com
 Reported By:      phpbugs at sevenlight dot com
 Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: OSX 10.5.5
 PHP Version:      5.3CVS-2008-10-23 (snap)
 New Comment:

Can nobody provide any assistance?

I realize I cannot provide a small test-case script, but that is
because this exact same script works fine in the smaller test cases.  I
am looking for any advice as to how I can help track down the cause of
this bug.  If I need to add some debugging code to the PHP source and
recompile, or something else, I'm willing to do this, I just need some
guidance.  I've covered the extent of what I can come up with to test
out inside my PHP code itself, and the bug is at the point where I feel
that it would need some modifications to the PHP code for debugging
purposes, but I have no experience in debugging the PHP C code.  I can
get around debugging C, but not debugging PHP in C.

I know your job is impossible without a test case, but please give me
some help in getting you a test case.  The bug is obviously not simple
enough that a 10 line test case will trigger it (although maybe it can,
but I don't know how to yet).

Thank you,
-Andrew


Previous Comments:
------------------------------------------------------------------------

[2008-10-23 20:54:21] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php



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

[2008-10-23 18:50:07] phpbugs at sevenlight dot com

Description:
------------
Using a type-hint with a namespace does not work.  It allows an object
of a different class to be passed, and even allows a bogus namespace to
be used.  It will also allow null variables, and will pass through any
value, no matter what class type-hinting you use.

Unfortunately, in my simplest test cases I have not been able to
reproduce it, it is only in my larger project that it causes this
problem.

I really don't know where to start with this, and how to duplicate it. 
Needless to say,  have provided the failing code from my project.  The
entire project is several thousand lines of code.  And I've really done
my best to track down the problem, even using the 5.3-alpha3-dev.

I'll include the code that causes the problem.

I really don't know what's wrong, and why it is doing it.  Any hints as
to what I might be able to do to try to reproduce this in a simpler way
would be nice, but I really don't know where to go from here.

Reproduce code:
---------------
<?php
namespace MyNamespace;

class MyClass
{
    // execute
    public function execute()
    {
        $this->test(NULL);
        return $this->_execute($this->_mc);
    }
    
    protected function test(MyBogusNamespace::MyBogusClass $m)
    {
        $reflect = new ReflectionClass(get_class($this));
        $method = $reflect->getMethod('test');
        echo $method;
        var_export($m);
        echo "\n\nClass: " . get_class($m) . " ==
MyBogusNamespace::MyBogusClass\n\n";
    }
}
?>

Expected result:
----------------
Catchable fatal error: Argument 1 passed to
MyNamespace::MyClass::test() must be an instance of
MyBogusNamespace::MyBogusClass, null given, called in
/srv/www/test/ns/new.php on line 9 and defined in
/srv/www/test/ns/new.php on line 13


Actual result:
--------------
Method [ <user> protected method test ] {
  @@ /srv/spin/spin4/spinnaker/extender/universal/tablelibrary.php 73 -
80

  - Parameters [1] {
    Parameter #0 [ <required> MyBogusNamespace::MyBogusClass $m ]
  }
}
NULL

 == MyBogusNamespace::MyBogusClass



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


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

Reply via email to