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