|
1 # Source: upstream |
|
2 # http://git.php.net/?p=php-src.git;a=patch;h=bbe4b87e1d1fa858c208368a28c0fb17c7774fe0;hp=676e0c0f7b294f8948f77a213d22ce9cdd014e4f |
|
3 # Fixed in 5.6.9 |
|
4 # This patch also contains unnecessary whitespace changes but is left as is |
|
5 |
|
6 From bbe4b87e1d1fa858c208368a28c0fb17c7774fe0 Mon Sep 17 00:00:00 2001 |
|
7 From: Stanislav Malyshev <[email protected]> |
|
8 Date: Sat, 9 May 2015 23:13:06 -0700 |
|
9 Subject: [PATCH 1/1] Fixed bug #69418 - more s->p fixes for filenames |
|
10 |
|
11 Conflicts: |
|
12 ext/pcntl/pcntl.c |
|
13 ext/standard/basic_functions.c |
|
14 --- |
|
15 ext/pcntl/pcntl.c | 74 +++++++++++++++++++++--------------------- |
|
16 ext/standard/basic_functions.c | 29 ++++++++++------- |
|
17 ext/standard/dir.c | 62 +++++++++++++++++------------------ |
|
18 ext/standard/file.c | 4 +-- |
|
19 4 files changed, 88 insertions(+), 81 deletions(-) |
|
20 |
|
21 diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c |
|
22 index bace3b0..09520a9 100644 |
|
23 --- a/ext/pcntl/pcntl.c |
|
24 +++ b/ext/pcntl/pcntl.c |
|
25 @@ -198,7 +198,7 @@ ZEND_GET_MODULE(pcntl) |
|
26 |
|
27 static void pcntl_signal_handler(int); |
|
28 static void pcntl_signal_dispatch(); |
|
29 - |
|
30 + |
|
31 void php_register_signal_constants(INIT_FUNC_ARGS) |
|
32 { |
|
33 |
|
34 @@ -234,7 +234,7 @@ void php_register_signal_constants(INIT_FUNC_ARGS) |
|
35 REGISTER_LONG_CONSTANT("SIGTERM", (long) SIGTERM, CONST_CS | CONST_PERSISTENT); |
|
36 #ifdef SIGSTKFLT |
|
37 REGISTER_LONG_CONSTANT("SIGSTKFLT",(long) SIGSTKFLT, CONST_CS | CONST_PERSISTENT); |
|
38 -#endif |
|
39 +#endif |
|
40 #ifdef SIGCLD |
|
41 REGISTER_LONG_CONSTANT("SIGCLD", (long) SIGCLD, CONST_CS | CONST_PERSISTENT); |
|
42 #endif |
|
43 @@ -484,7 +484,7 @@ static void php_pcntl_register_errno_constants(INIT_FUNC_ARGS) |
|
44 } |
|
45 |
|
46 static PHP_GINIT_FUNCTION(pcntl) |
|
47 -{ |
|
48 +{ |
|
49 memset(pcntl_globals, 0, sizeof(*pcntl_globals)); |
|
50 } |
|
51 |
|
52 @@ -547,7 +547,7 @@ PHP_FUNCTION(pcntl_fork) |
|
53 PCNTL_G(last_error) = errno; |
|
54 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d", errno); |
|
55 } |
|
56 - |
|
57 + |
|
58 RETURN_LONG((long) id); |
|
59 } |
|
60 /* }}} */ |
|
61 @@ -560,7 +560,7 @@ PHP_FUNCTION(pcntl_alarm) |
|
62 |
|
63 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE) |
|
64 return; |
|
65 - |
|
66 + |
|
67 RETURN_LONG ((long) alarm(seconds)); |
|
68 } |
|
69 /* }}} */ |
|
70 @@ -576,7 +576,7 @@ PHP_FUNCTION(pcntl_waitpid) |
|
71 |
|
72 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|l", &pid, &z_status, &options) == FAILURE) |
|
73 return; |
|
74 - |
|
75 + |
|
76 convert_to_long_ex(&z_status); |
|
77 |
|
78 status = Z_LVAL_P(z_status); |
|
79 @@ -604,7 +604,7 @@ PHP_FUNCTION(pcntl_wait) |
|
80 |
|
81 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &z_status, &options) == FAILURE) |
|
82 return; |
|
83 - |
|
84 + |
|
85 convert_to_long_ex(&z_status); |
|
86 |
|
87 status = Z_LVAL_P(z_status); |
|
88 @@ -628,7 +628,7 @@ PHP_FUNCTION(pcntl_wait) |
|
89 } |
|
90 /* }}} */ |
|
91 |
|
92 -/* {{{ proto bool pcntl_wifexited(int status) |
|
93 +/* {{{ proto bool pcntl_wifexited(int status) |
|
94 Returns true if the child status code represents a successful exit */ |
|
95 PHP_FUNCTION(pcntl_wifexited) |
|
96 { |
|
97 @@ -646,7 +646,7 @@ PHP_FUNCTION(pcntl_wifexited) |
|
98 } |
|
99 /* }}} */ |
|
100 |
|
101 -/* {{{ proto bool pcntl_wifstopped(int status) |
|
102 +/* {{{ proto bool pcntl_wifstopped(int status) |
|
103 Returns true if the child status code represents a stopped process (WUNTRACED must have been used with waitpid) */ |
|
104 PHP_FUNCTION(pcntl_wifstopped) |
|
105 { |
|
106 @@ -664,7 +664,7 @@ PHP_FUNCTION(pcntl_wifstopped) |
|
107 } |
|
108 /* }}} */ |
|
109 |
|
110 -/* {{{ proto bool pcntl_wifsignaled(int status) |
|
111 +/* {{{ proto bool pcntl_wifsignaled(int status) |
|
112 Returns true if the child status code represents a process that was terminated due to a signal */ |
|
113 PHP_FUNCTION(pcntl_wifsignaled) |
|
114 { |
|
115 @@ -682,7 +682,7 @@ PHP_FUNCTION(pcntl_wifsignaled) |
|
116 } |
|
117 /* }}} */ |
|
118 |
|
119 -/* {{{ proto int pcntl_wexitstatus(int status) |
|
120 +/* {{{ proto int pcntl_wexitstatus(int status) |
|
121 Returns the status code of a child's exit */ |
|
122 PHP_FUNCTION(pcntl_wexitstatus) |
|
123 { |
|
124 @@ -700,7 +700,7 @@ PHP_FUNCTION(pcntl_wexitstatus) |
|
125 } |
|
126 /* }}} */ |
|
127 |
|
128 -/* {{{ proto int pcntl_wtermsig(int status) |
|
129 +/* {{{ proto int pcntl_wtermsig(int status) |
|
130 Returns the number of the signal that terminated the process who's status code is passed */ |
|
131 PHP_FUNCTION(pcntl_wtermsig) |
|
132 { |
|
133 @@ -718,7 +718,7 @@ PHP_FUNCTION(pcntl_wtermsig) |
|
134 } |
|
135 /* }}} */ |
|
136 |
|
137 -/* {{{ proto int pcntl_wstopsig(int status) |
|
138 +/* {{{ proto int pcntl_wstopsig(int status) |
|
139 Returns the number of the signal that caused the process to stop who's status code is passed */ |
|
140 PHP_FUNCTION(pcntl_wstopsig) |
|
141 { |
|
142 @@ -754,19 +754,19 @@ PHP_FUNCTION(pcntl_exec) |
|
143 char *path; |
|
144 int path_len; |
|
145 ulong key_num; |
|
146 - |
|
147 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|aa", &path, &path_len, &args, &envs) == FAILURE) { |
|
148 + |
|
149 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|aa", &path, &path_len, &args, &envs) == FAILURE) { |
|
150 return; |
|
151 } |
|
152 - |
|
153 + |
|
154 if (ZEND_NUM_ARGS() > 1) { |
|
155 /* Build argument list */ |
|
156 args_hash = HASH_OF(args); |
|
157 argc = zend_hash_num_elements(args_hash); |
|
158 - |
|
159 + |
|
160 argv = safe_emalloc((argc + 2), sizeof(char *), 0); |
|
161 *argv = path; |
|
162 - for ( zend_hash_internal_pointer_reset(args_hash), current_arg = argv+1; |
|
163 + for ( zend_hash_internal_pointer_reset(args_hash), current_arg = argv+1; |
|
164 (argi < argc && (zend_hash_get_current_data(args_hash, (void **) &element) == SUCCESS)); |
|
165 (argi++, current_arg++, zend_hash_move_forward(args_hash)) ) { |
|
166 |
|
167 @@ -784,9 +784,9 @@ PHP_FUNCTION(pcntl_exec) |
|
168 /* Build environment pair list */ |
|
169 envs_hash = HASH_OF(envs); |
|
170 envc = zend_hash_num_elements(envs_hash); |
|
171 - |
|
172 + |
|
173 envp = safe_emalloc((envc + 1), sizeof(char *), 0); |
|
174 - for ( zend_hash_internal_pointer_reset(envs_hash), pair = envp; |
|
175 + for ( zend_hash_internal_pointer_reset(envs_hash), pair = envp; |
|
176 (envi < envc && (zend_hash_get_current_data(envs_hash, (void **) &element) == SUCCESS)); |
|
177 (envi++, pair++, zend_hash_move_forward(envs_hash)) ) { |
|
178 switch (return_val = zend_hash_get_current_key_ex(envs_hash, &key, &key_length, &key_num, 0, NULL)) { |
|
179 @@ -802,13 +802,13 @@ PHP_FUNCTION(pcntl_exec) |
|
180 |
|
181 convert_to_string_ex(element); |
|
182 |
|
183 - /* Length of element + equal sign + length of key + null */ |
|
184 + /* Length of element + equal sign + length of key + null */ |
|
185 pair_length = Z_STRLEN_PP(element) + key_length + 2; |
|
186 *pair = emalloc(pair_length); |
|
187 - strlcpy(*pair, key, key_length); |
|
188 + strlcpy(*pair, key, key_length); |
|
189 strlcat(*pair, "=", pair_length); |
|
190 strlcat(*pair, Z_STRVAL_PP(element), pair_length); |
|
191 - |
|
192 + |
|
193 /* Cleanup */ |
|
194 if (return_val == HASH_KEY_IS_LONG) efree(key); |
|
195 } |
|
196 @@ -818,7 +818,7 @@ PHP_FUNCTION(pcntl_exec) |
|
197 PCNTL_G(last_error) = errno; |
|
198 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occurred: (errno %d) %s", errno, strerror(errno)); |
|
199 } |
|
200 - |
|
201 + |
|
202 /* Cleanup */ |
|
203 for (pair = envp; *pair != NULL; pair++) efree(*pair); |
|
204 efree(envp); |
|
205 @@ -831,7 +831,7 @@ PHP_FUNCTION(pcntl_exec) |
|
206 } |
|
207 |
|
208 efree(argv); |
|
209 - |
|
210 + |
|
211 RETURN_FALSE; |
|
212 } |
|
213 /* }}} */ |
|
214 @@ -881,7 +881,7 @@ PHP_FUNCTION(pcntl_signal) |
|
215 zend_hash_index_del(&PCNTL_G(php_signal_table), signo); |
|
216 RETURN_TRUE; |
|
217 } |
|
218 - |
|
219 + |
|
220 if (!zend_is_callable(handle, 0, &func_name TSRMLS_CC)) { |
|
221 PCNTL_G(last_error) = EINVAL; |
|
222 php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a callable function name error", func_name); |
|
223 @@ -889,11 +889,11 @@ PHP_FUNCTION(pcntl_signal) |
|
224 RETURN_FALSE; |
|
225 } |
|
226 efree(func_name); |
|
227 - |
|
228 + |
|
229 /* Add the function name to our signal table */ |
|
230 zend_hash_index_update(&PCNTL_G(php_signal_table), signo, (void **) &handle, sizeof(zval *), (void **) &dest_handle); |
|
231 if (dest_handle) zval_add_ref(dest_handle); |
|
232 - |
|
233 + |
|
234 if (php_signal4(signo, pcntl_signal_handler, (int) restart_syscalls, 1) == SIG_ERR) { |
|
235 PCNTL_G(last_error) = errno; |
|
236 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error assigning signal"); |
|
237 @@ -1030,7 +1030,7 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{ |
|
238 } |
|
239 |
|
240 /* |
|
241 - * sigtimedwait and sigwaitinfo can return 0 on success on some |
|
242 + * sigtimedwait and sigwaitinfo can return 0 on success on some |
|
243 * platforms, e.g. NetBSD |
|
244 */ |
|
245 if (!signo && siginfo.si_signo) { |
|
246 @@ -1078,7 +1078,7 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{ |
|
247 EMPTY_SWITCH_DEFAULT_CASE(); |
|
248 } |
|
249 } |
|
250 - |
|
251 + |
|
252 RETURN_LONG(signo); |
|
253 } |
|
254 /* }}} */ |
|
255 @@ -1108,12 +1108,12 @@ PHP_FUNCTION(pcntl_getpriority) |
|
256 long who = PRIO_PROCESS; |
|
257 long pid = getpid(); |
|
258 int pri; |
|
259 - |
|
260 + |
|
261 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &pid, &who) == FAILURE) { |
|
262 RETURN_FALSE; |
|
263 } |
|
264 |
|
265 - /* needs to be cleared, since any returned value is valid */ |
|
266 + /* needs to be cleared, since any returned value is valid */ |
|
267 errno = 0; |
|
268 |
|
269 pri = getpriority(who, pid); |
|
270 @@ -1173,7 +1173,7 @@ PHP_FUNCTION(pcntl_setpriority) |
|
271 } |
|
272 RETURN_FALSE; |
|
273 } |
|
274 - |
|
275 + |
|
276 RETURN_TRUE; |
|
277 } |
|
278 /* }}} */ |
|
279 @@ -1206,7 +1206,7 @@ static void pcntl_signal_handler(int signo) |
|
280 { |
|
281 struct php_pcntl_pending_signal *psig; |
|
282 TSRMLS_FETCH(); |
|
283 - |
|
284 + |
|
285 psig = PCNTL_G(spares); |
|
286 if (!psig) { |
|
287 /* oops, too many signals for us to track, so we'll forget about this one */ |
|
288 @@ -1239,7 +1239,7 @@ void pcntl_signal_dispatch() |
|
289 if(!PCNTL_G(pending_signals)) { |
|
290 return; |
|
291 } |
|
292 - |
|
293 + |
|
294 /* Mask all signals */ |
|
295 sigfillset(&mask); |
|
296 sigprocmask(SIG_BLOCK, &mask, &old_mask); |
|
297 @@ -1255,7 +1255,7 @@ void pcntl_signal_dispatch() |
|
298 |
|
299 queue = PCNTL_G(head); |
|
300 PCNTL_G(head) = NULL; /* simple stores are atomic */ |
|
301 - |
|
302 + |
|
303 /* Allocate */ |
|
304 |
|
305 while (queue) { |
|
306 @@ -1282,7 +1282,7 @@ void pcntl_signal_dispatch() |
|
307 |
|
308 /* Re-enable queue */ |
|
309 PCNTL_G(processing_signal_queue) = 0; |
|
310 - |
|
311 + |
|
312 /* return signal mask to previous state */ |
|
313 sigprocmask(SIG_SETMASK, &old_mask, NULL); |
|
314 } |
|
315 diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c |
|
316 index a3783e0..83d140e 100644 |
|
317 --- a/ext/standard/basic_functions.c |
|
318 +++ b/ext/standard/basic_functions.c |
|
319 @@ -2127,7 +2127,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_stream_set_write_buffer, 0) |
|
320 ZEND_ARG_INFO(0, fp) |
|
321 ZEND_ARG_INFO(0, buffer) |
|
322 ZEND_END_ARG_INFO() |
|
323 - |
|
324 + |
|
325 ZEND_BEGIN_ARG_INFO(arginfo_stream_set_chunk_size, 0) |
|
326 ZEND_ARG_INFO(0, fp) |
|
327 ZEND_ARG_INFO(0, chunk_size) |
|
328 @@ -2322,7 +2322,7 @@ ZEND_END_ARG_INFO() |
|
329 ZEND_BEGIN_ARG_INFO(arginfo_lcfirst, 0) |
|
330 ZEND_ARG_INFO(0, str) |
|
331 ZEND_END_ARG_INFO() |
|
332 - |
|
333 + |
|
334 ZEND_BEGIN_ARG_INFO_EX(arginfo_ucwords, 0, 0, 1) |
|
335 ZEND_ARG_INFO(0, str) |
|
336 ZEND_ARG_INFO(0, delimiters) |
|
337 @@ -3475,7 +3475,7 @@ static void basic_globals_ctor(php_basic_globals *basic_globals_p TSRMLS_DC) /* |
|
338 BG(user_tick_functions) = NULL; |
|
339 BG(user_filter_map) = NULL; |
|
340 BG(serialize_lock) = 0; |
|
341 - |
|
342 + |
|
343 memset(&BG(serialize), 0, sizeof(BG(serialize))); |
|
344 memset(&BG(unserialize), 0, sizeof(BG(unserialize))); |
|
345 |
|
346 @@ -4034,8 +4034,8 @@ PHP_FUNCTION(getenv) |
|
347 int size; |
|
348 |
|
349 SetLastError(0); |
|
350 - /*If the given bugger is not large enough to hold the data, the return value is |
|
351 - the buffer size, in characters, required to hold the string and its terminating |
|
352 + /*If the given bugger is not large enough to hold the data, the return value is |
|
353 + the buffer size, in characters, required to hold the string and its terminating |
|
354 null character. We use this return value to alloc the final buffer. */ |
|
355 size = GetEnvironmentVariableA(str, &dummybuf, 0); |
|
356 if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) { |
|
357 @@ -4087,7 +4087,7 @@ PHP_FUNCTION(putenv) |
|
358 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &setting, &setting_len) == FAILURE) { |
|
359 return; |
|
360 } |
|
361 - |
|
362 + |
|
363 if(setting_len == 0 || setting[0] == '=') { |
|
364 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter syntax"); |
|
365 RETURN_FALSE; |
|
366 @@ -4151,6 +4151,13 @@ PHP_FUNCTION(putenv) |
|
367 && _putenv(pe.putenv_string) == 0 |
|
368 # endif |
|
369 ) { /* success */ |
|
370 +# if _MSC_VER < 1500 |
|
371 + /* Yet another VC6 bug, unset may return env not found */ |
|
372 + if (error_code != 0 || |
|
373 + (error_code == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND)) { |
|
374 +# else |
|
375 + if (error_code != 0) { /* success */ |
|
376 +# endif |
|
377 # endif |
|
378 #endif |
|
379 zend_hash_add(&BG(putenv_ht), pe.key, pe.key_len + 1, (void **) &pe, sizeof(putenv_entry), NULL); |
|
380 @@ -4634,7 +4641,7 @@ PHP_FUNCTION(set_magic_quotes_runtime) |
|
381 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &new_setting) == FAILURE) { |
|
382 return; |
|
383 } |
|
384 - |
|
385 + |
|
386 if (new_setting) { |
|
387 php_error_docref(NULL TSRMLS_CC, E_CORE_ERROR, "magic_quotes_runtime is not supported anymore"); |
|
388 } |
|
389 @@ -4922,7 +4929,7 @@ PHP_FUNCTION(forward_static_call) |
|
390 instanceof_function(EG(called_scope), fci_cache.calling_scope TSRMLS_CC)) { |
|
391 fci_cache.called_scope = EG(called_scope); |
|
392 } |
|
393 - |
|
394 + |
|
395 if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && fci.retval_ptr_ptr && *fci.retval_ptr_ptr) { |
|
396 COPY_PZVAL_TO_ZVAL(*return_value, *fci.retval_ptr_ptr); |
|
397 } |
|
398 @@ -5495,7 +5502,7 @@ PHP_FUNCTION(set_include_path) |
|
399 int new_value_len; |
|
400 char *old_value; |
|
401 |
|
402 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &new_value, &new_value_len) == FAILURE) { |
|
403 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &new_value, &new_value_len) == FAILURE) { |
|
404 return; |
|
405 } |
|
406 |
|
407 @@ -5623,7 +5630,7 @@ PHP_FUNCTION(getservbyname) |
|
408 } |
|
409 |
|
410 |
|
411 -/* empty string behaves like NULL on windows implementation of |
|
412 +/* empty string behaves like NULL on windows implementation of |
|
413 getservbyname. Let be portable instead. */ |
|
414 #ifdef PHP_WIN32 |
|
415 if (proto_len == 0) { |
|
416 @@ -6051,7 +6058,7 @@ PHP_FUNCTION(parse_ini_string) |
|
417 /* }}} */ |
|
418 |
|
419 #if ZEND_DEBUG |
|
420 -/* This function returns an array of ALL valid ini options with values and |
|
421 +/* This function returns an array of ALL valid ini options with values and |
|
422 * is not the same as ini_get_all() which returns only registered ini options. Only useful for devs to debug php.ini scanner/parser! */ |
|
423 PHP_FUNCTION(config_get_hash) /* {{{ */ |
|
424 { |
|
425 diff --git a/ext/standard/dir.c b/ext/standard/dir.c |
|
426 index 2ba4024..ddf884f 100644 |
|
427 --- a/ext/standard/dir.c |
|
428 +++ b/ext/standard/dir.c |
|
429 @@ -93,8 +93,8 @@ static zend_class_entry *dir_class_entry_ptr; |
|
430 dirp = (php_stream *) zend_fetch_resource(&id TSRMLS_CC, -1, "Directory", NULL, 1, php_file_le_stream()); \ |
|
431 if (!dirp) \ |
|
432 RETURN_FALSE; \ |
|
433 - } |
|
434 - |
|
435 + } |
|
436 + |
|
437 /* {{{ arginfo */ |
|
438 ZEND_BEGIN_ARG_INFO_EX(arginfo_dir, 0, 0, 0) |
|
439 ZEND_ARG_INFO(0, dir_handle) |
|
440 @@ -118,7 +118,7 @@ static void php_set_default_dir(int id TSRMLS_DC) |
|
441 if (id != -1) { |
|
442 zend_list_addref(id); |
|
443 } |
|
444 - |
|
445 + |
|
446 DIRG(default_dir) = id; |
|
447 } |
|
448 |
|
449 @@ -168,25 +168,25 @@ PHP_MINIT_FUNCTION(dir) |
|
450 |
|
451 #ifdef GLOB_NOSORT |
|
452 REGISTER_LONG_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_CS | CONST_PERSISTENT); |
|
453 -#else |
|
454 +#else |
|
455 # define GLOB_NOSORT 0 |
|
456 #endif |
|
457 |
|
458 #ifdef GLOB_NOCHECK |
|
459 REGISTER_LONG_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_CS | CONST_PERSISTENT); |
|
460 -#else |
|
461 +#else |
|
462 # define GLOB_NOCHECK 0 |
|
463 #endif |
|
464 |
|
465 #ifdef GLOB_NOESCAPE |
|
466 REGISTER_LONG_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_CS | CONST_PERSISTENT); |
|
467 -#else |
|
468 +#else |
|
469 # define GLOB_NOESCAPE 0 |
|
470 #endif |
|
471 |
|
472 #ifdef GLOB_ERR |
|
473 REGISTER_LONG_CONSTANT("GLOB_ERR", GLOB_ERR, CONST_CS | CONST_PERSISTENT); |
|
474 -#else |
|
475 +#else |
|
476 # define GLOB_ERR 0 |
|
477 #endif |
|
478 |
|
479 @@ -219,12 +219,12 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) |
|
480 php_stream_context *context = NULL; |
|
481 php_stream *dirp; |
|
482 |
|
483 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &dirname, &dir_len, &zcontext) == FAILURE) { |
|
484 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|r", &dirname, &dir_len, &zcontext) == FAILURE) { |
|
485 RETURN_NULL(); |
|
486 } |
|
487 |
|
488 context = php_stream_context_from_zval(zcontext, 0); |
|
489 - |
|
490 + |
|
491 dirp = php_stream_opendir(dirname, REPORT_ERRORS, context); |
|
492 |
|
493 if (dirp == NULL) { |
|
494 @@ -232,7 +232,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) |
|
495 } |
|
496 |
|
497 dirp->flags |= PHP_STREAM_FLAG_NO_FCLOSE; |
|
498 - |
|
499 + |
|
500 php_set_default_dir(dirp->rsrc_id TSRMLS_CC); |
|
501 |
|
502 if (createobject) { |
|
503 @@ -293,11 +293,11 @@ PHP_FUNCTION(chroot) |
|
504 { |
|
505 char *str; |
|
506 int ret, str_len; |
|
507 - |
|
508 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { |
|
509 + |
|
510 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &str, &str_len) == FAILURE) { |
|
511 RETURN_FALSE; |
|
512 } |
|
513 - |
|
514 + |
|
515 ret = chroot(str); |
|
516 if (ret != 0) { |
|
517 php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno); |
|
518 @@ -305,9 +305,9 @@ PHP_FUNCTION(chroot) |
|
519 } |
|
520 |
|
521 php_clear_stat_cache(1, NULL, 0 TSRMLS_CC); |
|
522 - |
|
523 + |
|
524 ret = chdir("/"); |
|
525 - |
|
526 + |
|
527 if (ret != 0) { |
|
528 php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno); |
|
529 RETURN_FALSE; |
|
530 @@ -324,7 +324,7 @@ PHP_FUNCTION(chdir) |
|
531 { |
|
532 char *str; |
|
533 int ret, str_len; |
|
534 - |
|
535 + |
|
536 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &str, &str_len) == FAILURE) { |
|
537 RETURN_FALSE; |
|
538 } |
|
539 @@ -333,7 +333,7 @@ PHP_FUNCTION(chdir) |
|
540 RETURN_FALSE; |
|
541 } |
|
542 ret = VCWD_CHDIR(str); |
|
543 - |
|
544 + |
|
545 if (ret != 0) { |
|
546 php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno); |
|
547 RETURN_FALSE; |
|
548 @@ -358,7 +358,7 @@ PHP_FUNCTION(getcwd) |
|
549 { |
|
550 char path[MAXPATHLEN]; |
|
551 char *ret=NULL; |
|
552 - |
|
553 + |
|
554 if (zend_parse_parameters_none() == FAILURE) { |
|
555 return; |
|
556 } |
|
557 @@ -383,7 +383,7 @@ PHP_FUNCTION(rewinddir) |
|
558 { |
|
559 zval *id = NULL, **tmp, *myself; |
|
560 php_stream *dirp; |
|
561 - |
|
562 + |
|
563 FETCH_DIRP(); |
|
564 |
|
565 if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) { |
|
566 @@ -450,9 +450,9 @@ PHP_FUNCTION(glob) |
|
567 RETURN_FALSE; |
|
568 } |
|
569 |
|
570 -#ifdef ZTS |
|
571 +#ifdef ZTS |
|
572 if (!IS_ABSOLUTE_PATH(pattern, pattern_len)) { |
|
573 - result = VCWD_GETCWD(cwd, MAXPATHLEN); |
|
574 + result = VCWD_GETCWD(cwd, MAXPATHLEN); |
|
575 if (!result) { |
|
576 cwd[0] = '\0'; |
|
577 } |
|
578 @@ -465,10 +465,10 @@ PHP_FUNCTION(glob) |
|
579 |
|
580 snprintf(work_pattern, MAXPATHLEN, "%s%c%s", cwd, DEFAULT_SLASH, pattern); |
|
581 pattern = work_pattern; |
|
582 - } |
|
583 + } |
|
584 #endif |
|
585 |
|
586 - |
|
587 + |
|
588 memset(&globbuf, 0, sizeof(glob_t)); |
|
589 globbuf.gl_offs = 0; |
|
590 if (0 != (ret = glob(pattern, flags & GLOB_FLAGMASK, NULL, &globbuf))) { |
|
591 @@ -477,7 +477,7 @@ PHP_FUNCTION(glob) |
|
592 /* Some glob implementation simply return no data if no matches |
|
593 were found, others return the GLOB_NOMATCH error code. |
|
594 We don't want to treat GLOB_NOMATCH as an error condition |
|
595 - so that PHP glob() behaves the same on both types of |
|
596 + so that PHP glob() behaves the same on both types of |
|
597 implementations and so that 'foreach (glob() as ...' |
|
598 can be used for simple glob() calls without further error |
|
599 checking. |
|
600 @@ -517,11 +517,11 @@ no_results: |
|
601 } |
|
602 /* we need to do this everytime since GLOB_ONLYDIR does not guarantee that |
|
603 * all directories will be filtered. GNU libc documentation states the |
|
604 - * following: |
|
605 - * If the information about the type of the file is easily available |
|
606 - * non-directories will be rejected but no extra work will be done to |
|
607 - * determine the information for each file. I.e., the caller must still be |
|
608 - * able to filter directories out. |
|
609 + * following: |
|
610 + * If the information about the type of the file is easily available |
|
611 + * non-directories will be rejected but no extra work will be done to |
|
612 + * determine the information for each file. I.e., the caller must still be |
|
613 + * able to filter directories out. |
|
614 */ |
|
615 if (flags & GLOB_ONLYDIR) { |
|
616 struct stat s; |
|
617 @@ -545,7 +545,7 @@ no_results: |
|
618 } |
|
619 } |
|
620 /* }}} */ |
|
621 -#endif |
|
622 +#endif |
|
623 |
|
624 /* {{{ proto array scandir(string dir [, int sorting_order [, resource context]]) |
|
625 List files & directories inside the specified path */ |
|
626 @@ -583,7 +583,7 @@ PHP_FUNCTION(scandir) |
|
627 php_error_docref(NULL TSRMLS_CC, E_WARNING, "(errno %d): %s", errno, strerror(errno)); |
|
628 RETURN_FALSE; |
|
629 } |
|
630 - |
|
631 + |
|
632 array_init(return_value); |
|
633 |
|
634 for (i = 0; i < n; i++) { |
|
635 diff --git a/ext/standard/file.c b/ext/standard/file.c |
|
636 index c2e71d1..0abc022 100644 |
|
637 --- a/ext/standard/file.c |
|
638 +++ b/ext/standard/file.c |
|
639 @@ -814,7 +814,7 @@ PHP_FUNCTION(tempnam) |
|
640 char *p; |
|
641 int fd; |
|
642 |
|
643 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &dir, &dir_len, &prefix, &prefix_len) == FAILURE) { |
|
644 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &dir, &dir_len, &prefix, &prefix_len) == FAILURE) { |
|
645 return; |
|
646 } |
|
647 |
|
648 @@ -1343,7 +1343,7 @@ PHP_FUNCTION(rmdir) |
|
649 zval *zcontext = NULL; |
|
650 php_stream_context *context; |
|
651 |
|
652 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &dir, &dir_len, &zcontext) == FAILURE) { |
|
653 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|r", &dir, &dir_len, &zcontext) == FAILURE) { |
|
654 RETURN_FALSE; |
|
655 } |
|
656 |
|
657 -- |
|
658 2.1.4 |
|
659 |