|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63562 Call methods with type hints stops thread
Submitted: 2012-11-19 13:24 UTC Modified: 2012-11-23 19:21 UTC
From: wagner_tim78 at yahoo dot de Assigned: krakjoe (profile)
Status: Not a bug Package: pthreads (PECL)
PHP Version: 5.3.18 OS: Debian Linux 6.0.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: wagner_tim78 at yahoo dot de
New email:
PHP Version: OS:


 [2012-11-19 13:24 UTC] wagner_tim78 at yahoo dot de
Hi guys,

we're really interested in your package and decided to start a little test 
project. During implementation we got the following problem.

When in the threads run method a method of a class with type hints will be 
invoked, the thread stops working without any debug out or output in a log file. 
If the type hint is removed the method works as expected.

See the short code example below!


Test script:
class Test {

    protected $_name = '';

    public function __construct($name) {
        $this->_name = $name;

class TestProcessor {

    public function doSomething(Test $test) {
        // do something here

class SomeThread extends Thread {

    public function run() {

        while (true) {
            .... // some socket stuff here

            /* var $test Test
            $test = unserialize($dataFromSocket);

            $processor = new TestProcessor();


$someThread = new SomeThread();

Expected result:
The method should also work with type hints.

Actual result:
The method will not be invoked and the thread stops working without debug/log file 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-21 03:06 UTC]
-Assigned To: +Assigned To: krakjoe
 [2012-11-22 22:44 UTC] wagner_tim78 at yahoo dot de
Hi guys,

i'm not sure what the real problem was, but i think it depends on other 
circumstances and after some major refactoring of my example i can use type hints.

You an close the ticket!

Sorry and thank you
 [2012-11-22 22:46 UTC] wagner_tim78 at yahoo dot de
-Status: Assigned +Status: Closed
 [2012-11-22 22:46 UTC] wagner_tim78 at yahoo dot de
Can't reproduce the circumstances!
 [2012-11-23 19:21 UTC]
-Status: Closed +Status: Not a bug
 [2012-11-23 19:21 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

I just wanted to add: unless it's absolutely necessary you shouldn't use type 
hints; you are creating extra unnecessary work for zend by doing so, I know it 
looks neat to type but with every keyword comes instructions, and with class 
entries come lookups ... in short, if you are defining the entry yourself and 
you have a choice, then avoid type hinting all together.

Type hinting should work, the class table is rebuilt for the thread as it was at 
the time Thread::start was called. However if you combine it with other features 
it may create problems - methods retain a pointer to the scope and those 
pointers are not rewritten by pthreads for the sake of efficiency.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Dec 02 10:03:34 2021 UTC