forked from krakjoe/pthreads
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
302 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tests/class-static-properties-order-dependencies-inheritance.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--TEST-- | ||
Testing inherited class statics properties and dependencies (gh bug #666) | ||
--DESCRIPTION-- | ||
If a inherited static property holds a reference to a threaded object, the order of class definition is important. | ||
--FILE-- | ||
<?php | ||
|
||
class SecondClass extends FirstClass {} | ||
class FirstClass extends \Threaded | ||
{ | ||
public static $prop = []; | ||
} | ||
|
||
FirstClass::$prop[] = new SecondClass(); | ||
|
||
$thread = new class extends Thread { | ||
public function run() { | ||
var_dump(FirstClass::$prop); | ||
} | ||
}; | ||
|
||
$thread->start() && $thread->join(); | ||
--EXPECT-- | ||
array(1) { | ||
[0]=> | ||
object(SecondClass)#1 (0) { | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--TEST-- | ||
Testing class statics properties and dependencies (gh bug #666) | ||
--DESCRIPTION-- | ||
If a static property holds a reference to a threaded object, the order of class definition is important. | ||
--FILE-- | ||
<?php | ||
class FirstClass extends \Threaded | ||
{ | ||
public static $prop = []; | ||
} | ||
|
||
class SecondClass extends \Threaded {} | ||
|
||
FirstClass::$prop[] = new SecondClass(); | ||
|
||
$thread = new class extends Thread { | ||
public function run() { | ||
var_dump(FirstClass::$prop); | ||
} | ||
}; | ||
|
||
$thread->start() && $thread->join(); | ||
--EXPECT-- | ||
array(1) { | ||
[0]=> | ||
object(SecondClass)#1 (0) { | ||
} | ||
} | ||
|
Oops, something went wrong.