Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zend/Optimizer/zend_func_infos.h
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ static const func_info_t func_infos[] = {
F1("password_get_info", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_ARRAY_OF_NULL),
F1("password_hash", MAY_BE_STRING),
#if defined(PHP_CAN_SUPPORT_PROC_OPEN)
F1("proc_open", MAY_BE_RESOURCE|MAY_BE_FALSE),
F1("proc_open", MAY_BE_OBJECT|MAY_BE_FALSE),
#endif
#if defined(PHP_CAN_SUPPORT_PROC_OPEN)
F1("proc_get_status", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_FALSE|MAY_BE_ARRAY_OF_TRUE|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING),
Expand Down
6 changes: 2 additions & 4 deletions ext/posix/tests/posix_ttyname_error_wrongparams.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ standard

var_dump(posix_ttyname(0)); // param not a resource

$descriptors = [["pty"], ["pty"], ["pty"], ["pipe", "w"]];
$pipes = [];
$process = proc_open('echo "foo";', $descriptors, $pipes);
$bucket = stream_bucket_new(fopen('php://temp', 'w+'), '');

try {
var_dump(posix_ttyname($process)); // wrong resource type
var_dump(posix_ttyname($bucket->bucket)); // wrong resource type
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
Expand Down
3 changes: 2 additions & 1 deletion ext/readline/tests/bug77812-libedit.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ fclose($pipes[0]);
proc_close($proc);
?>
--EXPECTF--
resource(%d) of type (process)
object(Process)#1 (0) {
}
Interactive shell

bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ $standard = new ReflectionExtension('standard');
var_dump($standard->getClassNames());
?>
--EXPECT--
array(4) {
array(5) {
[0]=>
string(22) "__PHP_Incomplete_Class"
[1]=>
string(14) "AssertionError"
[2]=>
string(15) "php_user_filter"
string(7) "Process"
[3]=>
string(15) "php_user_filter"
[4]=>
string(9) "Directory"
}
5 changes: 5 additions & 0 deletions ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */

assertion_error_ce = register_class_AssertionError(zend_ce_error);

#ifdef PHP_CAN_SUPPORT_PROC_OPEN
process_ce = register_class_Process();
php_register_process_class_handlers();
#endif

BASIC_MINIT_SUBMODULE(var)
BASIC_MINIT_SUBMODULE(file)
BASIC_MINIT_SUBMODULE(pack)
Expand Down
5 changes: 5 additions & 0 deletions ext/standard/basic_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
extern zend_module_entry basic_functions_module;
#define basic_functions_module_ptr &basic_functions_module

#ifdef PHP_CAN_SUPPORT_PROC_OPEN
extern zend_class_entry *process_ce;
extern void php_register_process_class_handlers(void);
#endif

PHP_MINIT_FUNCTION(basic);
PHP_MSHUTDOWN_FUNCTION(basic);
PHP_RINIT_FUNCTION(basic);
Expand Down
22 changes: 14 additions & 8 deletions ext/standard/basic_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,16 @@ class AssertionError extends Error
{
}

#ifdef PHP_CAN_SUPPORT_PROC_OPEN
/**
* @strict-properties
* @not-serializable
*/
final class Process
{
}
#endif

/* main/main.c */

function set_time_limit(int $seconds): bool {}
Expand Down Expand Up @@ -3273,23 +3283,19 @@ function password_algos(): array {}
#ifdef PHP_CAN_SUPPORT_PROC_OPEN
/**
* @param array $pipes
* @return resource|false
* @refcount 1
*/
function proc_open(array|string $command, array $descriptor_spec, &$pipes, ?string $cwd = null, ?array $env_vars = null, ?array $options = null) {}
function proc_open(array|string $command, array $descriptor_spec, &$pipes, ?string $cwd = null, ?array $env_vars = null, ?array $options = null): Process|false {}

/** @param resource $process */
function proc_close($process): int {}
function proc_close(Process $process): int {}

/** @param resource $process */
function proc_terminate($process, int $signal = 15): bool {}
function proc_terminate(Process $process, int $signal = 15): bool {}

/**
* @param resource $process
* @return array<string, bool|int|string>
* @refcount 1
*/
function proc_get_status($process): array {}
function proc_get_status(Process $process): array {}
#endif

/* quot_print.c */
Expand Down
30 changes: 25 additions & 5 deletions ext/standard/basic_functions_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading