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