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