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