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