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