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