|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-12-27 00:45 UTC] bobwei9 at hotmail dot com
[2012-12-27 12:07 UTC] krakjoe@php.net
[2012-12-27 12:07 UTC] krakjoe@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: krakjoe
[2012-12-27 12:26 UTC] bobwei9 at hotmail dot com
[2012-12-27 12:35 UTC] bobwei9 at hotmail dot com
[2012-12-27 13:24 UTC] krakjoe@php.net
-Status: Closed
+Status: Re-Opened
[2012-12-27 13:24 UTC] krakjoe@php.net
[2012-12-27 13:34 UTC] krakjoe@php.net
[2012-12-27 13:49 UTC] bobwei9 at hotmail dot com
[2012-12-27 14:38 UTC] krakjoe@php.net
[2012-12-27 14:55 UTC] bobwei9 at hotmail dot com
[2012-12-27 15:16 UTC] bobwei9 at hotmail dot com
[2012-12-27 16:03 UTC] bobwei9 at hotmail dot com
[2012-12-27 16:21 UTC] krakjoe@php.net
[2012-12-27 16:42 UTC] bobwei9 at hotmail dot com
[2012-12-27 16:51 UTC] krakjoe@php.net
[2012-12-27 19:11 UTC] krakjoe@php.net
[2012-12-30 14:51 UTC] krakjoe@php.net
-Status: Re-Opened
+Status: Feedback
[2012-12-30 14:51 UTC] krakjoe@php.net
[2013-01-04 09:35 UTC] krakjoe@php.net
[2013-01-04 09:35 UTC] krakjoe@php.net
-Status: Feedback
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 01:00:01 2025 UTC |
Description: ------------ I want to share an array with Classes between Thread and main-code (not in Thread). As you may notice, when you see the backtrace below, it didn't work. Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000 [Switching to process 9819 thread 0x1303] 0x0000000100963df2 in zend_std_object_get_class (object=0x10207cb18, tsrm_ls=0x102800000) at zend_object_handlers.c:1456 1456 return zobj->ce; (gdb) bt #0 0x0000000100963df2 in zend_std_object_get_class (object=0x10207cb18, tsrm_ls=0x102800000) at zend_object_handlers.c:1456 #1 0x0000000100910144 in zend_get_class_entry (zobject=0x10207cb18, tsrm_ls=0x102800000) at zend_API.c:238 #2 0x00000001006b593d in php_var_serialize_intern (buf=0x102902ef0, struc=0x10207cb18, var_hash=0x102a0aa00, tsrm_ls=0x102800000) at var.c:769 #3 0x00000001006b90de in php_var_serialize_intern (buf=0x102902ef0, struc=0x102080a88, var_hash=0x102a0aa00, tsrm_ls=0x102800000) at var.c:880 #4 0x00000001006ba3b4 in php_var_serialize (buf=0x102902ef0, struc=0x102780788, var_hash=0x102780758, tsrm_ls=0x102800000) at var.c:899 #5 0x00000001020dbe4f in pthreads_store_tostring (pzval=0x102080a88, pstring=0x1028fc040, slength=0x1028fc048, tsrm_ls=0x102800000) at /var/root/pthreads/src/store.c:244 #6 0x00000001020db3a4 in pthreads_store_create (unstore=0x102080a88, tsrm_ls=0x102800000) at /var/root/pthreads/src/store.c:333 #7 0x00000001020db6ab in pthreads_store_separate (pzval=0x102080a88, separated=0x102a08fe8, allocate=1 '\001', tsrm_ls=0x102800000) at /var/root/pthreads/src/store.c:202 #8 0x00000001020d922f in pthreads_prepared_entry (thread=0x1026c0910, candidate=0x102080508, tsrm_ls=0x102800000) at /var/root/pthreads/src/prepare.c:213 #9 0x00000001020d9d30 in pthreads_prepare (thread=0x1026c0910, tsrm_ls=0x102800000) at /var/root/pthreads/src/prepare.c:343 #10 0x00000001020de9ad in pthreads_routine (arg=0x1026c0910) at /var/root/pthreads/src/object.c:637 #11 0x00007fff8c4dc742 in _pthread_start () #12 0x00007fff8c4c9181 in thread_start () Test script: --------------- <?php class ThreadTest extends Thread { public static $test = [0]; public static function staticTest() { return self::$test; } public function run() { $this->result = self::staticTest(); var_dump($this->result); } } //ThreadTest::$test[1] = new stdClass; //ThreadTest::$test[1]->lala = ":D"; $thread = new ThreadTest(); if($thread->start()) if ($thread->join()) var_dump($thread->result); Expected result: ---------------- array(1) { [0]=> int(0) } and with the two lines uncommented: array(1) { [0]=> int(0) [1]=> object(stdClass)#1 (0) { ["lala"]=> string(2) ":D" } } Actual result: -------------- array(1) { [0]=> int(0) } [Thu Dec 27 01:21:47 2012] Script: '-' /var/root/php-src/Zend/zend_execute.c(1655) : Freeing 0x10A16CBF0 (16 bytes), script=- /var/root/php-src/Zend/zend_alloc.c(2529) : Actual location (location was relayed) === Total 1 memory leaks detected === array(1) { [0]=> int(0) } [Thu Dec 27 01:21:47 2012] Script: '/private/var/root/pttest.php' --------------------------------------- /var/root/php-src/Zend/zend_opcode.c(379) : Block 0x10a16cbf0 status: Invalid pointer: ((thread_id=0x0A0D3000) != (expected=0x74AAE180)) --------------------------------------- with the two lines of the reproduce script uncommented: segmentation fault