php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63292 Accessing members from outside causes segfault
Submitted: 2012-10-16 19:06 UTC Modified: 2012-10-18 20:56 UTC
From: chibisuke at web dot de Assigned: krakjoe (profile)
Status: Closed Package: pthreads (PECL)
PHP Version: 5.4.7 OS: FreeBSD
Private report: No CVE-ID: None
 [2012-10-16 19:06 UTC] chibisuke at web dot de
Description:
------------
When trying to access a member of the threadclass from outside the thread after the thread was joined causes a segfault.

I used the latest git version of the code, since a part of the problem is fixed there already

Test script:
---------------
<?php
class Test3 extends Thread {
    var $x;
    public function run() {
        $this->x = 7;
        sleep(5);
        return 0;
    }
}

$thread3 = new Test2();
$thread3->x = 5;
1echo $thread3->x; //works(5)
$thread3->start();
echo $thread3->x; //works(5 or 7 - racecondition)
sleep(3);
echo $thread3->x; //works(7)
$thread3->join();
echo $thread3->x; //segfault

?>


Expected result:
----------------
5577

Actual result:
--------------
557Segmentation fault: 11 (core dumped)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-18 20:56 UTC] krakjoe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2012-10-18 20:56 UTC] krakjoe@php.net
write access to thread members has been removed on account of it's instability.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 06:01:30 2024 UTC