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