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