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