64
64
static int le_proc_open ;
65
65
66
66
/* {{{ _php_array_to_envp */
67
- static php_process_env_t _php_array_to_envp (zval * environment , int is_persistent )
67
+ static php_process_env_t _php_array_to_envp (zval * environment )
68
68
{
69
69
zval * element ;
70
70
php_process_env_t env ;
@@ -86,9 +86,9 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
86
86
87
87
if (cnt < 1 ) {
88
88
#ifndef PHP_WIN32
89
- env .envarray = (char * * ) pecalloc (1 , sizeof (char * ), is_persistent );
89
+ env .envarray = (char * * ) ecalloc (1 , sizeof (char * ));
90
90
#endif
91
- env .envp = (char * ) pecalloc (4 , 1 , is_persistent );
91
+ env .envp = (char * ) ecalloc (4 , 1 );
92
92
return env ;
93
93
}
94
94
@@ -115,9 +115,9 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
115
115
} ZEND_HASH_FOREACH_END ();
116
116
117
117
#ifndef PHP_WIN32
118
- ep = env .envarray = (char * * ) pecalloc (cnt + 1 , sizeof (char * ), is_persistent );
118
+ ep = env .envarray = (char * * ) ecalloc (cnt + 1 , sizeof (char * ));
119
119
#endif
120
- p = env .envp = (char * ) pecalloc (sizeenv + 4 , 1 , is_persistent );
120
+ p = env .envp = (char * ) ecalloc (sizeenv + 4 , 1 );
121
121
122
122
ZEND_HASH_FOREACH_STR_KEY_PTR (env_hash , key , str ) {
123
123
#ifndef PHP_WIN32
@@ -147,15 +147,15 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
147
147
/* }}} */
148
148
149
149
/* {{{ _php_free_envp */
150
- static void _php_free_envp (php_process_env_t env , int is_persistent )
150
+ static void _php_free_envp (php_process_env_t env )
151
151
{
152
152
#ifndef PHP_WIN32
153
153
if (env .envarray ) {
154
- pefree (env .envarray , is_persistent );
154
+ efree (env .envarray );
155
155
}
156
156
#endif
157
157
if (env .envp ) {
158
- pefree (env .envp , is_persistent );
158
+ efree (env .envp );
159
159
}
160
160
}
161
161
/* }}} */
@@ -214,10 +214,10 @@ static void proc_open_rsrc_dtor(zend_resource *rsrc)
214
214
#else
215
215
FG (pclose_ret ) = -1 ;
216
216
#endif
217
- _php_free_envp (proc -> env , proc -> is_persistent );
218
- pefree (proc -> pipes , proc -> is_persistent );
219
- pefree (proc -> command , proc -> is_persistent );
220
- pefree (proc , proc -> is_persistent );
217
+ _php_free_envp (proc -> env );
218
+ efree (proc -> pipes );
219
+ efree (proc -> command );
220
+ efree (proc );
221
221
222
222
}
223
223
/* }}} */
@@ -507,7 +507,6 @@ PHP_FUNCTION(proc_open)
507
507
#endif
508
508
php_process_id_t child ;
509
509
struct php_process_handle * proc ;
510
- int is_persistent = 0 ; /* TODO: ensure that persistent procs will work */
511
510
#if PHP_CAN_DO_PTS
512
511
php_file_descriptor_t dev_ptmx = -1 ; /* master */
513
512
php_file_descriptor_t slave_pty = -1 ;
@@ -550,7 +549,7 @@ PHP_FUNCTION(proc_open)
550
549
}
551
550
552
551
if (i == 0 ) {
553
- command = pestrdup (ZSTR_VAL (arg_str ), is_persistent );
552
+ command = estrdup (ZSTR_VAL (arg_str ));
554
553
}
555
554
556
555
argv [i ++ ] = estrdup (ZSTR_VAL (arg_str ));
@@ -563,7 +562,7 @@ PHP_FUNCTION(proc_open)
563
562
#endif
564
563
} else {
565
564
convert_to_string (command_zv );
566
- command = pestrdup (Z_STRVAL_P (command_zv ), is_persistent );
565
+ command = estrdup (Z_STRVAL_P (command_zv ));
567
566
}
568
567
569
568
#ifdef PHP_WIN32
@@ -607,7 +606,7 @@ PHP_FUNCTION(proc_open)
607
606
#endif
608
607
609
608
if (environment ) {
610
- env = _php_array_to_envp (environment , is_persistent );
609
+ env = _php_array_to_envp (environment );
611
610
}
612
611
613
612
ndescriptors_array = zend_hash_num_elements (Z_ARRVAL_P (descriptorspec ));
@@ -1087,10 +1086,9 @@ PHP_FUNCTION(proc_open)
1087
1086
goto exit_fail ;
1088
1087
}
1089
1088
1090
- proc = (struct php_process_handle * )pemalloc (sizeof (struct php_process_handle ), is_persistent );
1091
- proc -> is_persistent = is_persistent ;
1089
+ proc = (struct php_process_handle * ) emalloc (sizeof (struct php_process_handle ));
1092
1090
proc -> command = command ;
1093
- proc -> pipes = pemalloc (sizeof (zend_resource * ) * ndesc , is_persistent );
1091
+ proc -> pipes = emalloc (sizeof (zend_resource * ) * ndesc );
1094
1092
proc -> npipes = ndesc ;
1095
1093
proc -> child = child ;
1096
1094
#ifdef PHP_WIN32
@@ -1182,9 +1180,9 @@ PHP_FUNCTION(proc_open)
1182
1180
if (descriptors ) {
1183
1181
efree (descriptors );
1184
1182
}
1185
- _php_free_envp (env , is_persistent );
1183
+ _php_free_envp (env );
1186
1184
if (command ) {
1187
- pefree (command , is_persistent );
1185
+ efree (command );
1188
1186
}
1189
1187
#ifdef PHP_WIN32
1190
1188
free (cwdw );
0 commit comments