Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f0c3a92

Browse files
Migrate resource returned by proc_open() to opaque object
1 parent dda6b8f commit f0c3a92

20 files changed

+268
-135
lines changed

‎Zend/Optimizer/zend_func_infos.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ static const func_info_t func_infos[] = {
643643
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),
644644
F1("password_hash", MAY_BE_STRING),
645645
#if defined(PHP_CAN_SUPPORT_PROC_OPEN)
646-
F1("proc_open", MAY_BE_RESOURCE|MAY_BE_FALSE),
646+
F1("proc_open", MAY_BE_OBJECT|MAY_BE_FALSE),
647647
#endif
648648
#if defined(PHP_CAN_SUPPORT_PROC_OPEN)
649649
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),

‎ext/standard/basic_functions.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,11 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
303303

304304
assertion_error_ce = register_class_AssertionError(zend_ce_error);
305305

306+
#ifdef PHP_CAN_SUPPORT_PROC_OPEN
307+
process_ce = register_class_Process();
308+
php_register_process_class_handlers();
309+
#endif
310+
306311
BASIC_MINIT_SUBMODULE(var)
307312
BASIC_MINIT_SUBMODULE(file)
308313
BASIC_MINIT_SUBMODULE(pack)

‎ext/standard/basic_functions.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
extern zend_module_entry basic_functions_module;
3838
#define basic_functions_module_ptr &basic_functions_module
3939

40+
#ifdef PHP_CAN_SUPPORT_PROC_OPEN
41+
extern zend_class_entry *process_ce;
42+
extern void php_register_process_class_handlers(void);
43+
#endif
44+
4045
PHP_MINIT_FUNCTION(basic);
4146
PHP_MSHUTDOWN_FUNCTION(basic);
4247
PHP_RINIT_FUNCTION(basic);

‎ext/standard/basic_functions.stub.php‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,16 @@ class AssertionError extends Error
15031503
{
15041504
}
15051505

1506+
#ifdef PHP_CAN_SUPPORT_PROC_OPEN
1507+
/**
1508+
* @strict-properties
1509+
* @not-serializable
1510+
*/
1511+
final class Process
1512+
{
1513+
}
1514+
#endif
1515+
15061516
/* main/main.c */
15071517

15081518
function set_time_limit(int $seconds): bool {}
@@ -3273,23 +3283,19 @@ function password_algos(): array {}
32733283
#ifdef PHP_CAN_SUPPORT_PROC_OPEN
32743284
/**
32753285
* @param array $pipes
3276-
* @return resource|false
32773286
* @refcount 1
32783287
*/
3279-
function proc_open(array|string $command, array $descriptor_spec, &$pipes, ?string $cwd = null, ?array $env_vars = null, ?array $options = null) {}
3288+
function proc_open(array|string $command, array $descriptor_spec, &$pipes, ?string $cwd = null, ?array $env_vars = null, ?array $options = null): Process|false {}
32803289

3281-
/** @param resource $process */
3282-
function proc_close($process): int {}
3290+
function proc_close(Process $process): int {}
32833291

3284-
/** @param resource $process */
3285-
function proc_terminate($process, int $signal = 15): bool {}
3292+
function proc_terminate(Process $process, int $signal = SIGTERM): bool {}
32863293

32873294
/**
3288-
* @param resource $process
32893295
* @return array<string, bool|int|string>
32903296
* @refcount 1
32913297
*/
3292-
function proc_get_status($process): array {}
3298+
function proc_get_status(Process$process): array {}
32933299
#endif
32943300

32953301
/* quot_print.c */

‎ext/standard/basic_functions_arginfo.h‎

Lines changed: 26 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /