php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63566 Segmentation Fault
Submitted: 2012-11-20 14:14 UTC Modified: 2012-11-23 15:53 UTC
Votes:2
Avg. Score:3.5 ± 1.5
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: j dot pardons at redline-hosting dot eu Assigned: krakjoe (profile)
Status: Not a bug Package: pthreads (PECL)
PHP Version: 5.4.8 OS: Debian
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:
Package:
Bug Type:
Summary:
From: j dot pardons at redline-hosting dot eu
New email:
PHP Version: OS:

 

 [2012-11-20 14:14 UTC] j dot pardons at redline-hosting dot eu
Description:
------------
#0  0x083afc55 in zend_std_object_get_class (object=0x9f5ca88, tsrm_ls=0xb772b600) at /home/php-5.4.8/Zend/zend_object_handlers.c:1450
1450	{
(gdb) bt
#0  0x083afc55 in zend_std_object_get_class (object=0x9f5ca88, tsrm_ls=0xb772b600) at /home/php-5.4.8/Zend/zend_object_handlers.c:1450
#1  0x082f90c1 in php_var_serialize (buf=0x9fc3150, struc=0xb6d30f3c, var_hash=0xb6d30f38, tsrm_ls=0x9f5ca88) at /home/php-5.4.8/ext/standard/var.c:899
#2  0xb6d3a03e in pthreads_store_tostring (unstore=0x2, tsrm_ls=<value optimized out>) at /home/pthreads-0.0.38/src/store.c:182
#3  pthreads_store_create (unstore=0x2, tsrm_ls=<value optimized out>) at /home/pthreads-0.0.38/src/store.c:273
#4  0xb6d3a60a in pthreads_store_separate (pzval=0x0, separated=0xb650e354, allocate=1 '\001', tsrm_ls=0x9f5ca88) at /home/pthreads-0.0.38/src/store.c:143
#5  0xb6d391e1 in pthreads_prepared_entry (thread=0x9f5c348, candidate=0xb6f05c5c, tsrm_ls=0x9f5ca88) at /home/pthreads-0.0.38/src/prepare.c:213
#6  0xb6d395e0 in pthreads_prepare (thread=0x9f5c348, tsrm_ls=0x9f5ca88) at /home/pthreads-0.0.38/src/prepare.c:311
#7  0xb6d3cc6b in pthreads_routine (arg=0x9f5c348) at /home/pthreads-0.0.38/src/object.c:619
#8  0xb7097955 in start_thread () from /lib/i686/cmov/libpthread.so.0
#9  0xb70171de in clone () from /lib/i686/cmov/libc.so.6


Test script:
---------------
<?php
dl('pthreads.so');
error_reporting(E_ALL);
class ThreadTest extends Worker {

	public $t = 0;
	public function run(){
		$i=0;
		while(true){
			if ($this->t == 1) { echo "counter++\n"; test::instance()->counter++; }
			if ($this->t == 2) {
				try {
				echo "test123\n";
				echo test::instance()->getCounter()."\n";
				echo "test123\n";
			} catch (Exception $ex) {
				echo $ex->getMessage();
			}
			}
			sleep(rand(1, 3));
		}
		return $i;
	}
}

class test {
	
	static private $ins = null;
	
	public static function instance() {
		if (self::$ins == null) {
			self::$ins = new test();
		}
		
		return self::$ins;
	}
	
	public $counter = 1;
	
	public function getCounter() {
		return "c:".$this->counter;
	}
	
}

$counter = 1;

echo "test: ".test::instance()->getCounter()."\n";


$thread = new ThreadTest();
$thread->t = 1;
$thread2 = new ThreadTest();
$thread2->t = 2;
if($thread->start() && $thread2->start()) {
	sleep(60);
}



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-21 03:07 UTC] laruence@php.net
-Assigned To: +Assigned To: krakjoe
 [2012-11-23 15:53 UTC] krakjoe@php.net
-Status: Assigned +Status: Not a bug
 [2012-11-23 15:53 UTC] krakjoe@php.net
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 http://www.php.net/support.php 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.

static variables are accessible but 
inherently unsafe; the Zend Engine 
provides handlers for reading and 
writing the object context, the same 
is not provided for the instance 
context.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 02:01:25 2019 UTC