xref: /PHP-7.0/ext/standard/basic_functions.c (revision 81b2533a)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2017 The PHP Group                                |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 3.01 of the PHP license,      |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.php.net/license/3_01.txt                                  |
11    | If you did not receive a copy of the PHP license and are unable to   |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@php.net so we can mail you a copy immediately.               |
14    +----------------------------------------------------------------------+
15    | Authors: Andi Gutmans <andi@zend.com>                                |
16    |          Zeev Suraski <zeev@zend.com>                                |
17    +----------------------------------------------------------------------+
18  */
19 
20 /* $Id$ */
21 
22 #include "php.h"
23 #include "php_streams.h"
24 #include "php_main.h"
25 #include "php_globals.h"
26 #include "php_ini.h"
27 #include "php_standard.h"
28 #include "php_math.h"
29 #include "php_http.h"
30 #include "php_incomplete_class.h"
31 #include "php_getopt.h"
32 #include "ext/standard/info.h"
33 #include "ext/session/php_session.h"
34 #include "zend_operators.h"
35 #include "ext/standard/php_dns.h"
36 #include "ext/standard/php_uuencode.h"
37 
38 #ifdef PHP_WIN32
39 #include "win32/php_win32_globals.h"
40 #include "win32/time.h"
41 #endif
42 
43 typedef struct yy_buffer_state *YY_BUFFER_STATE;
44 
45 #include "zend.h"
46 #include "zend_ini_scanner.h"
47 #include "zend_language_scanner.h"
48 #include <zend_language_parser.h>
49 
50 #include <stdarg.h>
51 #include <stdlib.h>
52 #include <math.h>
53 #include <time.h>
54 #include <stdio.h>
55 
56 #ifndef PHP_WIN32
57 #include <sys/types.h>
58 #include <sys/stat.h>
59 #endif
60 
61 #ifdef NETWARE
62 #include <netinet/in.h>
63 #endif
64 
65 #ifndef PHP_WIN32
66 # include <netdb.h>
67 #else
68 #include "win32/inet.h"
69 #endif
70 
71 #if HAVE_ARPA_INET_H
72 # include <arpa/inet.h>
73 #endif
74 
75 #if HAVE_UNISTD_H
76 # include <unistd.h>
77 #endif
78 
79 #if HAVE_STRING_H
80 # include <string.h>
81 #else
82 # include <strings.h>
83 #endif
84 
85 #if HAVE_LOCALE_H
86 # include <locale.h>
87 #endif
88 
89 #if HAVE_SYS_MMAN_H
90 # include <sys/mman.h>
91 #endif
92 
93 #if HAVE_SYS_LOADAVG_H
94 # include <sys/loadavg.h>
95 #endif
96 
97 #ifdef PHP_WIN32
98 # include "win32/unistd.h"
99 #endif
100 
101 #ifndef INADDR_NONE
102 #define INADDR_NONE ((zend_ulong) -1)
103 #endif
104 
105 #include "zend_globals.h"
106 #include "php_globals.h"
107 #include "SAPI.h"
108 #include "php_ticks.h"
109 
110 #ifdef ZTS
111 PHPAPI int basic_globals_id;
112 #else
113 PHPAPI php_basic_globals basic_globals;
114 #endif
115 
116 #include "php_fopen_wrappers.h"
117 #include "streamsfuncs.h"
118 
119 static zend_class_entry *incomplete_class_entry = NULL;
120 
121 typedef struct _user_tick_function_entry {
122 	zval *arguments;
123 	int arg_count;
124 	int calling;
125 } user_tick_function_entry;
126 
127 /* some prototypes for local functions */
128 static void user_shutdown_function_dtor(zval *zv);
129 static void user_tick_function_dtor(user_tick_function_entry *tick_function_entry);
130 
131 static HashTable basic_submodules;
132 
133 #undef sprintf
134 
135 /* {{{ arginfo */
136 /* {{{ main/main.c */
137 ZEND_BEGIN_ARG_INFO(arginfo_set_time_limit, 0)
138 	ZEND_ARG_INFO(0, seconds)
139 ZEND_END_ARG_INFO()
140 /* }}} */
141 
142 /* {{{ main/sapi.c */
143 ZEND_BEGIN_ARG_INFO(arginfo_header_register_callback, 0)
144 	ZEND_ARG_INFO(0, callback)
145 ZEND_END_ARG_INFO()
146 /* }}} */
147 
148 /* {{{ main/output.c */
149 ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_start, 0, 0, 0)
150 	ZEND_ARG_INFO(0, user_function)
151 	ZEND_ARG_INFO(0, chunk_size)
152 	ZEND_ARG_INFO(0, flags)
153 ZEND_END_ARG_INFO()
154 
155 ZEND_BEGIN_ARG_INFO(arginfo_ob_flush, 0)
156 ZEND_END_ARG_INFO()
157 
158 ZEND_BEGIN_ARG_INFO(arginfo_ob_clean, 0)
159 ZEND_END_ARG_INFO()
160 
161 ZEND_BEGIN_ARG_INFO(arginfo_ob_end_flush, 0)
162 ZEND_END_ARG_INFO()
163 
164 ZEND_BEGIN_ARG_INFO(arginfo_ob_end_clean, 0)
165 ZEND_END_ARG_INFO()
166 
167 ZEND_BEGIN_ARG_INFO(arginfo_ob_get_flush, 0)
168 ZEND_END_ARG_INFO()
169 
170 ZEND_BEGIN_ARG_INFO(arginfo_ob_get_clean, 0)
171 ZEND_END_ARG_INFO()
172 
173 ZEND_BEGIN_ARG_INFO(arginfo_ob_get_contents, 0)
174 ZEND_END_ARG_INFO()
175 
176 ZEND_BEGIN_ARG_INFO(arginfo_ob_get_level, 0)
177 ZEND_END_ARG_INFO()
178 
179 ZEND_BEGIN_ARG_INFO(arginfo_ob_get_length, 0)
180 ZEND_END_ARG_INFO()
181 
182 ZEND_BEGIN_ARG_INFO(arginfo_ob_list_handlers, 0)
183 ZEND_END_ARG_INFO()
184 
185 ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_get_status, 0, 0, 0)
186 	ZEND_ARG_INFO(0, full_status)
187 ZEND_END_ARG_INFO()
188 
189 ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_implicit_flush, 0, 0, 0)
190 	ZEND_ARG_INFO(0, flag)
191 ZEND_END_ARG_INFO()
192 
193 ZEND_BEGIN_ARG_INFO(arginfo_output_reset_rewrite_vars, 0)
194 ZEND_END_ARG_INFO()
195 
196 ZEND_BEGIN_ARG_INFO(arginfo_output_add_rewrite_var, 0)
197 	ZEND_ARG_INFO(0, name)
198 	ZEND_ARG_INFO(0, value)
199 ZEND_END_ARG_INFO()
200 /* }}} */
201 /* {{{ main/streams/userspace.c */
202 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_wrapper_register, 0, 0, 2)
203 	ZEND_ARG_INFO(0, protocol)
204 	ZEND_ARG_INFO(0, classname)
205 	ZEND_ARG_INFO(0, flags)
206 ZEND_END_ARG_INFO()
207 
208 ZEND_BEGIN_ARG_INFO(arginfo_stream_wrapper_unregister, 0)
209 	ZEND_ARG_INFO(0, protocol)
210 ZEND_END_ARG_INFO()
211 
212 ZEND_BEGIN_ARG_INFO(arginfo_stream_wrapper_restore, 0)
213 	ZEND_ARG_INFO(0, protocol)
214 ZEND_END_ARG_INFO()
215 /* }}} */
216 /* {{{ array.c */
217 ZEND_BEGIN_ARG_INFO_EX(arginfo_krsort, 0, 0, 1)
218 	ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
219 	ZEND_ARG_INFO(0, sort_flags)
220 ZEND_END_ARG_INFO()
221 
222 ZEND_BEGIN_ARG_INFO_EX(arginfo_ksort, 0, 0, 1)
223 	ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
224 	ZEND_ARG_INFO(0, sort_flags)
225 ZEND_END_ARG_INFO()
226 
227 ZEND_BEGIN_ARG_INFO_EX(arginfo_count, 0, 0, 1)
228 	ZEND_ARG_INFO(0, var)
229 	ZEND_ARG_INFO(0, mode)
230 ZEND_END_ARG_INFO()
231 
232 ZEND_BEGIN_ARG_INFO(arginfo_natsort, 0)
233 	ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
234 ZEND_END_ARG_INFO()
235 
236 ZEND_BEGIN_ARG_INFO(arginfo_natcasesort, 0)
237 	ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
238 ZEND_END_ARG_INFO()
239 
240 ZEND_BEGIN_ARG_INFO_EX(arginfo_asort, 0, 0, 1)
241 	ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
242 	ZEND_ARG_INFO(0, sort_flags)
243 ZEND_END_ARG_INFO()
244 
245 ZEND_BEGIN_ARG_INFO_EX(arginfo_arsort, 0, 0, 1)
246 	ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
247 	ZEND_ARG_INFO(0, sort_flags)
248 ZEND_END_ARG_INFO()
249 
250 ZEND_BEGIN_ARG_INFO_EX(arginfo_sort, 0, 0, 1)
251 	ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
252 	ZEND_ARG_INFO(0, sort_flags)
253 ZEND_END_ARG_INFO()
254 
255 ZEND_BEGIN_ARG_INFO_EX(arginfo_rsort, 0, 0, 1)
256 	ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
257 	ZEND_ARG_INFO(0, sort_flags)
258 ZEND_END_ARG_INFO()
259 
260 ZEND_BEGIN_ARG_INFO(arginfo_usort, 0)
261 	ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
262 	ZEND_ARG_INFO(0, cmp_function)
263 ZEND_END_ARG_INFO()
264 
265 ZEND_BEGIN_ARG_INFO(arginfo_uasort, 0)
266 	ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
267 	ZEND_ARG_INFO(0, cmp_function)
268 ZEND_END_ARG_INFO()
269 
270 ZEND_BEGIN_ARG_INFO(arginfo_uksort, 0)
271 	ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
272 	ZEND_ARG_INFO(0, cmp_function)
273 ZEND_END_ARG_INFO()
274 
275 ZEND_BEGIN_ARG_INFO(arginfo_end, 0)
276 	ZEND_ARG_INFO(1, arg)
277 ZEND_END_ARG_INFO()
278 
279 ZEND_BEGIN_ARG_INFO(arginfo_prev, 0)
280 	ZEND_ARG_INFO(1, arg)
281 ZEND_END_ARG_INFO()
282 
283 ZEND_BEGIN_ARG_INFO(arginfo_next, 0)
284 	ZEND_ARG_INFO(1, arg)
285 ZEND_END_ARG_INFO()
286 
287 ZEND_BEGIN_ARG_INFO(arginfo_reset, 0)
288 	ZEND_ARG_INFO(1, arg)
289 ZEND_END_ARG_INFO()
290 
291 ZEND_BEGIN_ARG_INFO(arginfo_current, 0)
292 	ZEND_ARG_INFO(0, arg)
293 ZEND_END_ARG_INFO()
294 
295 ZEND_BEGIN_ARG_INFO(arginfo_key, 0)
296 	ZEND_ARG_INFO(0, arg)
297 ZEND_END_ARG_INFO()
298 
299 ZEND_BEGIN_ARG_INFO_EX(arginfo_min, 0, 0, 1)
300 	ZEND_ARG_VARIADIC_INFO(0, args)
301 ZEND_END_ARG_INFO()
302 
303 ZEND_BEGIN_ARG_INFO_EX(arginfo_max, 0, 0, 1)
304 	ZEND_ARG_VARIADIC_INFO(0, args)
305 ZEND_END_ARG_INFO()
306 
307 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_walk, 0, 0, 2)
308 	ZEND_ARG_INFO(1, input) /* ARRAY_INFO(1, arg, 0) */
309 	ZEND_ARG_INFO(0, funcname)
310 	ZEND_ARG_INFO(0, userdata)
311 ZEND_END_ARG_INFO()
312 
313 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_walk_recursive, 0, 0, 2)
314 	ZEND_ARG_INFO(1, input) /* ARRAY_INFO(1, arg, 0) */
315 	ZEND_ARG_INFO(0, funcname)
316 	ZEND_ARG_INFO(0, userdata)
317 ZEND_END_ARG_INFO()
318 
319 ZEND_BEGIN_ARG_INFO_EX(arginfo_in_array, 0, 0, 2)
320 	ZEND_ARG_INFO(0, needle)
321 	ZEND_ARG_INFO(0, haystack) /* ARRAY_INFO(0, haystack, 0) */
322 	ZEND_ARG_INFO(0, strict)
323 ZEND_END_ARG_INFO()
324 
325 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_search, 0, 0, 2)
326 	ZEND_ARG_INFO(0, needle)
327 	ZEND_ARG_INFO(0, haystack) /* ARRAY_INFO(0, haystack, 0) */
328 	ZEND_ARG_INFO(0, strict)
329 ZEND_END_ARG_INFO()
330 
331 ZEND_BEGIN_ARG_INFO_EX(arginfo_extract, 0, 0, 1)
332 	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arg) /* ARRAY_INFO(0, arg, 0) */
333 	ZEND_ARG_INFO(0, extract_type)
334 	ZEND_ARG_INFO(0, prefix)
335 ZEND_END_ARG_INFO()
336 
337 ZEND_BEGIN_ARG_INFO_EX(arginfo_compact, 0, 0, 1)
338 	ZEND_ARG_VARIADIC_INFO(0, var_names)
339 ZEND_END_ARG_INFO()
340 
341 ZEND_BEGIN_ARG_INFO(arginfo_array_fill, 0)
342 	ZEND_ARG_INFO(0, start_key)
343 	ZEND_ARG_INFO(0, num)
344 	ZEND_ARG_INFO(0, val)
345 ZEND_END_ARG_INFO()
346 
347 ZEND_BEGIN_ARG_INFO(arginfo_array_fill_keys, 0)
348 	ZEND_ARG_INFO(0, keys) /* ARRAY_INFO(0, keys, 0) */
349 	ZEND_ARG_INFO(0, val)
350 ZEND_END_ARG_INFO()
351 
352 ZEND_BEGIN_ARG_INFO_EX(arginfo_range, 0, 0, 2)
353 	ZEND_ARG_INFO(0, low)
354 	ZEND_ARG_INFO(0, high)
355 	ZEND_ARG_INFO(0, step)
356 ZEND_END_ARG_INFO()
357 
358 ZEND_BEGIN_ARG_INFO(arginfo_shuffle, 0)
359 	ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
360 ZEND_END_ARG_INFO()
361 
362 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_push, 0, 0, 2)
363 	ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */
364 	ZEND_ARG_VARIADIC_INFO(0, vars)
365 ZEND_END_ARG_INFO()
366 
367 ZEND_BEGIN_ARG_INFO(arginfo_array_pop, 0)
368 	ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */
369 ZEND_END_ARG_INFO()
370 
371 ZEND_BEGIN_ARG_INFO(arginfo_array_shift, 0)
372 	ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */
373 ZEND_END_ARG_INFO()
374 
375 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_unshift, 0, 0, 2)
376 	ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */
377 	ZEND_ARG_VARIADIC_INFO(0, vars)
378 ZEND_END_ARG_INFO()
379 
380 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_splice, 0, 0, 2)
381 	ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
382 	ZEND_ARG_INFO(0, offset)
383 	ZEND_ARG_INFO(0, length)
384 	ZEND_ARG_INFO(0, replacement) /* ARRAY_INFO(0, arg, 1) */
385 ZEND_END_ARG_INFO()
386 
387 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_slice, 0, 0, 2)
388 	ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(1, arg, 0) */
389 	ZEND_ARG_INFO(0, offset)
390 	ZEND_ARG_INFO(0, length)
391 	ZEND_ARG_INFO(0, preserve_keys)
392 ZEND_END_ARG_INFO()
393 
394 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_merge, 0, 0, 2)
395 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */
396 	ZEND_ARG_VARIADIC_INFO(0, arrays)
397 ZEND_END_ARG_INFO()
398 
399 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_merge_recursive, 0, 0, 2)
400 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */
401 	ZEND_ARG_VARIADIC_INFO(0, arrays)
402 ZEND_END_ARG_INFO()
403 
404 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_replace, 0, 0, 2)
405 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */
406 	ZEND_ARG_VARIADIC_INFO(0, arrays)
407 ZEND_END_ARG_INFO()
408 
409 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_replace_recursive, 0, 0, 2)
410 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */
411 	ZEND_ARG_VARIADIC_INFO(0, arrays)
412 ZEND_END_ARG_INFO()
413 
414 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_keys, 0, 0, 1)
415 	ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
416 	ZEND_ARG_INFO(0, search_value)
417 	ZEND_ARG_INFO(0, strict)
418 ZEND_END_ARG_INFO()
419 
420 ZEND_BEGIN_ARG_INFO(arginfo_array_values, 0)
421 	ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
422 ZEND_END_ARG_INFO()
423 
424 ZEND_BEGIN_ARG_INFO(arginfo_array_count_values, 0)
425 	ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
426 ZEND_END_ARG_INFO()
427 
428 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_column, 0, 0, 2)
429 	ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
430 	ZEND_ARG_INFO(0, column_key)
431 	ZEND_ARG_INFO(0, index_key)
432 ZEND_END_ARG_INFO()
433 
434 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reverse, 0, 0, 1)
435 	ZEND_ARG_INFO(0, input) /* ARRAY_INFO(0, arg, 0) */
436 	ZEND_ARG_INFO(0, preserve_keys)
437 ZEND_END_ARG_INFO()
438 
439 ZEND_BEGIN_ARG_INFO(arginfo_array_pad, 0)
440 	ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
441 	ZEND_ARG_INFO(0, pad_size)
442 	ZEND_ARG_INFO(0, pad_value)
443 ZEND_END_ARG_INFO()
444 
445 ZEND_BEGIN_ARG_INFO(arginfo_array_flip, 0)
446 	ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
447 ZEND_END_ARG_INFO()
448 
449 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_change_key_case, 0, 0, 1)
450 	ZEND_ARG_INFO(0, input) /* ARRAY_INFO(0, arg, 0) */
451 	ZEND_ARG_INFO(0, case)
452 ZEND_END_ARG_INFO()
453 
454 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_unique, 0, 0, 1)
455 	ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
456 	ZEND_ARG_INFO(0, flags)
457 ZEND_END_ARG_INFO()
458 
459 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect_key, 0, 0, 2)
460 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
461 	ZEND_ARG_VARIADIC_INFO(0, arrays)
462 ZEND_END_ARG_INFO()
463 
464 ZEND_BEGIN_ARG_INFO(arginfo_array_intersect_ukey, 0)
465 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
466 	ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
467 	ZEND_ARG_INFO(0, callback_key_compare_func)
468 ZEND_END_ARG_INFO()
469 
470 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect, 0, 0, 2)
471 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
472 	ZEND_ARG_VARIADIC_INFO(0, arrays)
473 ZEND_END_ARG_INFO()
474 
475 ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect, 0)
476 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
477 	ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
478 	ZEND_ARG_INFO(0, callback_data_compare_func)
479 ZEND_END_ARG_INFO()
480 
481 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect_assoc, 0, 0, 2)
482 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
483 	ZEND_ARG_VARIADIC_INFO(0, arrays)
484 ZEND_END_ARG_INFO()
485 
486 ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect_assoc, 0)
487 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
488 	ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
489 	ZEND_ARG_INFO(0, callback_data_compare_func)
490 ZEND_END_ARG_INFO()
491 
492 ZEND_BEGIN_ARG_INFO(arginfo_array_intersect_uassoc, 0)
493 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
494 	ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
495 	ZEND_ARG_INFO(0, callback_key_compare_func)
496 ZEND_END_ARG_INFO()
497 
498 ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect_uassoc, 0)
499 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
500 	ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
501 	ZEND_ARG_INFO(0, callback_data_compare_func)
502 	ZEND_ARG_INFO(0, callback_key_compare_func)
503 ZEND_END_ARG_INFO()
504 
505 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff_key, 0, 0, 2)
506 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
507 	ZEND_ARG_VARIADIC_INFO(0, arrays)
508 ZEND_END_ARG_INFO()
509 
510 ZEND_BEGIN_ARG_INFO(arginfo_array_diff_ukey, 0)
511 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
512 	ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
513 	ZEND_ARG_INFO(0, callback_key_comp_func)
514 ZEND_END_ARG_INFO()
515 
516 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff, 0, 0, 2)
517 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
518 	ZEND_ARG_VARIADIC_INFO(0, arrays)
519 ZEND_END_ARG_INFO()
520 
521 ZEND_BEGIN_ARG_INFO(arginfo_array_udiff, 0)
522 	ZEND_ARG_INFO(0, arr1)
523 	ZEND_ARG_INFO(0, arr2)
524 	ZEND_ARG_INFO(0, callback_data_comp_func)
525 ZEND_END_ARG_INFO()
526 
527 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff_assoc, 0, 0, 2)
528 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
529 	ZEND_ARG_VARIADIC_INFO(0, arrays)
530 ZEND_END_ARG_INFO()
531 
532 ZEND_BEGIN_ARG_INFO(arginfo_array_diff_uassoc, 0)
533 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
534 	ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
535 	ZEND_ARG_INFO(0, callback_data_comp_func)
536 ZEND_END_ARG_INFO()
537 
538 ZEND_BEGIN_ARG_INFO(arginfo_array_udiff_assoc, 0)
539 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
540 	ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
541 	ZEND_ARG_INFO(0, callback_key_comp_func)
542 ZEND_END_ARG_INFO()
543 
544 ZEND_BEGIN_ARG_INFO(arginfo_array_udiff_uassoc, 0)
545 	ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
546 	ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
547 	ZEND_ARG_INFO(0, callback_data_comp_func)
548 	ZEND_ARG_INFO(0, callback_key_comp_func)
549 ZEND_END_ARG_INFO()
550 
551 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_multisort, 0, 0, 1)
552 	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr1) /* ARRAY_INFO(0, arg1, 0) */
553 	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_order)
554 	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_flags)
555 	ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, arr2)
556 ZEND_END_ARG_INFO()
557 
558 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_rand, 0, 0, 1)
559 	ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
560 	ZEND_ARG_INFO(0, num_req)
561 ZEND_END_ARG_INFO()
562 
563 ZEND_BEGIN_ARG_INFO(arginfo_array_sum, 0)
564 	ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
565 ZEND_END_ARG_INFO()
566 
567 ZEND_BEGIN_ARG_INFO(arginfo_array_product, 0)
568 	ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
569 ZEND_END_ARG_INFO()
570 
571 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reduce, 0, 0, 2)
572 	ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
573 	ZEND_ARG_INFO(0, callback)
574 	ZEND_ARG_INFO(0, initial)
575 ZEND_END_ARG_INFO()
576 
577 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_filter, 0, 0, 1)
578 	ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
579 	ZEND_ARG_INFO(0, callback)
580     ZEND_ARG_INFO(0, use_keys)
581 ZEND_END_ARG_INFO()
582 
583 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_map, 0, 0, 2)
584 	ZEND_ARG_INFO(0, callback)
585 	ZEND_ARG_VARIADIC_INFO(0, arrays)
586 ZEND_END_ARG_INFO()
587 
588 ZEND_BEGIN_ARG_INFO(arginfo_array_key_exists, 0)
589 	ZEND_ARG_INFO(0, key)
590 	ZEND_ARG_INFO(0, search)
591 ZEND_END_ARG_INFO()
592 
593 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_chunk, 0, 0, 2)
594 	ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
595 	ZEND_ARG_INFO(0, size)
596 	ZEND_ARG_INFO(0, preserve_keys)
597 ZEND_END_ARG_INFO()
598 
599 ZEND_BEGIN_ARG_INFO(arginfo_array_combine, 0)
600 	ZEND_ARG_INFO(0, keys)   /* ARRAY_INFO(0, keys, 0) */
601 	ZEND_ARG_INFO(0, values) /* ARRAY_INFO(0, values, 0) */
602 ZEND_END_ARG_INFO()
603 /* }}} */
604 /* {{{ basic_functions.c */
605 ZEND_BEGIN_ARG_INFO(arginfo_get_magic_quotes_gpc, 0)
606 ZEND_END_ARG_INFO()
607 
608 ZEND_BEGIN_ARG_INFO(arginfo_get_magic_quotes_runtime, 0)
609 ZEND_END_ARG_INFO()
610 
611 ZEND_BEGIN_ARG_INFO(arginfo_constant, 0)
612 	ZEND_ARG_INFO(0, const_name)
613 ZEND_END_ARG_INFO()
614 
615 #ifdef HAVE_INET_NTOP
616 ZEND_BEGIN_ARG_INFO(arginfo_inet_ntop, 0)
617 	ZEND_ARG_INFO(0, in_addr)
618 ZEND_END_ARG_INFO()
619 #endif
620 
621 #ifdef HAVE_INET_PTON
622 ZEND_BEGIN_ARG_INFO(arginfo_inet_pton, 0)
623 	ZEND_ARG_INFO(0, ip_address)
624 ZEND_END_ARG_INFO()
625 #endif
626 
627 ZEND_BEGIN_ARG_INFO(arginfo_ip2long, 0)
628 	ZEND_ARG_INFO(0, ip_address)
629 ZEND_END_ARG_INFO()
630 
631 ZEND_BEGIN_ARG_INFO(arginfo_long2ip, 0)
632 	ZEND_ARG_INFO(0, proper_address)
633 ZEND_END_ARG_INFO()
634 
635 ZEND_BEGIN_ARG_INFO_EX(arginfo_getenv, 0, 0, 1)
636 	ZEND_ARG_INFO(0, varname)
637 	ZEND_ARG_INFO(0, local_only)
638 ZEND_END_ARG_INFO()
639 
640 #ifdef HAVE_PUTENV
641 ZEND_BEGIN_ARG_INFO(arginfo_putenv, 0)
642 	ZEND_ARG_INFO(0, setting)
643 ZEND_END_ARG_INFO()
644 #endif
645 
646 ZEND_BEGIN_ARG_INFO_EX(arginfo_getopt, 0, 0, 1)
647 	ZEND_ARG_INFO(0, options)
648 	ZEND_ARG_INFO(0, opts) /* ARRAY_INFO(0, opts, 1) */
649 ZEND_END_ARG_INFO()
650 
651 ZEND_BEGIN_ARG_INFO(arginfo_flush, 0)
652 ZEND_END_ARG_INFO()
653 
654 ZEND_BEGIN_ARG_INFO(arginfo_sleep, 0)
655 	ZEND_ARG_INFO(0, seconds)
656 ZEND_END_ARG_INFO()
657 
658 ZEND_BEGIN_ARG_INFO(arginfo_usleep, 0)
659 	ZEND_ARG_INFO(0, micro_seconds)
660 ZEND_END_ARG_INFO()
661 
662 #if HAVE_NANOSLEEP
663 ZEND_BEGIN_ARG_INFO(arginfo_time_nanosleep, 0)
664 	ZEND_ARG_INFO(0, seconds)
665 	ZEND_ARG_INFO(0, nanoseconds)
666 ZEND_END_ARG_INFO()
667 
668 ZEND_BEGIN_ARG_INFO(arginfo_time_sleep_until, 0)
669 	ZEND_ARG_INFO(0, timestamp)
670 ZEND_END_ARG_INFO()
671 #endif
672 
673 ZEND_BEGIN_ARG_INFO(arginfo_get_current_user, 0)
674 ZEND_END_ARG_INFO()
675 
676 ZEND_BEGIN_ARG_INFO(arginfo_get_cfg_var, 0)
677 	ZEND_ARG_INFO(0, option_name)
678 ZEND_END_ARG_INFO()
679 
680 ZEND_BEGIN_ARG_INFO_EX(arginfo_error_log, 0, 0, 1)
681 	ZEND_ARG_INFO(0, message)
682 	ZEND_ARG_INFO(0, message_type)
683 	ZEND_ARG_INFO(0, destination)
684 	ZEND_ARG_INFO(0, extra_headers)
685 ZEND_END_ARG_INFO()
686 
687 ZEND_BEGIN_ARG_INFO_EX(arginfo_error_get_last, 0, 0, 0)
688 ZEND_END_ARG_INFO()
689 
690 ZEND_BEGIN_ARG_INFO_EX(arginfo_error_clear_last, 0, 0, 0)
691 ZEND_END_ARG_INFO()
692 
693 ZEND_BEGIN_ARG_INFO_EX(arginfo_call_user_func, 0, 0, 1)
694 	ZEND_ARG_INFO(0, function_name)
695 	ZEND_ARG_VARIADIC_INFO(0, parameters)
696 ZEND_END_ARG_INFO()
697 
698 ZEND_BEGIN_ARG_INFO_EX(arginfo_call_user_func_array, 0, 0, 2)
699 	ZEND_ARG_INFO(0, function_name)
700 	ZEND_ARG_INFO(0, parameters) /* ARRAY_INFO(0, parameters, 1) */
701 ZEND_END_ARG_INFO()
702 
703 ZEND_BEGIN_ARG_INFO_EX(arginfo_forward_static_call, 0, 0, 1)
704 	ZEND_ARG_INFO(0, function_name)
705 	ZEND_ARG_VARIADIC_INFO(0, parameters)
706 ZEND_END_ARG_INFO()
707 
708 ZEND_BEGIN_ARG_INFO_EX(arginfo_forward_static_call_array, 0, 0, 2)
709 	ZEND_ARG_INFO(0, function_name)
710 	ZEND_ARG_INFO(0, parameters) /* ARRAY_INFO(0, parameters, 1) */
711 ZEND_END_ARG_INFO()
712 
713 ZEND_BEGIN_ARG_INFO_EX(arginfo_register_shutdown_function, 0, 0, 1)
714 	ZEND_ARG_INFO(0, function_name)
715 	ZEND_ARG_VARIADIC_INFO(0, parameters)
716 ZEND_END_ARG_INFO()
717 
718 ZEND_BEGIN_ARG_INFO_EX(arginfo_highlight_file, 0, 0, 1)
719 	ZEND_ARG_INFO(0, file_name)
720 	ZEND_ARG_INFO(0, return)
721 ZEND_END_ARG_INFO()
722 
723 ZEND_BEGIN_ARG_INFO(arginfo_php_strip_whitespace, 0)
724 	ZEND_ARG_INFO(0, file_name)
725 ZEND_END_ARG_INFO()
726 
727 ZEND_BEGIN_ARG_INFO_EX(arginfo_highlight_string, 0, 0, 1)
728 	ZEND_ARG_INFO(0, string)
729 	ZEND_ARG_INFO(0, return)
730 ZEND_END_ARG_INFO()
731 
732 ZEND_BEGIN_ARG_INFO(arginfo_ini_get, 0)
733 	ZEND_ARG_INFO(0, varname)
734 ZEND_END_ARG_INFO()
735 
736 ZEND_BEGIN_ARG_INFO_EX(arginfo_ini_get_all, 0, 0, 0)
737 	ZEND_ARG_INFO(0, extension)
738 	ZEND_ARG_INFO(0, details)
739 ZEND_END_ARG_INFO()
740 
741 ZEND_BEGIN_ARG_INFO(arginfo_ini_set, 0)
742 	ZEND_ARG_INFO(0, varname)
743 	ZEND_ARG_INFO(0, newvalue)
744 ZEND_END_ARG_INFO()
745 
746 ZEND_BEGIN_ARG_INFO(arginfo_ini_restore, 0)
747 	ZEND_ARG_INFO(0, varname)
748 ZEND_END_ARG_INFO()
749 
750 ZEND_BEGIN_ARG_INFO(arginfo_set_include_path, 0)
751 	ZEND_ARG_INFO(0, new_include_path)
752 ZEND_END_ARG_INFO()
753 
754 ZEND_BEGIN_ARG_INFO(arginfo_get_include_path, 0)
755 ZEND_END_ARG_INFO()
756 
757 ZEND_BEGIN_ARG_INFO(arginfo_restore_include_path, 0)
758 ZEND_END_ARG_INFO()
759 
760 ZEND_BEGIN_ARG_INFO_EX(arginfo_print_r, 0, 0, 1)
761 	ZEND_ARG_INFO(0, var)
762 	ZEND_ARG_INFO(0, return)
763 ZEND_END_ARG_INFO()
764 
765 ZEND_BEGIN_ARG_INFO(arginfo_connection_aborted, 0)
766 ZEND_END_ARG_INFO()
767 
768 ZEND_BEGIN_ARG_INFO(arginfo_connection_status, 0)
769 ZEND_END_ARG_INFO()
770 
771 ZEND_BEGIN_ARG_INFO_EX(arginfo_ignore_user_abort, 0, 0, 0)
772 	ZEND_ARG_INFO(0, value)
773 ZEND_END_ARG_INFO()
774 
775 #if HAVE_GETSERVBYNAME
776 ZEND_BEGIN_ARG_INFO(arginfo_getservbyname, 0)
777 	ZEND_ARG_INFO(0, service)
778 	ZEND_ARG_INFO(0, protocol)
779 ZEND_END_ARG_INFO()
780 #endif
781 
782 #if HAVE_GETSERVBYPORT
783 ZEND_BEGIN_ARG_INFO(arginfo_getservbyport, 0)
784 	ZEND_ARG_INFO(0, port)
785 	ZEND_ARG_INFO(0, protocol)
786 ZEND_END_ARG_INFO()
787 #endif
788 
789 #if HAVE_GETPROTOBYNAME
790 ZEND_BEGIN_ARG_INFO(arginfo_getprotobyname, 0)
791 	ZEND_ARG_INFO(0, name)
792 ZEND_END_ARG_INFO()
793 #endif
794 
795 #if HAVE_GETPROTOBYNUMBER
796 ZEND_BEGIN_ARG_INFO(arginfo_getprotobynumber, 0)
797 	ZEND_ARG_INFO(0, proto)
798 ZEND_END_ARG_INFO()
799 #endif
800 
801 ZEND_BEGIN_ARG_INFO_EX(arginfo_register_tick_function, 0, 0, 1)
802 	ZEND_ARG_INFO(0, function_name)
803 	ZEND_ARG_VARIADIC_INFO(0, parameters)
804 ZEND_END_ARG_INFO()
805 
806 ZEND_BEGIN_ARG_INFO(arginfo_unregister_tick_function, 0)
807 	ZEND_ARG_INFO(0, function_name)
808 ZEND_END_ARG_INFO()
809 
810 ZEND_BEGIN_ARG_INFO(arginfo_is_uploaded_file, 0)
811 	ZEND_ARG_INFO(0, path)
812 ZEND_END_ARG_INFO()
813 
814 ZEND_BEGIN_ARG_INFO(arginfo_move_uploaded_file, 0)
815 	ZEND_ARG_INFO(0, path)
816 	ZEND_ARG_INFO(0, new_path)
817 ZEND_END_ARG_INFO()
818 
819 ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_ini_file, 0, 0, 1)
820 	ZEND_ARG_INFO(0, filename)
821 	ZEND_ARG_INFO(0, process_sections)
822 	ZEND_ARG_INFO(0, scanner_mode)
823 ZEND_END_ARG_INFO()
824 
825 ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_ini_string, 0, 0, 1)
826     ZEND_ARG_INFO(0, ini_string)
827     ZEND_ARG_INFO(0, process_sections)
828     ZEND_ARG_INFO(0, scanner_mode)
829 ZEND_END_ARG_INFO()
830 
831 #if ZEND_DEBUG
832 ZEND_BEGIN_ARG_INFO(arginfo_config_get_hash, 0)
833 ZEND_END_ARG_INFO()
834 #endif
835 
836 #ifdef HAVE_GETLOADAVG
837 ZEND_BEGIN_ARG_INFO(arginfo_sys_getloadavg, 0)
838 ZEND_END_ARG_INFO()
839 #endif
840 /* }}} */
841 /* {{{ assert.c */
842 ZEND_BEGIN_ARG_INFO_EX(arginfo_assert, 0, 0, 1)
843 	ZEND_ARG_INFO(0, assertion)
844 	ZEND_ARG_INFO(0, description)
845 ZEND_END_ARG_INFO()
846 
847 ZEND_BEGIN_ARG_INFO_EX(arginfo_assert_options, 0, 0, 1)
848 	ZEND_ARG_INFO(0, what)
849 	ZEND_ARG_INFO(0, value)
850 ZEND_END_ARG_INFO()
851 /* }}} */
852 /* {{{ base64.c */
853 ZEND_BEGIN_ARG_INFO(arginfo_base64_encode, 0)
854 	ZEND_ARG_INFO(0, str)
855 ZEND_END_ARG_INFO()
856 
857 ZEND_BEGIN_ARG_INFO_EX(arginfo_base64_decode, 0, 0, 1)
858 	ZEND_ARG_INFO(0, str)
859 	ZEND_ARG_INFO(0, strict)
860 ZEND_END_ARG_INFO()
861 
862 /* }}} */
863 /* {{{ browscap.c */
864 ZEND_BEGIN_ARG_INFO_EX(arginfo_get_browser, 0, 0, 0)
865 	ZEND_ARG_INFO(0, browser_name)
866 	ZEND_ARG_INFO(0, return_array)
867 ZEND_END_ARG_INFO()
868 /* }}} */
869 /* {{{ crc32.c */
870 ZEND_BEGIN_ARG_INFO(arginfo_crc32, 0)
871 	ZEND_ARG_INFO(0, str)
872 ZEND_END_ARG_INFO()
873 
874 /* }}} */
875 /* {{{ crypt.c */
876 #if HAVE_CRYPT
877 ZEND_BEGIN_ARG_INFO_EX(arginfo_crypt, 0, 0, 1)
878 	ZEND_ARG_INFO(0, str)
879 	ZEND_ARG_INFO(0, salt)
880 ZEND_END_ARG_INFO()
881 #endif
882 /* }}} */
883 /* {{{ cyr_convert.c */
884 ZEND_BEGIN_ARG_INFO(arginfo_convert_cyr_string, 0)
885 	ZEND_ARG_INFO(0, str)
886 	ZEND_ARG_INFO(0, from)
887 	ZEND_ARG_INFO(0, to)
888 ZEND_END_ARG_INFO()
889 
890 /* }}} */
891 /* {{{ datetime.c */
892 #if HAVE_STRPTIME
893 ZEND_BEGIN_ARG_INFO(arginfo_strptime, 0)
894 	ZEND_ARG_INFO(0, timestamp)
895 	ZEND_ARG_INFO(0, format)
896 ZEND_END_ARG_INFO()
897 #endif
898 /* }}} */
899 /* {{{ dir.c */
900 ZEND_BEGIN_ARG_INFO_EX(arginfo_opendir, 0, 0, 1)
901 	ZEND_ARG_INFO(0, path)
902 	ZEND_ARG_INFO(0, context)
903 ZEND_END_ARG_INFO()
904 
905 ZEND_BEGIN_ARG_INFO_EX(arginfo_dir, 0, 0, 1)
906 	ZEND_ARG_INFO(0, directory)
907 	ZEND_ARG_INFO(0, context)
908 ZEND_END_ARG_INFO()
909 
910 ZEND_BEGIN_ARG_INFO_EX(arginfo_closedir, 0, 0, 0)
911 	ZEND_ARG_INFO(0, dir_handle)
912 ZEND_END_ARG_INFO()
913 
914 #if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
915 ZEND_BEGIN_ARG_INFO(arginfo_chroot, 0)
916 	ZEND_ARG_INFO(0, directory)
917 ZEND_END_ARG_INFO()
918 #endif
919 
920 ZEND_BEGIN_ARG_INFO(arginfo_chdir, 0)
921 	ZEND_ARG_INFO(0, directory)
922 ZEND_END_ARG_INFO()
923 
924 ZEND_BEGIN_ARG_INFO(arginfo_getcwd, 0)
925 ZEND_END_ARG_INFO()
926 
927 ZEND_BEGIN_ARG_INFO_EX(arginfo_rewinddir, 0, 0, 0)
928 	ZEND_ARG_INFO(0, dir_handle)
929 ZEND_END_ARG_INFO()
930 
931 ZEND_BEGIN_ARG_INFO_EX(arginfo_readdir, 0, 0, 0)
932 	ZEND_ARG_INFO(0, dir_handle)
933 ZEND_END_ARG_INFO()
934 
935 #ifdef HAVE_GLOB
936 ZEND_BEGIN_ARG_INFO_EX(arginfo_glob, 0, 0, 1)
937 	ZEND_ARG_INFO(0, pattern)
938 	ZEND_ARG_INFO(0, flags)
939 ZEND_END_ARG_INFO()
940 #endif
941 
942 ZEND_BEGIN_ARG_INFO_EX(arginfo_scandir, 0, 0, 1)
943 	ZEND_ARG_INFO(0, dir)
944 	ZEND_ARG_INFO(0, sorting_order)
945 	ZEND_ARG_INFO(0, context)
946 ZEND_END_ARG_INFO()
947 /* }}} */
948 /* {{{ dns.c */
949 ZEND_BEGIN_ARG_INFO(arginfo_gethostbyaddr, 0)
950 	ZEND_ARG_INFO(0, ip_address)
951 ZEND_END_ARG_INFO()
952 
953 ZEND_BEGIN_ARG_INFO(arginfo_gethostbyname, 0)
954 	ZEND_ARG_INFO(0, hostname)
955 ZEND_END_ARG_INFO()
956 
957 ZEND_BEGIN_ARG_INFO(arginfo_gethostbynamel, 0)
958 	ZEND_ARG_INFO(0, hostname)
959 ZEND_END_ARG_INFO()
960 
961 #ifdef HAVE_GETHOSTNAME
962 ZEND_BEGIN_ARG_INFO(arginfo_gethostname, 0)
963 ZEND_END_ARG_INFO()
964 #endif
965 
966 #if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE)))
967 ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_check_record, 0, 0, 1)
968 	ZEND_ARG_INFO(0, host)
969 	ZEND_ARG_INFO(0, type)
970 ZEND_END_ARG_INFO()
971 
972 # if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS
973 ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_get_record, 0, 0, 1)
974 	ZEND_ARG_INFO(0, hostname)
975 	ZEND_ARG_INFO(0, type)
976 	ZEND_ARG_ARRAY_INFO(1, authns, 1)
977 	ZEND_ARG_ARRAY_INFO(1, addtl, 1)
978 	ZEND_ARG_INFO(0, raw)
979 ZEND_END_ARG_INFO()
980 
981 ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_get_mx, 0, 0, 2)
982 	ZEND_ARG_INFO(0, hostname)
983 	ZEND_ARG_INFO(1, mxhosts) /* ARRAY_INFO(1, mxhosts, 1) */
984 	ZEND_ARG_INFO(1, weight) /* ARRAY_INFO(1, weight, 1) */
985 ZEND_END_ARG_INFO()
986 # endif
987 
988 #endif /* defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE))) */
989 /* }}} */
990 
991 /* {{{ exec.c */
992 ZEND_BEGIN_ARG_INFO_EX(arginfo_exec, 0, 0, 1)
993 	ZEND_ARG_INFO(0, command)
994 	ZEND_ARG_INFO(1, output) /* ARRAY_INFO(1, output, 1) */
995 	ZEND_ARG_INFO(1, return_value)
996 ZEND_END_ARG_INFO()
997 
998 ZEND_BEGIN_ARG_INFO_EX(arginfo_system, 0, 0, 1)
999 	ZEND_ARG_INFO(0, command)
1000 	ZEND_ARG_INFO(1, return_value)
1001 ZEND_END_ARG_INFO()
1002 
1003 ZEND_BEGIN_ARG_INFO_EX(arginfo_passthru, 0, 0, 1)
1004 	ZEND_ARG_INFO(0, command)
1005 	ZEND_ARG_INFO(1, return_value)
1006 ZEND_END_ARG_INFO()
1007 
1008 ZEND_BEGIN_ARG_INFO(arginfo_escapeshellcmd, 0)
1009 	ZEND_ARG_INFO(0, command)
1010 ZEND_END_ARG_INFO()
1011 
1012 ZEND_BEGIN_ARG_INFO(arginfo_escapeshellarg, 0)
1013 	ZEND_ARG_INFO(0, arg)
1014 ZEND_END_ARG_INFO()
1015 
1016 ZEND_BEGIN_ARG_INFO(arginfo_shell_exec, 0)
1017 	ZEND_ARG_INFO(0, cmd)
1018 ZEND_END_ARG_INFO()
1019 
1020 #ifdef HAVE_NICE
1021 ZEND_BEGIN_ARG_INFO(arginfo_proc_nice, 0)
1022 	ZEND_ARG_INFO(0, priority)
1023 ZEND_END_ARG_INFO()
1024 #endif
1025 /* }}} */
1026 /* {{{ file.c */
1027 ZEND_BEGIN_ARG_INFO_EX(arginfo_flock, 0, 0, 2)
1028 	ZEND_ARG_INFO(0, fp)
1029 	ZEND_ARG_INFO(0, operation)
1030 	ZEND_ARG_INFO(1, wouldblock)
1031 ZEND_END_ARG_INFO()
1032 
1033 ZEND_BEGIN_ARG_INFO_EX(arginfo_get_meta_tags, 0, 0, 1)
1034 	ZEND_ARG_INFO(0, filename)
1035 	ZEND_ARG_INFO(0, use_include_path)
1036 ZEND_END_ARG_INFO()
1037 
1038 ZEND_BEGIN_ARG_INFO_EX(arginfo_file_get_contents, 0, 0, 1)
1039 	ZEND_ARG_INFO(0, filename)
1040 	ZEND_ARG_INFO(0, flags)
1041 	ZEND_ARG_INFO(0, context)
1042 	ZEND_ARG_INFO(0, offset)
1043 	ZEND_ARG_INFO(0, maxlen)
1044 ZEND_END_ARG_INFO()
1045 
1046 ZEND_BEGIN_ARG_INFO_EX(arginfo_file_put_contents, 0, 0, 2)
1047 	ZEND_ARG_INFO(0, filename)
1048 	ZEND_ARG_INFO(0, data)
1049 	ZEND_ARG_INFO(0, flags)
1050 	ZEND_ARG_INFO(0, context)
1051 ZEND_END_ARG_INFO()
1052 
1053 ZEND_BEGIN_ARG_INFO_EX(arginfo_file, 0, 0, 1)
1054 	ZEND_ARG_INFO(0, filename)
1055 	ZEND_ARG_INFO(0, flags)
1056 	ZEND_ARG_INFO(0, context)
1057 ZEND_END_ARG_INFO()
1058 
1059 ZEND_BEGIN_ARG_INFO(arginfo_tempnam, 0)
1060 	ZEND_ARG_INFO(0, dir)
1061 	ZEND_ARG_INFO(0, prefix)
1062 ZEND_END_ARG_INFO()
1063 
1064 ZEND_BEGIN_ARG_INFO(arginfo_tmpfile, 0)
1065 ZEND_END_ARG_INFO()
1066 
1067 ZEND_BEGIN_ARG_INFO_EX(arginfo_fopen, 0, 0, 2)
1068 	ZEND_ARG_INFO(0, filename)
1069 	ZEND_ARG_INFO(0, mode)
1070 	ZEND_ARG_INFO(0, use_include_path)
1071 	ZEND_ARG_INFO(0, context)
1072 ZEND_END_ARG_INFO()
1073 
1074 ZEND_BEGIN_ARG_INFO(arginfo_fclose, 0)
1075 	ZEND_ARG_INFO(0, fp)
1076 ZEND_END_ARG_INFO()
1077 
1078 ZEND_BEGIN_ARG_INFO(arginfo_popen, 0)
1079 	ZEND_ARG_INFO(0, command)
1080 	ZEND_ARG_INFO(0, mode)
1081 ZEND_END_ARG_INFO()
1082 
1083 ZEND_BEGIN_ARG_INFO(arginfo_pclose, 0)
1084 	ZEND_ARG_INFO(0, fp)
1085 ZEND_END_ARG_INFO()
1086 
1087 ZEND_BEGIN_ARG_INFO(arginfo_feof, 0)
1088 	ZEND_ARG_INFO(0, fp)
1089 ZEND_END_ARG_INFO()
1090 
1091 ZEND_BEGIN_ARG_INFO_EX(arginfo_fgets, 0, 0, 1)
1092 	ZEND_ARG_INFO(0, fp)
1093 	ZEND_ARG_INFO(0, length)
1094 ZEND_END_ARG_INFO()
1095 
1096 ZEND_BEGIN_ARG_INFO(arginfo_fgetc, 0)
1097 	ZEND_ARG_INFO(0, fp)
1098 ZEND_END_ARG_INFO()
1099 
1100 ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetss, 0, 0, 1)
1101 	ZEND_ARG_INFO(0, fp)
1102 	ZEND_ARG_INFO(0, length)
1103 	ZEND_ARG_INFO(0, allowable_tags)
1104 ZEND_END_ARG_INFO()
1105 
1106 ZEND_BEGIN_ARG_INFO_EX(arginfo_fscanf, 0, 0, 2)
1107 	ZEND_ARG_INFO(0, stream)
1108 	ZEND_ARG_INFO(0, format)
1109 	ZEND_ARG_VARIADIC_INFO(1, vars)
1110 ZEND_END_ARG_INFO()
1111 
1112 ZEND_BEGIN_ARG_INFO_EX(arginfo_fwrite, 0, 0, 2)
1113 	ZEND_ARG_INFO(0, fp)
1114 	ZEND_ARG_INFO(0, str)
1115 	ZEND_ARG_INFO(0, length)
1116 ZEND_END_ARG_INFO()
1117 
1118 ZEND_BEGIN_ARG_INFO(arginfo_fflush, 0)
1119 	ZEND_ARG_INFO(0, fp)
1120 ZEND_END_ARG_INFO()
1121 
1122 ZEND_BEGIN_ARG_INFO(arginfo_rewind, 0)
1123 	ZEND_ARG_INFO(0, fp)
1124 ZEND_END_ARG_INFO()
1125 
1126 ZEND_BEGIN_ARG_INFO(arginfo_ftell, 0)
1127 	ZEND_ARG_INFO(0, fp)
1128 ZEND_END_ARG_INFO()
1129 
1130 ZEND_BEGIN_ARG_INFO_EX(arginfo_fseek, 0, 0, 2)
1131 	ZEND_ARG_INFO(0, fp)
1132 	ZEND_ARG_INFO(0, offset)
1133 	ZEND_ARG_INFO(0, whence)
1134 ZEND_END_ARG_INFO()
1135 
1136 ZEND_BEGIN_ARG_INFO_EX(arginfo_mkdir, 0, 0, 1)
1137 	ZEND_ARG_INFO(0, pathname)
1138 	ZEND_ARG_INFO(0, mode)
1139 	ZEND_ARG_INFO(0, recursive)
1140 	ZEND_ARG_INFO(0, context)
1141 ZEND_END_ARG_INFO()
1142 
1143 ZEND_BEGIN_ARG_INFO_EX(arginfo_rmdir, 0, 0, 1)
1144 	ZEND_ARG_INFO(0, dirname)
1145 	ZEND_ARG_INFO(0, context)
1146 ZEND_END_ARG_INFO()
1147 
1148 ZEND_BEGIN_ARG_INFO_EX(arginfo_readfile, 0, 0, 1)
1149 	ZEND_ARG_INFO(0, filename)
1150 	ZEND_ARG_INFO(0, flags)
1151 	ZEND_ARG_INFO(0, context)
1152 ZEND_END_ARG_INFO()
1153 
1154 ZEND_BEGIN_ARG_INFO_EX(arginfo_umask, 0, 0, 0)
1155 	ZEND_ARG_INFO(0, mask)
1156 ZEND_END_ARG_INFO()
1157 
1158 ZEND_BEGIN_ARG_INFO(arginfo_fpassthru, 0)
1159 	ZEND_ARG_INFO(0, fp)
1160 ZEND_END_ARG_INFO()
1161 
1162 ZEND_BEGIN_ARG_INFO_EX(arginfo_rename, 0, 0, 2)
1163 	ZEND_ARG_INFO(0, old_name)
1164 	ZEND_ARG_INFO(0, new_name)
1165 	ZEND_ARG_INFO(0, context)
1166 ZEND_END_ARG_INFO()
1167 
1168 ZEND_BEGIN_ARG_INFO_EX(arginfo_unlink, 0, 0, 1)
1169 	ZEND_ARG_INFO(0, filename)
1170 	ZEND_ARG_INFO(0, context)
1171 ZEND_END_ARG_INFO()
1172 
1173 ZEND_BEGIN_ARG_INFO(arginfo_ftruncate, 0)
1174 	ZEND_ARG_INFO(0, fp)
1175 	ZEND_ARG_INFO(0, size)
1176 ZEND_END_ARG_INFO()
1177 
1178 ZEND_BEGIN_ARG_INFO(arginfo_fstat, 0)
1179 	ZEND_ARG_INFO(0, fp)
1180 ZEND_END_ARG_INFO()
1181 ZEND_BEGIN_ARG_INFO_EX(arginfo_copy, 0, 0, 2)
1182 	ZEND_ARG_INFO(0, source_file)
1183 	ZEND_ARG_INFO(0, destination_file)
1184 	ZEND_ARG_INFO(0, context)
1185 ZEND_END_ARG_INFO()
1186 
1187 ZEND_BEGIN_ARG_INFO(arginfo_fread, 0)
1188 	ZEND_ARG_INFO(0, fp)
1189 	ZEND_ARG_INFO(0, length)
1190 ZEND_END_ARG_INFO()
1191 
1192 ZEND_BEGIN_ARG_INFO_EX(arginfo_fputcsv, 0, 0, 2)
1193 	ZEND_ARG_INFO(0, fp)
1194 	ZEND_ARG_INFO(0, fields) /* ARRAY_INFO(0, fields, 1) */
1195 	ZEND_ARG_INFO(0, delimiter)
1196 	ZEND_ARG_INFO(0, enclosure)
1197 	ZEND_ARG_INFO(0, escape_char)
1198 ZEND_END_ARG_INFO()
1199 
1200 ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetcsv, 0, 0, 1)
1201 	ZEND_ARG_INFO(0, fp)
1202 	ZEND_ARG_INFO(0, length)
1203 	ZEND_ARG_INFO(0, delimiter)
1204 	ZEND_ARG_INFO(0, enclosure)
1205 	ZEND_ARG_INFO(0, escape)
1206 ZEND_END_ARG_INFO()
1207 
1208 #if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
1209 ZEND_BEGIN_ARG_INFO(arginfo_realpath, 0)
1210 	ZEND_ARG_INFO(0, path)
1211 ZEND_END_ARG_INFO()
1212 #endif
1213 
1214 #ifdef HAVE_FNMATCH
1215 ZEND_BEGIN_ARG_INFO_EX(arginfo_fnmatch, 0, 0, 2)
1216 	ZEND_ARG_INFO(0, pattern)
1217 	ZEND_ARG_INFO(0, filename)
1218 	ZEND_ARG_INFO(0, flags)
1219 ZEND_END_ARG_INFO()
1220 #endif
1221 
1222 ZEND_BEGIN_ARG_INFO(arginfo_sys_get_temp_dir, 0)
1223 ZEND_END_ARG_INFO()
1224 /* }}} */
1225 /* {{{ filestat.c */
1226 ZEND_BEGIN_ARG_INFO(arginfo_disk_total_space, 0)
1227 	ZEND_ARG_INFO(0, path)
1228 ZEND_END_ARG_INFO()
1229 
1230 ZEND_BEGIN_ARG_INFO(arginfo_disk_free_space, 0)
1231 	ZEND_ARG_INFO(0, path)
1232 ZEND_END_ARG_INFO()
1233 
1234 #ifndef NETWARE
1235 ZEND_BEGIN_ARG_INFO(arginfo_chgrp, 0)
1236 	ZEND_ARG_INFO(0, filename)
1237 	ZEND_ARG_INFO(0, group)
1238 ZEND_END_ARG_INFO()
1239 
1240 ZEND_BEGIN_ARG_INFO(arginfo_chown, 0)
1241 	ZEND_ARG_INFO(0, filename)
1242 	ZEND_ARG_INFO(0, user)
1243 ZEND_END_ARG_INFO()
1244 #endif
1245 
1246 #if HAVE_LCHOWN
1247 ZEND_BEGIN_ARG_INFO(arginfo_lchgrp, 0)
1248 	ZEND_ARG_INFO(0, filename)
1249 	ZEND_ARG_INFO(0, group)
1250 ZEND_END_ARG_INFO()
1251 
1252 ZEND_BEGIN_ARG_INFO(arginfo_lchown, 0)
1253 	ZEND_ARG_INFO(0, filename)
1254 	ZEND_ARG_INFO(0, user)
1255 ZEND_END_ARG_INFO()
1256 #endif
1257 
1258 ZEND_BEGIN_ARG_INFO(arginfo_chmod, 0)
1259 	ZEND_ARG_INFO(0, filename)
1260 	ZEND_ARG_INFO(0, mode)
1261 ZEND_END_ARG_INFO()
1262 
1263 #if HAVE_UTIME
1264 ZEND_BEGIN_ARG_INFO_EX(arginfo_touch, 0, 0, 1)
1265 	ZEND_ARG_INFO(0, filename)
1266 	ZEND_ARG_INFO(0, time)
1267 	ZEND_ARG_INFO(0, atime)
1268 ZEND_END_ARG_INFO()
1269 #endif
1270 
1271 ZEND_BEGIN_ARG_INFO_EX(arginfo_clearstatcache, 0, 0, 0)
1272 	ZEND_ARG_INFO(0, clear_realpath_cache)
1273 	ZEND_ARG_INFO(0, filename)
1274 ZEND_END_ARG_INFO()
1275 
1276 ZEND_BEGIN_ARG_INFO(arginfo_realpath_cache_size, 0)
1277 ZEND_END_ARG_INFO()
1278 
1279 ZEND_BEGIN_ARG_INFO(arginfo_realpath_cache_get, 0)
1280 ZEND_END_ARG_INFO()
1281 
1282 ZEND_BEGIN_ARG_INFO(arginfo_fileperms, 0)
1283 	ZEND_ARG_INFO(0, filename)
1284 ZEND_END_ARG_INFO()
1285 
1286 ZEND_BEGIN_ARG_INFO(arginfo_fileinode, 0)
1287 	ZEND_ARG_INFO(0, filename)
1288 ZEND_END_ARG_INFO()
1289 
1290 ZEND_BEGIN_ARG_INFO(arginfo_filesize, 0)
1291 	ZEND_ARG_INFO(0, filename)
1292 ZEND_END_ARG_INFO()
1293 
1294 ZEND_BEGIN_ARG_INFO(arginfo_fileowner, 0)
1295 	ZEND_ARG_INFO(0, filename)
1296 ZEND_END_ARG_INFO()
1297 
1298 ZEND_BEGIN_ARG_INFO(arginfo_filegroup, 0)
1299 	ZEND_ARG_INFO(0, filename)
1300 ZEND_END_ARG_INFO()
1301 
1302 ZEND_BEGIN_ARG_INFO(arginfo_fileatime, 0)
1303 	ZEND_ARG_INFO(0, filename)
1304 ZEND_END_ARG_INFO()
1305 
1306 ZEND_BEGIN_ARG_INFO(arginfo_filemtime, 0)
1307 	ZEND_ARG_INFO(0, filename)
1308 ZEND_END_ARG_INFO()
1309 
1310 ZEND_BEGIN_ARG_INFO(arginfo_filectime, 0)
1311 	ZEND_ARG_INFO(0, filename)
1312 ZEND_END_ARG_INFO()
1313 
1314 ZEND_BEGIN_ARG_INFO(arginfo_filetype, 0)
1315 	ZEND_ARG_INFO(0, filename)
1316 ZEND_END_ARG_INFO()
1317 
1318 ZEND_BEGIN_ARG_INFO(arginfo_is_writable, 0)
1319 	ZEND_ARG_INFO(0, filename)
1320 ZEND_END_ARG_INFO()
1321 
1322 ZEND_BEGIN_ARG_INFO(arginfo_is_readable, 0)
1323 	ZEND_ARG_INFO(0, filename)
1324 ZEND_END_ARG_INFO()
1325 
1326 ZEND_BEGIN_ARG_INFO(arginfo_is_executable, 0)
1327 	ZEND_ARG_INFO(0, filename)
1328 ZEND_END_ARG_INFO()
1329 
1330 ZEND_BEGIN_ARG_INFO(arginfo_is_file, 0)
1331 	ZEND_ARG_INFO(0, filename)
1332 ZEND_END_ARG_INFO()
1333 
1334 ZEND_BEGIN_ARG_INFO(arginfo_is_dir, 0)
1335 	ZEND_ARG_INFO(0, filename)
1336 ZEND_END_ARG_INFO()
1337 
1338 ZEND_BEGIN_ARG_INFO(arginfo_is_link, 0)
1339 	ZEND_ARG_INFO(0, filename)
1340 ZEND_END_ARG_INFO()
1341 
1342 ZEND_BEGIN_ARG_INFO(arginfo_file_exists, 0)
1343 	ZEND_ARG_INFO(0, filename)
1344 ZEND_END_ARG_INFO()
1345 
1346 ZEND_BEGIN_ARG_INFO(arginfo_lstat, 0)
1347 	ZEND_ARG_INFO(0, filename)
1348 ZEND_END_ARG_INFO()
1349 
1350 ZEND_BEGIN_ARG_INFO(arginfo_stat, 0)
1351 	ZEND_ARG_INFO(0, filename)
1352 ZEND_END_ARG_INFO()
1353 /* }}} */
1354 /* {{{ formatted_print.c */
1355 ZEND_BEGIN_ARG_INFO_EX(arginfo_sprintf, 0, 0, 1)
1356 	ZEND_ARG_INFO(0, format)
1357 	ZEND_ARG_VARIADIC_INFO(0, args)
1358 ZEND_END_ARG_INFO()
1359 
1360 ZEND_BEGIN_ARG_INFO(arginfo_vsprintf, 0)
1361 	ZEND_ARG_INFO(0, format)
1362 	ZEND_ARG_INFO(0, args) /* ARRAY_INFO(0, args, 1) */
1363 ZEND_END_ARG_INFO()
1364 
1365 ZEND_BEGIN_ARG_INFO_EX(arginfo_printf, 0, 0, 1)
1366 	ZEND_ARG_INFO(0, format)
1367 	ZEND_ARG_VARIADIC_INFO(0, args)
1368 ZEND_END_ARG_INFO()
1369 
1370 ZEND_BEGIN_ARG_INFO(arginfo_vprintf, 0)
1371 	ZEND_ARG_INFO(0, format)
1372 	ZEND_ARG_INFO(0, args) /* ARRAY_INFO(0, args, 1) */
1373 ZEND_END_ARG_INFO()
1374 
1375 ZEND_BEGIN_ARG_INFO_EX(arginfo_fprintf, 0, 0, 2)
1376 	ZEND_ARG_INFO(0, stream)
1377 	ZEND_ARG_INFO(0, format)
1378 	ZEND_ARG_VARIADIC_INFO(0, args)
1379 ZEND_END_ARG_INFO()
1380 
1381 ZEND_BEGIN_ARG_INFO(arginfo_vfprintf, 0)
1382 	ZEND_ARG_INFO(0, stream)
1383 	ZEND_ARG_INFO(0, format)
1384 	ZEND_ARG_INFO(0, args) /* ARRAY_INFO(0, args, 1) */
1385 ZEND_END_ARG_INFO()
1386 /* }}} */
1387 /* {{{ fsock.c */
1388 ZEND_BEGIN_ARG_INFO_EX(arginfo_fsockopen, 0, 0, 2)
1389 	ZEND_ARG_INFO(0, hostname)
1390 	ZEND_ARG_INFO(0, port)
1391 	ZEND_ARG_INFO(1, errno)
1392 	ZEND_ARG_INFO(1, errstr)
1393 	ZEND_ARG_INFO(0, timeout)
1394 ZEND_END_ARG_INFO()
1395 
1396 ZEND_BEGIN_ARG_INFO_EX(arginfo_pfsockopen, 0, 0, 2)
1397 	ZEND_ARG_INFO(0, hostname)
1398 	ZEND_ARG_INFO(0, port)
1399 	ZEND_ARG_INFO(1, errno)
1400 	ZEND_ARG_INFO(1, errstr)
1401 	ZEND_ARG_INFO(0, timeout)
1402 ZEND_END_ARG_INFO()
1403 /* }}} */
1404 /* {{{ ftok.c */
1405 #if HAVE_FTOK
1406 ZEND_BEGIN_ARG_INFO(arginfo_ftok, 0)
1407 	ZEND_ARG_INFO(0, pathname)
1408 	ZEND_ARG_INFO(0, proj)
1409 ZEND_END_ARG_INFO()
1410 #endif
1411 /* }}} */
1412 /* {{{ head.c */
1413 ZEND_BEGIN_ARG_INFO_EX(arginfo_header, 0, 0, 1)
1414 	ZEND_ARG_INFO(0, header)
1415 	ZEND_ARG_INFO(0, replace)
1416 	ZEND_ARG_INFO(0, http_response_code)
1417 ZEND_END_ARG_INFO()
1418 
1419 ZEND_BEGIN_ARG_INFO_EX(arginfo_header_remove, 0, 0, 0)
1420 	ZEND_ARG_INFO(0, name)
1421 ZEND_END_ARG_INFO()
1422 
1423 ZEND_BEGIN_ARG_INFO_EX(arginfo_setcookie, 0, 0, 1)
1424 	ZEND_ARG_INFO(0, name)
1425 	ZEND_ARG_INFO(0, value)
1426 	ZEND_ARG_INFO(0, expires)
1427 	ZEND_ARG_INFO(0, path)
1428 	ZEND_ARG_INFO(0, domain)
1429 	ZEND_ARG_INFO(0, secure)
1430 	ZEND_ARG_INFO(0, httponly)
1431 ZEND_END_ARG_INFO()
1432 
1433 ZEND_BEGIN_ARG_INFO_EX(arginfo_setrawcookie, 0, 0, 1)
1434 	ZEND_ARG_INFO(0, name)
1435 	ZEND_ARG_INFO(0, value)
1436 	ZEND_ARG_INFO(0, expires)
1437 	ZEND_ARG_INFO(0, path)
1438 	ZEND_ARG_INFO(0, domain)
1439 	ZEND_ARG_INFO(0, secure)
1440 	ZEND_ARG_INFO(0, httponly)
1441 ZEND_END_ARG_INFO()
1442 
1443 ZEND_BEGIN_ARG_INFO_EX(arginfo_headers_sent, 0, 0, 0)
1444 	ZEND_ARG_INFO(1, file)
1445 	ZEND_ARG_INFO(1, line)
1446 ZEND_END_ARG_INFO()
1447 
1448 ZEND_BEGIN_ARG_INFO(arginfo_headers_list, 0)
1449 ZEND_END_ARG_INFO()
1450 
1451 ZEND_BEGIN_ARG_INFO_EX(arginfo_http_response_code, 0, 0, 0)
1452 	ZEND_ARG_INFO(0, response_code)
1453 ZEND_END_ARG_INFO()
1454 /* }}} */
1455 /* {{{ html.c */
1456 ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars, 0, 0, 1)
1457 	ZEND_ARG_INFO(0, string)
1458 	ZEND_ARG_INFO(0, quote_style)
1459 	ZEND_ARG_INFO(0, encoding)
1460 	ZEND_ARG_INFO(0, double_encode)
1461 ZEND_END_ARG_INFO()
1462 
1463 ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars_decode, 0, 0, 1)
1464 	ZEND_ARG_INFO(0, string)
1465 	ZEND_ARG_INFO(0, quote_style)
1466 ZEND_END_ARG_INFO()
1467 
1468 ZEND_BEGIN_ARG_INFO_EX(arginfo_html_entity_decode, 0, 0, 1)
1469 	ZEND_ARG_INFO(0, string)
1470 	ZEND_ARG_INFO(0, quote_style)
1471 	ZEND_ARG_INFO(0, encoding)
1472 ZEND_END_ARG_INFO()
1473 
1474 ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlentities, 0, 0, 1)
1475 	ZEND_ARG_INFO(0, string)
1476 	ZEND_ARG_INFO(0, quote_style)
1477 	ZEND_ARG_INFO(0, encoding)
1478 	ZEND_ARG_INFO(0, double_encode)
1479 ZEND_END_ARG_INFO()
1480 
1481 ZEND_BEGIN_ARG_INFO_EX(arginfo_get_html_translation_table, 0, 0, 0)
1482 	ZEND_ARG_INFO(0, table)
1483 	ZEND_ARG_INFO(0, quote_style)
1484 	ZEND_ARG_INFO(0, encoding)
1485 ZEND_END_ARG_INFO()
1486 
1487 /* }}} */
1488 /* {{{ http.c */
1489 ZEND_BEGIN_ARG_INFO_EX(arginfo_http_build_query, 0, 0, 1)
1490 	ZEND_ARG_INFO(0, formdata)
1491 	ZEND_ARG_INFO(0, prefix)
1492 	ZEND_ARG_INFO(0, arg_separator)
1493 	ZEND_ARG_INFO(0, enc_type)
1494 ZEND_END_ARG_INFO()
1495 /* }}} */
1496 /* {{{ image.c */
1497 ZEND_BEGIN_ARG_INFO(arginfo_image_type_to_mime_type, 0)
1498 	ZEND_ARG_INFO(0, imagetype)
1499 ZEND_END_ARG_INFO()
1500 
1501 ZEND_BEGIN_ARG_INFO_EX(arginfo_image_type_to_extension, 0, 0, 1)
1502 	ZEND_ARG_INFO(0, imagetype)
1503 	ZEND_ARG_INFO(0, include_dot)
1504 ZEND_END_ARG_INFO()
1505 
1506 ZEND_BEGIN_ARG_INFO_EX(arginfo_getimagesize, 0, 0, 1)
1507 	ZEND_ARG_INFO(0, imagefile)
1508 	ZEND_ARG_INFO(1, info) /* ARRAY_INFO(1, info, 1) */
1509 ZEND_END_ARG_INFO()
1510 /* }}} */
1511 /* {{{ info.c */
1512 ZEND_BEGIN_ARG_INFO_EX(arginfo_phpinfo, 0, 0, 0)
1513 	ZEND_ARG_INFO(0, what)
1514 ZEND_END_ARG_INFO()
1515 
1516 ZEND_BEGIN_ARG_INFO_EX(arginfo_phpversion, 0, 0, 0)
1517 	ZEND_ARG_INFO(0, extension)
1518 ZEND_END_ARG_INFO()
1519 
1520 ZEND_BEGIN_ARG_INFO_EX(arginfo_phpcredits, 0, 0, 0)
1521 	ZEND_ARG_INFO(0, flag)
1522 ZEND_END_ARG_INFO()
1523 
1524 ZEND_BEGIN_ARG_INFO(arginfo_php_sapi_name, 0)
1525 ZEND_END_ARG_INFO()
1526 
1527 ZEND_BEGIN_ARG_INFO_EX(arginfo_php_uname, 0, 0, 0)
1528 	ZEND_ARG_INFO(0, mode)
1529 ZEND_END_ARG_INFO()
1530 
1531 ZEND_BEGIN_ARG_INFO(arginfo_php_ini_scanned_files, 0)
1532 ZEND_END_ARG_INFO()
1533 
1534 ZEND_BEGIN_ARG_INFO(arginfo_php_ini_loaded_file, 0)
1535 ZEND_END_ARG_INFO()
1536 /* }}} */
1537 /* {{{ iptc.c */
1538 ZEND_BEGIN_ARG_INFO_EX(arginfo_iptcembed, 0, 0, 2)
1539 	ZEND_ARG_INFO(0, iptcdata)
1540 	ZEND_ARG_INFO(0, jpeg_file_name)
1541 	ZEND_ARG_INFO(0, spool)
1542 ZEND_END_ARG_INFO()
1543 
1544 ZEND_BEGIN_ARG_INFO(arginfo_iptcparse, 0)
1545 	ZEND_ARG_INFO(0, iptcdata)
1546 ZEND_END_ARG_INFO()
1547 /* }}} */
1548 
1549 /* {{{ lcg.c */
1550 ZEND_BEGIN_ARG_INFO(arginfo_lcg_value, 0)
1551 ZEND_END_ARG_INFO()
1552 /* }}} */
1553 
1554 /* {{{ levenshtein.c */
1555 ZEND_BEGIN_ARG_INFO_EX(arginfo_levenshtein, 0, 0, 2)
1556 	ZEND_ARG_INFO(0, str1)
1557 	ZEND_ARG_INFO(0, str2)
1558 	ZEND_ARG_INFO(0, cost_ins)
1559 	ZEND_ARG_INFO(0, cost_rep)
1560 	ZEND_ARG_INFO(0, cost_del)
1561 ZEND_END_ARG_INFO()
1562 /* }}} */
1563 /* {{{ link.c */
1564 #if defined(HAVE_SYMLINK) || defined(PHP_WIN32)
1565 ZEND_BEGIN_ARG_INFO(arginfo_readlink, 0)
1566 	ZEND_ARG_INFO(0, filename)
1567 ZEND_END_ARG_INFO()
1568 
1569 ZEND_BEGIN_ARG_INFO(arginfo_linkinfo, 0)
1570 	ZEND_ARG_INFO(0, filename)
1571 ZEND_END_ARG_INFO()
1572 
1573 ZEND_BEGIN_ARG_INFO(arginfo_symlink, 0)
1574 	ZEND_ARG_INFO(0, target)
1575 	ZEND_ARG_INFO(0, link)
1576 ZEND_END_ARG_INFO()
1577 
1578 ZEND_BEGIN_ARG_INFO(arginfo_link, 0)
1579 	ZEND_ARG_INFO(0, target)
1580 	ZEND_ARG_INFO(0, link)
1581 ZEND_END_ARG_INFO()
1582 #endif
1583 /* }}} */
1584 /* {{{ mail.c */
1585 ZEND_BEGIN_ARG_INFO(arginfo_ezmlm_hash, 0)
1586 	ZEND_ARG_INFO(0, addr)
1587 ZEND_END_ARG_INFO()
1588 
1589 ZEND_BEGIN_ARG_INFO_EX(arginfo_mail, 0, 0, 3)
1590 	ZEND_ARG_INFO(0, to)
1591 	ZEND_ARG_INFO(0, subject)
1592 	ZEND_ARG_INFO(0, message)
1593 	ZEND_ARG_INFO(0, additional_headers)
1594 	ZEND_ARG_INFO(0, additional_parameters)
1595 ZEND_END_ARG_INFO()
1596 /* }}} */
1597 /* {{{ math.c */
1598 ZEND_BEGIN_ARG_INFO(arginfo_abs, 0)
1599 	ZEND_ARG_INFO(0, number)
1600 ZEND_END_ARG_INFO()
1601 
1602 ZEND_BEGIN_ARG_INFO(arginfo_ceil, 0)
1603 	ZEND_ARG_INFO(0, number)
1604 ZEND_END_ARG_INFO()
1605 
1606 ZEND_BEGIN_ARG_INFO(arginfo_floor, 0)
1607 	ZEND_ARG_INFO(0, number)
1608 ZEND_END_ARG_INFO()
1609 
1610 ZEND_BEGIN_ARG_INFO_EX(arginfo_round, 0, 0, 1)
1611 	ZEND_ARG_INFO(0, number)
1612 	ZEND_ARG_INFO(0, precision)
1613 	ZEND_ARG_INFO(0, mode)
1614 ZEND_END_ARG_INFO()
1615 
1616 ZEND_BEGIN_ARG_INFO(arginfo_sin, 0)
1617 	ZEND_ARG_INFO(0, number)
1618 ZEND_END_ARG_INFO()
1619 
1620 ZEND_BEGIN_ARG_INFO(arginfo_cos, 0)
1621 	ZEND_ARG_INFO(0, number)
1622 ZEND_END_ARG_INFO()
1623 
1624 ZEND_BEGIN_ARG_INFO(arginfo_tan, 0)
1625 	ZEND_ARG_INFO(0, number)
1626 ZEND_END_ARG_INFO()
1627 
1628 ZEND_BEGIN_ARG_INFO(arginfo_asin, 0)
1629 	ZEND_ARG_INFO(0, number)
1630 ZEND_END_ARG_INFO()
1631 
1632 ZEND_BEGIN_ARG_INFO(arginfo_acos, 0)
1633 	ZEND_ARG_INFO(0, number)
1634 ZEND_END_ARG_INFO()
1635 
1636 ZEND_BEGIN_ARG_INFO(arginfo_atan, 0)
1637 	ZEND_ARG_INFO(0, number)
1638 ZEND_END_ARG_INFO()
1639 
1640 ZEND_BEGIN_ARG_INFO(arginfo_atan2, 0)
1641 	ZEND_ARG_INFO(0, y)
1642 	ZEND_ARG_INFO(0, x)
1643 ZEND_END_ARG_INFO()
1644 
1645 ZEND_BEGIN_ARG_INFO(arginfo_sinh, 0)
1646 	ZEND_ARG_INFO(0, number)
1647 ZEND_END_ARG_INFO()
1648 
1649 ZEND_BEGIN_ARG_INFO(arginfo_cosh, 0)
1650 	ZEND_ARG_INFO(0, number)
1651 ZEND_END_ARG_INFO()
1652 
1653 ZEND_BEGIN_ARG_INFO(arginfo_tanh, 0)
1654 	ZEND_ARG_INFO(0, number)
1655 ZEND_END_ARG_INFO()
1656 
1657 ZEND_BEGIN_ARG_INFO(arginfo_asinh, 0)
1658 	ZEND_ARG_INFO(0, number)
1659 ZEND_END_ARG_INFO()
1660 
1661 ZEND_BEGIN_ARG_INFO(arginfo_acosh, 0)
1662 	ZEND_ARG_INFO(0, number)
1663 ZEND_END_ARG_INFO()
1664 
1665 ZEND_BEGIN_ARG_INFO(arginfo_atanh, 0)
1666 	ZEND_ARG_INFO(0, number)
1667 ZEND_END_ARG_INFO()
1668 
1669 ZEND_BEGIN_ARG_INFO(arginfo_pi, 0)
1670 ZEND_END_ARG_INFO()
1671 
1672 ZEND_BEGIN_ARG_INFO(arginfo_is_finite, 0)
1673 	ZEND_ARG_INFO(0, val)
1674 ZEND_END_ARG_INFO()
1675 
1676 ZEND_BEGIN_ARG_INFO(arginfo_is_infinite, 0)
1677 	ZEND_ARG_INFO(0, val)
1678 ZEND_END_ARG_INFO()
1679 
1680 ZEND_BEGIN_ARG_INFO(arginfo_is_nan, 0)
1681 	ZEND_ARG_INFO(0, val)
1682 ZEND_END_ARG_INFO()
1683 
1684 ZEND_BEGIN_ARG_INFO(arginfo_pow, 0)
1685 	ZEND_ARG_INFO(0, base)
1686 	ZEND_ARG_INFO(0, exponent)
1687 ZEND_END_ARG_INFO()
1688 
1689 ZEND_BEGIN_ARG_INFO(arginfo_exp, 0)
1690 	ZEND_ARG_INFO(0, number)
1691 ZEND_END_ARG_INFO()
1692 
1693 ZEND_BEGIN_ARG_INFO(arginfo_expm1, 0)
1694 	ZEND_ARG_INFO(0, number)
1695 ZEND_END_ARG_INFO()
1696 
1697 ZEND_BEGIN_ARG_INFO(arginfo_log1p, 0)
1698 	ZEND_ARG_INFO(0, number)
1699 ZEND_END_ARG_INFO()
1700 
1701 ZEND_BEGIN_ARG_INFO_EX(arginfo_log, 0, 0, 1)
1702 	ZEND_ARG_INFO(0, number)
1703 	ZEND_ARG_INFO(0, base)
1704 ZEND_END_ARG_INFO()
1705 
1706 ZEND_BEGIN_ARG_INFO(arginfo_log10, 0)
1707 	ZEND_ARG_INFO(0, number)
1708 ZEND_END_ARG_INFO()
1709 
1710 ZEND_BEGIN_ARG_INFO(arginfo_sqrt, 0)
1711 	ZEND_ARG_INFO(0, number)
1712 ZEND_END_ARG_INFO()
1713 
1714 ZEND_BEGIN_ARG_INFO(arginfo_hypot, 0)
1715 	ZEND_ARG_INFO(0, num1)
1716 	ZEND_ARG_INFO(0, num2)
1717 ZEND_END_ARG_INFO()
1718 
1719 ZEND_BEGIN_ARG_INFO(arginfo_deg2rad, 0)
1720 	ZEND_ARG_INFO(0, number)
1721 ZEND_END_ARG_INFO()
1722 
1723 ZEND_BEGIN_ARG_INFO(arginfo_rad2deg, 0)
1724 	ZEND_ARG_INFO(0, number)
1725 ZEND_END_ARG_INFO()
1726 
1727 ZEND_BEGIN_ARG_INFO(arginfo_bindec, 0)
1728 	ZEND_ARG_INFO(0, binary_number)
1729 ZEND_END_ARG_INFO()
1730 
1731 ZEND_BEGIN_ARG_INFO(arginfo_hexdec, 0)
1732 	ZEND_ARG_INFO(0, hexadecimal_number)
1733 ZEND_END_ARG_INFO()
1734 
1735 ZEND_BEGIN_ARG_INFO(arginfo_octdec, 0)
1736 	ZEND_ARG_INFO(0, octal_number)
1737 ZEND_END_ARG_INFO()
1738 
1739 ZEND_BEGIN_ARG_INFO(arginfo_decbin, 0)
1740 	ZEND_ARG_INFO(0, decimal_number)
1741 ZEND_END_ARG_INFO()
1742 
1743 ZEND_BEGIN_ARG_INFO(arginfo_decoct, 0)
1744 	ZEND_ARG_INFO(0, decimal_number)
1745 ZEND_END_ARG_INFO()
1746 
1747 ZEND_BEGIN_ARG_INFO(arginfo_dechex, 0)
1748 	ZEND_ARG_INFO(0, decimal_number)
1749 ZEND_END_ARG_INFO()
1750 
1751 ZEND_BEGIN_ARG_INFO(arginfo_base_convert, 0)
1752 	ZEND_ARG_INFO(0, number)
1753 	ZEND_ARG_INFO(0, frombase)
1754 	ZEND_ARG_INFO(0, tobase)
1755 ZEND_END_ARG_INFO()
1756 
1757 ZEND_BEGIN_ARG_INFO_EX(arginfo_number_format, 0, 0, 1)
1758 	ZEND_ARG_INFO(0, number)
1759 	ZEND_ARG_INFO(0, num_decimal_places)
1760 	ZEND_ARG_INFO(0, dec_separator)
1761 	ZEND_ARG_INFO(0, thousands_separator)
1762 ZEND_END_ARG_INFO()
1763 
1764 ZEND_BEGIN_ARG_INFO(arginfo_fmod, 0)
1765 	ZEND_ARG_INFO(0, x)
1766 	ZEND_ARG_INFO(0, y)
1767 ZEND_END_ARG_INFO()
1768 
1769 ZEND_BEGIN_ARG_INFO(arginfo_intdiv, 0)
1770 	ZEND_ARG_INFO(0, dividend)
1771 	ZEND_ARG_INFO(0, divisor)
1772 ZEND_END_ARG_INFO()
1773 /* }}} */
1774 /* {{{ md5.c */
1775 ZEND_BEGIN_ARG_INFO_EX(arginfo_md5, 0, 0, 1)
1776 	ZEND_ARG_INFO(0, str)
1777 	ZEND_ARG_INFO(0, raw_output)
1778 ZEND_END_ARG_INFO()
1779 
1780 ZEND_BEGIN_ARG_INFO_EX(arginfo_md5_file, 0, 0, 1)
1781 	ZEND_ARG_INFO(0, filename)
1782 	ZEND_ARG_INFO(0, raw_output)
1783 ZEND_END_ARG_INFO()
1784 /* }}} */
1785 /* {{{ metaphone.c */
1786 ZEND_BEGIN_ARG_INFO_EX(arginfo_metaphone, 0, 0, 1)
1787 	ZEND_ARG_INFO(0, text)
1788 	ZEND_ARG_INFO(0, phones)
1789 ZEND_END_ARG_INFO()
1790 /* }}} */
1791 /* {{{ microtime.c */
1792 #ifdef HAVE_GETTIMEOFDAY
1793 ZEND_BEGIN_ARG_INFO_EX(arginfo_microtime, 0, 0, 0)
1794 	ZEND_ARG_INFO(0, get_as_float)
1795 ZEND_END_ARG_INFO()
1796 
1797 ZEND_BEGIN_ARG_INFO_EX(arginfo_gettimeofday, 0, 0, 0)
1798 	ZEND_ARG_INFO(0, get_as_float)
1799 ZEND_END_ARG_INFO()
1800 #endif
1801 
1802 #ifdef HAVE_GETRUSAGE
1803 ZEND_BEGIN_ARG_INFO_EX(arginfo_getrusage, 0, 0, 0)
1804 	ZEND_ARG_INFO(0, who)
1805 ZEND_END_ARG_INFO()
1806 #endif
1807 /* }}} */
1808 /* {{{ pack.c */
1809 ZEND_BEGIN_ARG_INFO_EX(arginfo_pack, 0, 0, 2)
1810 	ZEND_ARG_INFO(0, format)
1811 	ZEND_ARG_VARIADIC_INFO(0, args)
1812 ZEND_END_ARG_INFO()
1813 
1814 ZEND_BEGIN_ARG_INFO(arginfo_unpack, 0)
1815 	ZEND_ARG_INFO(0, format)
1816 	ZEND_ARG_INFO(0, input)
1817 ZEND_END_ARG_INFO()
1818 /* }}} */
1819 /* {{{ pageinfo.c */
1820 ZEND_BEGIN_ARG_INFO(arginfo_getmyuid, 0)
1821 ZEND_END_ARG_INFO()
1822 
1823 ZEND_BEGIN_ARG_INFO(arginfo_getmygid, 0)
1824 ZEND_END_ARG_INFO()
1825 
1826 ZEND_BEGIN_ARG_INFO(arginfo_getmypid, 0)
1827 ZEND_END_ARG_INFO()
1828 
1829 ZEND_BEGIN_ARG_INFO(arginfo_getmyinode, 0)
1830 ZEND_END_ARG_INFO()
1831 
1832 ZEND_BEGIN_ARG_INFO(arginfo_getlastmod, 0)
1833 ZEND_END_ARG_INFO()
1834 /* }}} */
1835 /* {{{ password.c */
1836 ZEND_BEGIN_ARG_INFO_EX(arginfo_password_hash, 0, 0, 2)
1837 	ZEND_ARG_INFO(0, password)
1838 	ZEND_ARG_INFO(0, algo)
1839 	ZEND_ARG_INFO(0, options)
1840 ZEND_END_ARG_INFO()
1841 ZEND_BEGIN_ARG_INFO_EX(arginfo_password_get_info, 0, 0, 1)
1842 	ZEND_ARG_INFO(0, hash)
1843 ZEND_END_ARG_INFO()
1844 ZEND_BEGIN_ARG_INFO_EX(arginfo_password_needs_rehash, 0, 0, 2)
1845 	ZEND_ARG_INFO(0, hash)
1846 	ZEND_ARG_INFO(0, algo)
1847 	ZEND_ARG_INFO(0, options)
1848 ZEND_END_ARG_INFO()
1849 ZEND_BEGIN_ARG_INFO_EX(arginfo_password_verify, 0, 0, 2)
1850 	ZEND_ARG_INFO(0, password)
1851 	ZEND_ARG_INFO(0, hash)
1852 ZEND_END_ARG_INFO()
1853 /* }}} */
1854 /* {{{ proc_open.c */
1855 #ifdef PHP_CAN_SUPPORT_PROC_OPEN
1856 ZEND_BEGIN_ARG_INFO_EX(arginfo_proc_terminate, 0, 0, 1)
1857 	ZEND_ARG_INFO(0, process)
1858 	ZEND_ARG_INFO(0, signal)
1859 ZEND_END_ARG_INFO()
1860 
1861 ZEND_BEGIN_ARG_INFO(arginfo_proc_close, 0)
1862 	ZEND_ARG_INFO(0, process)
1863 ZEND_END_ARG_INFO()
1864 
1865 ZEND_BEGIN_ARG_INFO(arginfo_proc_get_status, 0)
1866 	ZEND_ARG_INFO(0, process)
1867 ZEND_END_ARG_INFO()
1868 
1869 ZEND_BEGIN_ARG_INFO_EX(arginfo_proc_open, 0, 0, 3)
1870 	ZEND_ARG_INFO(0, command)
1871 	ZEND_ARG_INFO(0, descriptorspec) /* ARRAY_INFO(0, descriptorspec, 1) */
1872 	ZEND_ARG_INFO(1, pipes) /* ARRAY_INFO(1, pipes, 1) */
1873 	ZEND_ARG_INFO(0, cwd)
1874 	ZEND_ARG_INFO(0, env) /* ARRAY_INFO(0, env, 1) */
1875 	ZEND_ARG_INFO(0, other_options) /* ARRAY_INFO(0, other_options, 1) */
1876 ZEND_END_ARG_INFO()
1877 #endif
1878 /* }}} */
1879 /* {{{ quot_print.c */
1880 ZEND_BEGIN_ARG_INFO(arginfo_quoted_printable_decode, 0)
1881 	ZEND_ARG_INFO(0, str)
1882 ZEND_END_ARG_INFO()
1883 /* }}} */
1884 /* {{{ quot_print.c */
1885 ZEND_BEGIN_ARG_INFO(arginfo_quoted_printable_encode, 0)
1886 	ZEND_ARG_INFO(0, str)
1887 ZEND_END_ARG_INFO()
1888 /* }}} */
1889 /* {{{ rand.c */
1890 ZEND_BEGIN_ARG_INFO_EX(arginfo_srand, 0, 0, 0)
1891 	ZEND_ARG_INFO(0, seed)
1892 ZEND_END_ARG_INFO()
1893 
1894 ZEND_BEGIN_ARG_INFO_EX(arginfo_mt_srand, 0, 0, 0)
1895 	ZEND_ARG_INFO(0, seed)
1896 ZEND_END_ARG_INFO()
1897 
1898 ZEND_BEGIN_ARG_INFO_EX(arginfo_rand, 0, 0, 0)
1899 	ZEND_ARG_INFO(0, min)
1900 	ZEND_ARG_INFO(0, max)
1901 ZEND_END_ARG_INFO()
1902 
1903 ZEND_BEGIN_ARG_INFO_EX(arginfo_mt_rand, 0, 0, 0)
1904 	ZEND_ARG_INFO(0, min)
1905 	ZEND_ARG_INFO(0, max)
1906 ZEND_END_ARG_INFO()
1907 
1908 ZEND_BEGIN_ARG_INFO(arginfo_getrandmax, 0)
1909 ZEND_END_ARG_INFO()
1910 
1911 ZEND_BEGIN_ARG_INFO(arginfo_mt_getrandmax, 0)
1912 ZEND_END_ARG_INFO()
1913 /* }}} */
1914 /* {{{ random.c */
1915 ZEND_BEGIN_ARG_INFO_EX(arginfo_random_bytes, 0, 0, 1)
1916 	ZEND_ARG_INFO(0, length)
1917 ZEND_END_ARG_INFO()
1918 
1919 ZEND_BEGIN_ARG_INFO_EX(arginfo_random_int, 0, 0, 2)
1920 	ZEND_ARG_INFO(0, min)
1921 	ZEND_ARG_INFO(0, max)
1922 ZEND_END_ARG_INFO()
1923 /* }}} */
1924 /* {{{ sha1.c */
1925 ZEND_BEGIN_ARG_INFO_EX(arginfo_sha1, 0, 0, 1)
1926 	ZEND_ARG_INFO(0, str)
1927 	ZEND_ARG_INFO(0, raw_output)
1928 ZEND_END_ARG_INFO()
1929 
1930 ZEND_BEGIN_ARG_INFO_EX(arginfo_sha1_file, 0, 0, 1)
1931 	ZEND_ARG_INFO(0, filename)
1932 	ZEND_ARG_INFO(0, raw_output)
1933 ZEND_END_ARG_INFO()
1934 /* }}} */
1935 /* {{{ soundex.c */
1936 ZEND_BEGIN_ARG_INFO(arginfo_soundex, 0)
1937 	ZEND_ARG_INFO(0, str)
1938 ZEND_END_ARG_INFO()
1939 /* }}} */
1940 /* {{{ streamsfuncs.c */
1941 #if HAVE_SOCKETPAIR
1942 ZEND_BEGIN_ARG_INFO(arginfo_stream_socket_pair, 0)
1943 	ZEND_ARG_INFO(0, domain)
1944 	ZEND_ARG_INFO(0, type)
1945 	ZEND_ARG_INFO(0, protocol)
1946 ZEND_END_ARG_INFO()
1947 #endif
1948 
1949 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_client, 0, 0, 1)
1950 	ZEND_ARG_INFO(0, remoteaddress)
1951 	ZEND_ARG_INFO(1, errcode)
1952 	ZEND_ARG_INFO(1, errstring)
1953 	ZEND_ARG_INFO(0, timeout)
1954 	ZEND_ARG_INFO(0, flags)
1955 	ZEND_ARG_INFO(0, context)
1956 ZEND_END_ARG_INFO()
1957 
1958 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_server, 0, 0, 1)
1959 	ZEND_ARG_INFO(0, localaddress)
1960 	ZEND_ARG_INFO(1, errcode)
1961 	ZEND_ARG_INFO(1, errstring)
1962 	ZEND_ARG_INFO(0, flags)
1963 	ZEND_ARG_INFO(0, context)
1964 ZEND_END_ARG_INFO()
1965 
1966 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_accept, 0, 0, 1)
1967 	ZEND_ARG_INFO(0, serverstream)
1968 	ZEND_ARG_INFO(0, timeout)
1969 	ZEND_ARG_INFO(1, peername)
1970 ZEND_END_ARG_INFO()
1971 
1972 ZEND_BEGIN_ARG_INFO(arginfo_stream_socket_get_name, 0)
1973 	ZEND_ARG_INFO(0, stream)
1974 	ZEND_ARG_INFO(0, want_peer)
1975 ZEND_END_ARG_INFO()
1976 
1977 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_sendto, 0, 0, 2)
1978 	ZEND_ARG_INFO(0, stream)
1979 	ZEND_ARG_INFO(0, data)
1980 	ZEND_ARG_INFO(0, flags)
1981 	ZEND_ARG_INFO(0, target_addr)
1982 ZEND_END_ARG_INFO()
1983 
1984 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_recvfrom, 0, 0, 2)
1985 	ZEND_ARG_INFO(0, stream)
1986 	ZEND_ARG_INFO(0, amount)
1987 	ZEND_ARG_INFO(0, flags)
1988 	ZEND_ARG_INFO(1, remote_addr)
1989 ZEND_END_ARG_INFO()
1990 
1991 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_get_contents, 0, 0, 1)
1992 	ZEND_ARG_INFO(0, source)
1993 	ZEND_ARG_INFO(0, maxlen)
1994 	ZEND_ARG_INFO(0, offset)
1995 ZEND_END_ARG_INFO()
1996 
1997 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_copy_to_stream, 0, 0, 2)
1998 	ZEND_ARG_INFO(0, source)
1999 	ZEND_ARG_INFO(0, dest)
2000 	ZEND_ARG_INFO(0, maxlen)
2001 	ZEND_ARG_INFO(0, pos)
2002 ZEND_END_ARG_INFO()
2003 
2004 ZEND_BEGIN_ARG_INFO(arginfo_stream_get_meta_data, 0)
2005 	ZEND_ARG_INFO(0, fp)
2006 ZEND_END_ARG_INFO()
2007 
2008 ZEND_BEGIN_ARG_INFO(arginfo_stream_get_transports, 0)
2009 ZEND_END_ARG_INFO()
2010 
2011 ZEND_BEGIN_ARG_INFO(arginfo_stream_get_wrappers, 0)
2012 ZEND_END_ARG_INFO()
2013 
2014 ZEND_BEGIN_ARG_INFO(arginfo_stream_resolve_include_path, 0)
2015 	ZEND_ARG_INFO(0, filename)
2016 ZEND_END_ARG_INFO()
2017 
2018 ZEND_BEGIN_ARG_INFO(arginfo_stream_is_local, 0)
2019 	ZEND_ARG_INFO(0, stream)
2020 ZEND_END_ARG_INFO()
2021 
2022 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_supports_lock, 0, 0, 1)
2023     ZEND_ARG_INFO(0, stream)
2024 ZEND_END_ARG_INFO()
2025 
2026 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_select, 0, 0, 4)
2027 	ZEND_ARG_INFO(1, read_streams) /* ARRAY_INFO(1, read_streams, 1) */
2028 	ZEND_ARG_INFO(1, write_streams) /* ARRAY_INFO(1, write_streams, 1) */
2029 	ZEND_ARG_INFO(1, except_streams) /* ARRAY_INFO(1, except_streams, 1) */
2030 	ZEND_ARG_INFO(0, tv_sec)
2031 	ZEND_ARG_INFO(0, tv_usec)
2032 ZEND_END_ARG_INFO()
2033 
2034 ZEND_BEGIN_ARG_INFO(arginfo_stream_context_get_options, 0)
2035 	ZEND_ARG_INFO(0, stream_or_context)
2036 ZEND_END_ARG_INFO()
2037 
2038 ZEND_BEGIN_ARG_INFO(arginfo_stream_context_set_option, 0)
2039 	ZEND_ARG_INFO(0, stream_or_context)
2040 	ZEND_ARG_INFO(0, wrappername)
2041 	ZEND_ARG_INFO(0, optionname)
2042 	ZEND_ARG_INFO(0, value)
2043 ZEND_END_ARG_INFO()
2044 
2045 ZEND_BEGIN_ARG_INFO(arginfo_stream_context_set_params, 0)
2046 	ZEND_ARG_INFO(0, stream_or_context)
2047 	ZEND_ARG_INFO(0, options) /* ARRAY_INFO(0, options, 1) */
2048 ZEND_END_ARG_INFO()
2049 
2050 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_get_params, 0, ZEND_RETURN_VALUE, 1)
2051 	ZEND_ARG_INFO(0, stream_or_context)
2052 ZEND_END_ARG_INFO()
2053 
2054 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_get_default, 0, 0, 0)
2055 	ZEND_ARG_INFO(0, options) /* ARRAY_INFO(0, options, 1) */
2056 ZEND_END_ARG_INFO()
2057 
2058 ZEND_BEGIN_ARG_INFO(arginfo_stream_context_set_default, 0)
2059 	ZEND_ARG_INFO(0, options)
2060 ZEND_END_ARG_INFO()
2061 
2062 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_create, 0, 0, 0)
2063 	ZEND_ARG_INFO(0, options) /* ARRAY_INFO(0, options, 1) */
2064 	ZEND_ARG_INFO(0, params) /* ARRAY_INFO(0, params, 1) */
2065 ZEND_END_ARG_INFO()
2066 
2067 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_filter_prepend, 0, 0, 2)
2068 	ZEND_ARG_INFO(0, stream)
2069 	ZEND_ARG_INFO(0, filtername)
2070 	ZEND_ARG_INFO(0, read_write)
2071 	ZEND_ARG_INFO(0, filterparams)
2072 ZEND_END_ARG_INFO()
2073 
2074 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_filter_append, 0, 0, 2)
2075 	ZEND_ARG_INFO(0, stream)
2076 	ZEND_ARG_INFO(0, filtername)
2077 	ZEND_ARG_INFO(0, read_write)
2078 	ZEND_ARG_INFO(0, filterparams)
2079 ZEND_END_ARG_INFO()
2080 
2081 ZEND_BEGIN_ARG_INFO(arginfo_stream_filter_remove, 0)
2082 	ZEND_ARG_INFO(0, stream_filter)
2083 ZEND_END_ARG_INFO()
2084 
2085 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_get_line, 0, 0, 2)
2086 	ZEND_ARG_INFO(0, stream)
2087 	ZEND_ARG_INFO(0, maxlen)
2088 	ZEND_ARG_INFO(0, ending)
2089 ZEND_END_ARG_INFO()
2090 
2091 ZEND_BEGIN_ARG_INFO(arginfo_stream_set_blocking, 0)
2092 	ZEND_ARG_INFO(0, socket)
2093 	ZEND_ARG_INFO(0, mode)
2094 ZEND_END_ARG_INFO()
2095 
2096 #if HAVE_SYS_TIME_H || defined(PHP_WIN32)
2097 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_set_timeout, 0, 0, 2)
2098 	ZEND_ARG_INFO(0, stream)
2099 	ZEND_ARG_INFO(0, seconds)
2100 	ZEND_ARG_INFO(0, microseconds)
2101 ZEND_END_ARG_INFO()
2102 #endif
2103 
2104 ZEND_BEGIN_ARG_INFO(arginfo_stream_set_read_buffer, 0)
2105 	ZEND_ARG_INFO(0, fp)
2106 	ZEND_ARG_INFO(0, buffer)
2107 ZEND_END_ARG_INFO()
2108 
2109 ZEND_BEGIN_ARG_INFO(arginfo_stream_set_write_buffer, 0)
2110 	ZEND_ARG_INFO(0, fp)
2111 	ZEND_ARG_INFO(0, buffer)
2112 ZEND_END_ARG_INFO()
2113 
2114 ZEND_BEGIN_ARG_INFO(arginfo_stream_set_chunk_size, 0)
2115 	ZEND_ARG_INFO(0, fp)
2116 	ZEND_ARG_INFO(0, chunk_size)
2117 ZEND_END_ARG_INFO()
2118 
2119 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_enable_crypto, 0, 0, 2)
2120 	ZEND_ARG_INFO(0, stream)
2121 	ZEND_ARG_INFO(0, enable)
2122 	ZEND_ARG_INFO(0, cryptokind)
2123 	ZEND_ARG_INFO(0, sessionstream)
2124 ZEND_END_ARG_INFO()
2125 
2126 #ifdef HAVE_SHUTDOWN
2127 ZEND_BEGIN_ARG_INFO(arginfo_stream_socket_shutdown, 0)
2128 	ZEND_ARG_INFO(0, stream)
2129 	ZEND_ARG_INFO(0, how)
2130 ZEND_END_ARG_INFO()
2131 #endif
2132 /* }}} */
2133 /* {{{ string.c */
2134 ZEND_BEGIN_ARG_INFO(arginfo_bin2hex, 0)
2135 	ZEND_ARG_INFO(0, data)
2136 ZEND_END_ARG_INFO()
2137 
2138 ZEND_BEGIN_ARG_INFO(arginfo_hex2bin, 0)
2139 	ZEND_ARG_INFO(0, data)
2140 ZEND_END_ARG_INFO()
2141 
2142 ZEND_BEGIN_ARG_INFO_EX(arginfo_strspn, 0, 0, 2)
2143 	ZEND_ARG_INFO(0, str)
2144 	ZEND_ARG_INFO(0, mask)
2145 	ZEND_ARG_INFO(0, start)
2146 	ZEND_ARG_INFO(0, len)
2147 ZEND_END_ARG_INFO()
2148 
2149 ZEND_BEGIN_ARG_INFO_EX(arginfo_strcspn, 0, 0, 2)
2150 	ZEND_ARG_INFO(0, str)
2151 	ZEND_ARG_INFO(0, mask)
2152 	ZEND_ARG_INFO(0, start)
2153 	ZEND_ARG_INFO(0, len)
2154 ZEND_END_ARG_INFO()
2155 
2156 #if HAVE_NL_LANGINFO
2157 ZEND_BEGIN_ARG_INFO(arginfo_nl_langinfo, 0)
2158 	ZEND_ARG_INFO(0, item)
2159 ZEND_END_ARG_INFO()
2160 #endif
2161 
2162 #ifdef HAVE_STRCOLL
2163 ZEND_BEGIN_ARG_INFO(arginfo_strcoll, 0)
2164 	ZEND_ARG_INFO(0, str1)
2165 	ZEND_ARG_INFO(0, str2)
2166 ZEND_END_ARG_INFO()
2167 #endif
2168 
2169 ZEND_BEGIN_ARG_INFO_EX(arginfo_trim, 0, 0, 1)
2170 	ZEND_ARG_INFO(0, str)
2171 	ZEND_ARG_INFO(0, character_mask)
2172 ZEND_END_ARG_INFO()
2173 
2174 ZEND_BEGIN_ARG_INFO_EX(arginfo_rtrim, 0, 0, 1)
2175 	ZEND_ARG_INFO(0, str)
2176 	ZEND_ARG_INFO(0, character_mask)
2177 ZEND_END_ARG_INFO()
2178 
2179 ZEND_BEGIN_ARG_INFO_EX(arginfo_ltrim, 0, 0, 1)
2180 	ZEND_ARG_INFO(0, str)
2181 	ZEND_ARG_INFO(0, character_mask)
2182 ZEND_END_ARG_INFO()
2183 
2184 ZEND_BEGIN_ARG_INFO_EX(arginfo_wordwrap, 0, 0, 1)
2185 	ZEND_ARG_INFO(0, str)
2186 	ZEND_ARG_INFO(0, width)
2187 	ZEND_ARG_INFO(0, break)
2188 	ZEND_ARG_INFO(0, cut)
2189 ZEND_END_ARG_INFO()
2190 
2191 ZEND_BEGIN_ARG_INFO_EX(arginfo_explode, 0, 0, 2)
2192 	ZEND_ARG_INFO(0, separator)
2193 	ZEND_ARG_INFO(0, str)
2194 	ZEND_ARG_INFO(0, limit)
2195 ZEND_END_ARG_INFO()
2196 
2197 ZEND_BEGIN_ARG_INFO(arginfo_implode, 0)
2198 	ZEND_ARG_INFO(0, glue)
2199 	ZEND_ARG_INFO(0, pieces)
2200 ZEND_END_ARG_INFO()
2201 
2202 ZEND_BEGIN_ARG_INFO(arginfo_strtok, 0)
2203 	ZEND_ARG_INFO(0, str)
2204 	ZEND_ARG_INFO(0, token)
2205 ZEND_END_ARG_INFO()
2206 
2207 ZEND_BEGIN_ARG_INFO(arginfo_strtoupper, 0)
2208 	ZEND_ARG_INFO(0, str)
2209 ZEND_END_ARG_INFO()
2210 
2211 ZEND_BEGIN_ARG_INFO(arginfo_strtolower, 0)
2212 	ZEND_ARG_INFO(0, str)
2213 ZEND_END_ARG_INFO()
2214 
2215 ZEND_BEGIN_ARG_INFO_EX(arginfo_basename, 0, 0, 1)
2216 	ZEND_ARG_INFO(0, path)
2217 	ZEND_ARG_INFO(0, suffix)
2218 ZEND_END_ARG_INFO()
2219 
2220 ZEND_BEGIN_ARG_INFO_EX(arginfo_dirname, 0, 0, 1)
2221 	ZEND_ARG_INFO(0, path)
2222 	ZEND_ARG_INFO(0, levels)
2223 ZEND_END_ARG_INFO()
2224 
2225 ZEND_BEGIN_ARG_INFO_EX(arginfo_pathinfo, 0, 0, 1)
2226 	ZEND_ARG_INFO(0, path)
2227 	ZEND_ARG_INFO(0, options)
2228 ZEND_END_ARG_INFO()
2229 
2230 ZEND_BEGIN_ARG_INFO_EX(arginfo_stristr, 0, 0, 2)
2231 	ZEND_ARG_INFO(0, haystack)
2232 	ZEND_ARG_INFO(0, needle)
2233 	ZEND_ARG_INFO(0, part)
2234 ZEND_END_ARG_INFO()
2235 
2236 ZEND_BEGIN_ARG_INFO_EX(arginfo_strstr, 0, 0, 2)
2237 	ZEND_ARG_INFO(0, haystack)
2238 	ZEND_ARG_INFO(0, needle)
2239 	ZEND_ARG_INFO(0, part)
2240 ZEND_END_ARG_INFO()
2241 
2242 ZEND_BEGIN_ARG_INFO_EX(arginfo_strpos, 0, 0, 2)
2243 	ZEND_ARG_INFO(0, haystack)
2244 	ZEND_ARG_INFO(0, needle)
2245 	ZEND_ARG_INFO(0, offset)
2246 ZEND_END_ARG_INFO()
2247 
2248 ZEND_BEGIN_ARG_INFO_EX(arginfo_stripos, 0, 0, 2)
2249 	ZEND_ARG_INFO(0, haystack)
2250 	ZEND_ARG_INFO(0, needle)
2251 	ZEND_ARG_INFO(0, offset)
2252 ZEND_END_ARG_INFO()
2253 
2254 ZEND_BEGIN_ARG_INFO_EX(arginfo_strrpos, 0, 0, 2)
2255 	ZEND_ARG_INFO(0, haystack)
2256 	ZEND_ARG_INFO(0, needle)
2257 	ZEND_ARG_INFO(0, offset)
2258 ZEND_END_ARG_INFO()
2259 
2260 ZEND_BEGIN_ARG_INFO_EX(arginfo_strripos, 0, 0, 2)
2261 	ZEND_ARG_INFO(0, haystack)
2262 	ZEND_ARG_INFO(0, needle)
2263 	ZEND_ARG_INFO(0, offset)
2264 ZEND_END_ARG_INFO()
2265 
2266 ZEND_BEGIN_ARG_INFO(arginfo_strrchr, 0)
2267 	ZEND_ARG_INFO(0, haystack)
2268 	ZEND_ARG_INFO(0, needle)
2269 ZEND_END_ARG_INFO()
2270 
2271 ZEND_BEGIN_ARG_INFO_EX(arginfo_chunk_split, 0, 0, 1)
2272 	ZEND_ARG_INFO(0, str)
2273 	ZEND_ARG_INFO(0, chunklen)
2274 	ZEND_ARG_INFO(0, ending)
2275 ZEND_END_ARG_INFO()
2276 
2277 ZEND_BEGIN_ARG_INFO_EX(arginfo_substr, 0, 0, 2)
2278 	ZEND_ARG_INFO(0, str)
2279 	ZEND_ARG_INFO(0, start)
2280 	ZEND_ARG_INFO(0, length)
2281 ZEND_END_ARG_INFO()
2282 
2283 ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_replace, 0, 0, 3)
2284 	ZEND_ARG_INFO(0, str)
2285 	ZEND_ARG_INFO(0, replace)
2286 	ZEND_ARG_INFO(0, start)
2287 	ZEND_ARG_INFO(0, length)
2288 ZEND_END_ARG_INFO()
2289 
2290 ZEND_BEGIN_ARG_INFO(arginfo_quotemeta, 0)
2291 	ZEND_ARG_INFO(0, str)
2292 ZEND_END_ARG_INFO()
2293 
2294 ZEND_BEGIN_ARG_INFO(arginfo_ord, 0)
2295 	ZEND_ARG_INFO(0, character)
2296 ZEND_END_ARG_INFO()
2297 
2298 ZEND_BEGIN_ARG_INFO(arginfo_chr, 0)
2299 	ZEND_ARG_INFO(0, codepoint)
2300 ZEND_END_ARG_INFO()
2301 
2302 ZEND_BEGIN_ARG_INFO(arginfo_ucfirst, 0)
2303 	ZEND_ARG_INFO(0, str)
2304 ZEND_END_ARG_INFO()
2305 
2306 ZEND_BEGIN_ARG_INFO(arginfo_lcfirst, 0)
2307 	ZEND_ARG_INFO(0, str)
2308 ZEND_END_ARG_INFO()
2309 
2310 ZEND_BEGIN_ARG_INFO_EX(arginfo_ucwords, 0, 0, 1)
2311 	ZEND_ARG_INFO(0, str)
2312 	ZEND_ARG_INFO(0, delimiters)
2313 ZEND_END_ARG_INFO()
2314 
2315 ZEND_BEGIN_ARG_INFO_EX(arginfo_strtr, 0, 0, 2)
2316 	ZEND_ARG_INFO(0, str)
2317 	ZEND_ARG_INFO(0, from)
2318 	ZEND_ARG_INFO(0, to)
2319 ZEND_END_ARG_INFO()
2320 
2321 ZEND_BEGIN_ARG_INFO(arginfo_strrev, 0)
2322 	ZEND_ARG_INFO(0, str)
2323 ZEND_END_ARG_INFO()
2324 
2325 ZEND_BEGIN_ARG_INFO_EX(arginfo_similar_text, 0, 0, 2)
2326 	ZEND_ARG_INFO(0, str1)
2327 	ZEND_ARG_INFO(0, str2)
2328 	ZEND_ARG_INFO(1, percent)
2329 ZEND_END_ARG_INFO()
2330 
2331 ZEND_BEGIN_ARG_INFO(arginfo_addcslashes, 0)
2332 	ZEND_ARG_INFO(0, str)
2333 	ZEND_ARG_INFO(0, charlist)
2334 ZEND_END_ARG_INFO()
2335 
2336 ZEND_BEGIN_ARG_INFO(arginfo_addslashes, 0)
2337 	ZEND_ARG_INFO(0, str)
2338 ZEND_END_ARG_INFO()
2339 
2340 ZEND_BEGIN_ARG_INFO(arginfo_stripcslashes, 0)
2341 	ZEND_ARG_INFO(0, str)
2342 ZEND_END_ARG_INFO()
2343 
2344 ZEND_BEGIN_ARG_INFO(arginfo_stripslashes, 0)
2345 	ZEND_ARG_INFO(0, str)
2346 ZEND_END_ARG_INFO()
2347 
2348 ZEND_BEGIN_ARG_INFO_EX(arginfo_str_replace, 0, 0, 3)
2349 	ZEND_ARG_INFO(0, search)
2350 	ZEND_ARG_INFO(0, replace)
2351 	ZEND_ARG_INFO(0, subject)
2352 	ZEND_ARG_INFO(1, replace_count)
2353 ZEND_END_ARG_INFO()
2354 
2355 ZEND_BEGIN_ARG_INFO_EX(arginfo_str_ireplace, 0, 0, 3)
2356 	ZEND_ARG_INFO(0, search)
2357 	ZEND_ARG_INFO(0, replace)
2358 	ZEND_ARG_INFO(0, subject)
2359 	ZEND_ARG_INFO(1, replace_count)
2360 ZEND_END_ARG_INFO()
2361 
2362 ZEND_BEGIN_ARG_INFO_EX(arginfo_hebrev, 0, 0, 1)
2363 	ZEND_ARG_INFO(0, str)
2364 	ZEND_ARG_INFO(0, max_chars_per_line)
2365 ZEND_END_ARG_INFO()
2366 
2367 ZEND_BEGIN_ARG_INFO_EX(arginfo_hebrevc, 0, 0, 1)
2368 	ZEND_ARG_INFO(0, str)
2369 	ZEND_ARG_INFO(0, max_chars_per_line)
2370 ZEND_END_ARG_INFO()
2371 
2372 ZEND_BEGIN_ARG_INFO_EX(arginfo_nl2br, 0, 0, 1)
2373 	ZEND_ARG_INFO(0, str)
2374 	ZEND_ARG_INFO(0, is_xhtml)
2375 ZEND_END_ARG_INFO()
2376 
2377 ZEND_BEGIN_ARG_INFO_EX(arginfo_strip_tags, 0, 0, 1)
2378 	ZEND_ARG_INFO(0, str)
2379 	ZEND_ARG_INFO(0, allowable_tags)
2380 ZEND_END_ARG_INFO()
2381 
2382 ZEND_BEGIN_ARG_INFO_EX(arginfo_setlocale, 0, 0, 2)
2383 	ZEND_ARG_INFO(0, category)
2384 	ZEND_ARG_VARIADIC_INFO(0, locales)
2385 ZEND_END_ARG_INFO()
2386 
2387 ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_str, 0, 0, 1)
2388 	ZEND_ARG_INFO(0, encoded_string)
2389 	ZEND_ARG_INFO(1, result)
2390 ZEND_END_ARG_INFO()
2391 
2392 ZEND_BEGIN_ARG_INFO_EX(arginfo_str_getcsv, 0, 0, 1)
2393 	ZEND_ARG_INFO(0, string)
2394 	ZEND_ARG_INFO(0, delimiter)
2395 	ZEND_ARG_INFO(0, enclosure)
2396 	ZEND_ARG_INFO(0, escape)
2397 ZEND_END_ARG_INFO()
2398 
2399 ZEND_BEGIN_ARG_INFO(arginfo_str_repeat, 0)
2400 	ZEND_ARG_INFO(0, input)
2401 	ZEND_ARG_INFO(0, mult)
2402 ZEND_END_ARG_INFO()
2403 
2404 ZEND_BEGIN_ARG_INFO_EX(arginfo_count_chars, 0, 0, 1)
2405 	ZEND_ARG_INFO(0, input)
2406 	ZEND_ARG_INFO(0, mode)
2407 ZEND_END_ARG_INFO()
2408 
2409 ZEND_BEGIN_ARG_INFO(arginfo_strnatcmp, 0)
2410 	ZEND_ARG_INFO(0, s1)
2411 	ZEND_ARG_INFO(0, s2)
2412 ZEND_END_ARG_INFO()
2413 
2414 ZEND_BEGIN_ARG_INFO(arginfo_localeconv, 0)
2415 ZEND_END_ARG_INFO()
2416 
2417 ZEND_BEGIN_ARG_INFO(arginfo_strnatcasecmp, 0)
2418 	ZEND_ARG_INFO(0, s1)
2419 	ZEND_ARG_INFO(0, s2)
2420 ZEND_END_ARG_INFO()
2421 
2422 ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_count, 0, 0, 2)
2423 	ZEND_ARG_INFO(0, haystack)
2424 	ZEND_ARG_INFO(0, needle)
2425 	ZEND_ARG_INFO(0, offset)
2426 	ZEND_ARG_INFO(0, length)
2427 ZEND_END_ARG_INFO()
2428 
2429 ZEND_BEGIN_ARG_INFO_EX(arginfo_str_pad, 0, 0, 2)
2430 	ZEND_ARG_INFO(0, input)
2431 	ZEND_ARG_INFO(0, pad_length)
2432 	ZEND_ARG_INFO(0, pad_string)
2433 	ZEND_ARG_INFO(0, pad_type)
2434 ZEND_END_ARG_INFO()
2435 
2436 ZEND_BEGIN_ARG_INFO_EX(arginfo_sscanf, 0, 0, 2)
2437 	ZEND_ARG_INFO(0, str)
2438 	ZEND_ARG_INFO(0, format)
2439 	ZEND_ARG_VARIADIC_INFO(1, vars)
2440 ZEND_END_ARG_INFO()
2441 
2442 ZEND_BEGIN_ARG_INFO(arginfo_str_rot13, 0)
2443 	ZEND_ARG_INFO(0, str)
2444 ZEND_END_ARG_INFO()
2445 
2446 ZEND_BEGIN_ARG_INFO(arginfo_str_shuffle, 0)
2447 	ZEND_ARG_INFO(0, str)
2448 ZEND_END_ARG_INFO()
2449 
2450 ZEND_BEGIN_ARG_INFO_EX(arginfo_str_word_count, 0, 0, 1)
2451 	ZEND_ARG_INFO(0, str)
2452 	ZEND_ARG_INFO(0, format)
2453 	ZEND_ARG_INFO(0, charlist)
2454 ZEND_END_ARG_INFO()
2455 
2456 #ifdef HAVE_STRFMON
2457 ZEND_BEGIN_ARG_INFO(arginfo_money_format, 0)
2458 	ZEND_ARG_INFO(0, format)
2459 	ZEND_ARG_INFO(0, value)
2460 ZEND_END_ARG_INFO()
2461 #endif
2462 
2463 ZEND_BEGIN_ARG_INFO_EX(arginfo_str_split, 0, 0, 1)
2464 	ZEND_ARG_INFO(0, str)
2465 	ZEND_ARG_INFO(0, split_length)
2466 ZEND_END_ARG_INFO()
2467 
2468 ZEND_BEGIN_ARG_INFO_EX(arginfo_strpbrk, 0, 0, 1)
2469 	ZEND_ARG_INFO(0, haystack)
2470 	ZEND_ARG_INFO(0, char_list)
2471 ZEND_END_ARG_INFO()
2472 
2473 ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_compare, 0, 0, 3)
2474 	ZEND_ARG_INFO(0, main_str)
2475 	ZEND_ARG_INFO(0, str)
2476 	ZEND_ARG_INFO(0, offset)
2477 	ZEND_ARG_INFO(0, length)
2478 	ZEND_ARG_INFO(0, case_sensitivity)
2479 ZEND_END_ARG_INFO()
2480 /* }}} */
2481 /* {{{ syslog.c */
2482 #ifdef HAVE_SYSLOG_H
2483 ZEND_BEGIN_ARG_INFO(arginfo_openlog, 0)
2484 	ZEND_ARG_INFO(0, ident)
2485 	ZEND_ARG_INFO(0, option)
2486 	ZEND_ARG_INFO(0, facility)
2487 ZEND_END_ARG_INFO()
2488 
2489 ZEND_BEGIN_ARG_INFO(arginfo_closelog, 0)
2490 ZEND_END_ARG_INFO()
2491 
2492 ZEND_BEGIN_ARG_INFO(arginfo_syslog, 0)
2493 	ZEND_ARG_INFO(0, priority)
2494 	ZEND_ARG_INFO(0, message)
2495 ZEND_END_ARG_INFO()
2496 #endif
2497 /* }}} */
2498 /* {{{ type.c */
2499 ZEND_BEGIN_ARG_INFO(arginfo_gettype, 0)
2500 	ZEND_ARG_INFO(0, var)
2501 ZEND_END_ARG_INFO()
2502 
2503 ZEND_BEGIN_ARG_INFO(arginfo_settype, 0)
2504 	ZEND_ARG_INFO(1, var)
2505 	ZEND_ARG_INFO(0, type)
2506 ZEND_END_ARG_INFO()
2507 
2508 ZEND_BEGIN_ARG_INFO_EX(arginfo_intval, 0, 0, 1)
2509 	ZEND_ARG_INFO(0, var)
2510 	ZEND_ARG_INFO(0, base)
2511 ZEND_END_ARG_INFO()
2512 
2513 ZEND_BEGIN_ARG_INFO(arginfo_floatval, 0)
2514 	ZEND_ARG_INFO(0, var)
2515 ZEND_END_ARG_INFO()
2516 
2517 ZEND_BEGIN_ARG_INFO(arginfo_strval, 0)
2518 	ZEND_ARG_INFO(0, var)
2519 ZEND_END_ARG_INFO()
2520 
2521 ZEND_BEGIN_ARG_INFO(arginfo_boolval, 0)
2522 	ZEND_ARG_INFO(0, var)
2523 ZEND_END_ARG_INFO()
2524 
2525 ZEND_BEGIN_ARG_INFO(arginfo_is_null, 0)
2526 	ZEND_ARG_INFO(0, var)
2527 ZEND_END_ARG_INFO()
2528 
2529 ZEND_BEGIN_ARG_INFO(arginfo_is_resource, 0)
2530 	ZEND_ARG_INFO(0, var)
2531 ZEND_END_ARG_INFO()
2532 
2533 ZEND_BEGIN_ARG_INFO(arginfo_is_bool, 0)
2534 	ZEND_ARG_INFO(0, var)
2535 ZEND_END_ARG_INFO()
2536 
2537 ZEND_BEGIN_ARG_INFO(arginfo_is_int, 0)
2538 	ZEND_ARG_INFO(0, var)
2539 ZEND_END_ARG_INFO()
2540 
2541 ZEND_BEGIN_ARG_INFO(arginfo_is_float, 0)
2542 	ZEND_ARG_INFO(0, var)
2543 ZEND_END_ARG_INFO()
2544 
2545 ZEND_BEGIN_ARG_INFO(arginfo_is_string, 0)
2546 	ZEND_ARG_INFO(0, var)
2547 ZEND_END_ARG_INFO()
2548 
2549 ZEND_BEGIN_ARG_INFO(arginfo_is_array, 0)
2550 	ZEND_ARG_INFO(0, var)
2551 ZEND_END_ARG_INFO()
2552 
2553 ZEND_BEGIN_ARG_INFO(arginfo_is_object, 0)
2554 	ZEND_ARG_INFO(0, var)
2555 ZEND_END_ARG_INFO()
2556 
2557 ZEND_BEGIN_ARG_INFO(arginfo_is_numeric, 0)
2558 	ZEND_ARG_INFO(0, value)
2559 ZEND_END_ARG_INFO()
2560 
2561 ZEND_BEGIN_ARG_INFO(arginfo_is_scalar, 0)
2562 	ZEND_ARG_INFO(0, value)
2563 ZEND_END_ARG_INFO()
2564 
2565 ZEND_BEGIN_ARG_INFO_EX(arginfo_is_callable, 0, 0, 1)
2566 	ZEND_ARG_INFO(0, var)
2567 	ZEND_ARG_INFO(0, syntax_only)
2568 	ZEND_ARG_INFO(1, callable_name)
2569 ZEND_END_ARG_INFO()
2570 /* }}} */
2571 /* {{{ uniqid.c */
2572 #ifdef HAVE_GETTIMEOFDAY
2573 ZEND_BEGIN_ARG_INFO_EX(arginfo_uniqid, 0, 0, 0)
2574 	ZEND_ARG_INFO(0, prefix)
2575 	ZEND_ARG_INFO(0, more_entropy)
2576 ZEND_END_ARG_INFO()
2577 #endif
2578 /* }}} */
2579 /* {{{ url.c */
2580 ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_url, 0, 0, 1)
2581 	ZEND_ARG_INFO(0, url)
2582 	ZEND_ARG_INFO(0, component)
2583 ZEND_END_ARG_INFO()
2584 
2585 ZEND_BEGIN_ARG_INFO(arginfo_urlencode, 0)
2586 	ZEND_ARG_INFO(0, str)
2587 ZEND_END_ARG_INFO()
2588 
2589 ZEND_BEGIN_ARG_INFO(arginfo_urldecode, 0)
2590 	ZEND_ARG_INFO(0, str)
2591 ZEND_END_ARG_INFO()
2592 
2593 ZEND_BEGIN_ARG_INFO(arginfo_rawurlencode, 0)
2594 	ZEND_ARG_INFO(0, str)
2595 ZEND_END_ARG_INFO()
2596 
2597 ZEND_BEGIN_ARG_INFO(arginfo_rawurldecode, 0)
2598 	ZEND_ARG_INFO(0, str)
2599 ZEND_END_ARG_INFO()
2600 
2601 ZEND_BEGIN_ARG_INFO_EX(arginfo_get_headers, 0, 0, 1)
2602 	ZEND_ARG_INFO(0, url)
2603 	ZEND_ARG_INFO(0, format)
2604 ZEND_END_ARG_INFO()
2605 /* }}} */
2606 /* {{{ user_filters.c */
2607 ZEND_BEGIN_ARG_INFO(arginfo_stream_bucket_make_writeable, 0)
2608 	ZEND_ARG_INFO(0, brigade)
2609 ZEND_END_ARG_INFO()
2610 
2611 ZEND_BEGIN_ARG_INFO(arginfo_stream_bucket_prepend, 0)
2612 	ZEND_ARG_INFO(0, brigade)
2613 	ZEND_ARG_INFO(0, bucket)
2614 ZEND_END_ARG_INFO()
2615 
2616 ZEND_BEGIN_ARG_INFO(arginfo_stream_bucket_append, 0)
2617 	ZEND_ARG_INFO(0, brigade)
2618 	ZEND_ARG_INFO(0, bucket)
2619 ZEND_END_ARG_INFO()
2620 
2621 ZEND_BEGIN_ARG_INFO(arginfo_stream_bucket_new, 0)
2622 	ZEND_ARG_INFO(0, stream)
2623 	ZEND_ARG_INFO(0, buffer)
2624 ZEND_END_ARG_INFO()
2625 
2626 ZEND_BEGIN_ARG_INFO(arginfo_stream_get_filters, 0)
2627 ZEND_END_ARG_INFO()
2628 
2629 ZEND_BEGIN_ARG_INFO(arginfo_stream_filter_register, 0)
2630 	ZEND_ARG_INFO(0, filtername)
2631 	ZEND_ARG_INFO(0, classname)
2632 ZEND_END_ARG_INFO()
2633 /* }}} */
2634 /* {{{ uuencode.c */
2635 ZEND_BEGIN_ARG_INFO(arginfo_convert_uuencode, 0)
2636 	ZEND_ARG_INFO(0, data)
2637 ZEND_END_ARG_INFO()
2638 
2639 ZEND_BEGIN_ARG_INFO(arginfo_convert_uudecode, 0)
2640 	ZEND_ARG_INFO(0, data)
2641 ZEND_END_ARG_INFO()
2642 /* }}} */
2643 /* {{{ var.c */
2644 ZEND_BEGIN_ARG_INFO_EX(arginfo_var_dump, 0, 0, 1)
2645 	ZEND_ARG_VARIADIC_INFO(0, vars)
2646 ZEND_END_ARG_INFO()
2647 
2648 ZEND_BEGIN_ARG_INFO_EX(arginfo_debug_zval_dump, 0, 0, 1)
2649 	ZEND_ARG_VARIADIC_INFO(0, vars)
2650 ZEND_END_ARG_INFO()
2651 
2652 ZEND_BEGIN_ARG_INFO_EX(arginfo_var_export, 0, 0, 1)
2653 	ZEND_ARG_INFO(0, var)
2654 	ZEND_ARG_INFO(0, return)
2655 ZEND_END_ARG_INFO()
2656 
2657 ZEND_BEGIN_ARG_INFO(arginfo_serialize, 0)
2658 	ZEND_ARG_INFO(0, var)
2659 ZEND_END_ARG_INFO()
2660 
2661 ZEND_BEGIN_ARG_INFO_EX(arginfo_unserialize, 0, 0, 1)
2662 	ZEND_ARG_INFO(0, variable_representation)
2663 	ZEND_ARG_INFO(0, allowed_classes)
2664 ZEND_END_ARG_INFO()
2665 
2666 ZEND_BEGIN_ARG_INFO_EX(arginfo_memory_get_usage, 0, 0, 0)
2667 	ZEND_ARG_INFO(0, real_usage)
2668 ZEND_END_ARG_INFO()
2669 
2670 ZEND_BEGIN_ARG_INFO_EX(arginfo_memory_get_peak_usage, 0, 0, 0)
2671 	ZEND_ARG_INFO(0, real_usage)
2672 ZEND_END_ARG_INFO()
2673 /* }}} */
2674 /* {{{ versioning.c */
2675 ZEND_BEGIN_ARG_INFO_EX(arginfo_version_compare, 0, 0, 2)
2676 	ZEND_ARG_INFO(0, ver1)
2677 	ZEND_ARG_INFO(0, ver2)
2678 	ZEND_ARG_INFO(0, oper)
2679 ZEND_END_ARG_INFO()
2680 /* }}} */
2681 /* }}} */
2682 
2683 const zend_function_entry basic_functions[] = { /* {{{ */
2684 	PHP_FE(constant,														arginfo_constant)
2685 	PHP_FE(bin2hex,															arginfo_bin2hex)
2686 	PHP_FE(hex2bin,															arginfo_hex2bin)
2687 	PHP_FE(sleep,															arginfo_sleep)
2688 	PHP_FE(usleep,															arginfo_usleep)
2689 #if HAVE_NANOSLEEP
2690 	PHP_FE(time_nanosleep,													arginfo_time_nanosleep)
2691 	PHP_FE(time_sleep_until,												arginfo_time_sleep_until)
2692 #endif
2693 
2694 #if HAVE_STRPTIME
2695 	PHP_FE(strptime,														arginfo_strptime)
2696 #endif
2697 
2698 	PHP_FE(flush,															arginfo_flush)
2699 	PHP_FE(wordwrap,														arginfo_wordwrap)
2700 	PHP_FE(htmlspecialchars,												arginfo_htmlspecialchars)
2701 	PHP_FE(htmlentities,													arginfo_htmlentities)
2702 	PHP_FE(html_entity_decode,												arginfo_html_entity_decode)
2703 	PHP_FE(htmlspecialchars_decode,											arginfo_htmlspecialchars_decode)
2704 	PHP_FE(get_html_translation_table,										arginfo_get_html_translation_table)
2705 	PHP_FE(sha1,															arginfo_sha1)
2706 	PHP_FE(sha1_file,														arginfo_sha1_file)
2707 	PHP_NAMED_FE(md5,php_if_md5,											arginfo_md5)
2708 	PHP_NAMED_FE(md5_file,php_if_md5_file,									arginfo_md5_file)
2709 	PHP_NAMED_FE(crc32,php_if_crc32,										arginfo_crc32)
2710 
2711 	PHP_FE(iptcparse,														arginfo_iptcparse)
2712 	PHP_FE(iptcembed,														arginfo_iptcembed)
2713 	PHP_FE(getimagesize,													arginfo_getimagesize)
2714 	PHP_FE(getimagesizefromstring,											arginfo_getimagesize)
2715 	PHP_FE(image_type_to_mime_type,											arginfo_image_type_to_mime_type)
2716 	PHP_FE(image_type_to_extension,											arginfo_image_type_to_extension)
2717 
2718 	PHP_FE(phpinfo,															arginfo_phpinfo)
2719 	PHP_FE(phpversion,														arginfo_phpversion)
2720 	PHP_FE(phpcredits,														arginfo_phpcredits)
2721 	PHP_FE(php_sapi_name,													arginfo_php_sapi_name)
2722 	PHP_FE(php_uname,														arginfo_php_uname)
2723 	PHP_FE(php_ini_scanned_files,											arginfo_php_ini_scanned_files)
2724 	PHP_FE(php_ini_loaded_file,												arginfo_php_ini_loaded_file)
2725 
2726 	PHP_FE(strnatcmp,														arginfo_strnatcmp)
2727 	PHP_FE(strnatcasecmp,													arginfo_strnatcasecmp)
2728 	PHP_FE(substr_count,													arginfo_substr_count)
2729 	PHP_FE(strspn,															arginfo_strspn)
2730 	PHP_FE(strcspn,															arginfo_strcspn)
2731 	PHP_FE(strtok,															arginfo_strtok)
2732 	PHP_FE(strtoupper,														arginfo_strtoupper)
2733 	PHP_FE(strtolower,														arginfo_strtolower)
2734 	PHP_FE(strpos,															arginfo_strpos)
2735 	PHP_FE(stripos,															arginfo_stripos)
2736 	PHP_FE(strrpos,															arginfo_strrpos)
2737 	PHP_FE(strripos,														arginfo_strripos)
2738 	PHP_FE(strrev,															arginfo_strrev)
2739 	PHP_FE(hebrev,															arginfo_hebrev)
2740 	PHP_FE(hebrevc,															arginfo_hebrevc)
2741 	PHP_FE(nl2br,															arginfo_nl2br)
2742 	PHP_FE(basename,														arginfo_basename)
2743 	PHP_FE(dirname,															arginfo_dirname)
2744 	PHP_FE(pathinfo,														arginfo_pathinfo)
2745 	PHP_FE(stripslashes,													arginfo_stripslashes)
2746 	PHP_FE(stripcslashes,													arginfo_stripcslashes)
2747 	PHP_FE(strstr,															arginfo_strstr)
2748 	PHP_FE(stristr,															arginfo_stristr)
2749 	PHP_FE(strrchr,															arginfo_strrchr)
2750 	PHP_FE(str_shuffle,														arginfo_str_shuffle)
2751 	PHP_FE(str_word_count,													arginfo_str_word_count)
2752 	PHP_FE(str_split,														arginfo_str_split)
2753 	PHP_FE(strpbrk,															arginfo_strpbrk)
2754 	PHP_FE(substr_compare,													arginfo_substr_compare)
2755 
2756 #ifdef HAVE_STRCOLL
2757 	PHP_FE(strcoll,															arginfo_strcoll)
2758 #endif
2759 
2760 #ifdef HAVE_STRFMON
2761 	PHP_FE(money_format,													arginfo_money_format)
2762 #endif
2763 
2764 	PHP_FE(substr,															arginfo_substr)
2765 	PHP_FE(substr_replace,													arginfo_substr_replace)
2766 	PHP_FE(quotemeta,														arginfo_quotemeta)
2767 	PHP_FE(ucfirst,															arginfo_ucfirst)
2768 	PHP_FE(lcfirst,															arginfo_lcfirst)
2769 	PHP_FE(ucwords,															arginfo_ucwords)
2770 	PHP_FE(strtr,															arginfo_strtr)
2771 	PHP_FE(addslashes,														arginfo_addslashes)
2772 	PHP_FE(addcslashes,														arginfo_addcslashes)
2773 	PHP_FE(rtrim,															arginfo_rtrim)
2774 	PHP_FE(str_replace,														arginfo_str_replace)
2775 	PHP_FE(str_ireplace,													arginfo_str_ireplace)
2776 	PHP_FE(str_repeat,														arginfo_str_repeat)
2777 	PHP_FE(count_chars,														arginfo_count_chars)
2778 	PHP_FE(chunk_split,														arginfo_chunk_split)
2779 	PHP_FE(trim,															arginfo_trim)
2780 	PHP_FE(ltrim,															arginfo_ltrim)
2781 	PHP_FE(strip_tags,														arginfo_strip_tags)
2782 	PHP_FE(similar_text,													arginfo_similar_text)
2783 	PHP_FE(explode,															arginfo_explode)
2784 	PHP_FE(implode,															arginfo_implode)
2785 	PHP_FALIAS(join,				implode,								arginfo_implode)
2786 	PHP_FE(setlocale,														arginfo_setlocale)
2787 	PHP_FE(localeconv,														arginfo_localeconv)
2788 
2789 #if HAVE_NL_LANGINFO
2790 	PHP_FE(nl_langinfo,														arginfo_nl_langinfo)
2791 #endif
2792 
2793 	PHP_FE(soundex,															arginfo_soundex)
2794 	PHP_FE(levenshtein,														arginfo_levenshtein)
2795 	PHP_FE(chr,																arginfo_chr)
2796 	PHP_FE(ord,																arginfo_ord)
2797 	PHP_FE(parse_str,														arginfo_parse_str)
2798 	PHP_FE(str_getcsv,														arginfo_str_getcsv)
2799 	PHP_FE(str_pad,															arginfo_str_pad)
2800 	PHP_FALIAS(chop,				rtrim,									arginfo_rtrim)
2801 	PHP_FALIAS(strchr,				strstr,									arginfo_strstr)
2802 	PHP_NAMED_FE(sprintf,			PHP_FN(user_sprintf),					arginfo_sprintf)
2803 	PHP_NAMED_FE(printf,			PHP_FN(user_printf),					arginfo_printf)
2804 	PHP_FE(vprintf,															arginfo_vprintf)
2805 	PHP_FE(vsprintf,														arginfo_vsprintf)
2806 	PHP_FE(fprintf,															arginfo_fprintf)
2807 	PHP_FE(vfprintf,														arginfo_vfprintf)
2808 	PHP_FE(sscanf,															arginfo_sscanf)
2809 	PHP_FE(fscanf,															arginfo_fscanf)
2810 	PHP_FE(parse_url,														arginfo_parse_url)
2811 	PHP_FE(urlencode,														arginfo_urlencode)
2812 	PHP_FE(urldecode,														arginfo_urldecode)
2813 	PHP_FE(rawurlencode,													arginfo_rawurlencode)
2814 	PHP_FE(rawurldecode,													arginfo_rawurldecode)
2815 	PHP_FE(http_build_query,												arginfo_http_build_query)
2816 
2817 #if defined(HAVE_SYMLINK) || defined(PHP_WIN32)
2818 	PHP_FE(readlink,														arginfo_readlink)
2819 	PHP_FE(linkinfo,														arginfo_linkinfo)
2820 	PHP_FE(symlink,															arginfo_symlink)
2821 	PHP_FE(link,															arginfo_link)
2822 #endif
2823 
2824 	PHP_FE(unlink,															arginfo_unlink)
2825 	PHP_FE(exec,															arginfo_exec)
2826 	PHP_FE(system,															arginfo_system)
2827 	PHP_FE(escapeshellcmd,													arginfo_escapeshellcmd)
2828 	PHP_FE(escapeshellarg,													arginfo_escapeshellarg)
2829 	PHP_FE(passthru,														arginfo_passthru)
2830 	PHP_FE(shell_exec,														arginfo_shell_exec)
2831 #ifdef PHP_CAN_SUPPORT_PROC_OPEN
2832 	PHP_FE(proc_open,														arginfo_proc_open)
2833 	PHP_FE(proc_close,														arginfo_proc_close)
2834 	PHP_FE(proc_terminate,													arginfo_proc_terminate)
2835 	PHP_FE(proc_get_status,													arginfo_proc_get_status)
2836 #endif
2837 
2838 #ifdef HAVE_NICE
2839 	PHP_FE(proc_nice,														arginfo_proc_nice)
2840 #endif
2841 
2842 	PHP_FE(rand,															arginfo_rand)
2843 	PHP_FE(srand,															arginfo_srand)
2844 	PHP_FE(getrandmax,													arginfo_getrandmax)
2845 	PHP_FE(mt_rand,														arginfo_mt_rand)
2846 	PHP_FE(mt_srand,														arginfo_mt_srand)
2847 	PHP_FE(mt_getrandmax,													arginfo_mt_getrandmax)
2848 
2849 	PHP_FE(random_bytes,													arginfo_random_bytes)
2850 	PHP_FE(random_int,													arginfo_random_int)
2851 
2852 #if HAVE_GETSERVBYNAME
2853 	PHP_FE(getservbyname,													arginfo_getservbyname)
2854 #endif
2855 
2856 #if HAVE_GETSERVBYPORT
2857 	PHP_FE(getservbyport,													arginfo_getservbyport)
2858 #endif
2859 
2860 #if HAVE_GETPROTOBYNAME
2861 	PHP_FE(getprotobyname,													arginfo_getprotobyname)
2862 #endif
2863 
2864 #if HAVE_GETPROTOBYNUMBER
2865 	PHP_FE(getprotobynumber,												arginfo_getprotobynumber)
2866 #endif
2867 
2868 	PHP_FE(getmyuid,														arginfo_getmyuid)
2869 	PHP_FE(getmygid,														arginfo_getmygid)
2870 	PHP_FE(getmypid,														arginfo_getmypid)
2871 	PHP_FE(getmyinode,														arginfo_getmyinode)
2872 	PHP_FE(getlastmod,														arginfo_getlastmod)
2873 
2874 	PHP_FE(base64_decode,													arginfo_base64_decode)
2875 	PHP_FE(base64_encode,													arginfo_base64_encode)
2876 
2877 	PHP_FE(password_hash,													arginfo_password_hash)
2878 	PHP_FE(password_get_info,												arginfo_password_get_info)
2879 	PHP_FE(password_needs_rehash,											arginfo_password_needs_rehash)
2880 	PHP_FE(password_verify,													arginfo_password_verify)
2881 	PHP_FE(convert_uuencode,												arginfo_convert_uuencode)
2882 	PHP_FE(convert_uudecode,												arginfo_convert_uudecode)
2883 
2884 	PHP_FE(abs,																arginfo_abs)
2885 	PHP_FE(ceil,															arginfo_ceil)
2886 	PHP_FE(floor,															arginfo_floor)
2887 	PHP_FE(round,															arginfo_round)
2888 	PHP_FE(sin,																arginfo_sin)
2889 	PHP_FE(cos,																arginfo_cos)
2890 	PHP_FE(tan,																arginfo_tan)
2891 	PHP_FE(asin,															arginfo_asin)
2892 	PHP_FE(acos,															arginfo_acos)
2893 	PHP_FE(atan,															arginfo_atan)
2894 	PHP_FE(atanh,															arginfo_atanh)
2895 	PHP_FE(atan2,															arginfo_atan2)
2896 	PHP_FE(sinh,															arginfo_sinh)
2897 	PHP_FE(cosh,															arginfo_cosh)
2898 	PHP_FE(tanh,															arginfo_tanh)
2899 	PHP_FE(asinh,															arginfo_asinh)
2900 	PHP_FE(acosh,															arginfo_acosh)
2901 	PHP_FE(expm1,															arginfo_expm1)
2902 	PHP_FE(log1p,															arginfo_log1p)
2903 	PHP_FE(pi,																arginfo_pi)
2904 	PHP_FE(is_finite,														arginfo_is_finite)
2905 	PHP_FE(is_nan,															arginfo_is_nan)
2906 	PHP_FE(is_infinite,														arginfo_is_infinite)
2907 	PHP_FE(pow,																arginfo_pow)
2908 	PHP_FE(exp,																arginfo_exp)
2909 	PHP_FE(log,																arginfo_log)
2910 	PHP_FE(log10,															arginfo_log10)
2911 	PHP_FE(sqrt,															arginfo_sqrt)
2912 	PHP_FE(hypot,															arginfo_hypot)
2913 	PHP_FE(deg2rad,															arginfo_deg2rad)
2914 	PHP_FE(rad2deg,															arginfo_rad2deg)
2915 	PHP_FE(bindec,															arginfo_bindec)
2916 	PHP_FE(hexdec,															arginfo_hexdec)
2917 	PHP_FE(octdec,															arginfo_octdec)
2918 	PHP_FE(decbin,															arginfo_decbin)
2919 	PHP_FE(decoct,															arginfo_decoct)
2920 	PHP_FE(dechex,															arginfo_dechex)
2921 	PHP_FE(base_convert,													arginfo_base_convert)
2922 	PHP_FE(number_format,													arginfo_number_format)
2923 	PHP_FE(fmod,															arginfo_fmod)
2924 	PHP_FE(intdiv,															arginfo_intdiv)
2925 #ifdef HAVE_INET_NTOP
2926 	PHP_RAW_NAMED_FE(inet_ntop,		php_inet_ntop,								arginfo_inet_ntop)
2927 #endif
2928 #ifdef HAVE_INET_PTON
2929 	PHP_RAW_NAMED_FE(inet_pton,		php_inet_pton,								arginfo_inet_pton)
2930 #endif
2931 	PHP_FE(ip2long,															arginfo_ip2long)
2932 	PHP_FE(long2ip,															arginfo_long2ip)
2933 
2934 	PHP_FE(getenv,															arginfo_getenv)
2935 #ifdef HAVE_PUTENV
2936 	PHP_FE(putenv,															arginfo_putenv)
2937 #endif
2938 
2939 	PHP_FE(getopt,															arginfo_getopt)
2940 
2941 #ifdef HAVE_GETLOADAVG
2942 	PHP_FE(sys_getloadavg,													arginfo_sys_getloadavg)
2943 #endif
2944 #ifdef HAVE_GETTIMEOFDAY
2945 	PHP_FE(microtime,														arginfo_microtime)
2946 	PHP_FE(gettimeofday,													arginfo_gettimeofday)
2947 #endif
2948 
2949 #ifdef HAVE_GETRUSAGE
2950 	PHP_FE(getrusage,														arginfo_getrusage)
2951 #endif
2952 
2953 #ifdef HAVE_GETTIMEOFDAY
2954 	PHP_FE(uniqid,															arginfo_uniqid)
2955 #endif
2956 
2957 	PHP_FE(quoted_printable_decode,											arginfo_quoted_printable_decode)
2958 	PHP_FE(quoted_printable_encode,											arginfo_quoted_printable_encode)
2959 	PHP_FE(convert_cyr_string,												arginfo_convert_cyr_string)
2960 	PHP_FE(get_current_user,												arginfo_get_current_user)
2961 	PHP_FE(set_time_limit,													arginfo_set_time_limit)
2962 	PHP_FE(header_register_callback,										arginfo_header_register_callback)
2963 	PHP_FE(get_cfg_var,														arginfo_get_cfg_var)
2964 
2965 	PHP_FE(get_magic_quotes_gpc,										arginfo_get_magic_quotes_gpc)
2966 	PHP_FE(get_magic_quotes_runtime,									arginfo_get_magic_quotes_runtime)
2967 
2968 	PHP_FE(error_log,														arginfo_error_log)
2969 	PHP_FE(error_get_last,													arginfo_error_get_last)
2970 	PHP_FE(error_clear_last,													arginfo_error_clear_last)
2971 	PHP_FE(call_user_func,													arginfo_call_user_func)
2972 	PHP_FE(call_user_func_array,											arginfo_call_user_func_array)
2973 	PHP_FE(forward_static_call,											arginfo_forward_static_call)
2974 	PHP_FE(forward_static_call_array,										arginfo_forward_static_call_array)
2975 	PHP_FE(serialize,														arginfo_serialize)
2976 	PHP_FE(unserialize,														arginfo_unserialize)
2977 
2978 	PHP_FE(var_dump,														arginfo_var_dump)
2979 	PHP_FE(var_export,														arginfo_var_export)
2980 	PHP_FE(debug_zval_dump,													arginfo_debug_zval_dump)
2981 	PHP_FE(print_r,															arginfo_print_r)
2982 	PHP_FE(memory_get_usage,												arginfo_memory_get_usage)
2983 	PHP_FE(memory_get_peak_usage,											arginfo_memory_get_peak_usage)
2984 
2985 	PHP_FE(register_shutdown_function,										arginfo_register_shutdown_function)
2986 	PHP_FE(register_tick_function,											arginfo_register_tick_function)
2987 	PHP_FE(unregister_tick_function,										arginfo_unregister_tick_function)
2988 
2989 	PHP_FE(highlight_file,													arginfo_highlight_file)
2990 	PHP_FALIAS(show_source,			highlight_file,							arginfo_highlight_file)
2991 	PHP_FE(highlight_string,												arginfo_highlight_string)
2992 	PHP_FE(php_strip_whitespace,											arginfo_php_strip_whitespace)
2993 
2994 	PHP_FE(ini_get,															arginfo_ini_get)
2995 	PHP_FE(ini_get_all,														arginfo_ini_get_all)
2996 	PHP_FE(ini_set,															arginfo_ini_set)
2997 	PHP_FALIAS(ini_alter,			ini_set,								arginfo_ini_set)
2998 	PHP_FE(ini_restore,														arginfo_ini_restore)
2999 	PHP_FE(get_include_path,												arginfo_get_include_path)
3000 	PHP_FE(set_include_path,												arginfo_set_include_path)
3001 	PHP_FE(restore_include_path,											arginfo_restore_include_path)
3002 
3003 	PHP_FE(setcookie,														arginfo_setcookie)
3004 	PHP_FE(setrawcookie,													arginfo_setrawcookie)
3005 	PHP_FE(header,															arginfo_header)
3006 	PHP_FE(header_remove,													arginfo_header_remove)
3007 	PHP_FE(headers_sent,													arginfo_headers_sent)
3008 	PHP_FE(headers_list,													arginfo_headers_list)
3009 	PHP_FE(http_response_code,												arginfo_http_response_code)
3010 
3011 	PHP_FE(connection_aborted,												arginfo_connection_aborted)
3012 	PHP_FE(connection_status,												arginfo_connection_status)
3013 	PHP_FE(ignore_user_abort,												arginfo_ignore_user_abort)
3014 	PHP_FE(parse_ini_file,													arginfo_parse_ini_file)
3015 	PHP_FE(parse_ini_string,												arginfo_parse_ini_string)
3016 #if ZEND_DEBUG
3017 	PHP_FE(config_get_hash,													arginfo_config_get_hash)
3018 #endif
3019 	PHP_FE(is_uploaded_file,												arginfo_is_uploaded_file)
3020 	PHP_FE(move_uploaded_file,												arginfo_move_uploaded_file)
3021 
3022 	/* functions from dns.c */
3023 	PHP_FE(gethostbyaddr,													arginfo_gethostbyaddr)
3024 	PHP_FE(gethostbyname,													arginfo_gethostbyname)
3025 	PHP_FE(gethostbynamel,													arginfo_gethostbynamel)
3026 
3027 #ifdef HAVE_GETHOSTNAME
3028 	PHP_FE(gethostname,													arginfo_gethostname)
3029 #endif
3030 
3031 #if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE)))
3032 
3033 	PHP_FE(dns_check_record,												arginfo_dns_check_record)
3034 	PHP_FALIAS(checkdnsrr,			dns_check_record,						arginfo_dns_check_record)
3035 
3036 # if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS
3037 	PHP_FE(dns_get_mx,														arginfo_dns_get_mx)
3038 	PHP_FALIAS(getmxrr,				dns_get_mx,					arginfo_dns_get_mx)
3039 	PHP_FE(dns_get_record,													arginfo_dns_get_record)
3040 # endif
3041 #endif
3042 
3043 	/* functions from type.c */
3044 	PHP_FE(intval,															arginfo_intval)
3045 	PHP_FE(floatval,														arginfo_floatval)
3046 	PHP_FALIAS(doubleval,			floatval,								arginfo_floatval)
3047 	PHP_FE(strval,															arginfo_strval)
3048 	PHP_FE(boolval,															arginfo_boolval)
3049 	PHP_FE(gettype,															arginfo_gettype)
3050 	PHP_FE(settype,															arginfo_settype)
3051 	PHP_FE(is_null,															arginfo_is_null)
3052 	PHP_FE(is_resource,														arginfo_is_resource)
3053 	PHP_FE(is_bool,															arginfo_is_bool)
3054 	PHP_FE(is_int,															arginfo_is_int)
3055 	PHP_FE(is_float,														arginfo_is_float)
3056 	PHP_FALIAS(is_integer,			is_int,									arginfo_is_int)
3057 	PHP_FALIAS(is_long,				is_int,									arginfo_is_int)
3058 	PHP_FALIAS(is_double,			is_float,								arginfo_is_float)
3059 	PHP_FALIAS(is_real,				is_float,								arginfo_is_float)
3060 	PHP_FE(is_numeric,														arginfo_is_numeric)
3061 	PHP_FE(is_string,														arginfo_is_string)
3062 	PHP_FE(is_array,														arginfo_is_array)
3063 	PHP_FE(is_object,														arginfo_is_object)
3064 	PHP_FE(is_scalar,														arginfo_is_scalar)
3065 	PHP_FE(is_callable,														arginfo_is_callable)
3066 
3067 	/* functions from file.c */
3068 	PHP_FE(pclose,															arginfo_pclose)
3069 	PHP_FE(popen,															arginfo_popen)
3070 	PHP_FE(readfile,														arginfo_readfile)
3071 	PHP_FE(rewind,															arginfo_rewind)
3072 	PHP_FE(rmdir,															arginfo_rmdir)
3073 	PHP_FE(umask,															arginfo_umask)
3074 	PHP_FE(fclose,															arginfo_fclose)
3075 	PHP_FE(feof,															arginfo_feof)
3076 	PHP_FE(fgetc,															arginfo_fgetc)
3077 	PHP_FE(fgets,															arginfo_fgets)
3078 	PHP_FE(fgetss,															arginfo_fgetss)
3079 	PHP_FE(fread,															arginfo_fread)
3080 	PHP_NAMED_FE(fopen,				php_if_fopen,							arginfo_fopen)
3081 	PHP_FE(fpassthru,														arginfo_fpassthru)
3082 	PHP_NAMED_FE(ftruncate,			php_if_ftruncate,						arginfo_ftruncate)
3083 	PHP_NAMED_FE(fstat,				php_if_fstat,							arginfo_fstat)
3084 	PHP_FE(fseek,															arginfo_fseek)
3085 	PHP_FE(ftell,															arginfo_ftell)
3086 	PHP_FE(fflush,															arginfo_fflush)
3087 	PHP_FE(fwrite,															arginfo_fwrite)
3088 	PHP_FALIAS(fputs,				fwrite,									arginfo_fwrite)
3089 	PHP_FE(mkdir,															arginfo_mkdir)
3090 	PHP_FE(rename,															arginfo_rename)
3091 	PHP_FE(copy,															arginfo_copy)
3092 	PHP_FE(tempnam,															arginfo_tempnam)
3093 	PHP_NAMED_FE(tmpfile,			php_if_tmpfile,							arginfo_tmpfile)
3094 	PHP_FE(file,															arginfo_file)
3095 	PHP_FE(file_get_contents,												arginfo_file_get_contents)
3096 	PHP_FE(file_put_contents,												arginfo_file_put_contents)
3097 	PHP_FE(stream_select,													arginfo_stream_select)
3098 	PHP_FE(stream_context_create,											arginfo_stream_context_create)
3099 	PHP_FE(stream_context_set_params,										arginfo_stream_context_set_params)
3100 	PHP_FE(stream_context_get_params,										arginfo_stream_context_get_params)
3101 	PHP_FE(stream_context_set_option,										arginfo_stream_context_set_option)
3102 	PHP_FE(stream_context_get_options,										arginfo_stream_context_get_options)
3103 	PHP_FE(stream_context_get_default,										arginfo_stream_context_get_default)
3104 	PHP_FE(stream_context_set_default,										arginfo_stream_context_set_default)
3105 	PHP_FE(stream_filter_prepend,											arginfo_stream_filter_prepend)
3106 	PHP_FE(stream_filter_append,											arginfo_stream_filter_append)
3107 	PHP_FE(stream_filter_remove,											arginfo_stream_filter_remove)
3108 	PHP_FE(stream_socket_client,											arginfo_stream_socket_client)
3109 	PHP_FE(stream_socket_server,											arginfo_stream_socket_server)
3110 	PHP_FE(stream_socket_accept,											arginfo_stream_socket_accept)
3111 	PHP_FE(stream_socket_get_name,											arginfo_stream_socket_get_name)
3112 	PHP_FE(stream_socket_recvfrom,											arginfo_stream_socket_recvfrom)
3113 	PHP_FE(stream_socket_sendto,											arginfo_stream_socket_sendto)
3114 	PHP_FE(stream_socket_enable_crypto,										arginfo_stream_socket_enable_crypto)
3115 #ifdef HAVE_SHUTDOWN
3116 	PHP_FE(stream_socket_shutdown,											arginfo_stream_socket_shutdown)
3117 #endif
3118 #if HAVE_SOCKETPAIR
3119 	PHP_FE(stream_socket_pair,												arginfo_stream_socket_pair)
3120 #endif
3121 	PHP_FE(stream_copy_to_stream,											arginfo_stream_copy_to_stream)
3122 	PHP_FE(stream_get_contents,												arginfo_stream_get_contents)
3123 	PHP_FE(stream_supports_lock,											arginfo_stream_supports_lock)
3124 	PHP_FE(fgetcsv,															arginfo_fgetcsv)
3125 	PHP_FE(fputcsv,															arginfo_fputcsv)
3126 	PHP_FE(flock,															arginfo_flock)
3127 	PHP_FE(get_meta_tags,													arginfo_get_meta_tags)
3128 	PHP_FE(stream_set_read_buffer,											arginfo_stream_set_read_buffer)
3129 	PHP_FE(stream_set_write_buffer,											arginfo_stream_set_write_buffer)
3130 	PHP_FALIAS(set_file_buffer, stream_set_write_buffer,					arginfo_stream_set_write_buffer)
3131 	PHP_FE(stream_set_chunk_size,											arginfo_stream_set_chunk_size)
3132 
3133 	PHP_FE(stream_set_blocking,												arginfo_stream_set_blocking)
3134 	PHP_FALIAS(socket_set_blocking, stream_set_blocking,					arginfo_stream_set_blocking)
3135 
3136 	PHP_FE(stream_get_meta_data,											arginfo_stream_get_meta_data)
3137 	PHP_FE(stream_get_line,													arginfo_stream_get_line)
3138 	PHP_FE(stream_wrapper_register,											arginfo_stream_wrapper_register)
3139 	PHP_FALIAS(stream_register_wrapper, stream_wrapper_register,			arginfo_stream_wrapper_register)
3140 	PHP_FE(stream_wrapper_unregister,										arginfo_stream_wrapper_unregister)
3141 	PHP_FE(stream_wrapper_restore,											arginfo_stream_wrapper_restore)
3142 	PHP_FE(stream_get_wrappers,												arginfo_stream_get_wrappers)
3143 	PHP_FE(stream_get_transports,											arginfo_stream_get_transports)
3144 	PHP_FE(stream_resolve_include_path,										arginfo_stream_resolve_include_path)
3145 	PHP_FE(stream_is_local,												arginfo_stream_is_local)
3146 	PHP_FE(get_headers,														arginfo_get_headers)
3147 
3148 #if HAVE_SYS_TIME_H || defined(PHP_WIN32)
3149 	PHP_FE(stream_set_timeout,												arginfo_stream_set_timeout)
3150 	PHP_FALIAS(socket_set_timeout, stream_set_timeout,						arginfo_stream_set_timeout)
3151 #endif
3152 
3153 	PHP_FALIAS(socket_get_status, stream_get_meta_data,						arginfo_stream_get_meta_data)
3154 
3155 #if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
3156 	PHP_FE(realpath,														arginfo_realpath)
3157 #endif
3158 
3159 #ifdef HAVE_FNMATCH
3160 	PHP_FE(fnmatch,															arginfo_fnmatch)
3161 #endif
3162 
3163 	/* functions from fsock.c */
3164 	PHP_FE(fsockopen,														arginfo_fsockopen)
3165 	PHP_FE(pfsockopen,														arginfo_pfsockopen)
3166 
3167 	/* functions from pack.c */
3168 	PHP_FE(pack,															arginfo_pack)
3169 	PHP_FE(unpack,															arginfo_unpack)
3170 
3171 	/* functions from browscap.c */
3172 	PHP_FE(get_browser,														arginfo_get_browser)
3173 
3174 #if HAVE_CRYPT
3175 	/* functions from crypt.c */
3176 	PHP_FE(crypt,															arginfo_crypt)
3177 #endif
3178 
3179 	/* functions from dir.c */
3180 	PHP_FE(opendir,															arginfo_opendir)
3181 	PHP_FE(closedir,														arginfo_closedir)
3182 	PHP_FE(chdir,															arginfo_chdir)
3183 
3184 #if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
3185 	PHP_FE(chroot,															arginfo_chroot)
3186 #endif
3187 
3188 	PHP_FE(getcwd,															arginfo_getcwd)
3189 	PHP_FE(rewinddir,														arginfo_rewinddir)
3190 	PHP_NAMED_FE(readdir,			php_if_readdir,							arginfo_readdir)
3191 	PHP_FALIAS(dir,					getdir,									arginfo_dir)
3192 	PHP_FE(scandir,															arginfo_scandir)
3193 #ifdef HAVE_GLOB
3194 	PHP_FE(glob,															arginfo_glob)
3195 #endif
3196 	/* functions from filestat.c */
3197 	PHP_FE(fileatime,														arginfo_fileatime)
3198 	PHP_FE(filectime,														arginfo_filectime)
3199 	PHP_FE(filegroup,														arginfo_filegroup)
3200 	PHP_FE(fileinode,														arginfo_fileinode)
3201 	PHP_FE(filemtime,														arginfo_filemtime)
3202 	PHP_FE(fileowner,														arginfo_fileowner)
3203 	PHP_FE(fileperms,														arginfo_fileperms)
3204 	PHP_FE(filesize,														arginfo_filesize)
3205 	PHP_FE(filetype,														arginfo_filetype)
3206 	PHP_FE(file_exists,														arginfo_file_exists)
3207 	PHP_FE(is_writable,														arginfo_is_writable)
3208 	PHP_FALIAS(is_writeable,		is_writable,							arginfo_is_writable)
3209 	PHP_FE(is_readable,														arginfo_is_readable)
3210 	PHP_FE(is_executable,													arginfo_is_executable)
3211 	PHP_FE(is_file,															arginfo_is_file)
3212 	PHP_FE(is_dir,															arginfo_is_dir)
3213 	PHP_FE(is_link,															arginfo_is_link)
3214 	PHP_NAMED_FE(stat,				php_if_stat,							arginfo_stat)
3215 	PHP_NAMED_FE(lstat,				php_if_lstat,							arginfo_lstat)
3216 #ifndef NETWARE
3217 	PHP_FE(chown,															arginfo_chown)
3218 	PHP_FE(chgrp,															arginfo_chgrp)
3219 #endif
3220 #if HAVE_LCHOWN
3221 	PHP_FE(lchown,															arginfo_lchown)
3222 #endif
3223 #if HAVE_LCHOWN
3224 	PHP_FE(lchgrp,															arginfo_lchgrp)
3225 #endif
3226 	PHP_FE(chmod,															arginfo_chmod)
3227 #if HAVE_UTIME
3228 	PHP_FE(touch,															arginfo_touch)
3229 #endif
3230 	PHP_FE(clearstatcache,													arginfo_clearstatcache)
3231 	PHP_FE(disk_total_space,												arginfo_disk_total_space)
3232 	PHP_FE(disk_free_space,													arginfo_disk_free_space)
3233 	PHP_FALIAS(diskfreespace,		disk_free_space,						arginfo_disk_free_space)
3234 	PHP_FE(realpath_cache_size,												arginfo_realpath_cache_size)
3235 	PHP_FE(realpath_cache_get,												arginfo_realpath_cache_get)
3236 
3237 	/* functions from mail.c */
3238 	PHP_FE(mail,															arginfo_mail)
3239 	PHP_FE(ezmlm_hash,														arginfo_ezmlm_hash)
3240 
3241 	/* functions from syslog.c */
3242 #ifdef HAVE_SYSLOG_H
3243 	PHP_FE(openlog,															arginfo_openlog)
3244 	PHP_FE(syslog,															arginfo_syslog)
3245 	PHP_FE(closelog,														arginfo_closelog)
3246 #endif
3247 
3248 	/* functions from lcg.c */
3249 	PHP_FE(lcg_value,														arginfo_lcg_value)
3250 
3251 	/* functions from metaphone.c */
3252 	PHP_FE(metaphone,														arginfo_metaphone)
3253 
3254 	/* functions from output.c */
3255 	PHP_FE(ob_start,														arginfo_ob_start)
3256 	PHP_FE(ob_flush,														arginfo_ob_flush)
3257 	PHP_FE(ob_clean,														arginfo_ob_clean)
3258 	PHP_FE(ob_end_flush,													arginfo_ob_end_flush)
3259 	PHP_FE(ob_end_clean,													arginfo_ob_end_clean)
3260 	PHP_FE(ob_get_flush,													arginfo_ob_get_flush)
3261 	PHP_FE(ob_get_clean,													arginfo_ob_get_clean)
3262 	PHP_FE(ob_get_length,													arginfo_ob_get_length)
3263 	PHP_FE(ob_get_level,													arginfo_ob_get_level)
3264 	PHP_FE(ob_get_status,													arginfo_ob_get_status)
3265 	PHP_FE(ob_get_contents,													arginfo_ob_get_contents)
3266 	PHP_FE(ob_implicit_flush,												arginfo_ob_implicit_flush)
3267 	PHP_FE(ob_list_handlers,												arginfo_ob_list_handlers)
3268 
3269 	/* functions from array.c */
3270 	PHP_FE(ksort,															arginfo_ksort)
3271 	PHP_FE(krsort,															arginfo_krsort)
3272 	PHP_FE(natsort,															arginfo_natsort)
3273 	PHP_FE(natcasesort,														arginfo_natcasesort)
3274 	PHP_FE(asort,															arginfo_asort)
3275 	PHP_FE(arsort,															arginfo_arsort)
3276 	PHP_FE(sort,															arginfo_sort)
3277 	PHP_FE(rsort,															arginfo_rsort)
3278 	PHP_FE(usort,															arginfo_usort)
3279 	PHP_FE(uasort,															arginfo_uasort)
3280 	PHP_FE(uksort,															arginfo_uksort)
3281 	PHP_FE(shuffle,															arginfo_shuffle)
3282 	PHP_FE(array_walk,														arginfo_array_walk)
3283 	PHP_FE(array_walk_recursive,											arginfo_array_walk_recursive)
3284 	PHP_FE(count,															arginfo_count)
3285 	PHP_FE(end,																arginfo_end)
3286 	PHP_FE(prev,															arginfo_prev)
3287 	PHP_FE(next,															arginfo_next)
3288 	PHP_FE(reset,															arginfo_reset)
3289 	PHP_FE(current,															arginfo_current)
3290 	PHP_FE(key,																arginfo_key)
3291 	PHP_FE(min,																arginfo_min)
3292 	PHP_FE(max,																arginfo_max)
3293 	PHP_FE(in_array,														arginfo_in_array)
3294 	PHP_FE(array_search,													arginfo_array_search)
3295 	PHP_FE(extract,															arginfo_extract)
3296 	PHP_FE(compact,															arginfo_compact)
3297 	PHP_FE(array_fill,														arginfo_array_fill)
3298 	PHP_FE(array_fill_keys,													arginfo_array_fill_keys)
3299 	PHP_FE(range,															arginfo_range)
3300 	PHP_FE(array_multisort,													arginfo_array_multisort)
3301 	PHP_FE(array_push,														arginfo_array_push)
3302 	PHP_FE(array_pop,														arginfo_array_pop)
3303 	PHP_FE(array_shift,														arginfo_array_shift)
3304 	PHP_FE(array_unshift,													arginfo_array_unshift)
3305 	PHP_FE(array_splice,													arginfo_array_splice)
3306 	PHP_FE(array_slice,														arginfo_array_slice)
3307 	PHP_FE(array_merge,														arginfo_array_merge)
3308 	PHP_FE(array_merge_recursive,											arginfo_array_merge_recursive)
3309 	PHP_FE(array_replace,													arginfo_array_replace)
3310 	PHP_FE(array_replace_recursive,											arginfo_array_replace_recursive)
3311 	PHP_FE(array_keys,														arginfo_array_keys)
3312 	PHP_FE(array_values,													arginfo_array_values)
3313 	PHP_FE(array_count_values,												arginfo_array_count_values)
3314 	PHP_FE(array_column,													arginfo_array_column)
3315 	PHP_FE(array_reverse,													arginfo_array_reverse)
3316 	PHP_FE(array_reduce,													arginfo_array_reduce)
3317 	PHP_FE(array_pad,														arginfo_array_pad)
3318 	PHP_FE(array_flip,														arginfo_array_flip)
3319 	PHP_FE(array_change_key_case,											arginfo_array_change_key_case)
3320 	PHP_FE(array_rand,														arginfo_array_rand)
3321 	PHP_FE(array_unique,													arginfo_array_unique)
3322 	PHP_FE(array_intersect,													arginfo_array_intersect)
3323 	PHP_FE(array_intersect_key,												arginfo_array_intersect_key)
3324 	PHP_FE(array_intersect_ukey,											arginfo_array_intersect_ukey)
3325 	PHP_FE(array_uintersect,												arginfo_array_uintersect)
3326 	PHP_FE(array_intersect_assoc,											arginfo_array_intersect_assoc)
3327 	PHP_FE(array_uintersect_assoc,											arginfo_array_uintersect_assoc)
3328 	PHP_FE(array_intersect_uassoc,											arginfo_array_intersect_uassoc)
3329 	PHP_FE(array_uintersect_uassoc,											arginfo_array_uintersect_uassoc)
3330 	PHP_FE(array_diff,														arginfo_array_diff)
3331 	PHP_FE(array_diff_key,													arginfo_array_diff_key)
3332 	PHP_FE(array_diff_ukey,													arginfo_array_diff_ukey)
3333 	PHP_FE(array_udiff,														arginfo_array_udiff)
3334 	PHP_FE(array_diff_assoc,												arginfo_array_diff_assoc)
3335 	PHP_FE(array_udiff_assoc,												arginfo_array_udiff_assoc)
3336 	PHP_FE(array_diff_uassoc,												arginfo_array_diff_uassoc)
3337 	PHP_FE(array_udiff_uassoc,												arginfo_array_udiff_uassoc)
3338 	PHP_FE(array_sum,														arginfo_array_sum)
3339 	PHP_FE(array_product,													arginfo_array_product)
3340 	PHP_FE(array_filter,													arginfo_array_filter)
3341 	PHP_FE(array_map,														arginfo_array_map)
3342 	PHP_FE(array_chunk,														arginfo_array_chunk)
3343 	PHP_FE(array_combine,													arginfo_array_combine)
3344 	PHP_FE(array_key_exists,												arginfo_array_key_exists)
3345 
3346 	/* aliases from array.c */
3347 	PHP_FALIAS(pos,					current,								arginfo_current)
3348 	PHP_FALIAS(sizeof,				count,									arginfo_count)
3349 	PHP_FALIAS(key_exists,			array_key_exists,						arginfo_array_key_exists)
3350 
3351 	/* functions from assert.c */
3352 	PHP_FE(assert,															arginfo_assert)
3353 	PHP_FE(assert_options,													arginfo_assert_options)
3354 
3355 	/* functions from versioning.c */
3356 	PHP_FE(version_compare,													arginfo_version_compare)
3357 
3358 	/* functions from ftok.c*/
3359 #if HAVE_FTOK
3360 	PHP_FE(ftok,															arginfo_ftok)
3361 #endif
3362 
3363 	PHP_FE(str_rot13,														arginfo_str_rot13)
3364 	PHP_FE(stream_get_filters,												arginfo_stream_get_filters)
3365 	PHP_FE(stream_filter_register,											arginfo_stream_filter_register)
3366 	PHP_FE(stream_bucket_make_writeable,									arginfo_stream_bucket_make_writeable)
3367 	PHP_FE(stream_bucket_prepend,											arginfo_stream_bucket_prepend)
3368 	PHP_FE(stream_bucket_append,											arginfo_stream_bucket_append)
3369 	PHP_FE(stream_bucket_new,												arginfo_stream_bucket_new)
3370 
3371 	PHP_FE(output_add_rewrite_var,											arginfo_output_add_rewrite_var)
3372 	PHP_FE(output_reset_rewrite_vars,										arginfo_output_reset_rewrite_vars)
3373 
3374 	PHP_FE(sys_get_temp_dir,												arginfo_sys_get_temp_dir)
3375 
3376 	PHP_FE_END
3377 };
3378 /* }}} */
3379 
3380 static const zend_module_dep standard_deps[] = { /* {{{ */
3381 	ZEND_MOD_OPTIONAL("session")
3382 	ZEND_MOD_END
3383 };
3384 /* }}} */
3385 
3386 zend_module_entry basic_functions_module = { /* {{{ */
3387 	STANDARD_MODULE_HEADER_EX,
3388 	NULL,
3389 	standard_deps,
3390 	"standard",					/* extension name */
3391 	basic_functions,			/* function list */
3392 	PHP_MINIT(basic),			/* process startup */
3393 	PHP_MSHUTDOWN(basic),		/* process shutdown */
3394 	PHP_RINIT(basic),			/* request startup */
3395 	PHP_RSHUTDOWN(basic),		/* request shutdown */
3396 	PHP_MINFO(basic),			/* extension info */
3397 	PHP_STANDARD_VERSION,		/* extension version */
3398 	STANDARD_MODULE_PROPERTIES
3399 };
3400 /* }}} */
3401 
3402 #if defined(HAVE_PUTENV)
php_putenv_destructor(zval * zv)3403 static void php_putenv_destructor(zval *zv) /* {{{ */
3404 {
3405 	putenv_entry *pe = Z_PTR_P(zv);
3406 
3407 	if (pe->previous_value) {
3408 # if defined(PHP_WIN32)
3409 		/* MSVCRT has a bug in putenv() when setting a variable that
3410 		 * is already set; if the SetEnvironmentVariable() API call
3411 		 * fails, the Crt will double free() a string.
3412 		 * We try to avoid this by setting our own value first */
3413 		SetEnvironmentVariable(pe->key, "bugbug");
3414 # endif
3415 		putenv(pe->previous_value);
3416 # if defined(PHP_WIN32)
3417 		efree(pe->previous_value);
3418 # endif
3419 	} else {
3420 # if HAVE_UNSETENV
3421 		unsetenv(pe->key);
3422 # elif defined(PHP_WIN32)
3423 		SetEnvironmentVariable(pe->key, NULL);
3424 # ifndef ZTS
3425 		_putenv_s(pe->key, "");
3426 # endif
3427 # else
3428 		char **env;
3429 
3430 		for (env = environ; env != NULL && *env != NULL; env++) {
3431 			if (!strncmp(*env, pe->key, pe->key_len) && (*env)[pe->key_len] == '=') {	/* found it */
3432 				*env = "";
3433 				break;
3434 			}
3435 		}
3436 # endif
3437 	}
3438 #ifdef HAVE_TZSET
3439 	/* don't forget to reset the various libc globals that
3440 	 * we might have changed by an earlier call to tzset(). */
3441 	if (!strncmp(pe->key, "TZ", pe->key_len)) {
3442 		tzset();
3443 	}
3444 #endif
3445 
3446 	efree(pe->putenv_string);
3447 	efree(pe->key);
3448 	efree(pe);
3449 }
3450 /* }}} */
3451 #endif
3452 
basic_globals_ctor(php_basic_globals * basic_globals_p)3453 static void basic_globals_ctor(php_basic_globals *basic_globals_p) /* {{{ */
3454 {
3455 	BG(rand_is_seeded) = 0;
3456 	BG(mt_rand_is_seeded) = 0;
3457 	BG(umask) = -1;
3458 	BG(next) = NULL;
3459 	BG(left) = -1;
3460 	BG(user_tick_functions) = NULL;
3461 	BG(user_filter_map) = NULL;
3462 	BG(serialize_lock) = 0;
3463 
3464 	memset(&BG(serialize), 0, sizeof(BG(serialize)));
3465 	memset(&BG(unserialize), 0, sizeof(BG(unserialize)));
3466 
3467 	memset(&BG(url_adapt_state_ex), 0, sizeof(BG(url_adapt_state_ex)));
3468 
3469 #if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T)
3470 	memset(&BG(mblen_state), 0, sizeof(BG(mblen_state)));
3471 #endif
3472 
3473 	BG(incomplete_class) = incomplete_class_entry;
3474 	BG(page_uid) = -1;
3475 	BG(page_gid) = -1;
3476 }
3477 /* }}} */
3478 
basic_globals_dtor(php_basic_globals * basic_globals_p)3479 static void basic_globals_dtor(php_basic_globals *basic_globals_p) /* {{{ */
3480 {
3481 	if (basic_globals_p->url_adapt_state_ex.tags) {
3482 		zend_hash_destroy(basic_globals_p->url_adapt_state_ex.tags);
3483 		free(basic_globals_p->url_adapt_state_ex.tags);
3484 	}
3485 }
3486 /* }}} */
3487 
3488 #define PHP_DOUBLE_INFINITY_HIGH       0x7ff00000
3489 #define PHP_DOUBLE_QUIET_NAN_HIGH      0xfff80000
3490 
php_get_nan(void)3491 PHPAPI double php_get_nan(void) /* {{{ */
3492 {
3493 #if HAVE_HUGE_VAL_NAN
3494 	return HUGE_VAL + -HUGE_VAL;
3495 #elif defined(__i386__) || defined(_X86_) || defined(ALPHA) || defined(_ALPHA) || defined(__alpha)
3496 	double val = 0.0;
3497 	((php_uint32*)&val)[1] = PHP_DOUBLE_QUIET_NAN_HIGH;
3498 	((php_uint32*)&val)[0] = 0;
3499 	return val;
3500 #elif HAVE_ATOF_ACCEPTS_NAN
3501 	return atof("NAN");
3502 #else
3503 	return 0.0/0.0;
3504 #endif
3505 }
3506 /* }}} */
3507 
php_get_inf(void)3508 PHPAPI double php_get_inf(void) /* {{{ */
3509 {
3510 #if HAVE_HUGE_VAL_INF
3511 	return HUGE_VAL;
3512 #elif defined(__i386__) || defined(_X86_) || defined(ALPHA) || defined(_ALPHA) || defined(__alpha)
3513 	double val = 0.0;
3514 	((php_uint32*)&val)[1] = PHP_DOUBLE_INFINITY_HIGH;
3515 	((php_uint32*)&val)[0] = 0;
3516 	return val;
3517 #elif HAVE_ATOF_ACCEPTS_INF
3518 	return atof("INF");
3519 #else
3520 	return 1.0/0.0;
3521 #endif
3522 }
3523 /* }}} */
3524 
3525 #define BASIC_MINIT_SUBMODULE(module) \
3526 	if (PHP_MINIT(module)(INIT_FUNC_ARGS_PASSTHRU) == SUCCESS) {\
3527 		BASIC_ADD_SUBMODULE(module); \
3528 	}
3529 
3530 #define BASIC_ADD_SUBMODULE(module) \
3531 	zend_hash_str_add_empty_element(&basic_submodules, #module, strlen(#module));
3532 
3533 #define BASIC_RINIT_SUBMODULE(module) \
3534 	if (zend_hash_str_exists(&basic_submodules, #module, strlen(#module))) { \
3535 		PHP_RINIT(module)(INIT_FUNC_ARGS_PASSTHRU); \
3536 	}
3537 
3538 #define BASIC_MINFO_SUBMODULE(module) \
3539 	if (zend_hash_str_exists(&basic_submodules, #module, strlen(#module))) { \
3540 		PHP_MINFO(module)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU); \
3541 	}
3542 
3543 #define BASIC_RSHUTDOWN_SUBMODULE(module) \
3544 	if (zend_hash_str_exists(&basic_submodules, #module, strlen(#module))) { \
3545 		PHP_RSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS_PASSTHRU); \
3546 	}
3547 
3548 #define BASIC_MSHUTDOWN_SUBMODULE(module) \
3549 	if (zend_hash_str_exists(&basic_submodules, #module, strlen(#module))) { \
3550 		PHP_MSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS_PASSTHRU); \
3551 	}
3552 
PHP_MINIT_FUNCTION(basic)3553 PHP_MINIT_FUNCTION(basic) /* {{{ */
3554 {
3555 #ifdef ZTS
3556 	ts_allocate_id(&basic_globals_id, sizeof(php_basic_globals), (ts_allocate_ctor) basic_globals_ctor, (ts_allocate_dtor) basic_globals_dtor);
3557 #ifdef PHP_WIN32
3558 	ts_allocate_id(&php_win32_core_globals_id, sizeof(php_win32_core_globals), (ts_allocate_ctor)php_win32_core_globals_ctor, (ts_allocate_dtor)php_win32_core_globals_dtor );
3559 #endif
3560 #else
3561 	basic_globals_ctor(&basic_globals);
3562 #ifdef PHP_WIN32
3563 	php_win32_core_globals_ctor(&the_php_win32_core_globals);
3564 #endif
3565 #endif
3566 
3567 	zend_hash_init(&basic_submodules, 0, NULL, NULL, 1);
3568 
3569 	BG(incomplete_class) = incomplete_class_entry = php_create_incomplete_class();
3570 
3571 	REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT);
3572 	REGISTER_LONG_CONSTANT("CONNECTION_NORMAL",  PHP_CONNECTION_NORMAL,  CONST_CS | CONST_PERSISTENT);
3573 	REGISTER_LONG_CONSTANT("CONNECTION_TIMEOUT", PHP_CONNECTION_TIMEOUT, CONST_CS | CONST_PERSISTENT);
3574 
3575 	REGISTER_LONG_CONSTANT("INI_USER",   ZEND_INI_USER,   CONST_CS | CONST_PERSISTENT);
3576 	REGISTER_LONG_CONSTANT("INI_PERDIR", ZEND_INI_PERDIR, CONST_CS | CONST_PERSISTENT);
3577 	REGISTER_LONG_CONSTANT("INI_SYSTEM", ZEND_INI_SYSTEM, CONST_CS | CONST_PERSISTENT);
3578 	REGISTER_LONG_CONSTANT("INI_ALL",    ZEND_INI_ALL,    CONST_CS | CONST_PERSISTENT);
3579 
3580 	REGISTER_LONG_CONSTANT("INI_SCANNER_NORMAL", ZEND_INI_SCANNER_NORMAL, CONST_CS | CONST_PERSISTENT);
3581 	REGISTER_LONG_CONSTANT("INI_SCANNER_RAW",    ZEND_INI_SCANNER_RAW,    CONST_CS | CONST_PERSISTENT);
3582 	REGISTER_LONG_CONSTANT("INI_SCANNER_TYPED",  ZEND_INI_SCANNER_TYPED,  CONST_CS | CONST_PERSISTENT);
3583 
3584 	REGISTER_LONG_CONSTANT("PHP_URL_SCHEME", PHP_URL_SCHEME, CONST_CS | CONST_PERSISTENT);
3585 	REGISTER_LONG_CONSTANT("PHP_URL_HOST", PHP_URL_HOST, CONST_CS | CONST_PERSISTENT);
3586 	REGISTER_LONG_CONSTANT("PHP_URL_PORT", PHP_URL_PORT, CONST_CS | CONST_PERSISTENT);
3587 	REGISTER_LONG_CONSTANT("PHP_URL_USER", PHP_URL_USER, CONST_CS | CONST_PERSISTENT);
3588 	REGISTER_LONG_CONSTANT("PHP_URL_PASS", PHP_URL_PASS, CONST_CS | CONST_PERSISTENT);
3589 	REGISTER_LONG_CONSTANT("PHP_URL_PATH", PHP_URL_PATH, CONST_CS | CONST_PERSISTENT);
3590 	REGISTER_LONG_CONSTANT("PHP_URL_QUERY", PHP_URL_QUERY, CONST_CS | CONST_PERSISTENT);
3591 	REGISTER_LONG_CONSTANT("PHP_URL_FRAGMENT", PHP_URL_FRAGMENT, CONST_CS | CONST_PERSISTENT);
3592 	REGISTER_LONG_CONSTANT("PHP_QUERY_RFC1738", PHP_QUERY_RFC1738, CONST_CS | CONST_PERSISTENT);
3593 	REGISTER_LONG_CONSTANT("PHP_QUERY_RFC3986", PHP_QUERY_RFC3986, CONST_CS | CONST_PERSISTENT);
3594 
3595 #define REGISTER_MATH_CONSTANT(x)  REGISTER_DOUBLE_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT)
3596 	REGISTER_MATH_CONSTANT(M_E);
3597 	REGISTER_MATH_CONSTANT(M_LOG2E);
3598 	REGISTER_MATH_CONSTANT(M_LOG10E);
3599 	REGISTER_MATH_CONSTANT(M_LN2);
3600 	REGISTER_MATH_CONSTANT(M_LN10);
3601 	REGISTER_MATH_CONSTANT(M_PI);
3602 	REGISTER_MATH_CONSTANT(M_PI_2);
3603 	REGISTER_MATH_CONSTANT(M_PI_4);
3604 	REGISTER_MATH_CONSTANT(M_1_PI);
3605 	REGISTER_MATH_CONSTANT(M_2_PI);
3606 	REGISTER_MATH_CONSTANT(M_SQRTPI);
3607 	REGISTER_MATH_CONSTANT(M_2_SQRTPI);
3608 	REGISTER_MATH_CONSTANT(M_LNPI);
3609 	REGISTER_MATH_CONSTANT(M_EULER);
3610 	REGISTER_MATH_CONSTANT(M_SQRT2);
3611 	REGISTER_MATH_CONSTANT(M_SQRT1_2);
3612 	REGISTER_MATH_CONSTANT(M_SQRT3);
3613 	REGISTER_DOUBLE_CONSTANT("INF", php_get_inf(), CONST_CS | CONST_PERSISTENT);
3614 	REGISTER_DOUBLE_CONSTANT("NAN", php_get_nan(), CONST_CS | CONST_PERSISTENT);
3615 
3616 	REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_UP", PHP_ROUND_HALF_UP, CONST_CS | CONST_PERSISTENT);
3617 	REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_DOWN", PHP_ROUND_HALF_DOWN, CONST_CS | CONST_PERSISTENT);
3618 	REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_EVEN", PHP_ROUND_HALF_EVEN, CONST_CS | CONST_PERSISTENT);
3619 	REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_ODD", PHP_ROUND_HALF_ODD, CONST_CS | CONST_PERSISTENT);
3620 
3621 #if ENABLE_TEST_CLASS
3622 	test_class_startup();
3623 #endif
3624 
3625 	register_phpinfo_constants(INIT_FUNC_ARGS_PASSTHRU);
3626 	register_html_constants(INIT_FUNC_ARGS_PASSTHRU);
3627 	register_string_constants(INIT_FUNC_ARGS_PASSTHRU);
3628 
3629 	BASIC_ADD_SUBMODULE(dl)
3630 	BASIC_ADD_SUBMODULE(mail)
3631 	BASIC_ADD_SUBMODULE(streams)
3632 	BASIC_MINIT_SUBMODULE(file)
3633 	BASIC_MINIT_SUBMODULE(pack)
3634 	BASIC_MINIT_SUBMODULE(browscap)
3635 	BASIC_MINIT_SUBMODULE(standard_filters)
3636 	BASIC_MINIT_SUBMODULE(user_filters)
3637 	BASIC_MINIT_SUBMODULE(password)
3638 
3639 #if defined(HAVE_LOCALECONV) && defined(ZTS)
3640 	BASIC_MINIT_SUBMODULE(localeconv)
3641 #endif
3642 
3643 #if defined(HAVE_NL_LANGINFO)
3644 	BASIC_MINIT_SUBMODULE(nl_langinfo)
3645 #endif
3646 
3647 #if HAVE_CRYPT
3648 	BASIC_MINIT_SUBMODULE(crypt)
3649 #endif
3650 
3651 	BASIC_MINIT_SUBMODULE(lcg)
3652 
3653 	BASIC_MINIT_SUBMODULE(dir)
3654 #ifdef HAVE_SYSLOG_H
3655 	BASIC_MINIT_SUBMODULE(syslog)
3656 #endif
3657 	BASIC_MINIT_SUBMODULE(array)
3658 	BASIC_MINIT_SUBMODULE(assert)
3659 	BASIC_MINIT_SUBMODULE(url_scanner_ex)
3660 #ifdef PHP_CAN_SUPPORT_PROC_OPEN
3661 	BASIC_MINIT_SUBMODULE(proc_open)
3662 #endif
3663 	BASIC_MINIT_SUBMODULE(exec)
3664 
3665 	BASIC_MINIT_SUBMODULE(user_streams)
3666 	BASIC_MINIT_SUBMODULE(imagetypes)
3667 
3668 	php_register_url_stream_wrapper("php", &php_stream_php_wrapper);
3669 	php_register_url_stream_wrapper("file", &php_plain_files_wrapper);
3670 #ifdef HAVE_GLOB
3671 	php_register_url_stream_wrapper("glob", &php_glob_stream_wrapper);
3672 #endif
3673 	php_register_url_stream_wrapper("data", &php_stream_rfc2397_wrapper);
3674 	php_register_url_stream_wrapper("http", &php_stream_http_wrapper);
3675 	php_register_url_stream_wrapper("ftp", &php_stream_ftp_wrapper);
3676 
3677 #if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__) || defined(NETWARE)))
3678 # if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS
3679 	BASIC_MINIT_SUBMODULE(dns)
3680 # endif
3681 #endif
3682 
3683 	BASIC_MINIT_SUBMODULE(random)
3684 
3685 	return SUCCESS;
3686 }
3687 /* }}} */
3688 
PHP_MSHUTDOWN_FUNCTION(basic)3689 PHP_MSHUTDOWN_FUNCTION(basic) /* {{{ */
3690 {
3691 #ifdef HAVE_SYSLOG_H
3692 	PHP_MSHUTDOWN(syslog)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
3693 #endif
3694 #ifdef ZTS
3695 	ts_free_id(basic_globals_id);
3696 #ifdef PHP_WIN32
3697 	ts_free_id(php_win32_core_globals_id);
3698 #endif
3699 #else
3700 	basic_globals_dtor(&basic_globals);
3701 #ifdef PHP_WIN32
3702 	php_win32_core_globals_dtor(&the_php_win32_core_globals);
3703 #endif
3704 #endif
3705 
3706 	php_unregister_url_stream_wrapper("php");
3707 	php_unregister_url_stream_wrapper("http");
3708 	php_unregister_url_stream_wrapper("ftp");
3709 
3710 	BASIC_MSHUTDOWN_SUBMODULE(browscap)
3711 	BASIC_MSHUTDOWN_SUBMODULE(array)
3712 	BASIC_MSHUTDOWN_SUBMODULE(assert)
3713 	BASIC_MSHUTDOWN_SUBMODULE(url_scanner_ex)
3714 	BASIC_MSHUTDOWN_SUBMODULE(file)
3715 	BASIC_MSHUTDOWN_SUBMODULE(standard_filters)
3716 #if defined(HAVE_LOCALECONV) && defined(ZTS)
3717 	BASIC_MSHUTDOWN_SUBMODULE(localeconv)
3718 #endif
3719 #if HAVE_CRYPT
3720 	BASIC_MSHUTDOWN_SUBMODULE(crypt)
3721 #endif
3722 
3723 	BASIC_MSHUTDOWN_SUBMODULE(random)
3724 
3725 	zend_hash_destroy(&basic_submodules);
3726 	return SUCCESS;
3727 }
3728 /* }}} */
3729 
PHP_RINIT_FUNCTION(basic)3730 PHP_RINIT_FUNCTION(basic) /* {{{ */
3731 {
3732 	memset(BG(strtok_table), 0, 256);
3733 
3734 	BG(serialize_lock) = 0;
3735 	memset(&BG(serialize), 0, sizeof(BG(serialize)));
3736 	memset(&BG(unserialize), 0, sizeof(BG(unserialize)));
3737 
3738 	BG(strtok_string) = NULL;
3739 	ZVAL_UNDEF(&BG(strtok_zval));
3740 	BG(strtok_last) = NULL;
3741 	BG(locale_string) = NULL;
3742 	BG(locale_changed) = 0;
3743 	BG(array_walk_fci) = empty_fcall_info;
3744 	BG(array_walk_fci_cache) = empty_fcall_info_cache;
3745 	BG(user_compare_fci) = empty_fcall_info;
3746 	BG(user_compare_fci_cache) = empty_fcall_info_cache;
3747 	BG(page_uid) = -1;
3748 	BG(page_gid) = -1;
3749 	BG(page_inode) = -1;
3750 	BG(page_mtime) = -1;
3751 #ifdef HAVE_PUTENV
3752 	zend_hash_init(&BG(putenv_ht), 1, NULL, php_putenv_destructor, 0);
3753 #endif
3754 	BG(user_shutdown_function_names) = NULL;
3755 
3756 	PHP_RINIT(filestat)(INIT_FUNC_ARGS_PASSTHRU);
3757 #ifdef HAVE_SYSLOG_H
3758 	BASIC_RINIT_SUBMODULE(syslog)
3759 #endif
3760 	BASIC_RINIT_SUBMODULE(dir)
3761 	BASIC_RINIT_SUBMODULE(url_scanner_ex)
3762 
3763 	/* Setup default context */
3764 	FG(default_context) = NULL;
3765 
3766 	/* Default to global wrappers only */
3767 	FG(stream_wrappers) = NULL;
3768 
3769 	/* Default to global filters only */
3770 	FG(stream_filters) = NULL;
3771 
3772 	return SUCCESS;
3773 }
3774 /* }}} */
3775 
PHP_RSHUTDOWN_FUNCTION(basic)3776 PHP_RSHUTDOWN_FUNCTION(basic) /* {{{ */
3777 {
3778 	zval_ptr_dtor(&BG(strtok_zval));
3779 	ZVAL_UNDEF(&BG(strtok_zval));
3780 	BG(strtok_string) = NULL;
3781 #ifdef HAVE_PUTENV
3782 	zend_hash_destroy(&BG(putenv_ht));
3783 #endif
3784 
3785 	if (BG(umask) != -1) {
3786 		umask(BG(umask));
3787 	}
3788 
3789 	/* Check if locale was changed and change it back
3790 	 * to the value in startup environment */
3791 	if (BG(locale_changed)) {
3792 		setlocale(LC_ALL, "C");
3793 		setlocale(LC_CTYPE, "");
3794 		zend_update_current_locale();
3795 		if (BG(locale_string)) {
3796 			zend_string_release(BG(locale_string));
3797 			BG(locale_string) = NULL;
3798 		}
3799 	}
3800 
3801 	/* FG(stream_wrappers) and FG(stream_filters) are destroyed
3802 	 * during php_request_shutdown() */
3803 
3804 	PHP_RSHUTDOWN(filestat)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
3805 #ifdef HAVE_SYSLOG_H
3806 #ifdef PHP_WIN32
3807 	BASIC_RSHUTDOWN_SUBMODULE(syslog)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
3808 #endif
3809 #endif
3810 	BASIC_RSHUTDOWN_SUBMODULE(assert)
3811 	BASIC_RSHUTDOWN_SUBMODULE(url_scanner_ex)
3812 	BASIC_RSHUTDOWN_SUBMODULE(streams)
3813 #ifdef PHP_WIN32
3814 	BASIC_RSHUTDOWN_SUBMODULE(win32_core_globals)
3815 #endif
3816 
3817 	if (BG(user_tick_functions)) {
3818 		zend_llist_destroy(BG(user_tick_functions));
3819 		efree(BG(user_tick_functions));
3820 		BG(user_tick_functions) = NULL;
3821 	}
3822 
3823 	BASIC_RSHUTDOWN_SUBMODULE(user_filters)
3824 	BASIC_RSHUTDOWN_SUBMODULE(browscap)
3825 
3826  	BG(page_uid) = -1;
3827  	BG(page_gid) = -1;
3828 	return SUCCESS;
3829 }
3830 /* }}} */
3831 
PHP_MINFO_FUNCTION(basic)3832 PHP_MINFO_FUNCTION(basic) /* {{{ */
3833 {
3834 	php_info_print_table_start();
3835 	BASIC_MINFO_SUBMODULE(dl)
3836 	BASIC_MINFO_SUBMODULE(mail)
3837 	php_info_print_table_end();
3838 	BASIC_MINFO_SUBMODULE(assert)
3839 }
3840 /* }}} */
3841 
3842 /* {{{ proto mixed constant(string const_name)
3843    Given the name of a constant this function will return the constant's associated value */
PHP_FUNCTION(constant)3844 PHP_FUNCTION(constant)
3845 {
3846 	zend_string *const_name;
3847 	zval *c;
3848 
3849 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &const_name) == FAILURE) {
3850 		return;
3851 	}
3852 
3853 	c = zend_get_constant_ex(const_name, NULL, ZEND_FETCH_CLASS_SILENT);
3854 	if (c) {
3855 		ZVAL_COPY_VALUE(return_value, c);
3856 		if (Z_CONSTANT_P(return_value)) {
3857 			if (UNEXPECTED(zval_update_constant_ex(return_value, 1, NULL) != SUCCESS)) {
3858 				return;
3859 			}
3860 		}
3861 		zval_copy_ctor(return_value);
3862 	} else {
3863 		php_error_docref(NULL, E_WARNING, "Couldn't find constant %s", ZSTR_VAL(const_name));
3864 		RETURN_NULL();
3865 	}
3866 }
3867 /* }}} */
3868 
3869 #ifdef HAVE_INET_NTOP
3870 /* {{{ proto string inet_ntop(string in_addr)
3871    Converts a packed inet address to a human readable IP address string */
PHP_NAMED_FUNCTION(php_inet_ntop)3872 PHP_NAMED_FUNCTION(php_inet_ntop)
3873 {
3874 	char *address;
3875 	size_t address_len;
3876 	int af = AF_INET;
3877 	char buffer[40];
3878 
3879 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &address, &address_len) == FAILURE) {
3880 		RETURN_FALSE;
3881 	}
3882 
3883 #ifdef HAVE_IPV6
3884 	if (address_len == 16) {
3885 		af = AF_INET6;
3886 	} else
3887 #endif
3888 	if (address_len != 4) {
3889 		php_error_docref(NULL, E_WARNING, "Invalid in_addr value");
3890 		RETURN_FALSE;
3891 	}
3892 
3893 	if (!inet_ntop(af, address, buffer, sizeof(buffer))) {
3894 		php_error_docref(NULL, E_WARNING, "An unknown error occurred");
3895 		RETURN_FALSE;
3896 	}
3897 
3898 	RETURN_STRING(buffer);
3899 }
3900 /* }}} */
3901 #endif /* HAVE_INET_NTOP */
3902 
3903 #ifdef HAVE_INET_PTON
3904 /* {{{ proto string inet_pton(string ip_address)
3905    Converts a human readable IP address to a packed binary string */
PHP_NAMED_FUNCTION(php_inet_pton)3906 PHP_NAMED_FUNCTION(php_inet_pton)
3907 {
3908 	int ret, af = AF_INET;
3909 	char *address;
3910 	size_t address_len;
3911 	char buffer[17];
3912 
3913 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &address, &address_len) == FAILURE) {
3914 		RETURN_FALSE;
3915 	}
3916 
3917 	memset(buffer, 0, sizeof(buffer));
3918 
3919 #ifdef HAVE_IPV6
3920 	if (strchr(address, ':')) {
3921 		af = AF_INET6;
3922 	} else
3923 #endif
3924 	if (!strchr(address, '.')) {
3925 		php_error_docref(NULL, E_WARNING, "Unrecognized address %s", address);
3926 		RETURN_FALSE;
3927 	}
3928 
3929 	ret = inet_pton(af, address, buffer);
3930 
3931 	if (ret <= 0) {
3932 		php_error_docref(NULL, E_WARNING, "Unrecognized address %s", address);
3933 		RETURN_FALSE;
3934 	}
3935 
3936 	RETURN_STRINGL(buffer, af == AF_INET ? 4 : 16);
3937 }
3938 /* }}} */
3939 #endif /* HAVE_INET_PTON */
3940 
3941 /* {{{ proto int ip2long(string ip_address)
3942    Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address */
PHP_FUNCTION(ip2long)3943 PHP_FUNCTION(ip2long)
3944 {
3945 	char *addr;
3946 	size_t addr_len;
3947 #ifdef HAVE_INET_PTON
3948 	struct in_addr ip;
3949 #else
3950 	zend_ulong ip;
3951 #endif
3952 
3953 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &addr, &addr_len) == FAILURE) {
3954 		return;
3955 	}
3956 
3957 #ifdef HAVE_INET_PTON
3958 	if (addr_len == 0 || inet_pton(AF_INET, addr, &ip) != 1) {
3959 		RETURN_FALSE;
3960 	}
3961 	RETURN_LONG(ntohl(ip.s_addr));
3962 #else
3963 	if (addr_len == 0 || (ip = inet_addr(addr)) == INADDR_NONE) {
3964 		/* The only special case when we should return -1 ourselves,
3965 		 * because inet_addr() considers it wrong. We return 0xFFFFFFFF and
3966 		 * not -1 or ~0 because of 32/64bit issues. */
3967 		if (addr_len == sizeof("255.255.255.255") - 1 &&
3968 			!memcmp(addr, "255.255.255.255", sizeof("255.255.255.255") - 1)
3969 		) {
3970 			RETURN_LONG(0xFFFFFFFF);
3971 		}
3972 		RETURN_FALSE;
3973 	}
3974 	RETURN_LONG(ntohl(ip));
3975 #endif
3976 }
3977 /* }}} */
3978 
3979 /* {{{ proto string long2ip(int proper_address)
3980    Converts an (IPv4) Internet network address into a string in Internet standard dotted format */
PHP_FUNCTION(long2ip)3981 PHP_FUNCTION(long2ip)
3982 {
3983 	/* "It's a long but it's not, PHP ints are signed */
3984 	char *ip;
3985 	size_t ip_len;
3986 	uint32_t n;
3987 	struct in_addr myaddr;
3988 #ifdef HAVE_INET_PTON
3989 	char str[40];
3990 #endif
3991 
3992 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &ip, &ip_len) == FAILURE) {
3993 		return;
3994 	}
3995 
3996 	n = strtoul(ip, NULL, 0);
3997 
3998 	myaddr.s_addr = htonl(n);
3999 #ifdef HAVE_INET_PTON
4000 	if (inet_ntop(AF_INET, &myaddr, str, sizeof(str))) {
4001 		RETURN_STRING(str);
4002 	} else {
4003 		RETURN_FALSE;
4004 	}
4005 #else
4006 	RETURN_STRING(inet_ntoa(myaddr));
4007 #endif
4008 }
4009 /* }}} */
4010 
4011 /********************
4012  * System Functions *
4013  ********************/
4014 
4015 /* {{{ proto string getenv(string varname[, bool local_only])
4016    Get the value of an environment variable */
PHP_FUNCTION(getenv)4017 PHP_FUNCTION(getenv)
4018 {
4019 	char *ptr, *str;
4020 	size_t str_len;
4021 	zend_bool local_only = 0;
4022 
4023 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &str, &str_len, &local_only) == FAILURE) {
4024 		RETURN_FALSE;
4025 	}
4026 
4027 	if (!local_only) {
4028 		/* SAPI method returns an emalloc()'d string */
4029 		ptr = sapi_getenv(str, str_len);
4030 		if (ptr) {
4031 			// TODO: avoid realocation ???
4032 			RETVAL_STRING(ptr);
4033 			efree(ptr);
4034 			return;
4035 		}
4036 	}
4037 #ifdef PHP_WIN32
4038 	{
4039 		char dummybuf;
4040 		int size;
4041 
4042 		SetLastError(0);
4043 		/*If the given bugger is not large enough to hold the data, the return value is
4044 		the buffer size,  in characters, required to hold the string and its terminating
4045 		null character. We use this return value to alloc the final buffer. */
4046 		size = GetEnvironmentVariableA(str, &dummybuf, 0);
4047 		if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
4048 				/* The environment variable doesn't exist. */
4049 				RETURN_FALSE;
4050 		}
4051 
4052 		if (size == 0) {
4053 				/* env exists, but it is empty */
4054 				RETURN_EMPTY_STRING();
4055 		}
4056 
4057 		ptr = emalloc(size);
4058 		size = GetEnvironmentVariableA(str, ptr, size);
4059 		if (size == 0) {
4060 				/* has been removed between the two calls */
4061 				efree(ptr);
4062 				RETURN_EMPTY_STRING();
4063 		} else {
4064 			RETVAL_STRING(ptr);
4065 			efree(ptr);
4066 			return;
4067 		}
4068 	}
4069 #else
4070 	/* system method returns a const */
4071 	ptr = getenv(str);
4072 	if (ptr) {
4073 		RETURN_STRING(ptr);
4074 	}
4075 #endif
4076 	RETURN_FALSE;
4077 }
4078 /* }}} */
4079 
4080 #ifdef HAVE_PUTENV
4081 /* {{{ proto bool putenv(string setting)
4082    Set the value of an environment variable */
PHP_FUNCTION(putenv)4083 PHP_FUNCTION(putenv)
4084 {
4085 	char *setting;
4086 	size_t setting_len;
4087 	char *p, **env;
4088 	putenv_entry pe;
4089 #ifdef PHP_WIN32
4090 	char *value = NULL;
4091 	int equals = 0;
4092 	int error_code;
4093 #endif
4094 
4095 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &setting, &setting_len) == FAILURE) {
4096 		return;
4097 	}
4098 
4099     if(setting_len == 0 || setting[0] == '=') {
4100     	php_error_docref(NULL, E_WARNING, "Invalid parameter syntax");
4101     	RETURN_FALSE;
4102     }
4103 
4104 	pe.putenv_string = estrndup(setting, setting_len);
4105 	pe.key = estrndup(setting, setting_len);
4106 	if ((p = strchr(pe.key, '='))) {	/* nullify the '=' if there is one */
4107 		*p = '\0';
4108 #ifdef PHP_WIN32
4109 		equals = 1;
4110 #endif
4111 	}
4112 
4113 	pe.key_len = (int)strlen(pe.key);
4114 #ifdef PHP_WIN32
4115 	if (equals) {
4116 		if (pe.key_len < setting_len - 1) {
4117 			value = p + 1;
4118 		} else {
4119 			/* empty string*/
4120 			value = p;
4121 		}
4122 	}
4123 #endif
4124 
4125 	zend_hash_str_del(&BG(putenv_ht), pe.key, pe.key_len);
4126 
4127 	/* find previous value */
4128 	pe.previous_value = NULL;
4129 	for (env = environ; env != NULL && *env != NULL; env++) {
4130 		if (!strncmp(*env, pe.key, pe.key_len) && (*env)[pe.key_len] == '=') {	/* found it */
4131 #if defined(PHP_WIN32)
4132 			/* must copy previous value because MSVCRT's putenv can free the string without notice */
4133 			pe.previous_value = estrdup(*env);
4134 #else
4135 			pe.previous_value = *env;
4136 #endif
4137 			break;
4138 		}
4139 	}
4140 
4141 #if HAVE_UNSETENV
4142 	if (!p) { /* no '=' means we want to unset it */
4143 		unsetenv(pe.putenv_string);
4144 	}
4145 	if (!p || putenv(pe.putenv_string) == 0) { /* success */
4146 #else
4147 # ifndef PHP_WIN32
4148 	if (putenv(pe.putenv_string) == 0) { /* success */
4149 # else
4150 	error_code = SetEnvironmentVariable(pe.key, value);
4151 
4152 	if (error_code != 0
4153 # ifndef ZTS
4154 	/* We need both SetEnvironmentVariable and _putenv here as some
4155 		dependency lib could use either way to read the environment.
4156 		Obviously the CRT version will be useful more often. But
4157 		generally, doing both brings us on the safe track at least
4158 		in NTS build. */
4159 	&& _putenv_s(pe.key, value ? value : "") == 0
4160 # endif
4161 	) { /* success */
4162 # endif
4163 #endif
4164 		zend_hash_str_add_mem(&BG(putenv_ht), pe.key, pe.key_len, &pe, sizeof(putenv_entry));
4165 #ifdef HAVE_TZSET
4166 		if (!strncmp(pe.key, "TZ", pe.key_len)) {
4167 			tzset();
4168 		}
4169 #endif
4170 		RETURN_TRUE;
4171 	} else {
4172 		efree(pe.putenv_string);
4173 		efree(pe.key);
4174 		RETURN_FALSE;
4175 	}
4176 }
4177 /* }}} */
4178 #endif
4179 
4180 /* {{{ free_argv()
4181    Free the memory allocated to an argv array. */
4182 static void free_argv(char **argv, int argc)
4183 {
4184 	int i;
4185 
4186 	if (argv) {
4187 		for (i = 0; i < argc; i++) {
4188 			if (argv[i]) {
4189 				efree(argv[i]);
4190 			}
4191 		}
4192 		efree(argv);
4193 	}
4194 }
4195 /* }}} */
4196 
4197 /* {{{ free_longopts()
4198    Free the memory allocated to an longopt array. */
4199 static void free_longopts(opt_struct *longopts)
4200 {
4201 	opt_struct *p;
4202 
4203 	if (longopts) {
4204 		for (p = longopts; p && p->opt_char != '-'; p++) {
4205 			if (p->opt_name != NULL) {
4206 				efree((char *)(p->opt_name));
4207 			}
4208 		}
4209 	}
4210 }
4211 /* }}} */
4212 
4213 /* {{{ parse_opts()
4214    Convert the typical getopt input characters to the php_getopt struct array */
4215 static int parse_opts(char * opts, opt_struct ** result)
4216 {
4217 	opt_struct * paras = NULL;
4218 	unsigned int i, count = 0;
4219 	unsigned int opts_len = (unsigned int)strlen(opts);
4220 
4221 	for (i = 0; i < opts_len; i++) {
4222 		if ((opts[i] >= 48 && opts[i] <= 57) ||
4223 			(opts[i] >= 65 && opts[i] <= 90) ||
4224 			(opts[i] >= 97 && opts[i] <= 122)
4225 		) {
4226 			count++;
4227 		}
4228 	}
4229 
4230 	paras = safe_emalloc(sizeof(opt_struct), count, 0);
4231 	memset(paras, 0, sizeof(opt_struct) * count);
4232 	*result = paras;
4233 	while ( (*opts >= 48 && *opts <= 57) || /* 0 - 9 */
4234 			(*opts >= 65 && *opts <= 90) || /* A - Z */
4235 			(*opts >= 97 && *opts <= 122)   /* a - z */
4236 	) {
4237 		paras->opt_char = *opts;
4238 		paras->need_param = (*(++opts) == ':') ? 1 : 0;
4239 		paras->opt_name = NULL;
4240 		if (paras->need_param == 1) {
4241 			opts++;
4242 			if (*opts == ':') {
4243 				paras->need_param++;
4244 				opts++;
4245 			}
4246 		}
4247 		paras++;
4248 	}
4249 	return count;
4250 }
4251 /* }}} */
4252 
4253 /* {{{ proto array getopt(string options [, array longopts])
4254    Get options from the command line argument list */
4255 PHP_FUNCTION(getopt)
4256 {
4257 	char *options = NULL, **argv = NULL;
4258 	char opt[2] = { '\0' };
4259 	char *optname;
4260 	int argc = 0, len, o;
4261 	size_t options_len = 0;
4262 	char *php_optarg = NULL;
4263 	int php_optind = 1;
4264 	zval val, *args = NULL, *p_longopts = NULL;
4265 	int optname_len = 0;
4266 	opt_struct *opts, *orig_opts;
4267 
4268 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|a", &options, &options_len, &p_longopts) == FAILURE) {
4269 		RETURN_FALSE;
4270 	}
4271 
4272 	/* Get argv from the global symbol table. We calculate argc ourselves
4273 	 * in order to be on the safe side, even though it is also available
4274 	 * from the symbol table. */
4275 	if ((Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY || zend_is_auto_global_str(ZEND_STRL("_SERVER"))) &&
4276 		((args = zend_hash_str_find_ind(Z_ARRVAL_P(&PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv")-1)) != NULL ||
4277 		(args = zend_hash_str_find_ind(&EG(symbol_table), "argv", sizeof("argv")-1)) != NULL)
4278 	) {
4279 		int pos = 0;
4280 		zval *entry;
4281 
4282  		if (Z_TYPE_P(args) != IS_ARRAY) {
4283  			RETURN_FALSE;
4284  		}
4285  		argc = zend_hash_num_elements(Z_ARRVAL_P(args));
4286 
4287 		/* Attempt to allocate enough memory to hold all of the arguments
4288 		 * and a trailing NULL */
4289 		argv = (char **) safe_emalloc(sizeof(char *), (argc + 1), 0);
4290 
4291 		/* Iterate over the hash to construct the argv array. */
4292 		ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(args), entry) {
4293 			zend_string *arg_str = zval_get_string(entry);
4294 
4295 			argv[pos++] = estrdup(ZSTR_VAL(arg_str));
4296 
4297 			zend_string_release(arg_str);
4298 		} ZEND_HASH_FOREACH_END();
4299 
4300 		/* The C Standard requires argv[argc] to be NULL - this might
4301 		 * keep some getopt implementations happy. */
4302 		argv[argc] = NULL;
4303 	} else {
4304 		/* Return false if we can't find argv. */
4305 		RETURN_FALSE;
4306 	}
4307 
4308 	len = parse_opts(options, &opts);
4309 
4310 	if (p_longopts) {
4311 		int count;
4312 		zval *entry;
4313 
4314 		count = zend_hash_num_elements(Z_ARRVAL_P(p_longopts));
4315 
4316 		/* the first <len> slots are filled by the one short ops
4317 		 * we now extend our array and jump to the new added structs */
4318 		opts = (opt_struct *) erealloc(opts, sizeof(opt_struct) * (len + count + 1));
4319 		orig_opts = opts;
4320 		opts += len;
4321 
4322 		memset(opts, 0, count * sizeof(opt_struct));
4323 
4324 		/* Iterate over the hash to construct the argv array. */
4325 		ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(p_longopts), entry) {
4326 			zend_string *arg_str = zval_get_string(entry);
4327 
4328 			opts->need_param = 0;
4329 			opts->opt_name = estrdup(ZSTR_VAL(arg_str));
4330 			len = (int)strlen(opts->opt_name);
4331 			if ((len > 0) && (opts->opt_name[len - 1] == ':')) {
4332 				opts->need_param++;
4333 				opts->opt_name[len - 1] = '\0';
4334 				if ((len > 1) && (opts->opt_name[len - 2] == ':')) {
4335 					opts->need_param++;
4336 					opts->opt_name[len - 2] = '\0';
4337 				}
4338 			}
4339 			opts->opt_char = 0;
4340 			opts++;
4341 
4342 			zend_string_release(arg_str);
4343 		} ZEND_HASH_FOREACH_END();
4344 	} else {
4345 		opts = (opt_struct*) erealloc(opts, sizeof(opt_struct) * (len + 1));
4346 		orig_opts = opts;
4347 		opts += len;
4348 	}
4349 
4350 	/* php_getopt want to identify the last param */
4351 	opts->opt_char   = '-';
4352 	opts->need_param = 0;
4353 	opts->opt_name   = NULL;
4354 
4355 	/* Initialize the return value as an array. */
4356 	array_init(return_value);
4357 
4358 	/* after our pointer arithmetic jump back to the first element */
4359 	opts = orig_opts;
4360 
4361 	while ((o = php_getopt(argc, argv, opts, &php_optarg, &php_optind, 0, 1)) != -1) {
4362 		/* Skip unknown arguments. */
4363 		if (o == '?') {
4364 			continue;
4365 		}
4366 
4367 		/* Prepare the option character and the argument string. */
4368 		if (o == 0) {
4369 			optname = opts[php_optidx].opt_name;
4370 		} else {
4371 			if (o == 1) {
4372 				o = '-';
4373 			}
4374 			opt[0] = o;
4375 			optname = opt;
4376 		}
4377 
4378 		if (php_optarg != NULL) {
4379 			/* keep the arg as binary, since the encoding is not known */
4380 			ZVAL_STRING(&val, php_optarg);
4381 		} else {
4382 			ZVAL_FALSE(&val);
4383 		}
4384 
4385 		/* Add this option / argument pair to the result hash. */
4386 		optname_len = (int)strlen(optname);
4387 		if (!(optname_len > 1 && optname[0] == '0') && is_numeric_string(optname, optname_len, NULL, NULL, 0) == IS_LONG) {
4388 			/* numeric string */
4389 			int optname_int = atoi(optname);
4390 			if ((args = zend_hash_index_find(Z_ARRVAL_P(return_value), optname_int)) != NULL) {
4391 				if (Z_TYPE_P(args) != IS_ARRAY) {
4392 					convert_to_array_ex(args);
4393 				}
4394 				zend_hash_next_index_insert(Z_ARRVAL_P(args), &val);
4395 			} else {
4396 				zend_hash_index_update(Z_ARRVAL_P(return_value), optname_int, &val);
4397 			}
4398 		} else {
4399 			/* other strings */
4400 			if ((args = zend_hash_str_find(Z_ARRVAL_P(return_value), optname, strlen(optname))) != NULL) {
4401 				if (Z_TYPE_P(args) != IS_ARRAY) {
4402 					convert_to_array_ex(args);
4403 				}
4404 				zend_hash_next_index_insert(Z_ARRVAL_P(args), &val);
4405 			} else {
4406 				zend_hash_str_add(Z_ARRVAL_P(return_value), optname, strlen(optname), &val);
4407 			}
4408 		}
4409 
4410 		php_optarg = NULL;
4411 	}
4412 
4413 	free_longopts(orig_opts);
4414 	efree(orig_opts);
4415 	free_argv(argv, argc);
4416 }
4417 /* }}} */
4418 
4419 /* {{{ proto void flush(void)
4420    Flush the output buffer */
4421 PHP_FUNCTION(flush)
4422 {
4423 	if (zend_parse_parameters_none() == FAILURE) {
4424 		return;
4425 	}
4426 
4427 	sapi_flush();
4428 }
4429 /* }}} */
4430 
4431 /* {{{ proto void sleep(int seconds)
4432    Delay for a given number of seconds */
4433 PHP_FUNCTION(sleep)
4434 {
4435 	zend_long num;
4436 
4437 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &num) == FAILURE) {
4438 		RETURN_FALSE;
4439 	}
4440 	if (num < 0) {
4441 		php_error_docref(NULL, E_WARNING, "Number of seconds must be greater than or equal to 0");
4442 		RETURN_FALSE;
4443 	}
4444 #ifdef PHP_SLEEP_NON_VOID
4445 	RETURN_LONG(php_sleep((unsigned int)num));
4446 #else
4447 	php_sleep((unsigned int)num);
4448 #endif
4449 
4450 }
4451 /* }}} */
4452 
4453 /* {{{ proto void usleep(int micro_seconds)
4454    Delay for a given number of micro seconds */
4455 PHP_FUNCTION(usleep)
4456 {
4457 #if HAVE_USLEEP
4458 	zend_long num;
4459 
4460 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &num) == FAILURE) {
4461 		return;
4462 	}
4463 	if (num < 0) {
4464 		php_error_docref(NULL, E_WARNING, "Number of microseconds must be greater than or equal to 0");
4465 		RETURN_FALSE;
4466 	}
4467 	usleep((unsigned int)num);
4468 #endif
4469 }
4470 /* }}} */
4471 
4472 #if HAVE_NANOSLEEP
4473 /* {{{ proto mixed time_nanosleep(long seconds, long nanoseconds)
4474    Delay for a number of seconds and nano seconds */
4475 PHP_FUNCTION(time_nanosleep)
4476 {
4477 	zend_long tv_sec, tv_nsec;
4478 	struct timespec php_req, php_rem;
4479 
4480 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &tv_sec, &tv_nsec) == FAILURE) {
4481 		return;
4482 	}
4483 
4484 	if (tv_sec < 0) {
4485 		php_error_docref(NULL, E_WARNING, "The seconds value must be greater than 0");
4486 		RETURN_FALSE;
4487 	}
4488 	if (tv_nsec < 0) {
4489 		php_error_docref(NULL, E_WARNING, "The nanoseconds value must be greater than 0");
4490 		RETURN_FALSE;
4491 	}
4492 
4493 	php_req.tv_sec = (time_t) tv_sec;
4494 	php_req.tv_nsec = (long)tv_nsec;
4495 	if (!nanosleep(&php_req, &php_rem)) {
4496 		RETURN_TRUE;
4497 	} else if (errno == EINTR) {
4498 		array_init(return_value);
4499 		add_assoc_long_ex(return_value, "seconds", sizeof("seconds")-1, php_rem.tv_sec);
4500 		add_assoc_long_ex(return_value, "nanoseconds", sizeof("nanoseconds")-1, php_rem.tv_nsec);
4501 		return;
4502 	} else if (errno == EINVAL) {
4503 		php_error_docref(NULL, E_WARNING, "nanoseconds was not in the range 0 to 999 999 999 or seconds was negative");
4504 	}
4505 
4506 	RETURN_FALSE;
4507 }
4508 /* }}} */
4509 
4510 /* {{{ proto mixed time_sleep_until(float timestamp)
4511    Make the script sleep until the specified time */
4512 PHP_FUNCTION(time_sleep_until)
4513 {
4514 	double d_ts, c_ts;
4515 	struct timeval tm;
4516 	struct timespec php_req, php_rem;
4517 
4518 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "d", &d_ts) == FAILURE) {
4519 		return;
4520 	}
4521 
4522 	if (gettimeofday((struct timeval *) &tm, NULL) != 0) {
4523 		RETURN_FALSE;
4524 	}
4525 
4526 	c_ts = (double)(d_ts - tm.tv_sec - tm.tv_usec / 1000000.00);
4527 	if (c_ts < 0) {
4528 		php_error_docref(NULL, E_WARNING, "Sleep until to time is less than current time");
4529 		RETURN_FALSE;
4530 	}
4531 
4532 	php_req.tv_sec = (time_t) c_ts;
4533 	if (php_req.tv_sec > c_ts) { /* rounding up occurred */
4534 		php_req.tv_sec--;
4535 	}
4536 	/* 1sec = 1000000000 nanoseconds */
4537 	php_req.tv_nsec = (long) ((c_ts - php_req.tv_sec) * 1000000000.00);
4538 
4539 	while (nanosleep(&php_req, &php_rem)) {
4540 		if (errno == EINTR) {
4541 			php_req.tv_sec = php_rem.tv_sec;
4542 			php_req.tv_nsec = php_rem.tv_nsec;
4543 		} else {
4544 			RETURN_FALSE;
4545 		}
4546 	}
4547 
4548 	RETURN_TRUE;
4549 }
4550 /* }}} */
4551 #endif
4552 
4553 /* {{{ proto string get_current_user(void)
4554    Get the name of the owner of the current PHP script */
4555 PHP_FUNCTION(get_current_user)
4556 {
4557 	if (zend_parse_parameters_none() == FAILURE) {
4558 		return;
4559 	}
4560 
4561 	RETURN_STRING(php_get_current_user());
4562 }
4563 /* }}} */
4564 
4565 /* {{{ add_config_entry_cb
4566  */
4567 static int add_config_entry_cb(zval *entry, int num_args, va_list args, zend_hash_key *hash_key)
4568 {
4569 	zval *retval = (zval *)va_arg(args, zval*);
4570 	zval tmp;
4571 
4572 	if (Z_TYPE_P(entry) == IS_STRING) {
4573 		if (hash_key->key) {
4574 			add_assoc_str_ex(retval, ZSTR_VAL(hash_key->key), ZSTR_LEN(hash_key->key), zend_string_copy(Z_STR_P(entry)));
4575 		} else {
4576 			add_index_str(retval, hash_key->h, zend_string_copy(Z_STR_P(entry)));
4577 		}
4578 	} else if (Z_TYPE_P(entry) == IS_ARRAY) {
4579 		array_init(&tmp);
4580 		zend_hash_apply_with_arguments(Z_ARRVAL_P(entry), add_config_entry_cb, 1, tmp);
4581 		zend_hash_update(Z_ARRVAL_P(retval), hash_key->key, &tmp);
4582 	}
4583 	return 0;
4584 }
4585 /* }}} */
4586 
4587 /* {{{ proto mixed get_cfg_var(string option_name)
4588    Get the value of a PHP configuration option */
4589 PHP_FUNCTION(get_cfg_var)
4590 {
4591 	char *varname;
4592 	size_t varname_len;
4593 	zval *retval;
4594 
4595 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &varname, &varname_len) == FAILURE) {
4596 		return;
4597 	}
4598 
4599 	retval = cfg_get_entry(varname, (uint)varname_len);
4600 
4601 	if (retval) {
4602 		if (Z_TYPE_P(retval) == IS_ARRAY) {
4603 			array_init(return_value);
4604 			zend_hash_apply_with_arguments(Z_ARRVAL_P(retval), add_config_entry_cb, 1, return_value);
4605 			return;
4606 		} else {
4607 			RETURN_STRING(Z_STRVAL_P(retval));
4608 		}
4609 	} else {
4610 		RETURN_FALSE;
4611 	}
4612 }
4613 /* }}} */
4614 
4615 /* {{{ proto int get_magic_quotes_runtime(void)
4616    Get the current active configuration setting of magic_quotes_runtime */
4617 PHP_FUNCTION(get_magic_quotes_runtime)
4618 {
4619 	if (zend_parse_parameters_none() == FAILURE) {
4620 		return;
4621 	}
4622 	RETURN_FALSE;
4623 }
4624 /* }}} */
4625 
4626 /* {{{ proto int get_magic_quotes_gpc(void)
4627    Get the current active configuration setting of magic_quotes_gpc */
4628 PHP_FUNCTION(get_magic_quotes_gpc)
4629 {
4630 	if (zend_parse_parameters_none() == FAILURE) {
4631 		return;
4632 	}
4633 	RETURN_FALSE;
4634 }
4635 /* }}} */
4636 
4637 /*
4638 	1st arg = error message
4639 	2nd arg = error option
4640 	3rd arg = optional parameters (email address or tcp address)
4641 	4th arg = used for additional headers if email
4642 
4643 error options:
4644 	0 = send to php_error_log (uses syslog or file depending on ini setting)
4645 	1 = send via email to 3rd parameter 4th option = additional headers
4646 	2 = send via tcp/ip to 3rd parameter (name or ip:port)
4647 	3 = save to file in 3rd parameter
4648 	4 = send to SAPI logger directly
4649 */
4650 
4651 /* {{{ proto bool error_log(string message [, int message_type [, string destination [, string extra_headers]]])
4652    Send an error message somewhere */
4653 PHP_FUNCTION(error_log)
4654 {
4655 	char *message, *opt = NULL, *headers = NULL;
4656 	size_t message_len, opt_len = 0, headers_len = 0;
4657 	int opt_err = 0, argc = ZEND_NUM_ARGS();
4658 	zend_long erropt = 0;
4659 
4660 	if (zend_parse_parameters(argc, "s|lps", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) {
4661 		return;
4662 	}
4663 
4664 	if (argc > 1) {
4665 		opt_err = (int)erropt;
4666 	}
4667 
4668 	if (_php_error_log_ex(opt_err, message, message_len, opt, headers) == FAILURE) {
4669 		RETURN_FALSE;
4670 	}
4671 
4672 	RETURN_TRUE;
4673 }
4674 /* }}} */
4675 
4676 /* For BC (not binary-safe!) */
4677 PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers) /* {{{ */
4678 {
4679 	return _php_error_log_ex(opt_err, message, (opt_err == 3) ? strlen(message) : 0, opt, headers);
4680 }
4681 /* }}} */
4682 
4683 PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, char *opt, char *headers) /* {{{ */
4684 {
4685 	php_stream *stream = NULL;
4686 	size_t nbytes;
4687 
4688 	switch (opt_err)
4689 	{
4690 		case 1:		/*send an email */
4691 			if (!php_mail(opt, "PHP error_log message", message, headers, NULL)) {
4692 				return FAILURE;
4693 			}
4694 			break;
4695 
4696 		case 2:		/*send to an address */
4697 			php_error_docref(NULL, E_WARNING, "TCP/IP option not available!");
4698 			return FAILURE;
4699 			break;
4700 
4701 		case 3:		/*save to a file */
4702 			stream = php_stream_open_wrapper(opt, "a", IGNORE_URL_WIN | REPORT_ERRORS, NULL);
4703 			if (!stream) {
4704 				return FAILURE;
4705 			}
4706 			nbytes = php_stream_write(stream, message, message_len);
4707 			php_stream_close(stream);
4708 			if (nbytes != message_len) {
4709 				return FAILURE;
4710 			}
4711 			break;
4712 
4713 		case 4: /* send to SAPI */
4714 			if (sapi_module.log_message) {
4715 				sapi_module.log_message(message);
4716 			} else {
4717 				return FAILURE;
4718 			}
4719 			break;
4720 
4721 		default:
4722 			php_log_err(message);
4723 			break;
4724 	}
4725 	return SUCCESS;
4726 }
4727 /* }}} */
4728 
4729 /* {{{ proto array error_get_last()
4730    Get the last occurred error as associative array. Returns NULL if there hasn't been an error yet. */
4731 PHP_FUNCTION(error_get_last)
4732 {
4733 	if (zend_parse_parameters_none() == FAILURE) {
4734 		return;
4735 	}
4736 
4737 	if (PG(last_error_message)) {
4738 		array_init(return_value);
4739 		add_assoc_long_ex(return_value, "type", sizeof("type")-1, PG(last_error_type));
4740 		add_assoc_string_ex(return_value, "message", sizeof("message")-1, PG(last_error_message));
4741 		add_assoc_string_ex(return_value, "file", sizeof("file")-1, PG(last_error_file)?PG(last_error_file):"-");
4742 		add_assoc_long_ex(return_value, "line", sizeof("line")-1, PG(last_error_lineno));
4743 	}
4744 }
4745 /* }}} */
4746 
4747 /* {{{ proto void error_clear_last(void)
4748    Clear the last occurred error. */
4749 PHP_FUNCTION(error_clear_last)
4750 {
4751 	if (zend_parse_parameters_none() == FAILURE) {
4752 		return;
4753 	}
4754 
4755 	if (PG(last_error_message)) {
4756 		PG(last_error_type) = 0;
4757 		PG(last_error_lineno) = 0;
4758 
4759 		free(PG(last_error_message));
4760 		PG(last_error_message) = NULL;
4761 
4762 		if (PG(last_error_file)) {
4763 			free(PG(last_error_file));
4764 			PG(last_error_file) = NULL;
4765 		}
4766 	}
4767 }
4768 /* }}} */
4769 
4770 /* {{{ proto mixed call_user_func(mixed function_name [, mixed parmeter] [, mixed ...])
4771    Call a user function which is the first parameter
4772    Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
4773 PHP_FUNCTION(call_user_func)
4774 {
4775 	zval retval;
4776 	zend_fcall_info fci;
4777 	zend_fcall_info_cache fci_cache;
4778 
4779 	ZEND_PARSE_PARAMETERS_START(1, -1)
4780 		Z_PARAM_FUNC(fci, fci_cache)
4781 		Z_PARAM_VARIADIC('*', fci.params, fci.param_count)
4782 	ZEND_PARSE_PARAMETERS_END();
4783 
4784 	fci.retval = &retval;
4785 
4786 	if (zend_call_function(&fci, &fci_cache) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
4787 		ZVAL_COPY_VALUE(return_value, &retval);
4788 	}
4789 }
4790 /* }}} */
4791 
4792 /* {{{ proto mixed call_user_func_array(string function_name, array parameters)
4793    Call a user function which is the first parameter with the arguments contained in array
4794    Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
4795 PHP_FUNCTION(call_user_func_array)
4796 {
4797 	zval *params, retval;
4798 	zend_fcall_info fci;
4799 	zend_fcall_info_cache fci_cache;
4800 
4801 	ZEND_PARSE_PARAMETERS_START(2, 2)
4802 		Z_PARAM_FUNC(fci, fci_cache)
4803 		Z_PARAM_ARRAY_EX(params, 0, 1)
4804 	ZEND_PARSE_PARAMETERS_END();
4805 
4806 	zend_fcall_info_args(&fci, params);
4807 	fci.retval = &retval;
4808 
4809 	if (zend_call_function(&fci, &fci_cache) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
4810 		ZVAL_COPY_VALUE(return_value, &retval);
4811 	}
4812 
4813 	zend_fcall_info_args_clear(&fci, 1);
4814 }
4815 /* }}} */
4816 
4817 /* {{{ proto mixed forward_static_call(mixed function_name [, mixed parmeter] [, mixed ...]) U
4818    Call a user function which is the first parameter */
4819 PHP_FUNCTION(forward_static_call)
4820 {
4821 	zval retval;
4822 	zend_fcall_info fci;
4823 	zend_fcall_info_cache fci_cache;
4824 	zend_class_entry *called_scope;
4825 
4826 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "f*", &fci, &fci_cache, &fci.params, &fci.param_count) == FAILURE) {
4827 		return;
4828 	}
4829 
4830 	if (!EX(prev_execute_data)->func->common.scope) {
4831 		zend_error(E_ERROR, "Cannot call forward_static_call() when no class scope is active");
4832 	}
4833 
4834 	fci.retval = &retval;
4835 
4836 	called_scope = zend_get_called_scope(execute_data);
4837 	if (called_scope && fci_cache.calling_scope &&
4838 		instanceof_function(called_scope, fci_cache.calling_scope)) {
4839 			fci_cache.called_scope = called_scope;
4840 	}
4841 
4842 	if (zend_call_function(&fci, &fci_cache) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
4843 		ZVAL_COPY_VALUE(return_value, &retval);
4844 	}
4845 }
4846 /* }}} */
4847 
4848 /* {{{ proto mixed call_user_func_array(string function_name, array parameters) U
4849    Call a user function which is the first parameter with the arguments contained in array */
4850 PHP_FUNCTION(forward_static_call_array)
4851 {
4852 	zval *params, retval;
4853 	zend_fcall_info fci;
4854 	zend_fcall_info_cache fci_cache;
4855 	zend_class_entry *called_scope;
4856 
4857 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "fa/", &fci, &fci_cache, &params) == FAILURE) {
4858 		return;
4859 	}
4860 
4861 	zend_fcall_info_args(&fci, params);
4862 	fci.retval = &retval;
4863 
4864 	called_scope = zend_get_called_scope(execute_data);
4865 	if (called_scope && fci_cache.calling_scope &&
4866 		instanceof_function(called_scope, fci_cache.calling_scope)) {
4867 			fci_cache.called_scope = called_scope;
4868 	}
4869 
4870 	if (zend_call_function(&fci, &fci_cache) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
4871 		ZVAL_COPY_VALUE(return_value, &retval);
4872 	}
4873 
4874 	zend_fcall_info_args_clear(&fci, 1);
4875 }
4876 /* }}} */
4877 
4878 void user_shutdown_function_dtor(zval *zv) /* {{{ */
4879 {
4880 	int i;
4881 	php_shutdown_function_entry *shutdown_function_entry = Z_PTR_P(zv);
4882 
4883 	for (i = 0; i < shutdown_function_entry->arg_count; i++) {
4884 		zval_ptr_dtor(&shutdown_function_entry->arguments[i]);
4885 	}
4886 	efree(shutdown_function_entry->arguments);
4887 	efree(shutdown_function_entry);
4888 }
4889 /* }}} */
4890 
4891 void user_tick_function_dtor(user_tick_function_entry *tick_function_entry) /* {{{ */
4892 {
4893 	int i;
4894 
4895 	for (i = 0; i < tick_function_entry->arg_count; i++) {
4896 		zval_ptr_dtor(&tick_function_entry->arguments[i]);
4897 	}
4898 	efree(tick_function_entry->arguments);
4899 }
4900 /* }}} */
4901 
4902 static int user_shutdown_function_call(zval *zv) /* {{{ */
4903 {
4904     php_shutdown_function_entry *shutdown_function_entry = Z_PTR_P(zv);
4905 	zval retval;
4906 	zend_string *function_name;
4907 
4908 	if (!zend_is_callable(&shutdown_function_entry->arguments[0], 0, &function_name)) {
4909 		if (function_name) {
4910 			php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", ZSTR_VAL(function_name));
4911 			zend_string_release(function_name);
4912 		} else {
4913 			php_error(E_WARNING, "(Registered shutdown functions) Unable to call - function does not exist");
4914 		}
4915 		return 0;
4916 	}
4917 	if (function_name) {
4918 		zend_string_release(function_name);
4919 	}
4920 
4921 	if (call_user_function(EG(function_table), NULL,
4922 				&shutdown_function_entry->arguments[0],
4923 				&retval,
4924 				shutdown_function_entry->arg_count - 1,
4925 				shutdown_function_entry->arguments + 1) == SUCCESS)
4926 	{
4927 		zval_dtor(&retval);
4928 	}
4929 	return 0;
4930 }
4931 /* }}} */
4932 
4933 static void user_tick_function_call(user_tick_function_entry *tick_fe) /* {{{ */
4934 {
4935 	zval retval;
4936 	zval *function = &tick_fe->arguments[0];
4937 
4938 	/* Prevent reentrant calls to the same user ticks function */
4939 	if (! tick_fe->calling) {
4940 		tick_fe->calling = 1;
4941 
4942 		if (call_user_function(	EG(function_table), NULL,
4943 								function,
4944 								&retval,
4945 								tick_fe->arg_count - 1,
4946 								tick_fe->arguments + 1
4947 								) == SUCCESS) {
4948 			zval_dtor(&retval);
4949 
4950 		} else {
4951 			zval *obj, *method;
4952 
4953 			if (Z_TYPE_P(function) == IS_STRING) {
4954 				php_error_docref(NULL, E_WARNING, "Unable to call %s() - function does not exist", Z_STRVAL_P(function));
4955 			} else if (	Z_TYPE_P(function) == IS_ARRAY
4956 						&& (obj = zend_hash_index_find(Z_ARRVAL_P(function), 0)) != NULL
4957 						&& (method = zend_hash_index_find(Z_ARRVAL_P(function), 1)) != NULL
4958 						&& Z_TYPE_P(obj) == IS_OBJECT
4959 						&& Z_TYPE_P(method) == IS_STRING) {
4960 				php_error_docref(NULL, E_WARNING, "Unable to call %s::%s() - function does not exist", ZSTR_VAL(Z_OBJCE_P(obj)->name), Z_STRVAL_P(method));
4961 			} else {
4962 				php_error_docref(NULL, E_WARNING, "Unable to call tick function");
4963 			}
4964 		}
4965 
4966 		tick_fe->calling = 0;
4967 	}
4968 }
4969 /* }}} */
4970 
4971 static void run_user_tick_functions(int tick_count, void *arg) /* {{{ */
4972 {
4973 	zend_llist_apply(BG(user_tick_functions), (llist_apply_func_t) user_tick_function_call);
4974 }
4975 /* }}} */
4976 
4977 static int user_tick_function_compare(user_tick_function_entry * tick_fe1, user_tick_function_entry * tick_fe2) /* {{{ */
4978 {
4979 	zval *func1 = &tick_fe1->arguments[0];
4980 	zval *func2 = &tick_fe2->arguments[0];
4981 	int ret;
4982 
4983 	if (Z_TYPE_P(func1) == IS_STRING && Z_TYPE_P(func2) == IS_STRING) {
4984 		ret = zend_binary_zval_strcmp(func1, func2) == 0;
4985 	} else if (Z_TYPE_P(func1) == IS_ARRAY && Z_TYPE_P(func2) == IS_ARRAY) {
4986 		ret = zend_compare_arrays(func1, func2) == 0;
4987 	} else if (Z_TYPE_P(func1) == IS_OBJECT && Z_TYPE_P(func2) == IS_OBJECT) {
4988 		ret = zend_compare_objects(func1, func2) == 0;
4989 	} else {
4990 		ret = 0;
4991 	}
4992 
4993 	if (ret && tick_fe1->calling) {
4994 		php_error_docref(NULL, E_WARNING, "Unable to delete tick function executed at the moment");
4995 		return 0;
4996 	}
4997 	return ret;
4998 }
4999 /* }}} */
5000 
5001 PHPAPI void php_call_shutdown_functions(void) /* {{{ */
5002 {
5003 	if (BG(user_shutdown_function_names)) {
5004 		zend_try {
5005 			zend_hash_apply(BG(user_shutdown_function_names), user_shutdown_function_call);
5006 		}
5007 		zend_end_try();
5008 	}
5009 }
5010 /* }}} */
5011 
5012 PHPAPI void php_free_shutdown_functions(void) /* {{{ */
5013 {
5014 	if (BG(user_shutdown_function_names))
5015 		zend_try {
5016 			zend_hash_destroy(BG(user_shutdown_function_names));
5017 			FREE_HASHTABLE(BG(user_shutdown_function_names));
5018 			BG(user_shutdown_function_names) = NULL;
5019 		} zend_catch {
5020 			/* maybe shutdown method call exit, we just ignore it */
5021 			FREE_HASHTABLE(BG(user_shutdown_function_names));
5022 			BG(user_shutdown_function_names) = NULL;
5023 		} zend_end_try();
5024 }
5025 /* }}} */
5026 
5027 /* {{{ proto void register_shutdown_function(callback function) U
5028    Register a user-level function to be called on request termination */
5029 PHP_FUNCTION(register_shutdown_function)
5030 {
5031 	php_shutdown_function_entry shutdown_function_entry;
5032 	zend_string *callback_name = NULL;
5033 	int i;
5034 
5035 	shutdown_function_entry.arg_count = ZEND_NUM_ARGS();
5036 
5037 	if (shutdown_function_entry.arg_count < 1) {
5038 		WRONG_PARAM_COUNT;
5039 	}
5040 
5041 	shutdown_function_entry.arguments = (zval *) safe_emalloc(sizeof(zval), shutdown_function_entry.arg_count, 0);
5042 
5043 	if (zend_get_parameters_array(ZEND_NUM_ARGS(), shutdown_function_entry.arg_count, shutdown_function_entry.arguments) == FAILURE) {
5044 		efree(shutdown_function_entry.arguments);
5045 		RETURN_FALSE;
5046 	}
5047 
5048 	/* Prevent entering of anything but valid callback (syntax check only!) */
5049 	if (!zend_is_callable(&shutdown_function_entry.arguments[0], 0, &callback_name)) {
5050 		if (callback_name) {
5051 			php_error_docref(NULL, E_WARNING, "Invalid shutdown callback '%s' passed", ZSTR_VAL(callback_name));
5052 		} else {
5053 			php_error_docref(NULL, E_WARNING, "Invalid shutdown callback passed");
5054 		}
5055 		efree(shutdown_function_entry.arguments);
5056 		RETVAL_FALSE;
5057 	} else {
5058 		if (!BG(user_shutdown_function_names)) {
5059 			ALLOC_HASHTABLE(BG(user_shutdown_function_names));
5060 			zend_hash_init(BG(user_shutdown_function_names), 0, NULL, user_shutdown_function_dtor, 0);
5061 		}
5062 
5063 		for (i = 0; i < shutdown_function_entry.arg_count; i++) {
5064 			if (Z_REFCOUNTED(shutdown_function_entry.arguments[i])) Z_ADDREF(shutdown_function_entry.arguments[i]);
5065 		}
5066 		zend_hash_next_index_insert_mem(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry));
5067 	}
5068 	if (callback_name) {
5069 		zend_string_release(callback_name);
5070 	}
5071 }
5072 /* }}} */
5073 
5074 PHPAPI zend_bool register_user_shutdown_function(char *function_name, size_t function_len, php_shutdown_function_entry *shutdown_function_entry) /* {{{ */
5075 {
5076 	if (!BG(user_shutdown_function_names)) {
5077 		ALLOC_HASHTABLE(BG(user_shutdown_function_names));
5078 		zend_hash_init(BG(user_shutdown_function_names), 0, NULL, user_shutdown_function_dtor, 0);
5079 	}
5080 
5081 	return zend_hash_str_update_mem(BG(user_shutdown_function_names), function_name, function_len, shutdown_function_entry, sizeof(php_shutdown_function_entry)) != NULL;
5082 }
5083 /* }}} */
5084 
5085 PHPAPI zend_bool remove_user_shutdown_function(char *function_name, size_t function_len) /* {{{ */
5086 {
5087 	if (BG(user_shutdown_function_names)) {
5088 		return zend_hash_str_del(BG(user_shutdown_function_names), function_name, function_len) != FAILURE;
5089 	}
5090 
5091 	return 0;
5092 }
5093 /* }}} */
5094 
5095 PHPAPI zend_bool append_user_shutdown_function(php_shutdown_function_entry shutdown_function_entry) /* {{{ */
5096 {
5097 	if (!BG(user_shutdown_function_names)) {
5098 		ALLOC_HASHTABLE(BG(user_shutdown_function_names));
5099 		zend_hash_init(BG(user_shutdown_function_names), 0, NULL, user_shutdown_function_dtor, 0);
5100 	}
5101 
5102 	return zend_hash_next_index_insert_mem(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry)) != NULL;
5103 }
5104 /* }}} */
5105 
5106 ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini) /* {{{ */
5107 {
5108 	syntax_highlighter_ini->highlight_comment = INI_STR("highlight.comment");
5109 	syntax_highlighter_ini->highlight_default = INI_STR("highlight.default");
5110 	syntax_highlighter_ini->highlight_html    = INI_STR("highlight.html");
5111 	syntax_highlighter_ini->highlight_keyword = INI_STR("highlight.keyword");
5112 	syntax_highlighter_ini->highlight_string  = INI_STR("highlight.string");
5113 }
5114 /* }}} */
5115 
5116 /* {{{ proto bool highlight_file(string file_name [, bool return] )
5117    Syntax highlight a source file */
5118 PHP_FUNCTION(highlight_file)
5119 {
5120 	char *filename;
5121 	size_t filename_len, ret;
5122 	zend_syntax_highlighter_ini syntax_highlighter_ini;
5123 	zend_bool i = 0;
5124 
5125 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &filename, &filename_len, &i) == FAILURE) {
5126 		RETURN_FALSE;
5127 	}
5128 
5129 	if (php_check_open_basedir(filename)) {
5130 		RETURN_FALSE;
5131 	}
5132 
5133 	if (i) {
5134 		php_output_start_default();
5135 	}
5136 
5137 	php_get_highlight_struct(&syntax_highlighter_ini);
5138 
5139 	ret = highlight_file(filename, &syntax_highlighter_ini);
5140 
5141 	if (ret == FAILURE) {
5142 		if (i) {
5143 			php_output_end();
5144 		}
5145 		RETURN_FALSE;
5146 	}
5147 
5148 	if (i) {
5149 		php_output_get_contents(return_value);
5150 		php_output_discard();
5151 	} else {
5152 		RETURN_TRUE;
5153 	}
5154 }
5155 /* }}} */
5156 
5157 /* {{{ proto string php_strip_whitespace(string file_name)
5158    Return source with stripped comments and whitespace */
5159 PHP_FUNCTION(php_strip_whitespace)
5160 {
5161 	char *filename;
5162 	size_t filename_len;
5163 	zend_lex_state original_lex_state;
5164 	zend_file_handle file_handle = {{0}};
5165 
5166 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
5167 		RETURN_FALSE;
5168 	}
5169 
5170 	php_output_start_default();
5171 
5172 	file_handle.type = ZEND_HANDLE_FILENAME;
5173 	file_handle.filename = filename;
5174 	file_handle.free_filename = 0;
5175 	file_handle.opened_path = NULL;
5176 	zend_save_lexical_state(&original_lex_state);
5177 	if (open_file_for_scanning(&file_handle) == FAILURE) {
5178 		zend_restore_lexical_state(&original_lex_state);
5179 		php_output_end();
5180 		RETURN_EMPTY_STRING();
5181 	}
5182 
5183 	zend_strip();
5184 
5185 	zend_destroy_file_handle(&file_handle);
5186 	zend_restore_lexical_state(&original_lex_state);
5187 
5188 	php_output_get_contents(return_value);
5189 	php_output_discard();
5190 }
5191 /* }}} */
5192 
5193 /* {{{ proto bool highlight_string(string string [, bool return] )
5194    Syntax highlight a string or optionally return it */
5195 PHP_FUNCTION(highlight_string)
5196 {
5197 	zval *expr;
5198 	zend_syntax_highlighter_ini syntax_highlighter_ini;
5199 	char *hicompiled_string_description;
5200 	zend_bool i = 0;
5201 	int old_error_reporting = EG(error_reporting);
5202 
5203 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &expr, &i) == FAILURE) {
5204 		RETURN_FALSE;
5205 	}
5206 	convert_to_string_ex(expr);
5207 
5208 	if (i) {
5209 		php_output_start_default();
5210 	}
5211 
5212 	EG(error_reporting) = E_ERROR;
5213 
5214 	php_get_highlight_struct(&syntax_highlighter_ini);
5215 
5216 	hicompiled_string_description = zend_make_compiled_string_description("highlighted code");
5217 
5218 	if (highlight_string(expr, &syntax_highlighter_ini, hicompiled_string_description) == FAILURE) {
5219 		efree(hicompiled_string_description);
5220 		EG(error_reporting) = old_error_reporting;
5221 		if (i) {
5222 			php_output_end();
5223 		}
5224 		RETURN_FALSE;
5225 	}
5226 	efree(hicompiled_string_description);
5227 
5228 	EG(error_reporting) = old_error_reporting;
5229 
5230 	if (i) {
5231 		php_output_get_contents(return_value);
5232 		php_output_discard();
5233 	} else {
5234 		RETURN_TRUE;
5235 	}
5236 }
5237 /* }}} */
5238 
5239 /* {{{ proto string ini_get(string varname)
5240    Get a configuration option */
5241 PHP_FUNCTION(ini_get)
5242 {
5243 	char *varname, *str;
5244 	size_t varname_len;
5245 
5246 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &varname, &varname_len) == FAILURE) {
5247 		return;
5248 	}
5249 
5250 	str = zend_ini_string(varname, (uint)varname_len, 0);
5251 
5252 	if (!str) {
5253 		RETURN_FALSE;
5254 	}
5255 
5256 	RETURN_STRING(str);
5257 }
5258 /* }}} */
5259 
5260 static int php_ini_get_option(zval *zv, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
5261 {
5262 	zend_ini_entry *ini_entry = Z_PTR_P(zv);
5263 	zval *ini_array = va_arg(args, zval *);
5264 	int module_number = va_arg(args, int);
5265 	int details = va_arg(args, int);
5266 	zval option;
5267 
5268 	if (module_number != 0 && ini_entry->module_number != module_number) {
5269 		return 0;
5270 	}
5271 
5272 	if (hash_key->key == NULL ||
5273 		ZSTR_VAL(hash_key->key)[0] != 0
5274 	) {
5275 		if (details) {
5276 			array_init(&option);
5277 
5278 			if (ini_entry->orig_value) {
5279 				add_assoc_str(&option, "global_value", zend_string_copy(ini_entry->orig_value));
5280 			} else if (ini_entry->value) {
5281 				add_assoc_str(&option, "global_value", zend_string_copy(ini_entry->value));
5282 			} else {
5283 				add_assoc_null(&option, "global_value");
5284 			}
5285 
5286 			if (ini_entry->value) {
5287 				add_assoc_str(&option, "local_value", zend_string_copy(ini_entry->value));
5288 			} else {
5289 				add_assoc_null(&option, "local_value");
5290 			}
5291 
5292 			add_assoc_long(&option, "access", ini_entry->modifiable);
5293 
5294 			zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &option);
5295 		} else {
5296 			if (ini_entry->value) {
5297 				zval zv;
5298 
5299 				ZVAL_STR_COPY(&zv, ini_entry->value);
5300 				zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &zv);
5301 			} else {
5302 				zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &EG(uninitialized_zval));
5303 			}
5304 		}
5305 	}
5306 	return 0;
5307 }
5308 /* }}} */
5309 
5310 /* {{{ proto array ini_get_all([string extension[, bool details = true]])
5311    Get all configuration options */
5312 PHP_FUNCTION(ini_get_all)
5313 {
5314 	char *extname = NULL;
5315 	size_t extname_len = 0, extnumber = 0;
5316 	zend_module_entry *module;
5317 	zend_bool details = 1;
5318 
5319 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!b", &extname, &extname_len, &details) == FAILURE) {
5320 		return;
5321 	}
5322 
5323 	zend_ini_sort_entries();
5324 
5325 	if (extname) {
5326 		if ((module = zend_hash_str_find_ptr(&module_registry, extname, extname_len)) == NULL) {
5327 			php_error_docref(NULL, E_WARNING, "Unable to find extension '%s'", extname);
5328 			RETURN_FALSE;
5329 		}
5330 		extnumber = module->module_number;
5331 	}
5332 
5333 	array_init(return_value);
5334 	zend_hash_apply_with_arguments(EG(ini_directives), php_ini_get_option, 2, return_value, extnumber, details);
5335 }
5336 /* }}} */
5337 
5338 static int php_ini_check_path(char *option_name, int option_len, char *new_option_name, int new_option_len) /* {{{ */
5339 {
5340 	if (option_len != (new_option_len - 1)) {
5341 		return 0;
5342 	}
5343 
5344 	return !strncmp(option_name, new_option_name, option_len);
5345 }
5346 /* }}} */
5347 
5348 /* {{{ proto string ini_set(string varname, string newvalue)
5349    Set a configuration option, returns false on error and the old value of the configuration option on success */
5350 PHP_FUNCTION(ini_set)
5351 {
5352 	zend_string *varname;
5353 	zend_string *new_value;
5354 	char *old_value;
5355 
5356 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &varname, &new_value) == FAILURE) {
5357 		return;
5358 	}
5359 
5360 	old_value = zend_ini_string(ZSTR_VAL(varname), (int)ZSTR_LEN(varname), 0);
5361 
5362 	/* copy to return here, because alter might free it! */
5363 	if (old_value) {
5364 		RETVAL_STRING(old_value);
5365 	} else {
5366 		RETVAL_FALSE;
5367 	}
5368 
5369 #define _CHECK_PATH(var, var_len, ini) php_ini_check_path(var, (int)var_len, ini, sizeof(ini))
5370 	/* open basedir check */
5371 	if (PG(open_basedir)) {
5372 		if (_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "error_log") ||
5373 			_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "java.class.path") ||
5374 			_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "java.home") ||
5375 			_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "mail.log") ||
5376 			_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "java.library.path") ||
5377 			_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "vpopmail.directory")) {
5378 			if (php_check_open_basedir(ZSTR_VAL(new_value))) {
5379 				zval_dtor(return_value);
5380 				RETURN_FALSE;
5381 			}
5382 		}
5383 	}
5384 
5385 	if (zend_alter_ini_entry_ex(varname, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0) == FAILURE) {
5386 		zval_dtor(return_value);
5387 		RETURN_FALSE;
5388 	}
5389 }
5390 /* }}} */
5391 
5392 /* {{{ proto void ini_restore(string varname)
5393    Restore the value of a configuration option specified by varname */
5394 PHP_FUNCTION(ini_restore)
5395 {
5396 	zend_string *varname;
5397 
5398 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &varname) == FAILURE) {
5399 		return;
5400 	}
5401 
5402 	zend_restore_ini_entry(varname, PHP_INI_STAGE_RUNTIME);
5403 }
5404 /* }}} */
5405 
5406 /* {{{ proto string set_include_path(string new_include_path)
5407    Sets the include_path configuration option */
5408 PHP_FUNCTION(set_include_path)
5409 {
5410 	zend_string *new_value;
5411 	char *old_value;
5412 	zend_string *key;
5413 
5414 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "P", &new_value) == FAILURE) {
5415 		return;
5416 	}
5417 
5418 	old_value = zend_ini_string("include_path", sizeof("include_path") - 1, 0);
5419 	/* copy to return here, because alter might free it! */
5420 	if (old_value) {
5421 		RETVAL_STRING(old_value);
5422 	} else {
5423 		RETVAL_FALSE;
5424 	}
5425 
5426 	key = zend_string_init("include_path", sizeof("include_path") - 1, 0);
5427 	if (zend_alter_ini_entry_ex(key, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0) == FAILURE) {
5428 		zend_string_release(key);
5429 		zval_dtor(return_value);
5430 		RETURN_FALSE;
5431 	}
5432 	zend_string_release(key);
5433 }
5434 /* }}} */
5435 
5436 /* {{{ proto string get_include_path()
5437    Get the current include_path configuration option */
5438 PHP_FUNCTION(get_include_path)
5439 {
5440 	char *str;
5441 
5442 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
5443 		return;
5444 	}
5445 
5446 	str = zend_ini_string("include_path", sizeof("include_path") - 1, 0);
5447 
5448 	if (str == NULL) {
5449 		RETURN_FALSE;
5450 	}
5451 
5452 	RETURN_STRING(str);
5453 }
5454 /* }}} */
5455 
5456 /* {{{ proto void restore_include_path()
5457    Restore the value of the include_path configuration option */
5458 PHP_FUNCTION(restore_include_path)
5459 {
5460 	zend_string *key;
5461 
5462 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
5463 		return;
5464 	}
5465 	key = zend_string_init("include_path", sizeof("include_path")-1, 0);
5466 	zend_restore_ini_entry(key, PHP_INI_STAGE_RUNTIME);
5467 	zend_string_free(key);
5468 }
5469 /* }}} */
5470 
5471 /* {{{ proto mixed print_r(mixed var [, bool return])
5472    Prints out or returns information about the specified variable */
5473 PHP_FUNCTION(print_r)
5474 {
5475 	zval *var;
5476 	zend_bool do_return = 0;
5477 
5478 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &var, &do_return) == FAILURE) {
5479 		RETURN_FALSE;
5480 	}
5481 
5482 	if (do_return) {
5483 		php_output_start_default();
5484 	}
5485 
5486 	zend_print_zval_r(var, 0);
5487 
5488 	if (do_return) {
5489 		php_output_get_contents(return_value);
5490 		php_output_discard();
5491 	} else {
5492 		RETURN_TRUE;
5493 	}
5494 }
5495 /* }}} */
5496 
5497 /* {{{ proto int connection_aborted(void)
5498    Returns true if client disconnected */
5499 PHP_FUNCTION(connection_aborted)
5500 {
5501 	RETURN_LONG(PG(connection_status) & PHP_CONNECTION_ABORTED);
5502 }
5503 /* }}} */
5504 
5505 /* {{{ proto int connection_status(void)
5506    Returns the connection status bitfield */
5507 PHP_FUNCTION(connection_status)
5508 {
5509 	RETURN_LONG(PG(connection_status));
5510 }
5511 /* }}} */
5512 
5513 /* {{{ proto int ignore_user_abort([bool value])
5514    Set whether we want to ignore a user abort event or not */
5515 PHP_FUNCTION(ignore_user_abort)
5516 {
5517 	zend_bool arg = 0;
5518 	int old_setting;
5519 
5520 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &arg) == FAILURE) {
5521 		return;
5522 	}
5523 
5524 	old_setting = (unsigned short)PG(ignore_user_abort);
5525 
5526 	if (ZEND_NUM_ARGS()) {
5527 		zend_string *key = zend_string_init("ignore_user_abort", sizeof("ignore_user_abort") - 1, 0);
5528 		zend_alter_ini_entry_chars(key, arg ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
5529 		zend_string_release(key);
5530 	}
5531 
5532 	RETURN_LONG(old_setting);
5533 }
5534 /* }}} */
5535 
5536 #if HAVE_GETSERVBYNAME
5537 /* {{{ proto int getservbyname(string service, string protocol)
5538    Returns port associated with service. Protocol must be "tcp" or "udp" */
5539 PHP_FUNCTION(getservbyname)
5540 {
5541 	char *name, *proto;
5542 	size_t name_len, proto_len;
5543 	struct servent *serv;
5544 
5545 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &proto, &proto_len) == FAILURE) {
5546 		return;
5547 	}
5548 
5549 
5550 /* empty string behaves like NULL on windows implementation of
5551    getservbyname. Let be portable instead. */
5552 #ifdef PHP_WIN32
5553 	if (proto_len == 0) {
5554 		RETURN_FALSE;
5555 	}
5556 #endif
5557 
5558 	serv = getservbyname(name, proto);
5559 
5560 #if defined(_AIX)
5561 	/*
5562         On AIX, imap is only known as imap2 in /etc/services, while on Linux imap is an alias for imap2.
5563         If a request for imap gives no result, we try again with imap2.
5564         */
5565 	if (serv == NULL && strcmp(name,  "imap") == 0) {
5566 		serv = getservbyname("imap2", proto);
5567 	}
5568 #endif
5569 	if (serv == NULL) {
5570 		RETURN_FALSE;
5571 	}
5572 
5573 	RETURN_LONG(ntohs(serv->s_port));
5574 }
5575 /* }}} */
5576 #endif
5577 
5578 #if HAVE_GETSERVBYPORT
5579 /* {{{ proto string getservbyport(int port, string protocol)
5580    Returns service name associated with port. Protocol must be "tcp" or "udp" */
5581 PHP_FUNCTION(getservbyport)
5582 {
5583 	char *proto;
5584 	size_t proto_len;
5585 	zend_long port;
5586 	struct servent *serv;
5587 
5588 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &port, &proto, &proto_len) == FAILURE) {
5589 		return;
5590 	}
5591 
5592 	serv = getservbyport(htons((unsigned short) port), proto);
5593 
5594 	if (serv == NULL) {
5595 		RETURN_FALSE;
5596 	}
5597 
5598 	RETURN_STRING(serv->s_name);
5599 }
5600 /* }}} */
5601 #endif
5602 
5603 #if HAVE_GETPROTOBYNAME
5604 /* {{{ proto int getprotobyname(string name)
5605    Returns protocol number associated with name as per /etc/protocols */
5606 PHP_FUNCTION(getprotobyname)
5607 {
5608 	char *name;
5609 	size_t name_len;
5610 	struct protoent *ent;
5611 
5612 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
5613 		return;
5614 	}
5615 
5616 	ent = getprotobyname(name);
5617 
5618 	if (ent == NULL) {
5619 		RETURN_FALSE;
5620 	}
5621 
5622 	RETURN_LONG(ent->p_proto);
5623 }
5624 /* }}} */
5625 #endif
5626 
5627 #if HAVE_GETPROTOBYNUMBER
5628 /* {{{ proto string getprotobynumber(int proto)
5629    Returns protocol name associated with protocol number proto */
5630 PHP_FUNCTION(getprotobynumber)
5631 {
5632 	zend_long proto;
5633 	struct protoent *ent;
5634 
5635 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &proto) == FAILURE) {
5636 		return;
5637 	}
5638 
5639 	ent = getprotobynumber((int)proto);
5640 
5641 	if (ent == NULL) {
5642 		RETURN_FALSE;
5643 	}
5644 
5645 	RETURN_STRING(ent->p_name);
5646 }
5647 /* }}} */
5648 #endif
5649 
5650 /* {{{ proto bool register_tick_function(string function_name [, mixed arg [, mixed ... ]])
5651    Registers a tick callback function */
5652 PHP_FUNCTION(register_tick_function)
5653 {
5654 	user_tick_function_entry tick_fe;
5655 	int i;
5656 	zend_string *function_name = NULL;
5657 
5658 	tick_fe.calling = 0;
5659 	tick_fe.arg_count = ZEND_NUM_ARGS();
5660 
5661 	if (tick_fe.arg_count < 1) {
5662 		WRONG_PARAM_COUNT;
5663 	}
5664 
5665 	tick_fe.arguments = (zval *) safe_emalloc(sizeof(zval), tick_fe.arg_count, 0);
5666 
5667 	if (zend_get_parameters_array(ZEND_NUM_ARGS(), tick_fe.arg_count, tick_fe.arguments) == FAILURE) {
5668 		efree(tick_fe.arguments);
5669 		RETURN_FALSE;
5670 	}
5671 
5672 	if (!zend_is_callable(&tick_fe.arguments[0], 0, &function_name)) {
5673 		efree(tick_fe.arguments);
5674 		php_error_docref(NULL, E_WARNING, "Invalid tick callback '%s' passed", ZSTR_VAL(function_name));
5675 		zend_string_release(function_name);
5676 		RETURN_FALSE;
5677 	} else if (function_name) {
5678 		zend_string_release(function_name);
5679 	}
5680 
5681 	if (Z_TYPE(tick_fe.arguments[0]) != IS_ARRAY && Z_TYPE(tick_fe.arguments[0]) != IS_OBJECT) {
5682 		convert_to_string_ex(&tick_fe.arguments[0]);
5683 	}
5684 
5685 	if (!BG(user_tick_functions)) {
5686 		BG(user_tick_functions) = (zend_llist *) emalloc(sizeof(zend_llist));
5687 		zend_llist_init(BG(user_tick_functions),
5688 						sizeof(user_tick_function_entry),
5689 						(llist_dtor_func_t) user_tick_function_dtor, 0);
5690 		php_add_tick_function(run_user_tick_functions, NULL);
5691 	}
5692 
5693 	for (i = 0; i < tick_fe.arg_count; i++) {
5694 		if (Z_REFCOUNTED(tick_fe.arguments[i])) {
5695 			Z_ADDREF(tick_fe.arguments[i]);
5696 		}
5697 	}
5698 
5699 	zend_llist_add_element(BG(user_tick_functions), &tick_fe);
5700 
5701 	RETURN_TRUE;
5702 }
5703 /* }}} */
5704 
5705 /* {{{ proto void unregister_tick_function(string function_name)
5706    Unregisters a tick callback function */
5707 PHP_FUNCTION(unregister_tick_function)
5708 {
5709 	zval *function;
5710 	user_tick_function_entry tick_fe;
5711 
5712 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/", &function) == FAILURE) {
5713 		return;
5714 	}
5715 
5716 	if (!BG(user_tick_functions)) {
5717 		return;
5718 	}
5719 
5720 	if (Z_TYPE_P(function) != IS_ARRAY && Z_TYPE_P(function) != IS_OBJECT) {
5721 		convert_to_string(function);
5722 	}
5723 
5724 	tick_fe.arguments = (zval *) emalloc(sizeof(zval));
5725 	ZVAL_COPY_VALUE(&tick_fe.arguments[0], function);
5726 	tick_fe.arg_count = 1;
5727 	zend_llist_del_element(BG(user_tick_functions), &tick_fe, (int (*)(void *, void *)) user_tick_function_compare);
5728 	efree(tick_fe.arguments);
5729 }
5730 /* }}} */
5731 
5732 /* {{{ proto bool is_uploaded_file(string path)
5733    Check if file was created by rfc1867 upload */
5734 PHP_FUNCTION(is_uploaded_file)
5735 {
5736 	char *path;
5737 	size_t path_len;
5738 
5739 	if (!SG(rfc1867_uploaded_files)) {
5740 		RETURN_FALSE;
5741 	}
5742 
5743 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &path, &path_len) == FAILURE) {
5744 		return;
5745 	}
5746 
5747 	if (zend_hash_str_exists(SG(rfc1867_uploaded_files), path, path_len)) {
5748 		RETURN_TRUE;
5749 	} else {
5750 		RETURN_FALSE;
5751 	}
5752 }
5753 /* }}} */
5754 
5755 /* {{{ proto bool move_uploaded_file(string path, string new_path)
5756    Move a file if and only if it was created by an upload */
5757 PHP_FUNCTION(move_uploaded_file)
5758 {
5759 	char *path, *new_path;
5760 	size_t path_len, new_path_len;
5761 	zend_bool successful = 0;
5762 
5763 #ifndef PHP_WIN32
5764 	int oldmask; int ret;
5765 #endif
5766 
5767 	if (!SG(rfc1867_uploaded_files)) {
5768 		RETURN_FALSE;
5769 	}
5770 
5771 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "sp", &path, &path_len, &new_path, &new_path_len) == FAILURE) {
5772 		return;
5773 	}
5774 
5775 	if (!zend_hash_str_exists(SG(rfc1867_uploaded_files), path, path_len)) {
5776 		RETURN_FALSE;
5777 	}
5778 
5779 	if (php_check_open_basedir(new_path)) {
5780 		RETURN_FALSE;
5781 	}
5782 
5783 	if (VCWD_RENAME(path, new_path) == 0) {
5784 		successful = 1;
5785 #ifndef PHP_WIN32
5786 		oldmask = umask(077);
5787 		umask(oldmask);
5788 
5789 		ret = VCWD_CHMOD(new_path, 0666 & ~oldmask);
5790 
5791 		if (ret == -1) {
5792 			php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
5793 		}
5794 #endif
5795 	} else if (php_copy_file_ex(path, new_path, STREAM_DISABLE_OPEN_BASEDIR) == SUCCESS) {
5796 		VCWD_UNLINK(path);
5797 		successful = 1;
5798 	}
5799 
5800 	if (successful) {
5801 		zend_hash_str_del(SG(rfc1867_uploaded_files), path, path_len);
5802 	} else {
5803 		php_error_docref(NULL, E_WARNING, "Unable to move '%s' to '%s'", path, new_path);
5804 	}
5805 
5806 	RETURN_BOOL(successful);
5807 }
5808 /* }}} */
5809 
5810 /* {{{ php_simple_ini_parser_cb
5811  */
5812 static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_type, zval *arr)
5813 {
5814 	switch (callback_type) {
5815 
5816 		case ZEND_INI_PARSER_ENTRY:
5817 			if (!arg2) {
5818 				/* bare string - nothing to do */
5819 				break;
5820 			}
5821 			Z_TRY_ADDREF_P(arg2);
5822 			zend_symtable_update(Z_ARRVAL_P(arr), Z_STR_P(arg1), arg2);
5823 			break;
5824 
5825 		case ZEND_INI_PARSER_POP_ENTRY:
5826 		{
5827 			zval hash, *find_hash;
5828 
5829 			if (!arg2) {
5830 				/* bare string - nothing to do */
5831 				break;
5832 			}
5833 
5834 			if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) {
5835 				zend_ulong key = (zend_ulong) zend_atol(Z_STRVAL_P(arg1), (int)Z_STRLEN_P(arg1));
5836 				if ((find_hash = zend_hash_index_find(Z_ARRVAL_P(arr), key)) == NULL) {
5837 					array_init(&hash);
5838 					find_hash = zend_hash_index_update(Z_ARRVAL_P(arr), key, &hash);
5839 				}
5840 			} else {
5841 				if ((find_hash = zend_hash_find(Z_ARRVAL_P(arr), Z_STR_P(arg1))) == NULL) {
5842 					array_init(&hash);
5843 					find_hash = zend_hash_update(Z_ARRVAL_P(arr), Z_STR_P(arg1), &hash);
5844 				}
5845 			}
5846 
5847 			if (Z_TYPE_P(find_hash) != IS_ARRAY) {
5848 				zval_dtor(find_hash);
5849 				array_init(find_hash);
5850 			}
5851 
5852 			if (!arg3 || (Z_TYPE_P(arg3) == IS_STRING && Z_STRLEN_P(arg3) == 0)) {
5853 				Z_TRY_ADDREF_P(arg2);
5854 				add_next_index_zval(find_hash, arg2);
5855 			} else {
5856 				array_set_zval_key(Z_ARRVAL_P(find_hash), arg3, arg2);
5857 			}
5858 		}
5859 		break;
5860 
5861 		case ZEND_INI_PARSER_SECTION:
5862 			break;
5863 	}
5864 }
5865 /* }}} */
5866 
5867 /* {{{ php_ini_parser_cb_with_sections
5868  */
5869 static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, zval *arg3, int callback_type, zval *arr)
5870 {
5871 	if (callback_type == ZEND_INI_PARSER_SECTION) {
5872 		array_init(&BG(active_ini_file_section));
5873 		zend_symtable_update(Z_ARRVAL_P(arr), Z_STR_P(arg1), &BG(active_ini_file_section));
5874 	} else if (arg2) {
5875 		zval *active_arr;
5876 
5877 		if (Z_TYPE(BG(active_ini_file_section)) != IS_UNDEF) {
5878 			active_arr = &BG(active_ini_file_section);
5879 		} else {
5880 			active_arr = arr;
5881 		}
5882 
5883 		php_simple_ini_parser_cb(arg1, arg2, arg3, callback_type, active_arr);
5884 	}
5885 }
5886 /* }}} */
5887 
5888 /* {{{ proto array parse_ini_file(string filename [, bool process_sections [, int scanner_mode]])
5889    Parse configuration file */
5890 PHP_FUNCTION(parse_ini_file)
5891 {
5892 	char *filename = NULL;
5893 	size_t filename_len = 0;
5894 	zend_bool process_sections = 0;
5895 	zend_long scanner_mode = ZEND_INI_SCANNER_NORMAL;
5896 	zend_file_handle fh;
5897 	zend_ini_parser_cb_t ini_parser_cb;
5898 
5899 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|bl", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) {
5900 		RETURN_FALSE;
5901 	}
5902 
5903 	if (filename_len == 0) {
5904 		php_error_docref(NULL, E_WARNING, "Filename cannot be empty!");
5905 		RETURN_FALSE;
5906 	}
5907 
5908 	/* Set callback function */
5909 	if (process_sections) {
5910 		ZVAL_UNDEF(&BG(active_ini_file_section));
5911 		ini_parser_cb = (zend_ini_parser_cb_t) php_ini_parser_cb_with_sections;
5912 	} else {
5913 		ini_parser_cb = (zend_ini_parser_cb_t) php_simple_ini_parser_cb;
5914 	}
5915 
5916 	/* Setup filehandle */
5917 	memset(&fh, 0, sizeof(fh));
5918 	fh.filename = filename;
5919 	fh.type = ZEND_HANDLE_FILENAME;
5920 
5921 	array_init(return_value);
5922 	if (zend_parse_ini_file(&fh, 0, (int)scanner_mode, ini_parser_cb, return_value) == FAILURE) {
5923 		zval_dtor(return_value);
5924 		RETURN_FALSE;
5925 	}
5926 }
5927 /* }}} */
5928 
5929 /* {{{ proto array parse_ini_string(string ini_string [, bool process_sections [, int scanner_mode]])
5930    Parse configuration string */
5931 PHP_FUNCTION(parse_ini_string)
5932 {
5933 	char *string = NULL, *str = NULL;
5934 	size_t str_len = 0;
5935 	zend_bool process_sections = 0;
5936 	zend_long scanner_mode = ZEND_INI_SCANNER_NORMAL;
5937 	zend_ini_parser_cb_t ini_parser_cb;
5938 
5939 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|bl", &str, &str_len, &process_sections, &scanner_mode) == FAILURE) {
5940 		RETURN_FALSE;
5941 	}
5942 
5943 	if (INT_MAX - str_len < ZEND_MMAP_AHEAD) {
5944 		RETVAL_FALSE;
5945 	}
5946 
5947 	/* Set callback function */
5948 	if (process_sections) {
5949 		ZVAL_UNDEF(&BG(active_ini_file_section));
5950 		ini_parser_cb = (zend_ini_parser_cb_t) php_ini_parser_cb_with_sections;
5951 	} else {
5952 		ini_parser_cb = (zend_ini_parser_cb_t) php_simple_ini_parser_cb;
5953 	}
5954 
5955 	/* Setup string */
5956 	string = (char *) emalloc(str_len + ZEND_MMAP_AHEAD);
5957 	memcpy(string, str, str_len);
5958 	memset(string + str_len, 0, ZEND_MMAP_AHEAD);
5959 
5960 	array_init(return_value);
5961 	if (zend_parse_ini_string(string, 0, (int)scanner_mode, ini_parser_cb, return_value) == FAILURE) {
5962 		zval_dtor(return_value);
5963 		RETVAL_FALSE;
5964 	}
5965 	efree(string);
5966 }
5967 /* }}} */
5968 
5969 #if ZEND_DEBUG
5970 /* This function returns an array of ALL valid ini options with values and
5971  *  is not the same as ini_get_all() which returns only registered ini options. Only useful for devs to debug php.ini scanner/parser! */
5972 PHP_FUNCTION(config_get_hash) /* {{{ */
5973 {
5974 	HashTable *hash = php_ini_get_configuration_hash();
5975 
5976 	array_init(return_value);
5977 	zend_hash_apply_with_arguments(hash, add_config_entry_cb, 1, return_value);
5978 }
5979 /* }}} */
5980 #endif
5981 
5982 #ifdef HAVE_GETLOADAVG
5983 /* {{{ proto array sys_getloadavg()
5984 */
5985 PHP_FUNCTION(sys_getloadavg)
5986 {
5987 	double load[3];
5988 
5989 	if (zend_parse_parameters_none() == FAILURE) {
5990 		return;
5991 	}
5992 
5993 	if (getloadavg(load, 3) == -1) {
5994 		RETURN_FALSE;
5995 	} else {
5996 		array_init(return_value);
5997 		add_index_double(return_value, 0, load[0]);
5998 		add_index_double(return_value, 1, load[1]);
5999 		add_index_double(return_value, 2, load[2]);
6000 	}
6001 }
6002 /* }}} */
6003 #endif
6004 
6005 /*
6006  * Local variables:
6007  * tab-width: 4
6008  * c-basic-offset: 4
6009  * End:
6010  * vim600: fdm=marker
6011  * vim: noet sw=4 ts=4
6012  */
6013