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