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