This repository has been archived by the owner on Dec 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy stdin, stdout and stderr at thread creation (#831)
* Copy stdin, stdout and stderr at thread creation * Duplicate the handles, reimport via streams API * php73 support
- Loading branch information
Showing
4 changed files
with
104 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--TEST-- | ||
Testing stdio constants STDIN / STDOUT / STDERR #806 and #583 | ||
--DESCRIPTION-- | ||
Copy stdin, stdout and stderr at thread creation with PTHREADS_INHERIT_ALL. | ||
--FILE-- | ||
<?php | ||
$thread = new class extends \Thread{ | ||
public function run(){ | ||
var_dump(defined('STDOUT')); | ||
|
||
fwrite(STDOUT, 'Hello'. PHP_EOL); | ||
} | ||
}; | ||
|
||
$thread->start(PTHREADS_INHERIT_ALL) && $thread->join(); | ||
|
||
fwrite(STDOUT, 'World'. PHP_EOL); | ||
?> | ||
--EXPECTF-- | ||
bool(true) | ||
Hello | ||
World |
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,22 @@ | ||
--TEST-- | ||
Testing stdio constants STDIN / STDOUT / STDERR #806 and #583 | ||
--DESCRIPTION-- | ||
Copy stdin, stdout and stderr at thread creation with PTHREADS_INHERIT_NONE. | ||
--FILE-- | ||
<?php | ||
$thread = new class extends \Thread{ | ||
public function run(){ | ||
var_dump(defined('STDOUT')); | ||
|
||
fwrite(STDOUT, 'Hello'. PHP_EOL); | ||
} | ||
}; | ||
|
||
$thread->start(PTHREADS_INHERIT_NONE) && $thread->join(); | ||
|
||
fwrite(STDOUT, 'World'. PHP_EOL); | ||
?> | ||
--EXPECTF-- | ||
bool(true) | ||
Hello | ||
World |