summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2002-10-11 04:44:15 +0000
committerSVN Migration <svn@php.net>2002-10-11 04:44:15 +0000
commite53a821b97f4c64e5427b12ac4d3dfd117da3c96 (patch)
tree3a2a6f24febf91beef8b07a2b57d7d899da49263
parentbc14a6f1338891d7f8f169895d2913293dc61188 (diff)
downloadphp-git-php-4.3.0pre1.tar.gz
This commit was manufactured by cvs2svn to create tag 'php_4_3_0pre1'.php-4.3.0pre1
-rw-r--r--Zend/ChangeLog10000
-rw-r--r--Zend/FlexLexer.h186
-rw-r--r--Zend/LICENSE56
-rw-r--r--Zend/Makefile.am51
-rw-r--r--Zend/OBJECTS2_HOWTO193
-rw-r--r--Zend/RFCs/001.txt136
-rw-r--r--Zend/RFCs/002.txt169
-rw-r--r--Zend/RFCs/003.txt72
-rw-r--r--Zend/RFCs/004.txt107
-rw-r--r--Zend/ZEND_CHANGES741
-rw-r--r--Zend/Zend.dsp510
-rw-r--r--Zend/Zend.m4232
-rw-r--r--Zend/ZendCore.dep258
-rw-r--r--Zend/ZendTS.dsp691
-rw-r--r--Zend/acconfig.h81
-rw-r--r--Zend/acinclude.m447
-rw-r--r--Zend/build.mk43
-rwxr-xr-xZend/buildconf33
-rw-r--r--Zend/configure.in45
-rw-r--r--Zend/flex.skl1633
-rw-r--r--Zend/tests/zend2.php339
-rw-r--r--Zend/zend.c936
-rw-r--r--Zend/zend.h586
-rw-r--r--Zend/zend.icobin1382 -> 0 bytes
-rw-r--r--Zend/zend_API.c1426
-rw-r--r--Zend/zend_API.h431
-rw-r--r--Zend/zend_alloc.c752
-rw-r--r--Zend/zend_alloc.h141
-rw-r--r--Zend/zend_builtin_functions.c1490
-rw-r--r--Zend/zend_builtin_functions.h26
-rw-r--r--Zend/zend_compile.c3055
-rw-r--r--Zend/zend_compile.h723
-rw-r--r--Zend/zend_config.nw.h79
-rw-r--r--Zend/zend_config.w32.h93
-rw-r--r--Zend/zend_constants.c273
-rw-r--r--Zend/zend_constants.h64
-rw-r--r--Zend/zend_dynamic_array.c62
-rw-r--r--Zend/zend_dynamic_array.h38
-rw-r--r--Zend/zend_errors.h40
-rw-r--r--Zend/zend_execute.c3182
-rw-r--r--Zend/zend_execute.h167
-rw-r--r--Zend/zend_execute_API.c990
-rw-r--r--Zend/zend_execute_locks.h32
-rw-r--r--Zend/zend_extensions.c279
-rw-r--r--Zend/zend_extensions.h116
-rw-r--r--Zend/zend_fast_cache.h140
-rw-r--r--Zend/zend_globals.h266
-rw-r--r--Zend/zend_globals_macros.h109
-rw-r--r--Zend/zend_hash.c1324
-rw-r--r--Zend/zend_hash.h274
-rw-r--r--Zend/zend_highlight.c247
-rw-r--r--Zend/zend_highlight.h52
-rw-r--r--Zend/zend_indent.c147
-rw-r--r--Zend/zend_indent.h26
-rw-r--r--Zend/zend_ini.c509
-rw-r--r--Zend/zend_ini.h199
-rw-r--r--Zend/zend_ini_parser.y236
-rw-r--r--Zend/zend_ini_scanner.h12
-rw-r--r--Zend/zend_ini_scanner.l228
-rw-r--r--Zend/zend_istdiostream.h15
-rw-r--r--Zend/zend_language_parser.y852
-rw-r--r--Zend/zend_language_scanner.h41
-rw-r--r--Zend/zend_language_scanner.l1516
-rw-r--r--Zend/zend_list.c367
-rw-r--r--Zend/zend_list.h111
-rw-r--r--Zend/zend_llist.c308
-rw-r--r--Zend/zend_llist.h77
-rw-r--r--Zend/zend_mm.c320
-rw-r--r--Zend/zend_mm.h63
-rw-r--r--Zend/zend_modules.h88
-rw-r--r--Zend/zend_multibyte.c0
-rw-r--r--Zend/zend_object_handlers.c498
-rw-r--r--Zend/zend_object_handlers.h79
-rw-r--r--Zend/zend_objects.c124
-rw-r--r--Zend/zend_objects.h10
-rw-r--r--Zend/zend_objects_API.c263
-rw-r--r--Zend/zend_objects_API.h49
-rw-r--r--Zend/zend_opcode.c411
-rw-r--r--Zend/zend_operators.c1766
-rw-r--r--Zend/zend_operators.h274
-rw-r--r--Zend/zend_ptr_stack.c110
-rw-r--r--Zend/zend_ptr_stack.h58
-rw-r--r--Zend/zend_qsort.c127
-rw-r--r--Zend/zend_qsort.h26
-rw-r--r--Zend/zend_sprintf.c40
-rw-r--r--Zend/zend_stack.c164
-rw-r--r--Zend/zend_stack.h47
-rw-r--r--Zend/zend_static_allocator.c75
-rw-r--r--Zend/zend_static_allocator.h45
-rw-r--r--Zend/zend_ts_hash.c342
-rw-r--r--Zend/zend_ts_hash.h121
-rw-r--r--Zend/zend_types.h29
-rw-r--r--Zend/zend_variables.c173
-rw-r--r--Zend/zend_variables.h57
-rw-r--r--configure.in2
-rw-r--r--ext/imap/imap.h103
-rw-r--r--ext/pcre/config0.m457
-rw-r--r--ext/soap/EXPERIMENTAL0
-rw-r--r--ext/soap/Makefile13
-rw-r--r--ext/soap/Makefile.in8
-rw-r--r--ext/soap/TODO36
-rw-r--r--ext/soap/config.m416
-rw-r--r--ext/soap/interop/base.php25
-rw-r--r--ext/soap/interop/client_round2.php102
-rw-r--r--ext/soap/interop/client_round2_interop.php796
-rw-r--r--ext/soap/interop/client_round2_params.php636
-rw-r--r--ext/soap/interop/client_round2_results.php75
-rw-r--r--ext/soap/interop/client_round2_run.php54
-rw-r--r--ext/soap/interop/database_round2.sql45
-rw-r--r--ext/soap/interop/echoheadersvc.wsdl16
-rw-r--r--ext/soap/interop/endpointdata.sql85
-rw-r--r--ext/soap/interop/index.php70
-rw-r--r--ext/soap/interop/info.php1
-rw-r--r--ext/soap/interop/interop.wsdl18
-rw-r--r--ext/soap/interop/interopB.wsdl13
-rw-r--r--ext/soap/interop/server_round2.php35
-rw-r--r--ext/soap/interop/server_round2_base.php184
-rw-r--r--ext/soap/interop/server_round2_groupB.php87
-rw-r--r--ext/soap/interop/server_round2_groupC.php41
-rw-r--r--ext/soap/interop/server_round2_test.php258
-rw-r--r--ext/soap/interop/test.utility.php81
-rw-r--r--ext/soap/interop/testclient.php17
-rw-r--r--ext/soap/interop/testserver.php17
-rw-r--r--ext/soap/libs.mk7
-rw-r--r--ext/soap/package.xml61
-rw-r--r--ext/soap/php_encoding.c1125
-rw-r--r--ext/soap/php_encoding.h256
-rw-r--r--ext/soap/php_http.c494
-rw-r--r--ext/soap/php_http.h25
-rw-r--r--ext/soap/php_packet_soap.c138
-rw-r--r--ext/soap/php_packet_soap.h6
-rw-r--r--ext/soap/php_schema.c1076
-rw-r--r--ext/soap/php_schema.h28
-rw-r--r--ext/soap/php_sdl.c1126
-rw-r--r--ext/soap/php_sdl.h167
-rw-r--r--ext/soap/php_soap.dsp148
-rw-r--r--ext/soap/php_soap.h418
-rw-r--r--ext/soap/php_xml.c214
-rw-r--r--ext/soap/php_xml.h23
-rw-r--r--ext/soap/soap.c2268
-rw-r--r--ext/standard/formatted_print.c6
-rw-r--r--main/config.w32.h.in25
-rw-r--r--main/php_realpath.c283
-rw-r--r--main/php_version.h4
-rw-r--r--strtok_r.c113
-rw-r--r--tests/lang/034.phpt6
146 files changed, 21 insertions, 53906 deletions
diff --git a/Zend/ChangeLog b/Zend/ChangeLog
deleted file mode 100644
index 531ff49a23..0000000000
--- a/Zend/ChangeLog
+++ /dev/null
@@ -1,10000 +0,0 @@
-2002-10-09 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.c: Fix object write handler behaviour:
- * If this value is already set to given value, don't try to set it again.
- * If we have reference, we should not move it.
- * If we are assigning referenced variable, we should separate it.
-
-2002-10-09 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_API.c
- zend_builtin_functions.c
- zend_compile.c
- zend_constants.c
- zend_execute.c
- zend_execute_API.c
- zend_language_parser.y
- zend_object_handlers.c
- zend_operators.c
- zend_operators.h: MFZE1 zend_str_tolower issue.
-
-2002-10-07 Andi Gutmans <andi@zend.com>
-
- * tests/zend2.php: - Fix test
-
- * zend_execute.c:
- - Require $this-> when calling a methods. This whole automatic lookup
- - first in the class and then in the global scope is confusing, slow and
- - not quite BC compatible.
-
- * zend.c
- zend_compile.c
- zend_globals.h:
- - Allow access to private/protected variables of $clone inside the __clone()
- - method
-
-2002-10-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fix problem with unsetting object members.
-
-2002-10-01 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y:
- - Fix problem when crashing on illegal tokens in class name during class
- - definition.
-
-2002-09-30 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ZEND_CHANGES: - No tabs :)
-
-2002-09-28 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_builtin_functions.c: - Fix for defines...
-
- * zend_builtin_functions.c: - Fix build in non-ZTS mode
-
-2002-09-26 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_API.c
- zend_builtin_functions.c
- zend_compile.c
- zend_constants.c
- zend_execute.c
- zend_execute_API.c
- zend_language_parser.y
- zend_object_handlers.c
- zend_operators.c
- zend_operators.h: MFZE1
-
-2002-09-25 Stanislav Malyshev <stas@zend.com>
-
- * zend_extensions.h:
- Propmote API NO year, so that it will never be the same as ZE1 API NO
-
-2002-09-24 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Fix leak
-
- * zend_language_parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- - Megapatch to try and support inheritance from sub-classes. Things might
- - be *very* buggy now so don't get too upset if that happens.
- - I still need to improve some stuff but it's a good step (hopefully).
-
-2002-09-23 Andi Gutmans <andi@zend.com>
-
- * zend_globals.h
- zend_ini.c
- zend_language_parser.y: - MFZE1.
-
-2002-09-21 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.h: - Someone screwed this up.
-
-2002-09-19 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_ini.c: - Make Colin happy
-
-2002-09-19 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_execute_API.c: MFZE1 - connection_status() fix
-
- * zend.c: Fix non ZTS build
-
- * zend.c: Fix that obscure crash in Debug_TS mode
-
-2002-09-18 Zeev Suraski <zeev@zend.com>
-
- * zend.c:
- Fix the thread-safe initialization of the ZE2. This should solve some
- sporadic crashes, as well as the problem with the built-in constants.
-
- * zend_constants.c: Remove dead code
-
- * zend_builtin_functions.c: Add useful debugging function
-
-2002-09-17 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c
- zend_hash.h: Add tracking for hashtable allocation
-
- * zend.c: ZE2 fix
-
- * zend_compile.c: whitespace
-
- * zend.c
- zend.h: MFZE1 - threading fix
-
-2002-09-16 Andrei Zmievski <andrei@php.net>
-
- * zend_API.h
- zend_builtin_functions.c
- zend_API.c
- zend_execute_API.c: MFZE1
-
-2002-09-15 Ilia Alshanetsky <ilia@prohost.org>
-
- * zend_highlight.c: Make zend actually strip comments. Bug #18151
-
- * zend.c:
- Make zend return a proper exit error code when it encounters a parse error.
-
-2002-09-15 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Hopefully fix problem with __autoload not working well with inherited classes.
- - There might still be some weird situations I haven't thought of.
-
- * zend_list.c
- zend_execute.c: - WS fix - "while (" instead of "while("
-
- * zend_execute_API.c
- zend_ini.c
- zend_list.c
- zend_object_handlers.c
- zend_objects_API.c
- zend_operators.c
- zend_API.c
- zend_builtin_functions.c
- zend_compile.c
- zend_execute.c: - WS - Always use "if (" and not "if("
-
- * zend_execute_API.c: - WS
-
-2002-09-10 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute_API.c
- zend_variables.c: MFZE1
-
-2002-09-09 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.c: remove comment
-
-2002-09-08 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Prepare for alpha 3
-
-2002-09-05 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c: quick-n-dirty inheritance support for __handlers
-
-2002-09-04 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Whitespace fixes.
-
-2002-09-04 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.c: remove dead code
-
- * ZEND_CHANGES
- zend_object_handlers.c: Fix __call and add some docs
-
-2002-09-04 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_object_handlers.c: Fix ZTS build.
-
- * ZEND_CHANGES: TBD: __call(), __get(), __set().
-
-2002-09-04 Stanislav Malyshev <stas@zend.com>
-
- * zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_extensions.h
- zend_object_handlers.c
- zend_objects.c: Support for __get, __set and __call in classes.
- This should work as follows: if class hasn't member with given name,
- __get/__set is called. If class has no method with given name, __call is called.
- __get/__set are not recursive, __call can be.
-
-2002-09-04 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Workaround for superfluous comma in var_export() result.
-
- * ZEND_CHANGES:
- Let debug_backtrace() example print out the class name, if applicable, and the function/method arguments.
-
-2002-09-03 Thies C. Arntzen <thies@thieso.net>
-
- * zend_builtin_functions.c: nuke warning
-
- * zend_builtin_functions.c: nuke unneeded stuff
-
-2002-09-03 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_ini.c: MFZE1
-
-2002-09-03 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_ini.c: - Revert
-
- * zend_ini.c:
- - MFH for: Apply rest of html errors fix (Patch by Jan Lehnardt <jan@php.net>)
-
-2002-09-03 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend.h:
- Add html_errors to zend_utility_values. Patch by Jan Lehnardt <jan@php.net>.
-
-2002-09-03 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Fix typo
-
-2002-09-02 Thies C. Arntzen <thies@thieso.net>
-
- * zend_builtin_functions.c:
- refine last patch. if the argument-stack is not consistent don't try to show
- arguments. no call to zend_error is made as we might end up in an infinite
- recursion if called from an error_handler.
- so: if the arguments to functions aren't shown in debug_backtrace this is 'cause
- the arument stack was not consistent when debug_backtrace was called.
-
- * zend_builtin_functions.c:
- debug_backtrace() now checks the complete argument-stack for consistency.
-
-2002-09-02 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c: MFZE1
-
-2002-09-01 Andi Gutmans <andi@zend.com>
-
- * zend_llist.c: - Fix leak reported by "l0t3k" <cshmoove@hotmail.com>
-
-2002-09-01 Stanislav Malyshev <stas@zend.com>
-
- * zend_operators.c: MFZE1
-
-2002-08-28 Thies Arntzen <thies@pb1.pair.com>
-
- * zend_builtin_functions.c
- zend_execute_API.c: debug_backtrace()
- - make args passed to functions called vy call_user_function available again.
-
- * zend_builtin_functions.c: debug_backtrace():
- - make args work if called from the error_handler
- - fix refcount for args
-
- * zend.c:
- clear current_execute_data on bailout as it would point into some freed area
- on the stack.
-
-2002-08-28 derick <derick@pb1.pair.com>
-
- * zend.c: - MFZE1
-
-2002-08-26 Thies Arntzen <thies@pb1.pair.com>
-
- * zend_builtin_functions.c:
- debug_backtrace(): show name of included file for include and require calls
- plus some small fixes suggested by andi.
-
-2002-08-24 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_builtin_functions.c: - Whitespace
-
- * zend_builtin_functions.c: - Whitespace and better variable name
-
-2002-08-24 Thies Arntzen <thies@pb1.pair.com>
-
- * zend_builtin_functions.c: fix warning
-
-2002-08-23 Andi Gutmans <andi@pb1.pair.com>
-
- * Zend.m4: - Add \n to configure fprintf
-
- * zend_extensions.c: - dlerror -> DL_ERROR
-
-2002-08-23 Thies Arntzen <thies@pb1.pair.com>
-
- * zend_builtin_functions.c:
- debug_backtrace: show include/require/eval as normal functions on the stack
-
-2002-08-23 derick <derick@pb1.pair.com>
-
- * zend_builtin_functions.c: - No spaces :)
-
-2002-08-23 Thies Arntzen <thies@pb1.pair.com>
-
- * zend_builtin_functions.c:
- - debug_backtrace now also returns an array containing the arguments of the
- called function.
-
- zeev, andi - is knowing the structure of the stack considered a bad thing in
- zend_builtin_function? if yes i would have to create a new function in
- zend_ptr_stack.c (but i think we are save this way)
-
- * zend_builtin_functions.c
- zend_execute_API.c: - debug_backtrace:
- added "type" ('->' or '::') for object calls.
- made calls done thru call_user_func show-up correct in backtraces.
-
- andi,
- does this look correct to you?
-
- * zend_execute.c: those are set by RETURN_FROM_EXECUTE
-
-2002-08-21 Thies Arntzen <thies@pb1.pair.com>
-
- * zend_execute.c:
- zend_execute: make sure that current_execute_data points to the right thing
- after coming back from recursion.
-
-2002-08-19 Zeev Suraski <zeev@pb1.pair.com>
-
- * zend_operators.c: MFZE1
-
-2002-08-17 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_execute.c: MFZE1
-
-2002-08-17 Zeev Suraski <zeev@pb1.pair.com>
-
- * zend_execute.c
- zend_hash.c: MFZE1
-
-2002-08-16 Stig Bakken <ssb@pb1.pair.com>
-
- * zend.c: * append emacs footer
-
- * zend.c: * remove builtin exception class
-
-2002-08-16 Andi Gutmans <andi@pb1.pair.com>
-
- * zend.c: - Fix whitespace
-
-2002-08-16 Stig Bakken <ssb@pb1.pair.com>
-
- * zend_execute_API.c
- zend_globals.h
- zend.c
- zend_builtin_functions.c:
- - Added set_exception_handler() function for registering a global,
- catch-all exception handling function
- - Added set_exception_handler() function for registering a global,
- catch-all exception handling function (Stig)
-
-2002-08-15 Zeev Suraski <zeev@pb1.pair.com>
-
- * flex.skl
- zend.c
- zend_globals.h
- zend_language_scanner.l: MFZE1
-
-2002-08-14 jason <jason@pb1.pair.com>
-
- * zend_compile.c
- zend_compile.h
- zend_globals.h
- zend_language_parser.y:
- MFZE1 (use token instead of global for opcode counting)
-
-2002-08-13 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_execute_API.c:
- - Fix crash when exception is raised in __autoload function
-
-2002-08-13 Zeev Suraski <zeev@pb1.pair.com>
-
- * zend.h: MFZE1
-
-2002-08-08 sebastian <sebastian@pb1.pair.com>
-
- * zend_objects.c: Fix warning.
-
-2002-08-08 stas <stas@pb1.pair.com>
-
- * zend_objects.c
- zend_objects.h
- zend_objects_API.c
- zend_objects_API.h: Add ZEND_API to functions
-
-2002-08-08 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y
- zend_language_scanner.l
- zend_operators.c
- zend_operators.h:
- - Make new 'is' operator work with classes only and return false when
- - the object isn't of the said class or the value isn't an object.
-
- * zend_static_allocator.c: - Bad Harald! :)
-
-2002-08-08 Zeev Suraski <zeev@pb1.pair.com>
-
- * zend_alloc.c: MFZE1
-
-2002-08-07 phanto <phanto@pb1.pair.com>
-
- * zend_static_allocator.c
- zend_alloc.c
- zend_config.w32.h
- zend_hash.c
- zend_ini.c
- zend_llist.h
- zend_mm.c
- zend_operators.c: make win32 debug output more verbose
-
-2002-08-03 Andi Gutmans <andi@pb1.pair.com>
-
- * tests/zend2.php: - Small fix
-
-2002-08-03 Zeev Suraski <zeev@pb1.pair.com>
-
- * zend_execute.c: MFZE1
-
-2002-08-01 stas <stas@pb1.pair.com>
-
- * zend_execute.c
- zend_hash.c: MFZE1
-
-2002-07-30 jason <jason@pb1.pair.com>
-
- * zend_compile.c
- zend_execute.c
- zend_globals.h: MFZE1 global declare
-
- * zend_compile.c: Fix segfault
-
-2002-07-30 Andrei Zmievski <andrei@pb1.pair.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y
- zend_language_scanner.l
- zend_operators.c
- zend_operators.h:
- - Adding 'is' operator that can be used to check the type of a variable,
- or its class.
-
-2002-07-28 phanto <phanto@pb1.pair.com>
-
- * OBJECTS2_HOWTO: update the handlers struct
-
-2002-07-27 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_compile.c
- zend_execute_API.c:
- - Make sure classes are first looked for in the current scope.
- - Make sure that during inheritance the global scope is searched if the
- - current one doesn't work.
-
-2002-07-26 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_execute.c
- zend.c
- zend_builtin_functions.c
- zend_compile.h:
- - Fix problem with debug_backtrace() reported by Stig. We weren't reporting
- - global function information because it wasn't available. We have to do
- - an additional assignment per-function call so that it'll be available.
- - Also don't define the global scope as function name _main_ but leave it
- - empty so that frameworks like Pear can decide what they want to do.
-
-2002-07-25 sniper <sniper@pb1.pair.com>
-
- * Zend.m4: Fixed 3 major failures in this test:
-
- 1. Tests work better when they are actually run..
- 2. When file is opened, it should be closed sometime too.
- 3. AC_TRY_RUN cleans after itself (rm -f conftest.*), so it's
- good idea to read the values while the file still exists.
-
-
-2002-07-24 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_mm.c: - Fix some compile problems with the new configure checks.
-
-2002-07-24 James Cox <imajes@pb1.pair.com>
-
- * Zend.m4
- zend_mm.c: move testing for the alignment values into configure.
-
- * Zend.m4: ws fixes.
-
-2002-07-23 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_hash.c: - Fix WS.
-
-2002-07-21 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_compile.c:
- - Fix bug reported by Sebastian where old constructors didn't work in
- - nested classes.
-
-2002-07-18 derick <derick@pb1.pair.com>
-
- * zend.h
- zend_extensions.c: - MFZE1 - MacOSX fixes by Marko Karppinen
-
-2002-07-17 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_compile.c:
- - Remove code which wasn't supposed to go into the patch.
-
- * zend_compile.c
- zend_language_parser.y: - Rejuggle some code.
-
-2002-07-17 sniper <sniper@pb1.pair.com>
-
- * ZEND_CHANGES: This was mentioned already above (with an example too :)
-
-2002-07-16 Andi Gutmans <andi@pb1.pair.com>
-
- * ZEND_CHANGES: - Before I forget to list it, this was also added.
-
- * zend_language_scanner.l:
- - Syntactic sugar - Add "public" as a synonym for "var".
- - Now we have the three P's.
- You can do:
-
- <?
- class MyClass {
- public $a;
- private $b;
- protected $c;
- }
-
- ?>
-
-2002-07-15 derick <derick@pb1.pair.com>
-
- * zend_operators.c: - MFH of the crap removal
-
-2002-07-15 Andi Gutmans <andi@pb1.pair.com>
-
- * ZEND_CHANGES
- zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_language_parser.y
- zend_language_scanner.l
- zend_opcode.c:
- - Commit patch to support protected member variables (by Timm Friebe w/
- - some fixes by me).
- - You can't access protected variables from outside the object. If you want
- - to see a protected member from your ancestors you need to declare the
- - member as protected in the class you want to use it in. You can't
- - redeclare a protected variable as private nor the other way around.
-
- * zend_operators.c:
- - Really implement bool increment/decrement as flip-flop.
-
-2002-07-14 Andi Gutmans <andi@pb1.pair.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y
- zend_language_scanner.l
- ZEND_CHANGES:
- - Nuke delete(). It was a big mistake to introduce it and I finally
- - understand why Java didn't do so.
- - If you still want to control destruction of your object then either make
- - sure you kill all references or create a destruction method which you
- - call yourself.
-
- * zend_execute.c: - Nuke some unused code
-
-2002-07-14 derick <derick@pb1.pair.com>
-
- * zend_operators.c: MFZE1
-
- * zend_operators.c: - MFZE1
-
-2002-07-07 Andi Gutmans <andi@zend.com>
-
- * zend_objects_API.c: - Path which should improve previous fix.
-
- * zend_objects_API.c:
- - First try at solving problem with different objects being allocated the
- - same id.
-
-2002-07-07 Stanislav Malyshev <stas@zend.com>
-
- * zend_object_handlers.c: name length should be strlen+1
-
-2002-07-07 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_language_parser.y:
- Allow for 'class Namespace::Bar extends Foo' syntax. Patch by Timm Friebe <thekid@thekid.de>.
-
-2002-07-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix problem where scope was lost in nested function calls.
- - Thanks to Timm Friebe for diving into this one.
-
-2002-07-06 Zeev Suraski <zeev@zend.com>
-
- * zend_language_parser.y: spelling fix
-
-2002-07-05 Stig Bakken <ssb@fast.no>
-
- * zend_builtin_functions.c: * folding fixes
-
-2002-07-01 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Fix bug when acccessing $this not in class scope.
-
- * zend_objects.h
- zend_objects.c: - Export zend_object_get_address()
-
-2002-06-30 Andi Gutmans <andi@zend.com>
-
- * ZEND_CHANGES: - Remember to document autoload when I have time.
-
-2002-06-30 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_modules.h: - MFZE1
-
-2002-06-29 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Get ready for alpha2
-
- * zend_execute_API.c: - Invalid -> Undefined
-
- * zend_language_parser.y: - Add missing semi-colon.
-
- * zend_execute_API.c
- zend_execute.c: - Improve some error messages.
-
- * zend_compile.c: - Revert previous fix.
-
- * zend_compile.c: - Change E_ERROR -> E_COMPILE_ERROR where needed.
-
- * zend_compile.c:
- - Fix for bug #17882. We complain if the same method is declared twice.
-
- * zend.h
- zend_operators.c: - Fix bug 15037
- - Bump version to alpha2-dev
-
-2002-06-28 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - WS fix
-
-2002-06-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c:
- - Autoloading support based on patch from Ivan Ristic.
- - Again I hope this feature ends up working well because if it doesn't we
- - might need to nuke it. This only works for global scoped classes and it
- - will never work for sub-classes so don't even ask!!!!!
- - Just define an __autoload() function in the global scope and it will be
- - called with the class name as the parameter if it doesn't manage to find
- - the class.
-
- * zend_API.c
- zend_builtin_functions.c
- zend_mm.h: - Centralize global class fetch
-
- * zend_alloc.c
- zend_execute.c:
- - Fix problem with scope's not changing correctly during method calls.
- - Reapply a tiny optimization to the allocator so that in non-debug mode
- - we clean memory without detecting leaks.
-
-2002-06-24 Andi Gutmans <andi@zend.com>
-
- * zend_fast_cache.h:
- - MFZE1 (Turn off fast cache until we make sure it performs well.)
-
- * zend_alloc.c: - More fixes (warnings, bug fixes etc.)
-
- * zend_execute.c:
- - Revert patch which checks at run-time if you're allowed to assign
- - certain values by reference.
- - We still need to find a solution for cases when this shouldn't be allowed
- - as it might cause leaks.
-
- * zend_alloc.c: - Fix crash bug and clean up a bit.
-
-2002-06-24 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * Zend.m4: IMHO, ZTS should no longer be labeled experimental.
-
-2002-06-24 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c: - MFZE1
-
- * zend_alloc.c: - Don't use cache if we're using ZEND_MM
-
- * zend_mm.c:
- - Hardcode alignment to 8. We might need a configure check for this.
-
- * zend_mm.c
- zend_mm.h: - Improve memory manager to allocate small blocks quickly.
-
- * zend_alloc.h
- zend_mm.h
- zend_alloc.c:
- - Don't keep allocated blocks in a linked list if we're in non-debug mode
- - as now the memory manager takes care to nuke all leaking blocks.
-
- * zend.h
- zend_types.h: - MFZE1
-
-2002-06-23 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c:
- - Fix problem with constructor not being inherited and called correctly.
-
- * zend_mm.c: - Fix small bug
-
- * zend_mm.c:
- - Almost completely implement realloc(). It now resizes in place when
- - possible.
-
-2002-06-22 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c
- zend_mm.c: - Fix crash when zend_mm_shutdown is called more than once.
-
- * zend_alloc.c
- zend_alloc.h
- zend_globals.h
- zend_language_parser.y: - MFZE1
-
- * zend_constants.h
- zend_objects.c
- zend_variables.c
- zend_variables.h
- zend_constants.c
- zend_alloc.c
- zend_alloc.h: - Nuke persist_alloc().
-
-2002-06-19 Andi Gutmans <andi@zend.com>
-
- * zend_globals.h:
- - This was also supposed to be part of the previous ZEND_MM commit :)
-
- * zend_alloc.c:
- - Oops, this was supposed to be part of the previous #ifdef ZEND_MM change
-
- * zend_mm.h: - Use #ifdef for ZEND_MM
-
- * zend_mm.c: - Make sure MAX is defined
-
- * zend_constants.c:
- - Fix problem where you couldn't define constants with different cases but
- - the same name.
-
-2002-06-18 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend.c: - MFZE1
-
-2002-06-17 Andi Gutmans <andi@zend.com>
-
- * zend_mm.c: - Improve speed of alignment calculation
-
- * zend_mm.c
- zend_mm.h
- zend_alloc.c:
- - Fix a bug and add code which frees actual allocated segments at the end
- - of execution (this still doesn't work because some blocks remain
- - referenced after the memory manager is killed.
-
- * zend_mm.c
- zend_mm.h: - Save space per-allocated block.
-
-2002-06-16 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_execute.h
- zend_execute_API.c: - Fix bug in class constants
- - Start centralizing main class lookups. This will help implement
- - __autload()
-
- * zend_mm.c
- zend_mm.h:
- - Remove debug code which doesn't work anymore and add headers.
-
- * zend_globals.h
- zend_mm.c
- zend_mm.h
- zend_alloc.c
- ZendTS.dsp: - Commit an initial version of a home made memory manager.
- - It's just for seeing if this would be an advantage to PHP in MT
- - environments. If this is to become production material there is still
- - a long way to go.
-
-2002-06-15 Andi Gutmans <andi@zend.com>
-
- * zend_objects.h
- zend_objects_API.c:
- - Fix copy&paste problem where we allocated according to an old structure
- - decleration and not the new one.
-
-2002-06-11 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c:
- - Don't show debug_backtrace() in the trace itself.
- - This patch is a bit ugly because the whole code itself is pretty complex
- - and hard to re-order.
-
- * zend_execute.c
- zend_language_parser.y:
- - Fix problem with assigning functions by reference.
-
-2002-06-11 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * RFCs/004.txt: Add __delegate().
-
-2002-06-10 Harald Radi <harald.radi@nme.at>
-
- * zend_ts_hash.h
- zend_ts_hash.c: added TS_HASH macro
-
-2002-06-10 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c: Fix leak
-
-2002-06-09 Harald Radi <harald.radi@nme.at>
-
- * zend_API.h
- zend_builtin_functions.c
- zend_object_handlers.h:
- only check for an available class entry instead of
- the std_object_handlers on some places
-
-
-2002-06-08 Andi Gutmans <andi@zend.com>
-
- * zend_hash.h
- zend.h: - This should improve performance on Windows
-
- * zend_hash.h:
- - Add a loop unrolled version of the hash function and a bit of an
- - explanation about our hash function (Ralf S. Engelschall)
-
-2002-06-06 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * RFCs/004.txt: Add RFC on delegation.
-
-2002-06-05 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_execute.c: Remove unused local variable.
-
-2002-06-05 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c
- zend_object_handlers.c:
- - Allow overloaded objects to receive the method name in its original
- - case.
-
-2002-06-05 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_llist.c: - Fix memleak (patch by Stefan Sesser)
-
-2002-06-04 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_ini_scanner.l: - Fix for bug #17462 (Patch by Edin Kadribasic)
-
-2002-05-31 Andi Gutmans <andi@zend.com>
-
- * ZendTS.dsp: - Add zend_objects_API.* to dsp
-
- * zend_objects_API.c: - Fix build (one more coming up)
-
- * zend_objects.c: - Fix build
-
-2002-05-31 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * Zend.dsp: Add zend_objects_API.c to project.
-
-2002-05-31 Stanislav Malyshev <stas@zend.com>
-
- * Makefile.am
- zend_execute_API.c
- zend_globals.h
- zend_object_handlers.c
- zend_objects.c
- zend_objects.h
- zend_objects_API.c
- zend_objects_API.h: Generalize object storage and reference bookkeeping
-
-2002-05-30 Venkat Raghavan S <rvenkat@novell.com>
-
- * zend.h
- zend_config.nw.h
- acconfig.h: NetWare changes
-
-2002-05-26 Andi Gutmans <andi@zend.com>
-
- * zend_multibyte.c:
- - Add empty zend_multibyte.c to allow build with 4.3.0-dev.
-
-2002-05-24 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Fugbix typo.
-
-2002-05-24 Andi Gutmans <andi@zend.com>
-
- * ZEND_CHANGES: - Add a bit of information.
-
-2002-05-20 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h
- zend_execute.h
- zend_list.h: MFZE1 (Expose more C++ APIs)
-
-2002-05-14 Andi Gutmans <andi@zend.com>
-
- * zend_objects.c
- zend_objects.h: - constructor_called is supposed to be destructor_called
-
-2002-05-13 Sterling Hughes <sterling@bumblebury.com>
-
- * zend_qsort.c: MFZE1
-
-2002-05-13 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_builtin_functions.c: - MFZE1
-
-2002-05-12 Zeev Suraski <zeev@zend.com>
-
- * zend_highlight.c: MFZE1
-
-2002-05-12 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Rephrase.
-
- * ZEND_CHANGES: Beautify.
-
- * ZEND_CHANGES: Start documenting the debug backtracing.
-
- * ZEND_CHANGES: Whitespace fixes.
-
-2002-05-11 Zeev Suraski <zeev@zend.com>
-
- * zend_highlight.c
- zend_highlight.h: MFZE1
-
-2002-05-10 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Nuke C++ comment
-
- * zend_builtin_functions.c:
- - Make debug_backtrace() return an array. Still not finished because I
- might want to differentiate between method calls and static methods.
-
- Example:
- $bt = debug_backtrace();
- foreach ($bt as $frame) {
- if (isset($frame['class'])) {
- print $frame['class'];
- print "::";
- }
- print $frame['function'];
- print " [";
- print $frame['file'];
- print ":";
- print $frame['line'];
- print "]\n";
- }
-
-2002-05-08 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_builtin_functions.c:
- - Hopefully fix problems with debug_backtrace()
-
-2002-05-08 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_builtin_functions.c: - MFZE1
-
-2002-05-07 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend_builtin_functions.c
- zend_compile.h
- zend_execute.c:
- - More debug backtrace work. It still doesn't work very well...
-
-2002-05-02 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_builtin_functions.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h: Initial support for built-in backtracing.
- There are still a few problems such as includes and calling other functions
- from internal functions which aren't seen (will have to think if and how to
- fix this).
- Also the main scripts filename isn't available. Need to think about that.
-
-2002-04-30 Stanislav Malyshev <stas@zend.com>
-
- * zend_API.h
- zend_builtin_functions.c
- zend_object_handlers.c
- zend_object_handlers.h
- zend_operators.h
- zend_API.c: Make OBJCE return zend_class_entry*, also some cleanups
-
-2002-04-28 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_alloc.c
- zend_alloc.h: Revert.
-
-2002-04-27 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_alloc.c
- zend_alloc.h:
- MFZE1: If the size-operands of memset are constants, the compiler can turn them into fast inline code. So, instead of using ecalloc, we use emalloc + memset in macro form now. emalloc will not return NULL, so the chosen macro form is safe. This is not true for malloc(3). An inline function accomodates our needs here. Suggested by: http://www.mail-archive.com/dev%40httpd.apache.org/msg02492.html (Sascha)
-
-2002-04-25 Harald Radi <h.radi@nme.at>
-
- * zend_config.w32.h: unbreak the win32 build
-
-2002-04-24 Harald Radi <h.radi@nme.at>
-
- * zend_API.c: MFZE1 saschas 'Avoid exceeding buffer limits' patch
-
-2002-04-23 Harald Radi <h.radi@nme.at>
-
- * zend_hash.c
- zend_hash.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ts_hash.c
- zend_ts_hash.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_API.c
- zend_API.h
- zend.h: some type cleanup work
-
-2002-04-22 Harald Radi <h.radi@nme.at>
-
- * zend_object_handlers.c
- zend_object_handlers.h
- zend_objects.h
- zend_operators.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c: added get_class_entry callback handler to the
- object handlers structure
-
-2002-04-22 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * Zend.m4: MFZE1: Change default value of inline-opt to yes (Sascha).
-
-2002-04-22 Harald Radi <h.radi@nme.at>
-
- * zend_config.w32.h
- acconfig.h
- flex.skl: fixed linkage warning under win32
-
-2002-04-20 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c: MFZE1
-
-2002-04-19 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_list.c
- zend_hash.c
- zend_hash.h:
- MFZE1: make sure the resource-list is always consistent during shutdown (Thies).
-
- * zend_hash.c: MFZE1: Fix imbalance bug (Zeev).
-
-2002-04-10 Jani Taskinen <sniper@iki.fi>
-
- * zend_language_scanner.l
- zend_language_parser.y: MFZE1
-
-2002-04-07 Stanislav Malyshev <stas@zend.com>
-
- * zend.h: make compatible with current PHP
-
- * zend_compile.c: sync
-
-2002-03-29 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_compile.c: - revert patch
-
-2002-03-25 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_compile.c: - MFZE1
-
-2002-03-23 Andi Gutmans <andi@zend.com>
-
- * zend_ts_hash.c
- zend_ts_hash.h:
- - Fix build without ZTS. If someone has a nicer fix let me know.
-
-2002-03-21 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y:
- - No idea how this slipped in. Fix delete $obj statement.
-
-2002-03-20 Harald Radi <h.radi@nme.at>
-
- * ZendTS.dsp
- zend.h
- zend_ts_hash.c
- zend_ts_hash.h: added thread safe hashtable which allows concurrent
- reads but only exclusive writes
-
-2002-03-19 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y
- zend.h:
- - Finish covering all parsed methods to check for validity in parser.
- - Change zval's refcount to zend_uint (If it doesn't slow down the Engine
- - too much it should probably stay this way). If anyone has time to test
- - the difference in speed between zend_ushort & zend_uint in zend.h of
- - the struct _zval_struct (one line change) I'd be glad to get some
- - figures.
-
-2002-03-18 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_language_parser.y:
- - More fixes to check for member/function call legality.
-
-2002-03-17 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y
- zend_compile.c:
- - Start putting error handling where method calls are being used in a
- - context where only writable variables should be used.
-
-2002-03-15 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_object_handlers.h
- zend_objects.c
- zend_objects.h
- zend_variables.c: - Pass TSRMLS to callbacks.
-
- * zend_execute.c:
- - Scope fix. When calling an imported function the scope will change
- - correctly to the scope of the functions class.
- <?php
-
- function Hello()
- {
- print "Wrong one\n";
- }
-
- class MyClass {
- static $hello = "Hello, World\n";
-
- function Hello()
- {
- print self::$hello;
- }
-
- function Trampoline()
- {
- Hello();
- }
- }
-
- import function Trampoline from MyClass;
-
- Trampoline();
- ?>
-
- * zend_opcode.c
- zend_execute.c
- zend_compile.h
- zend_compile.c:
- - Fix issues with $this when using it by itself without indirection such as
- - $this->foo.
-
-2002-03-14 Stanislav Malyshev <stas@zend.com>
-
- * OBJECTS2_HOWTO: more cleanup
-
- * OBJECTS2_HOWTO: Update howto
-
- * zend_execute.c: fix for delete $this and unset $this
-
- * zend_execute_API.c: Fix call_user_function
-
-2002-03-12 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Forgot to close comment.
-
- * zend.h: - Macro for duality between Engine 1 and 2
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_opcode.c
- zend_operators.c: - Another couple of indirection fixes.
- - Make class_entry->refcount be part of the structure and not allocated.
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_opcode.c: - Fix bug introduced with latest class hash table change.
-
-2002-03-12 Stanislav Malyshev <stas@zend.com>
-
- * zend_API.c: Fix standard object creation
-
- * zend_API.c
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c
- zend.c
- zend.h: - make class tables contain class_entry *, not class_entry
- - fix isset($this)
-
-2002-03-10 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fix build in ZTS mode.
-
-2002-03-10 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_object_handlers.c
- zend_object_handlers.h: New stuff for objects API:
- - Better assignment handling
- - More flexible operations with zval-containing objects
-
-2002-03-09 Andi Gutmans <andi@zend.com>
-
- * tests/zend2.php:
- - Add the original example script to the CVS so that it's always available.
-
-2002-03-08 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Add 'import const' example.
-
-2002-03-08 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Support importing constants. e.g.:
- <?php
-
- class MyOuterClass {
- const Hello = "Hello, World\n";
- }
-
- import const Hello from MyOuterClass;
- print Hello;
-
-2002-03-07 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES:
- Add another 'import' example and merge 'import' section into 'Namespaces' section.
-
-2002-03-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Add function * and class * functionality. Only constants are left.
- <?php
-
- class MyOuterClass {
- class MyInnerClass {
- function func1()
- {
- print "func1()\n";
- }
-
- function func2()
- {
- print "func2()\n";
- }
- }
- }
-
- import class * from MyOuterClass;
- import function func2 from MyOuterClass::MyInnerClass;
-
- MyInnerClass::func1();
- func2();
-
-2002-03-02 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Consistency.
-
- * ZEND_CHANGES: Add 'import statement' section.
-
-2002-03-02 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l:
- - Initial patch to support importing from class scopes (for Stig).
- - It isn't complete yet but I want to work on it from another machine. It
- - shouldn't break anything else so just don't try and use it.
- - The following is a teaser of something that already works:
- <?php
-
- class MyClass
- {
- function hello()
- {
- print "Hello, World\n";
- }
- class MyClass2
- {
- function hello()
- {
- print "Hello, World in MyClass2\n";
- }
- }
- }
-
- import function hello, class MyClass2 from MyClass;
-
- MyClass2::hello();
- hello();
- ?>
-
-2002-03-02 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_builtin_functions.c: - MFZE1
-
-2002-03-01 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c: MFZE1
-
-2002-03-01 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l:
- - Remove use of C++ reserved words namespace/this
-
- * zend_opcode.c
- zend_language_parser.y
- zend_compile.h
- zend_compile.c
- zend_API.c: - Fix bug in nested try/catch's
- - Infrastructure for implementing imports of methods.
-
- * zend_objects.c:
- - Fix crash reported by Sebastian when destructor function causes a fatal
- - error. I hope this does it and we don't find any other problems.
-
-2002-02-26 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.h
- zend_alloc.c
- zend.c: - MFZE1
-
-2002-02-21 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES:
- Maintain ZEND_CHANGES to account for the addition of private member variables.
-
-2002-02-21 Andi Gutmans <andi@zend.com>
-
- * zend_object_handlers.c
- zend_opcode.c
- zend_language_parser.y
- zend_language_scanner.l
- zend_compile.c
- zend.c
- zend.h
- zend_API.c: - Experimental support for private members.
- <?
- class MyClass {
- private $Hello = "Hello, World!\n";
-
- function printHello()
- {
- print $this->Hello;
- }
- }
-
- class MyClass2 extends MyClass {
- function printHello()
- {
- MyClass::printHello(); /* Should print */
- print $this->Hello; /* Shouldn't print out anything */
- }
- }
-
- $obj = new MyClass();
- print $obj->Hello; /* Shouldn't print out anything */
- $obj->printHello(); /* Should print */
-
- $obj = new MyClass2();
- print $obj->Hello; /* Shouldn't print out anything */
- $obj->printHello();
- ?>
-
-2002-02-14 Stanislav Malyshev <stas@zend.com>
-
- * zend.h
- zend_API.c: Pass TSRM to create_object
-
-2002-02-14 Andrei Zmievski <andrei@ispi.net>
-
- * zend_compile.c:
- Fix the bug where the declared properties without init values were not
- entered into the table.
-
-2002-02-13 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y: <?php
- class MyException1 {
-
- }
-
- class MyException2 {
-
- }
-
- try {
- throw new MyException2();
- } catch (MyException1 $m) {
- print "Caught MyException1";
- } catch (MyException2 $m) {
- print "Caught MyException2";
- }
-
-2002-02-10 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_compile.h:
- Export lex_scan(). Both the PHPDoc and tokenizer extension need this. I hope this is okay with Z&A.
-
-2002-02-08 Andi Gutmans <andi@zend.com>
-
- * zend_objects.c: - Remove object debug messages.
-
-2002-02-07 Stanislav Malyshev <stas@zend.com>
-
- * Makefile.am
- OBJECTS2_HOWTO
- ZendTS.dsp
- configure.in
- zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h
- zend_object_handlers.c
- zend_object_handlers.h
- zend_objects.c
- zend_objects.h
- zend_operators.c
- zend_operators.h
- zend_variables.c: Mega-commit: Enter the new object model
- Note: only standard Zend objects are working now. This is definitely going to
- break custom objects like COM, Java, etc. - this will be fixed later.
- Also, this may break other things that access objects' internals directly.
-
-2002-02-04 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - This small patch should also take care of allowing unseting of $this->foo
- - and static members. The unset() opcode was luckily already suitable for
- - object overloading.
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_objects.c:
- - Fix problem with the objects_destructor called during shutdown. It was
- - freeing objects from id 0 instead of id 1. id 0 is not used.
- - Change isset/empty opcodes to support static members and the new way of
- - doing $this->foobar. Also the opcodes operate now on the hash table
- - combined with the variable names so that they can be overloaded by the
- - soon to be added overloading patch.
-
-2002-02-03 Adam Dickmeiss <adam@indexdata.dk>
-
- * Makefile.am
- configure.in:
- Zend config sets ZEND_EXTRA_LIBS. Bugs 14452, 14602, 14616, 14824
-
-2002-02-02 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_builtin_functions.c: Revert per Andi's request. Sorry :-(
-
- * zend_builtin_functions.c: Fix warning. Again :-)
-
-2002-02-02 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c:
- - Please don't use strcmp() and friends in Zend but only the mem*
- - functions. I didn't check this patch so please check that it works.
-
-2002-02-02 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_builtin_functions.c: Fix a warning.
-
-2002-02-02 Andi Gutmans <andi@zend.com>
-
- * zend_modules.h: - Nice catch by Derick. GINIT is dead.
-
-2002-02-01 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_builtin_functions.c: MFZE1: is_a()
-
-2002-01-27 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_config.w32.h:
- MFZE1: define a couple of macros under win32. (Patch By: Jon Parise <jon@php.net>)
-
-2002-01-25 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute_API.c
- zend_objects.c
- zend_objects.h
- zend_opcode.c:
- - First destructor hell fix. There was a situation where an object's
- - destructor could be run after its class was already dead. Right now
- - object destructors is the first thing whic happens during shutdown in
- - order to prevent this problem. It's very likely that destructors will
- - cause more grief and we'll have to outline exactly when you should use
- - them and what kind of logic you're allowed to do inside of them.
- - This bug was reported by sebastian.
-
-2002-01-22 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix a bug reported by Sebastian with indirect class names not working.
-
-2002-01-20 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_language_parser.y
- zend_opcode.c: - Improve performance of functions that use $GLOBALS[]
- - Please check this and make sure it doesn't break anything.
-
-2002-01-19 Thies C. Arntzen <thies@thieso.net>
-
- * zend_language_parser.y: MFZE1
-
-2002-01-14 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c:
- - Fix crash bug in call_user_function_ex(). Thanks to Sebastian for the
- - very nice and short reproducing script.
- <?php
- $array = array('foo', 'bar');
-
- uasort($array, 'cmp');
-
- function cmp($a, $b)
- {
- return (strcmp($a[1], $b[1]));
- }
- ?>
-
-2002-01-14 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Update Exceptions example.
-
-2002-01-13 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_globals.h
- zend_language_parser.y:
- - Change exception handling to use the Java-like catch(MyException $exception)
- - semantics. Example:
- <?php
-
- class MyException {
- function __construct($exception)
- {
- $this->exception = $exception;
- }
-
- function Display()
- {
- print "MyException: $this->exception\n";
- }
-
- }
- class MyExceptionFoo extends MyException {
- function __construct($exception)
- {
- $this->exception = $exception;
- }
- function Display()
- {
- print "MyException: $this->exception\n";
- }
- }
-
- try {
- throw new MyExceptionFoo("Hello");
- } catch (MyException $exception) {
- $exception->Display();
- }
- ?>
-
- * zend_ini_scanner.l: - MFZE1
-
-2002-01-06 Andi Gutmans <andi@zend.com>
-
- * zend.c:
- - Output error when there's an uncaught exception (by Timm Friebe)
-
- * zend_execute.c: - Make sure $this is passed on to methods
-
-2002-01-06 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.l
- zend_language_parser.y
- zend_language_scanner.h
- zend_language_scanner.l
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_modules.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_qsort.c
- zend_qsort.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_static_allocator.c
- zend_static_allocator.h
- zend_variables.c
- zend_variables.h
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_builtin_functions.h
- zend_compile.c
- zend_compile.h
- zend_config.w32.h
- zend_constants.c
- zend_constants.h
- zend_dynamic_array.c
- zend_dynamic_array.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_fast_cache.h
- zend_globals.h
- zend_globals_macros.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_ini.c: Happy New Year.
-
-2002-01-05 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Small fix
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c: - Allow passing of $this as function arguments.
- - Fix a bug which I introduced a couple of months ago
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h:
- - Significantly improve the performance of method calls and $this->member
- - lookups.
-
-2002-01-04 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Improve performance of indirect-referenced function calls
-
- * zend_compile.c: - Nuke C++ comments
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c: - Separate other kinds of function calls too.
- - Significantly improve performance of function calls by moving lowercasing
- - the function name to compile-time when possible.
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c:
- - Start splitting up different kinds of function calls into different
- - opcodes.
-
-2002-01-03 Derick Rethans <d.rethans@jdimedia.nl>
-
- * zend_API.c
- zend_API.h
- zend_execute.c
- zend_list.c:
- - MFZE1 for exit fix, exposing current function name in error messages and
- exposing zend_zval_type_name().
-
-2001-12-31 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Consistency.
-
-2001-12-31 Andi Gutmans <andi@zend.com>
-
- * ZEND_CHANGES:
- - Add example of default argument for argument passed by-ref
-
-2001-12-30 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Typo.
-
-2001-12-29 Andi Gutmans <andi@zend.com>
-
- * zend.h:
- - #define to help #ifdef stuff in PHP sources to make them work w/ ZE1 and
- - 2
-
- * ZEND_CHANGES: - A few clarifications
-
-2001-12-29 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Integrate Andi's examples and some notes by Stig.
-
- * ZEND_CHANGES: Update Exceptions example.
-
-2001-12-28 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y:
- - Fix some case insensitivity stuff in respect to classes
-
- * zend_execute.c
- zend_language_parser.y:
- - Support default arguments for reference parameters
- - Fix two compile warnings
-
- * zend_compile.c:
- - Wasn't adding the lower case version of the class name to the hash
-
-2001-12-27 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_objects.c:
- - Use two underscores for __construct(), __clone and friends...
-
- * zend_objects.c:
- - Only check refcount of object if the destructor was called.
-
- * zend.c
- zend.h
- zend_API.h
- zend_compile.c
- zend_objects.c
- zend_objects.h:
- - Experimental support for destructors. We need to see if destructors
- - will actually work well in the context of PHP so we should consider this
- - as experimental. Possible problems might be that when the constructor is
- - run PHP might not be in a stable state.
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c: - Support parent:: again
-
- * zend_compile.c: - Support unified constructor name _construct()
-
-2001-12-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_execute_API.c: - Fix scoping issue. The following works now:
- <?
- class MyClass {
- static $id = 0;
-
- function MyClass()
- {
- $this->id = self::$id++;
- }
-
- function _clone()
- {
- $this->name = $clone->name;
- $this->address = "New York";
- $this->id = self::$id++;
- }
- }
-
-
-
- $obj = new MyClass();
-
- $obj->name = "Hello";
- $obj->address = "Tel-Aviv";
-
- print $obj->id;
- print "\n";
-
- $obj = $obj->_clone();
-
- print $obj->id;
- print "\n";
- print $obj->name;
- print "\n";
- print $obj->address;
- print "\n";
-
- * zend.c: - Print out object id for easier debugging
-
- * zend.c
- zend.h
- zend_API.h
- zend_compile.c
- zend_objects.c: - Pretty much finish _clone() support
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y: - Initial support for _clone()
-
- * zend_compile.c
- zend_language_parser.y:
- - Start fixing the parsing rules so that function and method calls
- - can't be used in a write context.
-
- * zend.c: - Fix crash correctly.
-
-2001-12-25 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y: - Revert delete syntax patch
-
- * zend.c
- zend_execute.c: - Fix a crash (not a thorough fix).
- - Commented old code
-
-2001-12-24 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fixed bug where global functions weren't called if they didn't exist
- - in the class scope
-
-2001-12-23 Andi Gutmans <andi@zend.com>
-
- * zend.c:
- - Fix a bug where function's didn't work anymore in multi-threaded
- - servers after the latest startup changes.
-
-2001-12-22 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute_API.c
- zend_language_parser.y:
- - Add initial capability of defining nested classes as class foo::bar
-
-2001-12-18 Zeev Suraski <zeev@zend.com>
-
- * zend_language_scanner.h
- zend_language_scanner.l: MFZE1
-
-2001-12-16 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: I'm too trigger-happy.
-
- * ZEND_CHANGES: delete is now function
-
-2001-12-16 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y:
- - Seems like most people prefer delete($obj) over delete $obj.
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y: - Start adding parsed variable checks.
-
- * zend_compile.h
- zend_language_parser.y:
- - Framework for knowing what kind of variable we just parsed.
- - This will be used in compile-time error checking which couldn't be done
- - at the level of the grammar.
-
-2001-12-13 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y:
- - Rearrange grammar to allow dereferencing of objects returned from
- - functions. It still crashes though.
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_opcode.c: - Fix crash bug in startup code.
- - Start work on being able to reference global and local scope
-
-2001-12-12 Andi Gutmans <andi@zend.com>
-
- * Zend.dsp
- zend.c
- zend_constants.c
- zend_globals.h:
- - Infrastructure changes for allowing to access the global scope from
- - within a class scope.
- - Fix the Zend.dsp project a bit. It seems someone pretty much killed it
- - when commiting their own personal configuration. Please be careful in
- - future.
-
- * zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_globals.h
- zend_language_parser.y:
- - Make classes have scope and function/constant lookups default to the class
-
-2001-12-11 Andi Gutmans <andi@zend.com>
-
- * zend.c: - Merge from ZE1
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c:
- - Rename zend_class_entry.constants -> zend_class_entry.constants_table
-
- * zend_execute.c:
- - Start making scope change correctly when calling namespace functions.
- - When inside a namespace fallback to global namespace when function
- - or constant is not found.
-
-2001-12-11 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * LICENSE: Forgot to update the LICENSE.
-
- * LICENSE
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_builtin_functions.h
- zend_compile.c
- zend_compile.h
- zend_config.w32.h
- zend_constants.c
- zend_constants.h
- zend_dynamic_array.c
- zend_dynamic_array.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_fast_cache.h
- zend_globals.h
- zend_globals_macros.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_ini.c
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.l
- zend_language_parser.y
- zend_language_scanner.h
- zend_language_scanner.l
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_modules.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_qsort.c
- zend_qsort.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_static_allocator.c
- zend_static_allocator.h
- zend_variables.c
- zend_variables.h: Update headers.
-
- * Zend.m4
- zend.h: MFZE1 (AIX fixes)
-
- * zend_highlight.h
- zend_highlight.c: MFZE1 (added zend_strip mode in the highliter)
-
-2001-12-10 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y: - More namespaces work.
- - Nuke memory leak.
-
-2001-12-08 Andi Gutmans <andi@zend.com>
-
- * zend.c: - Fix crash with unhandled exceptions
-
-2001-12-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Support constants. The following works now:
- <?
- class foo {
- const GC = "foo constant\n";
- }
-
- define("GC", "Global constant\n");
-
- namespace;
- print GC;
- namespace foo;
- print GC;
- namespace;
- print foo::GC;
-
- ?>
-
- * zend_language_parser.y
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_globals.h:
- - Initial work on changing namespace scope. Only methods & variables
- - right now.
- <?
- $hey = "Global hey\n";
-
- class foo {
- static $hey = "Namespace hey\n";
- function bar()
- {
- print "in foo::bar()\n";
- }
- }
- function bar()
- {
- print "in bar()\n";
- }
-
- bar();
- namespace foo;
- bar();
- namespace;
- bar();
- namespace foo;
- $bar_indirect = "bar";
- $bar_indirect();
-
- namespace;
- print $hey;
- namespace foo;
- print $hey;
- $hey = "Namespace hey #2\n";
- namespace;
- print $hey;
- $hey = "Global hey #2\n";
- namespace foo;
- print $hey;
- ?>
-
- * zend.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_language_parser.y:
- - Nuke the namespace work I did. It'll be redone differently.
-
-2001-12-05 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Document recent changes.
-
-2001-12-04 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Damn Zeev :)
-
-2001-12-01 Andi Gutmans <andi@zend.com>
-
- * zend_API.c:
- - Revert one of the changes because it might be before the memory
- - manager has started.
-
- * zend_API.c
- zend_constants.c: - Use alloca() when possible.
-
-2001-11-30 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_language_parser.y
- zend_opcode.c:
- - Initial support for class constants. There are still a few semantic
- - issues which need to be looked into but basically it seems to work.
- - Example:
- <?php
- class foo
- {
- const hey = "hello";
- }
-
- print foo::hey;
- ?>
-
- * Zend.m4: - Fix typo
-
-2001-11-27 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y:
- - Support syntax for class constants (doesn't do anything yet but
- - required some reworking of the grammar).
-
-2001-11-26 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y:
- - Support static $var = 0; style initialization of static class
- - members. For example:
- - class foo {
- - static $my_static = 5;
- -
- - }
- -
- - print foo::$my_static;
-
-2001-11-25 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend_compile.c: - Fix crash and leak
-
- * zend_compile.c: - Whitespace
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y
- zend_opcode.c: - Support static members. The following script works:
- <?
- class foo
- {
- class bar
- {
- function init_values()
- {
- for ($i=1; $i<10; $i++) {
- foo::bar::$hello[$i] = $i*$i;
- }
- }
-
- function print_values()
- {
- for ($i=1; $i<10; $i++) {
- print foo::bar::$hello[$i] . "\n";
- }
- }
- }
- }
-
- foo::bar::init_values();
- foo::bar::print_values();
-
- for ($i=1; $i<10; $i++) {
- print $hello[$i]?"Shouldn't be printed\n":"";
- }
- ?>
-
-2001-11-24 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c: - MFZE1
-
-2001-11-15 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: MFZE1
-
-2001-11-05 stig <stig@pb1.pair.com>
-
- * zend_objects.h: add newline at end of file to avoid warnings
-
- * zend_language_parser.y: non-zts compile fix
-
-2001-11-04 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_language_parser.y:
- - Support instantiation of nested class. The following script now should
- - work:
- -<?php
- - class foo
- - {
- - function bar()
- - {
- - print "bar() in class bar\n";
- - }
- -
- - class barbara
- - {
- - function bar()
- - {
- - print "bar() in class foo::barbara\n";
- - }
- - }
- - }
- -
- - $obj = new foo();
- - $obj->bar();
- -
- - $obj = new foo::barbara();
- - $obj->bar();
- -
-
-2001-11-03 Andi Gutmans <andi@zend.com>
-
- * zend.h: - RISC OS patch by Alex Waugh
-
- * zend.c
- zend_API.h
- zend_compile.c: - Add some initializations
-
- * zend_compile.c
- zend_execute.c
- zend.h:
- - Add constructor to the zend_class_entry instead of looking it up each
- - time by name.
- - This will allow the next patch of being able to instantiate nested
- - classes such as new foo::bar::barbara();
-
-2001-10-29 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_opcode.c: - Fix internal classes
-
- * zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_globals.h
- zend_language_parser.y
- zend_opcode.c: - Initial support for nested class definitions
-
-2001-10-27 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: MFTGZE1
-
-2001-10-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c: - Fix Zeev's MFZE1
-
-2001-10-23 Zeev Suraski <zeev@zend.com>
-
- * zend_constants.c
- zend_execute_API.c
- zend_globals.h: MFZE1
-
-2001-10-20 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c: MFHZ1
-
-2001-10-12 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_API.c
- zend_API.h
- zend_modules.h: MFZE1: Introduced extension version numbers (Stig)
-
-2001-10-04 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * zend_hash.c: MFZE1
-
-2001-09-30 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l:
- - Merge the NAMESPACES_BRANCH. It wasn't a good idea to have a branch when
- - the whole CVS tree is work in progress
-
- * zend_compile.h
- zend_execute.c:
- - At last I've had some time to move all execute() locals into one struct.
- - No immediate gain but it makes it more clear what variables are temps
- - and which ones are execute() locals.
-
-2001-09-27 Andi Gutmans <andi@zend.com>
-
- * zend_modules.h: - Bump it up in the right place
-
- * zend_modules.h: - Increase API number
-
-2001-09-26 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend.h
- zend_compile.c
- zend_execute.c: - Good catch by Sterling
-
-2001-09-24 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_execute_API.c
- zend_globals.h: - More namespaces work
-
-2001-09-22 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ZEND_CHANGES: Keep ZEND_CHANGES up-to-date.
-
-2001-09-22 Zeev Suraski <zeev@zend.com>
-
- * zend_globals.h
- flex.skl
- zend.c
- zend_ini_scanner.l
- zend_language_scanner.l: MFZE1
-
-2001-09-20 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend_compile.c: - Fix build on Win32
-
- * zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l
- zend.c:
- - Create a branch for namespaces. This isn't even remotely close to
- - working.
-
- * zend_list.h: - Nuke unused enum
-
-2001-09-19 Zeev Suraski <zeev@zend.com>
-
- * flex.skl
- zend.c
- zend_globals.h
- zend_ini_scanner.l
- zend_language_scanner.l: MFZE1
-
-2001-09-19 Andi Gutmans <andi@zend.com>
-
- * Makefile.am: - MFZE1
-
-2001-09-19 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * Makefile.am
- zend_hash.c
- zend_hash.h
- zend_ini.c
- zend_llist.c
- zend_llist.h
- zend_qsort.c
- zend_qsort.h
- Zend.dsp
- ZendTS.dsp: MFZE1
-
-2001-09-17 Brian L. Moon <brianm@dealnews.com>
-
- * RFCs/003.txt: adding RFC for loose type requirements for functions
-
-2001-09-16 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: MFZE1
-
-2001-09-10 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h
- zend_globals.h
- zend_ini_scanner.h
- zend_ini_scanner.l
- zend_language_scanner.h
- zend_language_scanner.l: MFZE1 (nuke cplusplus code)
-
- * zend.c
- zend_execute_API.c
- zend_globals.h: MFZE1 (support return value in execute_scripts)
-
-2001-09-08 stig <stig@pb1.pair.com>
-
- * RFCs/002.txt: remove bogus comment :)
-
- * RFCs/002.txt: RFC document for namespaces
-
- * RFCs/001.txt: wrapped to 80 columns :)
-
-2001-09-07 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_language_parser.y:
- - Shift around the variable parsing code to make it simpler.
-
- * zend_llist.c:
- - Fix warning (was fixed in ZE1 and not merged at some point). Please make
- sure you merge patches!
-
-2001-09-05 Stanislav Malyshev <stas@zend.com>
-
- * zend_operators.c: MFZE1
-
-2001-09-03 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y: - CLS_CC -> TSRMLS_CC
-
-2001-08-31 Sterling Hughes <sterling@bumblebury.com>
-
- * zend_llist.h: spaces->tabs
-
- * zend_llist.c
- zend_llist.h
- zend_execute_locks.h: MFZE1
-
-2001-08-31 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_compile.h: MFZE1
-
-2001-08-30 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h
- zend_compile.c: - Make it compile in thread-safe mode.
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c: - Get rid of warning and C++ comments
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l: - Initial support for exceptions.
-
-2001-08-30 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: MFZE1
-
-2001-08-28 Zeev Suraski <zeev@zend.com>
-
- * zend_language_scanner.l: MFZE1
-
-2001-08-27 Andi Gutmans <andi@zend.com>
-
- * RFCs/001.txt: - Add sample RFC
-
-2001-08-26 Stanislav Malyshev <stas@zend.com>
-
- * Zend.m4
- zend.h: Add dlsym underscore detection, by Jani Taskinen
-
-2001-08-26 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - MFZE1
-
- * zend_API.c:
- - Merge Andrei's fix from Engine 1. Please commit patches to both trees!
-
-2001-08-21 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_execute_API.c: MFZE1
-
-2001-08-20 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c
- zend_hash.h: MFZE1
-
-2001-08-19 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Fix compile problem
-
-2001-08-19 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: MFZE1
-
-2001-08-18 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_llist.c
- zend_llist.h: - Merge Sterling's patches from ZE1
-
-2001-08-17 Andrei Zmievski <andrei@ispi.net>
-
- * zend_execute.c: MFZE1
-
-2001-08-17 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: MFZE1
-
-2001-08-16 Zeev Suraski <zeev@zend.com>
-
- * flex.skl
- zend_ini_scanner.l
- zend_language_scanner.l: MFZE1
-
-2001-08-16 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Try and nuke get_object_zval_ptr()
-
- * zend_objects.c: - Remove bogus notice
-
- * zend_variables.c: - Sync with ZE1
-
- * zend.h
- zend_execute.c
- zend_objects.c
- zend_objects.h
- zend_operators.c
- zend_operators.h
- zend_variables.c: - Fix a bug in method calls.
- - Try to get the old copying behavior of objects to work (doesn't work yet).
-
-2001-08-15 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c: MFZE1
-
-2001-08-14 Zeev Suraski <zeev@zend.com>
-
- * zend_constants.c
- zend_constants.h
- zend_variables.c
- zend_variables.h: MFZE1
-
-2001-08-13 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - MFZE1
-
- * zend_execute.c: - Merge from Engine 1
-
-2001-08-13 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c
- zend_operators.c
- zend_operators.h: MFZE1
-
-2001-08-12 Stanislav Malyshev <stas@zend.com>
-
- * zend_API.h: _FUNCTION is used in definition, so use _D
-
-2001-08-11 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_API.h
- zend_objects.c
- zend_operators.c: - More work on making objects work
-
- * zend_API.c
- zend_objects.c
- zend_objects.h
- zend_operators.c:
- - Fix some places which create objects. The fixes are ugly and will be
- revised when things start working well
-
-2001-08-11 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_compile.c
- zend_constants.c
- zend_constants.h
- zend_execute_API.c
- zend_hash.c
- zend_hash.h
- zend_ini.h
- zend_ini_scanner.l
- zend_language_parser.y
- zend_language_scanner.l
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_operators.c: Whitespace
-
-2001-08-11 Andi Gutmans <andi@zend.com>
-
- * Makefile.am
- zend_objects.c: - Fix UNIX build.
-
- * zend_compile.c:
- - Need to do some rewriting in the parser instead of this.
-
- * zend.h:
- - For Sebastian. Will allow to see you're using the Engine 2 CVS via
- phpinfo()
-
-2001-08-10 Andi Gutmans <andi@zend.com>
-
- * zend_API.h: - Merge from Engine 1
-
- * zend_compile.c: - A couple of fixes
-
- * zend_API.h: - Merge from Engine 1 CVS
-
-2001-08-09 Andi Gutmans <andi@zend.com>
-
- * zend.c: - Merge from Engine 1 tree
-
-2001-08-08 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend_compile.c
- zend_compile.h
- zend_globals.h: - Merge new $_GET, $_POST etc. patch from Engine 1 tree
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y: - Preliminary patch for method() dereferencing
-
- * zend.c
- zend.h: - Merge zend_try fix from Engine 1
-
-2001-08-07 Zeev Suraski <zeev@zend.com>
-
- * ZendTS.dsp: Migrate .dsp patches
-
-2001-08-07 Andi Gutmans <andi@zend.com>
-
- * ZendTS.dsp: - Forgot to commit the updated dsp
-
- * ZendTS.dsp: - More sync with latest CVS
-
- * zend_objects.c
- zend_objects.h
- zend_operators.h
- zend_variables.c
- ZendTS.dsp
- zend.h
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_language_parser.y
- zend_language_scanner.l: - Sync Engine2 CVS with latest Engine CVS
-
-2001-08-06 Zeev Suraski <zeev@zend.com>
-
- * zend_indent.c: Commit uncommitted build fix
-
- * zend_compile.c
- zend_globals.h
- zend_language_scanner.l:
- Fix an off by one lineno issue, in case of an implicit ;
-
- * flex.skl
- zend_highlight.c: Better shared code
-
- * Makefile.am
- Zend.dsp
- Zend.m4
- ZendTS.dsp
- flex.skl
- zend.c
- zend_globals.h
- zend_globals_macros.h
- zend_highlight.c
- zend_indent.c
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l
- zend_language_scanner.h
- zend_language_scanner.l:
- Merge from branch - move to standard C scanners in thread safe mode
-
- * Makefile.am
- Zend.m4
- flex.skl
- zend_ini_scanner.l
- zend_language_scanner.l: Make the C++less scanner compile under UNIX
-
-2001-08-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Move to using Z_ macros
-
- * zend_API.h: - Use Z_ macros
-
-2001-08-05 Zeev Suraski <zeev@zend.com>
-
- * zend_globals_macros.h: More nulled-out macros
-
- * zend.c
- zend_API.c
- zend_API.h: TSRMLS_FETCH work
-
-2001-08-04 stig <stig@pb1.pair.com>
-
- * .cvsignore: added some more stuff to .cvsignore
-
-2001-08-03 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Fix buglet
-
- * zend_alloc.c: Fix macro
-
- * zend.c
- zend_alloc.c
- zend_globals.h:
- Implement fast memory allocation and reduced fragmentation under Windows.
-
- * zend_globals_macros.h: Some compat macros
-
-2001-08-02 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- require_once()/include_once will return true in case a file was not included
- because it was already included earlier.
- Changed the default return value type of the include() family from long to
- boolean
-
- * zend_constants.c
- zend_execute_API.c
- zend_hash.c
- zend_hash.h:
- Avoid going over huge lists of functions, classes and constants.
- Special thanks to the guys from the MS lab for the profiling tools :)
-
- * zend.c
- zend_execute_API.c
- zend_hash.c
- zend_hash.h
- zend_list.c
- zend_list.h: Some cleanup
-
- * zend_builtin_functions.c
- zend_hash.c
- zend_hash.h: TSRMLS fixes
-
- * zend_ini_parser.y: non ZTS build fix
-
- * Zend.dsp
- ZendTS.dsp
- flex.skl
- zend.c
- zend_globals.h
- zend_globals_macros.h
- zend_highlight.c
- zend_indent.c
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l
- zend_language_scanner.h
- zend_language_scanner.l:
- Implement a standard C thread safe scanner within flex
-
-2001-08-01 Zeev Suraski <zeev@zend.com>
-
- * flex.skl
- zend_language_scanner.l:
- Implement fast scanning in the multithreaded environment
-
-2001-07-31 Zeev Suraski <zeev@zend.com>
-
- * zend_language_scanner.l: the make Sebastian happy part of the day :)
-
- * zend_ini.c
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l: More TSRMLS_FETCH work
-
- * zend_list.c
- zend_list.h: More TSRMLS_FETCH annihilation
-
- * zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_hash.c
- zend_hash.h
- zend_ini.c
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_modules.h
- zend_opcode.c: More TSRMLS_FETCH work
-
-2001-07-30 Zeev Suraski <zeev@zend.com>
-
- * zend_language_scanner.l: Compile fix
-
- * zend.c
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_constants.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_highlight.c
- zend_highlight.h
- zend_ini.c
- zend_ini.h
- zend_ini_parser.y
- zend_language_scanner.l
- zend_modules.h: More TSRMLS_FETCH work
-
- * zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_modules.h:
- More TSRMLS_FETCH work, and get rid of redundant ParametersPassedByRef
-
-2001-07-30 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c
- zend_API.h:
- Let's be consisten and keep TSRMLS_DC declaration after num_args.
-
-2001-07-30 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_hash.c
- zend_hash.h
- zend_highlight.h
- zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l
- zend_language_parser.y
- zend_language_scanner.l
- zend_list.c
- zend_list.h
- zend_operators.c
- zend_operators.h
- zend_variables.c: More TSRMLS_FETCH annihilation
-
- * zend_API.c
- zend_API.h: Get rid of more TSRMLS_FETCH's
-
- * zend.c
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_builtin_functions.h
- zend_compile.h
- zend_constants.c
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c: Avoid TSRMLS_FETCH()'s (still lots of work left)
-
-2001-07-29 Andi Gutmans <andi@zend.com>
-
- * zend_execute.h: - More object junk
-
- * zend.c: - Object macros...
-
-2001-07-28 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - Fix build
-
- * zend_operators.c: - More object macros.
-
- * zend_builtin_functions.c: - Use the Z_OBJ* macros for accessing objects
-
- * zend.h
- zend_operators.h:
- - Small patch to allow fixing the PHP tree to be compatible w/ the initial
- - Zend 2 objects patch. Hopefully I can commit that this week.
-
-2001-07-28 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp
- ZendTS.dsp
- zend.c
- zend.h
- zend_API.c
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_fast_cache.h
- zend_globals_macros.h
- zend_highlight.c
- zend_indent.c
- zend_ini_parser.y
- zend_ini_scanner.l
- zend_language_parser.y
- zend_language_scanner.h
- zend_language_scanner.l
- zend_opcode.c: Redesigned thread safety mechanism - nua nua
-
-2001-07-28 sascha <sascha@pb1.pair.com>
-
- * zend.h: Fix build
-
-2001-07-27 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_constants.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_execute_locks.h
- zend_globals_macros.h
- zend_ini.c
- zend_ini.h
- zend_language_parser.y
- zend_language_scanner.l
- zend_list.c
- zend_list.h
- zend_modules.h
- zend_operators.c
- zend_variables.c
- zend.c: Get rid of ELS_*(), and use TSRMLS_*() instead.
- This patch is *bound* to break some files, as I must have had typos somewhere.
- If you use any uncommon extension, please try to build it...
-
-2001-07-23 sascha <sascha@pb1.pair.com>
-
- * zend_alloc.c: tsrm_error is only available, if TSRM_DEBUG is defined.
-
-2001-07-21 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h: Always track bailout file/lineno
-
- * zend.c: Fix Release builds
-
- * zend.c
- zend.h
- zend_execute_API.c
- zend_globals.h
- zend_list.c:
- Improve bailout mechanism, supports nesting of bailouts a-la try..catch
-
- * zend_hash.c: Fix compile warning
-
-2001-07-21 Andrei Zmievski <andrei@ispi.net>
-
- * zend_compile.c:
- Fix certain cases where inheritance of base class's overloaded handlers wasn't
- being done.
-
-2001-07-20 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_execute_API.c
- zend_list.c:
- Implement a more granular shutdown mechanism for the executor -
- prevent corruption of constants and missing destructions of resources
-
-2001-07-19 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Unfix, it has too strong effects
-
- * zend_compile.c: Catch all cases
-
- * zend_compile.c: Fix bug #11970, strike 2
-
- * zend_execute.c: Revert bogus patch
-
-2001-07-18 Stanislav Malyshev <stas@zend.com>
-
- * zend_operators.c: fix double->long conversion
-
-2001-07-17 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c: - Remove unused code
-
-2001-07-16 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h
- zend_compile.c
- zend_globals.h
- zend_variables.c:
- Fix bug #10287 - avoid crashing under a bogus usage of list()
-
- * zend.h
- zend_compile.c
- zend_execute_API.c: Fix bug #10467
-
-2001-07-15 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.h: Minor cleaning
-
- * zend_language_parser.y: Optimize the parser a bit
-
- * zend_language_scanner.h
- zend_language_scanner.l: Fix an inline
-
- * zend_variables.c
- zend_variables.h:
- Time to bid this old timer goodbye - get rid of var_uninit()
-
- * zend_hash.c: Fix bug #6239
-
- * zend_language_parser.y:
- Allow indirect reference to method names in class::method() construct
-
- * zend_execute_API.c: Fix bug #10257
-
- * zend_execute.c: Fix bug #11970
-
- * zend_compile.c: Fix bug #9884
-
- * zend.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h
- zend_language_scanner.l
- zend_opcode.c:
- Improved interactive mode - it is now available in all builds, without any significant slowdown
-
- * zend.c: Early initialization
-
-2001-07-13 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c: layout
-
-2001-07-13 Thies C. Arntzen <thies@thieso.net>
-
- * zend_hash.c
- zend_hash.h
- zend_list.c:
- the resource-lists are now destroyed backwards. this will make sure that
- resources get destroyed in the opposite order they were created and thereby
- db-cursors will always be released before their corresponding connection etc.
- this sould not break anything!
-
-2001-07-11 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c
- zend_ptr_stack.c
- zend_ptr_stack.h: Remove the last couple of bogus inlines
-
-2001-07-11 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c
- zend_hash.h: - Move inline_zend_hash_func() to header file
-
-2001-07-11 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h: fixed ZVAL_FALSE and ZVAL_TRUE
-
-2001-07-11 Stanislav Malyshev <stas@zend.com>
-
- * zend_hash.h: No hashpjw anymore, but we have zend_hash_func
-
-2001-07-11 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c
- zend_variables.h: Get rid of ZVAL_RESET...
-
- * zend_API.c
- zend_operators.c
- zend_variables.c
- zend_variables.h: Get rid of some inlines
-
-2001-07-10 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.h
- zend_hash.c
- zend_hash.h: - Merge faster hash implementation.
- - The hash function parameter in hash_init(...) is not used anymore.
- - It should be removed but it is "to be decided" if we want to do that now
- - or in a major version as it means changing MANY places and third party
- - modules might stop working.
-
-2001-07-10 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h
- zend_variables.c: cleaned up the RETVAL_ RETURN_ and ZVAL_ macros
-
- added check for \0 at end-of-string at some places. all strings in PHP
- have to be terminated with \0 because 3th party libraries might not be
- binary-safe.
-
-2001-07-10 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Commit Thies' patch. str.len was too long.
-
-2001-07-09 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c
- zend_API.h: Adding new parameter parsing API.
-
-2001-07-09 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c
- zend_hash.h:
- - Significantly improve hash table performance by using djb's hash function
- instead of hashpjw() and by using power of two sizes of hash tables (this
- saves the % and isn't necessary with a good hash function).
- Please try this patch.
-
-2001-07-03 Rasmus Lerdorf <rasmus@php.net>
-
- * zend_API.c: Trivial fix - but the period looks odd in error messages
-
-2001-06-30 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c: - Fix the memory limit fix.
-
-2001-06-29 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - Remove bogus comment.
-
-2001-06-29 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Fix memory_limit, kill warning
-
-2001-06-28 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_locks.h: Fix warnings
-
-2001-06-27 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- Fix leak in the patch, and revert a couple of lines I didn't mean to commit
-
- * zend_execute.c: - Warn about illegal offsets
- - Allow assignments to uninitialized string offsets (automatically pads the
- string with spaces)
-
-2001-06-26 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- Fixed autoconversion of negative values to double (Fix bug #11685)
-
-2001-06-26 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Fix crash bug (fix by Jani).
-
-2001-06-24 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Bump Zend version
-
-2001-06-21 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_execute_locks.h
- zend_globals.h:
- - Hopefully fix bug #11476 and improve garbage to be freed very quickly.
- Tree tagged as PRE_GRANULAR_GARBAGE_FIX before commiting.
-
- * zend_execute_locks.h:
- - Use inline instead of macro for PZVAL_LOCK()/PZVAL_UNLOCK() so that it
- can be debugged.
-
- * zend_execute.c
- zend_execute.h
- zend_execute_API.c:
- - Nuke dependency of all of PHP on zend_execute_locks.h.
-
-2001-06-21 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- Eliminate the leak that the original bogus code tried to solve
-
- * zend_compile.c
- zend_execute.c
- zend_globals.h:
- parent::methodname() now works better with runtime classes (fix bug #11589)
-
- * zend_execute.c:
- Fix bug #11590 (I want Andi to also review this patch before it goes into 4.0.6)
-
-2001-06-20 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - MFH
-
- * zend_execute.c: - Fix string offsets crash.
-
-2001-06-19 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c: - Real MFH of memory fragmentation patch
-
- * zend_alloc.c: - Bad merge. Revert the previous patch (damn CVS).
-
- * zend_alloc.c: - MFH
-
- * zend_alloc.c:
- - Fix memory fragmention problem which could lead to web server processes
- growing much more than they should. (bug #11344?)
-
- * zend_execute.c
- zend_execute.h: - MFH
-
-2001-06-19 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c
- zend_execute.h: Add missing exports
-
- * zend_execute.c: Fix warning
-
-2001-06-13 Zeev Suraski <zeev@zend.com>
-
- * zend.c: MFH
-
- * zend.c:
- Avoid crashing if the error reporting function is called after a bailout during shutdown
-
-2001-06-12 Zeev Suraski <zeev@zend.com>
-
- * zend_highlight.c:
- Improve XHTML compliance (suggested by Anil Madhavapeddy)
-
-2001-06-10 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Fix ZTS build problem
-
-2001-06-07 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - Avoid breaking op_array compatibility for 4.0.6
-
-2001-05-30 Zeev Suraski <zeev@zend.com>
-
- * Zend.m4
- zend_execute_API.c: Add missing check
-
-2001-05-25 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Change if() to while() to make sure we skip enough opcodes
-
- * zend_compile.c: - MFH
-
- * zend_compile.c: - Fix memory leak
-
-2001-05-23 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c:
- Fix segfault -- need to copy-construct constant value.
-
-2001-05-21 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: Moving some functions into Zend.
-
-2001-05-20 sascha <sascha@pb1.pair.com>
-
- * .cvsignore: ignore ylwrap
-
-2001-05-20 Andi Gutmans <andi@zend.com>
-
- * zend_list.h: - The previous name could be confused with resource #
-
- * zend_list.c
- zend_list.h:
- - Whitespace and change the name of the macro to something more verbose
- ZEND_GET_RESOURCE_ID(...)
-
-2001-05-20 James Moore <James@phpuk.org>
-
- * zend_list.c
- zend_list.h: - Add new ZEND_GET_LE macro for retrieving destructor
- id's from remote extensions. (Jmoore, Zend Engine)
-
-2001-05-20 Andi Gutmans <andi@zend.com>
-
- * zend_list.c: - Don't allow resource types of 0
-
-2001-05-19 sascha <sascha@pb1.pair.com>
-
- * zend_hash.c: Fix segfault when using zend_hash_add_empty_element
-
-2001-05-18 Thies C. Arntzen <thies@thieso.net>
-
- * zend_alloc.c: reset allocated_memory_peak after each request.
-
-2001-05-17 Zeev Suraski <zeev@zend.com>
-
- * zend_language_scanner.l: That's slightly clearer that way :)
-
- * zend_alloc.c: Fix build
-
- * zend.c: MFH
-
- * zend.c: Fix corruption issue
-
-2001-05-16 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c
- zend_hash.h:
- Implement zend_hash_add_empty_element() using the existing infrastructure
-
- * zend_globals.h: Commit missing fix
-
- * Zend.m4
- zend_alloc.c
- zend_globals.h: Merge memory usage into memory limit
-
-2001-05-14 sascha <sascha@pb1.pair.com>
-
- * zend_hash.c:
- Initialize empty pDataPtr to a pseudo value to prevent a pefree on
- pData.
-
-2001-05-12 Andi Gutmans <andi@zend.com>
-
- * zend_variables.c: - Remove check for ht == NULL in copy_ctor.
- If ht is NULL at this point then we are better off crashing and fixing
- the bug that caused it.
-
-2001-05-11 sascha <sascha@pb1.pair.com>
-
- * zend.h: add missing closing paranthesis
-
- * zend_hash.c: Some extensions don't associate any data with hash entries,
- except the key. Prior to this change, a separate chunk of memory
- was allocated in that case to store exactly zero bytes (plus
- memory manager overhead). We treat that case similar to the
- pointer case, but don't copy any data at all (because the pointer
- is usually the NULL pointer).
-
- * zend_constants.c:
- Fix a memory leak which occured upon registering an already existing
- constant.
-
-2001-05-11 Thies C. Arntzen <thies@thieso.net>
-
- * Zend.m4
- zend_alloc.c
- zend_globals.h: added --enable-memory-usage-info
-
-2001-05-11 Andi Gutmans <andi@zend.com>
-
- * zend_opcode.c: - MFH
-
- * zend_opcode.c:
- - Fix crash bug when opcodes array is erealloc()'ed to a different memory
- area before it reaches the loop.
- - Some whitespace stuff
-
-2001-05-10 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- Treat numeric strings as numbers in the increment operator
-
-2001-05-09 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c: Nuke unused variable.
-
- * zend_API.c: Fix a few bugs in zend_is_callable() and make it stricter.
-
-2001-05-08 Andi Gutmans <andi@zend.com>
-
- * zend_language_scanner.l: - Fix line numbers when some lines end with \r
-
- * zend_opcode.c: - Fix crash bug reported by DBG author Dmitri Dmitrienko.
-
-2001-05-07 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Make zend_execute_scripts() reentrant
-
-2001-05-06 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_compile.c
- zend_compile.h:
- Recover from a parse error in include files (before, it could result in a crash under certain circumstances). Fix bug #8663
-
-2001-05-06 Andi Gutmans <andi@zend.com>
-
- * .cvsignore: - .cc files were renamed. Update .cvsignore.
-
-2001-05-06 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.h: Yikes, that would have been a very bad bug :)
-
- * zend_execute.c:
- Floating point keys didn't work in array() (fix bug #6662)
-
- * zend_compile.c
- zend_execute_API.c:
- Hear hear, interactive mode is finally showing some progress:
- - Support function calls
- - Fix crash bug
-
- * zend_compile.h
- zend_language_parser.y
- zend_language_scanner.l: Support interactive mode in thread-safe builds
-
- * zend_operators.h: Fix autoconversion of hexadecimal strings
- It's time to close bug #5404 :)
-
- * zend_highlight.c: Retain single spaces as spaces to condense HTML
-
-2001-05-02 Andi Gutmans <andi@zend.com>
-
- * zend_ini_scanner.l: - Support \r as newline in the ini scanner
-
- * zend_language_scanner.l: - Handle MAC OS X \r line endings
-
- * zend_execute.c:
- - Patch by Andrei to prevent crash in error situation when not all
- object overloading handles are defined.
-
-2001-05-01 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Bump up Zend version
-
-2001-04-30 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Add mistakenly removen closing bracket
-
- * zend_builtin_functions.c: - Get rid of warning
-
- * zend_alloc.c:
- - Try to solve crash on OS400. There is actually no reason I can see for
- why his fix should solve a crash but it doesn't harm.
-
- * zend_execute_API.c: - Fix crash bug in interactive mode
-
-2001-04-29 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.h: - Whitespace
-
- * zend_alloc.c
- zend_alloc.h: - Improve overwrite detection in debug mode.
-
- * zend_operators.c:
- - Previous patch for too early freeing of resources seemed to have worked.
- - Clean it up a bit.
-
- * zend_operators.c:
- - Try and solve the too early resource destruction problem.
-
-2001-04-28 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_hash.c
- zend_language_scanner.l
- zend_operators.c: include limits.h if available
-
- * zend.h: Fix bug 5661
-
-2001-04-28 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - Move all cases into switch().
-
- * zend_alloc.c: - Just some little whitespace stuff.
-
- * zend_alloc.c:
- - Don't add/remove cached memory blocks from blocks list as this will slow
- - down performance a bit.
-
-2001-04-28 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- Resources weren't being properly destroyed by the convert_to_*() functions
-
-2001-04-27 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_builtin_functions.c
- zend_hash.c
- zend_language_scanner.l
- zend_operators.c
- zend_operators.h: - More whitespace fixes while I'm at it.
-
- * zend.h
- zend_alloc.c
- zend_builtin_functions.c
- zend_execute_API.c
- zend_extensions.c
- zend_language_scanner.l:
- - Whitespace changes to be standard like the rest of Zend
-
-2001-04-24 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Due to popular demand merge the foreach() crash fix.
-
-2001-04-24 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: MFH.
-
-2001-04-21 Andi Gutmans <andi@zend.com>
-
- * zend_llist.c
- zend_llist.h: - Add typedef for function pointer of llist dtor
-
-2001-04-20 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix for crash bug when using invalid arguments in the foreach() loop.
- - Reported by Yasuo Ohgaki
-
-2001-04-19 Andi Gutmans <andi@zend.com>
-
- * zend_API.h: - Patch from Jason Greene.
- - Make it easier to write PHP function definitions in more than just one .c
- file while accessing the same module globals.
-
-2001-04-17 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: small beautification
-
-2001-03-28 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c: Fix warning
-
- * zend_list.c: Make Windows happy
-
- * zend_list.c: Get rid of more redundant code
-
- * zend_list.c:
- Cleaner way of making sure resources start at 1 and not 0...
-
- * zend_list.c
- zend_list.h: Remove redundant code
-
-2001-03-27 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c
- zend_list.h: God knows what this code was doing...
-
-2001-03-26 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c:
- Updated get_class_methods() to take class instance as well as class name.
-
- * zend_builtin_functions.c:
- Making it possible to pass a class name to get_parent_class() as well
- as a class instance.
-
-2001-03-23 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: Fixing function name length.
-
-2001-03-19 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y:
- - Add support for isset($var1, $var2, $var3); - Will be true only if all
- - variables are set.
-
-2001-03-15 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y: - Nuke commented code
-
-2001-03-12 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c: Name length is already known.
-
-2001-03-12 Andi Gutmans <andi@zend.com>
-
- * zend_API.c: - Missed second place.
-
- * zend_API.c: - Nuke snprintf()
-
- * zend_language_scanner.l: - White space
-
- * zend_language_scanner.l:
- - Fix by Jani Taskinen <sniper@iki.fi> for whole path also to work
- with include_once()/require_once().
-
-2001-03-12 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c
- zend_API.h:
- Improve zend_is_callable() to the point where it's actually useful.
- Now it just needs to be invoked everywhere in PHP where a callback is
- expected.
-
-2001-03-11 Andi Gutmans <andi@zend.com>
-
- * Zend.m4
- acconfig.h: - Fix for Solaris.
-
-2001-03-10 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Whitespace
-
-2001-03-07 Zeev Suraski <zeev@zend.com>
-
- * zend_ini.h: Add missing #define's
-
- * zend_compile.c
- zend_execute.c: Make parent:: work in runtime bindings as well
-
-2001-03-06 sascha <sascha@pb1.pair.com>
-
- * Zend.m4: We actually only need AC_PROG_LEX here.
-
-2001-03-04 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix bug #8899 (thanks Jani)
-
-2001-03-03 sascha <sascha@pb1.pair.com>
-
- * Zend.m4: -Os is a valid GCC optimization level.
-
-2001-03-02 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Whitespace fix
-
-2001-02-28 Andrei Zmievski <andrei@ispi.net>
-
- * zend_execute_API.c: Do case-insensitive class name matching when parsing
- array('Class', 'method') structure.
- You guys can clean it up, if there is a better way.
-
-2001-02-27 Andi Gutmans <andi@zend.com>
-
- * zend_variables.c
- zend_variables.h: - Nuke zval_del_ref()
-
-2001-02-27 Andrei Zmievski <andrei@ispi.net>
-
- * zend_compile.c: Don't overwrite existing handlers with parent ones.
-
-2001-02-26 Andi Gutmans <andi@zend.com>
-
- * Zend.dsp
- ZendCore.dep
- ZendTS.dsp
- zend.c
- zend_API.c
- zend_API.h: - Rename modules.h to zend_modules.h
-
- * LICENSE: - One more copyright year update
-
- * zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.l
- zend_language_parser.y
- zend_language_scanner.h
- zend_language_scanner.l
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_static_allocator.c
- zend_static_allocator.h
- zend_variables.c
- zend_variables.h
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_builtin_functions.h
- zend_compile.c
- zend_compile.h
- zend_config.w32.h
- zend_constants.c
- zend_constants.h
- zend_dynamic_array.c
- zend_dynamic_array.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_fast_cache.h
- zend_globals.h
- zend_globals_macros.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_ini.c
- zend_modules.h: - Update copyright year
-
-2001-02-25 Andi Gutmans <andi@zend.com>
-
- * zend_modules.h: - Fix dll linkage warnings
-
-2001-02-24 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c
- zend_modules.h: - Add exports from Daniel Beulshausen
-
-2001-02-14 Stanislav Malyshev <stas@zend.com>
-
- * zend.h: allow more extensions with resources
-
-2001-02-13 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c: Move version registration to a more correct place
-
-2001-02-12 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c
- zend_operators.h: - Remove two unused functions
-
- * zend_execute_API.c: - Fix whitespace.
-
-2001-02-12 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c:
- Fix a bug that could cause corruption in case of an error during
- get_zval_ptr()
-
-2001-02-09 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Remove duplicate code and do a tiny optimization in DO_FCALL
-
-2001-02-05 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix string offset data corruption
-
-2001-02-04 Andrei Zmievski <andrei@ispi.net>
-
- * zend_execute_API.c:
- Allow passing class name as well as an object instance to call methods.
-
-2001-02-03 Andrei Zmievski <andrei@ispi.net>
-
- * zend_execute_API.c:
- Set the correct function state during execution. This is mainly to have
- get_active_function_name() to return proper value.
-
- * zend_compile.c: Inherit overloaded handlers.
-
-2001-02-01 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c
- zend_API.h:
- Added zend_is_callable() function that checks whether passed zval
- represents a valid and exiting callable construct.
-
-2001-01-31 Andi Gutmans <andi@zend.com>
-
- * zend_API.h
- zend_API.c: - Change unset() functions to null(). unset() is legacy
-
- * zend_API.h:
- - Quick fix. I'm for changing these to add_property_null() as we've nuked
- - unset.
-
-2001-01-27 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - That doesn't seem like a smart thing to do :)
- - I wonder if gcc optimized it out.
-
-2001-01-23 Thies C. Arntzen <thies@thieso.net>
-
- * zend_extensions.h
- zend_ini_scanner.h
- zend_list.c
- zend_list.h: fix a couple of warnings
-
- * zend_API.c: fixed crash in add_index_bool.
-
-2001-01-22 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.h: Make add_index_zval() available to the outside world.
-
-2001-01-21 Andi Gutmans <andi@zend.com>
-
- * zend.h:
- - Make people happy who like the Zend version number bumped up in parallel
- with PHP.
-
-2001-01-20 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_API.h:
- - Patch from Sterling. Add API calls to add zval's as array indeces/
- object properties. Add _ex functions which take the string length as an
- argument for better performance.
-
-2001-01-19 Andi Gutmans <andi@zend.com>
-
- * zend_API.h
- zend_API.c:
- - For Sterling. I wonder if not all of the API functions should take the
- - key_length as a parameter in order to save that strlen().
-
-2001-01-17 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix leak in fetch_dim_address() which was already fixed in
- - fetch_dim_object(). Take the oppertunity to make both use the same
- - function and not duplicate the code.
-
-2001-01-16 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c: Fix persistent resources, once and for all...
-
-2001-01-15 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_compile.c: Add free_estring()
-
-2001-01-12 Zeev Suraski <zeev@zend.com>
-
- * zend_istdiostream.h: Add newline
-
-2001-01-12 Rasmus Lerdorf <rasmus@php.net>
-
- * zend_highlight.c: Fix for bug number 8666
-
-2001-01-07 Zeev Suraski <zeev@zend.com>
-
- * zend_ini.c: Fix mismatch in return values
-
- * zend.c
- zend.h
- zend_alloc.c
- zend_ini.c
- zend_ini.h: - Remove backward dependency from PHP -> Zend
- - Rename get_ini_entry() as get_configuration_directive() for clarity
- (it doesn't use the INI subsystem, but the module-supplied function for
- retrieving configuration directives)
-
- * Zend.dsp
- ZendTS.dsp: Remove -S option on all bison calls
-
- * zend.c:
- Fix possibility of a crash during startup (very unlikely, but possible)
-
-2001-01-06 Zeev Suraski <zeev@zend.com>
-
- * ZendTS.dsp: Remove -S
-
-2001-01-06 Andi Gutmans <andi@zend.com>
-
- * zend_ini.c: - This slipped in by mistake.
-
-2001-01-05 Zeev Suraski <zeev@zend.com>
-
- * zend_ini.c
- zend_ini.h:
- Merge in some ZEND_API additions from Daniel Beulshausen (needed for the
- Win32 Apache module)
-
-2001-01-04 Andi Gutmans <andi@zend.com>
-
- * zend_list.c:
- - Make plist_destructor work like list_destructor to allow it to call
- extended destructors.
-
-2001-01-03 Zeev Suraski <zeev@zend.com>
-
- * zend.h: Fix Zend version while we're at it
-
- * zend_execute_API.c: Merge call_user_function_ex() fixes
-
- * zend_language_scanner.l: Merge line number corruption bug fix
-
- * zend_language_scanner.l:
- Fix another case of possible line number corruption
-
- * zend.h: Commit missing declaration
-
-2001-01-01 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Remove unreachable code
-
-2000-12-30 Zeev Suraski <zeev@zend.com>
-
- * zend_language_scanner.l
- zend_opcode.c: Fix possible corruption in line number information
-
-2000-12-27 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_globals.h
- zend_ini.c
- zend_ini.h
- ZendTS.dsp:
- Make the INI mechanism thread safe (or at least thread safer :)
-
-2000-12-26 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h:
- Use iostream.h instead of istream.h (IBM's compiler doesn't come with istream.h,
- and iostream.h should include it)
-
- * ZendTS.dsp
- zend_ini_scanner.l
- zend_istdiostream.h
- zend_language_scanner.l:
- - Use supplied istdiostream definition for the INI scanner too
- - Add Release_TSDbg configuration
-
-2000-12-24 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.h: This needs updating as well
-
- * zend_execute_API.c:
- More aggressive protection in call_user_function_ex()
-
-2000-12-23 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c:
- Fix a possible crash bug in call_user_function_ex(), if the function is
- in fact not a user function
-
-2000-12-22 sascha <sascha@pb1.pair.com>
-
- * zend.c
- zend_modules.h:
- Set the floating-point exception mask on FreeBSD to 0 (as do other
- FreeBSD system applications). Also bump up the module API number
- as the zend_hash_get_current_key change affects source and binary
- compatibility.
-
-2000-12-22 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_builtin_functions.c
- zend_execute.c
- zend_hash.c
- zend_hash.h:
- Allow get_current_key() not to return the key itself, instead of a duplicate
-
- * zend_hash.c: * Fixed a possible crash in get_class_methods()
-
-2000-12-19 Stanislav Malyshev <stas@zend.com>
-
- * zend_language_scanner.l: Add support for ASP tags in one-line comment
-
-2000-12-18 Andi Gutmans <andi@zend.com>
-
- * flex.skl: - Success! Yay!
-
- * flex.skl: - Yet another one.
-
- * flex.skl: - Testing
-
- * flex.skl: - No luck
-
- * flex.skl: - Make this damn commit stuff work.
-
- * flex.skl: - Testing
-
-2000-12-18 Stanislav Malyshev <stas@zend.com>
-
- * zend.c:
- Use HashPosition iterator instead of saving/restoring internal pointer
-
- * zend.c: Preserve internal pointer over print_r (fix #8289)
-
-2000-12-18 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Fix leak with useless statements such as "foo";
-
- * flex.skl:
- - Testing Sascha's CVS commit script which should work with branches.
-
- * flex.skl: - Testing
-
- * flex.skl: - Testin
-
-2000-12-18 Zeev Suraski <zeev@zend.com>
-
- * flex.skl: Test, ignore
-
-2000-12-18 Stanislav Malyshev <stas@zend.com>
-
- * zend_operators.c: Add notice when auto-converting array to string
-
-2000-12-17 Andi Gutmans <andi@zend.com>
-
- * zend_language_scanner.l:
- - Clean up the scanner a tiny bit while messing with it.
-
- * zend_language_scanner.l:
- - %> without asp_tags should not be treated as inline_html but as regular
- tokens. Of course the parser will die with a parse error which is the
- correct behavior.
-
- * zend_language_scanner.l:
- - Fix problem in one line comments with line endings such as ??>
-
-2000-12-17 Stanislav Malyshev <stas@zend.com>
-
- * zend_operators.c: Fix #8279 (-2147483647 > 2147483647).
-
-2000-12-14 Zeev Suraski <zeev@zend.com>
-
- * zend_modules.h: Update module_api_no
-
-2000-12-13 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h
- zend_execute_API.c:
- Fix call_user_function() with objects - it could leak under certain circumstances
-
-2000-12-12 Stanislav Malyshev <stas@zend.com>
-
- * zend_operators.c: Fix #8195: strncasecmp returns incorrect value
-
-2000-12-07 sascha <sascha@pb1.pair.com>
-
- * zend_builtin_functions.c:
- Hardcode strlen due to problems on SCO OpenServer 5.0.4 which defines
- strlen to __std_hdr_strlen.
-
-2000-12-07 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c: Whitespace fix
-
- * zend_compile.c: Allow var $foo = array(ABC => 1) constructs
-
- * zend_builtin_functions.c:
- Fix memory leak - get_current_key mallocs it's result, no need to
- copy it.
-
-2000-12-06 sascha <sascha@pb1.pair.com>
-
- * zend_hash.c:
- INIT_DATA/UPDATE_DATA assumed that pData elements of the size of a void
- pointer would actually be aligned like a void pointer. This lead
- to bus errors on architectures which don't allow unaligned 32-bit accesses.
-
-2000-12-05 Andi Gutmans <andi@zend.com>
-
- * zend_language_parser.y:
- - Support for $var =& new foo() syntax. This allows you to use objects
- which create extra references to themselves in the constructor.
-
-2000-12-05 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.h: Expose all timeout functions
-
-2000-12-02 sascha <sascha@pb1.pair.com>
-
- * acconfig.h
- configure.in:
- Use the hardly-documented third parameter of AM_INIT_AUTOMAKE to suppress
- defining PACKAGE/VERSION.
-
-2000-11-27 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c:
- - Allow passing references which are returned from functions and new
- - statements to be passed by reference.
-
-2000-11-27 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c:
- Update class constants before trying to get default properties.
-
-2000-11-22 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Remove code which has been commented out for ages.
-
-2000-11-22 sascha <sascha@pb1.pair.com>
-
- * zend_execute.c
- zend_globals.h: Pass on the exit status
-
-2000-11-21 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c
- zend_operators.h: Fix build
-
-2000-11-21 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - The baby patch wasn't that innocent :)
-
-2000-11-21 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c:
- Sterling's patch to make get_defined_vars() simpler and better.
-
-2000-11-20 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - NEVER copy and paste :)
-
- * zend_compile.c
- zend_execute.c: - Baby patch towards making the damn pass-by-ref work.
-
-2000-11-20 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.h: Update API number
-
-2000-11-20 Stanislav Malyshev <stas@zend.com>
-
- * zend.h:
- Add macro to replace value of zval with another value while preserving
- referencing structure
-
-2000-11-20 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - This patch is broken and needs more thorough fixing.
-
-2000-11-19 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Try and fix the problem when sending references returned from a function by reference.
-
-2000-11-19 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.h: Fix Zend build for non ZTS
-
-2000-11-18 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Forgot to commit the non-debug build fix yesterday...
-
- * zend_alloc.c
- zend_alloc.h:
- Add thread-safety debugging information (idea - Dmitri Dmitrienko)
-
-2000-11-14 Stanislav Malyshev <stas@zend.com>
-
- * zend_language_scanner.l: Restore compatibility with old broken way
-
- * zend_language_scanner.l:
- Better 0x handling - not change non-0x number behaviour
-
- * zend_language_scanner.l:
- Attempt at better handling long 0x-numbers, like 0xffffffff
-
-2000-11-13 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.c
- zend_extensions.h: - Remove unused function
-
- * zend_extensions.h:
- - Use typedef's for function pointers so that we can easily define arrays
- - of these function pointers.
-
-2000-11-13 Stanislav Malyshev <stas@zend.com>
-
- * zend_llist.c:
- Fix zend_llist_apply_with_del - it should remove from list,
- not only call dtor
-
-2000-11-12 Zeev Suraski <zeev@zend.com>
-
- * ZEND_CHANGES: Test, ignore
-
-2000-11-11 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h: - Move SET_UNUSED() to header
-
- * zend_opcode.c: - Beautify by using the standard #define.
-
-2000-11-10 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h
- zend_compile.c: - Remove this damn thing once again.
-
- * .cvsignore: - Add files to .cvsignore thanks to Jon Parise
-
-2000-11-09 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h: - Maybe it's OK now? :)
-
- * zend_compile.c
- zend_compile.h: - Undo the previous commit for fixing $obj = new foo().
-
- * zend_compile.c
- zend_compile.h:
- - Commit experimental patch to fix the problem when doing $a = new foo()
- and the constructor assigns $this by reference to other symbol table
- elements. Thanks to Daniel J. Rodriguez on this one.
-
-2000-11-08 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c
- zend_extensions.h: Add ability to find extensions by name
-
-2000-11-06 sascha <sascha@pb1.pair.com>
-
- * zend_ini.c: Kill a misleading warning which is intended for old code
- which assumes sizeof(int) == sizeof(void *).
-
-2000-11-03 Andi Gutmans <andi@zend.com>
-
- * zend_ini_scanner.h: - Add trailing \n?
-
-2000-11-03 Zeev Suraski <zeev@zend.com>
-
- * zend_ini_scanner.l: Fix for bug #5571 (by mookid@sigent.ru)
-
-2000-11-03 Andi Gutmans <andi@zend.com>
-
- * Makefile.am: - Fix dependency.
-
-2000-11-03 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.h: Fix build
-
- * zend_operators.h: Add RESVAL macros
-
-2000-11-02 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Fix bug #7599
-
- * zend_language_parser.y
- zend_language_scanner.l: Missed those
-
- * zend_API.c
- zend_compile.c
- zend_compile.h: Maintain consistency
-
-2000-11-02 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_language_parser.y: - Replace do_exit() with zend_do_exit().
- - Problem reported by David Hedbor <david@hedbor.org>
-
-2000-11-02 Zeev Suraski <zeev@zend.com>
-
- * zend_ini_parser.y: Remove unnecessary variables
-
- * zend_ini.c:
- explicit declaration here too - sigh, way too early in the morning
-
- * zend_ini.h: oops
-
- * zend_ini.h: explicit declaration
-
-2000-10-31 Zeev Suraski <zeev@zend.com>
-
- * zend_highlight.h: Fix Apache build
-
- * zend_ini.c
- zend_ini.h: Remove unnecessary code, fix phpinfo()
-
- * Zend.m4: Require bison 1.28
-
-2000-10-30 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp: Fix non-thread-safe Windows build
-
- * zend_globals.h
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l: Final touches on the INI parser
-
-2000-10-30 Stanislav Malyshev <stas@zend.com>
-
- * Makefile.am: Another attempt to make it build
-
- * Makefile.am
- zend_ini_scanner.l: Fix build
-
-2000-10-29 Zeev Suraski <zeev@zend.com>
-
- * zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l: Fix leaks
-
- * zend_alloc.h
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.h
- zend_ini_scanner.l: The new INI parser is showing some signs of life
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c:
- Fix a corruption bug, when erroneously allowing to send non-variables by reference (several
- bug-db reports seem to originate in this bug)
-
- * zend_extensions.c
- zend_ini_parser.y: Fix build
-
- * zend_ini_scanner.h: Forgot this one
-
- * Makefile.am
- ZendTS.dsp
- zend_globals.h
- zend_ini.h
- zend_ini_parser.y
- zend_ini_scanner.l: Generalization work
-
-2000-10-29 Stanislav Malyshev <stas@zend.com>
-
- * zend_extensions.c
- zend_extensions.h:
- Allow module to proclaim compatibility with any Zend version
-
-2000-10-29 Zeev Suraski <zeev@zend.com>
-
- * Makefile.am
- ZendTS.dsp
- zend_ini_parser.y
- zend_ini_scanner.l
- zend_language_scanner.l: Some more work on the INI parser/scanner
-
- * Makefile.am
- zend_ini_parser.y
- zend_ini_scanner.l: Initial step in rewriting the INI parsing mechanism
-
- * .cvsignore
- Makefile.am
- Zend.dsp
- ZendCore.dep
- ZendTS.dsp
- zend-parser.y
- zend-scanner.h
- zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_highlight.c
- zend_indent.c
- zend_language_parser.y
- zend_language_scanner.h
- zend_language_scanner.l: Unify the names of these last 3 files...
-
- * Zend.dsp
- ZendTS.dsp: Fix Windows build
-
- * Makefile.am
- zend_ini.c
- zend_ini.h
- zend_operators.c
- zend_operators.h:
- Initial steps to move the INI mechanism to the Zend engine
-
-2000-10-27 Andrei Zmievski <andrei@ispi.net>
-
- * zend_operators.h: Added macros for object properties and class entry.
-
-2000-10-26 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_modules.h: - Fix new -m on Windows
-
-2000-10-25 Andrei Zmievski <andrei@ispi.net>
-
- * zend_list.h: Remove the patch to register_list_destructors().
-
-2000-10-20 Andrei Zmievski <andrei@ispi.net>
-
- * zend_list.c
- zend_list.h: - Fixed a bug in zend_rsrc_list_get_rsrc_type()
- - Switched register_list_destructors() to use
- zend_register_list_destructors_ex() instead
-
-2000-10-19 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Constant expressions which are used multiple times need to be copy_ctored
-
-2000-10-18 Andi Gutmans <andi@zend.com>
-
- * zend_llist.c: - Fix whitespace
-
- * zend_extensions.c
- zend_llist.c
- zend_llist.h:
- - Try #2. Wasn't allowed to delete in the previous manner because we were
- in the middle of an llist_apply()
-
-2000-10-18 sascha <sascha@pb1.pair.com>
-
- * zend_fast_cache.h:
- Add explicit conversion from 'void *', otherwise ANSI C++ compilers
- will break out.
-
-2000-10-18 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.c: - Fix crash
-
-2000-10-17 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Fix copy&paste bug
-
-2000-10-15 Andi Gutmans <andi@zend.com>
-
- * zend_opcode.c:
- - Increase op_array size faster and make eralloc() it in the end to save
- memory.
-
-2000-10-14 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Add another patch from Sterling.
-
- * zend_builtin_functions.c:
- - Preliminary commit of Sterlings get_defined_functions()/get_defined_vars
- functions
-
- * zend_extensions.c:
- - Only run startup() if ZEND_EXTENSIONS is defined to 1.
- This fixes a link error on platforms which don't support libdl
-
-2000-10-13 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - Make increment of "" become "1"
-
-2000-10-11 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c
- zend_hash.h: Don't use 'new' symbol
-
-2000-10-11 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c
- zend_execute_API.c:
- Fix -a interactive mode (no idea how the previous commit got committed)
-
- * zend_execute.c: *** empty log message ***
-
- * zend.h: Update version
-
- * zend_hash.c
- zend_hash.h: Add zend_hash_merge_ex(), for selective merging
-
-2000-10-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.h: - Fix Bug #7061
-
-2000-10-05 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l:
- - Updated included_files() also for plain include()/require().
-
-2000-10-04 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c: - Fix fprintf
-
-2000-10-02 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.h: - Change zend_extension_api_no
-
-2000-09-30 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Cleanup error output
-
-2000-09-28 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c:
- - Another has optimization/fix like the hash_copy one from earlier on
-
-2000-09-28 Stanislav Malyshev <stas@zend.com>
-
- * zend_hash.c:
- Make hash_copy call copy constructor on a real copy, not on a temp
-
-2000-09-28 Andi Gutmans <andi@zend.com>
-
- * ZendTS.dsp: - Remove zend_gcc_inline.c
-
-2000-09-26 sascha <sascha@pb1.pair.com>
-
- * Makefile.am
- Zend.m4
- zend_execute.h
- zend_gcc_inline.c
- zend_operators.h:
- Remove --enable-c9x-inline option. We now use a syntax which is compatible
- with all compilers by providing the function with static linkage in every
- compilation unit.
-
-2000-09-25 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_extensions.c
- zend_extensions.h:
- Fix previous update - move extension startup further down the startup sequence
-
- * zend.c: Move extension startup further down the startup sequence
-
-2000-09-19 Andi Gutmans <andi@zend.com>
-
- * zend_operators.h: - Add Z_BVAL* macros
-
-2000-09-19 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute_locks.h:
- Fix crash on Solaris with function parameter destruction
-
-2000-09-18 Stanislav Malyshev <stas@zend.com>
-
- * zend_builtin_functions.c:
- Made get_included_files() work again, in somewhat different way
-
-2000-09-17 Stanislav Malyshev <stas@zend.com>
-
- * zend_compile.c: Set filename even on recursive include
-
-2000-09-14 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix NULL handling in ARRAY opcode and resolve memory leak
-
-2000-09-12 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend.c
- zend_builtin_functions.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_highlight.h: Make compile_string() accept a description of the code
-
-2000-09-11 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Forgot to create extended info in include()/require() call
-
-2000-09-10 Stanislav Malyshev <stas@zend.com>
-
- * zend-parser.y: Allow require_once to take expressions, just like require
-
- * ZEND_CHANGES: Try once more to remove dups
-
- * ZEND_CHANGES: Test commit - weed out duplicate messages
-
-2000-09-09 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Don't use unsafe sprintf()
-
-2000-09-08 Stanislav Malyshev <stas@zend.com>
-
- * zend.c: Don't trust snprintf return
-
-2000-09-06 Andi Gutmans <andi@zend.com>
-
- * zend_config.w32.h: - Save two lines
-
- * zend_config.w32.h: - Fix header
-
-2000-09-06 sascha <sascha@pb1.pair.com>
-
- * Zend.m4: Unless overwritten, default to no optimization in debug mode.
-
-2000-09-05 Andi Gutmans <andi@zend.com>
-
- * zend_operators.h
- zend_operators.c: - Commiting Sterling's new multi_convert* functions
-
-2000-09-05 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: Fix memory overrun.
-
-2000-09-05 Stanislav Malyshev <stas@zend.com>
-
- * zend_builtin_functions.c:
- Fix crash with trigger_error having no args (#6549)
-
-2000-09-04 Andi Gutmans <andi@zend.com>
-
- * Makefile.am: - Remove two tabs
-
-2000-09-02 Andi Gutmans <andi@zend.com>
-
- * ZendTS.dsp:
- - Defining TSRM_WIN32 in each and every dsp sucked. Revert this change
-
- * ZendTS.dsp: - Fix windows build
-
-2000-08-31 Andi Gutmans <andi@zend.com>
-
- * ZendTS.dsp:
- - This should fix the performance problem with Release builds
-
- * zend-scanner.l
- zend.c
- zend_execute.c:
- - Use emalloc() for opened_path now. This was a potential leak before.
- - This patch has potential to break stuff but I tested it as much as I
- - could. Fixes should be easy.
-
- * zend.c: - Remove support for __string_value() in print $obj
-
-2000-08-31 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Safer shutdown process
-
-2000-08-29 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Update Zend version.
-
-2000-08-26 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c: - Don't define this function in non-debug mode
-
-2000-08-24 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Revert patch from 9/7/2000 which seems to have broken unset().
- - I hope what made me do this patch doesn't appear again.
-
-2000-08-22 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c:
- - Fix bug report by Andrei when using a method as a sort user function
- - parameter in usort() like functions
-
-2000-08-20 Zeev Suraski <zeev@zend.com>
-
- * zend_config.w32.h: Fix Win32 build
-
-2000-08-20 sascha <sascha@pb1.pair.com>
-
- * zend_config.w32.h:
- _isnan seems to be supported on Win32, add an appropiate macro.
-
- * acconfig.h: If available, use fpclassify for substituting zend_finite.
-
- * acconfig.h:
- Including math.h before using macros defined there will work better :)
-
- * acconfig.h: Add zend_isinf and zend_isnan.
-
-2000-08-19 Andrei Zmievski <andrei@ispi.net>
-
- * zend-scanner.l: One more fix to C compile.
-
-2000-08-19 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: Fix C build
-
- * zend-scanner.l: Fix eval() leakage in ZTS mode
-
- * zend_compile.c
- zend_globals.h: Eliminate run-time leak with eval()'s
-
- * zend_alloc.c: Fix build with no memory_limit
-
- * zend_alloc.c: Fix memory_limit
-
-2000-08-19 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Beautify
-
-2000-08-17 Stanislav Malyshev <stas@zend.com>
-
- * zend_API.h: Fix EMPTY_STRING macros
-
-2000-08-15 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.h
- zend-scanner.l
- zend.c
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- Fix warning issue (compile errors inside require()'d files were incorrectly supressed)
-
-2000-08-14 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: - Fix leak and some logic
-
-2000-08-14 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c:
- - This patch should hopefully fix situations where a constructor uses
- - the $this pointer as a reference.
-
-2000-08-14 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c: Fix crash
-
-2000-08-14 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.h:
- - Unused results should be marked with EXT_TYPE_UNUSED and not IS_UNUSED
-
-2000-08-13 Stanislav Malyshev <stas@zend.com>
-
- * zend-scanner.l
- zend.c
- zend_compile.c
- zend_compile.h
- zend_execute.c: Fix zend_fiel_handle handling. Should fix URL include
- and various opened_path inconsistencies.
-
-2000-08-13 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y:
- - Revert foreach() change which only allowed variables and array(...)
-
-2000-08-11 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y: - Only support variables and array(...) in foreach loops
-
-2000-08-10 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- Fix problem with nested foreach()'s (Andi, Zend Engine)
-
- * zend_compile.c:
- Fix switch which only has a default rule (Andi, Zend Engine)
- Change require_once() to use the same file list as include_once().
- Patch includes making require() & include() to behave the same when it
- comes to scoping. require() is now an include() which isn't allowed to fail.
- require() caused too many memory reallocations which ended up being quite
- slow for sites that required lots of files. (Andi & Zeev, Zend Engine)
- - Fix switch() which only has default rule (bug #5879,
-
-2000-08-09 Zeev Suraski <zeev@zend.com>
-
- * zend_modules.h: that too
-
- * zend_extensions.h: Update API number
-
- * zend-parser.y
- zend-scanner.l
- zend.c
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_opcode.c:
- The patch we promised - redesigned the compilation/execution API:
- Advantages:
- - Smaller memory footprint for the op arrays
- - Slightly faster compilation times (due to saved erealloc() calls and faster zend_op
- initialization)
- - include_once() & require_once() share the same file list
- - Consistency between include() and require() - this mostly means that return()
- works inside require()'d files just as it does in include() files (it used to
- be meaningless in require()'d files, most of the time (see below))
- - Made require() consistent with itself. Before, if the argument was not a constant
- string, require() took the include() behavior (with return()).
- - Removed lots of duplicate code.
- Bottom line - require() and include() are very similar now; require() is simply an include()
- which isn't allowed to fail. Due to the erealloc() calls for large op arrays, require()
- didn't end up being any faster than include() in the Zend engine.
-
-2000-08-05 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Use some more SEPARATE_ZVAL macros instead of replicated code.
-
-2000-08-05 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c: Fix memory leak
-
-2000-08-04 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_execute.c:
- - Beautify code. Try and use more macros for splitting instead of
- - replicating the code everywhere.
-
-2000-08-02 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Remove commented code
-
-2000-07-29 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend_execute.c: Fix filename issues
-
-2000-07-28 Stanislav Malyshev <stas@zend.com>
-
- * zend_builtin_functions.c
- zend_constants.c
- zend_constants.h:
- Make define return false and issue E_NOTICE when trying to redefine constant
-
-2000-07-27 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l
- zend_execute.c: Always store full filename as compiled file name
-
-2000-07-26 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Fix a possible issue with runtime inheritence under fairly rare circumstance
- and optimize a tiny bit
-
-2000-07-26 Stanislav Malyshev <stas@zend.com>
-
- * zend_builtin_functions.c
- zend_operators.c
- zend_operators.h: Add strncasecmp function
-
-2000-07-18 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c: Forgot to link this function...
-
- * zend_hash.c: This is probably the oldest bug in PHP :)
- Luckily it's unlikely we're ever actually bitten by this bug.
-
-2000-07-16 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Beautify Zeev's patch a bit.
-
-2000-07-16 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Implement parent::foo()
-
-2000-07-15 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend_compile.c: Add more extended_info calls
-
-2000-07-14 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c
- zend_list.c
- zend_list.h: Improve register_resource_ex() infrastructure
-
-2000-07-12 Thies C. Arntzen <thies@thieso.net>
-
- * zend.c: fix ZTS startup without filename (thanx purify!)
-
- * zend.c: unset active_symbol_table on zend-shutdown.
-
-2000-07-11 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c: Another persistent hash - disable apply protection
-
- * zend.c
- zend_hash.c
- zend_hash.h:
- Disable the hash_apply() protection on hashes that persist across requests - it's unsafe
- because we may be aborted at any point
-
-2000-07-11 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c:
- Fix a bug in passing second parameter of RECV_INIT with is_ref set
-
-2000-07-11 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - Oops. Too early in the morning
-
- * zend_compile.h: - Include iostream.h in C++.
-
-2000-07-09 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fix memory leak.
-
- * zend_execute.c: - Need to seperate if the hash isn't a reference
-
-2000-07-08 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Add zend_ulong
-
-2000-07-07 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c: Remove C++ commennts.
-
-2000-07-06 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l:
- - Remove code which has never been used (neither in PHP 3)
-
- * zend_compile.c:
- - Make is_method_call() static and remove a couple of old lines
-
- * zend_execute.c
- zend_extensions.h: - Yet another fix...
-
- * zend_execute.c: - One more...
-
- * zend_compile.c: - One more fix for the latest patch
-
- * zend_compile.c: - One dumb bug in my latest patch
-
- * zend-parser.y
- zend_compile.c
- zend_execute.c:
- - Complex fix for solving a problem with objects & method calls.
- - Previous version is tagged PRE_METHOD_CALL_SEPERATE_FIX_PATCH.
- - I need to check this fix on a server so if it doesn't work I will revert
- - it.
-
- * zend-scanner.l:
- - Fix problem with newlines not being recognized under certain conditions
-
-2000-07-03 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Fix bug #4120
-
-2000-07-03 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute_API.c: Unblock SIGPROF signal when starting timer.
- On Linux, this signal is blocked by default after first signal is run
-
-2000-07-03 sascha <sascha@pb1.pair.com>
-
- * FlexLexer.h
- zend-scanner.h
- zend_alloc.h
- zend_compile.h
- zend_constants.h
- zend_dynamic_array.h
- zend_execute.h
- zend_globals.h
- zend_hash.h
- zend_highlight.h
- zend_list.h
- zend_operators.h
- zend_static_allocator.h
- zend_variables.h:
- Replace macros which begin with an underscore through an appropiately
- named macro.
-
-2000-07-02 sascha <sascha@pb1.pair.com>
-
- * zend.h
- zend_API.h
- zend_builtin_functions.h
- zend_config.w32.h
- zend_dynamic_array.h
- zend_errors.h
- zend_execute_locks.h
- zend_extensions.h
- zend_fast_cache.h
- zend_globals_macros.h
- zend_indent.h
- zend_llist.h
- zend_modules.h
- zend_ptr_stack.h
- zend_stack.h: Change header protection macros to conform to standard.
-
- Draft 3 of IEEE 1003.1 200x, "2.2 The Compilation Environment"
-
- All identifiers that begin with an underscore and either an uppercase
- letter or another underscore are always reserved for any use by the
- implementation.
-
-2000-07-02 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y: - Take #2 with tab size 4
-
- * zend-parser.y:
- - Beautify parser a bit. It still could do with some more at some point
-
- * zend_execute.h
- zend_execute_API.c: - Forgot ZEND_API
-
-2000-06-30 Zeev Suraski <zeev@zend.com>
-
- * zend_config.w32.h:
- Add a messagebox style that's safe to use from an ISAPI filter
-
- * zend_builtin_functions.c
- zend_execute_API.c
- zend_globals.h: error_reporting fix
-
-2000-06-29 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h: Add $context argument to error handler
-
-2000-06-28 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Improve error handling code
-
- * zend-scanner.l: Be HTML friendly
-
-2000-06-28 Andi Gutmans <andi@zend.com>
-
- * zend.h: version update
-
-2000-06-26 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_constants.c
- zend_extensions.h:
- Make it possible to detect whether we're thread safe or not from PHP scripts and the php.ini
- file
-
-2000-06-26 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.c: - Add another "\n" at the end of error messages.
-
-2000-06-26 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c:
- Make max_execution_time work properly when set to 0 under Win32 (disable)
-
-2000-06-25 Andi Gutmans <andi@zend.com>
-
- * zend.c: - I wrote a long msg but the commit didn't go through.
- - So here is the short version:
- - a) Start moving to binary opens in Windows
- - b) Give checkuid_mode() a small face lift including the fopen-wrappers.c
- - The mode to this function should at least be a #define but that is for
- - another day. Anyway this whole stuff should be given more face lifts in
- - the future.
-
-2000-06-24 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Nuke a warning
-
-2000-06-23 Andi Gutmans <andi@zend.com>
-
- * zend_static_allocator.c
- zend_static_allocator.h: - Not returning a value anymore
-
- * zend_static_allocator.h: - Don't need SUCCESS/FAILURE anymore
-
- * zend_static_allocator.c
- zend_static_allocator.h: - Add license
-
- * zend_static_allocator.c
- zend_static_allocator.h:
- - Commit static allocator structure which we might use in an upcoming Zend
- - change
-
-2000-06-22 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l: - Fix asp_tags.
-
- * zend_extensions.c: - Oops I miss-wrote that field
-
- * zend_extensions.c
- zend_extensions.h:
- - Change API version and make the error messages more meaningful.
-
- * zend_alloc.c
- zend_alloc.h: - Change cache size and only initialize part of it.
-
-2000-06-22 Stanislav Malyshev <stas@zend.com>
-
- * zend_alloc.c:
- Cached-freed memory blocks should not be in "occupied" list
-
- * zend_alloc.c
- zend_globals.h: Make cache counters to be unsigned int
- Start collecting statistics after cache pre-fill
-
-2000-06-18 sascha <sascha@pb1.pair.com>
-
- * Zend.m4
- acinclude.m4
- zend.c: fp_except check for FreeBSD 1.0-2.2.5
-
- * Zend.m4
- acconfig.h
- zend_config.w32.h
- zend_operators.h: Welcome zend_finite(n).
-
- This chooses the best combination of what is available:
-
- finite, isfinite, isinf, isnan
-
-2000-06-18 Stanislav Malyshev <stas@zend.com>
-
- * zend.h
- zend.c: Make error callback be publicly accessible
-
-2000-06-18 Andi Gutmans <andi@zend.com>
-
- * zend.c: - Better FreeBSD fix. Does fp_except_t exist on 3.4?
-
- * zend.c:
- - I don't know how this happened. I tested the bloody thing and I remember
- - copy&pasting from code which used ~.
-
-2000-06-17 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c
- zend_execute_API.c
- zend_globals.h
- zend_ptr_stack.c
- zend_ptr_stack.h: - Add restore_error_handler()
- error_handler's are now stored in a stack
-
- * zend-scanner.l
- zend.c
- zend_API.h
- zend_execute_API.c:
- Allow the symbol_table to be passed to call_user_function_ex()
-
- * zend-scanner.h
- zend-scanner.l: Fix filenames and line numbers in ZTS mode
-
- * zend_hash.c
- zend_hash.h:
- Avoid crashing with recursive applies - limit apply nest level to 3 (I'm not aware of a place
- in which applying recursively on the same hash makes sense with more than one nest level, but
- 3 should be enough)
-
-2000-06-16 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h:
- Ok, this time here's some real Win32 system programming :)
- Redesigned the timeout system using a single timeout thread and a single window,
- and used a much quicker check.
-
-2000-06-16 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c: Fix UNIX build
-
-2000-06-16 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Macro it up the right way
-
- * zend_execute.c: Macro this up, so it can be moved to other places
-
- * zend.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h: - Move timeout code to Zend
- - Implement timeouts in Win32
-
-2000-06-15 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp
- zend.c:
- Fix non thread-safe mode - asp_tags/short_tags etc weren't getting initialized properly
-
-2000-06-15 Andi Gutmans <andi@zend.com>
-
- * zend_list.c: *** empty log message ***
-
- * zend-parser.y: - Support multiple arguments to unset()
-
-2000-06-15 Thies C. Arntzen <thies@thieso.net>
-
- * zend_list.h: ups.
-
- * zend_list.h:
- changed return type of ZEND_VERIFY_RESOURCE from FALSE to NULL
-
-2000-06-14 sascha <sascha@pb1.pair.com>
-
- * zend_operators.h
- zend_operators.c:
- Move some stuff to zend_operators.h which is required by the
- moved inline functions.
-
-2000-06-14 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c
- zend_alloc.h: - More correct way of doing bit mask
-
-2000-06-14 sascha <sascha@pb1.pair.com>
-
- * Zend.m4: Only replaced C0X and C0x, but not c0x..
-
- * Zend.m4
- zend_execute.h
- zend_gcc_inline.c
- zend_operators.h:
- Rename C0x-inline to C9x-inline, and frame preprocessor directives in
- zend_gcc_inline.c with #ifndef C9X_INLINE_SEMANTICS..#endif.
-
-2000-06-14 Andi Gutmans <andi@zend.com>
-
- * ZendTS.dsp: - Make Win32 build
-
-2000-06-13 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h: Add to the API
-
-2000-06-13 sascha <sascha@pb1.pair.com>
-
- * Makefile.am
- Zend.m4
- zend_API.h
- zend_compile.h
- zend_execute.h
- zend_execute_API.c
- zend_gcc_inline.c
- zend_globals.h
- zend_operators.c
- zend_operators.h: Add optional support for C0x inline semantics.
-
- These are enabled by specifying `--enable-c0x-inline' on the command
- line. We might add an autoconf check for this particular feature
- later.
-
- * zend_llist.h:
- Add llist_apply_func_t and make prototypes use the typedefs.
-
-2000-06-12 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c: Make Egon happy :)
-
- * zend_builtin_functions.c:
- Return the previous error handler from set_error_handler()
-
- * zend_API.c
- zend_API.h
- zend_builtin_functions.c:
- Avoid using E_CORE_* errorlevels in any place which is not in the global startup sequence
-
- * zend-parser.y
- zend-scanner.l
- zend.h
- zend_compile.c: Get rid of <?php_track_vars?>
-
-2000-06-11 Andi Gutmans <andi@zend.com>
-
- * zend.c: - Solve floating point precision crash on FreeBSD.
-
- * zend.c:
- - Fixes crash problem on FreeBSD when losing precision. Need to still see
- - how to detect we're on FreeBSD
-
-2000-06-11 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c: Fix zend_get_parameters()
-
-2000-06-10 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c:
- - Fixed problem when using uninitialized values in comparisons with strings.
- - They behave as empty strings again just like in PHP 3.
-
-2000-06-10 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- I can't think of a reason of why it should just be a notice... Make it a warning, like it was in PHP 3.
-
- * zend_API.c
- zend_builtin_functions.c: Fix bug #4768
-
-2000-06-09 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c
- zend_hash.h: Made an alias for hash apply with arguments.
-
-2000-06-09 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c: - Forgot to remove the FIXME
-
- * zend_alloc.c: - Make the memory limit accurate
-
- * zend_alloc.c: - Fix cache initialization
-
- * zend_alloc.c
- zend_alloc.h:
- - Allocate and cache in 8 byte blocks. Most allocators anyway use 8 byte
- - blocks. This should help fragmentation and cache hits.
- - The old tree is tagged as PRE_EIGHT_BYTE_ALLOC_PATCH
-
-2000-06-09 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix bug #4933
-
- * zend_builtin_functions.c: Fixed bug #4819
-
-2000-06-09 Andi Gutmans <andi@zend.com>
-
- * zend_modules.h:
- - Time to change it. We changed register_internal_class() ->
- - zend_register_internal_class()
-
- * zend_API.c
- zend_API.h
- zend_compile.c
- zend_compile.h: - Andrei, this is for you!
- - Add zend_register_internal_class_ex() which allows you to specify a
- - parent to inherit from. You can either specify the parent directly or via
- - its name.
-
- * zend-parser.y
- zend-scanner.l: - Typo
-
- * zend_execute.c: - Remove old obsolete code.
-
- * zend_execute.c: - Make unset consistent with the way array offsets work
-
-2000-06-09 Stanislav Malyshev <stas@zend.com>
-
- * zend_execute.c: Handle unset with empty key
-
-2000-06-09 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_API.h:
- - Change register_internal_class to zend_register_internal_class for
- - consistency.
- - Andrei: I'm still thinking about the _ex you want me to implement
-
-2000-06-08 sascha <sascha@pb1.pair.com>
-
- * Zend.m4
- acconfig.h: Clean up acconfig.h
-
- * zend_execute_API.c
- zend_operators.c: Add a couple of casts
-
-2000-06-06 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_compile.c:
- Enable asp_tags/short_tags/allow_call_time_pass_by_reference to work on a per-directory
- basis as well
-
-2000-06-06 sascha <sascha@pb1.pair.com>
-
- * zend_API.c:
- Add newline at the end of the file (breaks at least SCO and Tru64 C compiler).
-
-2000-06-05 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l: - Revert internazionalization fix.
-
- * zend_builtin_functions.c: - Complete change to create_function()
-
-2000-06-04 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_execute_API.c:
- Change shutdown order to sort out a crash when assigning a resource id to a static.
-
- * zend_hash.c
- zend_hash.h
- zend_operators.c: - Support unordered hash comparisons
- - Make == perform an unordered comparison with arrays/objects, and === perform an ordered comparison
-
- * zend_builtin_functions.c: Rename lambda()
-
-2000-06-03 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c
- zend_hash.h
- zend_operators.c
- zend_operators.h:
- Support comparisons of arrays (with arrays) and objects (with objects)
-
-2000-06-03 Andi Gutmans <andi@zend.com>
-
- * zend.c: - Change #if to #ifdef.
-
-2000-06-03 Zeev Suraski <zeev@zend.com>
-
- * ZendTS.dsp
- zend.c: Don't take chances with new include files
-
- * zend_execute_API.c:
- Improve call_user_function() to support array($obj, $method)
-
- * zend-parser.y
- zend.h
- zend_operators.c: - Export normalize_bool
- - This global/static syntax fix brought us back to the 4 documented conflicts
-
- * zend_builtin_functions.c: Fix a lambda() bug
-
- * zend_builtin_functions.c: Add missing {
-
- * zend_globals.h
- zend_hash.c
- ZendTS.dsp
- zend-scanner.l
- zend.c
- zend.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h: - Fix Win32 compilation (Use winsock2.h from now on)
- - Add lambda() support
-
-2000-06-02 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y: - global/static require a trailing ';'
-
-2000-06-02 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c: Update error code
-
- * zend.c
- zend.h
- zend_config.w32.h: Nuke the old error code, use the new one
-
-2000-05-31 Zeev Suraski <zeev@zend.com>
-
- * zend.h: IS_BC isn't really being used, but still...
-
- * zend-parser.y
- zend.h
- zend_API.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.h
- zend_variables.c:
- Fix a bug in static initializers/default values/class member variables that contained
- array values
-
-2000-05-29 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c
- zend_API.h: Allow disabling of functions for security reasons
-
-2000-05-28 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c:
- - Use pointer arithmetic to speed up the function a bit
-
- * Zend.m4: - This should have been done for 4.0.0.
- - Default build is without debug now. Use --enable-debug if you want a
- - debug build which includes leak/memory overwrite etc. detection
-
-2000-05-26 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l
- zend_operators.c
- zend_operators.h:
- - Fixed scanning decimal numbers in internationalized environments. They should
- - always be in standard US format e.g. 23.3
-
-2000-05-25 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Fix a crash bug in certain situations of class redeclarations
-
-2000-05-24 Thies C. Arntzen <thies@thieso.net>
-
- * zend_hash.h: rename hastable -> _hashtable to avoid clashes
-
- * zend-scanner.l:
- add rdbuf() to our own istdiostream implementation, allowing C++ compile
- using SUN and SGI native compilers. (by Jayakumar Muthukumarasamy <jk@kasenna.com>)
-
-2000-05-22 Zeev Suraski <zeev@zend.com>
-
- * zend.c: - Remove ugly Ltd.
-
-2000-05-21 Sam Ruby <rubys@us.ibm.com>
-
- * zend.c: Windows build failure
-
-2000-05-21 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend_compile.h:
- - Fix Apache php source highlighting mode. It was crashing due to the
- - module shutdown functions being called when the startup functions weren't
- - being called.
-
- * zend.h
- zend_extensions.h: - Get ready for release
-
-2000-05-19 Zeev Suraski <zeev@zend.com>
-
- * zend_highlight.c
- zend_highlight.h: Open these up for the API
-
-2000-05-18 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Do it in thread unsafe mode for now.
-
-2000-05-18 sascha <sascha@pb1.pair.com>
-
- * zend_alloc.c: Kill warnings
-
-2000-05-18 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c: - Do this someplace else.
-
- * zend_execute.c
- zend_operators.c:
- - Fix include() when used on resources (shouldn't work but shouldn't crash
- either).
-
-2000-05-18 Andrei Zmievski <andrei@ispi.net>
-
- * zend_operators.c:
- Update for sort functions - user can now specify sort type.
-
-2000-05-17 Andi Gutmans <andi@zend.com>
-
- * zend_operators.h
- zend_operators.c:
- - Add support for string_compare_function() and number_compare_function().
- UNTESTED!
-
-2000-05-17 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Normalize results of compare_function()
-
- * zend-scanner.l:
- Fix crash if %> is encountered in HTML while ASP-tags are disabled
-
-2000-05-17 Andi Gutmans <andi@zend.com>
-
- * zend_opcode.c: Fix order
-
-2000-05-17 sascha <sascha@pb1.pair.com>
-
- * zend_operators.h: Add missing prototype
-
-2000-05-16 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c:
- - Small optimization. Filling up the Cache helps performance.
-
-2000-05-12 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: Fix parallel makes on BSD
-
-2000-05-11 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend-scanner.l
- zend.h
- zend_operators.c:
- Get rid of chval - it's really not necessary and seems to be confusing people
-
- * zend_compile.c: Refined fix
-
- * zend_compile.c:
- Fix a memory corruption bug with by-ref function arguments
-
-2000-05-10 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.h: - Bump up Zend extension version number
-
-2000-05-10 Thies C. Arntzen <thies@thieso.net>
-
- * zend_compile.c: make waning readable
-
-2000-05-08 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_opcode.c: Thoroughly initialize IS_UNUSED for proper cleanup
-
- * zend.h: - Change Zend Engine version number
-
- * zend_alloc.c: - Return real size allocated
-
-2000-05-08 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Make zend_binary_strcasecmp compile again
-
-2000-05-08 sascha <sascha@pb1.pair.com>
-
- * zend_operators.c: Make strcasecmp() act correctly WRT SUS II.
-
- Patch by: hholzgra@php.net
- PR: #3556
-
-2000-05-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.h
- zend_execute_API.c: - Make zend_eval_string() return SUCCESS/FAILURE
-
- * zend_execute.c:
- - Make $obj->test = 5; work again (assigning to uninitialized objects)
-
-2000-05-05 sascha <sascha@pb1.pair.com>
-
- * Zend.m4:
- Linking directly against libc might result in unexpected behaviour.
- We check for dlopen in libdl first, and check then whether dlopen exists.
-
-2000-05-03 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - Change fetch_type to be zend_uint
-
- * zend_compile.c
- zend_execute.c: - Change the place CAST uses for the op_type
-
-2000-05-02 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c
- zend_hash.h:
- Change zend_hash_get_current_key_ex() to also return the string length
-
-2000-05-02 sascha <sascha@pb1.pair.com>
-
- * zend_API.c:
- Fix segfault occuring when a temporary module was unloaded and if this
- module did not have a request shutdown function.
-
- * zend_API.h:
- Add ZEND_GET_MODULE(name). This is a short-cut for the common
- get_module function.
-
-2000-05-01 sascha <sascha@pb1.pair.com>
-
- * zend.c:
- Source file does not end with a newline. Some old compilers don't like that.
-
-2000-05-01 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: Added a way to get all declared classes.
-
-2000-05-01 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: Fix dependency
-
-2000-04-29 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.h
- zend_opcode.c:
- Pass the op_array to the ctor/dtor, instead of just the resource
-
- * zend_extensions.c: crash fix
-
- * zend_extensions.c
- zend_extensions.h
- zend_llist.c
- zend_llist.h: - Add zend_llist_apply_with_arguments()
- - Add a message handler to the extensions
-
- * zend_compile.h
- zend_opcode.c:
- Fix possible bug with extension dtors being called without the ctors being called first
-
- * zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_opcode.c: Beautify
-
-2000-04-28 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_extensions.c
- zend_extensions.h: Fix a bug in the resource dispencer
-
- * zend_operators.c
- zend_operators.h: Make convert_to_string() allocations traceable
-
-2000-04-27 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.h
- zend-scanner.l
- zend.c
- zend_compile.c
- zend_compile.h
- zend_execute.c: *** empty log message ***
-
- * zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_execute.c: Change to using the #define's
-
- * zend.c
- zend.h: More error handling work (still completely disabled)
-
-2000-04-26 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c
- zend_variables.c: Fix - forgot to split away if refcount>1
-
-2000-04-25 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c: Fix bug
-
- * zend.h: We'll need two...
-
- * zend_hash.h: Add useful macros
-
-2000-04-25 Andi Gutmans <andi@zend.com>
-
- * zend_llist.c: - Fix persistence of llist
-
-2000-04-24 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: - Forgot to keep the ':' in the class_name
-
- * zend_API.c: Correct fix
-
-2000-04-24 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.c: MODULE_TEMPORARY should get a call to RSHUTDOWN as well!
-
- * zend.c:
- fixed shutdown crash if MSHUTDOWN tries to php_error() something.
-
-2000-04-21 Thies C. Arntzen <thies@thieso.net>
-
- * zend_variables.c
- zend_variables.h: export zval_add-ref and zvale_del_ref
-
-2000-04-20 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.h: - Change macro names from Z to Z_
-
- * zend_operators.h: Add some macros for nicer zval handling
-
-2000-04-20 Andrei Zmievski <andrei@ispi.net>
-
- * zend_operators.c: Do proper ieeefp.h check.
-
-2000-04-20 Thies C. Arntzen <thies@thieso.net>
-
- * zend_operators.c:
- compile before commit! compile before commit! compile before commit!
-
- * zend_operators.c:
- revert andrei's path (i can't compile anymore on linux)
- we're always using #ifndef HAVE_BLA instead of if !HAVE_BLA and if we need ieeefp.h for some weird platform (which one is that?) we need an autoconf check for it.
-
-2000-04-19 Andrei Zmievski <andrei@ispi.net>
-
- * zend_operators.c: Include proper files for finite.
-
-2000-04-19 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_builtin_functions.c
- zend_execute_API.c
- zend_globals.h:
- Initial support for trapping errors (not complete and disabled; will be enabled only
- post-PHP 4.0.0)
-
- * zend_builtin_functions.c
- zend_constants.c
- zend_errors.h:
- - Renamed get_used_files() to get_required_files() for consistency
- - Documented some functions
- - Added user-level warning messages
- - Added user_error()
-
-2000-04-19 Andi Gutmans <andi@zend.com>
-
- * zend_opcode.c
- zend_compile.h: - Export pass_include() for Windows
-
-2000-04-18 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.h:
- Add convert_to_writable_*_ex() macros (unused at this time)
-
-2000-04-17 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c: - Fix order of JMPZNZ arguments
-
-2000-04-17 Thies C. Arntzen <thies@thieso.net>
-
- * zend_operators.c: ups, finite is already a macro on Win32
-
- * Zend.m4
- zend_operators.c: HPUX11 only has isfinite()
-
-2000-04-15 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l: - Fix leak in require_once()
-
-2000-04-15 Thies C. Arntzen <thies@thieso.net>
-
- * zend_extensions.c: fixes compile on platforms without dl() support.
-
-2000-04-15 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Fix ZTS
-
-2000-04-15 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l:
- "use" is not yet supported; instead use include_once() or require_once()
- for the time being (Andi, Zend library)
-
-2000-04-15 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_API.c
- zend_compile.c
- zend_execute_API.c
- zend_list.c
- zend_list.h: - Clean up resource lists namespace
- - Prepare extended resource list destructor APIs (currently unused)
-
-2000-04-13 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- Fix a memory leak when using assign-op bitwise operators on strings
-
-2000-04-12 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: *** empty log message ***
-
-2000-04-11 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c: - Fix memory leak
-
-2000-04-11 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix warnings
-
- * zend_execute.c: Fix fd leak in include_once()
-
-2000-04-10 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l
- zend_execute.c: -
-
-2000-04-10 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h
- zend_operators.c: Fix object overloading support
-
-2000-04-10 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Add warnings
-
- * zend_compile.c: - Two more places needed changing
-
-2000-04-10 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.h: Clean up last/size definitions
-
-2000-04-09 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h: *** empty log message ***
-
-2000-04-07 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Thoroughly fix include_once()
-
- * zend_execute.c: Fix include_once()
-
-2000-04-06 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y: *** empty log message ***
-
- * zend_execute.c
- zend_execute.h: Initial preparation for OO overloading patch
-
-2000-04-05 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.h: - Bump up version number
-
- * zend_compile.c
- zend_execute.c: - FIx JMPZNZ
-
-2000-04-03 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c:
- Fix the problem with dl()'d modules not freeing their resources properly
-
-2000-04-01 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h
- zend_config.w32.h: *** empty log message ***
-
- * acconfig.h: Have a standard way of exporting symbols
-
- * zend_modules.h: Use int
-
- * zend_API.h: Generalize some common thread-safety stuff
-
- * zend_modules.h: Have a standard entry for the globals id
-
-2000-03-31 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- The previous fix ended up being broken, this one should do it
-
-2000-03-31 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Fix bug
-
-2000-03-30 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c: Fix zend_register_extension()
-
-2000-03-30 Andi Gutmans <andi@zend.com>
-
- * zend_extensions.h: - Bump up API number after Lars' change
-
-2000-03-30 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: Give another hint to BSD makes
-
- * Makefile.am:
- Specifically mention $(srcdir), so that OpenBSD's make gets it
-
-2000-03-29 Zeev Suraski <zeev@zend.com>
-
- * zend_stack.c
- zend_stack.h
- zend_compile.c:
- - Make the argument order for the stack applies more consistent with other Zend
- data structures
- - Fix a possible corruption problem due to switch() C-level optimization
-
-2000-03-29 Torben Wilson <torben@pinc.com>
-
- * zend-parser.y
- zend-scanner.l
- zend_compile.h
- zend_execute.c
- zend_opcode.c
- zend_operators.c
- zend_operators.h:
-
- Added !== (is not identical) operator.
-
-2000-03-29 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c
- zend_extensions.h: *** empty log message ***
-
-2000-03-29 Andi Gutmans <andi@zend.com>
-
- * zend_API.h:
- - Make sure zend_API.h has Zend'ish versions of the ZEND macros so that
- Zend'ish modules don't need to mix PHP & Zend notation.
-
-2000-03-28 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c:
- The checks for func_num_args() and friends were broken - fixed
-
-2000-03-27 Sam Ruby <rubys@us.ibm.com>
-
- * Zend.dsp: Remove debug libraries from debug build
-
-2000-03-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_execute_API.c
- zend_API.c
- zend_builtin_functions.c: - Stop zend_func_args() and co. from crashing
-
- * zend.h:
- - Didn't see Thies' commit message although I can't really see how it would
- make a difference
-
- * zend.h
- zend_opcode.c: - Include Andrea's fix for alloca.h
-
-2000-03-26 Thies C. Arntzen <thies@thieso.net>
-
- * zend.h
- zend_execute.c:
- <alloca.h> needs to be included before we define macros calling alloca()
- atleast using SGI's cc - should not harm other platforms (i hope)
-
- * zend_opcode.c: fix cast
-
-2000-03-25 Andi Gutmans <andi@zend.com>
-
- * zend_alloc.c
- zend_alloc.h: *** empty log message ***
-
-2000-03-25 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c
- zend_variables.c: - Some header dependencies cleanup
- - Generalize zval_print() and zval_print_r()
-
-2000-03-25 Sam Ruby <rubys@us.ibm.com>
-
- * zend.h: RTLD_NOW => RTLD_LAZY|RTLD_GLOBAL
-
-2000-03-25 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp: Update dsp's
-
-2000-03-24 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- - Fixed a crash when sending a non-variable expression to a runtime-bound function
- that expected a reference.
-
-2000-03-24 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_builtin_functions.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_hash.c
- zend_hash.h: - Nuke hash_*_ptr functions
-
-2000-03-23 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: Use WRONG_PARAM_COUNT.
-
-2000-03-23 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c: - Make it compile
-
-2000-03-23 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: Added get_class_methods().
-
-2000-03-22 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Change Zend version as API has changed
-
-2000-03-22 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: - Wrong fix
-
- * zend_operators.c: - Only free when result != op1
-
-2000-03-21 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend.h:
- - Change zend_startup to accept a flag for starting builtin functions
-
- * zend.h
- zend_API.h: - Move #defines
-
-2000-03-19 Thies C. Arntzen <thies@thieso.net>
-
- * zend_compile.h: kill warning
-
-2000-03-18 Andi Gutmans <andi@zend.com>
-
- * zend.h: - Fix compile problem on FreeBSD
-
- * zend.h:
- - No reason for refcount to be signed and move to zend_* typedefs
-
-2000-03-18 Thies C. Arntzen <thies@thieso.net>
-
- * zend.c: renamed _string_value_() to __string_value().
-
-2000-03-18 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c:
- The third argument to define() wasn't working right, fixed
-
- * zend_execute.c:
- false wouldn't automaticaly switch to an array type, which resulted in an
- incompatibility with PHP 3. Fixed.
-
-2000-03-16 Thies C. Arntzen <thies@thieso.net>
-
- * zend.c: renamed "to_string" -> "_string_value_"
-
-2000-03-15 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend.h
- zend_execute.c: - Fix newly introduced problem reported by Sam Ruby
-
-2000-03-15 Andrei Zmievski <andrei@ispi.net>
-
- * zend_hash.c
- zend_hash.h:
- Make zend_hash_move_forward()/zenv_hash_move_backwards() a little smarter.
-
-2000-03-15 Zeev Suraski <zeev@zend.com>
-
- * zend_opcode.c: - Fix warning (I thought I fixed this one before)
-
-2000-03-14 Andrei Zmievski <andrei@ispi.net>
-
- * zend_llist.c
- zend_llist.h: Implemented external list traversing.
-
-2000-03-14 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y:
- - Allow array(1,2,3,) i.e. with trailing comma. You can only have one
- trailing comma.
-
-2000-03-13 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: -
-
- * zend_compile.c: - Spare a byte :)
-
-2000-03-13 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h
- zend_modules.h: - Another zend_uchar
-
- * zend_compile.c: *** empty log message ***
-
- * zend.h
- zend_compile.h:
- - define zend_uint and zend_uchar and use them in a few places
-
-2000-03-13 Andrei Zmievski <andrei@ispi.net>
-
- * zend_hash.c
- zend_hash.h:
- Introduced a way to traverse hashes through external pointers.
-
-2000-03-13 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - Change type from int -> char
-
-2000-03-13 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: - Fix filename/lineno initialization for do_return
-
-2000-03-12 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c
- zend_modules.h: -
-
-2000-03-11 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Remove inline from functions which are pretty large and besides eating up
- memory in compile time probably doesn't boost performance.
-
-2000-03-10 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c:
- - Seems to be a problem here with the return value not being set
-
- * zend-parser.y
- zend_builtin_functions.c
- zend_execute.c
- zend_execute_API.c
- zend_globals.h: - Quick way of supporting include_once().
- Good enough for RC1.
-
- * zend-parser.y
- zend-scanner.l
- zend_compile.c
- zend_compile.h: - Support require_once().
-
- * zend_compile.h
- zend_execute.c: - Cleanup old IMPORT stuff
-
- * zend-parser.y
- zend-scanner.l:
- - Nuke import, add include_once and include_require scanner/parser rules.
- Hope to nuke use too :)
-
- * zend_modules.h: - That broke the Win32 build
-
- * zend_modules.h: - Fix a bug and define an API_NO for the ZEND_MODULE_API
-
- * zend_modules.h: - zend_config.h is enough
-
- * zend_modules.h: - Save ZEND_DEBUG, ZTS, ZEND_API information
-
-2000-03-09 Andi Gutmans <andi@zend.com>
-
- * zend_highlight.c: - Fix bug in syntax highlighter
-
-2000-03-06 stig <stig@pb1.pair.com>
-
- * zend_modules.h: added GINIT_FUNC_ARGS and GINIT_FUNC_ARGS_PASSTHRU
-
-2000-03-06 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.h: - Bump up Zend's API version
-
-2000-03-06 stig <stig@pb1.pair.com>
-
- * zend_modules.h: Added ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU.
-
-2000-03-06 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l: - Fix memory leak
-
- * zend.c: - Missed one
-
-2000-03-06 Sam Ruby <rubys@us.ibm.com>
-
- * zend.c
- zend.h: Unresolved externs
-
-2000-03-06 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c
- zend_extensions.h
- zend_fast_cache.h
- zend_globals.h
- zend_globals_macros.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_variables.c
- zend_variables.h
- LICENSE
- zend-parser.y
- zend-scanner.h
- zend-scanner.l
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_builtin_functions.h
- zend_compile.c
- zend_compile.h
- zend_config.w32.h
- zend_constants.c
- zend_constants.h
- zend_dynamic_array.c
- zend_dynamic_array.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_modules.h: It's official now...
-
-2000-03-05 Zeev Suraski <zeev@zend.com>
-
- * ZendTS.dsp
- zend.c
- zend.h: Wrap some commonly unused callbacks
-
-2000-03-04 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l:
- The default return value from include() and eval() changed from 1 to 0
- unintentionally after the old return-reference patches - fixed
-
-2000-03-02 Sam Ruby <rubys@us.ibm.com>
-
- * zend_config.w32.h: Fix Win32 build breakage
-
-2000-03-01 Andi Gutmans <andi@zend.com>
-
- * zend.c: - Upgrade to year 2000
-
- * ZEND_CHANGES
- zend_compile.c
- zend_execute.c: - Fix typos
-
-2000-03-01 Thies C. Arntzen <thies@thieso.net>
-
- * zend_operators.c: now
-
-2000-02-27 Egon Schmid <eschmid@s.netic.de>
-
- * zend_builtin_functions.c: Fixed some protos.
-
-2000-02-26 Sam Ruby <rubys@us.ibm.com>
-
- * zend_builtin_functions.c: compilation error - Win32
-
-2000-02-26 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c:
- Added get_class_vars() and get_object_vars() functions.
-
- * zend_execute.c: Fix typo.
-
-2000-02-26 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Fix comparisons of "inf"=="inf" and "-inf"=="-inf"
-
-2000-02-25 Zeev Suraski <zeev@zend.com>
-
- * zend_fast_cache.h
- zend_variables.c: Use the fast cache here too
-
-2000-02-19 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend-scanner.h
- zend-scanner.l
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_builtin_functions.c
- zend_builtin_functions.h
- zend_compile.c
- zend_compile.h
- zend_config.w32.h
- zend_constants.c
- zend_constants.h
- zend_dynamic_array.c
- zend_dynamic_array.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_fast_cache.h
- zend_globals.h
- zend_globals_macros.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_modules.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_variables.c
- zend_variables.h: (c) patch
-
- * zend_API.c
- zend_API.h
- zend_fast_cache.h
- zend_hash.c:
- - Fix a nasty bug in the hash, introduced in the recent migration to macros
- - Make array_init() and friends trackable
-
- * zend_API.c
- zend_API.h
- zend_execute.c
- zend_operators.c
- zend_operators.h: Generalize macros
-
-2000-02-18 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: *** empty log message ***
-
-2000-02-18 sascha <sascha@pb1.pair.com>
-
- * zend_llist.c
- zend_llist.h:
- Get rid of second declaration of compare_func_t. Either put in a common
- header file or prefix it with i.e. zend_llist_
-
-2000-02-18 Andi Gutmans <andi@zend.com>
-
- * zend_llist.c
- zend_llist.h:
- - Quick and dirty hack for supporting sorts. Improve later on when I wake up.
-
- * ZendTS.dsp
- zend_dynamic_array.c: - Didn't compile on Win32
-
- * zend_dynamic_array.c:
- - Tiny change (I know I don't have to cast malloc() to void * but I like
- casting my malloc()'s)
-
- * Makefile.am
- zend_dynamic_array.c
- zend_dynamic_array.h:
- - Preliminary support for dynamic arrays. I need it on order to try out a
- new hash implementation. It isn't used anywhere.
-
-2000-02-17 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend.h: - Add ZEND_API
-
-2000-02-16 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: -Fix bug 3504 concerning leaks with unset()
-
- * zend_execute.c
- zend.h
- zend_compile.h: - Hopefully fix Thies' bug report.
-
-2000-02-16 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c:
- ZEND_TEST_EXCEPTIONS should be defined/undefined before it's checked
-
-2000-02-16 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fix bug #3309
-
-2000-02-14 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- - Put in the infrastructure for the unset() fix. Right now it has the old
- behavior but I just need time tomorrow to add the correct behavior.
-
- * zend_builtin_functions.c: - Fix bug in func_get_arg()
- - Get rid of compiler warnings for unused function crash()
-
-2000-02-13 Zeev Suraski <zeev@zend.com>
-
- * zend_constants.c: Fix a memory leak
-
-2000-02-13 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c: - Save a function call one very hash_add
-
- * zend_hash.c
- zend_hash.h:
- - Make startup a bit faster by changing some hash_update()'s and hash_add()'s
- to hash_update_ptr()/hash_add_ptr()
-
- * zend_hash.c:
- - Fix a couple of potential bugs where we were using emalloc/efree instead
- of pemalloc/pefree.
- - Fix a bug were we potentially would be freeing the key by mistake
-
-2000-02-13 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c: *** empty log message ***
-
- * zend_operators.c: Make (array) false == array() and not array(false)
-
-2000-02-11 Andrei Zmievski <andrei@ispi.net>
-
- * zend_hash.c
- zend_hash.h: Made a couple of typedefs for zend_hash_apply_*() calls.
-
-2000-02-11 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp
- ZendTS.dsp
- zend_config.w32.h: Update .dsp's
-
- * zend-scanner.l
- zend.h
- zend_API.h
- zend_alloc.c
- zend_config.w32.h
- zend_constants.c
- zend_execute.c
- zend_extensions.c: Fine tune Andi's patch
-
-2000-02-10 Andi Gutmans <andi@zend.com>
-
- * zend.h: - #define ZEND_WIN32 differently
-
- * zend-scanner.l
- zend.h
- zend_API.h
- zend_alloc.c
- zend_constants.c
- zend_execute.c
- zend_extensions.c: - Finally beautify those WIN32|WINNT checks
-
- * zend_execute.c: - Shouldn't be there
-
- * zend_execute.c: - Cleanup the code
-
-2000-02-09 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend_execute.c:
- Fix last known nasty bugs in Zend. It'll be cool if there are no new ones :)
-
-2000-02-09 Thies C. Arntzen <thies@thieso.net>
-
- * zend_execute.c: foreach() works now for objects as well.
-
-2000-02-08 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Fix declaration
-
- * zend_execute.c: Fix an elusive bug
-
-2000-02-08 Andrei Zmievski <andrei@ispi.net>
-
- * zend_operators.c: Fix up the patch.
-
- * zend_builtin_functions.c
- zend_operators.c
- zend_operators.h: Patches from Walter for strncmp() stuff.
-
-2000-02-07 Zeev Suraski <zeev@zend.com>
-
- * zend_highlight.c: Remove old unnecessary check
-
- * zend-parser.y
- zend-scanner.l
- zend_compile.c
- zend_highlight.c:
- Syntax highlighting was erronously emitting more than one semicolon and/or garbage with heredocs
-
-2000-02-06 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Support the string offset syntax $a{2} with the regular array opcodes.
- Will need to write new opcodes sometime but right now it's good enough
- to announce the change to this string offset syntax for beta 4.
-
-2000-02-05 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c:
- - This hopefully fixes the list($a, $a) = array(1,2) crash, i.e. when list
- by mistake contains the same variable twice.
- - BTW, there is no defined order of assignment. The value of $a after the
- previous example is undefined, and should not be assumed to be either 1
- nor 2.
-
-2000-02-05 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: More cleanup
-
- * zend.h
- zend_builtin_functions.c
- zend_execute.c
- zend_execute_API.c: Pass the executor globals to internal functions
-
- * zend.c
- zend.h
- zend_API.c
- zend_compile.c
- zend_constants.c
- zend_execute.c
- zend_execute_API.c
- zend_hash.c
- zend_hash.h
- zend_modules.h
- zend_variables.c: - Stop passing list/plist to internal functions
- - Add a typedef for the pCopyConstructor function pointer
- - Minor hacks
-
- * zend-scanner.l:
- That was the broken downcasting that prevented the interactive C++ mode from working properly under UNIX
-
-2000-02-04 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h
- zend_opcode.c:
- Maintain a state of whether we're compiling and/or executing
-
-2000-02-03 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c
- zend_API.h: *** empty log message ***
-
-2000-02-02 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c: - Fix built-in classes with more than 5 methods
-
- * zend_compile.c:
- - Fix the annoying problem with list(), that surfaced up after our recent cleaning
- patches
-
-2000-02-01 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c
- zend_API.h: Added add_property_unset() and add_property_bool().
-
-2000-02-01 Zeev Suraski <zeev@zend.com>
-
- * ZendTS.dsp
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_execute_locks.h: Improve dependencies
-
- * zend_execute.c: Sort out a gdb problem
-
- * zend_execute.c: Fix warning
-
-2000-02-01 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute_API.c
- zend_globals.h: - Get rid of remains of garbage.
- - This should fix Thies' UMR
-
-2000-02-01 Thies C. Arntzen <thies@thieso.net>
-
- * zend_execute_API.c:
- moved destroying of garbage before resource-list gets destroyed - (see my previous mail)
- zeev, andi - please comment!
-
- * zend.c: added missing break.
-
- * zend_hash.c
- zend_hash.h:
- took out zend_hash_pointer_update() & zend_hash_pointer_index_update_or_next_insert() - i really prefer link-errors instead of runtime-errors, don't you?
-
-2000-01-31 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - This has to always be done.
-
-2000-01-31 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend_compile.h
- zend_execute.c
- zend_execute_API.c: - Optimized garbage mechanism
- - Fixed another buglet in the parser
-
- * zend-parser.y
- zend_alloc.c
- zend_execute.c
- zend_fast_cache.h: - Fix foreach()
- - Fix indirect reference with object properties
-
-2000-01-30 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix the bug Thies found where I forgot to change a break; to NEXT_OPCODE();
- - If you find anymore let me know
-
- * zend_alloc.h: - Run it on align_test
-
-2000-01-29 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Fix ``'s
-
- * zend-parser.y
- zend-scanner.l
- zend_compile.h: Fix require()
-
-2000-01-29 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y: - Get rid of another rule which isn't needed.
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h:
- - Add parser support for string offsets. This added three shift/reduce
- conflicts but they all seem to be fine.
- - Cleaned up the parsing rules a bit and made them much more compact and
- elegant.
- - Please CVS update and see that I didn't break anything.
-
- * zend_alloc.h:
- - This will save some memory w/ GCC compilers on some platforms
-
- * zend_execute.c: - Yet another tiny optimization.
-
-2000-01-28 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_execute.c: - Make loop a bit faster.
-
- * zend.h: - Make sure its use is understood.
-
- * zend.h
- zend_execute.c: - Double the speed of some key switch() tests for Win32.
-
- * zend_execute.c:
- - This makes the switch() statement twice as quick. Moving to enum
- might make this a general speed up for other platforms too
-
-2000-01-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c: - Keep objects as references.
-
- * zend_execute_API.c
- zend_opcode.c:
- - Allow is_ref to become 0 in case the refcount is back to 1.
-
-2000-01-24 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c:
- - Make foreach() now copy the array but use the original array. It can
- still be optimized A LOT but it's only a performance issue and not
- a feature issue.
-
-2000-01-24 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend-scanner.l
- zend.c
- zend.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_operators.c
- zend_operators.h: - Implement declare() with declarables framework
- - Implement ticks - Germany&Norway - 5 points!
-
- * zend_execute.c
- zend_execute_API.c: Fixes
-
-2000-01-22 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c: Fix an elusive bug
-
-2000-01-20 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c: Add some order...
-
- * zend_hash.c: Indentation fixes
-
-2000-01-19 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c: - Optimize zend_hash_del a tiny bit.
-
- * zend_hash.c
- zend_hash.h: - Hopefully fix the hash problem.
-
- * zend_hash.c: - Hrm I'm not concentrating
-
- * zend_hash.c:
- - Actually the destructor should run after the data is already detached
- from the hash but before the bucket is freed.
-
- * zend_hash.c:
- - Rollback hash_apply and friends. They assume now that hash_del is reentrant
- as it first applies the destructor and only later nukes the bucket
-
- * zend_hash.c:
- - Run destructor before the hash structure is modified, thus, making
- hash_del, reentrant (BLOCK_INTERRUPTIONS needs to be made a counter now).
-
- * zend_hash.c: - Undo a bug we introduced. (Another one out there).
-
-2000-01-19 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h:
- RETURN_NULL -> RETURN_NULL() // we don't want macros without an argumnet
-
-2000-01-18 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Leak fix
-
-2000-01-18 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h: RETURN_NULL & RETVAL_NULL don't need ().
-
-2000-01-17 Thies C. Arntzen <thies@thieso.net>
-
- * zend_hash.c: use defines
-
-2000-01-17 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c
- zend_hash.h
- zend_variables.c: Get rid of the IsPointer functionality in the hash.
-
- * zend_hash.c: - Fixes a newly introduced bug in the hash
-
- * zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_constants.h
- zend_execute_API.c
- zend_hash.c
- zend_hash.h
- zend_list.c
- zend_list.h
- zend_modules.h
- zend_opcode.c
- zend_variables.c
- zend_variables.h:
- Destructors no longer return ints, the low level problem it was intended to solve is long gone now...
-
-2000-01-16 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_execute_API.c
- zend_hash.c
- zend_hash.h
- zend_list.c
- zend_list.h:
- - Make zend_hash_apply() (and friends) reentrant and much, much quicker
- - Introduce zend_hash_graceful_destroy(), which allows the destructor functions to
- use zend_hash_apply() and/or zend_hash_graceful_destroy()
- - Switch to zend_hash_graceful_destroy() in the resource list shutdowns
-
- * zend.c
- zend_compile.c
- zend_compile.h:
- Allow module startup to be separate from the compiler/executor startup
-
-2000-01-16 Thies C. Arntzen <thies@thieso.net>
-
- * zend_hash.c: make the ht->inconsistent stuff less ugly:)
-
-2000-01-15 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c
- zend_list.c: Fix a bug in call_user_function_ex()
-
- * zend-parser.y:
- Added support for $foo->{$bar}["foobar"] notation (was supported in PHP 3)
-
-2000-01-15 Thies C. Arntzen <thies@thieso.net>
-
- * zend_hash.c
- zend_hash.h:
- if ZEND_DEBUG mode is on we'll now see warnings when a HashTable is accessed
- while it's inconsistent.
-
- Zeev, Andi - you welcome to revert this patch if you don't like it - i find it
- useful! accesssing inconsistent hashtables is one of the hardest things to track!
-
-2000-01-14 Andrei Zmievski <andrei@ispi.net>
-
- * zend_highlight.c:
- Since we're highlighting code, put <code> and </code> around the code.
-
-2000-01-13 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_config.w32.h: Make Win32 compile again
-
-2000-01-12 sascha <sascha@pb1.pair.com>
-
- * acconfig.h
- zend.h:
- Move dl stuff from acconfig.h into zend.h. That allows us finer control
- when it comes to suppressing dlfcn.h.
-
-2000-01-09 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Functionality & crash fixes
-
-2000-01-04 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_operators.c:
- - Rename IS_BC to FLAG_IS_BC. We will probably nuke it.
-
-2000-01-04 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h: added ZVAL_*() macros.
-
-2000-01-04 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_execute.c:
- - Separate the overloaded objects' types from Zend's data types.
- There is no reason for them to be the same, and IS_METHOD just cluttered
- there data types.
-
- * zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_constants.c
- zend_execute.c
- zend_execute_API.c
- zend_operators.c
- zend_variables.c
- zend-parser.y
- zend.c: - Change IS_UNSET -> IS_NULL
-
-2000-01-03 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix a bug when using [] on a string
-
-2000-01-03 Joey Smith <joey@joeysmith.com>
-
- * zend_operators.c: number.h comes from ext/bcmath, not functions/
-
-2000-01-03 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix
-
-2000-01-03 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - Fix compare_function() for IS_UNSET
-
-2000-01-02 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix
-
-2000-01-02 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h: renamed RET???_UNSET -> RET???_NULL
-
-2000-01-01 sascha <sascha@pb1.pair.com>
-
- * Zend.m4
- acconfig.h
- acinclude.m4: Some cleanup
-
-2000-01-01 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c:
- - IS_NULL should be 0 when converted to a long although I don't think it
- really should be documented.
-
-2000-01-01 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Fix buglet
-
-1999-12-31 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp
- ZendTS.dsp: .dsp updates
-
- * Zend.dsp
- ZendTS.dsp
- zend_config.w32.h: - Add Release_inline builds
-
- * zend-parser.y
- zend-scanner.l
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_constants.c
- zend_execute.c
- zend_execute_API.c
- zend_operators.c
- zend_operators.h
- zend_variables.c: - Nuke undefined_variable_string
- - Introduce IS_UNSET
-
-1999-12-31 Andi Gutmans <andi@zend.com>
-
- * ZendTS.dsp
- zend-parser.y
- zend_compile.c
- zend_compile.h:
- - Fix bug #3073. continue in do..while() loops should work now
-
-1999-12-30 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend_alloc.c
- zend_fast_cache.h
- zend_globals.h
- zend_globals_macros.h:
- This should enable people to use ALLOC_ZVAL() in code outside the php4.dll
-
-1999-12-30 sascha <sascha@pb1.pair.com>
-
- * Zend.m4:
- Solaris' sed does not like this expression. Since -O0 is the default,
- we can also omit it.
-
-1999-12-29 Zeev Suraski <zeev@zend.com>
-
- * zend_variables.c:
- - Change var_reset() to set bool(0) instead of string("")
-
- Authors should go over their code and change it to use var_reset() instead of manually
- setting it to string(""), in case they're interested in the false value.
-
- * zend_alloc.c: time_t is an int under Linux... this should always work.
-
-1999-12-28 sascha <sascha@pb1.pair.com>
-
- * zend_alloc.c: Fix warnings
-
-1999-12-28 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h
- zend_constants.c: new constant: SQL_NULL
- new macros: RETURN_SQLNULL,RETVAL_SQLNULL,IS_SQLNULL
-
-1999-12-27 Zeev Suraski <zeev@zend.com>
-
- * zend_fast_cache.h: Fix
-
-1999-12-27 Andi Gutmans <andi@zend.com>
-
- * zend_API.c: - Get rid of warning
-
-1999-12-27 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp
- ZendTS.dsp
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_fast_cache.h
- zend_globals.h
- zend_opcode.c
- zend_operators.c
- zend_variables.c
- zend_zval_alloc.h: - Generalize the fast cache mechanism
- - Add the HashTable struct to the fast cache mechanism
-
-1999-12-27 Andi Gutmans <andi@zend.com>
-
- * zend_API.c:
- - Make zend_internal_function allocate a full zend_function structure so
- that we don't get memory overruns and Thies doesn't get angry :)
-
-1999-12-27 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: *** empty log message ***
-
- * zend_globals.h
- zend_zval_alloc.h
- zend_alloc.c: Add cache statistics support
-
-1999-12-27 Thies C. Arntzen <thies@thieso.net>
-
- * zend.c: fix UMR in ZTS mode
-
-1999-12-26 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp
- ZendTS.dsp
- zend_alloc.c
- zend_globals.h
- zend_zval_alloc.h:
- - Enable the new zval cache on debug too. No real reason not to, and it keeps
- the code cleaner.
- - ZTS compile fixes
-
- * zend_alloc.c: Fix buglet
-
- * zend_zval_alloc.h: Add missing file
-
- * zend.h
- zend_API.h
- zend_alloc.c
- zend_compile.c
- zend_execute.c
- zend_globals.h
- zend_operators.c:
- Introduce a zval-specific cache - 5-15% speed improvement
-
-1999-12-26 sascha <sascha@pb1.pair.com>
-
- * Makefile.am
- acinclude.m4: Makefile.am: Add dummy target for dependencies
- acinclude.m4: Cache result of broken sprintf check
-
-1999-12-26 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_operators.c: Change ALLOC_ZVAL() semantics
-
- * zend_alloc.c
- zend_alloc.h
- zend_globals.h: namespace protection
-
-1999-12-25 Zeev Suraski <zeev@zend.com>
-
- * zend_ptr_stack.c
- zend_ptr_stack.h: inline functions cannot accept varargs
-
-1999-12-25 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y: - Prepare Zend for the new $a{2} string offset syntax.
-
-1999-12-24 Zeev Suraski <zeev@zend.com>
-
- * zend_config.w32.h:
- Use __forceinline under Win32 (inlining under Win32 gives roughly 30% performance
- increase)
-
- * zend-scanner.l: Shut gcc up
-
- * zend_compile.c: Optimize
-
-1999-12-24 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_operators.c
- zend_variables.c:
- - Create two new macro's. ALLOC_ZVAL() and FREE_ZVAL(z) and make Zend use
- them.
-
-1999-12-24 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: - Use function_add_ref() here too
-
-1999-12-23 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_opcode.c:
- Fix a class inheritence leak, when using static varibles in a parent class member function
-
- * zend_compile.c: This one slipped away
-
-1999-12-23 sascha <sascha@pb1.pair.com>
-
- * Zend.m4: Rename option to match description string
-
-1999-12-23 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- - require() of a dynamic expression now has the standard require() semantics
- - Fixed a memory leak in require() of a dynamic expression
-
-1999-12-23 sascha <sascha@pb1.pair.com>
-
- * Makefile.am
- Zend.m4:
- Compile zend_execute.c with special CFLAGS. For GCC, INLINE_CFLAGS
- contains -O0 to disable optimizations. This can be disabled by using
- the appropiate parameter.
-
-1999-12-22 sascha <sascha@pb1.pair.com>
-
- * zend_builtin_functions.c: Kill compiler warning
-
- * Zend.m4: Don't set DEBUG_CFLAGS to -g, if -g is already in CFLAGS
-
-1999-12-22 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h: export
-
- * zend_extensions.h: Those void's don't belong in there
-
- * zend_API.h
- zend_builtin_functions.c: - Fix function_exists()
-
- * zend_execute.c:
- - Fix a very old legacy memory leak in break(n) statements
-
- * zend_execute.c: Fix for the array() initialization bug Stas found
-
-1999-12-22 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c: - Remove unused variable.
-
-1999-12-21 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend.h
- zend_compile.c
- zend_execute.c:
- Fix the highlighting problem. STR_REALLOC() should be used instead of plain erealloc()
- whenever you're dealing with strings that might be coming back from the engine - there seem
- to be a few other places like this in PHP.
-
-1999-12-21 Andrei Zmievski <andrei@ispi.net>
-
- * zend.c
- zend_API.c
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_operators.c
- zend_variables.c
- zend_variables.h: We're using ZVAL's now.
-
-1999-12-21 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: - Fix Sascha's leak. Good report!
-
- * zend_alloc.c: No need to block for interruptions so early
-
-1999-12-21 sascha <sascha@pb1.pair.com>
-
- * Zend.m4:
- Explicitly check for C++ preprocessor, otherwise autoconf forces it onto
- us at the wrong place (subsequent autoconf checks failed).
-
-1999-12-20 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: - Fix @expr
-
- * zend.h
- zend_compile.c
- zend_execute.c:
- - Fix the crash Thies was experiencing (returning a function call could cause a crash)
- - Fix the leak Thies was experiencing (@fcall() leaked)
-
-1999-12-19 Zeev Suraski <zeev@zend.com>
-
- * Zend.dsp: Some updates
-
- * Zend.dsp
- ZendTS.dsp: Make these work again
-
- * FlexLexer.h
- Makefile.am
- Zend.dsp
- Zend.m4
- ZendTS.dsp
- configure.in
- flex.skl
- libzend.dsp
- libzend.m4
- libzendts.dsp: libzend -> Zend
-
- * zend.h
- zend_API.h
- zend_compile.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h:
- - Made things work again (Thies, everybody - please check the latest CVS and see if you're
- still getting any problems)
- - Changed the interface of call_user_function_ex() to support returning of references
-
-1999-12-19 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend.h
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_globals.h: - More fixes related to the return references patch
- - eval_string() and call_user_function_ex() still don't work.
- - The libzend tree is untested and might not be stabl yet.
-
-1999-12-19 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: Add zend_sprintf.c
-
- * acconfig.h
- zend_sprintf.c: configure sets ZEND_BROKEN_SPRINTF
-
- * acinclude.m4: Variables are not interpolated unless we use _UNQUOTED
-
-1999-12-18 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_API.h: - The tree compiles again
-
-1999-12-18 sascha <sascha@pb1.pair.com>
-
- * libzend.m4: Let autoconf check for the proper inline keyword
-
- * Makefile.am
- libzend.m4:
- automake created illegal target names due to the ZEND_SCANNER definition.
- We now substitute @ZEND_SCANNER@ directly
-
-1999-12-18 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_API.c
- zend_API.h
- zend_builtin_functions.c:
- - Introduce ZEND_NUM_ARGS(), to replace ARG_COUNT(ht)
- - Rename getParameters() and friends for consistency and namespace cleanliness
-
-1999-12-17 Zeev Suraski <zeev@zend.com>
-
- * zend_constants.c: - Made PHP_VERSION and PHP_OS work again
- - More php3_ cleanup
- - Restored the PHP_VERSION and PHP_OS constants
-
-1999-12-17 sascha <sascha@pb1.pair.com>
-
- * libzend.m4: Define inline to inline explicitly
-
- * Makefile.am
- acinclude.m4
- configure.in
- libzend.m4: Move config code into separate file
-
-1999-12-17 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h:
- - By mistake commited this to the branch. It fixes a bug we introduced with
- the return reference patch.
-
-1999-12-15 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: Doh! I'm an idiot.
-
- * zend_builtin_functions.c
- zend_compile.c: - s/inheritence/inheritance/g
- - Added is_subclass_of() function
-
-1999-12-15 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_opcode.c: - Implement return by reference:
- - In function declaration instead of the return statement
- - In the assignment phase
- - Implement ability to turn off support for call-time pass by reference
-
-1999-12-15 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: val->len
-
- * zend_builtin_functions.c: Faster, must go faster.
-
-1999-12-15 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_opcode.c
- zend-parser.y
- zend_compile.c
- zend_compile.h:
- - Preliminary return ref patch. It breaks libzend so don't use this branch
- right now.
-
-1999-12-14 Andrei Zmievski <andrei@ispi.net>
-
- * zend_builtin_functions.c: - Added class_exists()
- - Moved function_exists() here from from the basic_functions.c
- - Modified method_exists() to convert method name to lowercase
- when checking
-
-1999-12-13 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix problem when return_value's is_ref/refcount is overwritten by the
- internal function.
-
-1999-12-11 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Another small fix.
-
- * zend_execute.c: - Support returning references
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h:
- - This is supposed to be commited to the RETURN_REF_PATCH branch which is
- the beginning of work on allowing returning of references from functions.
-
-1999-12-07 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l:
- - opened_path should not be freed here as the zend_file_dtor() takes care
- of it. This doesn't fix the bug report for the crash of highlight_file()
- though.
-
-1999-12-07 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y: Support ZTS definition in zend_config.h
-
-1999-12-06 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_highlight.c
- zend_indent.c: Move the #include of zend-parser.h out of zend_compile.h
-
- * zend-parser.y
- zend_globals_macros.h: More localization
-
- * zend-parser.y
- zend_compile.h
- zend_globals_macros.h: Localize a couple of macros
-
-1999-12-05 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: *** empty log message ***
-
-1999-12-05 sascha <sascha@pb1.pair.com>
-
- * .cvsignore
- zend-parser.y
- zend.c
- zend_API.c
- zend_compile.c
- zend_execute_API.c: Fix some warnings
-
-1999-12-04 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.c: *** empty log message ***
-
- * zend_API.c
- zend_API.h
- zend_hash.h: Added zend_set_hash_symbol() function.
-
-1999-12-04 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h:
- backed out last change after andi decided on a different approach.
-
-1999-12-04 Andi Gutmans <andi@zend.com>
-
- * zend_API.h:
- - Call ZEND_SET_SYMBOL_WITH_LENGTH() with refcount 1 from the standard
- ZEND_SET_SYMBOL()
-
-1999-12-04 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend_builtin_functions.c
- zend_compile.c: - Implement get_used_files() and get_imported_files()
-
- * zend-parser.y
- zend-scanner.l
- zend.c
- zend.h
- zend_compile.c
- zend_compile.h:
- - Break the zend->PHP dependency introduced by the .php extension for use(),
- by providing an API
- - Enable Stig's patch for use() extensions (it wasn't refered to by the parser)
- - Fix a memory leak in that code
-
-1999-12-04 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h: the new SET_VAR_* macros forgot to set the refcount!
-
-1999-12-04 Sam Ruby <rubys@us.ibm.com>
-
- * zend-scanner.l: build error - windows
-
-1999-12-04 stig <stig@pb1.pair.com>
-
- * zend-scanner.l
- zend_compile.h: Fix typo, add prototype for use_filename().
-
- * zend-scanner.l: "use" should use arg+".php" as parameter to require
-
-1999-12-04 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: This should fix the fd leak with include()/require()
-
-1999-12-03 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.h: *** empty log message ***
-
- * zend_API.h: Added ZEND_SET_GLOBAL_VAR_WITH_LENGTH_EX() macro.
-
-1999-12-03 Thies C. Arntzen <thies@thieso.net>
-
- * zend-scanner.l: revert my last patch - WARNING: we leak fd's again.
- add initialzation of opened_path highlight_file()
-
-1999-12-03 Andi Gutmans <andi@zend.com>
-
- * zend_API.h: - Remove _EX and make it the old _LENGTH
-
-1999-12-02 Andi Gutmans <andi@zend.com>
-
- * zend_API.h: - Add _EX macro for Andrei
-
-1999-12-02 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.h
- zend_compile.h: Solve a couple of compile issues
-
-1999-12-02 Thies C. Arntzen <thies@thieso.net>
-
- * zend-scanner.l:
- php_fopen_wrapper_for_zend() does *NOT* insert the opened files into any list - the caller needs to fclose() the file. (not sure if this is desired)
- fixed "Uninitialized memory read" when including URLs
-
-1999-12-01 stig <stig@pb1.pair.com>
-
- * zend-scanner.h
- zend.c
- zend.h
- zend_alloc.h
- zend_builtin_functions.h
- zend_compile.h
- zend_constants.h
- zend_execute.c
- zend_execute.h
- zend_extensions.h
- zend_globals_macros.h
- zend_hash.h
- zend_indent.h: Fix warnings surfacing in maintainer-mode.
-
-1999-12-01 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h:
- Make it possible to explicitly set refcount in ZEND_SET_SYMBOL_WITH_LENGTH(), part 2
-
- * libzendts.dsp
- zend_API.h:
- Allow to set the reference count explicitly for ZEND_SET_SYMBOL_WITH_LENGTH()
-
-1999-12-01 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Forgot to check for BP_VAR_IS in the fix made for Thies' string offset
- problem.
-
-1999-11-30 Andi Gutmans <andi@zend.com>
-
- * zend_API.c: - Applied Thies' bug fix. Great work!
-
- * zend-parser.y
- zend-scanner.l
- zend.c
- zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h:
- - Add use support (behaves like require, but will not use the same file twice)
- - Add import support (behaves like include, but requires parentheses; will not
- use the same file twice; Currently, it is not yet properly implemented, and
- only behaves like include)
-
- * zend_execute.c:
- - Fix problem Thies reported. We by mistake separated variables which were
- being fetched for read only.
-
-1999-11-27 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Add ability to disable the memory cache
-
-1999-11-26 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: - Fix fd leak in ZTS mode
-
- * zend-scanner.l
- zend_compile.c: UNIX/non ZTS compile fixes
-
- * zend-scanner.l
- zend_compile.c
- zend_compile.h: - Improve the file handle closing code
-
- * zend_llist.c
- zend_llist.h: - Modify zend_llist_del() to receive a comparison function
-
- * zend_API.c:
- This request_shutdown() is no longer needed (never was needed really)
-
- * zend-scanner.l: This should get the file to close properly
-
-1999-11-26 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: Rebuild libzend.la, if the scanner was rebuilt
-
-1999-11-26 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c
- zend_modules.h: Remove request_started, increase thread safety
-
-1999-11-25 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: That's a more thorough fix...
-
- * zend_execute.c:
- Fix bug #2817 - assignments to string offsets could erronously modify unrelated strings
-
-1999-11-22 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Fix compile problem with enable-memory-limit
-
- * zend-scanner.l: Fix inconsistencies with here-docs implementation
-
- * zend-scanner.l
- zend_globals.h: Fix #2744
-
-1999-11-21 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: That slipped away
-
-1999-11-21 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_API.c
- zend_compile.c
- zend_execute.h
- zend_execute_API.c: - Optimize class instanciation
- - Fix constant instanciation for array elements inside objects
-
-1999-11-19 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Moved var_uninit() for return_value to the beginning of DO_FCALL.
- We forgot to do it for overloaded methods
-
- * zend.h
- zend_execute.c:
- - Functions whose return values aren't used have them freed in DO_FCALL
- and don't need a special ZEND_FREE opcode following them anymore
-
-1999-11-17 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c:
- - If a function's return value is unused then don't create a ZEND_FREE
- opcode but free it after the function call in zend_execute.
-
- * zend_execute.c: - Forgot this
-
-1999-11-16 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c: - Weird that this compiled for me.
-
- * zend.h: - CHange used_return_value -> return_value_used
-
- * zend_compile.c:
- - In any case create the free opcode. Need to allow the functions to
- create a hint.
-
- * zend.h
- zend_compile.c
- zend_execute.c:
- - Add support for used_return_value passed to internal functions.
-
-1999-11-14 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - Fix comment as to Joey's findings
-
-1999-11-13 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fix crash with string offset assignments.
-
-1999-11-04 Andrei Zmievski <andrei@ispi.net>
-
- * zend_hash.c
- zend_hash.h: Made zend_hash_rehash() callable from outside.
-
-1999-11-03 Andi Gutmans <andi@zend.com>
-
- * zend_API.h
- zend_compile.c
- zend_compile.h
- zend_execute.c: - Add support for BYREF_FORCE_REST
-
-1999-10-28 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c: - Fix for Thies' leak and Andrei's crash
-
-1999-10-25 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h: *** empty log message ***
-
-1999-10-23 Sam Ruby <rubys@us.ibm.com>
-
- * libzend.dsp
- libzendts.dsp:
- Allow CYGWIN directory to be specified as via environment variable
-
-1999-10-22 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fix isset() with string offsets.
-
-1999-10-19 Thies C. Arntzen <thies@thieso.net>
-
- * zend_operators.c: fixed is_identicat_function()
-
-1999-10-19 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h: - Move IS_IDENTICAL next to IS_EQUAL
-
- * zend_operators.c: - Fix is_identical function
-
- * zend-parser.y
- zend-scanner.l
- zend_compile.h
- zend_execute.c
- zend_opcode.c
- zend_operators.c
- zend_operators.h:
- - Preliminary submit of Thie's patch. Will fix the rest on Windows
- as this was added on UNIX with patch. Changed IS_SAME -> IS_IDENTICAL
-
-1999-10-18 Andrei Zmievski <andrei@ispi.net>
-
- * zend_API.h: Be safe, use ().
-
-1999-10-15 Andrei Zmievski <andrei@ispi.net>
-
- * zend_operators.c
- zend_operators.h: unstatic'fy is_numeric_string()
-
- * zend_hash.c
- zend_hash.h
- zend_compile.c: *** empty log message ***
-
-1999-10-15 Andi Gutmans <andi@zend.com>
-
- * zend_operators.h: - Add convert_to_number_ex()
-
-1999-10-14 sascha <sascha@pb1.pair.com>
-
- * configure.in:
- Add "--disable-inline" for low-memory machines (be it limited
- RAM or virtual memory). It's also useful for Digital C where
- the C++ compiler thinks "inline" is an invalid specifier.
-
- * Makefile.am: Use sources from $(srcdir)
-
-1999-10-13 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: Do not use $< for anything but implicit rules.
-
-1999-10-13 Thies C. Arntzen <thies@thieso.net>
-
- * zend_list.c:
- (zend_fetch_resource) added warinig if resource is of wrong type
-
-1999-10-13 sascha <sascha@pb1.pair.com>
-
- * acconfig.h: Disable ZEND_EXTENSIONS_SUPPORT, if RTLD_NOW is not defined.
-
- Note that this part could be made platform independent by using
- libltdl (for Solaris, Linux, *BSD, HP-UX, Win16/32, BeOS).
-
-1999-10-12 Thies C. Arntzen <thies@thieso.net>
-
- * zend_list.c
- zend_list.h: new improved resource-API
-
-1999-10-12 sascha <sascha@pb1.pair.com>
-
- * acconfig.h:
- Use DL_LAZY for OpenBSD. This seems to be a compatibility flag which
- should be used for the 2nd parameter to dlopen.
-
- http://www.openbsd.org/cgi-bin/cvsweb/src/share/man/man3/dlfcn.3?rev=1.8
-
-1999-10-12 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - object.ptr was made NULL in DO_FCALL but wasn't restored. Right now I
- push it in DO_FCALL and at the end of do_fcall_common it always gets
- popped. We might be able to optimize it out.
-
-1999-10-11 Andrei Zmievski <andrei@ispi.net>
-
- * .cvsignore: *** empty log message ***
-
- * zend_hash.c
- zend_hash.h: Modified zend_hash() to accept a pointer to sort function.
-
-1999-10-11 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - No idea why this bug didn't exist before. But I'm too tired to think of it.
- During a regular do_fcall we need to set object.ptr to NULL and, thus,
- push it in the beginning and pop it in the end.
- I hope this fix more or less cuts it. I just want to sleep :)
-
-1999-10-10 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Didn't lower refcount when doing an internal function call linked to a regular object.
-
-1999-10-10 Thies C. Arntzen <thies@thieso.net>
-
- * .cvsignore: added some more autoconf/libtool stuff to be ignored
-
-1999-10-10 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Clean up a bit. Separate before the locking so that we can use SEPARATE_ZVAL
- macro.
-
-1999-10-10 sascha <sascha@pb1.pair.com>
-
- * build.mk: Add clean target which removes standard targets
-
- * build.mk: build.mk can be used to generate build tools. It is usually
- faster than buildconf, since it rebuilds only components, if
- it is necessary. To use it, run
-
- $ make -f build.mk
-
-1999-10-09 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Shouldn't be needed
-
- * zend_execute.c:
- - God damn this sucked. I hopefully fixed the problems with classes although
- we might need to clean stuff up a bit.
-
-1999-10-09 sascha <sascha@pb1.pair.com>
-
- * acconfig.h:
- Define RTLD_NOW to DL_NOW, if RTLD_NOW is not defined (for OpenBSD).
-
-1999-10-07 Thies C. Arntzen <thies@thieso.net>
-
- * zend_variables.c
- zend_variables.h: added zval_del_ref() function
-
-1999-10-07 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Reverse my patch
-
-1999-10-06 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fixed memory leak with this pointer. It was somtimes initialized with refcount
- of 2 instead of 1.
- - Also fixed a place where object.ptr_ptr is set to pointing to a zval* instead
- of zval**. I don't think this is ever used so we might be able to remove it
- altogether.
-
-1999-10-06 Thies C. Arntzen <thies@thieso.net>
-
- * zend_execute.c: fix for using resources as array indices
-
-1999-10-05 sascha <sascha@pb1.pair.com>
-
- * configure.in
- zend.h
- zend_globals.h: More portability stuff
-
- * configure.in: OSF/1 V4.0 wants -lcxx
-
- * zend_compile.h:
- This causes link problems with anything higher than -O0.
-
-1999-10-04 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: Add necessary rule.
-
- * Makefile.am
- acconfig.h
- acinclude.m4
- buildconf
- configure.in
- zend_config.in: Use libtool to build.
-
-1999-10-04 Thies C. Arntzen <thies@thieso.net>
-
- * zend_builtin_functions.c: use getParametersEx for all builtin functions
-
- * zend_API.c
- zend_API.h: added add_*_resource() and add_*_bool() functions
-
-1999-10-03 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h: - Hooray. This might actually work. (I hope)
-
-1999-10-03 sascha <sascha@pb1.pair.com>
-
- * configure.in: Make it executable.
-
-1999-10-02 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Another locking fix.
-
- * zend_execute.c: - Fixed locking problem when fetching string offsets
-
-1999-10-02 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- Fix the leak reported on the PHP 3 list (isset() on string offsets)
-
-1999-10-01 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_API.h
- zend_builtin_functions.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c
- zend_operators.h:
- - Move is_ref back to being an unsigned char and not a bit field.
-
- * zend.h
- zend_API.h
- zend_builtin_functions.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c: - Remove locking support completely
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- - For Andrei. Implement references in array() initializations
-
-1999-09-29 Zeev Suraski <zeev@zend.com>
-
- * zend_config.w32.h: *** empty log message ***
-
-1999-09-29 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: Fix leak in += with arrays
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- - Fix SEND_VAR problem after fetch'ing a variable and not knowing the fetch type
-
-1999-09-29 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.c
- zend_API.h: added add_property_resource
-
-1999-09-28 Andi Gutmans <andi@zend.com>
-
- * zend_compile.h
- zend_execute.c
- zend_execute_API.c:
- - Stop using the locking mechanism and start using refcount.
- Now we know when we need to free but we still need to support it
-
- * zend_execute.c
- zend_execute.h
- zend_execute_API.c:
- - First part of the patch which makes reads use ptr and not ptr_ptr.
-
-1999-09-28 sascha <sascha@pb1.pair.com>
-
- * acconfig.h
- configure.in
- zend-scanner.l: Provide alternative istdiostream.
-
- This has been tested with Sun WorkShop 4.2 C++ which does not
- contain class istdiostream.
-
-1999-09-26 sascha <sascha@pb1.pair.com>
-
- * Makefile.am
- configure.in: Actually allow to set CXXFLAGS
-
- * configure.in
- zend_config.in:
- Build communication channel and add checks for C++ library
-
-1999-09-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_execute.h
- zend_execute_API.c: - Changed Ts{}.var to Ts{}.var.ptr_ptr.
-
-1999-09-24 sascha <sascha@pb1.pair.com>
-
- * zend_operators.h: Add _ex API implementation for booleans.
-
-1999-09-24 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c
- zend_list.h: Exify the standardized resource stuff
-
-1999-09-23 Andi Gutmans <andi@zend.com>
-
- * zend_operators.c: - Fix bug #2364.
- I haven't checked all of the conversion macros yet but there's a change
- there are more such bugs there.
-
-1999-09-23 sascha <sascha@pb1.pair.com>
-
- * configure.in: Fix vpath build w/ thread-safe enabled on Unix.
-
-1999-09-22 Thies C. Arntzen <thies@thieso.net>
-
- * zend_builtin_functions.c:
- preliminary fix for each until andi & zeev clean up!
-
- * zend_list.c:
- if you pass NULL as the resource_type_name to zend_fetch_resource*&friends the functions will not print any warnings if the resource is not found!
-
-1999-09-21 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- - Fix problem where function parameter fetches were created too late.
-
-1999-09-21 Zeev Suraski <zeev@zend.com>
-
- * zend_builtin_functions.c: Add get_func_args()
-
- * zend_builtin_functions.c: *** empty log message ***
-
-1999-09-20 Andi Gutmans <andi@zend.com>
-
- * zend_builtin_functions.c:
- - Move some more Zend internal functions from PHP
-
- * zend-parser.y: - Next part of locking fix.
- $var = expr; and $var += expr; first create code for expr and later on
- for the fetch_w of $var.
-
- * zend_builtin_functions.c: - Newline for Sun's compiler
-
- * zend_API.h
- zend_builtin_functions.c: - Add some internal functions to Zend
-
- * zend_compile.c
- zend_compile.h
- zend_opcode.c:
- - First step in fixing locking problem. Array fetches are now always done last.
- Later on we will want to delay the write fetches even longer until after their
- resulting expression is parsed. The way it is now, will make it very easy
- to delay as long as we need.
-
- * zend_compile.c
- zend_compile.h:
- - Indirect references had all of the fetches by mistakenly backpatched.
- Actually all of the fetches are supposed to be read, except for the last
- one.
-
-1999-09-20 Zeev Suraski <zeev@zend.com>
-
- * libzend.dsp
- libzendts.dsp
- zend_builtin_functions.c: Added zend_num_args() and zend_get_arg()
-
- * Makefile.am
- zend.c
- zend_builtin_functions.c
- zend_builtin_functions.h:
- Add a file in which we can put Zend builtin functions
-
-1999-09-18 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Try to fix the leak Rasmus reported. It's pretty sucky code so I'm really
- not sure this fix is OK.I can't remember all of what we did there.
-
-1999-09-18 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c: Safer behavior
-
-1999-09-17 Thies C. Arntzen <thies@thieso.net>
-
- * zend_execute.c: make SUNs c89 happy
-
- * zend_execute_API.c: no // in the sources please
-
- * zend_globals_macros.h: added newline at end of file
-
-1999-09-17 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: - Fix bug #2318
-
-1999-09-16 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.h: Introduce convert_to_*_ex()
-
-1999-09-16 sascha <sascha@pb1.pair.com>
-
- * configure.in: this helps compiling on non-ANSI C compliant platforms
-
-1999-09-13 stig <stig@pb1.pair.com>
-
- * acconfig.h
- configure.in: Make sure HAVE_LIBDL gets defined.
- Disable more C++ tests when not configured for thread safety.
-
-1999-09-12 Zeev Suraski <zeev@zend.com>
-
- * zend.c: Make this class instanciatable
-
-1999-09-12 sascha <sascha@pb1.pair.com>
-
- * configure.in: check for c++ only, if thread safety is enabled
-
-1999-09-10 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Shut up a warning
-
-1999-09-09 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_globals.h
- zend_stack.c
- zend_stack.h: - Add foreach() freeing code.
- - Fix switch() freeing code to only free current function's switch expressions.
- - I have a feeling break expr; in a switch where expr > 1 leaks because it
- won't free all of the expressions. Fix is probably not trivial.
-
- * zend_operators.c:
- - Fix leak when decrementing strings which actually are longs.
-
-1999-09-08 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Fix for floating point array offsets. Same behaviour as in PHP 3.0. We
- casted to (long).
-
- * Makefile.am
- libzendts.dsp: - Add -b option to flex++
-
-1999-09-07 stig <stig@pb1.pair.com>
-
- * acconfig.h: define tests first, use after.
-
-1999-09-06 Andi Gutmans <andi@zend.com>
-
- * zend_config.w32.h: - Fix win32 compile
-
- * zend_config.w32.h: - Make zend compile again in Win32.
-
-1999-09-06 stig <stig@pb1.pair.com>
-
- * .cvsignore: ignore zend-scanner.cc
-
- * ZendCore.dep
- libzend.dsp
- libzendts.dsp: hand-patched some MSVC files
-
- * Makefile.am
- acconfig.h
- acinclude.m4
- config.unix.h
- config.w32.h
- configure.in
- zend-scanner.l
- zend.h
- zend_API.c
- zend_alloc.c
- zend_compile.h
- zend_config.w32.h
- zend_execute.c
- zend_hash.c
- zend_list.c
- zend_ptr_stack.c
- zend_sprintf.c: * header file cleanup
- * fixed --enable-thread-safety build for UNIX
-
- I don't have a Win32 environment available, could someone please try
- compiling on Win32 to see if I got all the header file stuff right there?
-
-1999-09-05 Andi Gutmans <andi@zend.com>
-
- * zend_globals_macros.h: - Oops
-
- * libzendts.dsp
- zend.c
- zend.h
- zend_alloc.c
- zend_alloc.h
- zend_globals.h: - Shift around header files.
-
-1999-09-04 Zeev Suraski <zeev@zend.com>
-
- * zend_list.c: Fix a stupid bug (from stefan@roehri.ch)
-
-1999-09-03 Zeev Suraski <zeev@zend.com>
-
- * zend_list.h: Damn, forgot to commit that
-
- * zend_list.c
- zend_list.h
- zend_modules.h: Add new API for resources
-
-1999-09-03 sascha <sascha@pb1.pair.com>
-
- * zend_modules.h: Add global startup/shutdown functions
-
-1999-09-03 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- Revert the IS_RESOURCE patch. It had some unintended behavior.
-
- * zend_variables.c: Let $GLOBALS actually work...
-
- * zend_operators.c:
- Release resources when converting to other types (fix Thies's reported problem)
-
-1999-09-02 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Use \0NameFilenameLineno as key instead of numeric index for runtime defined functions
-
-1999-08-28 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c
- zend.h
- zend_alloc.c
- zend_extensions.h
- zend_variables.c
- zend_variables.h: *** empty log message ***
-
- * zend.h
- zend_alloc.c
- zend_alloc.h
- zend_variables.c: Beef up debug macros
-
-1999-08-27 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c: Fix a crash bug in case of aborted execution
-
- * zend.h
- zend_alloc.c
- zend_alloc.h
- zend_execute_API.c
- zend_variables.c
- zend_variables.h: Better debug macros
-
-1999-08-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c: - Damn. It wasn't a correct fix. This should do it.
- When the zval ** are equal we don't want to assign_ref, in any other case
- I can think of we do want to assign_ref.
-
- * zend_execute_API.c: - Fix leak when global is used in the global scope.
-
- * zend_compile.c: - Fix when redefining classes at run-time.
-
-1999-08-25 sascha <sascha@pb1.pair.com>
-
- * zend.h: make it compile with gcc again
-
-1999-08-25 Andi Gutmans <andi@zend.com>
-
- * zend_hash.c
- zend_hash.h: - Add hash_apply_with_arguments()
-
- * zend-scanner.l: - More elegant fix for Win32 include_path
-
- * zend-scanner.l:
- - Temporary fix to allow Win32 MT safe version to use zend_fopen().
-
-1999-08-23 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fixed a specific memory leak linked to locking.
-
-1999-08-22 sascha <sascha@pb1.pair.com>
-
- * zend.h
- zend_globals.h: This changes makes it work on egcs 1.1.2/Alpha
-
- * configure.in
- zend.h: remove checks
-
-1999-08-20 Zeev Suraski <zeev@zend.com>
-
- * zend_constants.c
- zend_constants.h
- zend.c: Fix for Thies's UMR
-
-1999-08-19 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_opcode.c:
- - Make sure expr_list and echo_list are either empty or comma seperated
- expressions
-
-1999-08-18 Thies C. Arntzen <thies@thieso.net>
-
- * zend-scanner.l: on unix ZTS gets defined in zend_config.h
-
-1999-08-17 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c: Fix #2012
-
- * zend_execute.c: Fix #2070
-
-1999-08-17 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend.h: - Add some ZENDAPI's
-
-1999-08-15 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Oopsie
-
- * zend.h
- zend_compile.h
- zend_execute.c
- zend_globals.h: - Optimize the execute stack a bit.
-
-1999-08-14 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Fix several class issues
-
- * zend_compile.c
- zend_compile.h:
- Generate better warnings for class/function redefinitions
-
-1999-08-10 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_constants.c: - Got rid of the C++ comments.
-
-1999-08-09 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Thies's crash fix.
-
-1999-08-07 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h
- zend_execute.c
- zend_execute_API.c: Fix a few leaks
-
-1999-08-06 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c: Fix a bug in call_user_func_ex()
-
- * zend_API.h: Now that's an annoying bug.
-
- * zend_API.h
- zend_execute_API.c: Introduce call_user_func_ex()
-
- * zend_execute.c: *** empty log message ***
-
-1999-08-03 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_opcode.c:
- - Initialize extended value's and put the fetch_type in it's own variable
- name.
-
-1999-08-02 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h:
- Make set_compiled_filename() return a pointer to the allocated file name
-
-1999-07-31 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h: These aren't necessary
-
-1999-07-30 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h: Support symbols in any symbol table, not just the active one
-
-1999-07-30 Andi Gutmans <andi@zend.com>
-
- * zend_ptr_stack.c: - Damn that's more like it.
-
- * zend_ptr_stack.c: - Cut&paste crap
-
- * zend_execute.c
- zend_ptr_stack.c
- zend_ptr_stack.h:
- - Add ptr_stack_n_{push,pop} in order to speed up function calls a bit.
- There seems to be no reason for stack->top in the ptr_stack except for
- when realloc()'in the stack. I think I'll remove it.
-
-1999-07-30 Zeev Suraski <zeev@zend.com>
-
- * zend_API.h:
- * Setting variables in the global scope wasn't handling is_ref's properly
-
-1999-07-29 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h:
- - Fixed a leak when doing inheritance. The parent class name wasn't being freed.
- - Fixed a stack leak. Functions that had late argument binding were set up as
- INIT_FCALL_BY_NAME but were using DO_FCALL and not the corresponding
- DO_FCALL_BY_NAME.
-
-1999-07-28 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_hash.c: - Fixed various inheritance problems & Andrey's leak
-
-1999-07-27 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Inherit parent's constructor
-
- * zend_compile.c:
- Fix runtime inheritence (child functions/members should have higher precedence)
-
-1999-07-27 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Add missing lock
-
- * zend_execute.c: - Fix up the new operator a bit more.
-
-1999-07-27 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Set reference count and is_ref values for new objects
-
-1999-07-26 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- - Fixed a memory leak when using assignment-op operators with lvalue of type
- string (or array/object)
-
- * zend_compile.c: *** empty log message ***
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c:
- Fix a bug in inheritence from classes defined in include files, that are
- inherited from require()'d files
-
-1999-07-26 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Oops I erased this by mistake
-
- * zend_execute.c:
- - Should be a complete fix now. This break away code should maybe be made
- somewhat generic
-
- * zend_execute.c: - Temporary fix for "this". Have to fix it tomorrow.
-
- * zend_execute.c:
- - Fix compile error. Weird that Visual didn't catch this one.
-
- * zend-parser.y
- zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c: - Fix the new operator incompatibility.
- - I commented PHP_FUNCTION(strtotime) in datetime.c because it stopped
- win32 from compiling. This needs to be fixed!!!
- - Check out libzend to compile the tree now.
-
- * zend.h
- zend_execute.c: - new operator fixes
-
-1999-07-25 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c: - Commiting to branch newoperator.
- - To check it out do cvs checkout -rnewoperator libzend
-
-1999-07-24 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Fix that memory leak... nested function issue remains
-
- * zend_compile.c
- zend_stack.c
- zend_stack.h: Fix RETURN & SWITCH memory leak issue
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c:
- Thoroughly fix the SWITCH problem. No RETURN handling yet.
-
-1999-07-23 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h: Fix bug #1812
-
- * zend.h
- zend_operators.c:
- * Add an API macro users can use to ensure an array member can be modifed
- before they modify it.
- * Fix a bug and remove redundant code in convert_to_long() (booleans and
- resources weren't changing their types
-
-1999-07-22 Zeev Suraski <zeev@zend.com>
-
- * zend_constants.c: New constants
-
-1999-07-22 stig <stig@pb1.pair.com>
-
- * buildconf: identify ourselves
-
-1999-07-20 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Include alloca.h when need and available.
-
- * zend_compile.c
- zend_execute_API.c
- zend_list.c
- zend_operators.c: - Get rid of C++ comments
-
-1999-07-19 Zeev Suraski <zeev@zend.com>
-
- * config.unix.h
- config.w32.h
- zend-parser.y
- zend-scanner.h
- zend-scanner.l
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_constants.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_globals.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_modules.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_variables.c
- zend_variables.h: 0.91 update
-
-1999-07-19 Andi Gutmans <andi@zend.com>
-
- * zend.h
- zend_execute.c
- zend_extensions.h: * Fix Zend version
- * Fix a method call bug
-
- * LICENSE
- libzendts.dsp: License update
-
- * zend_errors.h: Make error codes PHP 3.0 compatible
-
-1999-07-18 Andi Gutmans <andi@zend.com>
-
- * zend_execute_API.c:
- - Should fix the memory leak when returning from the main scope.
-
-1999-07-17 Zeev Suraski <zeev@zend.com>
-
- * configure.in: Debug on by default
-
-1999-07-16 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c:
- Ignore T_PHP_TRACK_VARS in the parser (handled in the scanner)
-
- * config.unix.h
- config.w32.h
- zend-parser.y
- zend-scanner.h
- zend-scanner.l
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_alloc.h
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_constants.h
- zend_errors.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_globals.h
- zend_hash.c
- zend_hash.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_list.c
- zend_list.h
- zend_llist.c
- zend_llist.h
- zend_modules.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_sprintf.c
- zend_stack.c
- zend_stack.h
- zend_variables.c
- zend_variables.h: License update
-
-1999-07-15 Andi Gutmans <andi@zend.com>
-
- * zend.c: Change true/false back to 1/""
-
- * zend_execute.c: Fix a lock issue
-
-1999-07-15 sascha <sascha@pb1.pair.com>
-
- * zend_execute_API.c: disable zend_handle_sigsegv
-
-1999-07-14 Andi Gutmans <andi@zend.com>
-
- * libzendts.dsp
- zend.c: Fix thread unsafe constants startup
-
- * LICENSE
- zend.c
- zend_constants.c
- zend_constants.h: - License update
- - Fix multithreaded constants startup
-
- * zend_operators.c: - Fix for boolean convert to number
-
-1999-07-12 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c: - Fixed a purify warning
-
-1999-07-10 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c: Oh, that dumb bug.
-
-1999-07-10 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c
- zend_hash.c: Ok, so we do have to lock in there
-
- * zend.c
- zend_execute.c: Fix assignments of reference variables
-
-1999-07-10 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c: Woops, fix.
-
- * zend_execute.c
- zend_execute_API.c
- zend_globals.h: Put the garbage in the garbage bin
-
- * zend_alloc.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_variables.c: Get rid of AiCount completely
-
- * zend_execute.c: Final tweaks
-
- * zend_execute.c
- zend_hash.c: More locking work
-
-1999-07-09 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: *** empty log message ***
-
- * zend_execute.c: More stuff
-
- * zend-parser.y
- zend.h
- zend_API.c
- zend_API.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c
- zend_operators.c
- zend_variables.c: Step 4:
- Move to a 7-bit counter (not fully implemented yet)
-
- * zend_API.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c
- zend_variables.c: Phase 3:
- Use a single bit to mark IS_REF variables
-
- * zend-parser.y
- zend.h
- zend_API.c
- zend_API.h
- zend_compile.c
- zend_execute.c
- zend_execute_API.c
- zend_opcode.c
- zend_operators.c: Step 2:
- Rename is_ref to EA
-
- * zend.c
- zend_API.c
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_constants.h
- zend_execute_API.c
- zend_hash.c
- zend_hash.h
- zend_list.c
- zend_list.h
- zend_modules.h
- zend_opcode.c
- zend_variables.c
- zend_variables.h: Step 1 in nuking the garbage collector:
- - Change the hash destructor to return int
- - Don't kill the bucket on hash_destroy if the destructor returns 0
-
- * config.w32.h
- configure.in
- zend_alloc.c: *** empty log message ***
-
- * zend_alloc.c: Send a SIGSEGV instead of exiting, to trigger a core dump
-
- * zend_alloc.c
- zend_alloc.h
- zend_hash.c: * Support recoverable failure from erealloc()
- * Fix the shutdown code on an unrecoverable erealloc() failure
-
- * zend_execute_API.c: Fix the mess in SIGSEGV handling, hopefully
-
-1999-07-08 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h
- zend_compile.c:
- Support definition of classes that are derived from classes that are defined in runtime
-
-1999-07-06 sascha <sascha@pb1.pair.com>
-
- * zend.h: enable it, until we find a better way
-
-1999-07-05 sascha <sascha@pb1.pair.com>
-
- * zend.h: make Solaris gcc happy
-
- * configure.in
- zend.h: use void * instead of long for 64-bit test
-
-1999-07-05 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h: added RETVAL_RESOURCE and RETURN_RESOURCE
-
-1999-07-04 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- Make convert_to_string() regard false as "" instead of "0"
-
-1999-07-03 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: don't wipe files for distributions
-
- * configure.in
- zend.h:
- checking for ints won't work, since they are 32 bit on both platforms
-
-1999-07-03 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Support isset()/empty() for string offsets
-
- * zend-scanner.l: Fix a crash
-
-1999-07-03 sascha <sascha@pb1.pair.com>
-
- * configure.in: add usual rhapsody hack
-
- * config.unix.h: missing DL_HANDLE broke build
-
- * zend_extensions.c: typo
-
-1999-07-02 sascha <sascha@pb1.pair.com>
-
- * acconfig.h
- configure.in
- zend.h: workaround for 64-bit platforms
-
-1999-07-02 Zeev Suraski <zeev@zend.com>
-
- * acconfig.h
- configure.in
- zend_globals.h: define zend_bool
-
-1999-06-30 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y: Make require accept any parameter
-
-1999-06-26 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.h
- zend_operators.c
- zend_alloc.c:
- * Make the memory leak reporting code much better with repeats
- * Remove useless variables
-
-1999-06-22 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Fix Thies's bug report
-
- * zend_alloc.c
- zend_compile.c
- zend_operators.c:
- * Fix concatenation of arrays (it was PHP 3.0 style, copying zval's instead
- of zval *, and it wasn't using reference counting)
- * Fix a memory leak in static array()'s with textual indices
-
-1999-06-19 Zeev Suraski <zeev@zend.com>
-
- * zend.c: *** empty log message ***
-
- * zend.h
- zend_extensions.h:
- Add a standard get_ini_entry() to interface between Zend and the outside world
-
- * configure.in: *** empty log message ***
-
-1999-06-16 stig <stig@pb1.pair.com>
-
- * zend_modules.h:
- added INIT_FUNC_ARGS_PASSTHRU and SHUTDOWN_FUNC_ARGS_PASSTHRU
-
-1999-06-15 stig <stig@pb1.pair.com>
-
- * zend_operators.c
- zend_operators.h: * added zend_binary_strcasecmp()
-
-1999-06-12 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y:
- We can't quite go with expr there (shift/reduce conflict), go with scalar.
-
- * zend-parser.y: require() improvement as per Andi's suggestion
-
-1999-06-11 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- Make the concatenation operator use make_printable as well
-
- * zend-scanner.l: Don't take failing on an include file so badly
-
- * zend-scanner.l: Support <?=
-
- * zend_compile.c: E_ERROR -> E_COMPILE_ERROR in the compiler
-
- * zend_compile.c: Two fixes:
- * The error generated by a failed class inheritence wasn't properly
- displaying the file in which he error occured.
- * Inheritence didn't work if the parent class had uppercase letters in it.
-
- * zend-parser.y
- zend-scanner.l
- zend_execute.c: * Use to_string() instead of __print()
- * Support boolean casts ((bool) and (boolean))
-
- * zend.c: Change __print into to_string()
-
- * zend.c
- zend.h
- zend_execute.c
- zend_execute_API.c:
- * Make the output handling of variables much, much cooler.
- Uses zend_make_printable_zval() instead of convert_to_string() now:
-
- $foo = true;
- print "\$foo is $foo";
- will now print
- $foo is true
- (instead of "$foo is 1", earlier).
-
- Also, with objects, it automatically tries to call __print() and use it as a printing
- function.
-
- For example:
-
- class foo {
- function __print() { return "Foo Object"; }
- };
-
- $foo = new foo;
- print $foo;
-
- will print "Foo Object".
-
-1999-06-10 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Now THAT's an annoying bug.
-
-1999-06-09 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c: Fix
-
- * zend_API.c
- zend_execute.c:
- * Fix cases where you assign an array element to the parent array (the array was
- being erased before the assignment, so the element was being smashed).
-
- * zend_execute.c
- zend_execute_API.c: * Fix foreach() that receives a non array argument
- * Clean up some C++ comments
-
-1999-06-09 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_operators.c: - Fix the static array() initializing
-
-1999-06-08 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c: Replace error messages
-
-1999-06-08 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c: * Fix a by-name call/method call bug
- * Clean and optimize the whole function call process
-
-1999-06-07 Zeev Suraski <zeev@zend.com>
-
- * zend_hash.c
- zend_hash.h: Add zend_hash_get_current_key_type()
-
-1999-06-06 Andi Gutmans <andi@zend.com>
-
- * zend_compile.c:
- Work around a compiler bug - mark variables that are sent to functions that aren't yet
- defined as FETCH_W (because they might end up being sent by reference)
-
-1999-06-05 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_compile.c
- zend_compile.h: * Centralized shutdown
- * Change shutdown order again
-
- * zend_compile.c:
- Call the request_shutdown on modules before destroying symbol tables, so that
- the session module can be implemented
-
- * zend-scanner.l
- zend_compile.c
- zend_execute.c:
- - Fixed Karl's bug report. It's not really a thorough fix, we really need to rethink the INIT_FCALL/DO_FCALL issue.
- - Fixed numerous AiCount problems
-
-1999-06-04 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_opcode.c: New $GLOBALS init
-
- * zend_execute_API.c:
- Fix that GLOBALS leak. We were explicitly adding GLOBALS to the main symbol table,
- but there's no reason to do it (INIT_GLOBALS takes care of it if necessary.)
-
- * zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_list.c
- zend_list.h
- zend_opcode.c
- zend_operators.c: Minor updates (mostly __declspec() stuff)
-
-1999-06-04 Thies C. Arntzen <thies@thieso.net>
-
- * zend_API.h: added is_ref=0 and refcount=1 to SET_VAR_* macros
-
-1999-06-03 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y: T_BAD_CHARACTER is actually a string.
-
-1999-06-03 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l
- zend_execute.c:
- - We weren't counting newlines in heredocs. The only place which is still questionable
- is when there's a \ followed by a newline but it seems we have a parse error in this
- case anyways.
- - Fixed the alloca() macros so that the alloca() #define in win32 mode won't clash
- with the real win32 alloca().
-
-1999-06-01 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - Make execute() use less stack in thread-safe win32 due to Microsoft's shitty 256kb stack.
-
-1999-05-31 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_alloc.c: *** empty log message ***
-
-1999-05-31 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l
- zend_compile.c
- zend_execute.c
- zend_execute_API.c: Fixes
-
-1999-05-30 sascha <sascha@pb1.pair.com>
-
- * zend_alloc.c
- zend_compile.h
- zend_execute_API.c
- zend_indent.c
- zend_opcode.c: * fix some casts
- * introduce unary_op_type - cleaner than casting data voids to function ptrs
-
-1999-05-29 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c:
- That got fucked up when we went back to using uninitialized_zval
-
-1999-05-29 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: another VPATH related change
-
-1999-05-29 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y: Fix a bug
-
- * zend_hash.c
- zend_hash.h
- zend_operators.c: Support overwrite mode in zend_hash_merge()
-
-1999-05-29 sascha <sascha@pb1.pair.com>
-
- * Makefile.am: - clean is not called from automake. use CLEANFILES instead
- - allow VPATH compilation
-
-1999-05-29 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Correct fix
-
- * zend_execute_API.c: *** empty log message ***
-
- * zend_execute.c: Fix a leak
-
-1999-05-28 Zeev Suraski <zeev@zend.com>
-
- * zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute_API.c: * Support getThis() for internal functions.
- * Fix 'new object or die' and AiCount issue thoroughly (earlier fix didn't
- work with the optimizer).
- * Add new macros for standardized definition of classes.
- * Only report AiCount problems if shutdown was not silent.
-
-1999-05-27 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Fix the AiCount issue with objects
-
- * zend_API.h: Moved all #define's for SET_ and RETURN_ to zend_API.h
-
-1999-05-25 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c:
- Avoid crashing if an error occurs before we open the first file.
-
-1999-05-24 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: The last fix was wrong
-
- * zend_operators.c: Another operators fix
-
-1999-05-23 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c:
- boolean comparison didn't work with smaller-than and greater-than, something that
- fucked up berber's site a bit. fixed.
-
-1999-05-22 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c:
- Sigh, another leak bites the dust. FREE_OP missing in case of a SEND_VAR.
-
- * zend-parser.y: I'm on a roll. Fix a nasty yet stupid AiCount bug
-
- * zend_alloc.c: Warn about AiCount not zeroing out
-
- * zend-parser.y
- zend-scanner.h
- zend.h
- zend_alloc.c
- zend_alloc.h
- zend_compile.c
- zend_compile.h
- zend_constants.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_extensions.h
- zend_highlight.h
- zend_list.h
- zend_llist.h
- zend_ptr_stack.h
- zend_stack.h:
- * Add struct name to all typedef's so that they can be debugged with MSVC
- * Fix an AiCount bug - list(...) = $var was using $var multiple times, and thus
- causing AiCount to be decreased multiple times even though it was increased only
- once for $var. Mark all FETCH_DIM's so that they won't decrease AiCount, and only
- decrease AiCount on the last FETCH_DIM.
- * Fix a stupid bug - forgot to pass CLS_C to some compiler function. For some reason
- MSVC doesn't report these :I
-
- * zend.h
- zend_alloc.c
- zend_execute_API.c:
- Give more information and save log lines in memory leak reports
-
- * zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_globals.h
- zend_llist.c
- zend_llist.h: Avoid leaking fd's in case of failures
-
- * zend-scanner.l: more fixes
-
-1999-05-21 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: That wasn't supposed to slip in
-
- * zend-scanner.l: * Properly handle failed file opens in C++
- * Properly handle failed require()'s within libzend
-
- * zend-scanner.l: * Fix the comments issue. yymore() worked like a charm.
- * Change all flex states to be prefixed with ST_
-
-1999-05-20 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h
- zend_execute.c: Optimize allocations into uninitialized_zval assignments
-
-1999-05-20 Andi Gutmans <andi@zend.com>
-
- * config.w32.h
- libzend.dsp
- libzendts.dsp
- zend_compile.c
- zend_compile.h: - Updates we did today
-
- * zend_compile.c: - Fix a small problem with class decelerations.
-
- * zend-scanner.l: -Open curly braces fix?
-
-1999-05-15 Zeev Suraski <zeev@zend.com>
-
- * zend.c
- zend.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_hash.c
- zend-parser.y:
- * Fix all hash checks that checked Bucket.arKey for NULL, when it was changed
- to char[1], these checks should have been changed to Bucket.nKeyLength==0
- * Support runtime declaration of functions. I ended up changing the grammar
- to catch top level functions vs. nested functions. The reason is simple -
- if we don't have functions properly declared at compile-time, function calls
- cannot be resolved at compile time, and have to be resolved at runtime, which
- ends up being much much slower (without the optimizer, that is).
- It's no biggy though, the grammar change isn't that bad.
-
-1999-05-14 Zeev Suraski <zeev@zend.com>
-
- * configure.in
- zend-scanner.l:
- If a require() dies, we must bail out (since it corrupts an existing op_array
-
- * zend-scanner.l: Fix a bug
-
-1999-05-14 stig <stig@pb1.pair.com>
-
- * Makefile.am: don't install Zend on the system
-
-1999-05-14 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l:
- Add \012 and \xff missing support to constant quoted string
-
-1999-05-12 Zeev Suraski <zeev@zend.com>
-
- * zend.h: *** empty log message ***
-
-1999-05-12 stig <stig@pb1.pair.com>
-
- * Makefile.am: install libzend.a and header files on "make install"
-
- * acconfig.h
- configure.in: add --enable-thread-safety option
-
-1999-05-12 Zeev Suraski <zeev@zend.com>
-
- * zend_llist.c
- zend_llist.h: Added prepend to llist
-
-1999-05-11 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend.c: Fixes:
- * Avoid closing stdin (I could have sworn I've committed that already)
- * unclean_shutdown patches
-
- * zend_alloc.c: Easier Win32 debug code
-
- * zend-scanner.l
- zend_compile.c
- zend_globals.h
- zend_highlight.c:
- * Fix a bug that occured in case of parse errors. We need to restore the lexical state
- even if the compilation failed.
-
-1999-05-10 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.h
- zend-scanner.l
- zend.c
- zend_alloc.c
- zend_compile.h:
- Weed out all BoundsChecker-found bugs (including a serious file descriptor leak
- in the C++ scanner)
-
-1999-05-09 Zeev Suraski <zeev@zend.com>
-
- * zend_modules.h: Change argument name
-
- * zend.c
- zend_API.c
- zend_API.h
- zend_modules.h: Almost forgot to commit those
-
-1999-05-06 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: Ok, I tested it now. It works very nicely!
-
-1999-05-05 Andi Gutmans <andi@zend.com>
-
- * zend_llist.c
- zend_llist.h: llist improvements
-
-1999-05-02 Andi Gutmans <andi@zend.com>
-
- * zend.c
- zend_compile.h: - Don't support interactive mode when thread safe.
-
-1999-05-01 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Several operator fixes. Should fix the MySQL problem.
-
-1999-04-30 Andi Gutmans <andi@zend.com>
-
- * zend_opcode.c: - Free refcount when destroying the last class reference.
-
- * zend-parser.y: - Missed one place
-
- * zend-parser.y: - First try at fixing $a->foo[] syntax.
-
- * zend-scanner.l:
- - Move back to yyless(). I haven't tested it yet because it's taking too long
- to compile and I have to disconnect
-
-1999-04-30 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend-scanner.l:
- Fix Boris's problem (in my never ending struggle to show I never mean what I say
- when I say something's not gonna happen :)
-
- * zend-scanner.l
- zend_compile.c:
- * Fix a problem with constant quoted strings, that was causing Thies's problem
- * Remove a development-time printf
-
-1999-04-29 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l: - No reason to handle newlines here.
-
-1999-04-28 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l: Make the C++ scanner support interactive input
-
-1999-04-27 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l
- zend_compile.h
- zend_execute_API.c
- zend_extensions.c
- zend_extensions.h
- zend_opcode.c: * Fix debugger+interactive mode bug
- * Recognize whether an extension is with debug information or not
-
-1999-04-26 Zeev Suraski <zeev@zend.com>
-
- * libzendts.dsp: fix
-
- * config.w32.h
- libzend.dsp
- libzendts.dsp
- zend-scanner.l
- zend.c
- zend_alloc.c
- zend_compile.h
- zend_globals.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_opcode.c
- zend_sprintf.c: Various thread safety fixes and DLL updates
-
-1999-04-26 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l
- zend.c
- zend_alloc.c
- zend_globals.h: -More commits
-
-1999-04-24 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c: Another small fix
-
- * libzendts.dsp: dsp update
-
- * zend.c
- zend_globals.h: Thread safety fixes
-
- * zend_list.c: Remove redundant includes
-
-1999-04-24 zeevread <zeevread@pb1.pair.com>
-
- * zend-scanner.l: g++ compile fix
-
-1999-04-24 Zeev Suraski <zeev@zend.com>
-
- * Makefile.am
- zend-scanner.l: *** empty log message ***
-
- * zend_API.c
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_opcode.c
- zend-parser.y
- zend-scanner.l: Cleanups, remove old ts code
-
-1999-04-23 Zeev Suraski <zeev@zend.com>
-
- * zend_operators.c: Arithmetics bug fix
-
- * zend-scanner.h
- zend-scanner.l: Support eval() and highlight_string() in the C++ scanner
-
-1999-04-23 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l:
- - Use yyless() instead of unput() where possible. I'll erase the commented
- out code in a day or so.
-
-1999-04-23 Zeev Suraski <zeev@zend.com>
-
- * FlexLexer.h
- flex.skl
- zend-scanner.h
- zend-scanner.l
- zend.h
- zend_alloc.c
- zend_alloc.h
- zend_compile.h
- zend_globals.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_operators.h
- zend_variables.h: Ok, call me crazy, because I probably am.
- Thread safe version now uses a C++ scanner object. Works fully.
-
-1999-04-22 Zeev Suraski <zeev@zend.com>
-
- * acconfig.h
- zend-parser.y
- zend-scanner.l
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_globals.h
- zend_highlight.c
- zend_indent.c
- zend_opcode.c: Make token names uniform, they all begin with T_ now.
-
-1999-04-21 stig <stig@pb1.pair.com>
-
- * buildconf: state which aclocal.m4 and configure files are created
-
- * Makefile.am:
- zend-parser.o and zend-scanner.o were included twice in libzend.a
-
-1999-04-21 Zeev Suraski <zeev@zend.com>
-
- * FlexLexer.h
- flex.skl
- libzendts.dsp
- zend_API.c
- zend_API.h
- zend_globals.h:
- * Change the thread safe project to create a C++ scanner.
- * Add in a slightly modified skeleton file (only a couple of #if's for #include's
- that we dont have in Windows)
-
- It does NOT compile or work yet :)
-
- * zend_list.h: Fix
-
- * zend.c
- zend_compile.c
- zend_constants.c
- zend_constants.h
- zend_list.c
- zend_list.h:
- Thread safety patch. It works now with 'just in time' resource initialization!
-
- * libzend.dsp
- libzendts.dsp
- zend_globals.h: Thread-safe project
-
-1999-04-21 stig <stig@pb1.pair.com>
-
- * buildconf: move automake back to before autoconf
-
- * buildconf:
- autoheader must be called after autoconf, automake after autoheader
-
- * zend_config.h.in: think before one commits
-
- * zend_config.h.in: doh. cvs appears to ignore .in files by default
-
-1999-04-21 Zeev Suraski <zeev@zend.com>
-
- * zend-parser.y
- zend-scanner.l
- zend.c
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_compile.c
- zend_compile.h
- zend_constants.c
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h
- zend_opcode.c:
- Thread safety patch. We're still not quite there but it compiles again, and
- more logic has been implemented.
-
-1999-04-20 stig <stig@pb1.pair.com>
-
- * .cvsignore
- Makefile.am
- Makefile.in
- aclocal.m4
- buildconf: Makefile.in and aclocal.m4 are generated
- added buildconf script
-
-1999-04-19 Zeev Suraski <zeev@zend.com>
-
- * zend_extensions.c
- zend_extensions.h:
- Return a success value from the startup function, so we can unload immediately
- if it fails.
-
-1999-04-19 stig <stig@pb1.pair.com>
-
- * .cvsignore
- Makefile.am
- Makefile.in
- acconfig.h
- acinclude.m4
- aclocal.m4
- config.h.in
- configure.in
- zend.h: convert to automake
-
-1999-04-19 Andi Gutmans <andi@zend.com>
-
- * zend_API.c
- zend_API.h: Add a couple of ZEND_API's
-
- * config.w32.h
- zend-parser.y
- zend_compile.c
- zend_execute.c: Support =unset as arguments
-
-1999-04-19 stig <stig@pb1.pair.com>
-
- * acconfig.h
- config.h.in
- configure.in: removed -lnsl and -lsocket checks from zend
-
-1999-04-18 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: AiCount needs to be decreased here
-
- * configure.in
- zend-scanner.l
- zend.c
- zend.h
- zend_API.c
- zend_API.h
- zend_alloc.c
- zend_compile.c
- zend_extensions.c
- zend_extensions.h
- zend_globals.h
- zend_llist.c
- zend_modules.h
- zend_opcode.c: Whatnot:
- * updated alloc_persist to use critical sections
- * changed extension shutdown to two-phase
- * updated dependencies
- * PR support (don't remember if there was any really)
-
-1999-04-15 Andi Gutmans <andi@zend.com>
-
- * zend_execute.c:
- - one more place which seems to have needed fixing. I don't have time to look
- more into it. I hope we don't have anymore places which need fixing.
-
- * zend_compile.c:
- - Should fix the pass by reference problem. This happened because we moved
- start from arg 1 now and not arg 0. There might be more places which need fixing
- like in the executor but the bug seems OK now.
-
-1999-04-14 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.h: Compile fix
-
-1999-04-14 Andi Gutmans <andi@zend.com>
-
- * config.w32.h
- libzend.dsp
- zend-scanner.l
- zend_API.c
- zend_API.h
- zend_compile.c
- zend_compile.h
- zend_opcode.c: -Tiny patches
-
-1999-04-13 Zeev Suraski <zeev@zend.com>
-
- * zend_execute.c: Better detection
-
- * zend_execute.c:
- Move Ai stuff before get_zval_*(), like Andi suggested. Fixes Sascha's huge
- memory leak
-
-1999-04-13 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.c
- zend_execute.c
- zend_execute_API.c: - Fix various memory leaks.
-
- * zend_execute.c: Refcount bugfix
-
- * libzend.dsp
- zend_API.c
- zend_execute_API.c
- zend_ptr_stack.c: * Optimize argument_stack top lookup
- * Fix a nasty bug in zend_ptr_stack_clean()
-
-1999-04-12 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c
- zend_globals.h: Remove unnecessary stack
-
- * zend_API.c: off by one
-
- * zend_execute.c: Minor optimization
-
- * zend_API.c: Make functions that don't take arguments somewhat happier:)
-
- * zend_execute.c:
- This should take care of "this" for user-defined functions. It wasn't yet working
- for built-in functions anyway, this one is coming soon.
-
- * zend_compile.c
- zend_execute_API.c:
- Destroy the resource list after destroying the symbol table, otherwise the
- auto-destructor for resources are run when the resource list is no longer valid
-
- * zend-parser.y
- zend.h
- zend_API.c
- zend_API.h
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_execute.h
- zend_execute_API.c
- zend_globals.h
- zend_ptr_stack.c:
- This patch is a go. Not fully optimized yet, but working properly.
- Prepatch tagged as BEFORE_STACK_PATCH.
-
- * zend_compile.c
- zend_execute.c: Minor fixes:
- missing zval_copy_ctor()
- messed up AiCount fix
-
-1999-04-10 Zeev Suraski <zeev@zend.com>
-
- * zend_alloc.c
- zend_alloc.h: Allow runtime setting of the memory limit
-
- * zend_alloc.c
- zend_alloc.h
- zend_globals.h: Get rid of php3_ini in Zend
-
- * zend.c
- zend.h:
- We need to initialize the utility values after we initialize the INI file, which in
- turn, is after we initialize Zend. Set the utility values separately from Zend's
- initialization
-
-1999-04-09 Andi Gutmans <andi@zend.com>
-
- * zend-scanner.l: - Changed here-docs to <<< followed by whitespace.
-
-1999-04-09 stig <stig@pb1.pair.com>
-
- * .cvsignore: ignore file
-
-1999-04-09 Andi Gutmans <andi@zend.com>
-
- * zend-parser.y
- zend_compile.h:
- - I guess print $GLOBALS and print "$GLOBALS" should yield the same result
- so I returned the one in encaps_var.
- - Made INITAL_OP_ARRAY_SIZE smaller (64? can't remeber). I don't think the
- erealloc()'s during compile time are such a biggy, we might make it even
- smaller. We can have a configure time option as to it's size.
-
- * zend-parser.y:
- - Support $GLOBALS in cvar's. Now list(..) = each($GLOBALS) will work.
- - Remove support of $GLOBALS in enacapsed strings. print "$GLOBALS" isn't
- supposed to work in any case.
-
-1999-04-09 Zeev Suraski <zeev@zend.com>
-
- * zend-scanner.l:
- Honor a semicolon on the same line as an ending token of a heredoc
-
- * zend_compile.c: Prevent class redeclarations
-
-1999-04-08 Zeev Suraski <zeev@zend.com>
-
- * zend_API.c
- zend_modules.h: * Add arguments to shutdown functions
- * Remove traces of php_ini stuff
-
- * zend-parser.y: "Our favourite mistake"
-
- * zend-parser.y
- zend_compile.c
- zend_compile.h
- zend_execute.c
- zend_opcode.c: $GLOBALS support
-
-1999-04-08 Andi Gutmans <andi@zend.com>
-
- * ZEND_CHANGES: foreach() syntax has changed
-
-1999-04-08 Zeev Suraski <zeev@zend.com>
-
- * zend_compile.c
- zend_execute.c: Fix static assignment
-
-1999-04-07 Zeev Suraski <zeev@zend.com>
-
- * zend_execute_API.c: Remove an unused variable
-
- * libzend.dsp: That's better.
-
- * libzend.dsp: We didn't save the .dsp back then...
-
- * ZendCore.dsp
- ZendCore.dsw
- ZendCore.mak
- diffs
- libzend.dsp: Cleanups: ZendCore->libzend
-
-1999-04-07 Rasmus Lerdorf <rasmus@php.net>
-
- * zend.c: *** empty log message ***
-
-1999-04-07 Andi Gutmans <andi@zend.com>
-
- * LICENSE
- Makefile.in
- ZEND_CHANGES
- configure.in
- zend-parser.y
- zend-scanner.h
- zend-scanner.l
- zend.h
- zend_API.c
- zend_API.h
- zend_compile.h
- zend_errors.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_hash.c
- zend_hash.h
- zend_list.c
- zend_list.h
- zend_llist.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_stack.c
- zend_stack.h
- zend_variables.c
- zend_variables.h: New file.
-
- * LICENSE
- Makefile.in
- ZEND_CHANGES
- configure.in
- zend-parser.y
- zend-scanner.h
- zend-scanner.l
- zend.h
- zend_API.c
- zend_API.h
- zend_compile.h
- zend_errors.h
- zend_execute.c
- zend_execute_API.c
- zend_globals.h
- zend_hash.c
- zend_hash.h
- zend_list.c
- zend_list.h
- zend_llist.h
- zend_opcode.c
- zend_operators.c
- zend_operators.h
- zend_ptr_stack.c
- zend_ptr_stack.h
- zend_stack.c
- zend_stack.h
- zend_variables.c
- zend_variables.h: Zend Library
-
- * ZendCore.dep
- ZendCore.dsp
- ZendCore.dsw
- ZendCore.mak
- acconfig.h
- aclocal.m4
- config.h.in
- config.unix.h
- config.w32.h
- diffs
- zend.c
- zend.ico
- zend_alloc.c
- zend_alloc.h
- zend_compile.c
- zend_constants.c
- zend_constants.h
- zend_execute.h
- zend_extensions.c
- zend_extensions.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_llist.c
- zend_modules.h
- zend_sprintf.c: New file.
-
- * ZendCore.dep
- ZendCore.dsp
- ZendCore.dsw
- ZendCore.mak
- acconfig.h
- aclocal.m4
- config.h.in
- config.unix.h
- config.w32.h
- diffs
- zend.c
- zend.ico
- zend_alloc.c
- zend_alloc.h
- zend_compile.c
- zend_constants.c
- zend_constants.h
- zend_execute.h
- zend_extensions.c
- zend_extensions.h
- zend_highlight.c
- zend_highlight.h
- zend_indent.c
- zend_indent.h
- zend_llist.c
- zend_modules.h
- zend_sprintf.c: Zend Library
-
diff --git a/Zend/FlexLexer.h b/Zend/FlexLexer.h
deleted file mode 100644
index fd65258570..0000000000
--- a/Zend/FlexLexer.h
+++ /dev/null
@@ -1,186 +0,0 @@
-// $Header$
-
-// FlexLexer.h -- define interfaces for lexical analyzer classes generated
-// by flex
-
-// Copyright (c) 1993 The Regents of the University of California.
-// All rights reserved.
-//
-// This code is derived from software contributed to Berkeley by
-// Kent Williams and Tom Epperly.
-//
-// Redistribution and use in source and binary forms with or without
-// modification are permitted provided that: (1) source distributions retain
-// this entire copyright notice and comment, and (2) distributions including
-// binaries display the following acknowledgement: ``This product includes
-// software developed by the University of California, Berkeley and its
-// contributors'' in the documentation or other materials provided with the
-// distribution and in all advertising materials mentioning features or use
-// of this software. Neither the name of the University nor the names of
-// its contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-
-// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
-// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-// This file defines FlexLexer, an abstract class which specifies the
-// external interface provided to flex C++ lexer objects, and yyFlexLexer,
-// which defines a particular lexer class.
-//
-// If you want to create multiple lexer classes, you use the -P flag
-// to rename each yyFlexLexer to some other xxFlexLexer. You then
-// include <FlexLexer.h> in your other sources once per lexer class:
-//
-// #undef yyFlexLexer
-// #define yyFlexLexer xxFlexLexer
-// #include <FlexLexer.h>
-//
-// #undef yyFlexLexer
-// #define yyFlexLexer zzFlexLexer
-// #include <FlexLexer.h>
-// ...
-
-#ifndef FLEXLEXER_H
-// Never included before - need to define base class.
-#define FLEXLEXER_H
-#include <iostream.h>
-
-extern "C++" {
-
-struct yy_buffer_state;
-typedef int yy_state_type;
-
-class FlexLexer {
-public:
- virtual ~FlexLexer() { }
-
- const char* YYText() { return yytext; }
- int YYLeng() { return yyleng; }
-
- virtual void
- yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
- virtual struct yy_buffer_state*
- yy_create_buffer( istream* s, int size ) = 0;
- virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
- virtual void yyrestart( istream* s ) = 0;
-
- virtual int yylex() = 0;
-
- // Call yylex with new input/output sources.
- int yylex( istream* new_in, ostream* new_out = 0 )
- {
- switch_streams( new_in, new_out );
- return yylex();
- }
-
- // Switch to new input/output streams. A nil stream pointer
- // indicates "keep the current one".
- virtual void switch_streams( istream* new_in = 0,
- ostream* new_out = 0 ) = 0;
-
- int lineno() const { return yylineno; }
-
- int debug() const { return yy_flex_debug; }
- void set_debug( int flag ) { yy_flex_debug = flag; }
-
-protected:
- char* yytext;
- int yyleng;
- int yylineno; // only maintained if you use %option yylineno
- int yy_flex_debug; // only has effect with -d or "%option debug"
-};
-
-}
-#endif
-
-#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
-// Either this is the first time through (yyFlexLexerOnce not defined),
-// or this is a repeated include to define a different flavor of
-// yyFlexLexer, as discussed in the flex man page.
-#define yyFlexLexerOnce
-
-class yyFlexLexer : public FlexLexer {
-public:
- // arg_yyin and arg_yyout default to the cin and cout, but we
- // only make that assignment when initializing in yylex().
- yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 );
-
- virtual ~yyFlexLexer();
-
- void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
- struct yy_buffer_state* yy_create_buffer( istream* s, int size );
- void yy_delete_buffer( struct yy_buffer_state* b );
- void yyrestart( istream* s );
-
- virtual int yylex();
- virtual void switch_streams( istream* new_in, ostream* new_out );
-
-protected:
- virtual int LexerInput( char* buf, int max_size );
- virtual void LexerOutput( const char* buf, int size );
- virtual void LexerError( const char* msg );
-
- void yyunput( int c, char* buf_ptr );
- int yyinput();
-
- void yy_load_buffer_state();
- void yy_init_buffer( struct yy_buffer_state* b, istream* s );
- void yy_flush_buffer( struct yy_buffer_state* b );
-
- int yy_start_stack_ptr;
- int yy_start_stack_depth;
- int* yy_start_stack;
-
- void yy_push_state( int new_state );
- void yy_pop_state();
- int yy_top_state();
-
- yy_state_type yy_get_previous_state();
- yy_state_type yy_try_NUL_trans( yy_state_type current_state );
- int yy_get_next_buffer();
-
- istream* yyin; // input source for default LexerInput
- ostream* yyout; // output sink for default LexerOutput
-
- struct yy_buffer_state* yy_current_buffer;
-
- // yy_hold_char holds the character lost when yytext is formed.
- char yy_hold_char;
-
- // Number of characters read into yy_ch_buf.
- int yy_n_chars;
-
- // Points to current character in buffer.
- char* yy_c_buf_p;
-
- int yy_init; // whether we need to initialize
- int yy_start; // start state number
-
- // Flag which is used to allow yywrap()'s to do buffer switches
- // instead of setting up a fresh yyin. A bit of a hack ...
- int yy_did_buffer_switch_on_eof;
-
- // The following are not always needed, but may be depending
- // on use of certain flex features (like REJECT or yymore()).
-
- yy_state_type yy_last_accepting_state;
- char* yy_last_accepting_cpos;
-
- yy_state_type* yy_state_buf;
- yy_state_type* yy_state_ptr;
-
- char* yy_full_match;
- int* yy_full_state;
- int yy_full_lp;
-
- int yy_lp;
- int yy_looking_for_trail_begin;
-
- int yy_more_flag;
- int yy_more_len;
- int yy_more_offset;
- int yy_prev_more_offset;
-};
-
-#endif
diff --git a/Zend/LICENSE b/Zend/LICENSE
deleted file mode 100644
index 5837d7cf3c..0000000000
--- a/Zend/LICENSE
+++ /dev/null
@@ -1,56 +0,0 @@
---------------------------------------------------------------------
- The Zend Engine License, version 2.00
-Copyright (c) 1999-2002 Zend Technologies Ltd. All rights reserved.
---------------------------------------------------------------------
-
-Redistribution and use in source and binary forms, with or without
-modification, is permitted provided that the following conditions
-are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
- 3. The names "Zend" and "Zend Engine" must not be used to endorse
- or promote products derived from this software without prior
- permission from Zend Technologies Ltd. For written permission,
- please contact license@zend.com.
-
- 4. Zend Technologies Ltd. may publish revised and/or new versions
- of the license from time to time. Each version will be given a
- distinguishing version number.
- Once covered code has been published under a particular version
- of the license, you may always continue to use it under the
- terms of that version. You may also choose to use such covered
- code under the terms of any subsequent version of the license
- published by Zend Technologies Ltd. No one other than Zend
- Technologies Ltd. has the right to modify the terms applicable
- to covered code created under this License.
-
- 5. Redistributions of any form whatsoever must retain the following
- acknowledgment:
- "This product includes the Zend Engine, freely available at
- http://www.zend.com"
-
- 6. All advertising materials mentioning features or use of this
- software must display the following acknowledgment:
- "The Zend Engine is freely available at http://www.zend.com"
-
-THIS SOFTWARE IS PROVIDED BY ZEND TECHNOLOGIES LTD. ``AS IS'' AND
-ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ZEND
-TECHNOLOGIES LTD. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
---------------------------------------------------------------------
diff --git a/Zend/Makefile.am b/Zend/Makefile.am
deleted file mode 100644
index 2182442d5b..0000000000
--- a/Zend/Makefile.am
+++ /dev/null
@@ -1,51 +0,0 @@
-## Process this file with automake to produce Makefile.in -*- makefile -*-
-
-#CLEANFILES = zend_language_parser.c zend_language_parser.h zend_language_scanner.c zend_language_parser.output zend_ini_parser.c zend_ini_parser.h zend_ini_scanner.c zend_ini_parser.output
-
-AUTOMAKE_OPTIONS=foreign
-noinst_LTLIBRARIES=libZend.la
-
-libZend_la_SOURCES=\
- zend_language_parser.y zend_language_scanner.l \
- zend_ini_parser.y zend_ini_scanner.l \
- zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c \
- zend_execute.c zend_execute_API.c zend_highlight.c zend_llist.c \
- zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
- zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
- zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
- zend_ini.c zend_qsort.c zend_objects.c zend_object_handlers.c \
- zend_object_API.c
-
-libZend_la_LDFLAGS =
-libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
-
-# automake isn't too clever about "non-standard" use of lex and yacc
-
-$(libZend_la_OBJECTS): zend_language_parser.h
-
-zend_ini_scanner.lo: zend_ini_parser.h
-
-# Language parser/scanner rules
-
-zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
- $(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
-
-zend_language_parser.h: zend_language_parser.c
-zend_language_parser.c: $(srcdir)/zend_language_parser.y
- $(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o zend_language_parser.c
-
-# INI parser/scanner rules
-
-zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
- $(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o zend_ini_parser.c
-
-zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
- $(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
-
-zend_ini_parser.h: zend_ini_parser.c
-
-depend:
-
-zend_execute.lo: $(srcdir)/zend_execute.c
- $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(INLINE_CFLAGS) -c $(srcdir)/zend_execute.c
-
diff --git a/Zend/OBJECTS2_HOWTO b/Zend/OBJECTS2_HOWTO
deleted file mode 100644
index ce0fbdb3ea..0000000000
--- a/Zend/OBJECTS2_HOWTO
+++ /dev/null
@@ -1,193 +0,0 @@
-Creating an object
-------------------
-
-Object can be created in the following ways:
-
-1. As a result of a function call. E.g.:
-
-$foo = create_new_foo("parameter");
-$foo->run();
-
-The function should create a new zval, create new object and get the
-handle for it, set handle and handler table as needed. Note that the
-handle is the only ID of the object, so it should be enough to
-identify it.
-
-2. Overriding create_object handler for class. E.g.:
-
-$foo = new Java("some.Class.here", "parameter");
-$foo->run();
-
-The create_object handler function should create a new zval, create
-new object and get the handle for it, set handle and handler table as
-needed, and also provide constructor method that would handle
-constructor call. The get_constructor handler table entry should be
-used for that. Do not rely class entry's constructor, unless you refer
-to it from get_constructor handler.
-
-Object maintenance
-------------------
-
-The handlers add_ref and del_ref are called when a new zval referring
-to the object is created. This does not create a new object - both
-zvals still refer to the same object.
-
-clone_obj handler should create a new object, identical to an old one,
-but being a separate entity.
-
-delete_obj should destroy an object, all references to it become
-invalid.
-
-Object access - read
---------------------
-
-read_property is used to read object's property. This value is not
-meant to be changed. The handler returns zval * with the value.
-
-Object access - write
----------------------
-
-write_property is used to directly write object's property by
-name. This handler is used to assign property variables or to change them
-in operations like += or ++ (unless get_property_zval_ptr is also set).
-
-get_property_zval_ptr is used to obtain pointer to modifyable zval for
-operations like += or ++. This should be used only if your object model
-stores properties as real zval's that can be modified from outside.
-Otherwise this handler should be NULL and the engine will use
-read_property and write_property instead.
-
-get_property_ptr is used to obtain zval ** for future writing to
-it. If your object properties are stored as zval*, return real place
-where the property is stored. If the aren't, the best way is to create
-proxy object and handle it via get and set methods (see below).
-This method is meant to be used for send-by-reference and assign-by-reference
-use of object properties. If you don;t want to implement property
-referencing for your objects, you can set this handler to NULL.
-
-get and set handlers are used when engine needs to access the object
-as a value. E.g., in the following situation:
-
-$foo =& $obj->bar;
-$foo = 1;
-
-if $foo is an object (e.g., proxy object from get_property_ptr) it
-would be accessed using write handler.
-
-Object access - method call
----------------------------
-
-get_method handler is used to find method description by name. It
-should set right type, function name and parameter mask for the
-method. If the type is ZEND_OVERLOADED_FUNCTION, the method would be
-called via call_method handler, otherwise it would be called with
-standard Zend means.
-
-get_constructor performs the same function as get_method, but for the
-object constructor.
-
-call_method handler is used to perform method call. Parameters are
-passed like to any other Zend internal function.
-
-Object - comparison
--------------------
-
-Objects can be compared via compare_objects handler. This is used with
-== operation, === compares objects by handles, i.e., return true if
-and only if it's really the same object. Note that objects from
-different object types (i.e., having different handlers) can not be
-compared.
-
-Objects - reflection
---------------------
-
-get_class_name is used to retrieve class name of the object. No other
-reflection functions are currently implemented.
-
-Objects - data structures and handlers
----------------------------------------
-
-The object is represented by the following structure:
-
-struct _zend_object_value {
- zend_object_handle handle;
- zend_object_handlers *handlers;
-};
-
-handle is an ID of the object among the objects of the same type (not
-class!). The type of the object and how it behaves is determined by
-the handler table.
-
-typedef struct _zend_object_handlers {
- zend_object_add_ref_t add_ref;
- zend_object_del_ref_t del_ref;
- zend_object_delete_obj_t delete_obj;
- zend_object_clone_obj_t clone_obj;
- zend_object_read_property_t read_property;
- zend_object_write_property_t write_property;
- zend_object_get_property_ptr_t get_property_ptr;
- zend_object_get_property_zval_ptr_t get_property_zval_ptr;
- zend_object_get_t get;
- zend_object_set_t set;
- zend_object_has_property_t has_property;
- zend_object_unset_property_t unset_property;
- zend_object_get_properties_t get_properties;
- zend_object_get_method_t get_method;
- zend_object_call_method_t call_method;
- zend_object_get_constructor_t get_constructor;
- zend_object_get_class_entry_t get_class_entry;
- zend_object_get_class_name_t get_class_name;
- zend_object_compare_t compare_objects;
-} zend_object_handlers;
-
-See zend_object_handlers.h for prototypes. All objects are passed as zval's.
-
-Handlers explained:
-
-add_ref - called when a copy of the object handle is created.
-
-del_ref - called when a copy of the object handle is destroyed.
-
-delete_obj - called when an object needs to be destroyed.
-
-clone_obj - called when a new object identical to an old one should be
-created (unlike Zend Engine 1, this never happens unless explicitly
-asked for).
-
-read_property - returns zval *, containing the value of the
-property. Is used when value of the property should be retrieved for
-reading.
-
-write_property - assigns value to certain property of the object.
-
-get_property_zval_ptr - retrieves zval** for being directly modified by
-the engine. If your properties are not zval's, don't define it.
-
-get_property_ptr - retrieves zval** for the property of the value, to
-be used for read and write. If object properties are not zval's
-natively, this method should create and return proxy object for use
-with get and set methods.
-
-get - retrieves zval* for object contents. To be used mainly with
-proxy objects from get_property_ptr, but also may be used for
-convert_to_* functions.
-
-set - sets value for object contents. To be used mainly with
-proxy objects from get_property_ptr.
-
-has_property - checks if the object has certain property set.
-
-unset_property - removes value for the property of the object
-
-get_method - retrieves description of the method
-
-call_method - calls the method (parameters should be put on stack like
-for any other PHP internal function).
-
-get_constructor - get description for the object constructor method
-
-get_class_entry - should return the class entry
-
-get_class_name - get the name of the class the object belongs to
-
-compare_objects - compares if two objects are equal
diff --git a/Zend/RFCs/001.txt b/Zend/RFCs/001.txt
deleted file mode 100644
index bf1d847b97..0000000000
--- a/Zend/RFCs/001.txt
+++ /dev/null
@@ -1,136 +0,0 @@
-Revamped object model using object handles
-===========================================
-
-Background
-----------
-
-In the Zend Engine 1.0 (and its predecessor the PHP 3 scripting
-engine) the object model's design is that instantiated objects are
-language values. This means that when programmers are performing
-operations, such variable assignment and passing parameters to
-functions, objects are handled very similarly to the way other
-primitive types are handled such as integers and strings.
-Semantically this means that the whole object is being copied. The
-approach Java takes is different where one refers to objects by handle
-and not by value (one can think of a handle as an objects' ID).
-
-Need
-----
-
-Unfortunately, the approach taken up to now has severely limited the
-Zend Engine's object oriented model, both feature and simplicity
-wise. One of the main problems with the former approach is that object
-instantiation and duplication is very hard to control, a problem which
-can not only lead to inefficient development but also often to strange
-run-time behavior. Changing the object model to a handle oriented
-model will allow the addressing of many needs such as destructors,
-de-referencing method return values, tight control of object
-duplication and more.
-
-Overview
---------
-
-The proposed object model is very much influenced by the Java
-model. In general, when you create a new object you will be getting a
-handle to the object instead of the object itself. When this handle is
-sent to functions, assigned and copied it is only the handle which is
-copied/sent/assigned. The object itself is never copied nor
-duplicated. This results in all handles of this object to always point
-at the same object making it a very consistent solution and saving
-unnecessary duplication and confusing behavior.
-
-Functionality
--------------
-
-After this change the basic use of objects will be almost identical to
-previous versions of the scripting engine. However, you won't bump
-into awkward and confusing copying & destructing of objects. In order
-to create and use a new object instance you will do the following:
-$object = new MyClass(); $object->method();
-
-The previous code will assign $object the handle of a new instance of
-the class MyClass and call one of its methods.
-
-
-Consider the following code:
-
-1 class MyClass
-2 {
-3 function setMember($value)
-4 {
-5 $this->member = $value;
-6 }
-7
-8 function getMember()
-9 {
-10 return $this->member;
-11 }
-12 }
-13
-14 function foo($obj)
-15 {
-16 $obj->setMember("foo");
-17 }
-18
-19 $object = new MyClass();
-20 $object->setMember("bar");
-21 foo($object);
-22 print $object->getMember();
-
-Without the new Java-like handles, at line 20 the objects' data member
-member is set to the string value of "bar". Because of the internal
-representation of objects in the Zend Engine 1.0, the object is marked
-as a reference, and when it is sent by value to the function foo, it
-is duplicated (!). Therefore, the call to foo() on line 21 will
-result in the $obj->setMember("foo") call being called on a duplicate
-of $object. Line 22 will then result in "bar" being printed.
-
-This is how the scripting engine has worked until today. Most
-developers are probably unaware of the fact that they aren't always
-talking to the same object but often duplicates; others may have
-realized this can usually be solved by always passing objects by
-reference (unless a replica is actually desired, which is uncommon).
-
-The new object model will allow for a much more intuitive
-implementation of the code. On line 21, the object's handle (ID) is
-passed to foo() by value. Inside foo(), the object is fetched
-according to this handle and, therefore, the setMember() method is
-called on the originally instantiated object and not a copy. Line 22
-will therefore result in "foo" being printed. This approach gives
-developers tighter control of when objects are created and duplicated.
-An additional not-as-important benefit is that the object handle will
-be passed to foo() by value, which most probably will also save
-unnecessary duplication of the value containing the ID itself and thus
-additionally improving run-time performance.
-
-This was just a simple description of why the new object model solves
-awkward behavior and makes object handling much easier, intuitive and
-efficient. The importance of this change goes far beyond what is
-mentioned in this section as you will see in further sections which
-describe new features with a majority of them being based on this
-change.
-
-Compatibility Notes
---------------------
-
-Many PHP programmers aren't even aware of the copying quirks of the
-current object model and, therefore, there is a relatively good chance
-that the amount of PHP applications that will work out of the box or
-after a very small amount of modifications would be high.
-
-To simplify migration, version 2.0 will support an optional
-'auto-clone' feature, which will perform a cloning of the object
-whenever it would have been copied in version 1.0. Optionally, it
-will also be possible to request that the engine will emit an E_NOTICE
-message whenever such an automatic clone occurs, in order to allow
-developers to gradually migrate to the version 2.0-style behavior
-(without automatic clones).
-
-Dependencies
-------------
-
-The new object model is not dependent on other features. Many of the
-other Zend Engine 2.0 features, such as the $foo->bar()->barbara()
-syntax, destructors and others completely rely on this new object
-model.
-
diff --git a/Zend/RFCs/002.txt b/Zend/RFCs/002.txt
deleted file mode 100644
index 263c4116c9..0000000000
--- a/Zend/RFCs/002.txt
+++ /dev/null
@@ -1,169 +0,0 @@
-Title: Zend 2.0 Namespaces
-Version: $Revision$
-Status: draft
-Maintainer: Stig S. Bakken <ssb@fast.no>
-Created: 2001-09-08
-Modified: 2001-09-08
-
-
-1. Background/Need
-==================
-
-PHP and Zend 1.0 have come to a point where a lot of reusable code is
-being written; from simple functions and classes to entire application
-frameworks. It is becoming increasingly difficult to avoid symbol
-name collisions with the current scoping methods.
-
-The symbol scopes available in Zend 1.0 are the global scope, the
-class scope and the function scope. All scopes but classes may
-contain variables, only the class and global scopes may contain
-functions, while only the global scope may contain constants and
-classes. This means that all of Zend 1.0's scoping methods are
-inherently limited for solving symbol name collision problems.
-
-
-2. Overview
-===========
-
-Namespaces in Zend 2.0 provide a way to manage the symbol collision
-problem by making it possible to define multiple symbol tables able to
-contain all types of symbols. Zend will get the notion of a current
-namespace, defaulting to the current global one. The current name
-space may be changed on a file-by-file basis. Symbols in other name
-spaces than the current one may be referenced using a new namespace
-operator. It will be possible to "import" symbols from one namespace
-into another.
-
-
-3. Functionality
-================
-
-3.1. Namespace Syntax
-=====================
-
-The namespace operator ":" is used to refer to symbols in other
-namespaces than the current one:
-
-Class: Namespace:class
-Function: Namespace:function
-Static method: Namespace:class::method
-Variable: $Namespace:variable
-Constant: Namespace:CONSTANT
-Class variable: $Namespace:class::variable
-
-To refer to symbols in the global namespace, symbols are prefixed with
-only the namespace operator:
-
-Class: :class
-Function: :function
-Static method: :class::method
-Variable: $:variable
-Constant: :CONSTANT
-Class variable: $:class::variable
-
-Note: $:variable will effectively be just another syntax for
-$GLOBALS['variable'].
-
-A namespace may have a name containing a ":", it is always the last
-":" character in the symbol qualifier that is the actual namespace
-operator:
-
-Class: Name:Space:class
-Function: Name:Space:function
-Static method: Name:Space:class::method
-Variable: $Name:Space:variable
-Constant: Name:Space:CONSTANT
-Class variable: $Name:Space:class::variable
-
-(Here, the ":" between "Name" and "Space" is part of the name, it is
-the one after "Space" that is the namespace operator.)
-
-
-3.2. Defining Namespaces
-========================
-
-Individual files may define a namespace that will apply to the entire
-file. If no "namespace" operator occurs in the file, it will be in
-the global namespace:
-
- 1 namespace HTML;
- 2
- 3 class Form {
- 4 function Form() {
- 5 // constructor
- 6 }
- 7 // ...
- 8 }
-
-Or with the "nested" name syntax:
-
- 1 namespace HTML:Form;
- 2
- 3 class Image {
- 4 var $src;
- 5 function Image($src) {
- 6 $this->src = $src;
- 7 }
- 8 // ...
- 9 }
-
-Code executed within the "HTML" namespace may refer to the Form class
-as just "Form". Code executed from within other namespaces has to
-refer to it as "HTML:Form". The "namespace" statement must occur
-before any other statements in the file.
-
-# [ssb 2001-09-08]:
-# Should it be possible to "add" symbols to a namespace by including a
-# second file with the same namespace statement?
-
-
-3.3. Importing Symbols
-======================
-
-It is possible to import symbols from another namespace into the
-current one with the "import" statement:
-
- import * from HTML; // all symbols
-
- import Form from HTML; // single symbols
-
- import Form,Table from HTML; // multiple symbols
-
-There is a potential for name clashes between symols of different
-types that have the same qualifier syntax. These are resolved in this
-order: class, function, constant.
-
-Optionally, the symbol type may be explicitly given to import (as
-"class", "function", "variable" or "constant"):
-
- import class Form from HTML;
-
-And finally, you may import all symbols of a given type:
-
- import constant * from HTML:Table;
-
-The namespace with its symbols must already be defined before using
-"import".
-
-
-4. Compatibility Notes
-======================
-
-Old code that does not take advantage of namespaces will run without
-modifications.
-
-
-5. Dependencies
-===============
-
-The class variable syntax depends on this class variables being
-implemented in the new ZE2 object model.
-
-
-6. Acknowledgements
-===================
-
-Andi Gutmans <andi@zend.com> and Zeev Suraski <zeev@zend.com> for
-initial ZE2 namespaces proposal
-
-Dean Hall <php@apt7.com> for the initial symbol qualification syntax
diff --git a/Zend/RFCs/003.txt b/Zend/RFCs/003.txt
deleted file mode 100644
index aa90691b19..0000000000
--- a/Zend/RFCs/003.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-Title: Loose type requirements for functions
-Version: $Revision$
-Status: draft
-Maintainer: Brian Moon <brianm@dealnews.com>
-Created: 2001-09-17
-Modified: 2001-09-17
-
-
-1. Background/Need
-==================
-
-Many internal function of PHP will reject parameters because of their
-type (the array and variable function come to mind). For userland
-this is not an easy task as there is no uniform way to do it. An
-addition to the engine for requiring loose types would allow
-delevopers to know that the data passed to their functions is of the
-correct type and reduce the need for duplicating the same code in
-every function to check for the type of data.
-
-
-2. Overview
-===========
-
-Loose typing mostly means evaluating the contents of the variable and
-not the type of the variable itself. The requirements for this would
-and should work much like several of the is_* functions do now.
-
-The typing of parameters would be optional and those not typed would
-simply continue to be treated as they are now.
-
-3. Functionality
-================
-
-3.1. Allowed Types
-==================
-
-Only loose types should be needed to ensure the data is usable by the
-function. Duplicating the functionallity of is_scalar, is_resource,
-is_array and is_object should give developers all the information they
-need to use a variable correctly.
-
-3.2. Syntax
-===========
-
-The current function syntax should be expanded to allow typing of
-variables inline in a C style.
-
-function foo ($var){
-}
-
-could be changed to require an array such as:
-
-function foo (array $var){
-}
-
-3.3. Errors
-===========
-
-Mis-matches in type should be reported as fatal errors and should halt
-the execution of a script as that function can not be run and code
-following could not reliably run.
-
-
-4. Compatibility Notes
-======================
-
-Old code that does not take advantage of this will run without
-modifications.
-
-
-
-
diff --git a/Zend/RFCs/004.txt b/Zend/RFCs/004.txt
deleted file mode 100644
index 1e120ce306..0000000000
--- a/Zend/RFCs/004.txt
+++ /dev/null
@@ -1,107 +0,0 @@
-Title: Delegation
- (a/k/a. Object-Based Inheritance)
-Version: $Revision$
-Status: draft
-Maintainer: Sebastian Bergmann <sb@sebastian-bergmann.de>
-
-
-Dynamic Delegation
-
- Syntax / Example
-
- <?php
- class aDelegatee {
- function doSomething() {
- echo 'hubu';
- }
- }
-
- class anotherDelegatee {
- function doSomething() {
- echo 'tubu';
- }
- }
-
- class Foo {
- delegatee $bar;
-
- function setDelegatee($delegatee) {
- $this->delegatee = $delegatee;
- }
- }
-
- $foo = new Foo;
-
- $foo->setDelegatee(new aDelegatee);
- $foo->doSomething(); /* prints "hubu" */
-
- $foo->setDelegatee(new anotherDelegatee);
- $foo->doSomething(); /* prints "tubu" */
- ?>
-
- Semantics / Synopsis
-
- The "Foo" class may use all methods available in "$bar" as if they
- where locally defined or inherited from a superclass. The essential
- difference is that by assigning another object to "$bar" it is
- possible to dynamically switch between different implementations for
- these methods.
-
-
-Fixed Delegation
-
- Syntax / Example
-
- <?php
- class aDelegatee {
- function doSomething() {
- echo 'hubu';
- }
- }
-
- class Foo {
- final delegatee $bar = new aDelegatee;
- }
-
- $foo = new Foo;
-
- $foo->doSomething(); /* prints "hubu" */
- ?>
-
- Semantics / Synopsis
-
- The "Foo" class may use all methods available in "$bar" as if they
- where locally defined or inherited from a superclass. The difference
- to the dynamic delegation is that once the delegatee object is set,
- it cannot be changed.
-
-
-Default Delegation
-
- Syntax / Example
-
- <?php
- class Foo {
- function __delegate($name, $parameters = array()) {
- echo $name;
- }
- }
-
- $foo = new Foo;
- $foo->bar(); /* prints "bar" */
- ?>
-
- Semantics / Synopsis
-
- If a class has a __delegate() method, it is called whenever a
- method on an object of this class is called that is
-
- * Not defined in the class.
-
- * Not provided by a delegatee object.
-
- The __delegate() method is called with the name and parameters
- of the method call.
-
- This supersedes / obsoletes similar functionality introduced in
- Zend Engine 1 by ext/overload.
diff --git a/Zend/ZEND_CHANGES b/Zend/ZEND_CHANGES
deleted file mode 100644
index ecfc1c9a98..0000000000
--- a/Zend/ZEND_CHANGES
+++ /dev/null
@@ -1,741 +0,0 @@
-Changes in the Zend Engine 2.0
-
- * New Object Model.
-
- The Zend Engine's handling of objects has been completely
- changed in order to allow for new features, but also to increase
- its performance.
-
- Objects were handled in previous versions like primitive types
- (for instance integers and strings). The drawback of this method
- is, that semantically the whole object was copied when a
- variable was assigned or parameters were passed to a method. The
- new approach refers to objects by handle and not by value (one
- can think of a handle as an object's ID).
-
- Many PHP programmers aren't even aware of the copying quirks of
- the old object model and, therefore, there is a relatively good
- chance that the amount of PHP applications that will work out of
- the box or after a very small amount of modifications would be
- high.
-
- * Private and Protected Members.
-
- The Zend Engine 2.0 introduces private and protected member variables.
- Note that for performance reasons no error message is emitted in
- case of an illegal access to a private or protectecd member variable.
-
- Example:
-
- <?php
- class MyClass {
- private $Hello = "Hello, World!\n";
- protected $Bar = "Hello, Foo!\n";
- protected $Foo = "Hello, Bar!\n";
-
- function printHello() {
- print "MyClass::printHello() ".$this->Hello;
- print "MyClass::printHello() ".$this->Bar;
- print "MyClass::printHello() ".$this->Foo;
- }
- }
-
- class MyClass2 extends MyClass {
- protected $Foo;
-
- function printHello() {
- MyClass::printHello(); /* Should print */
- print "MyClass2::printHello() ".$this->Hello; /* Shouldn't print out anything */
- print "MyClass2::printHello() ".$this->Bar; /* Shouldn't print (not declared)*/
- print "MyClass2::printHello() ".$this->Foo; /* Should print */
- }
- }
-
- $obj = new MyClass();
- print $obj->Hello; /* Shouldn't print out anything */
- print $obj->Bar; /* Shouldn't print out anything */
- print $obj->Foo; /* Shouldn't print out anything */
- $obj->printHello(); /* Should print */
-
- $obj = new MyClass2();
- print $obj->Hello; /* Shouldn't print out anything */
- print $obj->Bar; /* Shouldn't print out anything */
- print $obj->Foo; /* Shouldn't print out anything */
- $obj->printHello();
- ?>
-
- Protected member variables can be accessed in classes extending the class
- they are declared in, whereas private member variables can only be accessed
- by the class they belong to.
-
- Note: Protected member variables have to be declared in every class they
- are used!
-
- * Object Cloning.
-
- The Zend Engine 1.0 offered no way a user could decide what copy
- constructor to run when an object is duplicated. During
- duplication, the Zend Engine 1.0 did a bitwise copy making an
- identical replica of all the object's properties.
-
- Creating a copy of an object with fully replicated properties is
- not always the wanted behavior. A good example of the need for
- copy constructors, is if you have an object which represents a
- GTK window and the object holds the resource of this GTK window,
- when you create a duplicate you might want to create a new
- window with the same properties and have the new object hold the
- resource of the new window. Another example is if your object
- holds a reference to another object which it uses and when you
- replicate the parent object you want to create a new instance of
- this other object so that the replica has its own separate copy.
-
- An object copy is created by calling the object's __clone()
- method.
-
- Example:
-
- <?php
- $copy_of_object = $object->__clone();
- ?>
-
- When the developer asks to create a new copy of an object, the
- Zend Engine will check if a __clone() method has been defined or
- not. If not, it will call a default __clone() which will copy
- all of the object's properties. If a __clone() method is
- defined, then it will be responsible to set the necessary
- properties in the created object. For convenience, the engine
- will supply a function that imports all of the properties from
- the source object, so that they can start with a by-value
- replica of the source object, and only override properties that
- need to be changed. [The function hasn't been implemented yet]
-
- Example:
-
- <?php
- class MyCloneable {
- static $id = 0;
-
- function MyCloneable() {
- $this->id = self::$id++;
- }
-
- function __clone() {
- $this->name = $clone->name;
- $this->address = 'New York';
- $this->id = self::$id++;
- }
- }
-
- $obj = new MyCloneable();
-
- $obj->name = 'Hello';
- $obj->address = 'Tel-Aviv';
-
- print $obj->id . "\n";
-
- $obj = $obj->__clone();
-
- print $obj->id . "\n";
- print $obj->name . "\n";
- print $obj->address . "\n";
- ?>
-
- * Nested classes (namespaces).
-
- The Zend Engine 1.0 provided only three scopes: the global
- scope, the class scope and the function scope. All scopes but
- classes could contain variables, only the class and global
- scopes could contain functions, while only the global scope
- could contain constants and classes. This means that all of the
- Zend Engine 1.0's scoping methods were inherently limited for
- solving symbol name collision problems.
-
- The Zend Engine 2.0 introduces the concept of nested classes
- to solve the symbol collision problem by making it possible to
- define multiple symbol tables able to contain all types of
- symbols. The Zend Engine is aware of a current class,
- defaulting to the global scope. Each class can contain it's
- own set of constants, functions and static variables. In order
- to access a class's local symbols you can use the self:: class
- accessor, for example, you can do self::$my_static_name = "Hello".
- You can also use the class's name such as
- MyClass::$my_static_name = "Hello". WIth both constants and
- functions, if you don't specify a class context the current class
- will be searched first and if the search fails then the global
- scope will be searched. If you want to force PHP to only check the
- global scope you can use the main:: accessor. For example,
- main::strlen() to make sure you're calling the strlen() in the main
- scope. You will only need to worry about this if you are defining
- methods which have the same name as global functions. For
- constants you can use the same notation such as self::MY_CONSTANT
- or main::MY_CONSTANT.
- Sometimes you will not want to access constants, functions or classes
- via the class accessor (i.e. MyClass::) because you use them very
- often and are an extremely slow typist. In this case, you can import
- functions, classes and constants from classes with the import keyword.
- It's quite self explanatory and there are a few examples below.
-
-
- * Classes may contain classes.
-
- Example:
-
- <?php
- class DB::MySQL {
- var $host = '';
-
- function db_connect($user) {
- print "Connecting to MySQL database '$this->host' as $user\n";
- }
- }
-
- class DB::Oracle {
- var $host = 'localhost';
-
- function db_connect($user) {
- print "Connecting to Oracle database '$this->host' as $user\n";
- }
- }
-
- $MySQL_obj = new DB::MySQL();
- $MySQL_obj->db_connect('Susan');
-
- $Oracle_obj = new DB::Oracle();
- $Oracle_obj->db_connect('Barbara');
- ?>
-
- * Classes may contain constants.
-
- Example:
-
- <?php
- class foo {
- const hey = 'hello';
- }
-
- print foo::hey;
- ?>
-
- * Current namespace's symbol tables are searched first for
- constants and functions.
-
- Example:
-
- The following code prints "foobar", not "foo", because
- the class constant overrides the "global" constant of
- the same name.
-
- <?php
- define('foo', 'bar');
-
- class FooClass {
- const foo = 'foobar';
-
- function printFoo() {
- print foo;
- }
- }
- ?>
-
- * In the scope of a function, the current namespace is that
- of the containing class/namespace.
-
- Example:
-
- <?php
- class FooClass {
- function foo() {
- $this->bar();
- bar();
- }
-
- function bar() {
- print "foobar\n";
- }
- }
-
- $obj = new FooClass;
- $obj->foo();
- $obj->foo();
- ?>
-
- This prints "foobar" two times, since a bar() method exists
- in the current namespace.
-
- * It is possible to "import" symbols from one namespace into
- another.
-
- Example:
-
- <?php
- class MyClass {
- class MyClass2 {
- function hello() {
- print "Hello, World in MyClass2\n";
- }
- }
-
- function hello() {
- print "Hello, World\n";
- }
- }
-
- import function hello, class MyClass2 from MyClass;
-
- MyClass2::hello();
- hello();
- ?>
-
- Example:
-
- <?php
- class MyOuterClass {
- class MyInnerClass {
- function func1() {
- print "func1()\n";
- }
-
- function func2() {
- print "func2()\n";
- }
- }
- }
-
- import class * from MyOuterClass;
- import function func2 from MyOuterClass::MyInnerClass;
-
- MyInnerClass::func1();
- func2();
- ?>
-
- Example:
-
- <?php
- class MyOuterClass {
- const Hello = "Hello, World\n";
- }
-
- import const Hello from MyOuterClass;
- print Hello;
- ?>
-
- Old code that does not take advantage of namespaces will run
- without modifications.
-
- * Unified Constructors.
-
- The Zend Engine allows developers to declare constructor methods
- for classes. Classes which have a constructor method call this
- method on each newly-created object, so it is suitable for any
- initialization that the object may need before it can be used.
-
- With the Zend Engine 1.0, constructor methods were class methods
- that had the same name as the class itself. Since it is very
- common to call parent constructors from derived classes, the way
- the Zend Engine 1.0 worked made it a bit cumbersome to move
- classes around in a large class hierarchy. If a class is moved
- to reside under a different parent, the constructor name of that
- parent changes as well, and the code in the derived class that
- calls the parent constructor has to be modified.
-
- The Zend Engine 2.0 introduces a standard way of declaring
- constructor methods by calling them by the name __construct().
-
- Example:
-
- <?php
- class BaseClass {
- function __construct() {
- print "In BaseClass constructor\n";
- }
- }
-
- class SubClass extends BaseClass {
- function __construct() {
- parent::__construct();
- print "In SubClass constructor\n";
- }
- }
-
- $obj = new BaseClass();
- $obj = new SubClass();
- ?>
-
- For backwards compatibility, if the Zend Engine 2.0 cannot find
- a __construct() function for a given class, it will search for
- the old-style constructor function, by the name of the class.
- Effectively, it means that the only case that would have
- compatibility issues is if the class had a method named
- __construct() which was used for different semantics.
-
- * Destructors.
-
- Having the ability to define destructors for objects can be very
- useful. Destructors can log messages for debugging, close
- database connections and do other clean-up work.
-
- No mechanism for object destructors existed in the Zend Engine
- 1.0, although PHP had already support for registering functions
- which should be run on request shutdown.
-
- The Zend Engine 2.0 introduces a destructor concept similar to
- that of other object-oriented languages, such as Java: When the
- last reference to an object is destroyed the object's
- destructor, which is a class method name __destruct() that
- recieves no parameters, is called before the object is freed
- from memory.
-
- Example:
-
- <?php
- class MyDestructableClass {
- function __construct() {
- print "In constructor\n";
- $this->name = 'MyDestructableClass';
- }
-
- function __destruct() {
- print 'Destroying ' . $this->name . "\n";
- }
- }
-
- $obj = new MyDestructableClass();
- ?>
-
- Like constructors, parent destructors will not be called
- implicitly by the engine. In order to run a parent destructor,
- one would have to explicitly call parent::__destruct() in the
- destructor body.
-
- * Exceptions.
-
- The Zend Engine 1.0 had no exception handling. The Zend Engine 2.0
- introduces a exception model similar to that of other programming
- languages.
-
- Example:
-
- <?php
- class MyException {
- function __construct($exception) {
- $this->exception = $exception;
- }
-
- function Display() {
- print "MyException: $this->exception\n";
- }
- }
-
- class MyExceptionFoo extends MyException {
- function __construct($exception) {
- $this->exception = $exception;
- }
-
- function Display() {
- print "MyException: $this->exception\n";
- }
- }
-
- try {
- throw new MyExceptionFoo('Hello');
- }
-
- catch (MyException $exception) {
- $exception->Display();
- }
- ?>
-
- Old code that has no user-defined functions 'catch', 'throw' and
- 'try' will run without modifications.
-
- * Dereferencing objects returned from functions.
-
- Example:
-
- <?php
- class Circle {
- function draw() {
- print "Circle\n";
- }
- }
-
- class Square {
- function draw() {
- print "Square\n";
- }
- }
-
- function ShapeFactoryMethod($shape) {
- switch ($shape) {
- case 'Circle': return new Circle();
- case 'Square': return new Square();
- }
- }
-
- ShapeFactoryMethod('Circle')->draw();
- ShapeFactoryMethod('Square')->draw();
- ?>
-
- * Static member variables of static classes can now be
- initialized.
-
- Example:
-
- <?php
- class foo {
- static $my_static = 5;
- }
-
- print foo::$my_static;
- ?>
-
- * Parameters that are passed by reference to a function
- may now have default values.
-
- Example:
-
- <?php
- function my_function(&$var = null) {
- if ($var === null) {
- die('$var needs to have a value');
- }
- }
- ?>
-
- * Built-In Backtracing.
-
- Example:
-
- <?php
- $backtrace = debug_backtrace();
-
- foreach ($backtrace as $step) {
- if (!empty($step['args'])) {
- foreach ($step['args'] as $arg) {
- $args = isset($args) ? $args . ', ' : '';
- $args .= var_export($arg, true);
- }
- } else {
- $args = '';
- }
-
- $args = str_replace(array("\n", ',)'), array('', ')'), $args);
-
- printf(
- "%s%s(%s) [%s:%s]\n",
- isset($step['class']) ? $step['class'] . '::' : '',
- $step['function'],
- $args,
- $step['file'],
- $step['line']
- );
- }
- ?>
-
- * __autoload(). TBD.
-
- * Method calls and property accesses can be overloaded
- by class methods __call(), __get() and __set().
-
- __get() and __set() Example:
-
- <?php
- class Setter {
- public $n;
- public $x = array('a' => 1, 'b' => 2, 'c' => 3);
-
- function __get($nm) {
- print "Getting [$nm]\n";
-
- if(isset($this->x[$nm])) {
- $r = $this->x[$nm];
- print "Returning: $r\n";
- return $r;
- } else {
- print "Nothing!\n";
- }
- }
-
- function __set($nm, $val) {
- print "Setting [$nm] to $val\n";
-
- if(isset($this->x[$nm])) {
- $this->x[$nm] = $val;
- print "OK!\n";
- } else {
- print "Not OK!\n";
- }
- }
- }
-
- $foo = new Setter();
- $foo->n = 1;
- $foo->a = 100;
- $foo->a++;
- $foo->z++;
- var_dump($foo);
- ?>
-
- __call() Example:
-
- <?php
- class Caller {
- var $x = array(1, 2, 3);
-
- function __call($m, $a) {
- print "Method $m called:\n";
- var_dump($a);
- return $this->x;
- }
- }
-
- $foo = new Caller();
- $a = $foo->test(1, '2', 3.4, true);
- var_dump($a);
- ?>
-
-
-Changes in the Zend Engine 1.0
-
- The Zend Engine was designed from the ground up for increased speed,
- reduced memory consumption and more reliable execution. We dare say
- it meets all of these goals and does so pretty well. Beyond that,
- there are several improvements in the language engine features:
-
- * References support.
-
- $foo = &$a; would make $foo and $a be two names to the same
- variable. This works with arrays as well, on either side; e.g.,
- $foo = &$a[7]; would make $foo and $a[7] be two names to the
- same variable. Changing one would change the other and vice
- versa.
-
- * Object overloading support.
-
- This feature allows various OO libraries to use the OO notation
- of PHP to access their functionality. Right now, no use is made
- of that feature, but we'd have a COM module ready by the time
- PHP 4.0 is released. A CORBA module would probably follow.
-
- * include() and eval() are now functions, and not statements.
-
- That means they return a value. The default return value from
- include() and eval() is 1, so that you can do if (include())
- without further coding. The return value may be changed by
- returning a value from the global scope of the included file or
- the evaluated string. For example, if 'return 7;' is executed in
- the global scope of foo.inc, include('foo.inc') would evaluate
- to 7.
-
- * Automatic resource deallocation.
-
- Several people have been bitten by the fact that PHP 3.0 had no
- concept of reference counting. The Zend Engine adds full
- reference counting for every value in the system, including
- resources. As soon as a resource is no longer referenced from
- any variable, it is automatically destroyed to save memory and
- resources. The most obvious example for the advantage in this is
- a loop that has an SQL query inside it, something like '$result
- = sql_query(...);'. In PHP 3.0, every iteration resulted in
- another SQL result-set allocated in the memory, and all of the
- result sets weren't destroyed until the end of the script's
- execution. With the Zend Engine, as soon as we overwrite an old
- result set with a new one, the old result set which is no longer
- referenced, is destroyed.
-
- * Full support for nesting arrays and objects within each other,
- in as many levels as you want.
-
- * true and false are now constants of type boolean.
-
- Comparing any other value to them would convert that value to a
- boolean first, and conduct the comparison later. That means, for
- example, that 5==true would evaluate to true (in PHP 3.0, true
- was nothing but a constant for the integer value of 1, so
- 5==true was identical to 5==1, which was false).
-
- * Runtime binding of function names.
-
- This complex name has a simple explanation - you can now call
- functions before they're declared!
-
- * Added here-docs support.
-
- * Added foreach.
-
- Two syntaxes supported:
-
- foreach(array_expr as $val) statement
- foreach(array_expr as $key => $val) statement
-
- * A true unset() implementation.
-
- A variable or element that is unset(), is now sent to oblivion
- in its entirely, no trace remains from it.
-
- * Output buffering support.
-
- Use ob_start() to begin output buffering, ob_end_flush() to end
- buffering and send out the buffered contents, ob_end_clean() to
- end buffering without sending the buffered contents, and
- ob_get_contents() to retreive the current contents of the output
- buffer. Header information (header(), content type, cookies) are
- not buffered. By turning on output buffering, you can
- effectively send header information all throughout your file,
- regardless of whether you've emitted body output or not.
-
- * Full variable reference within quoted strings:
-
- ${expr} - full indirect reference support for scalar
- variables
- {variable} - full variable support
-
- For example:
-
- $foo[5]['bar'] = 'foobar';
- print "{$foo[5]["bar"]}"; // would print "foobar"
-
- * Ability to call member functions of other classes from within
- member functions or from the global scope.
-
- You can now, for example, override a parent function with a
- child function, and call the parent function from it.
-
- * Runtime information for classes (class name, parent, available
- functions, etc.).
-
- * Much more efficient syntax highlighter - runs much quicker,
- performs more reliably, and generates much tighter HTML.
-
- * A full-featured debugger has been integrated with the language
- (supports breakpoints, expression evaluation, step-in/over,
- function call backtrace, and more).
-
- The Zend Engine claims 100% compatability with the engine of PHP
- 3.0, and is shamelessly lying about it. Here's why:
-
- * Static variable initializers only accept scalar values
- (in PHP 3.0 they accepted any valid expression). The impact
- should be somewhere in between void and non existent, since
- initializing a static variable with anything but a simple
- static value makes no sense at all.
-
- * The scope of break and continue is local to that of an
- include()'d file or an eval()'d string. The impact should
- be somewhat smaller of the one above.
-
- * The return statement no longer works from a require()'d file. It
- hardly worked in PHP 3.0, so the impact should be fairly small. If
- you want this functionality - use include() instead.
-
- * unset() is no longer a function, but a statement.
-
- * The following letter combination is not supported within
- encapsulated strings: "{$". If you have a string that includes
- this letter combination, for example, print "{$somevar"; (which
- printed the letter { and the contents of the variable $somevar in
- PHP 3.0), it will result in a parse error with the Zend Engine.
- In this case, you would have to change the code to print
- "\{$somevar"; This incompatability is due to the full variable
- reference within quoted strings feature added in the Zend
- Engine.
diff --git a/Zend/Zend.dsp b/Zend/Zend.dsp
deleted file mode 100644
index 6b2a1d6330..0000000000
--- a/Zend/Zend.dsp
+++ /dev/null
@@ -1,510 +0,0 @@
-# Microsoft Developer Studio Project File - Name="Zend" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=Zend - Win32 Release_inline
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Zend.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Zend.mak" CFG="Zend - Win32 Release_inline"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Zend - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "Zend - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE "Zend - Win32 Release_inline" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDebug" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D ZEND_DEBUG=0 /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug"
-# ADD RSC /l 0x40d /d "NDebug"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug" /D "_LIB" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=1 /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE RSC /l 0x40d /d "_Debug"
-# ADD RSC /l 0x40d /d "_Debug"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Zend___Win32_Release_inline"
-# PROP BASE Intermediate_Dir "Zend___Win32_Release_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release_inline"
-# PROP Intermediate_Dir "Release_inline"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D ZEND_DEBUG=0 /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug"
-# ADD RSC /l 0x40d /d "NDebug"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "Zend - Win32 Release"
-# Name "Zend - Win32 Debug"
-# Name "Zend - Win32 Release_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\zend.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_builtin_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_compile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_constants.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_extensions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_hash.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_highlight.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_indent.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.c
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.c"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_list.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_llist.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_opcode.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_operators.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ptr_stack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_qsort.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_sprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_variables.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\FlexLexer.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_builtin_functions.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_compile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_constants.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_errors.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_extensions.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_fast_cache.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_hash.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_highlight.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_indent.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini.h
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.h"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_list.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_llist.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_modules.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_operators.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ptr_stack.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_qsort.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stack.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_variables.h
-# End Source File
-# End Group
-# Begin Group "Parsers"
-
-# PROP Default_Filter "y"
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.y
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.y"
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Scanners"
-
-# PROP Default_Filter "l"
-# Begin Source File
-
-SOURCE=.\flex.skl
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.l
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.l"
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Text Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\ZEND_BUGS
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_CHANGES
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_TODO
-# End Source File
-# End Group
-# Begin Group "Resources"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\zend.ico
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/Zend/Zend.m4 b/Zend/Zend.m4
deleted file mode 100644
index 84a80af285..0000000000
--- a/Zend/Zend.m4
+++ /dev/null
@@ -1,232 +0,0 @@
-dnl
-dnl $Id$
-dnl
-dnl This file contains Zend specific autoconf functions.
-dnl
-
-AC_DEFUN(LIBZEND_BISON_CHECK,[
-
-if test "$YACC" != "bison -y"; then
- AC_MSG_WARN(You will need bison if you want to regenerate the Zend parser.)
-else
- AC_MSG_CHECKING(bison version)
- set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /'`
- if test "${1}" = "1" -a "${2}" -lt "28"; then
- AC_MSG_WARN(You will need bison 1.28 if you want to regenerate the Zend parser (found ${1}.${2}).)
- fi
- AC_MSG_RESULT(${1}.${2} (ok))
-fi
-
-])
-
-AC_DEFUN(LIBZEND_BASIC_CHECKS,[
-
-AC_REQUIRE([AC_PROG_YACC])
-AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE([AC_PROG_CC_C_O])
-AC_REQUIRE([AC_PROG_LEX])
-AC_REQUIRE([AC_HEADER_STDC])
-AC_REQUIRE([AC_PROG_LIBTOOL])
-
-LIBZEND_BISON_CHECK
-
-dnl Ugly hack to get around a problem with gcc on AIX.
-if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \
- "`uname -sv`" = "AIX 4"; then
- CFLAGS=`echo $CFLAGS | sed -e 's/-g//'`
-fi
-
-dnl Hack to work around a Mac OS X cpp problem
-dnl Known versions needing this workaround are 5.3 and 5.4
-if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then
- CPPFLAGS="$CPPFLAGS -traditional-cpp"
-fi
-
-AC_CHECK_HEADERS(
-limits.h \
-malloc.h \
-string.h \
-unistd.h \
-stdarg.h \
-sys/types.h \
-sys/time.h \
-signal.h \
-unix.h \
-dlfcn.h)
-
-AC_TYPE_SIZE_T
-AC_TYPE_SIGNAL
-
-AC_CHECK_LIB(dl, dlopen, [LIBS="-ldl $LIBS"])
-AC_CHECK_FUNC(dlopen,[AC_DEFINE(HAVE_LIBDL, 1,[ ])])
-
-dnl
-dnl Ugly hack to check if dlsym() requires a leading underscore in symbol name.
-dnl
-AC_MSG_CHECKING([whether dlsym() requires a leading underscore in symbol names])
-_LT_AC_TRY_DLOPEN_SELF([
- AC_MSG_RESULT(no)
-], [
- AC_MSG_RESULT(yes)
- AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, 1, [Define if dlsym() requires a leading underscore in symbol names. ])
-], [
- AC_MSG_RESULT(no)
-], [])
-
-dnl This is required for QNX and may be some BSD derived systems
-AC_CHECK_TYPE( uint, unsigned int )
-AC_CHECK_TYPE( ulong, unsigned long )
-
-dnl Checks for library functions.
-AC_FUNC_VPRINTF
-AC_FUNC_MEMCMP
-AC_FUNC_ALLOCA
-AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite fpclass)
-AC_ZEND_BROKEN_SPRINTF
-
-AC_CHECK_FUNCS(finite isfinite isinf isnan)
-
-ZEND_FP_EXCEPT
-
-])
-
-AC_DEFUN(LIBZEND_ENABLE_DEBUG,[
-
-AC_ARG_ENABLE(debug,
-[ --enable-debug Compile with debugging symbols],[
- ZEND_DEBUG=$enableval
-],[
- ZEND_DEBUG=no
-])
-
-])
-
-AC_DEFUN(LIBZEND_OTHER_CHECKS,[
-
-AC_ARG_ENABLE(experimental-zts,
-[ --enable-experimental-zts This will most likely break your build],[
- ZEND_EXPERIMENTAL_ZTS=$enableval
-],[
- ZEND_EXPERIMENTAL_ZTS=no
-])
-
-AC_ARG_ENABLE(inline-optimization,
-[ --disable-inline-optimization If building zend_execute.lo fails, try
- this switch.],[
- ZEND_INLINE_OPTIMIZATION=$enableval
-],[
- ZEND_INLINE_OPTIMIZATION=yes
-])
-
-AC_ARG_ENABLE(memory-limit,
-[ --enable-memory-limit Compile with memory limit support. ], [
- ZEND_MEMORY_LIMIT=$enableval
-],[
- ZEND_MEMORY_LIMIT=no
-])
-
-AC_MSG_CHECKING(whether to enable thread-safety)
-AC_MSG_RESULT($ZEND_EXPERIMENTAL_ZTS)
-
-AC_MSG_CHECKING(whether to enable inline optimization for GCC)
-AC_MSG_RESULT($ZEND_INLINE_OPTIMIZATION)
-
-AC_MSG_CHECKING(whether to enable a memory limit)
-AC_MSG_RESULT($ZEND_MEMORY_LIMIT)
-
-AC_MSG_CHECKING(whether to enable Zend debugging)
-AC_MSG_RESULT($ZEND_DEBUG)
-
-if test "$ZEND_DEBUG" = "yes"; then
- AC_DEFINE(ZEND_DEBUG,1,[ ])
- echo " $CFLAGS" | grep ' -g' >/dev/null || DEBUG_CFLAGS="-g"
- if test "$CFLAGS" = "-g -O2"; then
- CFLAGS=-g
- fi
- test -n "$GCC" && DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall"
- test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \
- DEBUG_CFLAGS="$DEBUG_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
-else
- AC_DEFINE(ZEND_DEBUG,0,[ ])
-fi
-
-test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
-
-if test "$ZEND_EXPERIMENTAL_ZTS" = "yes"; then
- AC_DEFINE(ZTS,1,[ ])
- CFLAGS="$CFLAGS -DZTS"
- LIBZEND_CPLUSPLUS_CHECKS
-fi
-
-if test "$ZEND_MEMORY_LIMIT" = "yes"; then
- AC_DEFINE(MEMORY_LIMIT, 1, [Memory limit])
-else
- AC_DEFINE(MEMORY_LIMIT, 0, [Memory limit])
-fi
-
-
-changequote({,})
-if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
- INLINE_CFLAGS=`echo $ac_n "$CFLAGS $ac_c" | sed s/-O[0-9s]*//`
-else
- INLINE_CFLAGS="$CFLAGS"
-fi
-changequote([,])
-
-AC_C_INLINE
-
-AC_SUBST(INLINE_CFLAGS)
-
-
-dnl test and set the alignment define for ZEND_MM
-dnl this also does the logarithmic test for ZEND_MM.
-AC_MSG_CHECKING(for MM alignment and log values)
-
-AC_TRY_RUN([
-#include <stdio.h>
-
-typedef union _mm_align_test {
- void *ptr;
- double dbl;
- long lng;
-} mm_align_test;
-
-#if (defined (__GNUC__) && __GNUC__ >= 2)
-#define ZEND_MM_ALIGNMENT (__alignof__ (mm_align_test))
-#else
-#define ZEND_MM_ALIGNMENT (sizeof(mm_align_test))
-#endif
-
-int main()
-{
- int i = ZEND_MM_ALIGNMENT;
- int zeros = 0;
- FILE *fp;
-
- while (i & ~0x1) {
- zeros++;
- i = i >> 1;
- }
-
- fp = fopen("conftest.zend", "w");
- fprintf(fp, "%d %d\n", ZEND_MM_ALIGNMENT, zeros);
- fclose(fp);
-
- exit(0);
-}
-], [
- LIBZEND_MM_ALIGN=`cat conftest.zend | cut -d ' ' -f 1`
- LIBZEND_MM_ALIGN_LOG2=`cat conftest.zend | cut -d ' ' -f 2`
- AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT, $LIBZEND_MM_ALIGN, [ ])
- AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT_LOG2, $LIBZEND_MM_ALIGN_LOG2, [ ])
-])
-
-AC_MSG_RESULT(done)
-
-])
-
-
-AC_DEFUN(LIBZEND_CPLUSPLUS_CHECKS,[
-
-])
-
diff --git a/Zend/ZendCore.dep b/Zend/ZendCore.dep
deleted file mode 100644
index 39a5c0fb0b..0000000000
--- a/Zend/ZendCore.dep
+++ /dev/null
@@ -1,258 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by ZendCore.mak
-
-.\zend_alloc.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_execute.h"\
- ".\zend_llist.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
-
-
-.\alloca.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_config.w32.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
-
-
-.\zend_compile.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_execute.h"\
- ".\zend_llist.h"\
- ".\zend_modules.h"\
- ".\zend_operators.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_API.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
- ".\zend_ini.h"\
-
-
-.\zend_constants.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_config.w32.h"\
- ".\zend_constants.h"\
- ".\zend_operators.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
-
-
-.\zend_execute.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_constants.h"\
- ".\zend_execute.h"\
- ".\zend_llist.h"\
- ".\zend_modules.h"\
- ".\zend_operators.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_API.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
- ".\zend_ini.h"\
-
-
-.\zend_highlight.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_execute.h"\
- ".\zend_highlight.h"\
- ".\zend_llist.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend_language_parser.tab.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
-
-
-.\zend_llist.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_config.w32.h"\
- ".\zend_llist.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
-
-
-.\zend_opcode.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_execute.h"\
- ".\zend_llist.h"\
- ".\zend_modules.h"\
- ".\zend_operators.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_API.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
- ".\zend_ini.h"\
-
-
-.\zend_operators.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_execute.h"\
- ".\zend_llist.h"\
- ".\zend_operators.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
-
-
-.\zend_ptr_stack.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_config.w32.h"\
- ".\zend_ptr_stack.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
-
-
-.\zend_stack.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_config.w32.h"\
- ".\zend_stack.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
-
-
-.\zend_variables.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_constants.h"\
- ".\zend_execute.h"\
- ".\zend_llist.h"\
- ".\zend_modules.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_API.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
- ".\zend_ini.h"\
- ".\zend_list.h"\
-
-
-.\zend.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_config.w32.h"\
- ".\zend_operators.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
-
-
-.\zend_API.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_compile.h"\
- ".\zend_config.w32.h"\
- ".\zend_constants.h"\
- ".\zend_execute.h"\
- ".\zend_llist.h"\
- ".\zend_modules.h"\
- ".\zend_operators.h"\
- ".\zend_ptr_stack.h"\
- ".\zend_stack.h"\
- ".\zend_variables.h"\
- ".\zend.h"\
- ".\zend_API.h"\
- ".\zend_errors.h"\
- ".\zend_globals.h"\
- ".\zend_hash.h"\
- ".\zend_ini.h"\
- ".\zend_list.h"\
-
-
-.\zend_hash.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_config.w32.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
-
-
-.\zend_ini.c : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
- ".\zend_alloc.h"\
- ".\zend_config.w32.h"\
- ".\zend.h"\
- ".\zend_errors.h"\
- ".\zend_hash.h"\
- ".\zend_ini.h"\
-
-
-!IF "$(CFG)" == "ZendCore - Win32 Release"
-
-!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
-
-!ENDIF
-
-!IF "$(CFG)" == "ZendCore - Win32 Release"
-
-!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
-
-!ENDIF
-
-!IF "$(CFG)" == "ZendCore - Win32 Release"
-
-!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
-
-!ENDIF
-
-!IF "$(CFG)" == "ZendCore - Win32 Release"
-
-!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
-
-!ENDIF
-
diff --git a/Zend/ZendTS.dsp b/Zend/ZendTS.dsp
deleted file mode 100644
index fecc69baea..0000000000
--- a/Zend/ZendTS.dsp
+++ /dev/null
@@ -1,691 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ZendTS" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=ZendTS - Win32 Release_TSDbg
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ZendTS.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ZendTS.mak" CFG="ZendTS - Win32 Release_TSDbg"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ZendTS - Win32 Release_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "ZendTS - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "ZendTS - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
-!MESSAGE "ZendTS - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDebug_TS" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug_TS"
-# ADD RSC /l 0x40d /d "NDebug_TS"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug_TS" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug_TS" /D ZEND_DEBUG=1 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE RSC /l 0x40d /d "_Debug_TS"
-# ADD RSC /l 0x40d /d "_Debug_TS"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "ZendTS___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "ZendTS___Win32_Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug_TS"
-# ADD RSC /l 0x40d /d "NDebug_TS"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "ZendTS___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "ZendTS___Win32_Release_TSDbg"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug_TS"
-# ADD RSC /l 0x40d /d "NDebug_TS"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "ZendTS - Win32 Release_TS"
-# Name "ZendTS - Win32 Debug_TS"
-# Name "ZendTS - Win32 Release_TS_inline"
-# Name "ZendTS - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\zend.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_builtin_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_compile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_constants.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_dynamic_array.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_extensions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_hash.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_highlight.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_indent.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.c
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.c"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_list.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_llist.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_mm.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_object_handlers.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_opcode.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_operators.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ptr_stack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_qsort.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_sprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ts_hash.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_variables.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\FlexLexer.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_builtin_functions.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_compile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_constants.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_dynamic_array.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_errors.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute_locks.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_extensions.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_fast_cache.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_globals_macros.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_hash.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_highlight.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_indent.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_istdiostream.h
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.h"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_list.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_llist.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_mm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_modules.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_object_handlers.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects_API.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_operators.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ptr_stack.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_qsort.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stack.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ts_hash.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_variables.h
-# End Source File
-# End Group
-# Begin Group "Parsers"
-
-# PROP Default_Filter "y"
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.y
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.y"
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Scanners"
-
-# PROP Default_Filter "l"
-# Begin Source File
-
-SOURCE=.\flex.skl
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.l
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.l"
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Text Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\LICENSE
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_BUGS
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_CHANGES
-# End Source File
-# End Group
-# Begin Group "Resources"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\zend.ico
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/Zend/acconfig.h b/Zend/acconfig.h
deleted file mode 100644
index 4889320b7e..0000000000
--- a/Zend/acconfig.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#define ZEND_API
-#define ZEND_DLEXPORT
-#define ZEND_DLIMPORT
-
-#ifndef NETWARE
-@TOP@
-#endif
-
-#undef uint
-#undef ulong
-
-/* Define if you want to enable memory limit support */
-#define MEMORY_LIMIT 0
-
-#ifndef NETWARE
-@BOTTOM@
-#endif
-
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_IEEEFP_H
-# include <ieeefp.h>
-#endif
-
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
-
-#if ZEND_BROKEN_SPRINTF
-int zend_sprintf(char *buffer, const char *format, ...);
-#else
-# define zend_sprintf sprintf
-#endif
-
-#include <math.h>
-
-#ifdef HAVE_ISNAN
-#define zend_isnan(a) isnan(a)
-#elif defined(NAN)
-#define zend_isnan(a) (((a)==NAN)?1:0)
-#elif defined(HAVE_FPCLASS)
-#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
-#else
-#define zend_isnan(a) 0
-#endif
-
-#ifdef HAVE_ISINF
-#define zend_isinf(a) isinf(a)
-#elif defined(INFINITY)
-/* Might not work, but is required by ISO C99 */
-#define zend_isinf(a) (((a)==INFINITY)?1:0)
-#elif defined(HAVE_FPCLASS)
-#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
-#else
-#define zend_isinf(a) 0
-#endif
-
-#ifdef HAVE_FINITE
-#define zend_finite(a) finite(a)
-#elif defined(HAVE_ISFINITE) || defined(isfinite)
-#define zend_finite(a) isfinite(a)
-#elif defined(fpclassify)
-#define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0)
-#else
-#define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1)
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4
deleted file mode 100644
index 395f7220db..0000000000
--- a/Zend/acinclude.m4
+++ /dev/null
@@ -1,47 +0,0 @@
-dnl $Id$
-dnl
-dnl This file contains local autoconf functions.
-
-AC_DEFUN(ZEND_FP_EXCEPT,[
- AC_CACHE_CHECK(whether fp_except is defined, ac_cv_type_fp_except,[
- AC_TRY_COMPILE([
-#include <floatingpoint.h>
-],[
-fp_except x = (fp_except) 0;
-],[
- ac_cv_type_fp_except=yes
-],[
- ac_cv_type_fp_except=no
-],[
- ac_cv_type_fp_except=no
-])])
- if test "$ac_cv_type_fp_except" = "yes"; then
- AC_DEFINE(HAVE_FP_EXCEPT, 1, [whether floatingpoint.h defines fp_except])
- fi
-])
-
-dnl
-dnl Check for broken sprintf()
-dnl
-AC_DEFUN(AC_ZEND_BROKEN_SPRINTF,[
- AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[
- AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[
- ac_cv_broken_sprintf=no
- ],[
- ac_cv_broken_sprintf=yes
- ],[
- ac_cv_broken_sprintf=no
- ])
- ])
- if test "$ac_cv_broken_sprintf" = "yes"; then
- ac_result=1
- else
- ac_result=0
- fi
- AC_DEFINE_UNQUOTED(ZEND_BROKEN_SPRINTF, $ac_result, [Whether sprintf is broken])
-])
-
-AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
- LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
-])
-
diff --git a/Zend/build.mk b/Zend/build.mk
deleted file mode 100644
index 6105ff12c4..0000000000
--- a/Zend/build.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# Makefile to generate build tools
-#
-# Standard usage:
-# make -f build.mk
-#
-# Written by Sascha Schumann
-#
-# $Id$
-
-
-LT_TARGETS = ltmain.sh ltconfig
-
-config_h_in = zend_config.h.in
-
-makefile_am_files = Makefile.am
-makefile_in_files = $(makefile_am_files:.am=.in)
-makefile_files = $(makefile_am_files:e.am=e)
-
-targets = $(makefile_in_files) $(LT_TARGETS) configure $(config_h_in)
-
-all: $(targets)
-
-clean:
- rm -f $(targets)
-
-$(LT_TARGETS):
- rm -f $(LT_TARGETS)
- libtoolize --automake $(AMFLAGS) -f
-
-$(makefile_in_files): $(makefile_am_files)
- automake -a -i $(AMFLAGS) $(makefile_files)
-
-aclocal.m4: configure.in acinclude.m4
- aclocal
-
-$(config_h_in): configure.in acconfig.h
-# explicitly remove target since autoheader does not seem to work
-# correctly otherwise (timestamps are not updated)
- @rm -f $@
- autoheader
-
-configure: aclocal.m4 configure.in
- autoconf
diff --git a/Zend/buildconf b/Zend/buildconf
deleted file mode 100755
index fe8dee6f76..0000000000
--- a/Zend/buildconf
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-
-case "$1" in
---copy)
- automake_flags=--copy
- shift
-;;
-esac
-
-libtoolize --force --automake $automake_flags
-
-mv aclocal.m4 aclocal.m4.old 2>/dev/null
-aclocal
-if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
- echo "buildconf: keeping ${1}aclocal.m4"
- mv aclocal.m4.old aclocal.m4
-else
- echo "buildconf: created or modified ${1}aclocal.m4"
-fi
-
-autoheader
-
-automake --add-missing --include-deps $automake_flags
-
-mv configure configure.old 2>/dev/null
-autoconf
-if cmp configure.old configure > /dev/null 2>&1; then
- echo "buildconf: keeping ${1}configure"
- mv configure.old configure
-else
- echo "buildconf: created or modified ${1}configure"
-fi
-
diff --git a/Zend/configure.in b/Zend/configure.in
deleted file mode 100644
index a999c3a3eb..0000000000
--- a/Zend/configure.in
+++ /dev/null
@@ -1,45 +0,0 @@
-dnl $Id$
-dnl Process this file with autoconf to produce a configure script.
-
-AC_INIT(zend.c)
-AM_INIT_AUTOMAKE(zend, 0.80A, nodefine)
-AM_CONFIG_HEADER(zend_config.h)
-AM_SANITY_CHECK
-AM_MAINTAINER_MODE
-AC_PROG_CC
-AM_PROG_LEX
-AM_PROG_CC_STDC
-ZEND_VERSION=$VERSION
-
-dnl We want this one before the checks, so the checks can modify CFLAGS.
-test -z "$CFLAGS" && auto_cflags=1
-
-sinclude(Zend.m4)
-
-LIBZEND_BASIC_CHECKS
-
-AM_PROG_LIBTOOL
-if test "$enable_debug" != "yes"; then
- AM_SET_LIBTOOL_VARIABLE([--silent])
-fi
-
-dnl
-dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary
-dnl and source packages. This should be harmless on other OSs.
-dnl
-if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
- CFLAGS="$CFLAGS -I/usr/pkg/include"
- LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
-fi
-
-LIBZEND_ENABLE_DEBUG
-LIBZEND_OTHER_CHECKS
-
-ZEND_EXTRA_LIBS="$LIBS"
-LIBS=""
-AC_SUBST(ZEND_EXTRA_LIBS)
-AC_OUTPUT(Makefile)
-
-# Local Variables:
-# tab-width: 4
-# End:
diff --git a/Zend/flex.skl b/Zend/flex.skl
deleted file mode 100644
index 65ed5ca2a5..0000000000
--- a/Zend/flex.skl
+++ /dev/null
@@ -1,1633 +0,0 @@
-/* A Lexical scanner generated by flex */
-
-/* Scanner skeleton version:
- * $Header$
- */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-
-%-
-#include <stdio.h>
-%*
-
-
-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
-#ifdef c_plusplus
-#ifndef __cplusplus
-#define __cplusplus
-#endif
-#endif
-
-
-#ifdef __cplusplus
-
-#include <stdlib.h>
-%+
-class istream;
-%*
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-/* Use prototypes in function declarations. */
-#define YY_USE_PROTOS
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-#if __STDC__
-
-#define YY_USE_PROTOS
-#define YY_USE_CONST
-
-#endif /* __STDC__ */
-#endif /* ! __cplusplus */
-
-#ifdef __TURBOC__
- #pragma warn -rch
- #pragma warn -use
-#include <io.h>
-#include <stdlib.h>
-#define YY_USE_CONST
-#define YY_USE_PROTOS
-#endif
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-#undef YY_USE_PROTOS
-#define YY_USE_PROTOS
-
-#ifdef YY_USE_PROTOS
-#define YY_PROTO(proto) proto
-#else
-#define YY_PROTO(proto) ()
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yy_start - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( SCNG(yy_in) TSRMLS_CC )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#define YY_BUF_SIZE 16384
-
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-
-extern int yyleng;
-%-
-%*
-
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-/* The funky do-while in the following #define is used to turn the definition
- * int a single C statement (which needs a semi-colon terminator). This
- * avoids problems with code like:
- *
- * if ( condition_holds )
- * yyless( 5 );
- * else
- * do_something_else();
- *
- * Prior to using the do-while the compiler would get upset at the
- * "else" because it interpreted the "if" statement as being all
- * done when it reached the ';' after the yyless() call.
- */
-
-/* Return all but the first 'n' matched characters back to the input stream. */
-
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- *yy_cp = yy_hold_char; \
- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-
-#define unput(c) yyunput( c, yytext_ptr TSRMLS_CC )
-
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-typedef unsigned int yy_size_t;
-
-
-struct yy_buffer_state
- {
-%-
- FILE *yy_input_file;
-%+
- istream* yy_input_file;
-%*
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
- };
-
-%- Standard (non-C++) definition
-#define yy_current_buffer SCNG(current_buffer)
-#define yy_hold_char SCNG(_yy_hold_char)
-%*
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- */
-#define YY_CURRENT_BUFFER yy_current_buffer
-
-
-%- Standard (non-C++) definition
-/* yy_hold_char holds the character lost when yytext is formed. */
-
-#if 0
-static char yy_hold_char;
-
-static int yy_n_chars; /* number of characters read into yy_ch_buf */
-#endif
-
-/* Points to current character in buffer. */
-#define yy_c_buf_p SCNG(c_buf_p)
-#define yy_init SCNG(init)
-#define yy_start SCNG(start)
-
-#ifdef ZTS
-#define TSRMLS_D void ***tsrm_ls
-#define TSRMLS_DC , TSRMLS_D
-#define TSRMLS_C tsrm_ls
-#define TSRMLS_CC , TSRMLS_C
-#else
-#define TSRMLS_D
-#define TSRMLS_DC
-#define TSRMLS_C
-#define TSRMLS_CC
-#endif
-
-/* Flag which is used to allow yywrap()'s to do buffer switches
- * instead of setting up a fresh yyin. A bit of a hack ...
- */
-/* static int yy_did_buffer_switch_on_eof; */
-#define yy_did_buffer_switch_on_eof SCNG(_yy_did_buffer_switch_on_eof)
-
-void yyrestart YY_PROTO(( FILE *input_file TSRMLS_DC ));
-
-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer TSRMLS_DC ));
-void yy_load_buffer_state YY_PROTO(( TSRMLS_D ));
-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size TSRMLS_DC ));
-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b TSRMLS_DC ));
-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file TSRMLS_DC ));
-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b TSRMLS_DC ));
-#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer TSRMLS_CC )
-
-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size TSRMLS_DC ));
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str TSRMLS_DC ));
-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len TSRMLS_DC ));
-
-%*
-
-static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
-static void yy_flex_free YY_PROTO(( void * ));
-
-#define yy_new_buffer yy_create_buffer
-
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \
- yy_current_buffer->yy_is_interactive = is_interactive; \
- }
-
-#define yy_set_bol(at_bol) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \
- yy_current_buffer->yy_at_bol = at_bol; \
- }
-
-#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
-
-%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
-#undef yyleng
-#define yyleng SCNG(yy_leng)
-#undef yytext
-#define yytext SCNG(yy_text)
-#undef yytext_ptr
-#define yytext_ptr SCNG(yy_text)
-#undef yyin
-#define yyin SCNG(yy_in)
-#undef yyout
-#define yyout SCNG(yy_out)
-#undef yy_last_accepting_state
-#define yy_last_accepting_state SCNG(_yy_last_accepting_state)
-#undef yy_last_accepting_cpos
-#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos)
-#undef yy_more_flag
-#define yy_more_flag SCNG(_yy_more_flag)
-#undef yy_more_len
-#define yy_more_len SCNG(_yy_more_len)
-
-
-%- Standard (non-C++) definition
-static yy_state_type yy_get_previous_state YY_PROTO(( TSRMLS_D ));
-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state TSRMLS_DC ));
-static int yy_get_next_buffer YY_PROTO(( TSRMLS_D ));
-static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
-%*
-
-#undef TSRMLS_D
-#undef TSRMLS_DC
-#undef TSRMLS_C
-#undef TSRMLS_CC
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- yytext_ptr = yy_bp; \
-%% code to fiddle yytext and yyleng for yymore() goes here
- yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
-%% code to copy yytext_ptr to yytext[] goes here, if %array
- yy_c_buf_p = yy_cp;
-
-#undef yyleng
-#undef yytext
-#undef yytext_ptr
-#undef yyin
-#undef yyout
-#undef yy_last_accepting_state
-#undef yy_last_accepting_cpos
-#undef yy_more_flag
-#undef yy_more_len
-
-
-%% data tables for the DFA and the user's section 1 definitions go here
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap YY_PROTO(( void ));
-#else
-extern int yywrap YY_PROTO(( void ));
-#endif
-#endif
-
-%-
-#ifndef YY_NO_UNPUT
-static void yyunput YY_PROTO(( int c, char *buf_ptr TSRMLS_DC ));
-#endif
-%*
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen YY_PROTO(( yyconst char * ));
-#endif
-
-#ifndef YY_NO_INPUT
-%- Standard (non-C++) definition
-#ifdef __cplusplus
-static int 3 YY_PROTO(( TSRMLS_D ));
-#else
-static int input YY_PROTO(( TSRMLS_D ));
-#endif
-%*
-#endif
-
-#if YY_STACK_USED
-#define yy_start_stack_ptr SCNG(yy_start_stack_ptr)
-#define yy_start_stack_depth SCNG(yy_start_stack_depth)
-#define yy_start_stack SCNG(yy_start_stack)
-/*
-static int yy_start_stack_ptr = 0;
-static int yy_start_stack_depth = 0;
-static int *yy_start_stack = 0;
-*/
-#ifndef YY_NO_PUSH_STATE
-static void yy_push_state YY_PROTO(( int new_state TSRMLS_DC ));
-#endif
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state YY_PROTO(( TSRMLS_D ));
-#endif
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state YY_PROTO(( TSRMLS_D ));
-#endif
-
-#else
-#define YY_NO_PUSH_STATE 1
-#define YY_NO_POP_STATE 1
-#define YY_NO_TOP_STATE 1
-#endif
-
-#ifdef YY_MALLOC_DECL
-YY_MALLOC_DECL
-#else
-#if __STDC__
-#ifndef __cplusplus
-#include <stdlib.h>
-#endif
-#else
-/* Just try to get by without declaring the routines. This will fail
- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
- * or sizeof(void*) != sizeof(int).
- */
-#endif
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-
-#ifndef ECHO
-%- Standard (non-C++) definition
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO (void) fwrite( yytext, yyleng, 1, SCNG(yy_out) )
-%+ C++ definition
-#define ECHO LexerOutput( yytext, yyleng )
-%*
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
-%% fread()/read() definition of YY_INPUT goes here unless we're doing C++
-%+ C++ definition
- if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
- YY_FATAL_ERROR( "input in flex scanner failed" );
-%*
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-%-
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
-%+
-#define YY_FATAL_ERROR(msg) LexerError( msg )
-%*
-#endif
-
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-%- Standard (non-C++) definition
-#define YY_DECL int yylex YY_PROTO(( void ))
-%+ C++ definition
-#define YY_DECL int yyFlexLexer::yylex()
-%*
-#endif
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-%% YY_RULE_SETUP definition goes here
-
-YY_DECL
- {
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
-
-%% user's declarations go here
-
- if ( yy_init )
- {
- yy_init = 0;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! yy_start )
- yy_start = 1; /* first start state */
-
- if ( ! SCNG(yy_in) )
-%-
- SCNG(yy_in) = stdin;
-%+
- SCNG(yy_in) = &cin;
-%*
-
- if ( ! SCNG(yy_out) )
-%-
- SCNG(yy_out) = stdout;
-%+
- SCNG(yy_out) = &cout;
-%*
-
- if ( ! yy_current_buffer )
- yy_current_buffer =
- yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC );
-
- yy_load_buffer_state(TSRMLS_C);
- }
-
- while ( 1 ) /* loops until end-of-file is reached */
- {
-%% yymore()-related code goes here
- yy_cp = yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
-%% code to set up and find next match goes here
-
-yy_find_action:
-%% code to find the action number goes here
-
- YY_DO_BEFORE_ACTION;
-
-%% code for yylineno update goes here
-
-do_action: /* This label is used only to access EOF actions. */
-
-%% debug code goes here
-
- switch ( yy_act )
- { /* beginning of action switch */
-%% actions go here
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yy_hold_char;
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between yy_current_buffer and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars;
- yy_current_buffer->yy_input_file = SCNG(yy_in);
- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state(TSRMLS_C);
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state TSRMLS_CC );
-
- yy_bp = yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
-%% code to do back-up for compressed tables and set up yy_cp goes here
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer(TSRMLS_C) )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yy_did_buffer_switch_on_eof = 0;
-
- if ( yywrap() )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p =
- yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state(TSRMLS_C);
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yy_c_buf_p =
- &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)];
-
- yy_current_state = yy_get_previous_state(TSRMLS_C);
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of yylex */
-
-%+
-yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
- {
- SCNG(yy_in) = arg_yyin;
- SCNG(yy_out) = arg_yyout;
- yy_c_buf_p = 0;
- yy_init = 1;
- yy_start = 0;
- yy_flex_debug = 0;
- yylineno = 1; // this will only get updated if %option yylineno
-
- yy_did_buffer_switch_on_eof = 0;
-
- yy_looking_for_trail_begin = 0;
- yy_more_flag = 0;
- yy_more_len = 0;
- yy_more_offset = yy_prev_more_offset = 0;
-
- yy_start_stack_ptr = yy_start_stack_depth = 0;
- yy_start_stack = 0;
-
- yy_current_buffer = 0;
-
-#ifdef YY_USES_REJECT
- yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
-#else
- yy_state_buf = 0;
-#endif
- }
-
-yyFlexLexer::~yyFlexLexer()
- {
- delete yy_state_buf;
- yy_delete_buffer( yy_current_buffer TSRMLS_CC );
- }
-
-void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
- {
- if ( new_in )
- {
- yy_delete_buffer( SCNG(yy_current_buffer TSRMLS_CC ) );
- yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE TSRMLS_CC ) TSRMLS_CC );
- }
-
- if ( new_out )
- SCNG(yy_out) = new_out;
- }
-
-int yyFlexLexer::LexerInput( char* buf, int max_size )
- {
- if ( SCNG(yy_in)->eof() || SCNG(yy_in)->fail() )
- return 0;
-
- if (yy_current_buffer->yy_is_interactive) {
- SCNG(yy_in)->get( buf[0] );
-
- if ( SCNG(yy_in)->eof() )
- return 0;
-
- if ( SCNG(yy_in)->bad() )
- return -1;
-
- return 1;
- } else {
- (void) SCNG(yy_in)->read( buf, max_size );
-
- if ( SCNG(yy_in)->bad() )
- return -1;
- else
- return SCNG(yy_in)->gcount();
- }
- }
-
-void yyFlexLexer::LexerOutput( const char* buf, int size )
- {
- (void) SCNG(yy_out)->write( buf, size );
- }
-%*
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-
-%-
-static int yy_get_next_buffer(TSRMLS_D)
-%+
-int yyFlexLexer::yy_get_next_buffer(TSRMLS_D)
-%*
- {
- register char *dest = yy_current_buffer->yy_ch_buf;
- register char *source = yytext_ptr;
- register int number_to_move, i;
- int ret_val;
-
- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( yy_current_buffer->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- yy_current_buffer->yy_n_chars = SCNG(yy_n_chars) = 0;
-
- else
- {
- int num_to_read =
- yy_current_buffer->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-#ifdef YY_USES_REJECT
- YY_FATAL_ERROR(
-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
-#else
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = yy_current_buffer;
-
- int yy_c_buf_p_offset =
- (int) (yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- int new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- yy_flex_realloc( (void *) b->yy_ch_buf,
- b->yy_buf_size + 2 );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = yy_current_buffer->yy_buf_size -
- number_to_move - 1;
-#endif
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
- SCNG(yy_n_chars), num_to_read );
-
- yy_current_buffer->yy_n_chars = SCNG(yy_n_chars);
- }
-
- if ( SCNG(yy_n_chars) == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( SCNG(yy_in) TSRMLS_CC );
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- yy_current_buffer->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- SCNG(yy_n_chars) += number_to_move;
- yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
- yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
-
- yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
-
- return ret_val;
- }
-
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-%-
-static yy_state_type yy_get_previous_state(TSRMLS_D)
-%+
-yy_state_type yyFlexLexer::yy_get_previous_state(TSRMLS_D)
-%*
- {
- register yy_state_type yy_current_state;
- register char *yy_cp;
-
-%% code to get the start state into yy_current_state goes here
-
- for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
- {
-%% code to find the next state goes here
- }
-
- return yy_current_state;
- }
-
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
-
-%-
-#ifdef YY_USE_PROTOS
-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state TSRMLS_DC )
-#else
-static yy_state_type yy_try_NUL_trans( yy_current_state TSRMLS_CC )
-yy_state_type yy_current_state;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state TSRMLS_DC )
-%*
- {
- register int yy_is_jam;
-%% code to find the next state, and perhaps do backing up, goes here
-
- return yy_is_jam ? 0 : yy_current_state;
- }
-
-
-%-
-#ifndef YY_NO_UNPUT
-#ifdef YY_USE_PROTOS
-static void yyunput( int c, register char *yy_bp TSRMLS_DC )
-#else
-static void yyunput( c, yy_bp TSRMLS_CC )
-int c;
-register char *yy_bp;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yyunput( int c, register char* yy_bp TSRMLS_DC )
-%*
- {
- register char *yy_cp = yy_c_buf_p;
-
- /* undo effects of setting up yytext */
- *yy_cp = yy_hold_char;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- { /* need to shift things up to make room */
- /* +2 for EOB chars. */
- register int number_to_move = SCNG(yy_n_chars) + 2;
- register char *dest = &yy_current_buffer->yy_ch_buf[
- yy_current_buffer->yy_buf_size + 2];
- register char *source =
- &yy_current_buffer->yy_ch_buf[number_to_move];
-
- while ( source > yy_current_buffer->yy_ch_buf )
- *--dest = *--source;
-
- yy_cp += (int) (dest - source);
- yy_bp += (int) (dest - source);
- yy_current_buffer->yy_n_chars =
- SCNG(yy_n_chars) = yy_current_buffer->yy_buf_size;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
-
- *--yy_cp = (char) c;
-
-%% update yylineno here
-
- yytext_ptr = yy_bp;
- yy_hold_char = *yy_cp;
- yy_c_buf_p = yy_cp;
- }
-%-
-#endif /* ifndef YY_NO_UNPUT */
-%*
-
-
-%-
-#ifdef __cplusplus
-static int yyinput(TSRMLS_D)
-#else
-static int input(TSRMLS_C)
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-int yyFlexLexer::yyinput(TSRMLS_D)
-%*
- {
- int c;
-
- *yy_c_buf_p = yy_hold_char;
-
- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] )
- /* This was really a NUL. */
- *yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = yy_c_buf_p - yytext_ptr;
- ++yy_c_buf_p;
-
- switch ( yy_get_next_buffer(TSRMLS_C) )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- yyrestart( SCNG(yy_in) TSRMLS_CC );
-
- /* fall through */
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap() )
- return EOF;
-
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput(TSRMLS_C);
-#else
- return input(TSRMLS_C);
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p = yytext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
- *yy_c_buf_p = '\0'; /* preserve yytext */
- yy_hold_char = *++yy_c_buf_p;
-
-%% update BOL and yylineno
-
- return c;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yyrestart( FILE *input_file TSRMLS_DC )
-#else
-void yyrestart( input_file TSRMLS_CC )
-FILE *input_file;
-#endif
-%+
-void yyFlexLexer::yyrestart( istream* input_file TSRMLS_DC )
-%*
- {
- if ( ! yy_current_buffer )
- yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC );
-
- yy_init_buffer( yy_current_buffer, input_file TSRMLS_CC );
- yy_load_buffer_state(TSRMLS_C);
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer TSRMLS_DC)
-#else
-void yy_switch_to_buffer( new_buffer TSRMLS_CC)
-YY_BUFFER_STATE new_buffer;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer TSRMLS_DC )
-%*
- {
- if ( yy_current_buffer == new_buffer )
- return;
-
- if ( yy_current_buffer )
- {
- /* Flush out information for old buffer. */
- *yy_c_buf_p = yy_hold_char;
- yy_current_buffer->yy_buf_pos = yy_c_buf_p;
- yy_current_buffer->yy_n_chars = SCNG(yy_n_chars);
- }
-
- yy_current_buffer = new_buffer;
- yy_load_buffer_state(TSRMLS_C);
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yy_did_buffer_switch_on_eof = 1;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_load_buffer_state( TSRMLS_D )
-#else
-void yy_load_buffer_state(TSRMLS_C)
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yy_load_buffer_state()
-%*
- {
- SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars;
- yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
- SCNG(yy_in) = yy_current_buffer->yy_input_file;
- yy_hold_char = *yy_c_buf_p;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_create_buffer( FILE *file, int size TSRMLS_DC )
-#else
-YY_BUFFER_STATE yy_create_buffer( file, size TSRMLS_CC )
-FILE *file;
-int size;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size TSRMLS_DC )
-%*
- {
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- yy_init_buffer( b, file TSRMLS_CC );
-
- return b;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_delete_buffer( YY_BUFFER_STATE b TSRMLS_DC )
-#else
-void yy_delete_buffer( b TSRMLS_CC )
-YY_BUFFER_STATE b;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b TSRMLS_DC )
-%*
- {
- if ( ! b )
- return;
-
- if ( b == yy_current_buffer )
- yy_current_buffer = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- yy_flex_free( (void *) b->yy_ch_buf );
-
- yy_flex_free( (void *) b );
- }
-
-
-%-
-#ifndef YY_ALWAYS_INTERACTIVE
-#ifndef YY_NEVER_INTERACTIVE
-ZEND_DLIMPORT int isatty YY_PROTO(( int ));
-#endif
-#endif
-
-#ifdef YY_USE_PROTOS
-void yy_init_buffer( YY_BUFFER_STATE b, FILE *file TSRMLS_DC )
-#else
-void yy_init_buffer( b, file TSRMLS_CC )
-YY_BUFFER_STATE b;
-FILE *file;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-
-%+
-extern "C" int isatty YY_PROTO(( int ));
-void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file TSRMLS_DC )
-%*
-
- {
- yy_flush_buffer( b TSRMLS_CC );
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
-%-
-#if YY_ALWAYS_INTERACTIVE
- b->yy_is_interactive = 1;
-#else
-#if YY_NEVER_INTERACTIVE
- b->yy_is_interactive = 0;
-#else
- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-#endif
-#endif
-%+
- b->yy_is_interactive = (file == (istream *) &cin) ? 1 : 0;
-%*
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_flush_buffer( YY_BUFFER_STATE b TSRMLS_DC )
-#else
-void yy_flush_buffer( b TSRMLS_CC )
-YY_BUFFER_STATE b;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-
-%+
-void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b TSRMLS_DC )
-%*
- {
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == yy_current_buffer )
- yy_load_buffer_state(TSRMLS_C);
- }
-%*
-
-
-#ifndef YY_NO_SCAN_BUFFER
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size TSRMLS_DC )
-#else
-YY_BUFFER_STATE yy_scan_buffer( base, size TSRMLS_CC )
-char *base;
-yy_size_t size;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
- {
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- yy_switch_to_buffer( b TSRMLS_CC );
-
- return b;
- }
-%*
-#endif
-
-
-#ifndef YY_NO_SCAN_STRING
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str TSRMLS_DC )
-#else
-YY_BUFFER_STATE yy_scan_string( yy_str TSRMLS_CC )
-yyconst char *yy_str;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
- {
- int len;
- for ( len = 0; yy_str[len]; ++len )
- ;
-
- return yy_scan_bytes( yy_str, len TSRMLS_CC );
- }
-%*
-#endif
-
-
-#ifndef YY_NO_SCAN_BYTES
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len TSRMLS_DC )
-#else
-YY_BUFFER_STATE yy_scan_bytes( bytes, len TSRMLS_CC )
-yyconst char *bytes;
-int len;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
- {
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = len + 2;
- buf = (char *) yy_flex_alloc( n );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
- for ( i = 0; i < len; ++i )
- buf[i] = bytes[i];
-
- buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = yy_scan_buffer( buf, n TSRMLS_CC);
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
- }
-%*
-#endif
-
-
-#ifndef YY_NO_PUSH_STATE
-%-
-#ifdef YY_USE_PROTOS
-static void yy_push_state( int new_state TSRMLS_DC )
-#else
-static void yy_push_state( new_state TSRMLS_CC )
-int new_state;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yy_push_state( int new_state TSRMLS_DC )
-%*
- {
- if ( yy_start_stack_ptr >= yy_start_stack_depth )
- {
- yy_size_t new_size;
-
- yy_start_stack_depth += YY_START_STACK_INCR;
- new_size = yy_start_stack_depth * sizeof( int );
-
- if ( ! yy_start_stack )
- yy_start_stack = (int *) yy_flex_alloc( new_size );
-
- else
- yy_start_stack = (int *) yy_flex_realloc(
- (void *) yy_start_stack, new_size );
-
- if ( ! yy_start_stack )
- YY_FATAL_ERROR(
- "out of memory expanding start-condition stack" );
- }
-
- yy_start_stack[yy_start_stack_ptr++] = YY_START;
-
- BEGIN(new_state);
- }
-#endif
-
-
-#ifndef YY_NO_POP_STATE
-%-
-static void yy_pop_state(TSRMLS_D)
-%+
-void yyFlexLexer::yy_pop_state(TSRMLS_D)
-%*
- {
- if ( --yy_start_stack_ptr < 0 )
- YY_FATAL_ERROR( "start-condition stack underflow" );
-
- BEGIN(yy_start_stack[yy_start_stack_ptr]);
- }
-#endif
-
-
-#ifndef YY_NO_TOP_STATE
-%-
-static int yy_top_state(TSRMLS_D)
-%+
-int yyFlexLexer::yy_top_state()
-%*
- {
- return yy_start_stack[yy_start_stack_ptr - 1];
- }
-#endif
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-%-
-#ifdef YY_USE_PROTOS
-static void yy_fatal_error( yyconst char msg[] )
-#else
-static void yy_fatal_error( msg )
-char msg[];
-#endif
- {
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
- }
-
-%+
-
-void yyFlexLexer::LexerError( yyconst char msg[] )
- {
- cerr << msg << '\n';
- exit( YY_EXIT_FAILURE );
- }
-%*
-
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- yytext[yyleng] = yy_hold_char; \
- yy_c_buf_p = yytext + n; \
- yy_hold_char = *yy_c_buf_p; \
- *yy_c_buf_p = '\0'; \
- yyleng = n; \
- } \
- while ( 0 )
-
-
-/* Internal utility routines. */
-
-#ifndef yytext_ptr
-#ifdef YY_USE_PROTOS
-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
-#else
-static void yy_flex_strncpy( s1, s2, n )
-char *s1;
-yyconst char *s2;
-int n;
-#endif
- {
- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
- }
-#endif
-
-#ifdef YY_NEED_STRLEN
-#ifdef YY_USE_PROTOS
-static int yy_flex_strlen( yyconst char *s )
-#else
-static int yy_flex_strlen( s )
-yyconst char *s;
-#endif
- {
- register int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
- }
-#endif
-
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_alloc( yy_size_t size )
-#else
-static void *yy_flex_alloc( size )
-yy_size_t size;
-#endif
- {
- return (void *) malloc( size );
- }
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_realloc( void *ptr, yy_size_t size )
-#else
-static void *yy_flex_realloc( ptr, size )
-void *ptr;
-yy_size_t size;
-#endif
- {
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
- }
-
-#ifdef YY_USE_PROTOS
-static void yy_flex_free( void *ptr )
-#else
-static void yy_flex_free( ptr )
-void *ptr;
-#endif
- {
- free( ptr );
- }
-
-#if YY_MAIN
-int main()
- {
- yylex();
- return 0;
- }
-#endif
diff --git a/Zend/tests/zend2.php b/Zend/tests/zend2.php
deleted file mode 100644
index 07d0a766d4..0000000000
--- a/Zend/tests/zend2.php
+++ /dev/null
@@ -1,339 +0,0 @@
-Example 1: A singleton (static members)
-=======================================
-
-<?php
-
- class Counter {
- var $counter = 0;
-
- function increment_and_print()
- {
- print ++$this->counter;
- print "\n";
- }
- }
-
-
- class SingletonCounter {
- static $m_instance = NULL;
-
- function Instance()
- {
- if (self::$m_instance == NULL) {
- self::$m_instance = new Counter();
- }
- return self::$m_instance;
- }
- }
-
- SingletonCounter::Instance()->increment_and_print();
- SingletonCounter::Instance()->increment_and_print();
- SingletonCounter::Instance()->increment_and_print();
-
-?>
-
-Example 2: Factory method (derefencing objects returned from functions)
-=======================================================================
-
-<?php
-
- class Circle {
- function draw()
- {
- print "Circle\n";
- }
- }
-
- class Square {
- function draw()
- {
- print "Square\n";
- }
- }
-
- function ShapeFactoryMethod($shape)
- {
- switch ($shape) {
- case "Circle":
- return new Circle();
- case "Square":
- return new Square();
- }
- }
-
- ShapeFactoryMethod("Circle")->draw();
- ShapeFactoryMethod("Square")->draw();
-
-
-?>
-
-Example 3: Nested class
-=======================
-
-<?php
-
- class Database {
- class MySQL {
- var $host = "";
-
- function db_connect($user) {
- print "Connecting to MySQL database '$this->host' as $user\n";
- }
- }
-
- class Oracle {
- var $host = "localhost";
-
- function db_connect($user) {
- print "Connecting to Oracle database '$this->host' as $user\n";
- }
-
- }
- }
-
- $MySQL_obj = new Database::MySQL();
- $MySQL_obj->db_connect("John");
-
- $Oracle_obj = new Database::Oracle();
- $Oracle_obj->db_connect("Mark");
-
- unset($MySQL_obj);
- unset($Oracle_obj);
-?>
-
-Example 3: Nested class suitable for a PEAR like hierarchy
-==========================================================
-
-<?php
-
- class DB::MySQL {
- var $host = "";
-
- function db_connect($user) {
- print "Connecting to MySQL database '$this->host' as $user\n";
- }
- }
-
- class DB::Oracle {
- var $host = "localhost";
-
- function db_connect($user) {
- print "Connecting to Oracle database '$this->host' as $user\n";
- }
-
- }
-
- $MySQL_obj = new DB::MySQL();
- $MySQL_obj->db_connect("Susan");
-
- $Oracle_obj = new DB::Oracle();
- $Oracle_obj->db_connect("Barbara");
-
-?>
-
-Example 4: Class constants and class scope
-==========================================
-
-<?php
-
- class ErrorCodes {
- const FATAL = "Fatal error\n";
- const WARNING = "Warning\n";
- const INFO = "Informational message\n";
-
- function print_fatal_error_codes()
- {
- print "FATAL = " . FATAL;
- print "self::FATAL = " . self::FATAL;
- }
- }
-
- /* Call the static function and move into the ErrorCodes scope */
- ErrorCodes::print_fatal_error_codes();
-
-?>
-
-Example 5: Regular object method using both local and global functions
-======================================================================
-
-<?php
-
- class HelloWorld {
- const HELLO_WORLD = "Hello, World!\n";
-
- function get_hello_world()
- {
- return HELLO_WORLD;
- }
-
- function length_of_hello_world()
- {
- $str = $this->get_hello_world();
- return strlen($str);
- }
- }
-
- $obj = new HelloWorld();
- print "length_of_hello_world() = " . $obj->length_of_hello_world();
- print "\n";
-?>
-
-Example 6: Multiple derefencing of objects returned from methods
-================================================================
-
-<?php
-
-
- class Name {
- function Name($_name)
- {
- $this->name = $_name;
- }
-
- function display()
- {
- print $this->name;
- print "\n";
- }
- }
-
- class Person {
- function Person($_name, $_address)
- {
- $this->name = new Name($_name);
- }
-
- function getName()
- {
- return $this->name;
- }
- }
-
- $person = new Person("John", "New York");
- $person->getName()->display();
-
-?>
-
-Example 7: Exception handling
-=============================
-
-<?
- class MyException {
- function MyException($_error) {
- $this->error = $_error;
- }
-
- function getException()
- {
- return $this->error;
- }
- }
-
- function ThrowException()
- {
- throw new MyException("'This is an exception!'");
- }
-
-
- try {
- } catch (MyException $exception) {
- print "There was an exception: " . $exception->getException();
- print "\n";
- }
-
- try {
- ThrowException();
- } catch (MyException $exception) {
- print "There was an exception: " . $exception->getException();
- print "\n";
- }
-
-?>
-
-Example 8: __clone()
-===================
-
-<?
- class MyCloneable {
- static $id = 0;
-
- function MyCloneable()
- {
- $this->id = self::$id++;
- }
-
- function __clone()
- {
- $this->name = $clone->name;
- $this->address = "New York";
- $this->id = self::$id++;
- }
- }
-
-
-
- $obj = new MyCloneable();
-
- $obj->name = "Hello";
- $obj->address = "Tel-Aviv";
-
- print $obj->id;
- print "\n";
-
- $obj = $obj->__clone();
-
- print $obj->id;
- print "\n";
- print $obj->name;
- print "\n";
- print $obj->address;
- print "\n";
-?>
-
-Example 9: Unified constructors
-===============================
-
-<?
-
- class BaseClass {
- function __construct()
- {
- print "In BaseClass constructor\n";
- }
- }
-
- class SubClass extends BaseClass {
- function __construct()
- {
- parent::__construct();
- print "In SubClass constructor\n";
- }
- }
-
- $obj = new BaseClass();
-
- $obj = new SubClass();
-
-?>
-
-Example 10: Destructors
-=======================
-
-<?php
-
-class MyDestructableClass {
- function __construct()
- {
- print "In constructor\n";
- $this->name = "MyDestructableClass";
- }
-
- function __destruct()
- {
- print "Destroying " . $this->name . "\n";
- }
-}
-
-$obj = new MyDestructableClass();
-
-?>
diff --git a/Zend/zend.c b/Zend/zend.c
deleted file mode 100644
index e3a467d446..0000000000
--- a/Zend/zend.c
+++ /dev/null
@@ -1,936 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "zend.h"
-#include "zend_extensions.h"
-#include "zend_modules.h"
-#include "zend_constants.h"
-#include "zend_list.h"
-#include "zend_API.h"
-#include "zend_builtin_functions.h"
-#include "zend_ini.h"
-
-#ifdef ZTS
-# define GLOBAL_FUNCTION_TABLE &global_main_class.function_table
-# define GLOBAL_CLASS_TABLE &global_main_class.class_table
-# define GLOBAL_CONSTANTS_TABLE &global_main_class.constants_table
-# define GLOBAL_AUTO_GLOBALS_TABLE global_auto_globals_table
-#else
-# define GLOBAL_FUNCTION_TABLE CG(function_table)
-# define GLOBAL_CLASS_TABLE CG(class_table)
-# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals)
-#endif
-
-#if defined(ZEND_WIN32) && ZEND_DEBUG
-BOOL WINAPI IsDebuggerPresent(VOID);
-#endif
-
-/* true multithread-shared globals */
-ZEND_API zend_class_entry *zend_standard_class_def = NULL;
-ZEND_API int (*zend_printf)(const char *format, ...);
-ZEND_API zend_write_func_t zend_write;
-ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path);
-ZEND_API void (*zend_block_interruptions)(void);
-ZEND_API void (*zend_unblock_interruptions)(void);
-ZEND_API void (*zend_ticks_function)(int ticks);
-ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
-
-void (*zend_on_timeout)(int seconds TSRMLS_DC);
-
-static void (*zend_message_dispatcher_p)(long message, void *data);
-static int (*zend_get_configuration_directive_p)(char *name, uint name_length, zval *contents);
-
-
-#ifdef ZTS
-ZEND_API int compiler_globals_id;
-ZEND_API int executor_globals_id;
-ZEND_API int alloc_globals_id;
-zend_class_entry global_main_class;
-HashTable *global_auto_globals_table;
-#endif
-
-ZEND_API zend_utility_values zend_uv;
-
-ZEND_API zval zval_used_for_init; /* True global variable */
-
-/* version information */
-static char *zend_version_info;
-static uint zend_version_info_length;
-#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2002 Zend Technologies\n"
-
-
-#define PRINT_ZVAL_INDENT 4
-
-static void print_hash(HashTable *ht, int indent)
-{
- zval **tmp;
- char *string_key;
- HashPosition iterator;
- ulong num_key;
- uint str_len;
- int i;
-
- for (i=0; i<indent; i++) {
- ZEND_PUTS(" ");
- }
- ZEND_PUTS("(\n");
- indent += PRINT_ZVAL_INDENT;
- zend_hash_internal_pointer_reset_ex(ht, &iterator);
- while (zend_hash_get_current_data_ex(ht, (void **) &tmp, &iterator) == SUCCESS) {
- for (i=0; i<indent; i++) {
- ZEND_PUTS(" ");
- }
- ZEND_PUTS("[");
- switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) {
- case HASH_KEY_IS_STRING:
- ZEND_PUTS(string_key);
- break;
- case HASH_KEY_IS_LONG:
- zend_printf("%ld", num_key);
- break;
- }
- ZEND_PUTS("] => ");
- zend_print_zval_r(*tmp, indent+PRINT_ZVAL_INDENT);
- ZEND_PUTS("\n");
- zend_hash_move_forward_ex(ht, &iterator);
- }
- indent -= PRINT_ZVAL_INDENT;
- for (i=0; i<indent; i++) {
- ZEND_PUTS(" ");
- }
- ZEND_PUTS(")\n");
-}
-
-
-ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy)
-{
- if (expr->type==IS_STRING) {
- *use_copy = 0;
- return;
- }
- switch (expr->type) {
- case IS_NULL:
- expr_copy->value.str.len = 0;
- expr_copy->value.str.val = empty_string;
- break;
- case IS_BOOL:
- if (expr->value.lval) {
- expr_copy->value.str.len = 1;
- expr_copy->value.str.val = estrndup("1", 1);
- } else {
- expr_copy->value.str.len = 0;
- expr_copy->value.str.val = empty_string;
- }
- break;
- case IS_RESOURCE:
- expr_copy->value.str.val = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG);
- expr_copy->value.str.len = sprintf(expr_copy->value.str.val, "Resource id #%ld", expr->value.lval);
- break;
- case IS_ARRAY:
- expr_copy->value.str.len = sizeof("Array")-1;
- expr_copy->value.str.val = estrndup("Array", expr_copy->value.str.len);
- break;
- case IS_OBJECT:
- expr_copy->value.str.val = (char *) emalloc(sizeof("Object id #")-1 + MAX_LENGTH_OF_LONG);
- expr_copy->value.str.len = sprintf(expr_copy->value.str.val, "Object id #%ld", (long)expr->value.obj.handle);
-#if 0
- /* FIXME: This might break BC for some people */
- expr_copy->value.str.len = sizeof("Object")-1;
- expr_copy->value.str.val = estrndup("Object", expr_copy->value.str.len);
-#endif
- break;
- default:
- *expr_copy = *expr;
- zval_copy_ctor(expr_copy);
- convert_to_string(expr_copy);
- break;
- }
- expr_copy->type = IS_STRING;
- *use_copy = 1;
-}
-
-
-ZEND_API int zend_print_zval(zval *expr, int indent)
-{
- return zend_print_zval_ex(zend_write, expr, indent);
-}
-
-
-ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent)
-{
- zval expr_copy;
- int use_copy;
-
- zend_make_printable_zval(expr, &expr_copy, &use_copy);
- if (use_copy) {
- expr = &expr_copy;
- }
- if (expr->value.str.len==0) { /* optimize away empty strings */
- if (use_copy) {
- zval_dtor(expr);
- }
- return 0;
- }
- write_func(expr->value.str.val, expr->value.str.len);
- if (use_copy) {
- zval_dtor(expr);
- }
- return expr->value.str.len;
-}
-
-
-ZEND_API void zend_print_zval_r(zval *expr, int indent)
-{
- zend_print_zval_r_ex(zend_write, expr, indent);
-}
-
-
-ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent)
-{
- switch(expr->type) {
- case IS_ARRAY:
- ZEND_PUTS("Array\n");
- if (++expr->value.ht->nApplyCount>1) {
- ZEND_PUTS(" *RECURSION*");
- expr->value.ht->nApplyCount--;
- return;
- }
- print_hash(expr->value.ht, indent);
- expr->value.ht->nApplyCount--;
- break;
- case IS_OBJECT:
- {
- zend_object *object = Z_OBJ_P(expr);
-
- if (++object->properties->nApplyCount>1) {
- ZEND_PUTS(" *RECURSION*");
- object->properties->nApplyCount--;
- return;
- }
- zend_printf("%s Object\n", object->ce->name);
- print_hash(object->properties, indent);
- object->properties->nApplyCount--;
- break;
- }
- default:
- zend_print_variable(expr);
- break;
- }
-}
-
-
-static FILE *zend_fopen_wrapper(const char *filename, char **opened_path)
-{
- if (opened_path) {
- *opened_path = estrdup(filename);
- }
- return fopen(filename, "rb");
-}
-
-
-static void register_standard_class(void)
-{
- zend_standard_class_def = malloc(sizeof(zend_class_entry));
-
- zend_standard_class_def->type = ZEND_INTERNAL_CLASS;
- zend_standard_class_def->name_length = sizeof("stdClass") - 1;
- zend_standard_class_def->name = zend_strndup("stdClass", zend_standard_class_def->name_length);
- zend_standard_class_def->parent = NULL;
- zend_hash_init_ex(&zend_standard_class_def->default_properties, 0, NULL, ZVAL_PTR_DTOR, 1, 0);
- zend_hash_init_ex(&zend_standard_class_def->private_properties, 0, NULL, ZVAL_PTR_DTOR, 1, 0);
- zend_hash_init_ex(&zend_standard_class_def->protected_properties, 0, NULL, ZVAL_PTR_DTOR, 1, 0);
- zend_standard_class_def->static_members = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init_ex(zend_standard_class_def->static_members, 0, NULL, ZVAL_PTR_DTOR, 1, 0);
- zend_hash_init_ex(&zend_standard_class_def->constants_table, 0, NULL, ZVAL_PTR_DTOR, 1, 0);
- zend_hash_init_ex(&zend_standard_class_def->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
- zend_hash_init_ex(&zend_standard_class_def->function_table, 0, NULL, ZEND_FUNCTION_DTOR, 1, 0);
- zend_standard_class_def->constructor = NULL;
- zend_standard_class_def->destructor = NULL;
- zend_standard_class_def->clone = NULL;
- zend_standard_class_def->handle_function_call = NULL;
- zend_standard_class_def->handle_property_get = NULL;
- zend_standard_class_def->handle_property_set = NULL;
- zend_standard_class_def->refcount = 1;
- zend_hash_add(GLOBAL_CLASS_TABLE, "stdclass", sizeof("stdclass"), &zend_standard_class_def, sizeof(zend_class_entry *), NULL);
-}
-
-
-static void zend_set_default_compile_time_values(TSRMLS_D)
-{
- /* default compile-time values */
- CG(asp_tags) = 0;
- CG(short_tags) = 1;
- CG(allow_call_time_pass_reference) = 1;
- CG(extended_info) = 0;
-}
-
-
-#ifdef ZTS
-static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS_DC)
-{
- zend_function tmp_func;
- zend_class_entry tmp_class;
-
- compiler_globals->compiled_filename = NULL;
-
- compiler_globals->function_table = &compiler_globals->main_class.function_table;
- zend_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
- zend_hash_copy(compiler_globals->function_table, GLOBAL_FUNCTION_TABLE, NULL, &tmp_func, sizeof(zend_function));
-
- compiler_globals->class_table = &compiler_globals->main_class.class_table;
- zend_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
- zend_hash_copy(compiler_globals->class_table, GLOBAL_CLASS_TABLE, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry *));
-
- zend_set_default_compile_time_values(TSRMLS_C);
-
- CG(interactive) = 0;
-
- compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, 0);
- zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, NULL, NULL, sizeof(void *) /* empty element */);
-}
-
-
-static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS_DC)
-{
- if (compiler_globals->function_table != GLOBAL_FUNCTION_TABLE) {
- zend_hash_destroy(compiler_globals->function_table);
- }
- if (compiler_globals->class_table != GLOBAL_CLASS_TABLE) {
- zend_hash_destroy(compiler_globals->class_table);
- }
- if (compiler_globals->auto_globals != global_auto_globals_table) {
- zend_hash_destroy(compiler_globals->auto_globals);
- free(compiler_globals->auto_globals);
- }
-}
-
-
-static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS_DC)
-{
- zend_startup_constants(TSRMLS_C);
- zend_copy_constants(EG(zend_constants), GLOBAL_CONSTANTS_TABLE);
- zend_init_rsrc_plist(TSRMLS_C);
- EG(lambda_count)=0;
- EG(user_error_handler) = NULL;
- EG(user_exception_handler) = NULL;
- EG(in_execution) = 0;
-}
-
-
-static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC)
-{
- zend_shutdown_constants(TSRMLS_C);
- zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
- zend_ini_shutdown(TSRMLS_C);
-}
-
-
-static void zend_new_thread_end_handler(THREAD_T thread_id TSRMLS_DC)
-{
- zend_copy_ini_directives(TSRMLS_C);
- zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC);
-}
-
-#endif
-
-
-static void alloc_globals_ctor(zend_alloc_globals *alloc_globals_p TSRMLS_DC)
-{
- start_memory_manager(TSRMLS_C);
-}
-
-
-static void alloc_globals_dtor(zend_alloc_globals *alloc_globals_p TSRMLS_DC)
-{
- shutdown_memory_manager(0, 1 TSRMLS_CC);
-}
-
-
-#ifdef __FreeBSD__
-/* FreeBSD floating point precision fix */
-#include <floatingpoint.h>
-#endif
-
-
-static void scanner_globals_ctor(zend_scanner_globals *scanner_globals_p TSRMLS_DC)
-{
- scanner_globals_p->c_buf_p = (char *) 0;
- scanner_globals_p->init = 1;
- scanner_globals_p->start = 0;
- scanner_globals_p->current_buffer = NULL;
- scanner_globals_p->yy_in = NULL;
- scanner_globals_p->yy_out = NULL;
- scanner_globals_p->_yy_more_flag = 0;
- scanner_globals_p->_yy_more_len = 0;
- scanner_globals_p->yy_start_stack_ptr = 0;
- scanner_globals_p->yy_start_stack_depth = 0;
- scanner_globals_p->yy_start_stack = 0;
-}
-
-
-int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions)
-{
-#ifdef ZTS
- zend_compiler_globals *compiler_globals;
- zend_executor_globals *executor_globals;
- void ***tsrm_ls;
-#ifdef ZTS
- extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
- extern ZEND_API ts_rsrc_id language_scanner_globals_id;
-#else
- extern zend_scanner_globals ini_scanner_globals;
- extern zend_scanner_globals language_scanner_globals;
-#endif
-
- ts_allocate_id(&alloc_globals_id, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, (ts_allocate_dtor) alloc_globals_dtor);
-#else
- alloc_globals_ctor(&alloc_globals TSRMLS_CC);
-#endif
-
-#ifdef __FreeBSD__
- /* FreeBSD floating point precision fix */
- fpsetmask(0);
-#endif
-
- zend_startup_extensions_mechanism();
-
- /* Set up utility functions and values */
- zend_error_cb = utility_functions->error_function;
- zend_printf = utility_functions->printf_function;
- zend_write = (zend_write_func_t) utility_functions->write_function;
- zend_fopen = utility_functions->fopen_function;
- if (!zend_fopen) {
- zend_fopen = zend_fopen_wrapper;
- }
- zend_message_dispatcher_p = utility_functions->message_handler;
- zend_block_interruptions = utility_functions->block_interruptions;
- zend_unblock_interruptions = utility_functions->unblock_interruptions;
- zend_get_configuration_directive_p = utility_functions->get_configuration_directive;
- zend_ticks_function = utility_functions->ticks_function;
- zend_on_timeout = utility_functions->on_timeout;
-
- zend_compile_file = compile_file;
- zend_execute = execute;
-
- /* set up version */
- zend_version_info = strdup(ZEND_CORE_VERSION_INFO);
- zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO)-1;
-
-#ifndef ZTS
- GLOBAL_FUNCTION_TABLE = &compiler_globals.main_class.function_table;
- GLOBAL_CLASS_TABLE = &compiler_globals.main_class.class_table;
-#endif
- GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
- zend_hash_init_ex(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
-
- register_standard_class();
- zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0);
- zend_init_rsrc_list_dtors();
-
-
- /* This zval can be used to initialize allocate zval's to an uninit'ed value */
- zval_used_for_init.is_ref = 0;
- zval_used_for_init.refcount = 1;
- zval_used_for_init.type = IS_NULL;
-
-#ifdef ZTS
- zend_hash_init_ex(GLOBAL_CONSTANTS_TABLE, 20, NULL, ZEND_CONSTANT_DTOR, 1, 0);
- zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, NULL, 1, 0);
- ts_allocate_id(&compiler_globals_id, sizeof(zend_compiler_globals), (ts_allocate_ctor) compiler_globals_ctor, (ts_allocate_dtor) compiler_globals_dtor);
- ts_allocate_id(&executor_globals_id, sizeof(zend_executor_globals), (ts_allocate_ctor) executor_globals_ctor, (ts_allocate_dtor) executor_globals_dtor);
- ts_allocate_id(&language_scanner_globals_id, sizeof(zend_scanner_globals), (ts_allocate_ctor) scanner_globals_ctor, NULL);
- ts_allocate_id(&ini_scanner_globals_id, sizeof(zend_scanner_globals), (ts_allocate_ctor) scanner_globals_ctor, NULL);
- compiler_globals = ts_resource(compiler_globals_id);
- executor_globals = ts_resource(executor_globals_id);
- tsrm_ls = ts_resource_ex(0, NULL);
-
- compiler_globals_dtor(compiler_globals, tsrm_ls);
- *compiler_globals->function_table = *GLOBAL_FUNCTION_TABLE;
- *compiler_globals->class_table = *GLOBAL_CLASS_TABLE;
- compiler_globals->auto_globals = GLOBAL_AUTO_GLOBALS_TABLE;
-
- zend_hash_destroy(executor_globals->zend_constants);
- *executor_globals->zend_constants = *GLOBAL_CONSTANTS_TABLE;
-#else
- zend_hash_init_ex(CG(auto_globals), 8, NULL, NULL, 1, 0);
- scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC);
- scanner_globals_ctor(&language_scanner_globals TSRMLS_CC);
- zend_startup_constants();
- zend_set_default_compile_time_values(TSRMLS_C);
- EG(user_error_handler) = NULL;
- EG(user_exception_handler) = NULL;
-#endif
- zend_register_standard_constants(TSRMLS_C);
-
-#ifndef ZTS
- zend_init_rsrc_plist(TSRMLS_C);
-#endif
-
- if (start_builtin_functions) {
- zend_startup_builtin_functions(TSRMLS_C);
- }
-
- zend_ini_startup(TSRMLS_C);
-
-#ifdef ZTS
- tsrm_set_new_thread_end_handler(zend_new_thread_end_handler);
-#endif
-
- return SUCCESS;
-}
-
-
-#ifdef ZTS
-/* Unlink the global (r/o) copies of the class, function and constant tables,
- * and use a fresh r/w copy for the startup thread
- */
-void zend_post_startup(TSRMLS_D)
-{
- zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id);
- zend_executor_globals *executor_globals = ts_resource(executor_globals_id);
-
- *GLOBAL_FUNCTION_TABLE = *compiler_globals->function_table;
- *GLOBAL_CLASS_TABLE = *compiler_globals->class_table;
- *GLOBAL_CONSTANTS_TABLE = *executor_globals->zend_constants;
- compiler_globals_ctor(compiler_globals, tsrm_ls);
- executor_globals_ctor(executor_globals, tsrm_ls);
-}
-#endif
-
-
-void zend_shutdown(TSRMLS_D)
-{
-#ifdef ZEND_WIN32
- zend_shutdown_timeout_thread();
-#endif
-#ifndef ZTS
- zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
-#endif
- zend_destroy_rsrc_list_dtors();
- zend_hash_graceful_reverse_destroy(&module_registry);
-
-#ifndef ZTS
- /* In ZTS mode these are freed by compiler_globals_dtor() */
- zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
- zend_hash_destroy(GLOBAL_CLASS_TABLE);
-#endif
-
- zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE);
- free(GLOBAL_AUTO_GLOBALS_TABLE);
- zend_shutdown_extensions(TSRMLS_C);
- free(zend_version_info);
-#ifndef ZTS
- zend_shutdown_constants();
-#endif
-}
-
-
-void zend_set_utility_values(zend_utility_values *utility_values)
-{
- zend_uv = *utility_values;
- zend_uv.import_use_extension_length = strlen(zend_uv.import_use_extension);
-}
-
-
-/* this should be compatible with the standard zenderror */
-void zenderror(char *error)
-{
- zend_error(E_PARSE, error);
-}
-
-
-BEGIN_EXTERN_C()
-ZEND_API void _zend_bailout(char *filename, uint lineno)
-{
- TSRMLS_FETCH();
-
- if (!EG(bailout_set)) {
- zend_output_debug_string(1, "%s(%d) : Bailed out without a bailout address!", filename, lineno);
- exit(-1);
- }
- CG(unclean_shutdown) = 1;
- CG(in_compilation) = EG(in_execution) = 0;
- EG(current_execute_data) = NULL;
- longjmp(EG(bailout), FAILURE);
-}
-END_EXTERN_C()
-
-
-void zend_append_version_info(zend_extension *extension)
-{
- char *new_info;
- uint new_info_length;
-
- new_info_length = sizeof(" with v, by \n")
- + strlen(extension->name)
- + strlen(extension->version)
- + strlen(extension->copyright)
- + strlen(extension->author);
-
- new_info = (char *) malloc(new_info_length+1);
-
- sprintf(new_info, " with %s v%s, %s, by %s\n", extension->name, extension->version, extension->copyright, extension->author);
-
- zend_version_info = (char *) realloc(zend_version_info, zend_version_info_length+new_info_length+1);
- strcat(zend_version_info, new_info);
- zend_version_info_length += new_info_length;
- free(new_info);
-}
-
-
-ZEND_API char *get_zend_version()
-{
- return zend_version_info;
-}
-
-
-void zend_activate(TSRMLS_D)
-{
- init_compiler(TSRMLS_C);
- init_executor(TSRMLS_C);
- startup_scanner(TSRMLS_C);
-}
-
-
-void zend_activate_modules(TSRMLS_D)
-{
- zend_hash_apply(&module_registry, (apply_func_t) module_registry_request_startup TSRMLS_CC);
-}
-
-void zend_deactivate_modules(TSRMLS_D)
-{
- EG(opline_ptr) = NULL; /* we're no longer executing anything */
-
- zend_try {
- zend_hash_apply(&module_registry, (apply_func_t) module_registry_cleanup TSRMLS_CC);
- } zend_end_try();
-}
-
-void zend_deactivate(TSRMLS_D)
-{
- /* we're no longer executing anything */
- EG(opline_ptr) = NULL;
- EG(active_symbol_table) = NULL;
-
- zend_try {
- shutdown_scanner(TSRMLS_C);
- } zend_end_try();
-
- /* shutdown_executor() takes care of its own bailout handling */
- shutdown_executor(TSRMLS_C);
-
- zend_try {
- shutdown_compiler(TSRMLS_C);
- } zend_end_try();
-
- zend_try {
- zend_ini_deactivate(TSRMLS_C);
- } zend_end_try();
-}
-
-
-BEGIN_EXTERN_C()
-ZEND_API void zend_message_dispatcher(long message, void *data)
-{
- if (zend_message_dispatcher_p) {
- zend_message_dispatcher_p(message, data);
- }
-}
-END_EXTERN_C()
-
-
-ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval *contents)
-{
- if (zend_get_configuration_directive_p) {
- return zend_get_configuration_directive_p(name, name_length, contents);
- } else {
- return FAILURE;
- }
-}
-
-
-#define ZEND_ERROR_BUFFER_SIZE 1024
-
-ZEND_API void zend_error(int type, const char *format, ...)
-{
- va_list args;
- zval ***params;
- zval *retval;
- zval *z_error_type, *z_error_message, *z_error_filename, *z_error_lineno, *z_context;
- char *error_filename;
- uint error_lineno;
- zval *orig_user_error_handler;
- TSRMLS_FETCH();
-
- /* Obtain relevant filename and lineno */
- switch (type) {
- case E_CORE_ERROR:
- case E_CORE_WARNING:
- error_filename = NULL;
- error_lineno = 0;
- break;
- case E_PARSE:
- case E_COMPILE_ERROR:
- case E_COMPILE_WARNING:
- case E_ERROR:
- case E_NOTICE:
- case E_WARNING:
- case E_USER_ERROR:
- case E_USER_WARNING:
- case E_USER_NOTICE:
- if (zend_is_compiling(TSRMLS_C)) {
- error_filename = zend_get_compiled_filename(TSRMLS_C);
- error_lineno = zend_get_compiled_lineno(TSRMLS_C);
- } else if (zend_is_executing(TSRMLS_C)) {
- error_filename = zend_get_executed_filename(TSRMLS_C);
- error_lineno = zend_get_executed_lineno(TSRMLS_C);
- } else {
- error_filename = NULL;
- error_lineno = 0;
- }
- break;
- default:
- error_filename = NULL;
- error_lineno = 0;
- break;
- }
- if (!error_filename) {
- error_filename = "Unknown";
- }
-
-
- va_start(args, format);
-
- /* if we don't have a user defined error handler */
- if (!EG(user_error_handler)) {
- zend_error_cb(type, error_filename, error_lineno, format, args);
- } else switch (type) {
- case E_ERROR:
- case E_PARSE:
- case E_CORE_ERROR:
- case E_CORE_WARNING:
- case E_COMPILE_ERROR:
- case E_COMPILE_WARNING:
- /* The error may not be safe to handle in user-space */
- zend_error_cb(type, error_filename, error_lineno, format, args);
- break;
- default:
- /* Handle the error in user space */
- ALLOC_INIT_ZVAL(z_error_message);
- ALLOC_INIT_ZVAL(z_error_type);
- ALLOC_INIT_ZVAL(z_error_filename);
- ALLOC_INIT_ZVAL(z_error_lineno);
- ALLOC_INIT_ZVAL(z_context);
- z_error_message->value.str.val = (char *) emalloc(ZEND_ERROR_BUFFER_SIZE);
-
-#ifdef HAVE_VSNPRINTF
- z_error_message->value.str.len = vsnprintf(z_error_message->value.str.val, ZEND_ERROR_BUFFER_SIZE, format, args);
- if (z_error_message->value.str.len > ZEND_ERROR_BUFFER_SIZE-1) {
- z_error_message->value.str.len = ZEND_ERROR_BUFFER_SIZE-1;
- }
-#else
- strncpy(z_error_message->value.str.val, format, ZEND_ERROR_BUFFER_SIZE);
- /* This is risky... */
- /* z_error_message->value.str.len = vsprintf(z_error_message->value.str.val, format, args); */
-#endif
- z_error_message->type = IS_STRING;
-
- z_error_type->value.lval = type;
- z_error_type->type = IS_LONG;
-
- if (error_filename) {
- z_error_filename->value.str.len = strlen(error_filename);
- z_error_filename->value.str.val = estrndup(error_filename, z_error_filename->value.str.len);
- z_error_filename->type = IS_STRING;
- }
-
- z_error_lineno->value.lval = error_lineno;
- z_error_lineno->type = IS_LONG;
-
- z_context->value.ht = EG(active_symbol_table);
- z_context->type = IS_ARRAY;
- ZVAL_ADDREF(z_context); /* we don't want this one to be freed */
-
- params = (zval ***) emalloc(sizeof(zval **)*5);
- params[0] = &z_error_type;
- params[1] = &z_error_message;
- params[2] = &z_error_filename;
- params[3] = &z_error_lineno;
- params[4] = &z_context;
-
- orig_user_error_handler = EG(user_error_handler);
- EG(user_error_handler) = NULL;
- if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC)==SUCCESS) {
- zval_ptr_dtor(&retval);
- } else {
- /* The user error handler failed, use built-in error handler */
- zend_error_cb(type, error_filename, error_lineno, format, args);
- }
- EG(user_error_handler) = orig_user_error_handler;
-
- efree(params);
- zval_ptr_dtor(&z_error_message);
- zval_ptr_dtor(&z_error_type);
- zval_ptr_dtor(&z_error_filename);
- zval_ptr_dtor(&z_error_lineno);
- if (ZVAL_REFCOUNT(z_context) == 2) {
- FREE_ZVAL(z_context);
- }
- break;
- }
-
- va_end(args);
-
- if (type == E_PARSE) {
- EG(exit_status) = 255;
- zend_init_compiler_data_structures(TSRMLS_C);
- }
-}
-
-
-ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ...)
-{
-#if ZEND_DEBUG
- va_list args;
-
- va_start(args, format);
-# ifdef ZEND_WIN32
- {
- char output_buf[1024];
-
- vsnprintf(output_buf, 1024, format, args);
- OutputDebugString(output_buf);
- OutputDebugString("\n");
- if (trigger_break && IsDebuggerPresent()) {
- DebugBreak();
- }
- }
-# else
- vfprintf(stderr, format, args);
- fprintf(stderr, "\n");
-# endif
- va_end(args);
-#endif
-}
-
-
-ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...)
-{
- va_list files;
- int i;
- zend_file_handle *file_handle;
- zend_op_array *orig_op_array = EG(active_op_array);
- zval *local_retval=NULL;
-
- va_start(files, file_count);
- for (i=0; i<file_count; i++) {
- file_handle = va_arg(files, zend_file_handle *);
- if (!file_handle) {
- continue;
- }
- EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDE TSRMLS_CC);
- zend_destroy_file_handle(file_handle TSRMLS_CC);
- if (EG(active_op_array)) {
- EG(return_value_ptr_ptr) = retval ? retval : &local_retval;
- zend_execute(EG(active_op_array) TSRMLS_CC);
- if (EG(exception)) {
-#if 1 /* support set_exception_handler() */
- if (EG(user_exception_handler)) {
- zval *orig_user_exception_handler;
- zval ***params, *retval2;
- params = (zval ***)emalloc(sizeof(zval **));
- params[0] = &EG(exception);
- orig_user_exception_handler = EG(user_exception_handler);
- if (call_user_function_ex(CG(function_table), NULL, orig_user_exception_handler, &retval2, 1, params, 1, NULL TSRMLS_CC) == SUCCESS) {
- zval_ptr_dtor(&retval2);
- }
- efree(params);
- zval_ptr_dtor(&EG(exception));
- EG(exception) = NULL;
- } else {
- zval_ptr_dtor(&EG(exception));
- EG(exception) = NULL;
- zend_error(E_ERROR, "Uncaught exception!");
- }
- if (!retval) {
- zval_ptr_dtor(EG(return_value_ptr_ptr));
- local_retval = NULL;
- }
-#else
- zval_ptr_dtor(&EG(exception));
- zend_error(E_ERROR, "Uncaught exception!");
-#endif
- } else if (!retval) {
- zval_ptr_dtor(EG(return_value_ptr_ptr));
- local_retval = NULL;
- }
- destroy_op_array(EG(active_op_array));
- efree(EG(active_op_array));
- } else if (type==ZEND_REQUIRE) {
- va_end(files);
- EG(active_op_array) = orig_op_array;
- return FAILURE;
- }
- }
- va_end(files);
- EG(active_op_array) = orig_op_array;
-
- return SUCCESS;
-}
-
-#define COMPILED_STRING_DESCRIPTION_FORMAT "%s(%d) : %s"
-
-ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC)
-{
- char *cur_filename;
- int cur_lineno;
- char *compiled_string_description;
-
- if (zend_is_compiling(TSRMLS_C)) {
- cur_filename = zend_get_compiled_filename(TSRMLS_C);
- cur_lineno = zend_get_compiled_lineno(TSRMLS_C);
- } else if (zend_is_executing(TSRMLS_C)) {
- cur_filename = zend_get_executed_filename(TSRMLS_C);
- cur_lineno = zend_get_executed_lineno(TSRMLS_C);
- } else {
- cur_filename = "Unknown";
- cur_lineno = 0;
- }
-
- compiled_string_description = emalloc(sizeof(COMPILED_STRING_DESCRIPTION_FORMAT)+strlen(name)+strlen(cur_filename)+MAX_LENGTH_OF_LONG);
- sprintf(compiled_string_description, COMPILED_STRING_DESCRIPTION_FORMAT, cur_filename, cur_lineno, name);
- return compiled_string_description;
-}
-
-
-void free_estring(char **str_p)
-{
- efree(*str_p);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend.h b/Zend/zend.h
deleted file mode 100644
index 4901f468ac..0000000000
--- a/Zend/zend.h
+++ /dev/null
@@ -1,586 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_H
-#define ZEND_H
-
-#define ZEND_VERSION "2.0.0-alpha3"
-
-#define ZEND_ENGINE_2
-
-#ifdef __cplusplus
-#define BEGIN_EXTERN_C() extern "C" {
-#define END_EXTERN_C() }
-#else
-#define BEGIN_EXTERN_C()
-#define END_EXTERN_C()
-#endif
-
-#include <stdio.h>
-
-/*
- * general definitions
- */
-
-#ifdef ZEND_WIN32
-# include "zend_config.w32.h"
-# define ZEND_PATHS_SEPARATOR ';'
-#elif defined(NETWARE)
-# include "zend_config.nw.h"
-# include "acconfig.h"
-#elif defined(__riscos__)
-# include "zend_config.h"
-# define ZEND_PATHS_SEPARATOR ';'
-#else
-# include "zend_config.h"
-# define ZEND_PATHS_SEPARATOR ':'
-#endif
-
-
-#ifdef ZEND_WIN32
-/* Only use this macro if you know for sure that all of the switches values
- are covered by its case statements */
-#define EMPTY_SWITCH_DEFAULT_CASE() \
- default: \
- __assume(0); \
- break;
-#else
-#define EMPTY_SWITCH_DEFAULT_CASE()
-#endif
-
-/* all HAVE_XXX test have to be after the include of zend_config above */
-
-#ifdef HAVE_UNIX_H
-# include <unix.h>
-#endif
-
-#ifdef HAVE_STDARG_H
-# include <stdarg.h>
-#endif
-
-#ifdef HAVE_DLFCN_H
-# include <dlfcn.h>
-#endif
-
-#if HAVE_MACH_O_DYLD_H
-#include <mach-o/dyld.h>
-
-/* MH_BUNDLE loading functions for Mac OS X / Darwin */
-void *zend_mh_bundle_load (char* bundle_path);
-int zend_mh_bundle_unload (void *bundle_handle);
-void *zend_mh_bundle_symbol(void *bundle_handle, const char *symbol_name);
-const char *zend_mh_bundle_error(void);
-
-#endif /* HAVE_MACH_O_DYLD_H */
-
-#if defined(HAVE_LIBDL)
-
-# ifndef RTLD_LAZY
-# define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
-# endif
-
-# ifndef RTLD_GLOBAL
-# define RTLD_GLOBAL 0
-# endif
-
-# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
-# define DL_UNLOAD dlclose
-# if defined(DLSYM_NEEDS_UNDERSCORE)
-# define DL_FETCH_SYMBOL(h,s) dlsym((h), "_" s)
-# else
-# define DL_FETCH_SYMBOL dlsym
-# endif
-# define DL_ERROR dlerror
-# define DL_HANDLE void *
-# define ZEND_EXTENSIONS_SUPPORT 1
-#elif defined(HAVE_MACH_O_DYLD_H)
-# define DL_LOAD(libname) zend_mh_bundle_load(libname)
-# define DL_UNLOAD(handle) zend_mh_bundle_unload(handle)
-# define DL_FETCH_SYMBOL(h,s) zend_mh_bundle_symbol(h,s)
-# define DL_ERROR zend_mh_bundle_error
-# define DL_HANDLE void *
-# define ZEND_EXTENSIONS_SUPPORT 1
-#elif defined(ZEND_WIN32)
-# define DL_LOAD(libname) LoadLibrary(libname)
-# define DL_FETCH_SYMBOL GetProcAddress
-# define DL_UNLOAD FreeLibrary
-# define DL_HANDLE HMODULE
-# define ZEND_EXTENSIONS_SUPPORT 1
-#else
-# define DL_HANDLE void *
-# define ZEND_EXTENSIONS_SUPPORT 0
-#endif
-
-/* AIX requires this to be the first thing in the file. */
-#ifndef __GNUC__
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-# endif
-# endif
-# endif
-#endif
-
-#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE))
-# define do_alloca(p) alloca(p)
-# define free_alloca(p)
-#else
-# define do_alloca(p) emalloc(p)
-# define free_alloca(p) efree(p)
-#endif
-
-#if ZEND_DEBUG
-#define ZEND_FILE_LINE_D char *__zend_filename, uint __zend_lineno
-#define ZEND_FILE_LINE_DC , ZEND_FILE_LINE_D
-#define ZEND_FILE_LINE_ORIG_D char *__zend_orig_filename, uint __zend_orig_lineno
-#define ZEND_FILE_LINE_ORIG_DC , ZEND_FILE_LINE_ORIG_D
-#define ZEND_FILE_LINE_RELAY_C __zend_filename, __zend_lineno
-#define ZEND_FILE_LINE_RELAY_CC , ZEND_FILE_LINE_RELAY_C
-#define ZEND_FILE_LINE_C __FILE__, __LINE__
-#define ZEND_FILE_LINE_CC , ZEND_FILE_LINE_C
-#define ZEND_FILE_LINE_EMPTY_C NULL, 0
-#define ZEND_FILE_LINE_EMPTY_CC , ZEND_FILE_LINE_EMPTY_C
-#define ZEND_FILE_LINE_ORIG_RELAY_C __zend_orig_filename, __zend_orig_lineno
-#define ZEND_FILE_LINE_ORIG_RELAY_CC , ZEND_FILE_LINE_ORIG_RELAY_C
-#else
-#define ZEND_FILE_LINE_D
-#define ZEND_FILE_LINE_DC
-#define ZEND_FILE_LINE_ORIG_D
-#define ZEND_FILE_LINE_ORIG_DC
-#define ZEND_FILE_LINE_RELAY_C
-#define ZEND_FILE_LINE_RELAY_CC
-#define ZEND_FILE_LINE_C
-#define ZEND_FILE_LINE_CC
-#define ZEND_FILE_LINE_EMPTY_C
-#define ZEND_FILE_LINE_EMPTY_CC
-#define ZEND_FILE_LINE_ORIG_RELAY_C
-#define ZEND_FILE_LINE_ORIG_RELAY_CC
-#endif /* ZEND_DEBUG */
-
-#ifdef ZTS
-#define ZTS_V 1
-#else
-#define ZTS_V 0
-#endif
-
-#include "zend_errors.h"
-#include "zend_alloc.h"
-
-#include "zend_types.h"
-
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
-
-#ifndef LONG_MAX
-#define LONG_MAX 2147483647L
-#endif
-
-#ifndef LONG_MIN
-#define LONG_MIN (- LONG_MAX - 1)
-#endif
-
-#undef SUCCESS
-#undef FAILURE
-#define SUCCESS 0
-#define FAILURE -1 /* this MUST stay a negative number, or it may affect functions! */
-
-
-#include "zend_hash.h"
-#include "zend_ts_hash.h"
-#include "zend_llist.h"
-
-#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval *this_ptr, int return_value_used TSRMLS_DC
-#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, this_ptr, return_value_used TSRMLS_CC
-
-
-/*
- * zval
- */
-typedef struct _zval_struct zval;
-typedef struct _zend_class_entry zend_class_entry;
-
-typedef struct _zend_object {
- zend_class_entry *ce;
- HashTable *properties;
- int in_get:1;
- int in_set:1;
-} zend_object;
-
-typedef unsigned int zend_object_handle;
-typedef struct _zend_object_value zend_object_value;
-
-#include "zend_object_handlers.h"
-
-struct _zend_object_value {
- zend_object_handle handle;
- zend_object_handlers *handlers;
-};
-
-typedef union _zvalue_value {
- long lval; /* long value */
- double dval; /* double value */
- struct {
- char *val;
- zend_uint len;
- } str;
- HashTable *ht; /* hash table value */
-/* struct {
- zend_class_entry *ce;
- HashTable *properties;
- } obj;
-*/
- zend_object_value obj;
-} zvalue_value;
-
-
-struct _zval_struct {
- /* Variable information */
- zvalue_value value; /* value */
- zend_uint refcount;
- zend_uchar type; /* active type */
- zend_uchar is_ref;
-};
-
-
-
-typedef struct _zend_function_entry {
- char *fname;
- void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
- unsigned char *func_arg_types;
-} zend_function_entry;
-
-
-typedef struct _zend_property_reference {
- int type; /* read, write or r/w */
- zval *object;
- zend_llist *elements_list;
-} zend_property_reference;
-
-
-
-typedef struct _zend_overloaded_element {
- int type; /* array offset or object proprety */
- zval element;
-} zend_overloaded_element;
-
-/* excpt.h on Digital Unix 4.0 defines function_table */
-#undef function_table
-
-/* A lot of stuff needs shifiting around in order to include zend_compile.h here */
-union _zend_function;
-
-struct _zend_class_entry {
- char type;
- char *name;
- zend_uint name_length;
- struct _zend_class_entry *parent;
- int refcount;
- zend_bool constants_updated;
-
- HashTable function_table;
- HashTable default_properties;
- HashTable private_properties; /* This is only needed at compile-time */
- HashTable protected_properties; /* This is only needed at compile-time */
- HashTable class_table;
- HashTable *static_members;
- HashTable constants_table;
- zend_function_entry *builtin_functions;
-
- union _zend_function *constructor;
- union _zend_function *destructor;
- union _zend_function *clone;
- union _zend_function *__get;
- union _zend_function *__set;
- union _zend_function *__call;
-
- /* handlers */
- zend_object_value (*create_object)(zend_class_entry *class_type TSRMLS_DC);
-
- /* old handlers */
- void (*handle_function_call)(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
- zval (*handle_property_get)(zend_property_reference *property_reference);
- int (*handle_property_set)(zend_property_reference *property_reference, zval *value);
-};
-
-
-typedef struct _zend_utility_functions {
- void (*error_function)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
- int (*printf_function)(const char *format, ...);
- int (*write_function)(const char *str, uint str_length);
- FILE *(*fopen_function)(const char *filename, char **opened_path);
- void (*message_handler)(long message, void *data);
- void (*block_interruptions)(void);
- void (*unblock_interruptions)(void);
- int (*get_configuration_directive)(char *name, uint name_length, zval *contents);
- void (*ticks_function)(int ticks);
- void (*on_timeout)(int seconds TSRMLS_DC);
-} zend_utility_functions;
-
-
-typedef struct _zend_utility_values {
- char *import_use_extension;
- uint import_use_extension_length;
- zend_bool html_errors;
-} zend_utility_values;
-
-
-typedef int (*zend_write_func_t)(const char *str, uint str_length);
-
-
-#undef MIN
-#undef MAX
-#define MAX(a, b) (((a)>(b))?(a):(b))
-#define MIN(a, b) (((a)<(b))?(a):(b))
-#define ZEND_STRL(str) (str), (sizeof(str)-1)
-#define ZEND_STRS(str) (str), (sizeof(str))
-#define ZEND_NORMALIZE_BOOL(n) \
- ((n) ? (((n)>0) ? 1 : -1) : 0)
-
-
-/* data types */
-#define IS_NULL 0
-#define IS_LONG 1
-#define IS_DOUBLE 2
-#define IS_STRING 3
-#define IS_ARRAY 4
-#define IS_OBJECT 5
-#define IS_BOOL 6
-#define IS_RESOURCE 7
-#define IS_CONSTANT 8
-#define IS_CONSTANT_ARRAY 9
-
-/* Special data type to temporarily mark large numbers */
-#define FLAG_IS_BC 10 /* for parser internal use only */
-
-/* Ugly hack to support constants as static array indices */
-#define IS_CONSTANT_INDEX 0x80
-
-
-/* overloaded elements data types */
-#define OE_IS_ARRAY (1<<0)
-#define OE_IS_OBJECT (1<<1)
-#define OE_IS_METHOD (1<<2)
-
-
-/* Argument passing types */
-#define BYREF_NONE 0
-#define BYREF_FORCE 1
-#define BYREF_ALLOW 2
-#define BYREF_FORCE_REST 3
-
-int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions);
-void zend_shutdown(TSRMLS_D);
-
-#ifdef ZTS
-void zend_post_startup(TSRMLS_D);
-#endif
-
-void zend_set_utility_values(zend_utility_values *utility_values);
-
-BEGIN_EXTERN_C()
-ZEND_API void _zend_bailout(char *filename, uint lineno);
-END_EXTERN_C()
-
-#define zend_bailout() _zend_bailout(__FILE__, __LINE__)
-
-#define zend_try \
- { \
- jmp_buf orig_bailout; \
- zend_bool orig_bailout_set=EG(bailout_set); \
- \
- EG(bailout_set) = 1; \
- memcpy(&orig_bailout, &EG(bailout), sizeof(jmp_buf)); \
- if (setjmp(EG(bailout))==0)
-#define zend_catch \
- else
-#define zend_end_try() \
- memcpy(&EG(bailout), &orig_bailout, sizeof(jmp_buf)); \
- EG(bailout_set) = orig_bailout_set; \
- }
-#define zend_first_try EG(bailout_set)=0; zend_try
-
-ZEND_API char *get_zend_version(void);
-ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy);
-ZEND_API int zend_print_zval(zval *expr, int indent);
-ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent);
-ZEND_API void zend_print_zval_r(zval *expr, int indent);
-ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent);
-ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ...);
-
-#if ZEND_DEBUG
-#define Z_DBG(expr) (expr)
-#else
-#define Z_DBG(expr)
-#endif
-
-ZEND_API extern char *empty_string;
-
-ZEND_API void free_estring(char **str_p);
-
-#define STR_FREE(ptr) if (ptr && ptr!=empty_string) { efree(ptr); }
-#define STR_FREE_REL(ptr) if (ptr && ptr!=empty_string) { efree_rel(ptr); }
-
-#define STR_REALLOC(ptr, size) \
- if (ptr!=empty_string) { \
- ptr = (char *) erealloc(ptr, size); \
- } else { \
- ptr = (char *) emalloc(size); \
- memset(ptr, 0, size); \
- }
-
-/* output support */
-#define ZEND_WRITE(str, str_len) zend_write((str), (str_len))
-#define ZEND_PUTS(str) zend_write((str), strlen((str)))
-#define ZEND_PUTC(c) zend_write(&(c), 1), (c)
-
-
-BEGIN_EXTERN_C()
-extern ZEND_API int (*zend_printf)(const char *format, ...);
-extern ZEND_API zend_write_func_t zend_write;
-extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path);
-extern ZEND_API void (*zend_block_interruptions)(void);
-extern ZEND_API void (*zend_unblock_interruptions)(void);
-extern ZEND_API void (*zend_ticks_function)(int ticks);
-extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
-extern void (*zend_on_timeout)(int seconds TSRMLS_DC);
-
-
-ZEND_API void zend_error(int type, const char *format, ...);
-
-void zenderror(char *error);
-
-/* The following #define is used for code duality in PHP for Engine 1 & 2 */
-#define ZEND_STANDARD_CLASS_DEF_PTR zend_standard_class_def
-extern ZEND_API zend_class_entry *zend_standard_class_def;
-extern ZEND_API zend_utility_values zend_uv;
-extern ZEND_API zval zval_used_for_init;
-
-END_EXTERN_C()
-
-#define ZEND_UV(name) (zend_uv.name)
-
-
-#define HANDLE_BLOCK_INTERRUPTIONS() if (zend_block_interruptions) { zend_block_interruptions(); }
-#define HANDLE_UNBLOCK_INTERRUPTIONS() if (zend_unblock_interruptions) { zend_unblock_interruptions(); }
-
-BEGIN_EXTERN_C()
-ZEND_API void zend_message_dispatcher(long message, void *data);
-END_EXTERN_C()
-
-ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval *contents);
-
-
-/* Messages for applications of Zend */
-#define ZMSG_FAILED_INCLUDE_FOPEN 1L
-#define ZMSG_FAILED_REQUIRE_FOPEN 2L
-#define ZMSG_FAILED_HIGHLIGHT_FOPEN 3L
-#define ZMSG_MEMORY_LEAK_DETECTED 4L
-#define ZMSG_MEMORY_LEAK_REPEATED 5L
-#define ZMSG_LOG_SCRIPT_NAME 6L
-
-
-#define ZVAL_ADDREF(pz) (++(pz)->refcount)
-#define ZVAL_DELREF(pz) (--(pz)->refcount)
-#define ZVAL_REFCOUNT(pz) ((pz)->refcount)
-
-#define INIT_PZVAL(z) \
- (z)->refcount = 1; \
- (z)->is_ref = 0;
-
-#define INIT_ZVAL(z) z = zval_used_for_init;
-
-#define ALLOC_INIT_ZVAL(zp) \
- ALLOC_ZVAL(zp); \
- INIT_ZVAL(*zp);
-
-#define MAKE_STD_ZVAL(zv) \
- ALLOC_ZVAL(zv); \
- INIT_PZVAL(zv);
-
-#define PZVAL_IS_REF(z) ((z)->is_ref)
-
-#define SEPARATE_ZVAL(ppzv) \
- { \
- zval *orig_ptr = *(ppzv); \
- \
- if (orig_ptr->refcount>1) { \
- orig_ptr->refcount--; \
- ALLOC_ZVAL(*(ppzv)); \
- **(ppzv) = *orig_ptr; \
- zval_copy_ctor(*(ppzv)); \
- (*(ppzv))->refcount=1; \
- (*(ppzv))->is_ref = 0; \
- } \
- }
-
-#define SEPARATE_ZVAL_IF_NOT_REF(ppzv) \
- if (!PZVAL_IS_REF(*ppzv)) { \
- SEPARATE_ZVAL(ppzv); \
- }
-
-#define SEPARATE_ZVAL_TO_MAKE_IS_REF(ppzv) \
- if (!PZVAL_IS_REF(*ppzv)) { \
- SEPARATE_ZVAL(ppzv); \
- (*(ppzv))->is_ref = 1; \
- }
-
-#define COPY_PZVAL_TO_ZVAL(zv, pzv) \
- (zv) = *(pzv); \
- if ((pzv)->refcount>1) { \
- zval_copy_ctor(&(zv)); \
- (pzv)->refcount--; \
- } else { \
- FREE_ZVAL(pzv); \
- } \
- INIT_PZVAL(&(zv));
-
-#define REPLACE_ZVAL_VALUE(ppzv_dest, pzv_src, copy) { \
- int is_ref, refcount; \
- \
- SEPARATE_ZVAL_IF_NOT_REF(ppzv_dest); \
- is_ref = (*ppzv_dest)->is_ref; \
- refcount = (*ppzv_dest)->refcount; \
- zval_dtor(*ppzv_dest); \
- **ppzv_dest = *pzv_src; \
- if (copy) { \
- zval_copy_ctor(*ppzv_dest); \
- } \
- (*ppzv_dest)->is_ref = is_ref; \
- (*ppzv_dest)->refcount = refcount; \
-}
-
-#define ZEND_MAX_RESERVED_RESOURCES 4
-
-
-#endif /* ZEND_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend.ico b/Zend/zend.ico
deleted file mode 100644
index 80978a6c7e..0000000000
--- a/Zend/zend.ico
+++ /dev/null
Binary files differ
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
deleted file mode 100644
index 030ca9489f..0000000000
--- a/Zend/zend_API.c
+++ /dev/null
@@ -1,1426 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Andrei Zmievski <andrei@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "zend.h"
-#include "zend_execute.h"
-#include "zend_API.h"
-#include "zend_modules.h"
-#include "zend_constants.h"
-
-#ifdef HAVE_STDARG_H
-#include <stdarg.h>
-#endif
-
-/* these variables are true statics/globals, and have to be mutex'ed on every access */
-static int module_count=0;
-ZEND_API HashTable module_registry;
-
-/* this function doesn't check for too many parameters */
-ZEND_API int zend_get_parameters(int ht, int param_count, ...)
-{
- void **p;
- int arg_count;
- va_list ptr;
- zval **param, *param_ptr;
- TSRMLS_FETCH();
-
- p = EG(argument_stack).top_element-2;
- arg_count = (ulong) *p;
-
- if (param_count>arg_count) {
- return FAILURE;
- }
-
- va_start(ptr, param_count);
-
- while (param_count-->0) {
- param = va_arg(ptr, zval **);
- param_ptr = *(p-arg_count);
- if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) {
- zval *new_tmp;
-
- ALLOC_ZVAL(new_tmp);
- *new_tmp = *param_ptr;
- zval_copy_ctor(new_tmp);
- INIT_PZVAL(new_tmp);
- param_ptr = new_tmp;
- ((zval *) *(p-arg_count))->refcount--;
- *(p-arg_count) = param_ptr;
- }
- *param = param_ptr;
- arg_count--;
- }
- va_end(ptr);
-
- return SUCCESS;
-}
-
-
-ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument_array TSRMLS_DC)
-{
- void **p;
- int arg_count;
- zval *param_ptr;
-
- p = EG(argument_stack).top_element-2;
- arg_count = (ulong) *p;
-
- if (param_count>arg_count) {
- return FAILURE;
- }
-
- while (param_count-->0) {
- param_ptr = *(p-arg_count);
- if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) {
- zval *new_tmp;
-
- ALLOC_ZVAL(new_tmp);
- *new_tmp = *param_ptr;
- zval_copy_ctor(new_tmp);
- INIT_PZVAL(new_tmp);
- param_ptr = new_tmp;
- ((zval *) *(p-arg_count))->refcount--;
- *(p-arg_count) = param_ptr;
- }
- *(argument_array++) = param_ptr;
- arg_count--;
- }
-
- return SUCCESS;
-}
-
-
-
-
-/* Zend-optimized Extended functions */
-/* this function doesn't check for too many parameters */
-ZEND_API int zend_get_parameters_ex(int param_count, ...)
-{
- void **p;
- int arg_count;
- va_list ptr;
- zval ***param;
- TSRMLS_FETCH();
-
- p = EG(argument_stack).top_element-2;
- arg_count = (ulong) *p;
-
- if (param_count>arg_count) {
- return FAILURE;
- }
-
- va_start(ptr, param_count);
- while (param_count-->0) {
- param = va_arg(ptr, zval ***);
- *param = (zval **) p-(arg_count--);
- }
- va_end(ptr);
-
- return SUCCESS;
-}
-
-
-ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC)
-{
- void **p;
- int arg_count;
-
- p = EG(argument_stack).top_element-2;
- arg_count = (ulong) *p;
-
- if (param_count>arg_count) {
- return FAILURE;
- }
-
- while (param_count-->0) {
- *(argument_array++) = (zval **) p-(arg_count--);
- }
-
- return SUCCESS;
-}
-
-
-ZEND_API void zend_wrong_param_count(TSRMLS_D)
-{
- zend_error(E_WARNING, "Wrong parameter count for %s()", get_active_function_name(TSRMLS_C));
-}
-
-
-/* Argument parsing API -- andrei */
-
-ZEND_API char *zend_zval_type_name(zval *arg)
-{
- switch (Z_TYPE_P(arg)) {
- case IS_NULL:
- return "null";
-
- case IS_LONG:
- return "integer";
-
- case IS_DOUBLE:
- return "double";
-
- case IS_STRING:
- return "string";
-
- case IS_ARRAY:
- return "array";
-
- case IS_OBJECT:
- return "object";
-
- case IS_BOOL:
- return "boolean";
-
- case IS_RESOURCE:
- return "resource";
-
- default:
- return "unknown";
- }
-}
-
-ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject)
-{
- if (Z_OBJ_HT_P(zobject)->get_class_entry) {
- TSRMLS_FETCH();
- return Z_OBJ_HT_P(zobject)->get_class_entry(zobject TSRMLS_CC);
- } else {
- zend_error(E_ERROR, "Class entry requested for an object without PHP class");
- return NULL;
- }
-}
-
-static int zend_check_class(zval *obj, zend_class_entry *expected_ce)
-{
- zend_class_entry *ce;
-
- if (Z_TYPE_P(obj) != IS_OBJECT) {
- return 0;
- }
-
- for (ce = Z_OBJCE_P(obj); ce != NULL; ce = ce->parent) {
- if (ce == expected_ce) {
- return 1;
- }
- }
-
- return 0;
-}
-
-static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec)
-{
- char *spec_walk = *spec;
- char c = *spec_walk++;
- int return_null = 0;
-
- while (*spec_walk == '/' || *spec_walk == '!') {
- if (*spec_walk == '/') {
- SEPARATE_ZVAL_IF_NOT_REF(arg);
- } else if (*spec_walk == '!' && Z_TYPE_PP(arg) == IS_NULL) {
- return_null = 1;
- }
- spec_walk++;
- }
-
- switch (c) {
- case 'l':
- {
- long *p = va_arg(*va, long *);
- switch (Z_TYPE_PP(arg)) {
- case IS_STRING:
- {
- double d;
- int type;
-
- if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), p, &d, 0)) == 0) {
- return "long";
- } else if (type == IS_DOUBLE) {
- *p = (long) d;
- }
- }
- break;
-
- case IS_NULL:
- case IS_LONG:
- case IS_DOUBLE:
- case IS_BOOL:
- convert_to_long_ex(arg);
- *p = Z_LVAL_PP(arg);
- break;
-
- case IS_ARRAY:
- case IS_OBJECT:
- case IS_RESOURCE:
- default:
- return "long";
- }
- }
- break;
-
- case 'd':
- {
- double *p = va_arg(*va, double *);
- switch (Z_TYPE_PP(arg)) {
- case IS_STRING:
- {
- long l;
- int type;
-
- if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &l, p, 0)) == 0) {
- return "double";
- } else if (type == IS_LONG) {
- *p = (double) l;
- }
- }
- break;
-
- case IS_NULL:
- case IS_LONG:
- case IS_DOUBLE:
- case IS_BOOL:
- convert_to_double_ex(arg);
- *p = Z_DVAL_PP(arg);
- break;
-
- case IS_ARRAY:
- case IS_OBJECT:
- case IS_RESOURCE:
- default:
- return "double";
- }
- }
- break;
-
- case 's':
- {
- char **p = va_arg(*va, char **);
- int *pl = va_arg(*va, int *);
- switch (Z_TYPE_PP(arg)) {
- case IS_NULL:
- if (return_null) {
- *p = NULL;
- *pl = 0;
- break;
- }
- /* break omitted intentionally */
-
- case IS_STRING:
- case IS_LONG:
- case IS_DOUBLE:
- case IS_BOOL:
- convert_to_string_ex(arg);
- *p = Z_STRVAL_PP(arg);
- *pl = Z_STRLEN_PP(arg);
- break;
-
- case IS_ARRAY:
- case IS_OBJECT:
- case IS_RESOURCE:
- default:
- return "string";
- }
- }
- break;
-
- case 'b':
- {
- zend_bool *p = va_arg(*va, zend_bool *);
- switch (Z_TYPE_PP(arg)) {
- case IS_NULL:
- case IS_STRING:
- case IS_LONG:
- case IS_DOUBLE:
- case IS_BOOL:
- convert_to_boolean_ex(arg);
- *p = Z_BVAL_PP(arg);
- break;
-
- case IS_ARRAY:
- case IS_OBJECT:
- case IS_RESOURCE:
- default:
- return "boolean";
- }
- }
- break;
-
- case 'r':
- {
- zval **p = va_arg(*va, zval **);
- if (Z_TYPE_PP(arg) != IS_RESOURCE) {
- if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
- *p = NULL;
- } else {
- return "resource";
- }
- } else
- *p = *arg;
- }
- break;
-
- case 'a':
- {
- zval **p = va_arg(*va, zval **);
- if (Z_TYPE_PP(arg) != IS_ARRAY) {
- if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
- *p = NULL;
- } else {
- return "array";
- }
- } else
- *p = *arg;
- }
- break;
-
- case 'o':
- {
- zval **p = va_arg(*va, zval **);
- if (Z_TYPE_PP(arg) != IS_OBJECT) {
- if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
- *p = NULL;
- } else {
- return "object";
- }
- } else
- *p = *arg;
- }
- break;
-
- case 'O':
- {
- zval **p = va_arg(*va, zval **);
- zend_class_entry *ce = va_arg(*va, zend_class_entry *);
- if (!zend_check_class(*arg, ce)) {
- if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
- *p = NULL;
- } else {
- return ce->name;
- }
- } else
- *p = *arg;
- }
- break;
-
- case 'z':
- {
- zval **p = va_arg(*va, zval **);
- if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
- *p = NULL;
- } else {
- *p = *arg;
- }
- }
- break;
-
- default:
- return "unknown";
- }
-
- *spec = spec_walk;
-
- return NULL;
-}
-
-static int zend_parse_arg(int arg_num, zval **arg, va_list *va, char **spec, int quiet TSRMLS_DC)
-{
- char *expected_type = NULL;
- char buf[1024];
-
- expected_type = zend_parse_arg_impl(arg, va, spec);
- if (expected_type) {
- if (!quiet) {
- snprintf(buf, sizeof(buf)-1, "%s() expects parameter %d to be %s, %s given",
- get_active_function_name(TSRMLS_C), arg_num, expected_type,
- zend_zval_type_name(*arg));
- buf[sizeof(buf)-1] = '\0';
- zend_error(E_WARNING, buf);
- }
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int flags TSRMLS_DC)
-{
- char *spec_walk;
- char buf[1024];
- int c, i;
- int min_num_args = -1;
- int max_num_args = 0;
- zval **arg;
- void **p;
- int arg_count;
- int quiet = flags & ZEND_PARSE_PARAMS_QUIET;
-
- for (spec_walk = type_spec; *spec_walk; spec_walk++) {
- c = *spec_walk;
- switch (c) {
- case 'l': case 'd':
- case 's': case 'b':
- case 'r': case 'a':
- case 'o': case 'O':
- case 'z':
- max_num_args++;
- break;
-
- case '|':
- min_num_args = max_num_args;
- break;
-
- case '/':
- case '!':
- /* Pass */
- break;
-
- default:
- if (!quiet) {
- zend_error(E_WARNING, "%s(): bad type specifier while parsing parameters", get_active_function_name(TSRMLS_C));
- }
- return FAILURE;
- }
- }
-
- if (min_num_args < 0) {
- min_num_args = max_num_args;
- }
-
- if (num_args < min_num_args || num_args > max_num_args) {
- if (!quiet) {
- sprintf(buf, "%s() expects %s %d parameter%s, %d given",
- get_active_function_name(TSRMLS_C),
- min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most",
- num_args < min_num_args ? min_num_args : max_num_args,
- (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s",
- num_args);
- zend_error(E_WARNING, buf);
- }
- return FAILURE;
- }
-
- p = EG(argument_stack).top_element-2;
- arg_count = (ulong) *p;
-
- if (num_args > arg_count) {
- zend_error(E_WARNING, "%s(): could not obtain parameters for parsing",
- get_active_function_name(TSRMLS_C));
- return FAILURE;
- }
-
- i = 0;
- while (num_args-- > 0) {
- arg = (zval **) p - (arg_count-i);
- if (*type_spec == '|') {
- type_spec++;
- }
- if (zend_parse_arg(i+1, arg, va, &type_spec, quiet TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- i++;
- }
-
- return SUCCESS;
-}
-
-ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...)
-{
- va_list va;
- int retval;
-
- va_start(va, type_spec);
- retval = zend_parse_va_args(num_args, type_spec, &va, flags TSRMLS_CC);
- va_end(va);
-
- return retval;
-}
-
-ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...)
-{
- va_list va;
- int retval;
-
- va_start(va, type_spec);
- retval = zend_parse_va_args(num_args, type_spec, &va, 0 TSRMLS_CC);
- va_end(va);
-
- return retval;
-}
-
-/* Argument parsing API -- andrei */
-
-
-ZEND_API int _array_init(zval *arg ZEND_FILE_LINE_DC)
-{
- ALLOC_HASHTABLE_REL(arg->value.ht);
-
- zend_hash_init(arg->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0);
- arg->type = IS_ARRAY;
- return SUCCESS;
-}
-
-
-ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC)
-{
- zval *tmp;
- zend_object *object;
-
- if (!class_type->constants_updated) {
- zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
- zend_hash_apply_with_argument(class_type->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
- class_type->constants_updated = 1;
- }
-
- arg->type = IS_OBJECT;
- if (class_type->create_object == NULL) {
- arg->value.obj = zend_objects_new(&object, class_type);
- if (properties) {
- object->properties = properties;
- } else {
- ALLOC_HASHTABLE_REL(object->properties);
- zend_hash_init(object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(object->properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
- }
- } else {
- arg->value.obj = class_type->create_object(class_type TSRMLS_CC);
- }
- return SUCCESS;
-}
-
-ZEND_API int _object_init_ex(zval *arg, zend_class_entry *class_type ZEND_FILE_LINE_DC TSRMLS_DC)
-{
- return _object_and_properties_init(arg, class_type, 0 ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
-}
-
-ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC)
-{
- return _object_init_ex(arg, zend_standard_class_def ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
-}
-
-
-ZEND_API int add_assoc_function(zval *arg, char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS))
-{
- zend_error(E_WARNING, "add_assoc_function() is no longer supported");
- return FAILURE;
-}
-
-
-ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, n);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_BOOL(tmp, b);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_RESOURCE(tmp, r);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value)
-{
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &value, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_index_long(zval *arg, uint index, long n)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, n);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_index_null(zval *arg, uint index)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_index_bool(zval *arg, uint index, int b)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_BOOL(tmp, b);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_index_resource(zval *arg, uint index, int r)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_RESOURCE(tmp, r);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_index_double(zval *arg, uint index, double d)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_index_string(zval *arg, uint index, char *str, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_index_stringl(zval *arg, uint index, char *str, uint length, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_index_zval(zval *arg, uint index, zval *value)
-{
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &value, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_long(zval *arg, long n)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, n);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_null(zval *arg)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_bool(zval *arg, int b)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_BOOL(tmp, b);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_resource(zval *arg, int r)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_RESOURCE(tmp, r);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_double(zval *arg, double d)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_next_index_zval(zval *arg, zval *value)
-{
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &value, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, void **dest, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest);
-}
-
-
-ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, void **dest, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
-
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest);
-}
-
-
-ZEND_API int add_get_index_long(zval *arg, uint index, long l, void **dest)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, l);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest);
-}
-
-
-ZEND_API int add_get_index_double(zval *arg, uint index, double d, void **dest)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest);
-}
-
-
-ZEND_API int add_get_index_string(zval *arg, uint index, char *str, void **dest, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest);
-}
-
-
-ZEND_API int add_get_index_stringl(zval *arg, uint index, char *str, uint length, void **dest, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest);
-}
-
-
-ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long n)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, n);
-
- return zend_hash_update(Z_OBJPROP_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_BOOL(tmp, b);
-
- return zend_hash_update(Z_OBJPROP_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
-
- return zend_hash_update(Z_OBJPROP_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long n)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_RESOURCE(tmp, n);
-
- return zend_hash_update(Z_OBJPROP_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
-
- return zend_hash_update(Z_OBJPROP_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- return zend_hash_update(Z_OBJPROP_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate)
-{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
-
- return zend_hash_update(Z_OBJPROP_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value)
-{
- return zend_hash_update(Z_OBJPROP_P(arg), key, key_len, (void *) &value, sizeof(zval *), NULL);
-}
-
-ZEND_API int zend_startup_module(zend_module_entry *module)
-{
- if (module) {
- module->module_number = zend_next_free_module();
- if (module->module_startup_func) {
- TSRMLS_FETCH();
-
- if (module->module_startup_func(MODULE_PERSISTENT, module->module_number TSRMLS_CC)==FAILURE) {
- zend_error(E_CORE_ERROR,"Unable to start %s module", module->name);
- return FAILURE;
- }
- }
- module->type = MODULE_PERSISTENT;
- zend_register_module(module);
- }
- return SUCCESS;
-}
-
-
-/* registers all functions in *library_functions in the function hash */
-int zend_register_functions(zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC)
-{
- zend_function_entry *ptr = functions;
- zend_function function;
- zend_internal_function *internal_function = (zend_internal_function *)&function;
- int count=0, unload=0;
- HashTable *target_function_table = function_table;
- int error_type;
-
- if (type==MODULE_PERSISTENT) {
- error_type = E_CORE_WARNING;
- } else {
- error_type = E_WARNING;
- }
-
- if (!target_function_table) {
- target_function_table = CG(function_table);
- }
- internal_function->type = ZEND_INTERNAL_FUNCTION;
-
- while (ptr->fname) {
- internal_function->handler = ptr->handler;
- internal_function->arg_types = ptr->func_arg_types;
- internal_function->function_name = ptr->fname;
- internal_function->scope = NULL;
- if (!internal_function->handler) {
- zend_error(error_type, "Null function defined as active function");
- zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
- return FAILURE;
- }
- if (zend_hash_add(target_function_table, ptr->fname, strlen(ptr->fname)+1, &function, sizeof(zend_function), NULL) == FAILURE) {
- unload=1;
- break;
- }
- ptr++;
- count++;
- }
- if (unload) { /* before unloading, display all remaining bad function in the module */
- while (ptr->fname) {
- if (zend_hash_exists(target_function_table, ptr->fname, strlen(ptr->fname)+1)) {
- zend_error(error_type, "Function registration failed - duplicate name - %s", ptr->fname);
- }
- ptr++;
- }
- zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
- return FAILURE;
- }
- return SUCCESS;
-}
-
-/* count=-1 means erase all functions, otherwise,
- * erase the first count functions
- */
-void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC)
-{
- zend_function_entry *ptr = functions;
- int i=0;
- HashTable *target_function_table = function_table;
-
- if (!target_function_table) {
- target_function_table = CG(function_table);
- }
- while (ptr->fname) {
- if (count!=-1 && i>=count) {
- break;
- }
-#if 0
- zend_printf("Unregistering %s()\n", ptr->fname);
-#endif
- zend_hash_del(target_function_table, ptr->fname, strlen(ptr->fname)+1);
- ptr++;
- i++;
- }
-}
-
-
-ZEND_API int zend_register_module(zend_module_entry *module)
-{
- TSRMLS_FETCH();
-
-#if 0
- zend_printf("%s: Registering module %d\n", module->name, module->module_number);
-#endif
- if (module->functions && zend_register_functions(module->functions, NULL, module->type TSRMLS_CC)==FAILURE) {
- zend_error(E_CORE_WARNING,"%s: Unable to register functions, unable to load", module->name);
- return FAILURE;
- }
- module->module_started=1;
- return zend_hash_add(&module_registry, module->name, strlen(module->name)+1, (void *)module, sizeof(zend_module_entry), NULL);
-}
-
-
-void module_destructor(zend_module_entry *module)
-{
- TSRMLS_FETCH();
-
- if (module->type == MODULE_TEMPORARY) {
- zend_clean_module_rsrc_dtors(module->module_number TSRMLS_CC);
- clean_module_constants(module->module_number TSRMLS_CC);
- if (module->request_shutdown_func)
- module->request_shutdown_func(module->type, module->module_number TSRMLS_CC);
- }
-
- if (module->module_started && module->module_shutdown_func) {
-#if 0
- zend_printf("%s: Module shutdown\n", module->name);
-#endif
- module->module_shutdown_func(module->type, module->module_number TSRMLS_CC);
- }
- module->module_started=0;
- if (module->functions) {
- zend_unregister_functions(module->functions, -1, NULL TSRMLS_CC);
- }
-
-#if HAVE_LIBDL
- if (module->handle) {
- dlclose(module->handle);
- }
-#endif
-}
-
-
-/* call request startup for all modules */
-int module_registry_request_startup(zend_module_entry *module TSRMLS_DC)
-{
- if (module->request_startup_func) {
-#if 0
- zend_printf("%s: Request startup\n", module->name);
-#endif
- if (module->request_startup_func(module->type, module->module_number TSRMLS_CC)==FAILURE) {
- zend_error(E_WARNING, "request_startup() for %s module failed", module->name);
- exit(1);
- }
- }
- return 0;
-}
-
-
-/* for persistent modules - call request shutdown and flag NOT to erase
- * for temporary modules - do nothing, and flag to erase
- */
-int module_registry_cleanup(zend_module_entry *module TSRMLS_DC)
-{
- switch(module->type) {
- case MODULE_PERSISTENT:
- if (module->request_shutdown_func) {
-#if 0
- zend_printf("%s: Request shutdown\n", module->name);
-#endif
- module->request_shutdown_func(module->type, module->module_number TSRMLS_CC);
- }
- return 0;
- break;
- case MODULE_TEMPORARY:
- return 1;
- break;
- }
- return 0;
-}
-
-
-/* return the next free module number */
-int zend_next_free_module(void)
-{
- return ++module_count;
-}
-
-/* If parent_ce is not NULL then it inherits from parent_ce
- * If parent_ce is NULL and parent_name isn't then it looks for the parent and inherits from it
- * If both parent_ce and parent_name are NULL it does a regular class registration
- * If parent_name is specified but not found NULL is returned
- */
-ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC)
-{
- zend_class_entry *register_class;
-
- if (!parent_ce && parent_name) {
- zend_class_entry **pce;
- if (zend_hash_find(CG(class_table), parent_name, strlen(parent_name)+1, (void **) &pce)==FAILURE) {
- return NULL;
- } else {
- parent_ce = *pce;
- }
- }
-
- register_class = zend_register_internal_class(class_entry TSRMLS_CC);
-
- if (parent_ce) {
- zend_do_inheritance(register_class, parent_ce);
- }
- return register_class;
-}
-
-ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *orig_class_entry TSRMLS_DC)
-{
- zend_class_entry *class_entry = malloc(sizeof(zend_class_entry));
- char *lowercase_name = zend_strndup(orig_class_entry->name, orig_class_entry->name_length);
- *class_entry = *orig_class_entry;
-
- zend_str_tolower(lowercase_name, class_entry->name_length);
-
- class_entry->type = ZEND_INTERNAL_CLASS;
- class_entry->parent = NULL;
- class_entry->refcount = 1;
- class_entry->constants_updated = 0;
- zend_hash_init(&class_entry->default_properties, 0, NULL, ZVAL_PTR_DTOR, 1);
- zend_hash_init(&class_entry->private_properties, 0, NULL, ZVAL_PTR_DTOR, 1);
- zend_hash_init(&class_entry->protected_properties, 0, NULL, ZVAL_PTR_DTOR, 1);
- class_entry->static_members = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init(class_entry->static_members, 0, NULL, ZVAL_PTR_DTOR, 1);
- zend_hash_init(&class_entry->constants_table, 0, NULL, ZVAL_PTR_DTOR, 1);
- zend_hash_init(&class_entry->function_table, 0, NULL, ZEND_FUNCTION_DTOR, 1);
- zend_hash_init(&class_entry->class_table, 10, NULL, ZEND_CLASS_DTOR, 1);
-
- if (class_entry->builtin_functions) {
- zend_register_functions(class_entry->builtin_functions, &class_entry->function_table, MODULE_PERSISTENT TSRMLS_CC);
- }
-
- zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, &class_entry, sizeof(zend_class_entry *), NULL);
- free(lowercase_name);
- return class_entry;
-}
-
-
-ZEND_API zend_module_entry *zend_get_module(int module_number)
-{
- zend_module_entry *module;
-
- if (zend_hash_index_find(&module_registry, module_number, (void **) &module)==SUCCESS) {
- return module;
- } else {
- return NULL;
- }
-}
-
-ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
- zend_bool is_ref, int num_symbol_tables, ...)
-{
- HashTable *symbol_table;
- va_list symbol_table_list;
-
- if (num_symbol_tables <= 0) return FAILURE;
-
- symbol->is_ref = is_ref;
-
- va_start(symbol_table_list, num_symbol_tables);
- while (num_symbol_tables-- > 0) {
- symbol_table = va_arg(symbol_table_list, HashTable *);
- zend_hash_update(symbol_table, name, name_length + 1, &symbol, sizeof(zval *), NULL);
- zval_add_ref(&symbol);
- }
- va_end(symbol_table_list);
- return SUCCESS;
-}
-
-
-
-
-/* Disabled functions support */
-
-ZEND_API ZEND_FUNCTION(display_disabled_function)
-{
- zend_error(E_WARNING, "%s() has been disabled for security reasons", get_active_function_name(TSRMLS_C));
-}
-
-
-static zend_function_entry disabled_function[] = {
- ZEND_FE(display_disabled_function, NULL)
- { NULL, NULL, NULL }
-};
-
-
-ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC)
-{
- if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) {
- return FAILURE;
- }
- disabled_function[0].fname = function_name;
- return zend_register_functions(disabled_function, CG(function_table), MODULE_PERSISTENT TSRMLS_CC);
-}
-
-zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name)
-{
- char *lcname;
- zend_bool retval = 0;
- TSRMLS_FETCH();
-
- switch (Z_TYPE_P(callable)) {
- case IS_STRING:
- if (callable_name)
- *callable_name = estrndup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
-
- if (syntax_only)
- return 1;
-
- lcname = estrndup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
- zend_str_tolower(lcname, Z_STRLEN_P(callable));
- if (zend_hash_exists(EG(function_table), lcname, Z_STRLEN_P(callable)+1))
- retval = 1;
- efree(lcname);
- break;
-
- case IS_ARRAY:
- {
- zval **method;
- zval **obj;
- zend_class_entry *ce = NULL, **pce;
- zend_uint callable_name_len;
-
- if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2 &&
- zend_hash_index_find(Z_ARRVAL_P(callable), 0, (void **) &obj) == SUCCESS &&
- zend_hash_index_find(Z_ARRVAL_P(callable), 1, (void **) &method) == SUCCESS &&
- (Z_TYPE_PP(obj) == IS_OBJECT || Z_TYPE_PP(obj) == IS_STRING) &&
- Z_TYPE_PP(method) == IS_STRING) {
-
- if (Z_TYPE_PP(obj) == IS_STRING) {
- if (callable_name) {
- char *ptr;
-
- callable_name_len = Z_STRLEN_PP(obj) + Z_STRLEN_PP(method) + sizeof("::");
- ptr = *callable_name = emalloc(callable_name_len);
- memcpy(ptr, Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
- ptr += Z_STRLEN_PP(obj);
- memcpy(ptr, "::", sizeof("::") - 1);
- ptr += sizeof("::") - 1;
- memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
- }
-
- if (syntax_only)
- return 1;
-
- lcname = estrndup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
- zend_str_tolower(lcname, Z_STRLEN_PP(obj));
- if (zend_lookup_class(lcname, Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
- ce = *pce;
- }
-
- efree(lcname);
- } else {
- ce = Z_OBJCE_PP(obj); /* ??? */
-
- if (callable_name) {
- char *ptr;
-
- callable_name_len = ce->name_length + Z_STRLEN_PP(method) + sizeof("::");
- ptr = *callable_name = emalloc(callable_name_len);
- memcpy(ptr, ce->name, ce->name_length);
- ptr += ce->name_length;
- memcpy(ptr, "::", sizeof("::") - 1);
- ptr += sizeof("::") - 1;
- memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
- }
-
- if (syntax_only)
- return 1;
- }
-
- if (ce) {
- lcname = estrndup(Z_STRVAL_PP(method), Z_STRLEN_PP(method));
- zend_str_tolower(lcname, Z_STRLEN_PP(method));
- if (zend_hash_exists(&ce->function_table, lcname, Z_STRLEN_PP(method)+1))
- retval = 1;
- efree(lcname);
- }
- } else if (callable_name)
- *callable_name = estrndup("Array", sizeof("Array")-1);
- }
- break;
-
- default:
- if (callable_name) {
- zval expr_copy;
- int use_copy;
-
- zend_make_printable_zval(callable, &expr_copy, &use_copy);
- *callable_name = estrndup(Z_STRVAL(expr_copy), Z_STRLEN(expr_copy));
- zval_dtor(&expr_copy);
- }
- break;
- }
-
- return retval;
-}
-
-ZEND_API char *zend_get_module_version(char *module_name)
-{
- zend_module_entry *module;
-
- if (zend_hash_find(&module_registry, module_name, strlen(module_name) + 1,
- (void**)&module) == FAILURE) {
- return NULL;
- }
- return module->version;
-}
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
deleted file mode 100644
index 09ca6e7aab..0000000000
--- a/Zend/zend_API.h
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Andrei Zmievski <andrei@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_API_H
-#define ZEND_API_H
-
-#include "zend_modules.h"
-#include "zend_list.h"
-#include "zend_fast_cache.h"
-#include "zend_operators.h"
-#include "zend_variables.h"
-#include "zend_execute.h"
-
-
-BEGIN_EXTERN_C()
-#define ZEND_FN(name) zif_##name
-#define ZEND_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
-#define ZEND_FUNCTION(name) ZEND_NAMED_FUNCTION(ZEND_FN(name))
-
-#define ZEND_NAMED_FE(zend_name, name, arg_types) { #zend_name, name, arg_types },
-#define ZEND_FE(name, arg_types) ZEND_NAMED_FE(name, ZEND_FN(name), arg_types)
-#define ZEND_FALIAS(name, alias, arg_types) ZEND_NAMED_FE(name, ZEND_FN(alias), arg_types)
-#define ZEND_STATIC_FE(name, impl_name, arg_types) { name, impl_name, arg_types },
-
-/* Name macros */
-#define ZEND_MODULE_STARTUP_N(module) zm_startup_##module
-#define ZEND_MODULE_SHUTDOWN_N(module) zm_shutdown_##module
-#define ZEND_MODULE_ACTIVATE_N(module) zm_activate_##module
-#define ZEND_MODULE_DEACTIVATE_N(module) zm_deactivate_##module
-#define ZEND_MODULE_INFO_N(module) zm_info_##module
-
-/* Declaration macros */
-#define ZEND_MODULE_STARTUP_D(module) int ZEND_MODULE_STARTUP_N(module)(INIT_FUNC_ARGS)
-#define ZEND_MODULE_SHUTDOWN_D(module) int ZEND_MODULE_SHUTDOWN_N(module)(SHUTDOWN_FUNC_ARGS)
-#define ZEND_MODULE_ACTIVATE_D(module) int ZEND_MODULE_ACTIVATE_N(module)(INIT_FUNC_ARGS)
-#define ZEND_MODULE_DEACTIVATE_D(module) int ZEND_MODULE_DEACTIVATE_N(module)(SHUTDOWN_FUNC_ARGS)
-#define ZEND_MODULE_INFO_D(module) void ZEND_MODULE_INFO_N(module)(ZEND_MODULE_INFO_FUNC_ARGS)
-
-#define ZEND_GET_MODULE(name) \
- ZEND_DLEXPORT zend_module_entry *get_module(void) { return &name##_module_entry; }
-
-#define ZEND_BEGIN_MODULE_GLOBALS(module_name) \
- typedef struct _zend_##module_name##_globals {
-#define ZEND_END_MODULE_GLOBALS(module_name) \
- } zend_##module_name##_globals;
-
-#ifdef ZTS
-
-#define ZEND_DECLARE_MODULE_GLOBALS(module_name) \
- ts_rsrc_id module_name##_globals_id;
-#define ZEND_EXTERN_MODULE_GLOBALS(module_name) \
- extern ts_rsrc_id module_name##_globals_id;
-#define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \
- ts_allocate_id(&module_name##_globals_id, sizeof(zend_##module_name##_globals), (ts_allocate_ctor) globals_ctor, (ts_allocate_dtor) globals_dtor);
-
-#else
-
-#define ZEND_DECLARE_MODULE_GLOBALS(module_name) \
- zend_##module_name##_globals module_name##_globals;
-#define ZEND_EXTERN_MODULE_GLOBALS(module_name) \
- extern zend_##module_name##_globals module_name##_globals;
-#define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \
- globals_ctor(&module_name##_globals);
-
-#endif
-
-
-
-#define INIT_CLASS_ENTRY(class_container, class_name, functions) INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, NULL, NULL, NULL)
-
-#define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset) \
- { \
- class_container.name = strdup(class_name); \
- class_container.name_length = sizeof(class_name)-1; \
- class_container.builtin_functions = functions; \
- class_container.constructor = NULL; \
- class_container.destructor = NULL; \
- class_container.clone = NULL; \
- class_container.create_object = NULL; \
- class_container.handle_function_call = handle_fcall; \
- class_container.handle_property_get = handle_propget; \
- class_container.handle_property_set = handle_propset; \
- }
-
-
-
-int zend_next_free_module(void);
-
-ZEND_API int zend_get_parameters(int ht, int param_count, ...);
-ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument_array TSRMLS_DC);
-ZEND_API int zend_get_parameters_ex(int param_count, ...);
-ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC);
-
-#define zend_get_parameters_array(ht, param_count, argument_array) \
- _zend_get_parameters_array(ht, param_count, argument_array TSRMLS_CC)
-#define zend_get_parameters_array_ex(param_count, argument_array) \
- _zend_get_parameters_array_ex(param_count, argument_array TSRMLS_CC)
-
-
-/* Parameter parsing API -- andrei */
-
-#define ZEND_PARSE_PARAMS_QUIET 1<<1
-ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...);
-ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...);
-ZEND_API char *zend_zval_type_name(zval *arg);
-
-/* End of parameter parsing API -- andrei */
-
-int zend_register_functions(zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC);
-void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
-ZEND_API int zend_register_module(zend_module_entry *module_entry);
-
-ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry TSRMLS_DC);
-ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC);
-
-ZEND_API zend_module_entry *zend_get_module(int module_number);
-ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC);
-
-ZEND_API void zend_wrong_param_count(TSRMLS_D);
-ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name);
-ZEND_API char *zend_get_module_version(char *module_name);
-
-ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject);
-
-#define getThis() (this_ptr)
-
-#define WRONG_PARAM_COUNT ZEND_WRONG_PARAM_COUNT()
-#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret)
-#define ARG_COUNT(dummy) (ht)
-#define ZEND_NUM_ARGS() (ht)
-#define ZEND_WRONG_PARAM_COUNT() { zend_wrong_param_count(TSRMLS_C); return; }
-#define ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret) { zend_wrong_param_count(TSRMLS_C); return ret; }
-
-#ifndef ZEND_WIN32
-#define DLEXPORT
-#endif
-
-ZEND_API int zend_startup_module(zend_module_entry *module);
-
-#define array_init(arg) _array_init((arg) ZEND_FILE_LINE_CC)
-#define object_init(arg) _object_init((arg) ZEND_FILE_LINE_CC TSRMLS_CC)
-#define object_init_ex(arg, ce) _object_init_ex((arg), (ce) ZEND_FILE_LINE_CC TSRMLS_CC)
-#define object_and_properties_init(arg, ce, properties) _object_and_properties_init((arg), (ce), (properties) ZEND_FILE_LINE_CC TSRMLS_CC)
-ZEND_API int _array_init(zval *arg ZEND_FILE_LINE_DC);
-ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC);
-ZEND_API int _object_init_ex(zval *arg, zend_class_entry *ce ZEND_FILE_LINE_DC TSRMLS_DC);
-ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC);
-
-/* no longer supported */
-ZEND_API int add_assoc_function(zval *arg, char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS));
-
-ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n);
-ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len);
-ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b);
-ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r);
-ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d);
-ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate);
-ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate);
-ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value);
-
-#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
-#define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
-#define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b)
-#define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key)+1, __r)
-#define add_assoc_double(__arg, __key, __d) add_assoc_double_ex(__arg, __key, strlen(__key)+1, __d)
-#define add_assoc_string(__arg, __key, __str, __duplicate) add_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
-#define add_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
-#define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key)+1, __value)
-
-/* unset() functions are only suported for legacy modules and null() functions should be used */
-#define add_assoc_unset(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
-#define add_index_unset(__arg, __key) add_index_null(__arg, __key)
-#define add_next_index_unset(__arg) add_next_index_null(__arg)
-#define add_property_unset(__arg, __key) add_property_null(__arg, __key)
-
-ZEND_API int add_index_long(zval *arg, uint idx, long n);
-ZEND_API int add_index_null(zval *arg, uint idx);
-ZEND_API int add_index_bool(zval *arg, uint idx, int b);
-ZEND_API int add_index_resource(zval *arg, uint idx, int r);
-ZEND_API int add_index_double(zval *arg, uint idx, double d);
-ZEND_API int add_index_string(zval *arg, uint idx, char *str, int duplicate);
-ZEND_API int add_index_stringl(zval *arg, uint idx, char *str, uint length, int duplicate);
-ZEND_API int add_index_zval(zval *arg, uint index, zval *value);
-
-ZEND_API int add_next_index_long(zval *arg, long n);
-ZEND_API int add_next_index_null(zval *arg);
-ZEND_API int add_next_index_bool(zval *arg, int b);
-ZEND_API int add_next_index_resource(zval *arg, int r);
-ZEND_API int add_next_index_double(zval *arg, double d);
-ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate);
-ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate);
-ZEND_API int add_next_index_zval(zval *arg, zval *value);
-
-ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, void **dest, int duplicate);
-ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, void **dest, int duplicate);
-
-#define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate)
-#define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate)
-
-ZEND_API int add_get_index_long(zval *arg, uint idx, long l, void **dest);
-ZEND_API int add_get_index_double(zval *arg, uint idx, double d, void **dest);
-ZEND_API int add_get_index_string(zval *arg, uint idx, char *str, void **dest, int duplicate);
-ZEND_API int add_get_index_stringl(zval *arg, uint idx, char *str, uint length, void **dest, int duplicate);
-
-ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long l);
-ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len);
-ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b);
-ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long r);
-ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d);
-ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate);
-ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate);
-ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value);
-
-#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n)
-#define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1)
-#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key)+1, __b)
-#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key)+1, __r)
-#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key)+1, __d)
-#define add_property_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
-#define add_property_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
-#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key)+1, __value)
-
-ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC);
-ZEND_API int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC);
-
-ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
- zend_bool is_ref, int num_symbol_tables, ...);
-
-#define add_method(arg, key, method) add_assoc_function((arg), (key), (method))
-
-ZEND_API ZEND_FUNCTION(display_disabled_function);
-
-#if ZEND_DEBUG
-#define CHECK_ZVAL_STRING(z) \
- if ((z)->value.str.val[ (z)->value.str.len ] != '\0') zend_error(E_WARNING, "String is not zero-terminated (%s)", (z)->value.str.val);
-#define CHECK_ZVAL_STRING_REL(z) \
- if ((z)->value.str.val[ (z)->value.str.len ] != '\0') zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", (z)->value.str.val ZEND_FILE_LINE_RELAY_CC);
-#else
-#define CHECK_ZVAL_STRING(z)
-#define CHECK_ZVAL_STRING_REL(z)
-#endif
-
-#define ZVAL_RESOURCE(z, l) { \
- (z)->type = IS_RESOURCE; \
- (z)->value.lval = l; \
- }
-
-#define ZVAL_BOOL(z, b) { \
- (z)->type = IS_BOOL; \
- (z)->value.lval = b; \
- }
-
-#define ZVAL_NULL(z) { \
- (z)->type = IS_NULL; \
- }
-
-#define ZVAL_LONG(z, l) { \
- (z)->type = IS_LONG; \
- (z)->value.lval = l; \
- }
-
-#define ZVAL_DOUBLE(z, d) { \
- (z)->type = IS_DOUBLE; \
- (z)->value.dval = d; \
- }
-
-#define ZVAL_STRING(z, s, duplicate) { \
- char *__s=(s); \
- (z)->value.str.len = strlen(__s); \
- (z)->value.str.val = (duplicate?estrndup(__s, (z)->value.str.len):__s); \
- (z)->type = IS_STRING; \
- }
-
-#define ZVAL_STRINGL(z, s, l, duplicate) { \
- char *__s=(s); int __l=l; \
- (z)->value.str.len = __l; \
- (z)->value.str.val = (duplicate?estrndup(__s, __l):__s); \
- (z)->type = IS_STRING; \
- }
-
-#define ZVAL_EMPTY_STRING(z) { \
- (z)->value.str.len = 0; \
- (z)->value.str.val = empty_string; \
- (z)->type = IS_STRING; \
- }
-
-#define ZVAL_FALSE(z) ZVAL_BOOL(z, 0)
-#define ZVAL_TRUE(z) ZVAL_BOOL(z, 1)
-
-#define RETVAL_RESOURCE(l) ZVAL_RESOURCE(return_value, l)
-#define RETVAL_BOOL(b) ZVAL_BOOL(return_value, b)
-#define RETVAL_NULL() ZVAL_NULL(return_value)
-#define RETVAL_LONG(l) ZVAL_LONG(return_value, l)
-#define RETVAL_DOUBLE(d) ZVAL_DOUBLE(return_value, d)
-#define RETVAL_STRING(s, duplicate) ZVAL_STRING(return_value, s, duplicate)
-#define RETVAL_STRINGL(s, l, duplicate) ZVAL_STRINGL(return_value, s, l, duplicate)
-#define RETVAL_EMPTY_STRING() ZVAL_EMPTY_STRING(return_value)
-#define RETVAL_FALSE ZVAL_BOOL(return_value, 0)
-#define RETVAL_TRUE ZVAL_BOOL(return_value, 1)
-
-#define RETURN_RESOURCE(l) { RETVAL_RESOURCE(l); return; }
-#define RETURN_BOOL(b) { RETVAL_BOOL(b); return; }
-#define RETURN_NULL() { RETVAL_NULL(); return;}
-#define RETURN_LONG(l) { RETVAL_LONG(l); return; }
-#define RETURN_DOUBLE(d) { RETVAL_DOUBLE(d); return; }
-#define RETURN_STRING(s, duplicate) { RETVAL_STRING(s, duplicate); return; }
-#define RETURN_STRINGL(s, l, duplicate) { RETVAL_STRINGL(s, l, duplicate); return; }
-#define RETURN_EMPTY_STRING() { RETVAL_EMPTY_STRING(); return; }
-#define RETURN_FALSE { RETVAL_FALSE; return; }
-#define RETURN_TRUE { RETVAL_TRUE; return; }
-
-#define SET_VAR_STRING(n, v) { \
- { \
- zval *var; \
- ALLOC_ZVAL(var); \
- ZVAL_STRING(var, v, 0); \
- ZEND_SET_GLOBAL_VAR(n, var); \
- } \
- }
-
-#define SET_VAR_STRINGL(n, v, l) { \
- { \
- zval *var; \
- ALLOC_ZVAL(var); \
- ZVAL_STRINGL(var, v, l, 0); \
- ZEND_SET_GLOBAL_VAR(n, var); \
- } \
- }
-
-#define SET_VAR_LONG(n, v) { \
- { \
- zval *var; \
- ALLOC_ZVAL(var); \
- ZVAL_LONG(var, v); \
- ZEND_SET_GLOBAL_VAR(n, var); \
- } \
- }
-
-#define SET_VAR_DOUBLE(n, v) { \
- { \
- zval *var; \
- ALLOC_ZVAL(var); \
- ZVAL_DOUBLE(var, v); \
- ZEND_SET_GLOBAL_VAR(n, var); \
- } \
- }
-
-
-#define ZEND_SET_SYMBOL(symtable, name, var) \
- { \
- char *_name = (name); \
- \
- ZEND_SET_SYMBOL_WITH_LENGTH(symtable, _name, strlen(_name)+1, var, 1, 0); \
- }
-
-#define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var, _refcount, _is_ref) \
- { \
- zval **orig_var; \
- \
- if (zend_hash_find(symtable, (name), (name_length), (void **) &orig_var)==SUCCESS \
- && PZVAL_IS_REF(*orig_var)) { \
- (var)->refcount = (*orig_var)->refcount; \
- (var)->is_ref = 1; \
- \
- if (_refcount) { \
- (var)->refcount += _refcount-1; \
- } \
- zval_dtor(*orig_var); \
- **orig_var = *(var); \
- FREE_ZVAL(var); \
- } else { \
- (var)->is_ref = _is_ref; \
- if (_refcount) { \
- (var)->refcount = _refcount; \
- } \
- zend_hash_update(symtable, (name), (name_length), &(var), sizeof(zval *), NULL); \
- } \
- }
-
-
-#define ZEND_SET_GLOBAL_VAR(name, var) \
- ZEND_SET_SYMBOL(&EG(symbol_table), name, var)
-
-#define ZEND_SET_GLOBAL_VAR_WITH_LENGTH(name, name_length, var, _refcount, _is_ref) \
- ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table), name, name_length, var, _refcount, _is_ref)
-
-#define HASH_OF(p) ((p)->type==IS_ARRAY ? (p)->value.ht : (((p)->type==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p) TSRMLS_CC) : NULL)))
-#define ZVAL_IS_NULL(z) ((z)->type==IS_NULL)
-
-/* For compatibility */
-#define ZEND_MINIT ZEND_MODULE_STARTUP_N
-#define ZEND_MSHUTDOWN ZEND_MODULE_SHUTDOWN_N
-#define ZEND_RINIT ZEND_MODULE_ACTIVATE_N
-#define ZEND_RSHUTDOWN ZEND_MODULE_DEACTIVATE_N
-#define ZEND_MINFO ZEND_MODULE_INFO_N
-
-#define ZEND_MINIT_FUNCTION ZEND_MODULE_STARTUP_D
-#define ZEND_MSHUTDOWN_FUNCTION ZEND_MODULE_SHUTDOWN_D
-#define ZEND_RINIT_FUNCTION ZEND_MODULE_ACTIVATE_D
-#define ZEND_RSHUTDOWN_FUNCTION ZEND_MODULE_DEACTIVATE_D
-#define ZEND_MINFO_FUNCTION ZEND_MODULE_INFO_D
-
-END_EXTERN_C()
-
-#endif /* ZEND_API_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
deleted file mode 100644
index 19a3e90d1d..0000000000
--- a/Zend/zend_alloc.c
+++ /dev/null
@@ -1,752 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include "zend.h"
-#include "zend_alloc.h"
-#include "zend_globals.h"
-#include "zend_fast_cache.h"
-#ifdef HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#include "zend_mm.h"
-
-#ifndef ZTS
-ZEND_API zend_alloc_globals alloc_globals;
-#endif
-
-
-#ifdef ZEND_MM
-#define ZEND_DISABLE_MEMORY_CACHE 1
-#else
-#define ZEND_DISABLE_MEMORY_CACHE 0
-#endif
-
-#ifdef ZEND_MM
-#define ZEND_DO_MALLOC(size) zend_mm_alloc(&AG(mm_heap), size)
-#define ZEND_DO_FREE(ptr) zend_mm_free(&AG(mm_heap), ptr)
-#define ZEND_DO_REALLOC(ptr, size) zend_mm_realloc(&AG(mm_heap), ptr, size)
-#elif defined(ZEND_WIN32)
-#define ZEND_DO_MALLOC(size) (AG(memory_heap) ? HeapAlloc(AG(memory_heap), HEAP_NO_SERIALIZE, size) : malloc(size))
-#define ZEND_DO_FREE(ptr) (AG(memory_heap) ? HeapFree(AG(memory_heap), HEAP_NO_SERIALIZE, ptr) : free(ptr))
-#define ZEND_DO_REALLOC(ptr, size) (AG(memory_heap) ? HeapReAlloc(AG(memory_heap), HEAP_NO_SERIALIZE, ptr, size) : realloc(ptr, size))
-#else
-#define ZEND_DO_MALLOC(size) malloc(size)
-#define ZEND_DO_FREE(ptr) free(ptr)
-#define ZEND_DO_REALLOC(ptr, size) realloc(ptr, size)
-#endif
-
-#if ZEND_DEBUG
-# define END_MAGIC_SIZE sizeof(long)
-static long mem_block_end_magic = MEM_BLOCK_END_MAGIC;
-#else
-# define END_MAGIC_SIZE 0
-#endif
-
-
-# if MEMORY_LIMIT
-# if ZEND_DEBUG
-#define CHECK_MEMORY_LIMIT(s, rs) _CHECK_MEMORY_LIMIT(s, rs, __zend_filename, __zend_lineno)
-# else
-#define CHECK_MEMORY_LIMIT(s, rs) _CHECK_MEMORY_LIMIT(s, rs, NULL, 0)
-# endif
-
-#define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { AG(allocated_memory) += rs;\
- if (AG(memory_limit)<AG(allocated_memory)) {\
- if ((AG(memory_limit)+1048576)<AG(allocated_memory)) { \
- /* failed to handle this gracefully, exit() */ \
- exit(1); \
- } \
- if (!AG(memory_exhausted)) { \
- if (!file) { \
- zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted (tried to allocate %d bytes)", AG(memory_limit), s); \
- } else { \
- zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)", AG(memory_limit), file, lineno, s); \
- } \
- AG(memory_exhausted)=1; \
- } \
- } \
- }
-# endif
-
-#ifndef CHECK_MEMORY_LIMIT
-#define CHECK_MEMORY_LIMIT(s, rs)
-#endif
-
-
-#define REMOVE_POINTER_FROM_LIST(p) \
- if (p==AG(head)) { \
- AG(head) = p->pNext; \
- } else { \
- p->pLast->pNext = p->pNext; \
- } \
- if (p->pNext) { \
- p->pNext->pLast = p->pLast; \
- }
-
-#define ADD_POINTER_TO_LIST(p) \
- p->pNext = AG(head); \
- if (AG(head)) { \
- AG(head)->pLast = p; \
- } \
- AG(head) = p; \
- p->pLast = (zend_mem_header *) NULL;
-
-#define DECLARE_CACHE_VARS() \
- unsigned int real_size; \
- unsigned int cache_index
-
-#define REAL_SIZE(size) ((size+7) & ~0x7)
-
-#define CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size) \
- real_size = REAL_SIZE(size); \
- cache_index = real_size >> 3;
-
-#define SIZE real_size
-
-#define CACHE_INDEX cache_index
-
-ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- zend_mem_header *p;
- DECLARE_CACHE_VARS();
- TSRMLS_FETCH();
-
- CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size);
-
- if (!ZEND_DISABLE_MEMORY_CACHE && (CACHE_INDEX < MAX_CACHED_MEMORY) && (AG(cache_count)[CACHE_INDEX] > 0)) {
- p = AG(cache)[CACHE_INDEX][--AG(cache_count)[CACHE_INDEX]];
-#if ZEND_DEBUG
- p->filename = __zend_filename;
- p->lineno = __zend_lineno;
- p->orig_filename = __zend_orig_filename;
- p->orig_lineno = __zend_orig_lineno;
- p->magic = MEM_BLOCK_START_MAGIC;
- p->reported = 0;
- /* Setting the thread id should not be necessary, because we fetched this block
- * from this thread's cache
- */
- AG(cache_stats)[CACHE_INDEX][1]++;
- memcpy((((char *) p) + sizeof(zend_mem_header) + MEM_HEADER_PADDING + size), &mem_block_end_magic, sizeof(long));
-#endif
- p->cached = 0;
- p->size = size;
- return (void *)((char *)p + sizeof(zend_mem_header) + MEM_HEADER_PADDING);
- } else {
-#if ZEND_DEBUG
- if (CACHE_INDEX<MAX_CACHED_MEMORY) {
- AG(cache_stats)[CACHE_INDEX][0]++;
- }
-#endif
- p = (zend_mem_header *) ZEND_DO_MALLOC(sizeof(zend_mem_header) + MEM_HEADER_PADDING + SIZE + END_MAGIC_SIZE);
- }
-
- HANDLE_BLOCK_INTERRUPTIONS();
-
- if (!p) {
- fprintf(stderr,"FATAL: emalloc(): Unable to allocate %ld bytes\n", (long) size);
-#if ZEND_DEBUG && defined(HAVE_KILL) && defined(HAVE_GETPID)
- kill(getpid(), SIGSEGV);
-#else
- exit(1);
-#endif
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *)p;
- }
- p->cached = 0;
-#if ZEND_DEBUG || !defined(ZEND_MM)
- ADD_POINTER_TO_LIST(p);
-#endif
- p->size = size; /* Save real size for correct cache output */
-#if ZEND_DEBUG
- p->filename = __zend_filename;
- p->lineno = __zend_lineno;
- p->orig_filename = __zend_orig_filename;
- p->orig_lineno = __zend_orig_lineno;
- p->magic = MEM_BLOCK_START_MAGIC;
- p->reported = 0;
-# ifdef ZTS
- p->thread_id = tsrm_thread_id();
-# endif
- memcpy((((char *) p) + sizeof(zend_mem_header) + MEM_HEADER_PADDING + size), &mem_block_end_magic, sizeof(long));
-#endif
-#if MEMORY_LIMIT
- CHECK_MEMORY_LIMIT(size, SIZE);
- if (AG(allocated_memory) > AG(allocated_memory_peak)) {
- AG(allocated_memory_peak) = AG(allocated_memory);
- }
-#endif
-
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *)((char *)p + sizeof(zend_mem_header) + MEM_HEADER_PADDING);
-}
-
-
-ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- zend_mem_header *p = (zend_mem_header *) ((char *)ptr - sizeof(zend_mem_header) - MEM_HEADER_PADDING);
- DECLARE_CACHE_VARS();
- TSRMLS_FETCH();
-
-#if defined(ZTS) && TSRM_DEBUG
- if (p->thread_id != tsrm_thread_id()) {
- tsrm_error(TSRM_ERROR_LEVEL_ERROR, "Memory block allocated at %s:(%d) on thread %x freed at %s:(%d) on thread %x, ignoring",
- p->filename, p->lineno, p->thread_id,
- __zend_filename, __zend_lineno, tsrm_thread_id());
- return;
- }
-#endif
-
- CALCULATE_REAL_SIZE_AND_CACHE_INDEX(p->size);
-#if ZEND_DEBUG
- if (!_mem_block_check(ptr, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC)) {
- return;
- }
- memset(ptr, 0x5a, p->size);
-#endif
-
- if (!ZEND_DISABLE_MEMORY_CACHE
- && (CACHE_INDEX < MAX_CACHED_MEMORY) && (AG(cache_count)[CACHE_INDEX] < MAX_CACHED_ENTRIES)) {
- AG(cache)[CACHE_INDEX][AG(cache_count)[CACHE_INDEX]++] = p;
- p->cached = 1;
-#if ZEND_DEBUG
- p->magic = MEM_BLOCK_CACHED_MAGIC;
-#endif
- return;
- }
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG || !defined(ZEND_MM)
- REMOVE_POINTER_FROM_LIST(p);
-#endif
-
-#if MEMORY_LIMIT
- AG(allocated_memory) -= SIZE;
-#endif
-
- ZEND_DO_FREE(p);
- HANDLE_UNBLOCK_INTERRUPTIONS();
-}
-
-
-ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- void *p;
- int final_size = size*nmemb;
-
- HANDLE_BLOCK_INTERRUPTIONS();
- p = _emalloc(final_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- if (!p) {
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *) p;
- }
- memset(p, 0, final_size);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return p;
-}
-
-
-ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- zend_mem_header *p;
- zend_mem_header *orig;
- DECLARE_CACHE_VARS();
- TSRMLS_FETCH();
-
- if (!ptr) {
- return _emalloc(size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
-
- p = orig = (zend_mem_header *) ((char *)ptr-sizeof(zend_mem_header)-MEM_HEADER_PADDING);
-
-#if defined(ZTS) && TSRM_DEBUG
- if (p->thread_id != tsrm_thread_id()) {
- void *new_p;
-
- tsrm_error(TSRM_ERROR_LEVEL_ERROR, "Memory block allocated at %s:(%d) on thread %x reallocated at %s:(%d) on thread %x, duplicating",
- p->filename, p->lineno, p->thread_id,
- __zend_filename, __zend_lineno, tsrm_thread_id());
- new_p = _emalloc(size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- memcpy(new_p, ptr, p->size);
- return new_p;
- }
-#endif
-
- CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size);
-
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG || !defined(ZEND_MM)
- REMOVE_POINTER_FROM_LIST(p);
-#endif
- p = (zend_mem_header *) ZEND_DO_REALLOC(p, sizeof(zend_mem_header)+MEM_HEADER_PADDING+SIZE+END_MAGIC_SIZE);
- if (!p) {
- if (!allow_failure) {
- fprintf(stderr,"FATAL: erealloc(): Unable to allocate %ld bytes\n", (long) size);
-#if ZEND_DEBUG && HAVE_KILL && HAVE_GETPID
- kill(getpid(), SIGSEGV);
-#else
- exit(1);
-#endif
- }
-#if ZEND_DEBUG || !defined(ZEND_MM)
- ADD_POINTER_TO_LIST(orig);
-#endif
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *)NULL;
- }
-#if ZEND_DEBUG || !defined(ZEND_MM)
- ADD_POINTER_TO_LIST(p);
-#endif
-#if ZEND_DEBUG
- p->filename = __zend_filename;
- p->lineno = __zend_lineno;
- p->magic = MEM_BLOCK_START_MAGIC;
- memcpy((((char *) p) + sizeof(zend_mem_header) + MEM_HEADER_PADDING + size), &mem_block_end_magic, sizeof(long));
-#endif
-#if MEMORY_LIMIT
- CHECK_MEMORY_LIMIT(size - p->size, SIZE - REAL_SIZE(p->size));
- if (AG(allocated_memory) > AG(allocated_memory_peak)) {
- AG(allocated_memory_peak) = AG(allocated_memory);
- }
-#endif
-
- p->size = size;
-
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *)((char *)p+sizeof(zend_mem_header)+MEM_HEADER_PADDING);
-}
-
-
-ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- int length;
- char *p;
-
- length = strlen(s)+1;
- HANDLE_BLOCK_INTERRUPTIONS();
- p = (char *) _emalloc(length ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- if (!p) {
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (char *)NULL;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- memcpy(p, s, length);
- return p;
-}
-
-
-ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- char *p;
-
- HANDLE_BLOCK_INTERRUPTIONS();
- p = (char *) _emalloc(length+1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- if (!p) {
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (char *)NULL;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- memcpy(p, s, length);
- p[length] = 0;
- return p;
-}
-
-
-ZEND_API char *zend_strndup(const char *s, uint length)
-{
- char *p;
-
- p = (char *) malloc(length+1);
- if (!p) {
- return (char *)NULL;
- }
- if (length) {
- memcpy(p, s, length);
- }
- p[length] = 0;
- return p;
-}
-
-
-ZEND_API int zend_set_memory_limit(unsigned int memory_limit)
-{
-#if MEMORY_LIMIT
- TSRMLS_FETCH();
-
- AG(memory_limit) = memory_limit;
- return SUCCESS;
-#else
- return FAILURE;
-#endif
-}
-
-
-ZEND_API void start_memory_manager(TSRMLS_D)
-{
- AG(head) = NULL;
-
-#if MEMORY_LIMIT
- AG(memory_limit) = 1<<30; /* ridiculous limit, effectively no limit */
- AG(allocated_memory) = 0;
- AG(memory_exhausted) = 0;
- AG(allocated_memory_peak) = 0;
-#endif
-
-#if ZEND_ENABLE_FAST_CACHE
- memset(AG(fast_cache_list_head), 0, sizeof(AG(fast_cache_list_head)));
-#endif
-#if !ZEND_DISABLE_MEMORY_CACHE
- memset(AG(cache_count), 0, sizeof(AG(cache_count)));
-#endif
-
-#ifdef ZEND_MM
- zend_mm_startup(&AG(mm_heap), 256*1024);
-#elif defined(ZEND_WIN32)
- AG(memory_heap) = HeapCreate(HEAP_NO_SERIALIZE, 256*1024, 0);
-#endif
-
-#if ZEND_DEBUG
- memset(AG(cache_stats), 0, sizeof(AG(cache_stats)));
- memset(AG(fast_cache_stats), 0, sizeof(AG(fast_cache_stats)));
-#endif
-}
-
-
-ZEND_API void shutdown_memory_manager(int silent, int clean_cache TSRMLS_DC)
-{
- zend_mem_header *p, *t;
-
-#if ZEND_DEBUG
- int had_leaks = 0;
-#endif
-
-#if defined(ZEND_MM) && !ZEND_DEBUG
- if (clean_cache) {
- zend_mm_shutdown(&AG(mm_heap));
- return;
- }
-#elif defined(ZEND_WIN32) && !ZEND_DEBUG
- if (clean_cache && AG(memory_heap)) {
- HeapDestroy(AG(memory_heap));
- return;
- }
-#endif
-
-#if ZEND_ENABLE_FAST_CACHE
- {
- zend_fast_cache_list_entry *fast_cache_list_entry, *next_fast_cache_list_entry;
- unsigned int fci;
-
- for (fci=0; fci<MAX_FAST_CACHE_TYPES; fci++) {
- fast_cache_list_entry = AG(fast_cache_list_head)[fci];
- while (fast_cache_list_entry) {
- next_fast_cache_list_entry = fast_cache_list_entry->next;
- efree(fast_cache_list_entry);
- fast_cache_list_entry = next_fast_cache_list_entry;
- }
- AG(fast_cache_list_head)[fci] = NULL;
- }
- }
-#endif /* ZEND_ENABLE_FAST_CACHE */
-
-#if !ZEND_DISABLE_MEMORY_CACHE
- if (1 || clean_cache) {
- unsigned int i, j;
- zend_mem_header *ptr;
-
- for (i=1; i<MAX_CACHED_MEMORY; i++) {
- for (j=0; j<AG(cache_count)[i]; j++) {
- ptr = (zend_mem_header *) AG(cache)[i][j];
-#if MEMORY_LIMIT
- AG(allocated_memory) -= REAL_SIZE(ptr->size);
-#endif
- REMOVE_POINTER_FROM_LIST(ptr);
- ZEND_DO_FREE(ptr);
- }
- AG(cache_count)[i] = 0;
- }
- }
-#endif /* !ZEND_DISABLE_MEMORY_CACHE */
-
-#if ZEND_DEBUG || !defined(ZEND_MM)
- p = AG(head);
- t = AG(head);
- while (t) {
- if (!t->cached) {
-#if ZEND_DEBUG
- if (!t->cached && !t->reported) {
- zend_mem_header *iterator;
- int total_leak=0, total_leak_count=0;
-
- had_leaks = 1;
- if (!silent) {
- zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, t);
- }
- t->reported = 1;
- for (iterator=t->pNext; iterator; iterator=iterator->pNext) {
- if (!iterator->cached
- && iterator->filename==t->filename
- && iterator->lineno==t->lineno) {
- total_leak += iterator->size;
- total_leak_count++;
- iterator->reported = 1;
- }
- }
- if (!silent && total_leak_count>0) {
- zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) (long) (total_leak_count));
- }
- }
-#endif
-#if MEMORY_LIMIT
- AG(allocated_memory) -= REAL_SIZE(t->size);
-#endif
- p = t->pNext;
- REMOVE_POINTER_FROM_LIST(t);
- ZEND_DO_FREE(t);
- t = p;
- } else {
- t = t->pNext;
- }
- }
-
-#if MEMORY_LIMIT
- AG(memory_exhausted)=0;
- AG(allocated_memory_peak) = 0;
-#endif
-
-
-#if (ZEND_DEBUG)
- do {
- zval display_memory_cache_stats;
- int i, j;
-
- if (clean_cache) {
- /* we're shutting down completely, don't even touch the INI subsystem */
- break;
- }
- if (zend_get_configuration_directive("display_memory_cache_stats", sizeof("display_memory_cache_stats"), &display_memory_cache_stats)==FAILURE) {
- break;
- }
- if (!atoi(display_memory_cache_stats.value.str.val)) {
- break;
- }
- fprintf(stderr, "Memory cache statistics\n"
- "-----------------------\n\n"
- "[zval, %2ld]\t\t%d / %d (%.2f%%)\n"
- "[hash, %2ld]\t\t%d / %d (%.2f%%)\n",
- (long) sizeof(zval),
- AG(fast_cache_stats)[ZVAL_CACHE_LIST][1], AG(fast_cache_stats)[ZVAL_CACHE_LIST][0]+AG(fast_cache_stats)[ZVAL_CACHE_LIST][1],
- ((double) AG(fast_cache_stats)[ZVAL_CACHE_LIST][1] / (AG(fast_cache_stats)[ZVAL_CACHE_LIST][0]+AG(fast_cache_stats)[ZVAL_CACHE_LIST][1]))*100,
- (long) sizeof(HashTable),
- AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1], AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][0]+AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1],
- ((double) AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1] / (AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][0]+AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1]))*100);
-
-
- for (i=0; i<MAX_CACHED_MEMORY; i+=2) {
- fprintf(stderr, "[%2d, %2d]\t\t", i, i+1);
- for (j=0; j<2; j++) {
- fprintf(stderr, "%d / %d (%.2f%%)\t\t",
- AG(cache_stats)[i+j][1], AG(cache_stats)[i+j][0]+AG(cache_stats)[i+j][1],
- ((double) AG(cache_stats)[i+j][1] / (AG(cache_stats)[i+j][0]+AG(cache_stats)[i+j][1]))*100);
- }
- fprintf(stderr, "\n");
- }
-
- } while (0);
-#endif
-
-#endif
-
-#if defined(ZEND_MM) && ZEND_DEBUG
- if (clean_cache) {
- zend_mm_shutdown(&AG(mm_heap));
- return;
- }
-#elif defined(ZEND_WIN32) && ZEND_DEBUG
- if (clean_cache && AG(memory_heap)) {
- HeapDestroy(AG(memory_heap));
- return;
- }
-#endif
-}
-
-
-#if ZEND_DEBUG
-void zend_debug_alloc_output(char *format, ...)
-{
- char output_buf[256];
- va_list args;
-
- va_start(args, format);
- vsprintf(output_buf, format, args);
- va_end(args);
-
-#ifdef ZEND_WIN32
- OutputDebugString(output_buf);
-#else
- fprintf(stderr, "%s", output_buf);
-#endif
-}
-
-
-ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- zend_mem_header *p = (zend_mem_header *) ((char *)ptr - sizeof(zend_mem_header) - MEM_HEADER_PADDING);
- int no_cache_notice=0;
- int valid_beginning=1;
- int had_problems=0;
- long end_magic;
-
- if (silent==2) {
- silent = 1;
- no_cache_notice = 1;
- }
- if (silent==3) {
- silent = 0;
- no_cache_notice = 1;
- }
- if (!silent) {
- zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL);
- zend_debug_alloc_output("---------------------------------------\n");
- zend_debug_alloc_output("%s(%d) : Block 0x%0.8lX status:\n" ZEND_FILE_LINE_RELAY_CC, (long) p);
- if (__zend_orig_filename) {
- zend_debug_alloc_output("%s(%d) : Actual location (location was relayed)\n" ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- zend_debug_alloc_output("%10s\t","Beginning: ");
- }
-
- switch (p->magic) {
- case MEM_BLOCK_START_MAGIC:
- if (!silent) {
- zend_debug_alloc_output("OK (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size);
- }
- break; /* ok */
- case MEM_BLOCK_FREED_MAGIC:
- if (!silent) {
- zend_debug_alloc_output("Freed\n");
- had_problems = 1;
- } else {
- return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- break;
- case MEM_BLOCK_CACHED_MAGIC:
- if (!silent) {
- if (!no_cache_notice) {
- zend_debug_alloc_output("Cached (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size);
- had_problems = 1;
- }
- } else {
- if (!no_cache_notice) {
- return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- }
- break;
- default:
- if (!silent) {
- zend_debug_alloc_output("Overrun (magic=0x%0.8lX, expected=0x%0.8lX)\n", p->magic, MEM_BLOCK_START_MAGIC);
- } else {
- return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- had_problems = 1;
- valid_beginning = 0;
- break;
- }
-
-
- memcpy(&end_magic, (((char *) p)+sizeof(zend_mem_header)+MEM_HEADER_PADDING+p->size), sizeof(long));
-
- if (valid_beginning && (end_magic != MEM_BLOCK_END_MAGIC)) {
- char *overflow_ptr, *magic_ptr=(char *) &mem_block_end_magic;
- int overflows=0;
- int i;
-
- if (silent) {
- return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- had_problems = 1;
- overflow_ptr = (char *) &end_magic;
-
- for (i=0; i<sizeof(long); i++) {
- if (overflow_ptr[i]!=magic_ptr[i]) {
- overflows++;
- }
- }
-
- zend_debug_alloc_output("%10s\t", "End:");
- zend_debug_alloc_output("Overflown (magic=0x%0.8lX instead of 0x%0.8lX)\n", end_magic, MEM_BLOCK_END_MAGIC);
- zend_debug_alloc_output("%10s\t","");
- if (overflows>=sizeof(long)) {
- zend_debug_alloc_output("At least %d bytes overflown\n", sizeof(long));
- } else {
- zend_debug_alloc_output("%d byte(s) overflown\n", overflows);
- }
- } else if (!silent) {
- zend_debug_alloc_output("%10s\t", "End:");
- if (valid_beginning) {
- zend_debug_alloc_output("OK\n");
- } else {
- zend_debug_alloc_output("Unknown\n");
- }
- }
-
- if (had_problems) {
- int foo = 5;
-
- foo += 1;
- }
-
- if (!silent) {
- zend_debug_alloc_output("---------------------------------------\n");
- }
- return ((!had_problems) ? 1 : 0);
-}
-
-
-ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- zend_mem_header *p;
- int errors=0;
- TSRMLS_FETCH();
-
- p = AG(head);
-
-
- zend_debug_alloc_output("------------------------------------------------\n");
- zend_debug_alloc_output("Full Memory Check at %s:%d\n" ZEND_FILE_LINE_RELAY_CC);
-
- while (p) {
- if (!_mem_block_check((void *)((char *)p + sizeof(zend_mem_header) + MEM_HEADER_PADDING), (silent?2:3) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC)) {
- errors++;
- }
- p = p->pNext;
- }
- zend_debug_alloc_output("End of full memory check %s:%d (%d errors)\n" ZEND_FILE_LINE_RELAY_CC, errors);
- zend_debug_alloc_output("------------------------------------------------\n");
-}
-#endif
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h
deleted file mode 100644
index c04ee1dee7..0000000000
--- a/Zend/zend_alloc.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_ALLOC_H
-#define ZEND_ALLOC_H
-
-#include <stdio.h>
-
-#include "../TSRM/TSRM.h"
-#include "zend_globals_macros.h"
-
-#include "zend_mm.h"
-
-#define MEM_BLOCK_START_MAGIC 0x7312F8DCL
-#define MEM_BLOCK_END_MAGIC 0x2A8FCC84L
-#define MEM_BLOCK_FREED_MAGIC 0x99954317L
-#define MEM_BLOCK_CACHED_MAGIC 0xFB8277DCL
-
-typedef struct _zend_mem_header {
-#if ZEND_DEBUG
- long magic;
- char *filename;
- uint lineno;
- int reported;
- char *orig_filename;
- uint orig_lineno;
-# ifdef ZTS
- THREAD_T thread_id;
-# endif
-#endif
-#if ZEND_DEBUG || !defined(ZEND_MM)
- struct _zend_mem_header *pNext;
- struct _zend_mem_header *pLast;
-#endif
- unsigned int size:31;
- unsigned int cached:1;
-} zend_mem_header;
-
-typedef union _align_test {
- void *ptr;
- double dbl;
- long lng;
-} align_test;
-
-#define MAX_CACHED_MEMORY 11
-#define MAX_CACHED_ENTRIES 256
-#define PRE_INIT_CACHE_ENTRIES 32
-
-#if (defined (__GNUC__) && __GNUC__ >= 2)
-#define PLATFORM_ALIGNMENT (__alignof__ (align_test))
-#else
-#define PLATFORM_ALIGNMENT (sizeof(align_test))
-#endif
-
-#define MEM_HEADER_PADDING (((PLATFORM_ALIGNMENT-sizeof(zend_mem_header))%PLATFORM_ALIGNMENT+PLATFORM_ALIGNMENT)%PLATFORM_ALIGNMENT)
-
-
-BEGIN_EXTERN_C()
-
-ZEND_API char *zend_strndup(const char *s, unsigned int length);
-
-ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-
-/* Standard wrapper macros */
-#define emalloc(size) _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define efree(ptr) _efree((ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define ecalloc(nmemb, size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define erealloc(ptr, size) _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define erealloc_recoverable(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define estrdup(s) _estrdup((s) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define estrndup(s, length) _estrndup((s), (length) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-
-/* Relay wrapper macros */
-#define emalloc_rel(size) _emalloc((size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-#define efree_rel(ptr) _efree((ptr) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-#define ecalloc_rel(nmemb, size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-#define erealloc_rel(ptr, size) _erealloc((ptr), (size), 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-#define erealloc_recoverable_rel(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-#define estrdup_rel(s) _estrdup((s) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-#define estrndup_rel(s, length) _estrndup((s), (length) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-
-/* Selective persistent/non persistent allocation macros */
-#define pemalloc(size, persistent) ((persistent)?malloc(size):emalloc(size))
-#define pefree(ptr, persistent) ((persistent)?free(ptr):efree(ptr))
-#define pecalloc(nmemb, size, persistent) ((persistent)?calloc((nmemb), (size)):ecalloc((nmemb), (size)))
-#define perealloc(ptr, size, persistent) ((persistent)?realloc((ptr), (size)):erealloc((ptr), (size)))
-#define perealloc_recoverable(ptr, size, persistent) ((persistent)?realloc((ptr), (size)):erealloc_recoverable((ptr), (size)))
-#define pestrdup(s, persistent) ((persistent)?strdup(s):estrdup(s))
-
-#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):(empty_string))
-#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):(empty_string))
-
-ZEND_API int zend_set_memory_limit(unsigned int memory_limit);
-
-ZEND_API void start_memory_manager(TSRMLS_D);
-ZEND_API void shutdown_memory_manager(int silent, int clean_cache TSRMLS_DC);
-
-#if ZEND_DEBUG
-ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-void zend_debug_alloc_output(char *format, ...);
-#define mem_block_check(ptr, silent) _mem_block_check(ptr, silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define full_mem_check(silent) _full_mem_check(silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#else
-#define mem_block_check(type, ptr, silent)
-#define full_mem_check(silent)
-#endif
-
-
-END_EXTERN_C()
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
deleted file mode 100644
index abbab065e2..0000000000
--- a/Zend/zend_builtin_functions.c
+++ /dev/null
@@ -1,1490 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "zend.h"
-#include "zend_API.h"
-#include "zend_builtin_functions.h"
-#include "zend_constants.h"
-
-#undef ZEND_TEST_EXCEPTIONS
-
-static ZEND_FUNCTION(zend_version);
-static ZEND_FUNCTION(func_num_args);
-static ZEND_FUNCTION(func_get_arg);
-static ZEND_FUNCTION(func_get_args);
-static ZEND_NAMED_FUNCTION(zend_if_strlen);
-static ZEND_FUNCTION(strcmp);
-static ZEND_FUNCTION(strncmp);
-static ZEND_FUNCTION(strcasecmp);
-static ZEND_FUNCTION(strncasecmp);
-static ZEND_FUNCTION(each);
-static ZEND_FUNCTION(error_reporting);
-static ZEND_FUNCTION(define);
-static ZEND_FUNCTION(defined);
-static ZEND_FUNCTION(get_class);
-static ZEND_FUNCTION(get_parent_class);
-static ZEND_FUNCTION(method_exists);
-static ZEND_FUNCTION(class_exists);
-static ZEND_FUNCTION(function_exists);
-static ZEND_FUNCTION(leak);
-#ifdef ZEND_TEST_EXCEPTIONS
-static ZEND_FUNCTION(crash);
-#endif
-static ZEND_FUNCTION(get_included_files);
-static ZEND_FUNCTION(is_subclass_of);
-static ZEND_FUNCTION(is_a);
-static ZEND_FUNCTION(get_class_vars);
-static ZEND_FUNCTION(get_object_vars);
-static ZEND_FUNCTION(get_class_methods);
-static ZEND_FUNCTION(trigger_error);
-static ZEND_FUNCTION(set_error_handler);
-static ZEND_FUNCTION(restore_error_handler);
-static ZEND_FUNCTION(set_exception_handler);
-static ZEND_FUNCTION(restore_exception_handler);
-static ZEND_FUNCTION(get_declared_classes);
-static ZEND_FUNCTION(get_defined_functions);
-static ZEND_FUNCTION(get_defined_vars);
-static ZEND_FUNCTION(create_function);
-static ZEND_FUNCTION(get_resource_type);
-static ZEND_FUNCTION(get_loaded_extensions);
-static ZEND_FUNCTION(extension_loaded);
-static ZEND_FUNCTION(get_extension_funcs);
-static ZEND_FUNCTION(get_defined_constants);
-static ZEND_FUNCTION(debug_backtrace);
-#if ZEND_DEBUG
-static ZEND_FUNCTION(zend_test_func);
-#ifdef ZTS
-static ZEND_FUNCTION(zend_thread_id);
-#endif
-#endif
-
-ZEND_API unsigned char first_arg_force_ref[] = { 1, BYREF_FORCE };
-ZEND_API unsigned char second_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
-ZEND_API unsigned char third_arg_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-
-static zend_function_entry builtin_functions[] = {
- ZEND_FE(zend_version, NULL)
- ZEND_FE(func_num_args, NULL)
- ZEND_FE(func_get_arg, NULL)
- ZEND_FE(func_get_args, NULL)
- { "strlen", zend_if_strlen, NULL },
- ZEND_FE(strcmp, NULL)
- ZEND_FE(strncmp, NULL)
- ZEND_FE(strcasecmp, NULL)
- ZEND_FE(strncasecmp, NULL)
- ZEND_FE(each, first_arg_force_ref)
- ZEND_FE(error_reporting, NULL)
- ZEND_FE(define, NULL)
- ZEND_FE(defined, NULL)
- ZEND_FE(get_class, NULL)
- ZEND_FE(get_parent_class, NULL)
- ZEND_FE(method_exists, NULL)
- ZEND_FE(class_exists, NULL)
- ZEND_FE(function_exists, NULL)
- ZEND_FE(leak, NULL)
-#ifdef ZEND_TEST_EXCEPTIONS
- ZEND_FE(crash, NULL)
-#endif
- ZEND_FE(get_included_files, NULL)
- ZEND_FALIAS(get_required_files, get_included_files, NULL)
- ZEND_FE(is_subclass_of, NULL)
- ZEND_FE(is_a, NULL)
- ZEND_FE(get_class_vars, NULL)
- ZEND_FE(get_object_vars, NULL)
- ZEND_FE(get_class_methods, NULL)
- ZEND_FE(trigger_error, NULL)
- ZEND_FALIAS(user_error, trigger_error, NULL)
- ZEND_FE(set_error_handler, NULL)
- ZEND_FE(restore_error_handler, NULL)
- ZEND_FE(set_exception_handler, NULL)
- ZEND_FE(restore_exception_handler, NULL)
- ZEND_FE(get_declared_classes, NULL)
- ZEND_FE(get_defined_functions, NULL)
- ZEND_FE(get_defined_vars, NULL)
- ZEND_FE(create_function, NULL)
- ZEND_FE(get_resource_type, NULL)
- ZEND_FE(get_loaded_extensions, NULL)
- ZEND_FE(extension_loaded, NULL)
- ZEND_FE(get_extension_funcs, NULL)
- ZEND_FE(get_defined_constants, NULL)
- ZEND_FE(debug_backtrace, NULL)
-#if ZEND_DEBUG
- ZEND_FE(zend_test_func, NULL)
-#ifdef ZTS
- ZEND_FE(zend_thread_id, NULL)
-#endif
-#endif
- { NULL, NULL, NULL }
-};
-
-
-int zend_startup_builtin_functions(TSRMLS_D)
-{
- return zend_register_functions(builtin_functions, NULL, MODULE_PERSISTENT TSRMLS_CC);
-}
-
-
-/* {{{ proto string zend_version(void)
- Get the version of the Zend Engine */
-ZEND_FUNCTION(zend_version)
-{
- RETURN_STRINGL(ZEND_VERSION, sizeof(ZEND_VERSION)-1, 1);
-}
-/* }}} */
-
-
-/* {{{ proto int func_num_args(void)
- Get the number of arguments that were passed to the function */
-ZEND_FUNCTION(func_num_args)
-{
- void **p;
- int arg_count;
-
- p = EG(argument_stack).top_element-1-1;
- arg_count = (ulong) *p; /* this is the amount of arguments passed to func_num_args(); */
- p -= 1+arg_count;
- if (*p) {
- zend_error(E_ERROR, "func_num_args(): Can't be used as a function parameter");
- }
- --p;
- if (p>=EG(argument_stack).elements) {
- RETURN_LONG((ulong) *p);
- } else {
- zend_error(E_WARNING, "func_num_args(): Called from the global scope - no function context");
- RETURN_LONG(-1);
- }
-}
-/* }}} */
-
-
-/* {{{ proto mixed func_get_arg(int arg_num)
- Get the $arg_num'th argument that was passed to the function */
-ZEND_FUNCTION(func_get_arg)
-{
- void **p;
- int arg_count;
- zval **z_requested_offset;
- zval *arg;
- long requested_offset;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &z_requested_offset)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(z_requested_offset);
- requested_offset = (*z_requested_offset)->value.lval;
-
- if (requested_offset < 0) {
- zend_error(E_WARNING, "func_get_arg(): The argument number should be >= 0");
- RETURN_FALSE;
- }
-
- p = EG(argument_stack).top_element-1-1;
- arg_count = (ulong) *p; /* this is the amount of arguments passed to func_get_arg(); */
- p -= 1+arg_count;
- if (*p) {
- zend_error(E_ERROR, "func_get_arg(): Can't be used as a function parameter");
- }
- --p;
- if (p<EG(argument_stack).elements) {
- zend_error(E_WARNING, "func_get_arg(): Called from the global scope - no function context");
- RETURN_FALSE;
- }
- arg_count = (ulong) *p;
-
- if (requested_offset>=arg_count) {
- zend_error(E_WARNING, "func_get_arg(): Argument %d not passed to function", requested_offset);
- RETURN_FALSE;
- }
-
- arg = *(p-(arg_count-requested_offset));
- *return_value = *arg;
- zval_copy_ctor(return_value);
-}
-/* }}} */
-
-
-/* {{{ proto array func_get_args()
- Get an array of the arguments that were passed to the function */
-ZEND_FUNCTION(func_get_args)
-{
- void **p;
- int arg_count;
- int i;
-
- p = EG(argument_stack).top_element-1-1;
- arg_count = (ulong) *p; /* this is the amount of arguments passed to func_get_args(); */
- p -= 1+arg_count;
- if (*p) {
- zend_error(E_ERROR, "func_get_args(): Can't be used as a function parameter");
- }
- --p;
-
- if (p<EG(argument_stack).elements) {
- zend_error(E_WARNING, "func_get_args(): Called from the global scope - no function context");
- RETURN_FALSE;
- }
- arg_count = (ulong) *p;
-
-
- array_init(return_value);
- for (i=0; i<arg_count; i++) {
- zval *element;
-
- ALLOC_ZVAL(element);
- *element = **((zval **) (p-(arg_count-i)));
- zval_copy_ctor(element);
- INIT_PZVAL(element);
- zend_hash_next_index_insert(return_value->value.ht, &element, sizeof(zval *), NULL);
- }
-}
-/* }}} */
-
-
-/* {{{ proto int strlen(string str)
- Get string length */
-ZEND_NAMED_FUNCTION(zend_if_strlen)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(str);
- RETVAL_LONG((*str)->value.str.len);
-}
-/* }}} */
-
-
-/* {{{ proto int strcmp(string str1, string str2)
- Binary safe string comparison */
-ZEND_FUNCTION(strcmp)
-{
- zval **s1, **s2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
- RETURN_LONG(zend_binary_zval_strcmp(*s1, *s2));
-}
-/* }}} */
-
-
-/* {{{ proto int strncmp(string str1, string str2, int len)
- Binary safe string comparison */
-ZEND_FUNCTION(strncmp)
-{
- zval **s1, **s2, **s3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &s1, &s2, &s3) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
- convert_to_long_ex(s3);
- RETURN_LONG(zend_binary_zval_strncmp(*s1, *s2, *s3));
-}
-/* }}} */
-
-
-/* {{{ proto int strcasecmp(string str1, string str2)
- Binary safe case-insensitive string comparison */
-ZEND_FUNCTION(strcasecmp)
-{
- zval **s1, **s2;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
- RETURN_LONG(zend_binary_zval_strcasecmp(*s1, *s2));
-}
-/* }}} */
-
-
-/* {{{ proto int strncasecmp(string str1, string str2, int len)
- Binary safe string comparison */
-ZEND_FUNCTION(strncasecmp)
-{
- zval **s1, **s2, **s3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &s1, &s2, &s3) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
- convert_to_long_ex(s3);
- RETURN_LONG(zend_binary_zval_strncasecmp(*s1, *s2, *s3));
-}
-/* }}} */
-
-
-/* {{{ proto array each(array arr)
- Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element */
-ZEND_FUNCTION(each)
-{
- zval **array, *entry, **entry_ptr, *tmp;
- char *string_key;
- ulong num_key;
- zval **inserted_pointer;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- zend_error(E_WARNING,"Variable passed to each() is not an array or object");
- return;
- }
- if (zend_hash_get_current_data(target_hash, (void **) &entry_ptr)==FAILURE) {
- RETURN_FALSE;
- }
- array_init(return_value);
- entry = *entry_ptr;
-
- /* add value elements */
- if (entry->is_ref) {
- ALLOC_ZVAL(tmp);
- *tmp = *entry;
- zval_copy_ctor(tmp);
- tmp->is_ref=0;
- tmp->refcount=0;
- entry=tmp;
- }
- zend_hash_index_update(return_value->value.ht, 1, &entry, sizeof(zval *), NULL);
- entry->refcount++;
- zend_hash_update(return_value->value.ht, "value", sizeof("value"), &entry, sizeof(zval *), NULL);
- entry->refcount++;
-
- /* add the key elements */
- switch (zend_hash_get_current_key(target_hash, &string_key, &num_key, 1)) {
- case HASH_KEY_IS_STRING:
- add_get_index_string(return_value, 0, string_key, (void **) &inserted_pointer, 0);
- break;
- case HASH_KEY_IS_LONG:
- add_get_index_long(return_value, 0, num_key, (void **) &inserted_pointer);
- break;
- }
- zend_hash_update(return_value->value.ht, "key", sizeof("key"), inserted_pointer, sizeof(zval *), NULL);
- (*inserted_pointer)->refcount++;
- zend_hash_move_forward(target_hash);
-}
-/* }}} */
-
-
-/* {{{ proto int error_reporting(int new_error_level=null)
- Return the current error_reporting level, and if an argument was passed - change to the new level */
-ZEND_FUNCTION(error_reporting)
-{
- zval **arg;
- int old_error_reporting;
-
- old_error_reporting = EG(error_reporting);
- switch (ZEND_NUM_ARGS()) {
- case 0:
- break;
- case 1:
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(arg);
- EG(error_reporting)=(*arg)->value.lval;
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
-
- RETVAL_LONG(old_error_reporting);
-}
-/* }}} */
-
-
-/* {{{ proto bool define(string constant_name, mixed value, case_sensitive=true)
- Define a new constant */
-ZEND_FUNCTION(define)
-{
- zval **var, **val, **non_cs;
- int case_sensitive;
- zend_constant c;
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &var, &val)==FAILURE) {
- RETURN_FALSE;
- }
- case_sensitive = CONST_CS;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &var, &val, &non_cs)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(non_cs);
- if ((*non_cs)->value.lval) {
- case_sensitive = 0;
- } else {
- case_sensitive = CONST_CS;
- }
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
-
- switch((*val)->type) {
- case IS_LONG:
- case IS_DOUBLE:
- case IS_STRING:
- case IS_BOOL:
- case IS_RESOURCE:
- case IS_NULL:
- break;
- default:
- zend_error(E_WARNING,"Constants may only evaluate to scalar values");
- RETURN_FALSE;
- break;
- }
- convert_to_string_ex(var);
-
- c.value = **val;
- zval_copy_ctor(&c.value);
- c.flags = case_sensitive; /* non persistent */
- c.name = zend_strndup((*var)->value.str.val, (*var)->value.str.len);
- c.name_len = (*var)->value.str.len+1;
- if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool defined(string constant_name)
- Check whether a constant exists */
-ZEND_FUNCTION(defined)
-{
- zval **var;
- zval c;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &var)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(var);
- if (zend_get_constant((*var)->value.str.val, (*var)->value.str.len, &c TSRMLS_CC)) {
- zval_dtor(&c);
- RETURN_LONG(1);
- } else {
- RETURN_LONG(0);
- }
-}
-/* }}} */
-
-
-/* {{{ proto string get_class(object object)
- Retrieves the class name */
-ZEND_FUNCTION(get_class)
-{
- zval **arg;
- char *name;
- zend_uint name_len;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &arg)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- if (Z_TYPE_PP(arg) != IS_OBJECT) {
- RETURN_FALSE;
- }
-
- if (Z_OBJ_HT_PP(arg)->get_class_name == NULL ||
- Z_OBJ_HT_PP(arg)->get_class_name(*arg, &name, &name_len, 0 TSRMLS_CC) != SUCCESS) {
- zend_class_entry *ce;
-
- ce = zend_get_class_entry(*arg);
- if (!ce) {
- RETURN_FALSE;
- }
-
- name = ce->name;
- name_len = ce->name_length;
- }
-
- RETURN_STRINGL(name, name_len, 1);
-}
-/* }}} */
-
-
-/* {{{ proto string get_parent_class(mixed object)
- Retrieves the parent class name for object or class. */
-ZEND_FUNCTION(get_parent_class)
-{
- zval **arg;
- zend_class_entry *ce = NULL;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &arg)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (Z_TYPE_PP(arg) == IS_OBJECT) {
- char *name;
- zend_uint name_length;
-
- /* first try asking handler for parent class name */
- if (Z_OBJ_HT_PP(arg)->get_class_name != NULL &&
- Z_OBJ_HT_PP(arg)->get_class_name(*arg, &name, &name_length, 1 TSRMLS_CC) == SUCCESS) {
- name = ce->name;
- name_length = ce->name_length;
-
- RETURN_STRINGL(name, name_length, 1);
- }
- /* then try getting the class entry
- if successfull, will fall through to standard ce handling */
- if (!Z_OBJ_HT_PP(arg)->get_class_entry || !(ce = zend_get_class_entry(*arg))) {
- RETURN_FALSE;
- }
- } else if (Z_TYPE_PP(arg) == IS_STRING) {
- zend_class_entry **pce;
-
- SEPARATE_ZVAL(arg);
- zend_str_tolower(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg));
- if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &pce TSRMLS_CC) == SUCCESS) {
- ce = *pce;
- }
- }
-
- if (ce && ce->parent) {
- RETURN_STRINGL(ce->parent->name, ce->parent->name_length, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
-{
- zval **obj, **class_name;
- char *lcname;
- zend_class_entry *ce = NULL;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &obj, &class_name)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (Z_TYPE_PP(obj) != IS_OBJECT) {
- RETURN_FALSE;
- }
-
- /* TBI!! new object handlers */
- if (!HAS_CLASS_ENTRY(**obj)) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(class_name);
-
- lcname = estrndup(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name));
- zend_str_tolower(lcname, Z_STRLEN_PP(class_name));
-
- if (only_subclass)
- ce = Z_OBJCE_PP(obj)->parent;
- else
- ce = Z_OBJCE_PP(obj);
- for (; ce != NULL; ce = ce->parent) {
- if ((ce->name_length == Z_STRLEN_PP(class_name)) && !memcmp(ce->name, lcname, ce->name_length)) {
- efree(lcname);
- RETURN_TRUE;
- }
- }
- efree(lcname);
- RETURN_FALSE;
-}
-
-
-/* {{{ proto bool is_subclass_of(object object, string class_name)
- Returns true if the object has this class as one of its parents */
-ZEND_FUNCTION(is_subclass_of)
-{
- is_a_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-/* {{{ proto bool is_a(object object, string class_name)
- Returns true if the object is of this class or has this class as one of its parents */
-ZEND_FUNCTION(is_a)
-{
- is_a_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-
-/* {{{ proto array get_class_vars(string class_name)
- Returns an array of default properties of the class */
-ZEND_FUNCTION(get_class_vars)
-{
- zval **class_name;
- char *lcname;
- zend_class_entry *ce, **pce;
- zval *tmp;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class_name)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(class_name);
- lcname = estrndup((*class_name)->value.str.val, (*class_name)->value.str.len);
- zend_str_tolower(lcname, (*class_name)->value.str.len);
-
- if (zend_lookup_class(lcname, Z_STRLEN_PP(class_name), &pce TSRMLS_CC) == FAILURE) {
- efree(lcname);
- RETURN_FALSE;
- } else {
- ce = *pce;
- efree(lcname);
- array_init(return_value);
- if (!ce->constants_updated) {
- zend_hash_apply_with_argument(&ce->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
- ce->constants_updated = 1;
- }
- zend_hash_copy(return_value->value.ht, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
- }
-}
-/* }}} */
-
-
-/* {{{ proto array get_object_vars(object obj)
- Returns an array of object properties */
-ZEND_FUNCTION(get_object_vars)
-{
- zval **obj;
- zval *tmp;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &obj) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if ((*obj)->type != IS_OBJECT) {
- RETURN_FALSE;
- }
- if (Z_OBJ_HT_PP(obj)->get_properties == NULL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- zend_hash_copy(return_value->value.ht, Z_OBJ_HT_PP(obj)->get_properties(*obj TSRMLS_CC),
- (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
-}
-/* }}} */
-
-
-/* {{{ proto array get_class_methods(mixed class)
- Returns an array of method names for class or class instance. */
-ZEND_FUNCTION(get_class_methods)
-{
- zval **class;
- zval *method_name;
- zend_class_entry *ce = NULL, **pce;
- char *string_key;
- ulong num_key;
- int key_type;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (Z_TYPE_PP(class) == IS_OBJECT) {
- /* TBI!! new object handlers */
- if (!HAS_CLASS_ENTRY(**class)) {
- RETURN_FALSE;
- }
- ce = Z_OBJCE_PP(class);
- } else if (Z_TYPE_PP(class) == IS_STRING) {
- SEPARATE_ZVAL(class);
- zend_str_tolower(Z_STRVAL_PP(class), Z_STRLEN_PP(class));
-
- if (zend_lookup_class(Z_STRVAL_PP(class), Z_STRLEN_PP(class), &pce TSRMLS_CC) == SUCCESS) {
- ce = *pce;
- }
- }
-
- if (!ce) {
- RETURN_NULL();
- }
-
- array_init(return_value);
- zend_hash_internal_pointer_reset(&ce->function_table);
- while ((key_type = zend_hash_get_current_key(&ce->function_table, &string_key, &num_key, 1)) != HASH_KEY_NON_EXISTANT) {
- if (key_type == HASH_KEY_IS_STRING) {
- MAKE_STD_ZVAL(method_name);
- ZVAL_STRING(method_name, string_key, 0);
- zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
- }
- zend_hash_move_forward(&ce->function_table);
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool method_exists(object object, string method)
- Checks if the class method exists */
-ZEND_FUNCTION(method_exists)
-{
- zval **klass, **method_name;
- char *lcname;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &klass, &method_name)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- if ((*klass)->type != IS_OBJECT) {
- RETURN_FALSE;
- }
-
- /* TBI!! new object handlers */
- if (!HAS_CLASS_ENTRY(**klass)) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(method_name);
- lcname = estrndup((*method_name)->value.str.val, (*method_name)->value.str.len);
- zend_str_tolower(lcname, (*method_name)->value.str.len);
- if (zend_hash_exists(&Z_OBJCE_PP(klass)->function_table, lcname, (*method_name)->value.str.len+1)) {
- efree(lcname);
- RETURN_TRUE;
- } else {
- efree(lcname);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool class_exists(string classname)
- Checks if the class exists */
-ZEND_FUNCTION(class_exists)
-{
- zval **class_name;
- char *lcname;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class_name)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(class_name);
- lcname = estrndup((*class_name)->value.str.val, (*class_name)->value.str.len);
- zend_str_tolower(lcname, (*class_name)->value.str.len);
- if (zend_hash_exists(EG(class_table), lcname, (*class_name)->value.str.len+1)) {
- efree(lcname);
- RETURN_TRUE;
- } else {
- efree(lcname);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool function_exists(string function_name)
- Checks if the function exists */
-ZEND_FUNCTION(function_exists)
-{
- zval **function_name;
- zend_function *func;
- char *lcname;
- zend_bool retval;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &function_name)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(function_name);
- lcname = estrndup((*function_name)->value.str.val, (*function_name)->value.str.len);
- zend_str_tolower(lcname, (*function_name)->value.str.len);
-
- retval = (zend_hash_find(EG(function_table), lcname, (*function_name)->value.str.len+1, (void **)&func) == SUCCESS);
- efree(lcname);
-
- /*
- * A bit of a hack, but not a bad one: we see if the handler of the function
- * is actually one that displays "function is disabled" message.
- */
- if (retval &&
- func->internal_function.handler == zif_display_disabled_function) {
- retval = 0;
- }
-
- RETURN_BOOL(retval);
-}
-/* }}} */
-
-
-/* {{{ proto void leak(int num_bytes=3)
- Cause an intentional memory leak, for testing/debugging purposes */
-ZEND_FUNCTION(leak)
-{
- int leakbytes=3;
- zval **leak;
-
- if (ZEND_NUM_ARGS()>=1) {
- if (zend_get_parameters_ex(1, &leak)==SUCCESS) {
- convert_to_long_ex(leak);
- leakbytes = (*leak)->value.lval;
- }
- }
-
- emalloc(leakbytes);
-}
-/* }}} */
-
-
-#ifdef ZEND_TEST_EXCEPTIONS
-ZEND_FUNCTION(crash)
-{
- char *nowhere=NULL;
-
- memcpy(nowhere, "something", sizeof("something"));
-}
-#endif
-
-
-/* {{{ proto array get_included_files(void)
- Returns an array with the file names that were include_once()'d */
-ZEND_FUNCTION(get_included_files)
-{
- char *entry;
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- array_init(return_value);
- zend_hash_internal_pointer_reset(&EG(included_files));
- while (zend_hash_get_current_key(&EG(included_files), &entry, NULL, 1) == HASH_KEY_IS_STRING) {
- add_next_index_string(return_value, entry, 0);
- zend_hash_move_forward(&EG(included_files));
- }
-}
-/* }}} */
-
-
-/* {{{ proto void trigger_error(string messsage [, int error_type])
- Generates a user-level error/warning/notice message */
-ZEND_FUNCTION(trigger_error)
-{
- int error_type = E_USER_NOTICE;
- zval **z_error_type, **z_error_message;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &z_error_message)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &z_error_message, &z_error_type)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_long_ex(z_error_type);
- error_type = (*z_error_type)->value.lval;
- switch (error_type) {
- case E_USER_ERROR:
- case E_USER_WARNING:
- case E_USER_NOTICE:
- break;
- default:
- zend_error(E_WARNING, "Invalid error type specified");
- RETURN_FALSE;
- break;
- }
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(z_error_message);
- zend_error(error_type, "%s", (*z_error_message)->value.str.val);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto string set_error_handler(string error_handler)
- Sets a user-defined error handler function. Returns the previously defined error handler, or false on error */
-ZEND_FUNCTION(set_error_handler)
-{
- zval **error_handler;
- zend_bool had_orig_error_handler=0;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &error_handler)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(error_handler);
- if (EG(user_error_handler)) {
- had_orig_error_handler = 1;
- *return_value = *EG(user_error_handler);
- zval_copy_ctor(return_value);
- zend_ptr_stack_push(&EG(user_error_handlers), EG(user_error_handler));
- }
- ALLOC_ZVAL(EG(user_error_handler));
-
- if (Z_STRLEN_PP(error_handler)==0) { /* unset user-defined handler */
- FREE_ZVAL(EG(user_error_handler));
- EG(user_error_handler) = NULL;
- RETURN_TRUE;
- }
-
- *EG(user_error_handler) = **error_handler;
- zval_copy_ctor(EG(user_error_handler));
-
- if (!had_orig_error_handler) {
- RETURN_NULL();
- }
-}
-/* }}} */
-
-
-/* {{{ proto void restore_error_handler(void)
- Restores the previously defined error handler function */
-ZEND_FUNCTION(restore_error_handler)
-{
- if (EG(user_error_handler)) {
- zval_ptr_dtor(&EG(user_error_handler));
- }
- if (zend_ptr_stack_num_elements(&EG(user_error_handlers))==0) {
- EG(user_error_handler) = NULL;
- } else {
- EG(user_error_handler) = zend_ptr_stack_pop(&EG(user_error_handlers));
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto string set_exception_handler(string exception_handler)
- Sets a user-defined exception handler function. Returns the previously defined exception handler, or false on error */
-ZEND_FUNCTION(set_exception_handler)
-{
- zval **exception_handler;
- zend_bool had_orig_exception_handler=0;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &exception_handler)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(exception_handler);
- if (EG(user_exception_handler)) {
- had_orig_exception_handler = 1;
- *return_value = *EG(user_exception_handler);
- zval_copy_ctor(return_value);
- zend_ptr_stack_push(&EG(user_exception_handlers), EG(user_exception_handler));
- }
- ALLOC_ZVAL(EG(user_exception_handler));
-
- if (Z_STRLEN_PP(exception_handler)==0) { /* unset user-defined handler */
- FREE_ZVAL(EG(user_exception_handler));
- EG(user_exception_handler) = NULL;
- RETURN_TRUE;
- }
-
- *EG(user_exception_handler) = **exception_handler;
- zval_copy_ctor(EG(user_exception_handler));
-
- if (!had_orig_exception_handler) {
- RETURN_NULL();
- }
-}
-/* }}} */
-
-
-/* {{{ proto void restore_exception_handler(void)
- Restores the previously defined exception handler function */
-ZEND_FUNCTION(restore_exception_handler)
-{
- if (EG(user_exception_handler)) {
- zval_ptr_dtor(&EG(user_exception_handler));
- }
- if (zend_ptr_stack_num_elements(&EG(user_exception_handlers))==0) {
- EG(user_exception_handler) = NULL;
- } else {
- EG(user_exception_handler) = zend_ptr_stack_pop(&EG(user_exception_handlers));
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-static int copy_class_name(zend_class_entry **pce, int num_args, va_list args, zend_hash_key *hash_key)
-{
- zval *array = va_arg(args, zval *);
- zend_class_entry *ce = *pce;
-
- if (hash_key->nKeyLength==0 || hash_key->arKey[0]!=0) {
- add_next_index_stringl(array, ce->name, ce->name_length, 1);
- }
- return 0;
-}
-
-
-/* {{{ proto array get_declared_classes(void)
- Returns an array of all declared classes. */
-ZEND_FUNCTION(get_declared_classes)
-{
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- array_init(return_value);
- zend_hash_apply_with_arguments(EG(class_table), (apply_func_args_t) copy_class_name, 1, return_value);
-}
-/* }}} */
-
-
-static int copy_function_name(zend_function *func, int num_args, va_list args, zend_hash_key *hash_key)
-{
- zval *internal_ar = va_arg(args, zval *),
- *user_ar = va_arg(args, zval *);
-
- if (hash_key->nKeyLength == 0 || hash_key->arKey[0] == 0) {
- return 0;
- }
-
- if (func->type == ZEND_INTERNAL_FUNCTION) {
- add_next_index_stringl(internal_ar, hash_key->arKey, hash_key->nKeyLength-1, 1);
- } else if (func->type == ZEND_USER_FUNCTION) {
- add_next_index_stringl(user_ar, hash_key->arKey, hash_key->nKeyLength-1, 1);
- }
-
- return 0;
-}
-
-
-/* {{{ proto array get_defined_functions(void)
- Returns an array of all defined functions */
-ZEND_FUNCTION(get_defined_functions)
-{
- zval *internal;
- zval *user;
-
- if (ZEND_NUM_ARGS() != 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- MAKE_STD_ZVAL(internal);
- MAKE_STD_ZVAL(user);
-
- array_init(internal);
- array_init(user);
- array_init(return_value);
-
- zend_hash_apply_with_arguments(EG(function_table), (apply_func_args_t) copy_function_name, 2, internal, user);
-
- if (zend_hash_add(return_value->value.ht, "internal", sizeof("internal"), (void **)&internal, sizeof(zval *), NULL) == FAILURE) {
- zend_error(E_WARNING, "Cannot add internal functions to return value from get_defined_functions()");
- RETURN_FALSE;
- }
-
- if (zend_hash_add(return_value->value.ht, "user", sizeof("user"), (void **)&user, sizeof(zval *), NULL) == FAILURE) {
- zend_error(E_WARNING, "Cannot add user functions to return value from get_defined_functions()");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto array get_defined_vars(void)
- Returns an associative array of names and values of all currently defined variable names (variables in the current scope) */
-ZEND_FUNCTION(get_defined_vars)
-{
- zval *tmp;
-
- array_init(return_value);
-
- zend_hash_copy(return_value->value.ht, EG(active_symbol_table),
- (copy_ctor_func_t)zval_add_ref, &tmp, sizeof(zval *));
-}
-/* }}} */
-
-
-#define LAMBDA_TEMP_FUNCNAME "__lambda_func"
-/* {{{ proto string create_function(string args, string code)
- Creates an anonymous function, and returns its name (funny, eh?) */
-ZEND_FUNCTION(create_function)
-{
- char *eval_code, *function_name;
- int eval_code_length, function_name_length;
- zval **z_function_args, **z_function_code;
- int retval;
- char *eval_name;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &z_function_args, &z_function_code)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(z_function_args);
- convert_to_string_ex(z_function_code);
-
- eval_code_length = sizeof("function " LAMBDA_TEMP_FUNCNAME)
- +Z_STRLEN_PP(z_function_args)
- +2 /* for the args parentheses */
- +2 /* for the curly braces */
- +Z_STRLEN_PP(z_function_code);
-
- eval_code = (char *) emalloc(eval_code_length);
- sprintf(eval_code, "function " LAMBDA_TEMP_FUNCNAME "(%s){%s}", Z_STRVAL_PP(z_function_args), Z_STRVAL_PP(z_function_code));
-
- eval_name = zend_make_compiled_string_description("runtime-created function" TSRMLS_CC);
- retval = zend_eval_string(eval_code, NULL, eval_name TSRMLS_CC);
- efree(eval_code);
- efree(eval_name);
-
- if (retval==SUCCESS) {
- zend_function *func;
-
- if (zend_hash_find(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME), (void **) &func)==FAILURE) {
- zend_error(E_ERROR, "Unexpected inconsistency in create_function()");
- RETURN_FALSE;
- }
- function_add_ref(func);
-
- function_name = (char *) emalloc(sizeof("0lambda_")+MAX_LENGTH_OF_LONG);
-
- do {
- sprintf(function_name, "%clambda_%d", 0, ++EG(lambda_count));
- function_name_length = strlen(function_name+1)+1;
- } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, func, sizeof(zend_function), NULL)==FAILURE);
- zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME));
- RETURN_STRINGL(function_name, function_name_length, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-#if ZEND_DEBUG
-ZEND_FUNCTION(zend_test_func)
-{
- zval *arg1, *arg2;
-
- zend_get_parameters(ht, 2, &arg1, &arg2);
-}
-
-
-#ifdef ZTS
-ZEND_FUNCTION(zend_thread_id)
-{
- RETURN_LONG(tsrm_thread_id());
-}
-#endif
-#endif
-
-/* {{{ proto string get_resource_type(resource res)
- Get the resource type name for a given resource */
-ZEND_FUNCTION(get_resource_type)
-{
- char *resource_type;
- zval **z_resource_type;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &z_resource_type)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (Z_TYPE_PP(z_resource_type) != IS_RESOURCE) {
- zend_error(E_WARNING, "Supplied argument is not a valid resource handle");
- RETURN_FALSE;
- }
-
- resource_type = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(z_resource_type) TSRMLS_CC);
- if (resource_type) {
- RETURN_STRING(resource_type, 1);
- } else {
- RETURN_STRING("Unknown", 1);
- }
-}
-/* }}} */
-
-
-static int add_extension_info(zend_module_entry *module, void *arg TSRMLS_DC)
-{
- zval *name_array = (zval *)arg;
- add_next_index_string(name_array, module->name, 1);
- return 0;
-}
-
-static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC)
-{
- zval *name_array = (zval *)arg;
- zval *const_val;
-
- MAKE_STD_ZVAL(const_val);
- *const_val = constant->value;
- zval_copy_ctor(const_val);
- INIT_PZVAL(const_val);
- add_assoc_zval_ex(name_array, constant->name, constant->name_len, const_val);
- return 0;
-}
-
-
-/* {{{ proto array get_loaded_extensions(void)
- Return an array containing names of loaded extensions */
-ZEND_FUNCTION(get_loaded_extensions)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- array_init(return_value);
- zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) add_extension_info, return_value TSRMLS_CC);
-}
-/* }}} */
-
-
-/* {{{ proto array get_defined_constants(void)
- Return an array containing the names and values of all defined constants */
-ZEND_FUNCTION(get_defined_constants)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- array_init(return_value);
- zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) add_constant_info, return_value TSRMLS_CC);
-}
-/* }}} */
-
-
-static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC) {
- void **p = *curpos - 2;
- zval *arg_array, **arg;
- int arg_count = (ulong) *p;
-
- *curpos -= (arg_count+2);
-
- MAKE_STD_ZVAL(arg_array);
- array_init(arg_array);
- p -= arg_count;
-
- while (--arg_count >= 0) {
- arg = (zval **) p++;
- SEPARATE_ZVAL_TO_MAKE_IS_REF(arg);
- (*arg)->refcount++;
- add_next_index_zval(arg_array, *arg);
- }
- return arg_array;
-}
-
-/* {{{ proto void debug_backtrace(void)
- Prints out a backtrace */
-ZEND_FUNCTION(debug_backtrace)
-{
- zend_execute_data *ptr;
- int lineno;
- char *function_name;
- char *filename;
- char *class_name;
- char *call_type;
- char *include_filename = NULL;
- zval *stack_frame;
- void **cur_arg_pos = EG(argument_stack).top_element;
- void **args = cur_arg_pos;
- int arg_stack_consistent = 0;
-
- if (ZEND_NUM_ARGS()) {
- WRONG_PARAM_COUNT;
- }
-
- while (--args >= EG(argument_stack).elements) {
- if (*args--) {
- break;
- }
- args -= *(ulong*)args;
-
- if (args == EG(argument_stack).elements) {
- arg_stack_consistent = 1;
- break;
- }
- }
-
- ptr = EG(current_execute_data);
-
- /* skip debug_backtrace() */
- ptr = ptr->prev_execute_data;
- cur_arg_pos -= 2;
-
- array_init(return_value);
-
- while (ptr) {
- MAKE_STD_ZVAL(stack_frame);
- array_init(stack_frame);
-
- if (ptr->op_array) {
- filename = ptr->op_array->filename;
- lineno = ptr->opline->lineno;
- add_assoc_string_ex(stack_frame, "file", sizeof("file"), filename, 1);
- add_assoc_long_ex(stack_frame, "line", sizeof("line"), lineno);
-
- /* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function
- * and debug_baktrace() might have been called by the error_handler. in this case we don't
- * want to pop anything of the argument-stack */
- } else {
- filename = NULL;
- }
-
- function_name = ptr->function_state.function->common.function_name;
-
- if (function_name) {
- add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
-
- if (ptr->object) {
- class_name = Z_OBJCE(*ptr->object)->name;
- call_type = "->";
- } else if (ptr->function_state.function->common.scope) {
- class_name = ptr->function_state.function->common.scope->name;
- call_type = "::";
- } else {
- class_name = NULL;
- call_type = NULL;
- }
-
- if (class_name) {
- add_assoc_string_ex(stack_frame, "class", sizeof("class"), class_name, 1);
- add_assoc_string_ex(stack_frame, "type", sizeof("type"), call_type, 1);
- }
-
- if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) {
- if (arg_stack_consistent) {
- add_assoc_zval_ex(stack_frame, "args", sizeof("args"), debug_backtrace_get_args(&cur_arg_pos TSRMLS_CC));
- }
- }
- } else {
- /* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */
- zend_bool build_filename_arg = 1;
-
- switch (ptr->opline->op2.u.constant.value.lval) {
- case ZEND_EVAL:
- function_name = "eval";
- build_filename_arg = 0;
- break;
- case ZEND_INCLUDE:
- function_name = "include";
- break;
- case ZEND_REQUIRE:
- function_name = "require";
- break;
- case ZEND_INCLUDE_ONCE:
- function_name = "include_once";
- break;
- case ZEND_REQUIRE_ONCE:
- function_name = "require_once";
- break;
- default:
- /* this can actually happen if you use debug_backtrace() in your error_handler and
- * you're in the top-scope */
- function_name = "unknown";
- build_filename_arg = 0;
- break;
- }
-
- if (build_filename_arg && include_filename) {
- zval *arg_array;
-
- MAKE_STD_ZVAL(arg_array);
- array_init(arg_array);
-
- /* include_filename always points to the last filename of the last last called-fuction.
- if we have called include in the frame above - this is the file we have included.
- */
-
- add_next_index_string(arg_array, include_filename, 1);
- add_assoc_zval_ex(stack_frame, "args", sizeof("args"), arg_array);
- }
-
- add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
- }
-
- add_next_index_zval(return_value, stack_frame);
-
- include_filename = filename;
-
- ptr = ptr->prev_execute_data;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool extension_loaded(string extension_name)
- Returns true if the named extension is loaded */
-ZEND_FUNCTION(extension_loaded)
-{
- zval **extension_name;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &extension_name)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(extension_name);
- if (zend_hash_exists(&module_registry, Z_STRVAL_PP(extension_name), Z_STRLEN_PP(extension_name)+1)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto array get_extension_funcs(string extension_name)
- Returns an array with the names of functions belonging to the named extension */
-ZEND_FUNCTION(get_extension_funcs)
-{
- zval **extension_name;
- zend_module_entry *module;
- zend_function_entry *func;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &extension_name)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(extension_name);
- if (zend_hash_find(&module_registry, Z_STRVAL_PP(extension_name),
- Z_STRLEN_PP(extension_name)+1, (void**)&module) == FAILURE) {
- return;
- }
-
- array_init(return_value);
- func = module->functions;
- if (!func) {
- return;
- }
-
- while (func->fname) {
- add_next_index_string(return_value, func->fname, 1);
- func++;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_builtin_functions.h b/Zend/zend_builtin_functions.h
deleted file mode 100644
index 471037a3f9..0000000000
--- a/Zend/zend_builtin_functions.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_BUILTIN_FUNCTIONS_H
-#define ZEND_BUILTIN_FUNCTIONS_H
-
-int zend_startup_builtin_functions(TSRMLS_D);
-
-#endif /* ZEND_BUILTIN_FUNCTIONS_H */
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
deleted file mode 100644
index cd6815e56a..0000000000
--- a/Zend/zend_compile.c
+++ /dev/null
@@ -1,3055 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "zend_language_parser.h"
-#include "zend.h"
-#include "zend_compile.h"
-#include "zend_llist.h"
-#include "zend_API.h"
-#include "zend_fast_cache.h"
-
-
-ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
-
-
-#ifndef ZTS
-ZEND_API zend_compiler_globals compiler_globals;
-ZEND_API zend_executor_globals executor_globals;
-#endif
-
-static void build_runtime_defined_function_key(zval *result, char *name, int name_length, zend_op *opline TSRMLS_DC)
-{
- char lineno_buf[32];
- uint lineno_len;
- char *filename;
-
- lineno_len = zend_sprintf(lineno_buf, "%d", opline->lineno);
- if (CG(active_op_array)->filename) {
- filename = CG(active_op_array)->filename;
- } else {
- filename = "-";
- }
-
- /* NULL, name length, filename length, line number length */
- result->value.str.len = 1+name_length+strlen(filename)+lineno_len;
- result->value.str.val = (char *) emalloc(result->value.str.len+1);
- sprintf(result->value.str.val, "%c%s%s%s", '\0', name, filename, lineno_buf);
- result->type = IS_STRING;
- result->refcount = 1;
-}
-
-
-static void init_compiler_declarables(TSRMLS_D)
-{
- CG(declarables).ticks.type = IS_LONG;
- CG(declarables).ticks.value.lval = 0;
-}
-
-
-
-void zend_init_compiler_data_structures(TSRMLS_D)
-{
- zend_stack_init(&CG(bp_stack));
- zend_stack_init(&CG(function_call_stack));
- zend_stack_init(&CG(switch_cond_stack));
- zend_stack_init(&CG(foreach_copy_stack));
- zend_stack_init(&CG(object_stack));
- zend_stack_init(&CG(declare_stack));
- CG(active_class_entry) = NULL;
- CG(active_ce_parent_class_name).value.str.val = NULL;
- zend_llist_init(&CG(list_llist), sizeof(list_llist_element), NULL, 0);
- zend_llist_init(&CG(dimension_llist), sizeof(int), NULL, 0);
- zend_stack_init(&CG(list_stack));
- CG(handle_op_arrays) = 1;
- CG(in_compilation) = 0;
- init_compiler_declarables(TSRMLS_C);
- CG(throw_list) = NULL;
- zend_register_auto_global("GLOBALS", sizeof("GLOBALS")-1 TSRMLS_CC);
- CG(in_clone_method) = 0;
-}
-
-
-void init_compiler(TSRMLS_D)
-{
- zend_init_compiler_data_structures(TSRMLS_C);
- zend_init_rsrc_list(TSRMLS_C);
- zend_hash_init(&CG(filenames_table), 5, NULL, (dtor_func_t) free_estring, 0);
- zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) zend_file_handle_dtor, 0);
- CG(unclean_shutdown) = 0;
-}
-
-
-void shutdown_compiler(TSRMLS_D)
-{
- zend_stack_destroy(&CG(bp_stack));
- zend_stack_destroy(&CG(function_call_stack));
- zend_stack_destroy(&CG(switch_cond_stack));
- zend_stack_destroy(&CG(foreach_copy_stack));
- zend_stack_destroy(&CG(object_stack));
- zend_stack_destroy(&CG(declare_stack));
- zend_stack_destroy(&CG(list_stack));
- zend_hash_destroy(&CG(filenames_table));
- zend_llist_destroy(&CG(open_files));
-}
-
-
-ZEND_API char *zend_set_compiled_filename(char *new_compiled_filename TSRMLS_DC)
-{
- char **pp, *p;
- int length = strlen(new_compiled_filename);
-
- if (zend_hash_find(&CG(filenames_table), new_compiled_filename, length+1, (void **) &pp)==SUCCESS) {
- CG(compiled_filename) = *pp;
- return *pp;
- }
- p = estrndup(new_compiled_filename, length);
- zend_hash_update(&CG(filenames_table), new_compiled_filename, length+1, &p, sizeof(char *), (void **) &pp);
- CG(compiled_filename) = p;
- return p;
-}
-
-
-ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC)
-{
- CG(compiled_filename) = original_compiled_filename;
-}
-
-
-ZEND_API char *zend_get_compiled_filename(TSRMLS_D)
-{
- return CG(compiled_filename);
-}
-
-
-ZEND_API int zend_get_compiled_lineno(TSRMLS_D)
-{
- return CG(zend_lineno);
-}
-
-
-ZEND_API zend_bool zend_is_compiling(TSRMLS_D)
-{
- return CG(in_compilation);
-}
-
-
-static zend_uint get_temporary_variable(zend_op_array *op_array)
-{
- return (op_array->T)++;
-}
-
-
-void zend_do_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = op;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *op1;
- opline->op2 = *op2;
- *result = opline->result;
-}
-
-
-void zend_do_unary_op(zend_uchar op, znode *result, znode *op1 TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = op;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *op1;
- *result = opline->result;
- SET_UNUSED(opline->op2);
-}
-
-#define MAKE_NOP(opline) { opline->opcode = ZEND_NOP; memset(&opline->result,0,sizeof(znode)); memset(&opline->op1,0,sizeof(znode)); memset(&opline->op2,0,sizeof(znode)); opline->result.op_type=opline->op1.op_type=opline->op2.op_type=IS_UNUSED; }
-
-static void zend_replace_object_fetch(zend_op *last_op, znode *value TSRMLS_DC)
-{
- if (value->op_type != IS_VAR) {
- last_op->opcode = ZEND_MAKE_VAR;
- last_op->result.op_type = IS_VAR;
- last_op->result.u.EA.type = 0;
- last_op->result.u.var = get_temporary_variable(CG(active_op_array));
- last_op->op1 = *value;
- SET_UNUSED(last_op->op2);
- value->op_type = IS_VAR;
- value->u.EA.type = 0;
- value->u.var = last_op->result.u.var;
- } else {
- MAKE_NOP(last_op);
- }
-}
-
-void zend_do_binary_assign_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC)
-{
- int last_op_number = get_next_op_number(CG(active_op_array))-1;
- zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number];
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- if (last_op->opcode == ZEND_FETCH_OBJ_RW) {
-
- switch(op) {
- case ZEND_ASSIGN_ADD:
- opline->opcode = ZEND_ASSIGN_ADD_OBJ;
- break;
- case ZEND_ASSIGN_SUB:
- opline->opcode = ZEND_ASSIGN_SUB_OBJ;
- break;
- case ZEND_ASSIGN_MUL:
- opline->opcode = ZEND_ASSIGN_MUL_OBJ;
- break;
- case ZEND_ASSIGN_DIV:
- opline->opcode = ZEND_ASSIGN_DIV_OBJ;
- break;
- case ZEND_ASSIGN_MOD:
- opline->opcode = ZEND_ASSIGN_MOD_OBJ;
- break;
- case ZEND_ASSIGN_SL:
- opline->opcode = ZEND_ASSIGN_SL_OBJ;
- break;
- case ZEND_ASSIGN_SR:
- opline->opcode = ZEND_ASSIGN_SR_OBJ;
- break;
- case ZEND_ASSIGN_CONCAT:
- opline->opcode = ZEND_ASSIGN_CONCAT_OBJ;
- break;
- case ZEND_ASSIGN_BW_OR:
- opline->opcode = ZEND_ASSIGN_BW_OR_OBJ;
- break;
- case ZEND_ASSIGN_BW_AND:
- opline->opcode = ZEND_ASSIGN_BW_AND_OBJ;
- break;
- case ZEND_ASSIGN_BW_XOR:
- opline->opcode = ZEND_ASSIGN_BW_XOR_OBJ;
- break;
- default:
- zend_error(E_COMPILE_ERROR, "Unknown binary op opcode %d", op);
- }
-
- opline->op2 = last_op->op2;
- opline->op1 = last_op->op1;
- zend_replace_object_fetch(last_op, op2 TSRMLS_CC);
- opline->extended_value = op2->u.var;
-
- } else {
- opline->opcode = op;
- opline->op1 = *op1;
- opline->op2 = *op2;
- }
-
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
-}
-
-
-void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar op TSRMLS_DC)
-{
- zend_op opline;
- zend_op *opline_ptr;
- zend_llist *fetch_list_ptr;
-
- if (bp) {
- opline_ptr = &opline;
- init_op(opline_ptr TSRMLS_CC);
- } else {
- opline_ptr = get_next_op(CG(active_op_array) TSRMLS_CC);
- }
-
- opline_ptr->opcode = op;
- opline_ptr->result.op_type = IS_VAR;
- opline_ptr->result.u.EA.type = 0;
- opline_ptr->result.u.var = get_temporary_variable(CG(active_op_array));
- opline_ptr->op1 = *varname;
- *result = opline_ptr->result;
- SET_UNUSED(opline_ptr->op2);
-
- if (varname->op_type == IS_CONST && varname->u.constant.type == IS_STRING
- && zend_hash_exists(CG(auto_globals), varname->u.constant.value.str.val, varname->u.constant.value.str.len+1)) {
- opline_ptr->op2.u.EA.type = ZEND_FETCH_GLOBAL;
- } else {
- opline_ptr->op2.u.EA.type = ZEND_FETCH_LOCAL;
- }
-
- if (bp) {
- zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
- zend_llist_add_element(fetch_list_ptr, opline_ptr);
- }
-}
-
-void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC)
-{
- /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */
- fetch_simple_variable_ex(result, varname, bp, ZEND_FETCH_W TSRMLS_CC);
-}
-
-void zend_do_fetch_static_member(znode *class TSRMLS_DC)
-{
- zend_llist *fetch_list_ptr;
- zend_llist_element *le;
- zend_op *opline_ptr;
-
- zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
- le = fetch_list_ptr->head;
-
- opline_ptr = (zend_op *)le->data;
- opline_ptr->op2 = *class;
- opline_ptr->op2.u.EA.type = ZEND_FETCH_STATIC_MEMBER;
-}
-
-void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC)
-{
- fetch_simple_variable(result, varname, 1 TSRMLS_CC);
-
- fetch_array_dim(result, result, first_dim TSRMLS_CC);
-}
-
-
-void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC)
-{
- zend_op opline;
- zend_llist *fetch_list_ptr;
-
- init_op(&opline TSRMLS_CC);
- opline.opcode = ZEND_FETCH_DIM_W; /* the backpatching routine assumes W */
- opline.result.op_type = IS_VAR;
- opline.result.u.EA.type = 0;
- opline.result.u.var = get_temporary_variable(CG(active_op_array));
- opline.op1 = *parent;
- opline.op2 = *dim;
- opline.extended_value = ZEND_FETCH_STANDARD;
- *result = opline.result;
-
- zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
- zend_llist_add_element(fetch_list_ptr, &opline);
-}
-
-
-void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC)
-{
- fetch_array_dim(result, parent, offset TSRMLS_CC);
-}
-
-
-void zend_do_print(znode *result, znode *arg TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->opcode = ZEND_PRINT;
- opline->op1 = *arg;
- SET_UNUSED(opline->op2);
- *result = opline->result;
-}
-
-
-void zend_do_echo(znode *arg TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_ECHO;
- opline->op1 = *arg;
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC)
-{
- int last_op_number = get_next_op_number(CG(active_op_array))-1;
- zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number];
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- if (last_op->opcode == ZEND_FETCH_OBJ_W) {
- opline->opcode = ZEND_ASSIGN_OBJ;
- opline->op1 = last_op->op1;
- opline->op2 = last_op->op2;
-
- zend_replace_object_fetch(last_op, value TSRMLS_CC);
-
- opline->extended_value = value->u.var;
- } else {
- opline->opcode = ZEND_ASSIGN;
- opline->op1 = *variable;
- opline->op2 = *value;
- }
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
-}
-
-
-void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_ASSIGN_REF;
- if (result) {
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
- } else {
- /* SET_UNUSED(opline->result); */
- opline->result.u.EA.type |= EXT_TYPE_UNUSED;
- }
- opline->op1 = *lvar;
- opline->op2 = *rvar;
-}
-
-
-static inline void do_begin_loop(TSRMLS_D)
-{
- zend_brk_cont_element *brk_cont_element;
- int parent;
-
- parent = CG(active_op_array)->current_brk_cont;
- CG(active_op_array)->current_brk_cont = CG(active_op_array)->last_brk_cont;
- brk_cont_element = get_next_brk_cont_element(CG(active_op_array));
- brk_cont_element->parent = parent;
-}
-
-
-static inline void do_end_loop(int cont_addr TSRMLS_DC)
-{
- CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].cont = cont_addr;
- CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].brk = get_next_op_number(CG(active_op_array));
- CG(active_op_array)->current_brk_cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].parent;
-}
-
-
-void zend_do_while_cond(znode *expr, znode *close_bracket_token TSRMLS_DC)
-{
- int while_cond_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPZ;
- opline->op1 = *expr;
- close_bracket_token->u.opline_num = while_cond_op_number;
- SET_UNUSED(opline->op2);
-
- do_begin_loop(TSRMLS_C);
- INC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_while_end(znode *while_token, znode *close_bracket_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- /* add unconditional jump */
- opline->opcode = ZEND_JMP;
- opline->op1.u.opline_num = while_token->u.opline_num;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- /* update while's conditional jmp */
- CG(active_op_array)->opcodes[close_bracket_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
-
- do_end_loop(while_token->u.opline_num TSRMLS_CC);
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_for_cond(znode *expr, znode *second_semicolon_token TSRMLS_DC)
-{
- int for_cond_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPZNZ;
- opline->op1 = *expr; /* the conditional expression */
- second_semicolon_token->u.opline_num = for_cond_op_number;
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_for_before_statement(znode *cond_start, znode *second_semicolon_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMP;
- opline->op1.u.opline_num = cond_start->u.opline_num;
- CG(active_op_array)->opcodes[second_semicolon_token->u.opline_num].extended_value = get_next_op_number(CG(active_op_array));
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- do_begin_loop(TSRMLS_C);
-
- INC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_for_end(znode *second_semicolon_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMP;
- opline->op1.u.opline_num = second_semicolon_token->u.opline_num+1;
- CG(active_op_array)->opcodes[second_semicolon_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- do_end_loop(second_semicolon_token->u.opline_num+1 TSRMLS_CC);
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_pre_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC)
-{
- int last_op_number = get_next_op_number(CG(active_op_array))-1;
- zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number];
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- if (last_op->opcode == ZEND_FETCH_OBJ_RW) {
- opline->opcode = (op==ZEND_PRE_INC)?ZEND_PRE_INC_OBJ:ZEND_PRE_DEC_OBJ;
- opline->op1 = last_op->op1;
- opline->op2 = last_op->op2;
-
- MAKE_NOP(last_op);
- } else {
- opline->opcode = op;
- opline->op1 = *op1;
- SET_UNUSED(opline->op2);
- }
-
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
-}
-
-
-void zend_do_post_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC)
-{
- int last_op_number = get_next_op_number(CG(active_op_array))-1;
- zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number];
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- if (last_op->opcode == ZEND_FETCH_OBJ_RW) {
- opline->opcode = (op==ZEND_POST_INC)?ZEND_POST_INC_OBJ:ZEND_POST_DEC_OBJ;
- opline->op1 = last_op->op1;
- opline->op2 = last_op->op2;
-
- MAKE_NOP(last_op);
- } else {
- opline->opcode = op;
- opline->op1 = *op1;
- SET_UNUSED(opline->op2);
- }
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
-}
-
-
-void zend_do_if_cond(znode *cond, znode *closing_bracket_token TSRMLS_DC)
-{
- int if_cond_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPZ;
- opline->op1 = *cond;
- closing_bracket_token->u.opline_num = if_cond_op_number;
- SET_UNUSED(opline->op2);
- INC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_if_after_statement(znode *closing_bracket_token, unsigned char initialize TSRMLS_DC)
-{
- int if_end_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zend_llist *jmp_list_ptr;
-
- opline->opcode = ZEND_JMP;
- /* save for backpatching */
- if (initialize) {
- zend_llist jmp_list;
-
- zend_llist_init(&jmp_list, sizeof(int), NULL, 0);
- zend_stack_push(&CG(bp_stack), (void *) &jmp_list, sizeof(zend_llist));
- }
- zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr);
- zend_llist_add_element(jmp_list_ptr, &if_end_op_number);
-
- CG(active_op_array)->opcodes[closing_bracket_token->u.opline_num].op2.u.opline_num = if_end_op_number+1;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_if_end(TSRMLS_D)
-{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_llist *jmp_list_ptr;
- zend_llist_element *le;
-
- zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr);
- for (le=jmp_list_ptr->head; le; le = le->next) {
- CG(active_op_array)->opcodes[*((int *) le->data)].op1.u.opline_num = next_op_number;
- }
- zend_llist_destroy(jmp_list_ptr);
- zend_stack_del_top(&CG(bp_stack));
- DEC_BPC(CG(active_op_array));
-}
-
-#if 0
-/* variable parsing type (compile-time) */
-#define ZEND_PARSED_MEMBER (1<<0)
-#define ZEND_PARSED_METHOD_CALL (1<<1)
-#define ZEND_PARSED_STATIC_MEMBER (1<<2)
-#define ZEND_PARSED_FUNCTION_CALL (1<<3)
-#define ZEND_PARSED_VARIABLE (1<<4)
-
-#endif
-
-void zend_check_writable_variable(znode *variable)
-{
- zend_uint type = variable->u.EA.type;
-
- if (type & ZEND_PARSED_METHOD_CALL) {
- zend_error(E_COMPILE_ERROR, "Can't use method return value in write context");
- }
- if (type == ZEND_PARSED_FUNCTION_CALL) {
- zend_error(E_COMPILE_ERROR, "Can't use function return value in write context");
- }
-}
-
-zend_bool zend_is_function_or_method_call(znode *variable)
-{
- zend_uint type = variable->u.EA.type;
-
- return ((type & ZEND_PARSED_METHOD_CALL) || (type == ZEND_PARSED_FUNCTION_CALL));
-}
-
-void zend_do_begin_import(TSRMLS_D)
-{
- zend_llist_init(&CG(import_commands), sizeof(zend_op), NULL, 0);
-}
-
-void zend_do_import(int type, znode *what TSRMLS_DC)
-{
- zend_op opline;
-
- init_op(&opline TSRMLS_CC);
-
- switch (type) {
- case T_FUNCTION:
- opline.opcode = ZEND_IMPORT_FUNCTION;
- break;
- case T_CLASS:
- opline.opcode = ZEND_IMPORT_CLASS;
- break;
- case T_CONST:
- opline.opcode = ZEND_IMPORT_CONST;
- break;
- }
-
- if (what) {
- if (type == T_FUNCTION || type == T_CLASS) {
- zend_str_tolower(what->u.constant.value.str.val, what->u.constant.value.str.len);
- }
- opline.op2 = *what;
- } else {
- SET_UNUSED(opline.op2);
- }
-
- zend_llist_add_element(&CG(import_commands), &opline);
-}
-
-void zend_do_end_import(znode *import_from TSRMLS_DC)
-{
- zend_llist_element *le;
- zend_op *opline, *opline_ptr;
-
-
- le = CG(import_commands).head;
-
- while (le) {
- opline_ptr = (zend_op *)le->data;
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- memcpy(opline, opline_ptr, sizeof(zend_op));
- opline->op1 = *import_from;
- le = le->next;
- }
- zend_llist_destroy(&CG(import_commands));
-}
-
-
-
-void zend_do_begin_variable_parse(TSRMLS_D)
-{
- zend_llist fetch_list;
-
- zend_llist_init(&fetch_list, sizeof(zend_op), NULL, 0);
- zend_stack_push(&CG(bp_stack), (void *) &fetch_list, sizeof(zend_llist));
-}
-
-
-void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC)
-{
- zend_llist *fetch_list_ptr;
- zend_llist_element *le;
- zend_op *opline, *opline_ptr;
- int num_of_created_opcodes = 0;
-
- zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
-
- le = fetch_list_ptr->head;
-
- while (le) {
- opline_ptr = (zend_op *)le->data;
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- memcpy(opline, opline_ptr, sizeof(zend_op));
- switch (type) {
- case BP_VAR_R:
- if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) {
- zend_error(E_COMPILE_ERROR, "Cannot use [] for reading");
- }
- opline->opcode -= 3;
- break;
- case BP_VAR_W:
- break;
- case BP_VAR_RW:
- opline->opcode += 3;
- break;
- case BP_VAR_IS:
- opline->opcode += 6; /* 3+3 */
- break;
- case BP_VAR_FUNC_ARG:
- opline->opcode += 9; /* 3+3+3 */
- opline->extended_value = arg_offset;
- break;
- case BP_VAR_UNSET:
- if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) {
- zend_error(E_COMPILE_ERROR, "Cannot use [] for unsetting");
- }
- opline->opcode += 12; /* 3+3+3+3 */
- break;
- }
- le = le->next;
- num_of_created_opcodes++;
- }
-
- if (num_of_created_opcodes == 1) {
- if ((opline_ptr->op1.op_type == IS_CONST) && (opline_ptr->op1.u.constant.type == IS_STRING) &&
- (opline_ptr->op1.u.constant.value.str.len == (sizeof("this")-1)) &&
- !memcmp(opline_ptr->op1.u.constant.value.str.val, "this", sizeof("this"))) {
- CG(active_op_array)->uses_this = 1;
- }
- }
-
- zend_llist_destroy(fetch_list_ptr);
- zend_stack_del_top(&CG(bp_stack));
-}
-
-
-void zend_do_init_string(znode *result TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_INIT_STRING;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_add_char(znode *result, znode *op1, znode *op2 TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_ADD_CHAR;
- opline->op1 = *op1;
- opline->op2 = *op2;
- opline->op2.op_type = IS_CONST;
- opline->result = opline->op1;
- *result = opline->result;
-}
-
-
-void zend_do_add_string(znode *result, znode *op1, znode *op2 TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_ADD_STRING;
- opline->op1 = *op1;
- opline->op2 = *op2;
- opline->op2.op_type = IS_CONST;
- opline->result = opline->op1;
- *result = opline->result;
-}
-
-
-void zend_do_add_variable(znode *result, znode *op1, znode *op2 TSRMLS_DC)
-{
- zend_op *opline;
-
- if (op1->op_type == IS_CONST) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_INIT_STRING;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- if (op1->u.constant.value.str.len>0) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_ADD_STRING;
- opline->result = *result;
- opline->op1 = *result;
- opline->op2 = *op1;
- opline->result = opline->op1;
- } else {
- zval_dtor(&op1->u.constant);
- }
- } else {
- *result = *op1;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_ADD_VAR;
- opline->result = *result;
- opline->op1 = *result;
- opline->op2 = *op2;
- *result = opline->result;
-}
-
-static void zend_lowercase_znode_if_const(znode *z)
-{
- if (z->op_type == IS_CONST) {
- zend_str_tolower(z->u.constant.value.str.val, z->u.constant.value.str.len);
- }
-}
-
-void zend_do_free(znode *op1 TSRMLS_DC)
-{
- if (op1->op_type==IS_TMP_VAR) {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_FREE;
- opline->op1 = *op1;
- SET_UNUSED(opline->op2);
- } else if (op1->op_type==IS_VAR) {
- zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
-
- while (opline->opcode == ZEND_END_SILENCE || opline->opcode == ZEND_EXT_FCALL_END) {
- opline--;
- }
- if (opline->result.op_type == op1->op_type
- && opline->result.u.var == op1->u.var) {
- opline->result.u.EA.type |= EXT_TYPE_UNUSED;
- } else {
- while (opline>CG(active_op_array)->opcodes) {
- /* This should be an object instantiation
- * Find JMP_NO_CTOR, mark the preceding ASSIGN and the
- * proceeding INIT_FCALL_BY_NAME as unused
- */
- if (opline->opcode == ZEND_JMP_NO_CTOR) {
- (opline-1)->result.u.EA.type |= EXT_TYPE_UNUSED;
- (opline+1)->op1.u.EA.type |= EXT_TYPE_UNUSED;
- break;
- } else if (opline->opcode == ZEND_FETCH_DIM_R
- && opline->op1.op_type == IS_VAR
- && opline->op1.u.var == op1->u.var) {
- /* This should the end of a list() construct
- * Mark its result as unused
- */
- opline->extended_value = ZEND_FETCH_STANDARD;
- break;
- } else if (opline->result.op_type==IS_VAR
- && opline->result.u.var == op1->u.var) {
- break;
- }
- opline--;
- }
- }
- } else if (op1->op_type == IS_CONST) {
- zval_dtor(&op1->u.constant);
- }
-}
-
-void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference TSRMLS_DC)
-{
- zend_op_array op_array;
- char *name = function_name->u.constant.value.str.val;
- int name_len = function_name->u.constant.value.str.len;
- int function_begin_line = function_token->u.opline_num;
-
- function_token->u.op_array = CG(active_op_array);
- zend_str_tolower(name, name_len);
-
- init_op_array(&op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
-
- op_array.function_name = name;
- op_array.arg_types = NULL;
- op_array.return_reference = return_reference;
-
- op_array.scope = CG(active_class_entry);
-
- if (is_method) {
- char *short_class_name = CG(active_class_entry)->name;
- zend_uint short_class_name_length = CG(active_class_entry)->name_length;
- zend_uint i;
-
- for (i=0; i < CG(active_class_entry)->name_length; i++) {
- if (CG(active_class_entry)->name[i] == ':') {
- short_class_name = &CG(active_class_entry)->name[i+1];
- short_class_name_length = strlen(short_class_name);
- }
- }
-
- zend_hash_update(&CG(active_class_entry)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array));
- if ((short_class_name_length == name_len) && (!memcmp(short_class_name, name, name_len))) {
- CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) {
- CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)))) {
- CG(active_class_entry)->destructor = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)))) {
- CG(active_class_entry)->clone = (zend_function *) CG(active_op_array);
- CG(in_clone_method) = 1;
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)))) {
- CG(active_class_entry)->__call = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)))) {
- CG(active_class_entry)->__get = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)))) {
- CG(active_class_entry)->__set = (zend_function *) CG(active_op_array);
- }
- } else {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_DECLARE_FUNCTION;
- opline->op1.op_type = IS_CONST;
- build_runtime_defined_function_key(&opline->op1.u.constant, function_name->u.constant.value.str.val, function_name->u.constant.value.str.len, opline TSRMLS_CC);
- opline->op2.op_type = IS_CONST;
- opline->op2.u.constant.type = IS_STRING;
- opline->op2.u.constant.value.str.val = estrndup(name, name_len);
- opline->op2.u.constant.value.str.len = name_len;
- opline->op2.u.constant.refcount = 1;
- opline->extended_value = ZEND_DECLARE_FUNCTION;
- zend_hash_update(CG(function_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array));
- }
-
- if (CG(extended_info)) {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_EXT_NOP;
- opline->lineno = function_begin_line;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- }
-
- {
- /* Push a seperator to the switch and foreach stacks */
- zend_switch_entry switch_entry;
-
- switch_entry.cond.op_type = IS_UNUSED;
- switch_entry.default_case = 0;
- switch_entry.control_var = 0;
-
- zend_stack_push(&CG(switch_cond_stack), (void *) &switch_entry, sizeof(switch_entry));
-
- zend_stack_push(&CG(foreach_copy_stack), (void *) &switch_entry.cond, sizeof(znode));
- }
- function_token->throw_list = CG(throw_list);
- CG(throw_list) = NULL;
-}
-
-
-void zend_do_end_function_declaration(znode *function_token TSRMLS_DC)
-{
- zend_do_extended_info(TSRMLS_C);
- zend_do_return(NULL, 0 TSRMLS_CC);
- pass_two(CG(active_op_array) TSRMLS_CC);
- CG(active_op_array) = function_token->u.op_array;
-
- /* Pop the switch and foreach seperators */
- zend_stack_del_top(&CG(switch_cond_stack));
- zend_stack_del_top(&CG(foreach_copy_stack));
-
- CG(throw_list) = function_token->throw_list;
-
- CG(in_clone_method) = 0;
-}
-
-
-void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initialization, zend_uchar pass_type TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = op;
- opline->result = *var;
- opline->op1 = *offset;
- if ((op == ZEND_RECV_INIT)) {
- opline->op2 = *initialization;
- } else {
- SET_UNUSED(opline->op2);
- }
- if (!CG(active_op_array)->arg_types) {
- if (pass_type==BYREF_FORCE) {
- int i;
-
- CG(active_op_array)->arg_types = (unsigned char *) emalloc(sizeof(unsigned char)*(offset->u.constant.value.lval+1));
- for (i=1; i<offset->u.constant.value.lval; i++) {
- CG(active_op_array)->arg_types[i] = BYREF_NONE;
- }
- CG(active_op_array)->arg_types[0]=(unsigned char) offset->u.constant.value.lval;
- CG(active_op_array)->arg_types[offset->u.constant.value.lval] = pass_type;
- }
- } else {
- CG(active_op_array)->arg_types = (unsigned char *) erealloc(CG(active_op_array)->arg_types, sizeof(unsigned char)*(offset->u.constant.value.lval+1));
- CG(active_op_array)->arg_types[0]=(unsigned char) offset->u.constant.value.lval;
- CG(active_op_array)->arg_types[offset->u.constant.value.lval] = pass_type;
- }
-}
-
-
-int zend_do_begin_function_call(znode *function_name TSRMLS_DC)
-{
- zend_function *function;
-
- zend_str_tolower(function_name->u.constant.value.str.val, function_name->u.constant.value.str.len);
- if (zend_hash_find(CG(function_table), function_name->u.constant.value.str.val, function_name->u.constant.value.str.len+1, (void **) &function)==FAILURE) {
- zend_do_begin_dynamic_function_call(function_name TSRMLS_CC);
- return 1; /* Dynamic */
- }
-
- switch (function->type) {
- case ZEND_USER_FUNCTION: {
- zend_op_array *op_array = (zend_op_array *) function;
-
- zend_stack_push(&CG(function_call_stack), (void *) &op_array, sizeof(zend_function *));
- }
- break;
- case ZEND_INTERNAL_FUNCTION: {
- zend_internal_function *internal_function = (zend_internal_function *) function;
-
- zend_stack_push(&CG(function_call_stack), (void *) &internal_function, sizeof(zend_function *));
- }
- break;
- }
- zend_do_extended_fcall_begin(TSRMLS_C);
- return 0;
-}
-
-
-
-void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC)
-{
- zend_op *last_op;
- int last_op_number;
- unsigned char *ptr = NULL;
-
- zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC);
- zend_do_begin_variable_parse(TSRMLS_C);
-
- last_op_number = get_next_op_number(CG(active_op_array))-1;
- last_op = &CG(active_op_array)->opcodes[last_op_number];
-
- if ((last_op->op2.op_type == IS_CONST) && (last_op->op2.u.constant.value.str.len == sizeof(ZEND_CLONE_FUNC_NAME)-1)
- && !memcmp(last_op->op2.u.constant.value.str.val, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME))) {
- last_op->opcode = ZEND_CLONE;
- left_bracket->u.constant.value.lval = ZEND_CLONE;
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
- zend_do_extended_fcall_begin(TSRMLS_C);
- return;
- }
-
- last_op->opcode = ZEND_INIT_METHOD_CALL;
-
- if (last_op->op2.op_type == IS_UNUSED && last_op->op2.u.EA.type == ZEND_FETCH_FROM_THIS) {
- last_op->op2 = last_op->op1;
- memset(&last_op->op1, 0, sizeof(znode));
- SET_UNUSED(last_op->op1);
- last_op->extended_value = ZEND_FETCH_FROM_THIS;
- }
-
- left_bracket->u.constant.value.lval = ZEND_INIT_FCALL_BY_NAME;
-
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
- zend_do_extended_fcall_begin(TSRMLS_C);
-}
-
-
-void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC)
-{
- unsigned char *ptr = NULL;
- zend_op *opline;
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_INIT_FCALL_BY_NAME;
- opline->op2 = *function_name;
- opline->extended_value = 0;
- SET_UNUSED(opline->op1);
-
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
- zend_do_extended_fcall_begin(TSRMLS_C);
-}
-
-
-void do_fetch_class(znode *result, znode *class_entry, znode *class_name TSRMLS_DC)
-{
- long fetch_class_op_number;
- zend_op *opline;
-
- fetch_class_op_number = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_FETCH_CLASS;
- if (class_entry) {
- opline->op1 = *class_entry;
- } else {
- SET_UNUSED(opline->op1);
- CG(catch_begin) = fetch_class_op_number;
- }
- zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len);
- if ((class_name->u.constant.value.str.len == (sizeof("self") - 1)) &&
- !memcmp(class_name->u.constant.value.str.val, "self", sizeof("self"))) {
- SET_UNUSED(opline->op2);
- opline->extended_value = ZEND_FETCH_CLASS_SELF;
- zval_dtor(&class_name->u.constant);
- } else if ((class_name->u.constant.value.str.len == (sizeof("parent") - 1)) &&
- !memcmp(class_name->u.constant.value.str.val, "parent", sizeof("parent"))) {
- SET_UNUSED(opline->op2);
- opline->extended_value = ZEND_FETCH_CLASS_PARENT;
- zval_dtor(&class_name->u.constant);
- } else if ((class_name->u.constant.value.str.len == (sizeof("main") - 1)) &&
- !memcmp(class_name->u.constant.value.str.val, "main", sizeof("main"))) {
- SET_UNUSED(opline->op2);
- opline->extended_value = ZEND_FETCH_CLASS_MAIN;
- zval_dtor(&class_name->u.constant);
- } else {
- opline->op2 = *class_name;
- }
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_CONST; /* FIXME: Hack so that INIT_FCALL_BY_NAME still knows this is a class */
- *result = opline->result;
-}
-
-
-void do_fetch_class_name(znode *result, znode *class_name_entry, znode *class_name, zend_bool case_sensitive TSRMLS_DC)
-{
- zend_uint length;
-
- if (!result) {
- result = class_name_entry;
- } else {
- *result = *class_name_entry;
- }
- if (!case_sensitive) {
- zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len);
- }
-
- length = sizeof("::")-1 + result->u.constant.value.str.len + class_name->u.constant.value.str.len;
- result->u.constant.value.str.val = erealloc(result->u.constant.value.str.val, length+1);
- memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len], "::", sizeof("::")-1);
- memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len + sizeof("::")-1], class_name->u.constant.value.str.val, class_name->u.constant.value.str.len+1);
- STR_FREE(class_name->u.constant.value.str.val);
- result->u.constant.value.str.len = length;
-}
-
-void zend_do_begin_class_member_function_call(znode *class_name, znode *function_name TSRMLS_DC)
-{
- unsigned char *ptr = NULL;
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_INIT_STATIC_METHOD_CALL;
- opline->op1 = *class_name;
- zend_lowercase_znode_if_const(function_name);
- opline->op2 = *function_name;
-
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
-}
-
-
-void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC)
-{
- zend_op *opline;
-
- if (is_method && function_name && function_name->u.constant.value.lval == ZEND_CLONE) {
- if (argument_list->u.constant.value.lval > 0) {
- zend_error(E_COMPILE_ERROR, "Can't pass arguments to __clone()");
- }
- /* FIXME: throw_list */
- zend_stack_del_top(&CG(function_call_stack));
- *result = CG(active_op_array)->opcodes[get_next_op_number(CG(active_op_array))-1].result;
- return;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- if (!is_method && !is_dynamic_fcall && function_name->op_type==IS_CONST) {
- opline->opcode = ZEND_DO_FCALL;
- opline->op1 = *function_name;
- } else {
- opline->opcode = ZEND_DO_FCALL_BY_NAME;
- SET_UNUSED(opline->op1);
- }
-
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_VAR;
- *result = opline->result;
- SET_UNUSED(opline->op2);
-
- /* Check how much this is really needed
- opline->op2.u.constant.value.lval = is_method;
- */
- if (CG(throw_list) != NULL) {
- long op_number = get_next_op_number(CG(active_op_array))-1;
- zend_llist_add_element(CG(throw_list), &op_number);
- } else {
- opline->op2.u.opline_num = -1;
- }
-
- zend_stack_del_top(&CG(function_call_stack));
- opline->extended_value = argument_list->u.constant.value.lval;
-}
-
-
-void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC)
-{
- zend_op *opline;
- unsigned char *arg_types;
- int original_op=op;
- zend_function **function_ptr_ptr, *function_ptr;
- int send_by_reference;
-
-
- zend_stack_top(&CG(function_call_stack), (void **) &function_ptr_ptr);
- function_ptr = *function_ptr_ptr;
-
- if (original_op==ZEND_SEND_REF
- && !CG(allow_call_time_pass_reference)) {
- zend_error(E_COMPILE_WARNING,
- "Call-time pass-by-reference has been deprecated - argument passed by value; "
- "If you would like to pass it by reference, modify the declaration of %s(). "
- "If you would like to enable call-time pass-by-reference, you can set "
- "allow_call_time_pass_reference to true in your INI file. "
- "However, future versions may not support this any longer. ",
- (function_ptr?function_ptr->common.function_name:"[runtime function name]"),
- offset+1);
- }
-
- if (function_ptr) {
- arg_types = function_ptr->common.arg_types;
- } else {
- arg_types = NULL;
- }
-
- send_by_reference = ARG_SHOULD_BE_SENT_BY_REF(offset, 1, arg_types)?ZEND_ARG_SEND_BY_REF:0;
-
-
- if (op == ZEND_SEND_VAR && zend_is_function_or_method_call(param)) {
- /* Method call */
- op = ZEND_SEND_VAR_NO_REF;
- } else if (op == ZEND_SEND_VAL && param->op_type == IS_VAR) {
- op = ZEND_SEND_VAR_NO_REF;
- }
-
- if (op!=ZEND_SEND_VAR_NO_REF && send_by_reference == ZEND_ARG_SEND_BY_REF) {
- /* change to passing by reference */
- switch (param->op_type) {
- case IS_VAR:
- op = ZEND_SEND_REF;
- break;
- default:
- zend_error(E_COMPILE_ERROR, "Only variables can be passed by reference");
- break;
- }
- }
-
- if (original_op == ZEND_SEND_VAR) {
- switch(op) {
- case ZEND_SEND_VAR_NO_REF:
- zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC);
- break;
- case ZEND_SEND_VAR:
- if (function_ptr) {
- zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC);
- } else {
- zend_do_end_variable_parse(BP_VAR_FUNC_ARG, offset TSRMLS_CC);
- }
- break;
- case ZEND_SEND_REF:
- zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
- break;
- }
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- if (op == ZEND_SEND_VAR_NO_REF) {
- if (function_ptr) {
- opline->extended_value = ZEND_ARG_COMPILE_TIME_BOUND | send_by_reference;
- } else {
- opline->extended_value = 0;
- }
- } else {
- if (function_ptr) {
- opline->extended_value = ZEND_DO_FCALL;
- } else {
- opline->extended_value = ZEND_DO_FCALL_BY_NAME;
- }
- }
- opline->opcode = op;
- opline->op1 = *param;
- opline->op2.u.opline_num = offset;
- SET_UNUSED(opline->op2);
-}
-
-
-static int generate_free_switch_expr(zend_switch_entry *switch_entry TSRMLS_DC)
-{
- zend_op *opline;
-
- if (switch_entry->cond.op_type!=IS_VAR && switch_entry->cond.op_type!=IS_TMP_VAR) {
- return 1;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_SWITCH_FREE;
- opline->op1 = switch_entry->cond;
- SET_UNUSED(opline->op2);
- opline->extended_value = 0;
- return 0;
-}
-
-static int generate_free_foreach_copy(znode *foreach_copy TSRMLS_DC)
-{
- zend_op *opline;
-
- if (foreach_copy->op_type!=IS_VAR && foreach_copy->op_type!=IS_TMP_VAR) {
- return 1;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_SWITCH_FREE;
- opline->op1 = *foreach_copy;
- SET_UNUSED(opline->op2);
- opline->extended_value = 1;
- return 0;
-}
-
-void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC)
-{
- zend_op *opline;
-
- if (do_end_vparse) {
- if (CG(active_op_array)->return_reference && !zend_is_function_or_method_call(expr)) {
- zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
- } else {
- zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC);
- }
-#if 0
- } else if (expr && CG(active_op_array)->return_reference) {
- zend_error(E_COMPILE_ERROR, "Only variables may be returned by reference");
-#endif
- }
-
-#ifdef ZTS
- zend_stack_apply_with_argument(&CG(switch_cond_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element, void *)) generate_free_switch_expr TSRMLS_CC);
- zend_stack_apply_with_argument(&CG(foreach_copy_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element, void *)) generate_free_foreach_copy TSRMLS_CC);
-#else
- zend_stack_apply(&CG(switch_cond_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element)) generate_free_switch_expr);
- zend_stack_apply(&CG(foreach_copy_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element)) generate_free_foreach_copy);
-#endif
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_RETURN;
-
- if (expr) {
- opline->op1 = *expr;
- } else {
- opline->op1.op_type = IS_CONST;
- INIT_ZVAL(opline->op1.u.constant);
- }
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_try(znode *try_token TSRMLS_DC)
-{
- try_token->throw_list = (void *) CG(throw_list);
- CG(throw_list) = (zend_llist *) emalloc(sizeof(zend_llist));
- zend_llist_init(CG(throw_list), sizeof(long), NULL, 0);
- /* Initialize try backpatch list used to backpatch throw, do_fcall */
-}
-
-static void throw_list_applier(long *opline_num, long *catch_opline)
-{
- zend_op *opline;
- TSRMLS_FETCH(); /* Pass this by argument */
-
- opline = &CG(active_op_array)->opcodes[*opline_num];
-
- /* Backpatch the opline of the catch statement */
- switch (opline->opcode) {
- case ZEND_DO_FCALL:
- case ZEND_DO_FCALL_BY_NAME:
- case ZEND_THROW:
- opline->op2.u.opline_num = *catch_opline;
- break;
- default:
- zend_error(E_COMPILE_ERROR, "Bad opcode in throw list");
- break;
- }
-}
-
-void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, zend_bool first_catch TSRMLS_DC)
-{
- long catch_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline;
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_CATCH;
- opline->op1 = *catch_class;
- SET_UNUSED(opline->op1); /* FIXME: Define IS_CLASS or something like that */
- opline->op2 = *catch_var;
-
- if (first_catch) {
- zend_llist_apply_with_argument(CG(throw_list), (llist_apply_with_arg_func_t) throw_list_applier, &CG(catch_begin) TSRMLS_CC);
- zend_llist_destroy(CG(throw_list));
- efree(CG(throw_list));
- CG(throw_list) = (void *) try_token->throw_list;
- }
- try_token->u.opline_num = catch_op_number;
-}
-
-void zend_do_end_catch(znode *try_token TSRMLS_DC)
-{
- CG(active_op_array)->opcodes[try_token->u.opline_num].extended_value = get_next_op_number(CG(active_op_array));
-}
-
-void zend_do_throw(znode *expr TSRMLS_DC)
-{
- zend_op *opline;
- long throw_op_number = get_next_op_number(CG(active_op_array));
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_THROW;
- opline->op1 = *expr;
- SET_UNUSED(opline->op2);
-
- if (CG(throw_list) != NULL) {
- zend_llist_add_element(CG(throw_list), &throw_op_number);
- } else {
- opline->op2.u.opline_num = -1;
- }
-}
-
-ZEND_API void function_add_ref(zend_function *function)
-{
- if (function->type == ZEND_USER_FUNCTION) {
- zend_op_array *op_array = &function->op_array;
-
- (*op_array->refcount)++;
- if (op_array->static_variables) {
- HashTable *static_variables = op_array->static_variables;
- zval *tmp_zval;
-
- ALLOC_HASHTABLE(op_array->static_variables);
- zend_hash_init(op_array->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(op_array->static_variables, static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_zval, sizeof(zval *));
- }
- }
-}
-
-
-static void do_inherit_parent_constructor(zend_class_entry *ce)
-{
- zend_function *function;
-
- if (!ce->parent || ce->constructor) {
- return;
- }
-
- if (!zend_hash_exists(&ce->function_table, ce->name, ce->name_length+1)) {
- if (zend_hash_find(&ce->parent->function_table, ce->parent->name, ce->parent->name_length+1, (void **) &function)==SUCCESS) {
- /* inherit parent's constructor */
- zend_hash_update(&ce->function_table, ce->name, ce->name_length+1, function, sizeof(zend_function), NULL);
- function_add_ref(function);
- }
- }
- if (zend_hash_find(&ce->parent->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME), (void **) &function)==SUCCESS) {
- /* inherit parent's constructor */
- zend_hash_update(&ce->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME), function, sizeof(zend_function), NULL);
- function_add_ref(function);
- }
- ce->constructor = ce->parent->constructor;
- ce->__get = ce->parent->__get;
- ce->__set = ce->parent->__set;
- ce->__call = ce->parent->__call;
-}
-
-void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce)
-{
- zend_function tmp_zend_function;
- zval *tmp;
-
- /* Perform inheritance */
- zend_hash_merge(&ce->default_properties, &parent_ce->default_properties, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0);
-
- /* STATIC_MEMBERS_FIXME */
- zend_hash_merge(ce->static_members, parent_ce->static_members, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0);
- zend_hash_merge(&ce->constants_table, &parent_ce->constants_table, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0);
- zend_hash_merge(&ce->function_table, &parent_ce->function_table, (void (*)(void *)) function_add_ref, &tmp_zend_function, sizeof(zend_function), 0);
- ce->parent = parent_ce;
- if (!ce->handle_property_get)
- ce->handle_property_get = parent_ce->handle_property_get;
- if (!ce->handle_property_set)
- ce->handle_property_set = parent_ce->handle_property_set;
- if (!ce->handle_function_call)
- ce->handle_function_call = parent_ce->handle_function_call;
- do_inherit_parent_constructor(ce);
-}
-
-static void create_class(HashTable *class_table, char *name, int name_length, zend_class_entry **ce)
-{
- zend_class_entry *new_class_entry;
-
- new_class_entry = emalloc(sizeof(zend_class_entry));
- *ce = new_class_entry;
- new_class_entry->type = ZEND_USER_CLASS;
- new_class_entry->name = estrndup(name, name_length);
- new_class_entry->name_length = name_length;
- new_class_entry->refcount = 1;
- new_class_entry->constants_updated = 0;
-
- zend_str_tolower(new_class_entry->name, new_class_entry->name_length);
-
- zend_hash_init(&new_class_entry->function_table, 10, NULL, ZEND_FUNCTION_DTOR, 0);
- zend_hash_init(&new_class_entry->class_table, 10, NULL, ZEND_CLASS_DTOR, 0);
- zend_hash_init(&new_class_entry->default_properties, 10, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_init(&new_class_entry->private_properties, 10, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_init(&new_class_entry->protected_properties, 10, NULL, ZVAL_PTR_DTOR, 0);
- ALLOC_HASHTABLE(new_class_entry->static_members);
- zend_hash_init(new_class_entry->static_members, 10, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_init(&new_class_entry->constants_table, 10, NULL, ZVAL_PTR_DTOR, 0);
-
- new_class_entry->constructor = NULL;
- new_class_entry->destructor = NULL;
- new_class_entry->clone = NULL;
- new_class_entry->__get = NULL;
- new_class_entry->__set = NULL;
- new_class_entry->__call = NULL;
-
- new_class_entry->create_object = NULL;
- new_class_entry->handle_function_call = NULL;
- new_class_entry->handle_property_set = NULL;
- new_class_entry->handle_property_get = NULL;
-
- new_class_entry->parent = NULL;
-
- if (zend_hash_update(class_table, new_class_entry->name, name_length+1, &new_class_entry, sizeof(zend_class_entry *), NULL) == FAILURE) {
- zend_error(E_COMPILE_ERROR, "Can't create class. Fatal error, please report!");
- }
-}
-
-
-#include "../TSRM/tsrm_strtok_r.h"
-
-static int create_nested_class(HashTable *class_table, char *path, zend_class_entry *new_ce)
-{
- char *cur, *temp;
- char *last;
- zend_class_entry *ce, **pce;
-
-
- cur = tsrm_strtok_r(path, ":", &temp);
-
- if (zend_hash_find(class_table, cur, strlen(cur)+1, (void **)&pce) == FAILURE) {
- create_class(class_table, cur, strlen(cur), &ce);
- } else {
- ce = *pce;
- }
-
- last = tsrm_strtok_r(NULL, ":", &temp);
-
- for(;;) {
- cur = tsrm_strtok_r(NULL, ":", &temp);
- if (!cur) {
- break;
- }
- if (zend_hash_find(&ce->class_table, last, strlen(last)+1, (void **)&pce) == FAILURE) {
- create_class(&ce->class_table, last, strlen(last), &ce);
- } else {
- ce = *pce;
- }
- last = cur;
- }
- new_ce->refcount++;
- if (zend_hash_add(&ce->class_table, last, strlen(last)+1, &new_ce, sizeof(zend_class_entry *), NULL) == FAILURE) {
- new_ce->refcount--;
- zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", last);
- return FAILURE;
- }
- return SUCCESS;
-}
-
-ZEND_API int do_bind_function(zend_op *opline, HashTable *function_table, HashTable *class_table, int compile_time)
-{
- zend_function *function;
-
- zend_hash_find(function_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void *) &function);
- if (zend_hash_add(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, function, sizeof(zend_function), NULL)==FAILURE) {
- int error_level = compile_time ? E_COMPILE_ERROR : E_ERROR;
- zend_function *function;
-
- if (zend_hash_find(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void *) &function)==SUCCESS
- && function->type==ZEND_USER_FUNCTION
- && ((zend_op_array *) function)->last>0) {
- zend_error(error_level, "Cannot redeclare %s() (previously declared in %s:%d)",
- opline->op2.u.constant.value.str.val,
- ((zend_op_array *) function)->filename,
- ((zend_op_array *) function)->opcodes[0].lineno);
- } else {
- zend_error(error_level, "Cannot redeclare %s()", opline->op2.u.constant.value.str.val);
- }
- return FAILURE;
- } else {
- (*function->op_array.refcount)++;
- function->op_array.static_variables = NULL; /* NULL out the unbound function */
- return SUCCESS;
- }
-}
-
-
-ZEND_API int do_bind_class(zend_op *opline, HashTable *function_table, HashTable *class_table)
-{
- zend_class_entry *ce, **pce;
-
- if (zend_hash_find(class_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void **) &pce)==FAILURE) {
- zend_error(E_ERROR, "Internal Zend error - Missing class information for %s", opline->op1.u.constant.value.str.val);
- return FAILURE;
- } else {
- ce = *pce;
- }
- if (strchr(opline->op2.u.constant.value.str.val, ':')) {
- return create_nested_class(class_table, opline->op2.u.constant.value.str.val, ce);
- }
- ce->refcount++;
- if (zend_hash_add(class_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, &ce, sizeof(zend_class_entry *), NULL)==FAILURE) {
- ce->refcount--;
- zend_error(E_ERROR, "Cannot redeclare class %s", opline->op2.u.constant.value.str.val);
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-ZEND_API int do_bind_inherited_class(zend_op *opline, HashTable *function_table, HashTable *class_table, zend_class_entry *parent_ce)
-{
- zend_class_entry *ce, **pce;
- int found_ce;
-
- found_ce = zend_hash_find(class_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void **) &pce);
-
- if (found_ce == FAILURE) {
- zend_error(E_ERROR, "Cannot redeclare class %s", (*pce)->name);
- return FAILURE;
- } else {
- ce = *pce;
- }
-
- zend_do_inheritance(ce, parent_ce);
-
- if (strchr(opline->op2.u.constant.value.str.val, ':')) {
- return create_nested_class(class_table, opline->op2.u.constant.value.str.val, ce);
- }
-
- ce->refcount++;
-
- /* Register the derived class */
- if (zend_hash_add(class_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, pce, sizeof(zend_class_entry *), NULL)==FAILURE) {
- zend_error(E_ERROR, "Cannot redeclare class %s", opline->op2.u.constant.value.str.val);
- ce->refcount--;
- zend_hash_destroy(&ce->function_table);
- zend_hash_destroy(&ce->default_properties);
- zend_hash_destroy(&ce->private_properties);
- zend_hash_destroy(&ce->protected_properties);
- zend_hash_destroy(ce->static_members);
- zend_hash_destroy(&ce->constants_table);
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-void zend_do_early_binding(TSRMLS_D)
-{
- zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
-
- if (do_bind_function(opline, CG(function_table), CG(class_table), 1) == FAILURE) {
- return;
- }
-
- zend_hash_del(CG(function_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len);
- zval_dtor(&opline->op1.u.constant);
- zval_dtor(&opline->op2.u.constant);
- opline->opcode = ZEND_NOP;
- memset(&opline->op1, 0, sizeof(znode));
- memset(&opline->op2, 0, sizeof(znode));
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC)
-{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPNZ_EX;
- if (expr1->op_type == IS_TMP_VAR) {
- opline->result = *expr1;
- } else {
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_TMP_VAR;
- }
- opline->op1 = *expr1;
- SET_UNUSED(opline->op2);
-
- op_token->u.opline_num = next_op_number;
-
- *expr1 = opline->result;
-}
-
-
-void zend_do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- *result = *expr1; /* we saved the original result in expr1 */
- opline->opcode = ZEND_BOOL;
- opline->result = *result;
- opline->op1 = *expr2;
- SET_UNUSED(opline->op2);
-
- CG(active_op_array)->opcodes[op_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
-}
-
-
-void zend_do_boolean_and_begin(znode *expr1, znode *op_token TSRMLS_DC)
-{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPZ_EX;
- if (expr1->op_type == IS_TMP_VAR) {
- opline->result = *expr1;
- } else {
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_TMP_VAR;
- }
- opline->op1 = *expr1;
- SET_UNUSED(opline->op2);
-
- op_token->u.opline_num = next_op_number;
-
- *expr1 = opline->result;
-}
-
-
-void zend_do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- *result = *expr1; /* we saved the original result in expr1 */
- opline->opcode = ZEND_BOOL;
- opline->result = *result;
- opline->op1 = *expr2;
- SET_UNUSED(opline->op2);
-
- CG(active_op_array)->opcodes[op_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
-}
-
-
-void zend_do_do_while_begin(TSRMLS_D)
-{
- do_begin_loop(TSRMLS_C);
- INC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_do_while_end(znode *do_token, znode *expr_open_bracket, znode *expr TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPNZ;
- opline->op1 = *expr;
- opline->op2.u.opline_num = do_token->u.opline_num;
- SET_UNUSED(opline->op2);
-
- do_end_loop(expr_open_bracket->u.opline_num TSRMLS_CC);
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = op;
- opline->op1.u.opline_num = CG(active_op_array)->current_brk_cont;
- SET_UNUSED(opline->op1);
- if (expr) {
- opline->op2 = *expr;
- } else {
- opline->op2.u.constant.type = IS_LONG;
- opline->op2.u.constant.value.lval = 1;
- INIT_PZVAL(&opline->op2.u.constant);
- opline->op2.op_type = IS_CONST;
- }
-}
-
-
-void zend_do_switch_cond(znode *cond TSRMLS_DC)
-{
- zend_switch_entry switch_entry;
- zend_op *opline;
-
- /* Initialize the conditional value */
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_BOOL;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_TMP_VAR;
- opline->op1.op_type = IS_CONST;
- opline->op1.u.constant.type = IS_BOOL;
- opline->op1.u.constant.value.lval = 0;
- INIT_PZVAL(&opline->op1.u.constant);
- SET_UNUSED(opline->op2);
-
- switch_entry.cond = *cond;
- switch_entry.default_case = -1;
- switch_entry.control_var = opline->result.u.var;
- zend_stack_push(&CG(switch_cond_stack), (void *) &switch_entry, sizeof(switch_entry));
-
- do_begin_loop(TSRMLS_C);
-
- INC_BPC(CG(active_op_array));
-}
-
-
-
-void zend_do_switch_end(znode *case_list TSRMLS_DC)
-{
- zend_op *opline;
- zend_switch_entry *switch_entry_ptr;
-
- zend_stack_top(&CG(switch_cond_stack), (void **) &switch_entry_ptr);
-
- if (case_list->op_type != IS_UNUSED) { /* non-empty switch */
- int next_op_number = get_next_op_number(CG(active_op_array));
-
- CG(active_op_array)->opcodes[case_list->u.opline_num].op1.u.opline_num = next_op_number;
- }
-
- /* add code to jmp to default case */
- if (switch_entry_ptr->default_case != -1) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_JMPZ;
- opline->op1.op_type = IS_TMP_VAR;
- opline->op1.u.var = switch_entry_ptr->control_var;
- opline->op2.u.opline_num = switch_entry_ptr->default_case;
- SET_UNUSED(opline->op2);
- }
-
-
- /* remember break/continue loop information */
- CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].brk = get_next_op_number(CG(active_op_array));
- CG(active_op_array)->current_brk_cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].parent;
-
- if (switch_entry_ptr->cond.op_type==IS_VAR || switch_entry_ptr->cond.op_type==IS_TMP_VAR) {
- /* emit free for the switch condition*/
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_SWITCH_FREE;
- opline->op1 = switch_entry_ptr->cond;
- SET_UNUSED(opline->op2);
- }
- if (switch_entry_ptr->cond.op_type == IS_CONST) {
- zval_dtor(&switch_entry_ptr->cond.u.constant);
- }
-
- zend_stack_del_top(&CG(switch_cond_stack));
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- int next_op_number;
- zend_switch_entry *switch_entry_ptr;
- znode result;
-
- zend_stack_top(&CG(switch_cond_stack), (void **) &switch_entry_ptr);
-
- opline->opcode = ZEND_CASE;
- opline->result.u.var = switch_entry_ptr->control_var;
- opline->result.op_type = IS_TMP_VAR;
- opline->op1 = switch_entry_ptr->cond;
- opline->op2 = *case_expr;
- if (opline->op1.op_type == IS_CONST) {
- zval_copy_ctor(&opline->op1.u.constant);
- }
- result = opline->result;
-
- next_op_number = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_JMPZ;
- opline->op1 = result;
- SET_UNUSED(opline->op2);
- case_token->u.opline_num = next_op_number;
-
- if (case_list->op_type==IS_UNUSED) {
- return;
- }
- next_op_number = get_next_op_number(CG(active_op_array));
- CG(active_op_array)->opcodes[case_list->u.opline_num].op1.u.opline_num = next_op_number;
-}
-
-
-void zend_do_case_after_statement(znode *result, znode *case_token TSRMLS_DC)
-{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMP;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- result->u.opline_num = next_op_number;
-
- switch (CG(active_op_array)->opcodes[case_token->u.opline_num].opcode) {
- case ZEND_JMP:
- CG(active_op_array)->opcodes[case_token->u.opline_num].op1.u.opline_num = get_next_op_number(CG(active_op_array));
- break;
- case ZEND_JMPZ:
- CG(active_op_array)->opcodes[case_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
- break;
- }
-}
-
-
-
-void zend_do_default_before_statement(znode *case_list, znode *default_token TSRMLS_DC)
-{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zend_switch_entry *switch_entry_ptr;
-
- zend_stack_top(&CG(switch_cond_stack), (void **) &switch_entry_ptr);
-
- opline->opcode = ZEND_JMP;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- default_token->u.opline_num = next_op_number;
-
- next_op_number = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_BOOL;
- opline->result.u.var = switch_entry_ptr->control_var;
- opline->result.op_type = IS_TMP_VAR;
- opline->op1.op_type = IS_CONST;
- opline->op1.u.constant.type = IS_BOOL;
- opline->op1.u.constant.value.lval = 1;
- INIT_PZVAL(&opline->op1.u.constant);
- SET_UNUSED(opline->op2);
- switch_entry_ptr->default_case = next_op_number;
-
- if (case_list->op_type==IS_UNUSED) {
- return;
- }
- next_op_number = get_next_op_number(CG(active_op_array));
- CG(active_op_array)->opcodes[case_list->u.opline_num].op1.u.opline_num = next_op_number;
-}
-
-
-void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znode *parent_class_name TSRMLS_DC)
-{
- zend_op *opline;
- int doing_inheritance = 0;
- zend_class_entry *new_class_entry = emalloc(sizeof(zend_class_entry));
-
- class_token->u.previously_active_class_entry = CG(active_class_entry);
- new_class_entry->type = ZEND_USER_CLASS;
- if (CG(active_class_entry)) {
- new_class_entry->name_length = sizeof("::")-1 + class_name->u.constant.value.str.len + CG(active_class_entry)->name_length;
- new_class_entry->name = emalloc(new_class_entry->name_length+1);
- strcpy(new_class_entry->name, CG(active_class_entry)->name);
- strcat(new_class_entry->name, "::");
- strcat(new_class_entry->name, class_name->u.constant.value.str.val);
- STR_FREE(class_name->u.constant.value.str.val);
- } else {
- new_class_entry->name = class_name->u.constant.value.str.val;
- new_class_entry->name_length = class_name->u.constant.value.str.len;
- }
- new_class_entry->refcount = 1;
- new_class_entry->constants_updated = 0;
-
- zend_str_tolower(new_class_entry->name, new_class_entry->name_length);
-
- zend_hash_init(&new_class_entry->function_table, 10, NULL, ZEND_FUNCTION_DTOR, 0);
- zend_hash_init(&new_class_entry->class_table, 10, NULL, ZEND_CLASS_DTOR, 0);
- zend_hash_init(&new_class_entry->default_properties, 10, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_init(&new_class_entry->private_properties, 10, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_init(&new_class_entry->protected_properties, 10, NULL, ZVAL_PTR_DTOR, 0);
- ALLOC_HASHTABLE(new_class_entry->static_members);
- zend_hash_init(new_class_entry->static_members, 10, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_init(&new_class_entry->constants_table, 10, NULL, ZVAL_PTR_DTOR, 0);
-
- new_class_entry->constructor = NULL;
- new_class_entry->destructor = NULL;
- new_class_entry->clone = NULL;
- new_class_entry->__get = NULL;
- new_class_entry->__set = NULL;
- new_class_entry->__call = NULL;
-
- new_class_entry->create_object = NULL;
- new_class_entry->handle_function_call = NULL;
- new_class_entry->handle_property_set = NULL;
- new_class_entry->handle_property_get = NULL;
-
- new_class_entry->parent = NULL;
-
- if (parent_class_name->op_type != IS_UNUSED) {
- doing_inheritance = 1;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->op1.op_type = IS_CONST;
- build_runtime_defined_function_key(&opline->op1.u.constant, new_class_entry->name, new_class_entry->name_length, opline TSRMLS_CC);
-
- opline->op2.op_type = IS_CONST;
- opline->op2.u.constant.type = IS_STRING;
- opline->op2.u.constant.refcount = 1;
-
- if (doing_inheritance) {
- opline->extended_value = parent_class_name->u.var;
- opline->opcode = ZEND_DECLARE_INHERITED_CLASS;
- } else {
- opline->opcode = ZEND_DECLARE_CLASS;
- }
-
- opline->op2.u.constant.value.str.val = estrndup(new_class_entry->name, new_class_entry->name_length);
- opline->op2.u.constant.value.str.len = new_class_entry->name_length;
-
- zend_hash_update(CG(class_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, &new_class_entry, sizeof(zend_class_entry *), NULL);
- CG(active_class_entry) = new_class_entry;
-}
-
-
-void zend_do_end_class_declaration(znode *class_token TSRMLS_DC)
-{
- do_inherit_parent_constructor(CG(active_class_entry));
- CG(active_class_entry) = class_token->u.previously_active_class_entry;
- if (CG(active_ce_parent_class_name).value.str.val) {
- efree(CG(active_ce_parent_class_name).value.str.val);
- CG(active_ce_parent_class_name).value.str.val = NULL;
- }
-}
-
-void mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length)
-{
- char *prop_name;
- int prop_name_length;
-
- prop_name_length = 1 + src1_length + 1 + src2_length;
- prop_name = emalloc(prop_name_length+1);
- prop_name[0] = '\0';
- memcpy(prop_name + 1, src1, src1_length+1);
- memcpy(prop_name + 1 + src1_length + 1, src2, src2_length+1);
-
- *dest = prop_name;
- *dest_length = prop_name_length;
-}
-
-void zend_do_declare_property(znode *var_name, znode *value, int declaration_type TSRMLS_DC)
-{
- zval *property;
-
- ALLOC_ZVAL(property);
-
- if (value) {
- *property = value->u.constant;
- } else {
- INIT_PZVAL(property);
- property->type = IS_NULL;
- }
-
- switch (declaration_type) {
- case T_PRIVATE:
- {
- char *priv_name;
- int priv_name_length;
-
- mangle_property_name(&priv_name, &priv_name_length, CG(active_class_entry)->name, CG(active_class_entry)->name_length, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len);
- zend_hash_update(&CG(active_class_entry)->default_properties, priv_name, priv_name_length+1, &property, sizeof(zval *), NULL);
- efree(priv_name);
-
- property->refcount++;
-
- zend_hash_update(&CG(active_class_entry)->private_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
- break;
- }
- case T_PROTECTED:
- {
- char *prot_name;
- int prot_name_length;
- zval **found = NULL;
-
- if (CG(active_class_entry)->parent) {
- zend_hash_find(&CG(active_class_entry)->parent->protected_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, (void **) &found);
- }
-
- mangle_property_name(&prot_name, &prot_name_length, "*", 1, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len);
- /* If we don't have a value and it exists in our parent then use the parent's value */
- if (!value && found) {
- (*found)->refcount++;
- zend_hash_update(&CG(active_class_entry)->default_properties, prot_name, prot_name_length+1, found, sizeof(zval *), NULL);
- (*found)->refcount++;
- zend_hash_update(&CG(active_class_entry)->protected_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, found, sizeof(zval *), NULL);
- zval_ptr_dtor(&property);
- } else {
- zend_hash_update(&CG(active_class_entry)->default_properties, prot_name, prot_name_length+1, &property, sizeof(zval *), NULL);
- property->refcount++;
- zend_hash_update(&CG(active_class_entry)->protected_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
- }
- efree(prot_name);
- break;
- }
- case T_VAR:
- zend_hash_update(&CG(active_class_entry)->default_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
- break;
- case T_STATIC:
- zend_hash_update(CG(active_class_entry)->static_members, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
- break;
- case T_CONST:
- zend_hash_update(&CG(active_class_entry)->constants_table, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
- break;
- }
- FREE_PNODE(var_name);
-}
-
-void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS_DC)
-{
- zend_op opline;
- zend_llist *fetch_list_ptr;
- zend_op *opline_ptr;
-
- zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
-
- if (fetch_list_ptr->count == 1) {
- zend_llist_element *le;
-
- le = fetch_list_ptr->head;
- opline_ptr = (zend_op *) le->data;
-
- if ((opline_ptr->op1.op_type == IS_CONST) && (opline_ptr->op1.u.constant.type == IS_STRING) &&
- (opline_ptr->op1.u.constant.value.str.len == (sizeof("this")-1)) &&
- !memcmp(opline_ptr->op1.u.constant.value.str.val, "this", sizeof("this"))) {
- efree(opline_ptr->op1.u.constant.value.str.val);
- opline_ptr->op1 = *property;
- SET_UNUSED(opline_ptr->op2);
- opline_ptr->op2.u.EA.type = ZEND_FETCH_FROM_THIS;
-
- if (CG(active_class_entry) && (opline_ptr->op1.op_type == IS_CONST)) {
- if (zend_hash_exists(&CG(active_class_entry)->private_properties, opline_ptr->op1.u.constant.value.str.val, opline_ptr->op1.u.constant.value.str.len+1)) {
- char *priv_name;
- int priv_name_length;
-
- mangle_property_name(&priv_name, &priv_name_length, CG(active_class_entry)->name, CG(active_class_entry)->name_length, opline_ptr->op1.u.constant.value.str.val, opline_ptr->op1.u.constant.value.str.len);
-
- STR_FREE(opline_ptr->op1.u.constant.value.str.val);
- opline_ptr->op1.u.constant.value.str.val = priv_name;
- opline_ptr->op1.u.constant.value.str.len = priv_name_length;
- } else if (zend_hash_exists(&CG(active_class_entry)->protected_properties, opline_ptr->op1.u.constant.value.str.val, opline_ptr->op1.u.constant.value.str.len+1)) {
- char *prot_name;
- int prot_name_length;
-
- mangle_property_name(&prot_name, &prot_name_length, "*", 1, opline_ptr->op1.u.constant.value.str.val, opline_ptr->op1.u.constant.value.str.len);
-
- STR_FREE(opline_ptr->op1.u.constant.value.str.val);
- opline_ptr->op1.u.constant.value.str.val = prot_name;
- opline_ptr->op1.u.constant.value.str.len = prot_name_length;
- }
- }
- *result = opline_ptr->result;
- return;
- }
- }
-
- init_op(&opline TSRMLS_CC);
- opline.opcode = ZEND_FETCH_OBJ_W; /* the backpatching routine assumes W */
- opline.result.op_type = IS_VAR;
- opline.result.u.EA.type = 0;
- opline.result.u.var = get_temporary_variable(CG(active_op_array));
- opline.op1 = *object;
- opline.op2 = *property;
- *result = opline.result;
-
- if (CG(in_clone_method)) {
- if ((opline_ptr->op1.op_type == IS_CONST) && (opline_ptr->op1.u.constant.type == IS_STRING) &&
- (opline_ptr->op1.u.constant.value.str.len == (sizeof("clone")-1)) &&
- !memcmp(opline_ptr->op1.u.constant.value.str.val, "clone", sizeof("clone"))) {
- if (CG(active_class_entry) && (opline.op2.op_type == IS_CONST)) {
- if (zend_hash_exists(&CG(active_class_entry)->private_properties, opline.op2.u.constant.value.str.val, opline.op2.u.constant.value.str.len+1)) {
- char *priv_name;
- int priv_name_length;
-
- mangle_property_name(&priv_name, &priv_name_length, CG(active_class_entry)->name, CG(active_class_entry)->name_length, opline.op2.u.constant.value.str.val, opline.op2.u.constant.value.str.len);
-
- STR_FREE(opline.op2.u.constant.value.str.val);
- opline.op2.u.constant.value.str.val = priv_name;
- opline.op2.u.constant.value.str.len = priv_name_length;
- } else if (zend_hash_exists(&CG(active_class_entry)->protected_properties, opline.op2.u.constant.value.str.val, opline.op2.u.constant.value.str.len+1)) {
- char *prot_name;
- int prot_name_length;
-
- mangle_property_name(&prot_name, &prot_name_length, "*", 1, opline.op2.u.constant.value.str.val, opline.op2.u.constant.value.str.len);
-
- STR_FREE(opline.op2.u.constant.value.str.val);
- opline.op2.u.constant.value.str.val = prot_name;
- opline.op2.u.constant.value.str.len = prot_name_length;
- }
- }
- }
- }
-
- zend_llist_add_element(fetch_list_ptr, &opline);
-}
-
-
-void zend_do_push_object(znode *object TSRMLS_DC)
-{
- zend_stack_push(&CG(object_stack), object, sizeof(znode));
-}
-
-
-void zend_do_pop_object(znode *object TSRMLS_DC)
-{
- znode *tmp;
-
- zend_stack_top(&CG(object_stack), (void **) &tmp);
- *object = *tmp;
- zend_stack_del_top(&CG(object_stack));
-}
-
-
-void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- unsigned char *ptr = NULL;
-
- opline->opcode = ZEND_NEW;
- opline->result.op_type = IS_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *class_type;
- SET_UNUSED(opline->op2);
-
- new_token->u.opline_num = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_JMP_NO_CTOR;
- opline->op1 = (opline-1)->result;
- SET_UNUSED(opline->op2);
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_INIT_CTOR_CALL;
- opline->op1 = (opline-2)->result;
- SET_UNUSED(opline->op2);
-
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(unsigned char *));
-}
-
-
-void zend_do_end_new_object(znode *result, znode *new_token, znode *argument_list TSRMLS_DC)
-{
- znode ctor_result;
-
- zend_do_end_function_call(NULL, &ctor_result, argument_list, 1, 0 TSRMLS_CC);
- zend_do_free(&ctor_result TSRMLS_CC);
-
- CG(active_op_array)->opcodes[new_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
- *result = CG(active_op_array)->opcodes[new_token->u.opline_num].op1;
-}
-
-
-void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode TSRMLS_DC)
-{
- switch (mode) {
- case ZEND_CT:
- if (constant_container) {
- do_fetch_class_name(NULL, constant_container, constant_name, 1 TSRMLS_CC);
- *result = *constant_container;
- } else {
- *result = *constant_name;
- }
- result->u.constant.type = IS_CONSTANT;
- break;
- case ZEND_RT:
- {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_FETCH_CONSTANT;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- if (constant_container) {
- opline->op1 = *constant_container;
- } else {
- SET_UNUSED(opline->op1);
- }
- opline->op2 = *constant_name;
- *result = opline->result;
- }
- break;
- }
-}
-
-
-void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- switch (cmd->op_type) {
- case IS_TMP_VAR:
- opline->opcode = ZEND_SEND_VAL;
- break;
- default:
- opline->opcode = ZEND_SEND_VAR;
- break;
- }
- opline->op1 = *cmd;
- opline->op2.u.opline_num = 0;
- opline->extended_value = ZEND_DO_FCALL;
- SET_UNUSED(opline->op2);
-
- /* FIXME: exception support not added to this op2 */
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_DO_FCALL;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_VAR;
- opline->op1.u.constant.value.str.val = estrndup("shell_exec", sizeof("shell_exec")-1);
- opline->op1.u.constant.value.str.len = sizeof("shell_exec")-1;
- INIT_PZVAL(&opline->op1.u.constant);
- opline->op1.u.constant.type = IS_STRING;
- opline->op1.op_type = IS_CONST;
- opline->extended_value = 1;
- SET_UNUSED(opline->op2);
- *result = opline->result;
-}
-
-
-
-void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_INIT_ARRAY;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_TMP_VAR;
- *result = opline->result;
- if (expr) {
- opline->op1 = *expr;
- if (offset) {
- opline->op2 = *offset;
- } else {
- SET_UNUSED(opline->op2);
- }
- } else {
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- }
- opline->extended_value = is_ref;
-}
-
-
-void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_ADD_ARRAY_ELEMENT;
- opline->result = *result;
- opline->op1 = *expr;
- if (offset) {
- opline->op2 = *offset;
- } else {
- SET_UNUSED(opline->op2);
- }
- opline->extended_value = is_ref;
-}
-
-
-
-void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr)
-{
- zval *element;
-
- ALLOC_ZVAL(element);
- *element = expr->u.constant;
- if (offset) {
- switch (offset->u.constant.type) {
- case IS_CONSTANT:
- /* Ugly hack to denote that this value has a constant index */
- element->type |= IS_CONSTANT_INDEX;
- /* break missing intentionally */
- case IS_STRING:
- zend_hash_update(result->u.constant.value.ht, offset->u.constant.value.str.val, offset->u.constant.value.str.len+1, &element, sizeof(zval *), NULL);
- zval_dtor(&offset->u.constant);
- break;
- case IS_LONG:
- zend_hash_index_update(result->u.constant.value.ht, offset->u.constant.value.lval, &element, sizeof(zval *), NULL);
- break;
- }
- } else {
- zend_hash_next_index_insert(result->u.constant.value.ht, &element, sizeof(zval *), NULL);
- }
-}
-
-
-void zend_do_add_list_element(znode *element TSRMLS_DC)
-{
- list_llist_element lle;
-
- if (element) {
- zend_check_writable_variable(element);
-
- lle.var = *element;
- zend_llist_copy(&lle.dimensions, &CG(dimension_llist));
- zend_llist_prepend_element(&CG(list_llist), &lle);
- }
- (*((int *)CG(dimension_llist).tail->data))++;
-}
-
-
-void zend_do_new_list_begin(TSRMLS_D)
-{
- int current_dimension = 0;
- zend_llist_add_element(&CG(dimension_llist), &current_dimension);
-}
-
-
-void zend_do_new_list_end(TSRMLS_D)
-{
- zend_llist_remove_tail(&CG(dimension_llist));
- (*((int *)CG(dimension_llist).tail->data))++;
-}
-
-
-void zend_do_list_init(TSRMLS_D)
-{
- zend_stack_push(&CG(list_stack), &CG(list_llist), sizeof(zend_llist));
- zend_stack_push(&CG(list_stack), &CG(dimension_llist), sizeof(zend_llist));
- zend_llist_init(&CG(list_llist), sizeof(list_llist_element), NULL, 0);
- zend_llist_init(&CG(dimension_llist), sizeof(int), NULL, 0);
- zend_do_new_list_begin(TSRMLS_C);
-}
-
-
-void zend_do_list_end(znode *result, znode *expr TSRMLS_DC)
-{
- zend_llist_element *le;
- zend_llist_element *dimension;
- zend_op *opline;
- znode last_container;
-
- le = CG(list_llist).head;
- while (le) {
- zend_llist *tmp_dimension_llist = &((list_llist_element *)le->data)->dimensions;
- dimension = tmp_dimension_llist->head;
- while (dimension) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- if (dimension == tmp_dimension_llist->head) { /* first */
- last_container = *expr;
- switch(expr->op_type) {
- case IS_VAR:
- opline->opcode = ZEND_FETCH_DIM_R;
- break;
- case IS_TMP_VAR:
- opline->opcode = ZEND_FETCH_DIM_TMP_VAR;
- break;
- case IS_CONST: /* fetch_dim_tmp_var will handle this bogus fetch */
- zval_copy_ctor(&expr->u.constant);
- opline->opcode = ZEND_FETCH_DIM_TMP_VAR;
- break;
- }
- } else {
- opline->opcode = ZEND_FETCH_DIM_R;
- }
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = last_container;
- opline->op2.op_type = IS_CONST;
- opline->op2.u.constant.type = IS_LONG;
- opline->op2.u.constant.value.lval = *((int *) dimension->data);
- INIT_PZVAL(&opline->op2.u.constant);
- opline->extended_value = ZEND_FETCH_ADD_LOCK;
- last_container = opline->result;
- dimension = dimension->next;
- }
- ((list_llist_element *) le->data)->value = last_container;
- zend_llist_destroy(&((list_llist_element *) le->data)->dimensions);
- zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
- zend_do_assign(result, &((list_llist_element *) le->data)->var, &((list_llist_element *) le->data)->value TSRMLS_CC);
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED;
- le = le->next;
- }
- zend_llist_destroy(&CG(dimension_llist));
- zend_llist_destroy(&CG(list_llist));
- *result = *expr;
- {
- zend_llist *p;
-
- /* restore previous lists */
- zend_stack_top(&CG(list_stack), (void **) &p);
- CG(dimension_llist) = *p;
- zend_stack_del_top(&CG(list_stack));
- zend_stack_top(&CG(list_stack), (void **) &p);
- CG(list_llist) = *p;
- zend_stack_del_top(&CG(list_stack));
- }
-}
-
-
-void zend_do_fetch_global_or_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- znode lval;
- znode result;
-
- if (fetch_type==ZEND_FETCH_STATIC && static_assignment) {
- zval *tmp;
-
- ALLOC_ZVAL(tmp);
- convert_to_string(&varname->u.constant);
- *tmp = static_assignment->u.constant;
- if (!CG(active_op_array)->static_variables) {
- ALLOC_HASHTABLE(CG(active_op_array)->static_variables);
- zend_hash_init(CG(active_op_array)->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0);
- }
- zend_hash_update(CG(active_op_array)->static_variables, varname->u.constant.value.str.val, varname->u.constant.value.str.len+1, &tmp, sizeof(zval *), NULL);
- }
-
-
- opline->opcode = ZEND_FETCH_W; /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *varname;
- SET_UNUSED(opline->op2);
- opline->op2.u.EA.type = fetch_type;
- result = opline->result;
-
- if (varname->op_type == IS_CONST) {
- zval_copy_ctor(&varname->u.constant);
- }
- fetch_simple_variable(&lval, varname, 0 TSRMLS_CC); /* Relies on the fact that the default fetch is BP_VAR_W */
-
- zend_do_assign_ref(NULL, &lval, &result TSRMLS_CC);
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED;
-}
-
-
-void zend_do_cast(znode *result, znode *expr, int type TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_CAST;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *expr;
- SET_UNUSED(opline->op2);
- opline->extended_value = type;
- *result = opline->result;
-}
-
-
-void zend_do_include_or_eval(int type, znode *result, znode *op1 TSRMLS_DC)
-{
- zend_do_extended_fcall_begin(TSRMLS_C);
- {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_INCLUDE_OR_EVAL;
- opline->result.op_type = IS_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *op1;
- SET_UNUSED(opline->op2);
- opline->op2.u.constant.value.lval = type;
- *result = opline->result;
- if (type==ZEND_REQUIRE) {
- opline->result.u.EA.type |= EXT_TYPE_UNUSED;
- }
- }
- zend_do_extended_fcall_end(TSRMLS_C);
-}
-
-
-void zend_do_indirect_references(znode *result, znode *num_references, znode *variable TSRMLS_DC)
-{
- int i;
-
- zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC);
- for (i=1; i<num_references->u.constant.value.lval; i++) {
- fetch_simple_variable_ex(result, variable, 0, ZEND_FETCH_R TSRMLS_CC);
- *variable = *result;
- }
- zend_do_begin_variable_parse(TSRMLS_C);
- fetch_simple_variable(result, variable, 1 TSRMLS_CC);
-}
-
-
-void zend_do_unset(znode *variable TSRMLS_DC)
-{
- zend_op *last_op;
-
- zend_check_writable_variable(variable);
-
- last_op = &CG(active_op_array)->opcodes[get_next_op_number(CG(active_op_array))-1];
-
- switch (last_op->opcode) {
- case ZEND_FETCH_UNSET:
- last_op->opcode = ZEND_UNSET_VAR;
- break;
- case ZEND_FETCH_DIM_UNSET:
- case ZEND_FETCH_OBJ_UNSET:
- last_op->opcode = ZEND_UNSET_DIM_OBJ;
- break;
-
- }
-}
-
-
-void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC)
-{
- zend_op *last_op;
-
- zend_do_end_variable_parse(BP_VAR_IS, 0 TSRMLS_CC);
-
- zend_check_writable_variable(variable);
-
- last_op = &CG(active_op_array)->opcodes[get_next_op_number(CG(active_op_array))-1];
-
- switch (last_op->opcode) {
- case ZEND_FETCH_IS:
- last_op->opcode = ZEND_ISSET_ISEMPTY_VAR;
- break;
- case ZEND_FETCH_DIM_IS:
- case ZEND_FETCH_OBJ_IS:
- last_op->opcode = ZEND_ISSET_ISEMPTY_DIM_OBJ;
- break;
- }
- last_op->result.op_type = IS_TMP_VAR;
- last_op->extended_value = type;
-
- *result = last_op->result;
-}
-
-
-void zend_do_is_class(znode *result, znode *expr, znode *class, int type TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_IS_CLASS;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *expr;
-
- opline->op2 = *class;
-
- *result = opline->result;
-}
-
-
-void zend_do_foreach_begin(znode *foreach_token, znode *array, znode *open_brackets_token, znode *as_token, int variable TSRMLS_DC)
-{
- zend_op *opline;
- zend_bool is_variable;
-
- if (variable) {
- if (zend_is_function_or_method_call(array)) {
- is_variable = 0;
- } else {
- is_variable = 1;
- }
- zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
- } else {
- is_variable = 0;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- /* Preform array reset */
- opline->opcode = ZEND_FE_RESET;
- opline->result.op_type = IS_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *array;
- SET_UNUSED(opline->op2);
- opline->extended_value = is_variable;
- *open_brackets_token = opline->result;
-
- zend_stack_push(&CG(foreach_copy_stack), (void *) &opline->result, sizeof(znode));
-
- /* save the location of the beginning of the loop (array fetching) */
- foreach_token->u.opline_num = get_next_op_number(CG(active_op_array));
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_FE_FETCH;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *open_brackets_token;
- SET_UNUSED(opline->op2);
- *as_token = opline->result;
-}
-
-
-void zend_do_foreach_cont(znode *value, znode *key, znode *as_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- znode result_value, result_key, dummy;
-
- if (key->op_type != IS_UNUSED) {
- znode *tmp;
-
- /* switch between the key and value... */
- tmp = key;
- key = value;
- value = tmp;
- }
-
- opline->opcode = ZEND_FETCH_DIM_TMP_VAR;
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.opline_num = get_temporary_variable(CG(active_op_array));
- opline->op1 = *as_token;
- opline->op2.op_type = IS_CONST;
- opline->op2.u.constant.type = IS_LONG;
- opline->op2.u.constant.value.lval = 0;
- opline->extended_value = ZEND_FETCH_STANDARD; /* ignored in fetch_dim_tmp_var, but what the hell. */
- result_value = opline->result;
-
- if (key->op_type != IS_UNUSED) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_FETCH_DIM_TMP_VAR;
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.opline_num = get_temporary_variable(CG(active_op_array));
- opline->op1 = *as_token;
- opline->op2.op_type = IS_CONST;
- opline->op2.u.constant.type = IS_LONG;
- opline->op2.u.constant.value.lval = 1;
- opline->extended_value = ZEND_FETCH_STANDARD; /* ignored in fetch_dim_tmp_var, but what the hell. */
- result_key = opline->result;
- }
-
- zend_do_assign(&dummy, value, &result_value TSRMLS_CC);
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED;
- if (key->op_type != IS_UNUSED) {
- zend_do_assign(&dummy, key, &result_key TSRMLS_CC);
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED;
- }
- zend_do_free(as_token TSRMLS_CC);
-
- do_begin_loop(TSRMLS_C);
- INC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_foreach_end(znode *foreach_token, znode *open_brackets_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMP;
- opline->op1.u.opline_num = foreach_token->u.opline_num;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- CG(active_op_array)->opcodes[foreach_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
-
- do_end_loop(foreach_token->u.opline_num TSRMLS_CC);
-
- generate_free_foreach_copy(open_brackets_token TSRMLS_CC);
-
- zend_stack_del_top(&CG(foreach_copy_stack));
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_declare_begin(TSRMLS_D)
-{
- zend_stack_push(&CG(declare_stack), &CG(declarables), sizeof(zend_declarables));
-}
-
-
-void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC)
-{
- convert_to_string(&var->u.constant);
-
- if (!zend_binary_strcasecmp(var->u.constant.value.str.val, var->u.constant.value.str.len, "ticks", sizeof("ticks")-1)) {
- convert_to_long(&val->u.constant);
- CG(declarables).ticks = val->u.constant;
- }
- zval_dtor(&var->u.constant);
-}
-
-
-void zend_do_declare_end(znode *declare_token TSRMLS_DC)
-{
- zend_declarables *declarables;
-
- zend_stack_top(&CG(declare_stack), (void **) &declarables);
- /* We should restore if there was more than (current - start) - (ticks?1:0) opcodes */
- if ((get_next_op_number(CG(active_op_array)) - declare_token->u.opline_num) - ((CG(declarables).ticks.value.lval)?1:0)) {
- CG(declarables) = *declarables;
- }
-}
-
-
-void zend_do_end_heredoc(TSRMLS_D)
-{
- int opline_num = get_next_op_number(CG(active_op_array))-1;
- zend_op *opline = &CG(active_op_array)->opcodes[opline_num];
-
- if (opline->opcode != ZEND_ADD_STRING) {
- return;
- }
-
- opline->op2.u.constant.value.str.val[(opline->op2.u.constant.value.str.len--)-1] = 0;
- if (opline->op2.u.constant.value.str.len>0) {
- if (opline->op2.u.constant.value.str.val[opline->op2.u.constant.value.str.len-1]=='\r') {
- opline->op2.u.constant.value.str.val[(opline->op2.u.constant.value.str.len--)-1] = 0;
- }
- }
-}
-
-
-void zend_do_exit(znode *result, znode *message TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_EXIT;
- opline->op1 = *message;
- SET_UNUSED(opline->op2);
-
- result->op_type = IS_CONST;
- result->u.constant.type = IS_BOOL;
- result->u.constant.value.lval = 1;
-}
-
-
-void zend_do_begin_silence(znode *strudel_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_BEGIN_SILENCE;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- *strudel_token = opline->result;
-}
-
-
-void zend_do_end_silence(znode *strudel_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_END_SILENCE;
- opline->op1 = *strudel_token;
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_begin_qm_op(znode *cond, znode *qm_token TSRMLS_DC)
-{
- int jmpz_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline;
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPZ;
- opline->op1 = *cond;
- SET_UNUSED(opline->op2);
- opline->op2.u.opline_num = jmpz_op_number;
- *qm_token = opline->op2;
-
- INC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_qm_true(znode *true_value, znode *qm_token, znode *colon_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- CG(active_op_array)->opcodes[qm_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array))+1; /* jmp over the ZEND_JMP */
-
- opline->opcode = ZEND_QM_ASSIGN;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *true_value;
- SET_UNUSED(opline->op2);
-
- *qm_token = opline->result;
- colon_token->u.opline_num = get_next_op_number(CG(active_op_array));
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_JMP;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_qm_false(znode *result, znode *false_value, znode *qm_token, znode *colon_token TSRMLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_QM_ASSIGN;
- opline->result = *qm_token;
- opline->op1 = *false_value;
- SET_UNUSED(opline->op2);
-
- CG(active_op_array)->opcodes[colon_token->u.opline_num].op1.u.opline_num = get_next_op_number(CG(active_op_array));
-
- *result = opline->result;
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void zend_do_extended_info(TSRMLS_D)
-{
- zend_op *opline;
-
- if (!CG(extended_info)) {
- return;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_EXT_STMT;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_extended_fcall_begin(TSRMLS_D)
-{
- zend_op *opline;
-
- if (!CG(extended_info)) {
- return;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_EXT_FCALL_BEGIN;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_extended_fcall_end(TSRMLS_D)
-{
- zend_op *opline;
-
- if (!CG(extended_info)) {
- return;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_EXT_FCALL_END;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void zend_do_ticks(TSRMLS_D)
-{
- if (CG(declarables).ticks.value.lval) {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_TICKS;
- opline->op1.u.constant = CG(declarables).ticks;
- opline->op1.op_type = IS_CONST;
- SET_UNUSED(opline->op2);
- }
-}
-
-
-int zend_register_auto_global(char *name, uint name_len TSRMLS_DC)
-{
- return zend_hash_add_empty_element(CG(auto_globals), name, name_len+1);
-}
-
-
-int zendlex(znode *zendlval TSRMLS_DC)
-{
- int retval;
-
- if (CG(increment_lineno)) {
- CG(zend_lineno)++;
- CG(increment_lineno) = 0;
- }
-
- zendlval->u.constant.type = IS_LONG;
- retval = lex_scan(&zendlval->u.constant TSRMLS_CC);
- switch(retval) {
- case T_COMMENT:
- case T_OPEN_TAG:
- case T_WHITESPACE:
- retval = zendlex(zendlval TSRMLS_CC);
- break;
- case T_CLOSE_TAG:
- if (LANG_SCNG(yy_text)[LANG_SCNG(yy_leng)-1]=='\n'
- || (LANG_SCNG(yy_text)[LANG_SCNG(yy_leng)-2]=='\r' && LANG_SCNG(yy_text)[LANG_SCNG(yy_leng)-1])) {
- CG(increment_lineno) = 1;
- }
- retval = ';'; /* implicit ; */
- break;
- case T_OPEN_TAG_WITH_ECHO:
- retval = T_ECHO;
- break;
- case T_END_HEREDOC:
- efree(zendlval->u.constant.value.str.val);
- break;
- }
-
- INIT_PZVAL(&zendlval->u.constant);
- zendlval->op_type = IS_CONST;
- return retval;
-}
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
deleted file mode 100644
index 8fac9268d5..0000000000
--- a/Zend/zend_compile.h
+++ /dev/null
@@ -1,723 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_COMPILE_H
-#define ZEND_COMPILE_H
-
-#include "zend.h"
-
-#ifdef HAVE_STDARG_H
-# include <stdarg.h>
-#endif
-
-#include "zend_llist.h"
-
-#define DEBUG_ZEND 0
-
-#define FREE_PNODE(znode) zval_dtor(&znode->u.constant);
-#define FREE_OP(Ts, op, should_free) if (should_free) zval_dtor(&Ts[(op)->u.var].tmp_var);
-
-#define SET_UNUSED(op) (op).op_type = IS_UNUSED
-
-#define INC_BPC(op_array) if (CG(interactive)) { ((op_array)->backpatch_count++); }
-#define DEC_BPC(op_array) if (CG(interactive)) { ((op_array)->backpatch_count--); }
-#define HANDLE_INTERACTIVE() if (CG(interactive)) { execute_new_code(TSRMLS_C); }
-
-typedef struct _zend_op_array zend_op_array;
-
-typedef struct _znode {
- int op_type;
- zend_llist *throw_list; /* Try and save this space later on */
- union {
- zval constant;
-
- zend_uint var;
- zend_uint opline_num; /* Needs to be signed */
- zend_op_array *op_array;
- zend_class_entry *previously_active_class_entry; /* Used at compile-time */
- struct {
- zend_uint var; /* dummy */
- zend_uint type;
- } EA;
- } u;
-} znode;
-
-
-typedef struct _zend_op {
- zend_uchar opcode;
- znode result;
- znode op1;
- znode op2;
- ulong extended_value;
- uint lineno;
-} zend_op;
-
-
-typedef struct _zend_brk_cont_element {
- int cont;
- int brk;
- int parent;
-} zend_brk_cont_element;
-
-
-struct _zend_op_array {
- zend_uchar type; /* MUST be the first element of this struct! */
-
- zend_uchar *arg_types; /* MUST be the second element of this struct! */
- char *function_name; /* MUST be the third element of this struct! */
- zend_class_entry *scope; /* MUST be the fourth element of this struct! */
-
- zend_uint *refcount;
-
- zend_op *opcodes;
- zend_uint last, size;
-
- zend_uint T;
-
- zend_brk_cont_element *brk_cont_array;
- zend_uint last_brk_cont;
- zend_uint current_brk_cont;
-
- /* static variables support */
- HashTable *static_variables;
-
- zend_op *start_op;
- int backpatch_count;
-
- zend_bool return_reference;
- zend_bool done_pass_two;
- zend_bool uses_this;
-
- char *filename;
-
- void *reserved[ZEND_MAX_RESERVED_RESOURCES];
-};
-
-
-typedef struct _zend_internal_function {
- zend_uchar type; /* MUST be the first element of this struct! */
-
- zend_uchar *arg_types; /* MUST be the second element of this struct! */
- char *function_name; /* MUST be the third element of this struct! */
- zend_class_entry *scope; /* MUST be the fourth element of this struct! */
-
- void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
-} zend_internal_function;
-
-
-typedef struct _zend_overloaded_function {
- zend_uchar type; /* MUST be the first element of this struct! */
-
- zend_uchar *arg_types; /* MUST be the second element of this struct! */
- char *function_name; /* MUST be the third element of this struct! */
- zend_class_entry *scope; /* MUST be the fourth element of this struct! */
-
- zend_uint var;
-} zend_overloaded_function;
-
-
-typedef union _zend_function {
- zend_uchar type; /* MUST be the first element of this struct! */
-
- struct {
- zend_uchar type; /* never used */
- zend_uchar *arg_types;
- char *function_name;
- zend_class_entry *scope;
- } common;
-
- zend_op_array op_array;
- zend_internal_function internal_function;
- zend_overloaded_function overloaded_function;
-} zend_function;
-
-
-typedef struct _zend_function_state {
- HashTable *function_symbol_table;
- zend_function *function;
- void *reserved[ZEND_MAX_RESERVED_RESOURCES];
-} zend_function_state;
-
-
-typedef struct _zend_switch_entry {
- znode cond;
- int default_case;
- int control_var;
-} zend_switch_entry;
-
-
-typedef struct _list_llist_element {
- znode var;
- zend_llist dimensions;
- znode value;
-} list_llist_element;
-
-
-typedef struct _zend_file_handle {
- zend_uchar type;
- char *filename;
- char *opened_path;
- union {
- int fd;
- FILE *fp;
- } handle;
- zend_bool free_filename;
-} zend_file_handle;
-
-union _temp_variable;
-
-typedef struct _zend_execute_data {
- struct _zend_op *opline;
- zend_function_state function_state;
- zend_function *fbc; /* Function Being Called */
- zend_function *fbc_constructor;
- zend_op_array *op_array;
- zval *object;
- union _temp_variable *Ts;
- zend_bool original_in_execution;
- zend_class_entry *calling_scope;
- struct _zend_execute_data *prev_execute_data;
-} zend_execute_data;
-
-#define EX(element) execute_data.element
-
-
-#define IS_CONST (1<<0)
-#define IS_TMP_VAR (1<<1)
-#define IS_VAR (1<<2)
-#define IS_UNUSED (1<<3) /* Unused variable */
-
-
-#define EXT_TYPE_UNUSED (1<<0)
-
-#include "zend_globals.h"
-
-BEGIN_EXTERN_C()
-
-void init_compiler(TSRMLS_D);
-void shutdown_compiler(TSRMLS_D);
-void zend_init_compiler_data_structures(TSRMLS_D);
-
-extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
-
-void zend_activate(TSRMLS_D);
-void zend_deactivate(TSRMLS_D);
-void zend_activate_modules(TSRMLS_D);
-void zend_deactivate_modules(TSRMLS_D);
-
-
-ZEND_API int lex_scan(zval *zendlval TSRMLS_DC);
-void startup_scanner(TSRMLS_D);
-void shutdown_scanner(TSRMLS_D);
-
-ZEND_API char *zend_set_compiled_filename(char *new_compiled_filename TSRMLS_DC);
-ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC);
-ZEND_API char *zend_get_compiled_filename(TSRMLS_D);
-ZEND_API int zend_get_compiled_lineno(TSRMLS_D);
-
-#ifdef ZTS
-const char *zend_get_zendtext(TSRMLS_D);
-int zend_get_zendleng(TSRMLS_D);
-#endif
-
-
-/* parser-driven code generators */
-void zend_do_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
-void zend_do_unary_op(zend_uchar op, znode *result, znode *op1 TSRMLS_DC);
-void zend_do_binary_assign_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
-void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC);
-void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC);
-void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC);
-void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar op TSRMLS_DC);
-void zend_do_indirect_references(znode *result, znode *num_references, znode *variable TSRMLS_DC);
-void zend_do_fetch_global_or_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC);
-
-void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC);
-void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC);
-void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC);
-void zend_do_fetch_static_member(znode *class TSRMLS_DC);
-void zend_do_print(znode *result, znode *arg TSRMLS_DC);
-void zend_do_echo(znode *arg TSRMLS_DC);
-typedef int (*unary_op_type)(zval *, zval *);
-ZEND_API unary_op_type get_unary_op(int opcode);
-ZEND_API void *get_binary_op(int opcode);
-
-void zend_do_while_cond(znode *expr, znode *close_bracket_token TSRMLS_DC);
-void zend_do_while_end(znode *while_token, znode *close_bracket_token TSRMLS_DC);
-void zend_do_do_while_begin(TSRMLS_D);
-void zend_do_do_while_end(znode *do_token, znode *expr_open_bracket, znode *expr TSRMLS_DC);
-
-
-void zend_do_if_cond(znode *cond, znode *closing_bracket_token TSRMLS_DC);
-void zend_do_if_after_statement(znode *closing_bracket_token, unsigned char initialize TSRMLS_DC);
-void zend_do_if_end(TSRMLS_D);
-
-void zend_do_for_cond(znode *expr, znode *second_semicolon_token TSRMLS_DC);
-void zend_do_for_before_statement(znode *cond_start, znode *second_semicolon_token TSRMLS_DC);
-void zend_do_for_end(znode *second_semicolon_token TSRMLS_DC);
-
-void zend_do_pre_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC);
-void zend_do_post_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC);
-
-void zend_do_begin_variable_parse(TSRMLS_D);
-void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC);
-
-void zend_check_writable_variable(znode *variable);
-
-void zend_do_free(znode *op1 TSRMLS_DC);
-
-void zend_do_init_string(znode *result TSRMLS_DC);
-void zend_do_add_char(znode *result, znode *op1, znode *op2 TSRMLS_DC);
-void zend_do_add_string(znode *result, znode *op1, znode *op2 TSRMLS_DC);
-void zend_do_add_variable(znode *result, znode *op1, znode *op2 TSRMLS_DC);
-
-void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference TSRMLS_DC);
-void zend_do_end_function_declaration(znode *function_token TSRMLS_DC);
-void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initialization, zend_uchar pass_type TSRMLS_DC);
-int zend_do_begin_function_call(znode *function_name TSRMLS_DC);
-void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC);
-void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC);
-void do_fetch_class(znode *result, znode *class_entry, znode *class_name TSRMLS_DC);
-void do_fetch_class_name(znode *result, znode *class_entry, znode *class_name, zend_bool case_sensitive TSRMLS_DC);
-void zend_do_begin_class_member_function_call(znode *class_name, znode *function_name TSRMLS_DC);
-void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC);
-void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC);
-
-void zend_do_try(znode *try_token TSRMLS_DC);
-void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, zend_bool first_catch TSRMLS_DC);
-void zend_do_end_catch(znode *try_token TSRMLS_DC);
-void zend_do_throw(znode *expr TSRMLS_DC);
-
-ZEND_API int do_bind_function(zend_op *opline, HashTable *function_table, HashTable *class_table, int compile_time);
-ZEND_API int do_bind_class(zend_op *opline, HashTable *function_table, HashTable *class_table);
-ZEND_API int do_bind_inherited_class(zend_op *opline, HashTable *function_table, HashTable *class_table, zend_class_entry *parent_ce);
-
-void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce);
-void zend_do_early_binding(TSRMLS_D);
-
-void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC);
-
-
-void zend_do_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC);
-void zend_do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC);
-void zend_do_boolean_and_begin(znode *expr1, znode *op_token TSRMLS_DC);
-void zend_do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC);
-
-void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC);
-
-void zend_do_switch_cond(znode *cond TSRMLS_DC);
-void zend_do_switch_end(znode *case_list TSRMLS_DC);
-void zend_do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr TSRMLS_DC);
-void zend_do_case_after_statement(znode *result, znode *case_token TSRMLS_DC);
-void zend_do_default_before_statement(znode *case_list, znode *default_token TSRMLS_DC);
-
-void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znode *parent_class_name TSRMLS_DC);
-void zend_do_end_class_declaration(znode *class_token TSRMLS_DC);
-void zend_do_declare_property(znode *var_name, znode *value, int declaration_type TSRMLS_DC);
-
-void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS_DC);
-
-
-void zend_do_push_object(znode *object TSRMLS_DC);
-void zend_do_pop_object(znode *object TSRMLS_DC);
-
-
-void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC);
-void zend_do_end_new_object(znode *result, znode *new_token, znode *argument_list TSRMLS_DC);
-
-void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode TSRMLS_DC);
-
-void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC);
-
-void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC);
-void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC);
-void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr);
-void zend_do_list_init(TSRMLS_D);
-void zend_do_list_end(znode *result, znode *expr TSRMLS_DC);
-void zend_do_add_list_element(znode *element TSRMLS_DC);
-void zend_do_new_list_begin(TSRMLS_D);
-void zend_do_new_list_end(TSRMLS_D);
-
-void zend_do_cast(znode *result, znode *expr, int type TSRMLS_DC);
-void zend_do_include_or_eval(int type, znode *result, znode *op1 TSRMLS_DC);
-
-void zend_do_unset(znode *variable TSRMLS_DC);
-void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC);
-
-void zend_do_is_class(znode *result, znode *expr, znode *class, int type TSRMLS_DC);
-
-void zend_do_foreach_begin(znode *foreach_token, znode *array, znode *open_brackets_token, znode *as_token, int variable TSRMLS_DC);
-void zend_do_foreach_cont(znode *value, znode *key, znode *as_token TSRMLS_DC);
-void zend_do_foreach_end(znode *foreach_token, znode *open_brackets_token TSRMLS_DC);
-
-void zend_do_declare_begin(TSRMLS_D);
-void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC);
-void zend_do_declare_end(znode *declare_token TSRMLS_DC);
-
-void zend_do_end_heredoc(TSRMLS_D);
-
-void zend_do_exit(znode *result, znode *message TSRMLS_DC);
-
-void zend_do_begin_silence(znode *strudel_token TSRMLS_DC);
-void zend_do_end_silence(znode *strudel_token TSRMLS_DC);
-
-void zend_do_begin_qm_op(znode *cond, znode *qm_token TSRMLS_DC);
-void zend_do_qm_true(znode *true_value, znode *qm_token, znode *colon_token TSRMLS_DC);
-void zend_do_qm_false(znode *result, znode *false_value, znode *qm_token, znode *colon_token TSRMLS_DC);
-
-void zend_do_extended_info(TSRMLS_D);
-void zend_do_extended_fcall_begin(TSRMLS_D);
-void zend_do_extended_fcall_end(TSRMLS_D);
-
-void zend_do_ticks(TSRMLS_D);
-
-void zend_do_begin_import(TSRMLS_D);
-void zend_do_import(int type, znode *what TSRMLS_DC);
-void zend_do_end_import(znode *import_from TSRMLS_DC);
-
-ZEND_API void function_add_ref(zend_function *function);
-
-#define INITIAL_OP_ARRAY_SIZE 64
-
-
-/* helper functions in zend_language_scanner.l */
-ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC);
-ZEND_API zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC);
-ZEND_API zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC);
-ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...);
-ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC);
-ZEND_API void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC);
-ZEND_API void destroy_op_array(zend_op_array *op_array);
-ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC);
-ZEND_API void zend_file_handle_dtor(zend_file_handle *fh);
-
-ZEND_API void destroy_zend_function(zend_function *function);
-ZEND_API void destroy_zend_class(zend_class_entry **pce);
-void zend_class_add_ref(zend_class_entry **ce);
-
-#define ZEND_FUNCTION_DTOR (void (*)(void *)) destroy_zend_function
-#define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
-
-zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC);
-void init_op(zend_op *op TSRMLS_DC);
-int get_next_op_number(zend_op_array *op_array);
-int print_class(zend_class_entry *class_entry TSRMLS_DC);
-void print_op_array(zend_op_array *op_array, int optimizations);
-int pass_two(zend_op_array *op_array TSRMLS_DC);
-zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
-ZEND_API zend_bool zend_is_compiling(TSRMLS_D);
-ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC);
-
-int zend_register_auto_global(char *name, uint name_len TSRMLS_DC);
-
-int zendlex(znode *zendlval TSRMLS_DC);
-
-#define ZEND_NOP 0
-
-#define ZEND_ADD 1
-#define ZEND_SUB 2
-#define ZEND_MUL 3
-#define ZEND_DIV 4
-#define ZEND_MOD 5
-#define ZEND_SL 6
-#define ZEND_SR 7
-#define ZEND_CONCAT 8
-#define ZEND_BW_OR 9
-#define ZEND_BW_AND 10
-#define ZEND_BW_XOR 11
-#define ZEND_BW_NOT 12
-#define ZEND_BOOL_NOT 13
-#define ZEND_BOOL_XOR 14
-#define ZEND_IS_IDENTICAL 15
-#define ZEND_IS_NOT_IDENTICAL 16
-#define ZEND_IS_EQUAL 17
-#define ZEND_IS_NOT_EQUAL 18
-#define ZEND_IS_SMALLER 19
-#define ZEND_IS_SMALLER_OR_EQUAL 20
-#define ZEND_CAST 21
-#define ZEND_QM_ASSIGN 22
-
-#define ZEND_ASSIGN_ADD 23
-#define ZEND_ASSIGN_SUB 24
-#define ZEND_ASSIGN_MUL 25
-#define ZEND_ASSIGN_DIV 26
-#define ZEND_ASSIGN_MOD 27
-#define ZEND_ASSIGN_SL 28
-#define ZEND_ASSIGN_SR 29
-#define ZEND_ASSIGN_CONCAT 30
-#define ZEND_ASSIGN_BW_OR 31
-#define ZEND_ASSIGN_BW_AND 32
-#define ZEND_ASSIGN_BW_XOR 33
-
-#define ZEND_PRE_INC 34
-#define ZEND_PRE_DEC 35
-#define ZEND_POST_INC 36
-#define ZEND_POST_DEC 37
-
-#define ZEND_ASSIGN 38
-#define ZEND_ASSIGN_REF 39
-
-#define ZEND_ECHO 40
-#define ZEND_PRINT 41
-
-#define ZEND_JMP 42
-#define ZEND_JMPZ 43
-#define ZEND_JMPNZ 44
-#define ZEND_JMPZNZ 45
-#define ZEND_JMPZ_EX 46
-#define ZEND_JMPNZ_EX 47
-#define ZEND_CASE 48
-#define ZEND_SWITCH_FREE 49
-#define ZEND_BRK 50
-#define ZEND_CONT 51
-#define ZEND_BOOL 52
-
-#define ZEND_INIT_STRING 53
-#define ZEND_ADD_CHAR 54
-#define ZEND_ADD_STRING 55
-#define ZEND_ADD_VAR 56
-
-#define ZEND_BEGIN_SILENCE 57
-#define ZEND_END_SILENCE 58
-
-#define ZEND_INIT_FCALL_BY_NAME 59
-#define ZEND_DO_FCALL 60
-#define ZEND_DO_FCALL_BY_NAME 61
-#define ZEND_RETURN 62
-
-#define ZEND_RECV 63
-#define ZEND_RECV_INIT 64
-
-#define ZEND_SEND_VAL 65
-#define ZEND_SEND_VAR 66
-#define ZEND_SEND_REF 67
-
-#define ZEND_NEW 68
-#define ZEND_JMP_NO_CTOR 69
-#define ZEND_FREE 70
-
-#define ZEND_INIT_ARRAY 71
-#define ZEND_ADD_ARRAY_ELEMENT 72
-
-#define ZEND_INCLUDE_OR_EVAL 73
-
-#define ZEND_UNSET_VAR 74
-#define ZEND_UNSET_DIM_OBJ 75
-
-#define ZEND_FE_RESET 77
-#define ZEND_FE_FETCH 78
-
-#define ZEND_EXIT 79
-
-
-/* the following 18 opcodes are 6 groups of 3 opcodes each, and must
- * remain in that order!
- */
-#define ZEND_FETCH_R 80
-#define ZEND_FETCH_DIM_R 81
-#define ZEND_FETCH_OBJ_R 82
-#define ZEND_FETCH_W 83
-#define ZEND_FETCH_DIM_W 84
-#define ZEND_FETCH_OBJ_W 85
-#define ZEND_FETCH_RW 86
-#define ZEND_FETCH_DIM_RW 87
-#define ZEND_FETCH_OBJ_RW 88
-#define ZEND_FETCH_IS 89
-#define ZEND_FETCH_DIM_IS 90
-#define ZEND_FETCH_OBJ_IS 91
-#define ZEND_FETCH_FUNC_ARG 92
-#define ZEND_FETCH_DIM_FUNC_ARG 93
-#define ZEND_FETCH_OBJ_FUNC_ARG 94
-#define ZEND_FETCH_UNSET 95
-#define ZEND_FETCH_DIM_UNSET 96
-#define ZEND_FETCH_OBJ_UNSET 97
-
-#define ZEND_FETCH_DIM_TMP_VAR 98
-#define ZEND_FETCH_CONSTANT 99
-
-/* Hole - 100 */
-
-#define ZEND_EXT_STMT 101
-#define ZEND_EXT_FCALL_BEGIN 102
-#define ZEND_EXT_FCALL_END 103
-#define ZEND_EXT_NOP 104
-
-#define ZEND_TICKS 105
-
-#define ZEND_SEND_VAR_NO_REF 106
-
-#define ZEND_CATCH 107
-#define ZEND_THROW 108
-
-#define ZEND_FETCH_CLASS 109
-
-#define ZEND_CLONE 110
-
-#define ZEND_INIT_CTOR_CALL 111
-#define ZEND_INIT_METHOD_CALL 112
-#define ZEND_INIT_STATIC_METHOD_CALL 113
-
-#define ZEND_ISSET_ISEMPTY_VAR 114
-#define ZEND_ISSET_ISEMPTY_DIM_OBJ 115
-
-#define ZEND_IMPORT_FUNCTION 116
-#define ZEND_IMPORT_CLASS 117
-#define ZEND_IMPORT_CONST 118
-
-#define ZEND_ASSIGN_ADD_OBJ 121
-#define ZEND_ASSIGN_SUB_OBJ 122
-#define ZEND_ASSIGN_MUL_OBJ 123
-#define ZEND_ASSIGN_DIV_OBJ 124
-#define ZEND_ASSIGN_MOD_OBJ 125
-#define ZEND_ASSIGN_SL_OBJ 126
-#define ZEND_ASSIGN_SR_OBJ 127
-#define ZEND_ASSIGN_CONCAT_OBJ 128
-#define ZEND_ASSIGN_BW_OR_OBJ 129
-#define ZEND_ASSIGN_BW_AND_OBJ 130
-#define ZEND_ASSIGN_BW_XOR_OBJ 131
-
-#define ZEND_PRE_INC_OBJ 132
-#define ZEND_PRE_DEC_OBJ 133
-#define ZEND_POST_INC_OBJ 134
-#define ZEND_POST_DEC_OBJ 135
-
-#define ZEND_ASSIGN_OBJ 136
-#define ZEND_MAKE_VAR 137
-
-#define ZEND_IS_CLASS 138
-
-#define ZEND_DECLARE_CLASS 139
-#define ZEND_DECLARE_INHERITED_CLASS 140
-#define ZEND_DECLARE_FUNCTION 141
-
-/* end of block */
-
-
-
-
-/* global/local fetches */
-#define ZEND_FETCH_GLOBAL 0
-#define ZEND_FETCH_LOCAL 1
-#define ZEND_FETCH_STATIC 2
-#define ZEND_FETCH_STATIC_MEMBER 3
-#define ZEND_FETCH_FROM_THIS 4
-
-/* class fetches */
-#define ZEND_FETCH_CLASS_DEFAULT 0
-#define ZEND_FETCH_CLASS_SELF 1
-#define ZEND_FETCH_CLASS_PARENT 2
-#define ZEND_FETCH_CLASS_MAIN 3
-
-
-/* variable parsing type (compile-time) */
-#define ZEND_PARSED_MEMBER (1<<0)
-#define ZEND_PARSED_METHOD_CALL (1<<1)
-#define ZEND_PARSED_STATIC_MEMBER (1<<2)
-#define ZEND_PARSED_FUNCTION_CALL (1<<3)
-#define ZEND_PARSED_VARIABLE (1<<4)
-
-
-/* unset types */
-#define ZEND_UNSET_REG 0
-
-/* var status for backpatching */
-#define BP_VAR_R 0
-#define BP_VAR_W 1
-#define BP_VAR_RW 2
-#define BP_VAR_IS 3
-#define BP_VAR_NA 4 /* if not applicable */
-#define BP_VAR_FUNC_ARG 5
-#define BP_VAR_UNSET 6
-
-
-#define ZEND_INTERNAL_FUNCTION 1
-#define ZEND_USER_FUNCTION 2
-#define ZEND_OVERLOADED_FUNCTION 3
-#define ZEND_EVAL_CODE 4
-
-#define ZEND_INTERNAL_CLASS 1
-#define ZEND_USER_CLASS 2
-
-#define ZEND_EVAL (1<<0)
-#define ZEND_INCLUDE (1<<1)
-#define ZEND_INCLUDE_ONCE (1<<2)
-#define ZEND_REQUIRE (1<<3)
-#define ZEND_REQUIRE_ONCE (1<<4)
-
-#define ZEND_ISSET (1<<0)
-#define ZEND_ISEMPTY (1<<1)
-
-#define ZEND_CT (1<<0)
-#define ZEND_RT (1<<1)
-
-
-#define ZEND_HANDLE_FILENAME 0
-#define ZEND_HANDLE_FD 1
-#define ZEND_HANDLE_FP 2
-#define ZEND_HANDLE_STDIOSTREAM 3
-#define ZEND_HANDLE_FSTREAM 4
-
-#define ZEND_FETCH_STANDARD 0
-#define ZEND_FETCH_ADD_LOCK 1
-
-#define ZEND_MEMBER_FUNC_CALL 1<<0
-
-#define ZEND_ARG_SEND_BY_REF (1<<0)
-#define ZEND_ARG_COMPILE_TIME_BOUND (1<<1)
-
-#define AI_USE_PTR(ai) \
- if ((ai).ptr_ptr) { \
- (ai).ptr = *((ai).ptr_ptr); \
- (ai).ptr_ptr = &((ai).ptr); \
- } else { \
- (ai).ptr = NULL; \
- }
-
-/* Lost In Stupid Parentheses */
-#define ARG_SHOULD_BE_SENT_BY_REF(offset, conduct_check, arg_types) \
- ( \
- conduct_check \
- && arg_types \
- && \
- ( \
- ( \
- offset<=arg_types[0] \
- && arg_types[offset]==BYREF_FORCE \
- ) \
- || ( \
- offset>=arg_types[0] \
- && arg_types[arg_types[0]]==BYREF_FORCE_REST \
- ) \
- ) \
- )
-
-#define ZEND_RETURN_VAL 0
-#define ZEND_RETURN_REF 1
-
-END_EXTERN_C()
-
-#define ZEND_CLONE_FUNC_NAME "__clone"
-#define ZEND_CONSTRUCTOR_FUNC_NAME "__construct"
-#define ZEND_DESTRUCTOR_FUNC_NAME "__destruct"
-#define ZEND_GET_FUNC_NAME "__get"
-#define ZEND_SET_FUNC_NAME "__set"
-#define ZEND_CALL_FUNC_NAME "__call"
-
-#endif /* ZEND_COMPILE_H */
diff --git a/Zend/zend_config.nw.h b/Zend/zend_config.nw.h
deleted file mode 100644
index ad7dec1376..0000000000
--- a/Zend/zend_config.nw.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_CONFIG_NW_H
-#define ZEND_CONFIG_NW_H
-
-
-#include <string.h>
-#include <float.h>
-
-typedef unsigned long ulong;
-typedef unsigned int uint;
-
-#define HAVE_ALLOCA 1
-#define HAVE_LIMITS_H 1
-/* #include <malloc.h> */
-
-#define HAVE_STRING_H 1
-
-#undef HAVE_KILL
-#define HAVE_GETPID 1
-/* #define HAVE_ALLOCA_H 1 */
-#define HAVE_MEMCPY 1
-#define HAVE_STRDUP 1
-#define HAVE_SYS_TYPES_H 1
-/* #define HAVE_STDIOSTR_H 1 */
-#define HAVE_CLASS_ISTDIOSTREAM
-#define istdiostream stdiostream
-#define HAVE_STDARG_H 1
-#define HAVE_DLFCN_H 1
-/* #define HAVE_LIBDL 1 */
-#define HAVE_SNPRINTF 1
-#define HAVE_VSNPRINTF 1
-
-/*
-#define snprintf _snprintf
-#define vsnprintf _vsnprintf
-#define zend_isinf(a) 0
-#define zend_finite(x) _finite(x)
-#define zend_isnan(x) _isnan(x)
-*/
-
-#define zend_sprintf sprintf
-
-/* This will cause the compilation process to be MUCH longer, but will generate
- * a much quicker PHP binary
- */
-/*
-#undef inline
-#ifdef ZEND_WIN32_FORCE_INLINE
-# define inline __forceinline
-#else
-# define inline
-#endif
-*/
-
-/*
-#define zend_finite(A) _finite(A)
-#define zend_isnan(A) _isnan(A)
-*/
-
-#endif /* ZEND_CONFIG_NW_H */
diff --git a/Zend/zend_config.w32.h b/Zend/zend_config.w32.h
deleted file mode 100644
index f13aa0684f..0000000000
--- a/Zend/zend_config.w32.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_CONFIG_W32_H
-#define ZEND_CONFIG_W32_H
-
-#define HAVE_ALLOCA 1
-#define HAVE_LIMITS_H 1
-#define _CRTDBG_MAP_ALLOC
-
-#include <malloc.h>
-#include <stdlib.h>
-#include <crtdbg.h>
-
-#include <string.h>
-#include <windows.h>
-#include <float.h>
-
-typedef unsigned long ulong;
-typedef unsigned int uint;
-
-#undef HAVE_KILL
-#define HAVE_GETPID 1
-/* #define HAVE_ALLOCA_H 1 */
-#define HAVE_MEMCPY 1
-#define HAVE_STRDUP 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIOSTR_H 1
-#define HAVE_CLASS_ISTDIOSTREAM
-#define istdiostream stdiostream
-#define HAVE_STDARG_H 1
-#define HAVE_SNPRINTF 1
-#define HAVE_VSNPRINTF 1
-
-#define snprintf _snprintf
-#define vsnprintf _vsnprintf
-#define zend_isinf(a) 0
-#define zend_finite(x) _finite(x)
-#define zend_isnan(x) _isnan(x)
-
-#define zend_sprintf sprintf
-
-/* This will cause the compilation process to be MUCH longer, but will generate
- * a much quicker PHP binary
- */
-#undef inline
-#ifdef ZEND_WIN32_FORCE_INLINE
-# define inline __forceinline
-#else
-# define inline
-#endif
-
-#define zend_finite(A) _finite(A)
-#define zend_isnan(A) _isnan(A)
-
-#ifdef LIBZEND_EXPORTS
-# define ZEND_API __declspec(dllexport)
-#else
-# define ZEND_API __declspec(dllimport)
-#endif
-
-#define ZEND_DLEXPORT __declspec(dllexport)
-#define ZEND_DLIMPORT __declspec(dllimport)
-
-/* 0x00200000L is MB_SERVICE_NOTIFICATION, which is only supported under Windows NT
- * (and requires _WIN32_WINNT to be defined, which prevents the resulting executable
- * from running under Windows 9x
- * Windows 9x should silently ignore it, so it's being used here directly
- */
-#ifndef MB_SERVICE_NOTIFICATION
-#define MB_SERVICE_NOTIFICATION 0x00200000L
-#endif
-
-#define ZEND_SERVICE_MB_STYLE (MB_TOPMOST|MB_SERVICE_NOTIFICATION)
-
-#endif /* ZEND_CONFIG_W32_H */
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
deleted file mode 100644
index 34350d3eb2..0000000000
--- a/Zend/zend_constants.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "zend.h"
-#include "zend_constants.h"
-#include "zend_variables.h"
-#include "zend_operators.h"
-#include "zend_globals.h"
-
-
-void free_zend_constant(zend_constant *c)
-{
- if (!(c->flags & CONST_PERSISTENT)) {
- zval_dtor(&c->value);
- }
- free(c->name);
-}
-
-
-void copy_zend_constant(zend_constant *c)
-{
- c->name = zend_strndup(c->name, c->name_len);
- if (!(c->flags & CONST_PERSISTENT)) {
- zval_copy_ctor(&c->value);
- }
-}
-
-
-void zend_copy_constants(HashTable *target, HashTable *source)
-{
- zend_constant tmp_constant;
-
- zend_hash_copy(target, source, (copy_ctor_func_t) copy_zend_constant, &tmp_constant, sizeof(zend_constant));
-}
-
-
-static int clean_non_persistent_constant(zend_constant *c TSRMLS_DC)
-{
- if (c->flags & CONST_PERSISTENT) {
- return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
- } else {
- return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
- }
-}
-
-
-static int clean_module_constant(zend_constant *c, int *module_number TSRMLS_DC)
-{
- if (c->module_number == *module_number) {
- return 1;
- } else {
- return 0;
- }
-}
-
-
-void clean_module_constants(int module_number TSRMLS_DC)
-{
- zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) clean_module_constant, (void *) &module_number TSRMLS_CC);
-}
-
-
-int zend_startup_constants(TSRMLS_D)
-{
- EG(zend_constants) = &CG(main_class).constants_table;
-
- if (zend_hash_init(EG(zend_constants), 20, NULL, ZEND_CONSTANT_DTOR, 1)==FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-
-void zend_register_standard_constants(TSRMLS_D)
-{
- REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS);
-
- /* true/false constants */
- {
- zend_constant c;
-
- c.value.type = IS_BOOL;
- c.flags = CONST_PERSISTENT;
- c.module_number = 0;
-
- c.name = zend_strndup(ZEND_STRL("TRUE"));
- c.name_len = sizeof("TRUE");
- c.value.value.lval = 1;
- c.value.type = IS_BOOL;
- zend_register_constant(&c TSRMLS_CC);
-
- c.name = zend_strndup(ZEND_STRL("FALSE"));
- c.name_len = sizeof("FALSE");
- c.value.value.lval = 0;
- c.value.type = IS_BOOL;
- zend_register_constant(&c TSRMLS_CC);
-
- c.name = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE"));
- c.name_len = sizeof("ZEND_THREAD_SAFE");
- c.value.value.lval = ZTS_V;
- c.value.type = IS_BOOL;
- zend_register_constant(&c TSRMLS_CC);
-
- c.name = zend_strndup(ZEND_STRL("NULL"));
- c.name_len = sizeof("NULL");
- c.value.type = IS_NULL;
- zend_register_constant(&c TSRMLS_CC);
- }
-}
-
-
-int zend_shutdown_constants(TSRMLS_D)
-{
- zend_hash_destroy(EG(zend_constants));
- return SUCCESS;
-}
-
-
-void clean_non_persistent_constants(TSRMLS_D)
-{
- if (EG(full_tables_cleanup)) {
- zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC);
- } else {
- zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC);
- }
-}
-
-
-ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC)
-{
- zend_constant c;
-
- c.value.type = IS_LONG;
- c.value.value.lval = lval;
- c.flags = flags;
- c.name = zend_strndup(name, name_len);
- c.name_len = name_len;
- c.module_number = module_number;
- zend_register_constant(&c TSRMLS_CC);
-}
-
-
-ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC)
-{
- zend_constant c;
-
- c.value.type = IS_DOUBLE;
- c.value.value.dval = dval;
- c.flags = flags;
- c.name = zend_strndup(name, name_len);
- c.name_len = name_len;
- c.module_number = module_number;
- zend_register_constant(&c TSRMLS_CC);
-}
-
-
-ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC)
-{
- zend_constant c;
-
- c.value.type = IS_STRING;
- c.value.value.str.val = strval;
- c.value.value.str.len = strlen;
- c.flags = flags;
- c.name = zend_strndup(name, name_len);
- c.name_len = name_len;
- c.module_number = module_number;
- zend_register_constant(&c TSRMLS_CC);
-}
-
-
-ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC)
-{
- zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number TSRMLS_CC);
-}
-
-
-ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC)
-{
- zend_constant *c;
- char *lookup_name;
- int retval = 1;
-
- if (zend_hash_find(EG(zend_constants), name, name_len+1, (void **) &c) == FAILURE) {
- lookup_name = do_alloca(name_len+1);
- memcpy(lookup_name, name, name_len+1);
- zend_str_tolower(lookup_name, name_len);
-
- if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) {
- if ((c->flags & CONST_CS) && memcmp(c->name, name, name_len)!=0) {
- retval=0;
- }
- } else {
- retval=0;
- }
- free_alloca(lookup_name);
- }
-
- if (retval) {
- *result = c->value;
- zval_copy_ctor(result);
- }
-
- return retval;
-}
-
-
-ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
-{
- char *lowercase_name;
- int ret = SUCCESS;
-
-#if 0
- printf("Registering constant for module %d\n", c->module_number);
-#endif
-
- lowercase_name = do_alloca(c->name_len);
-
- memcpy(lowercase_name, c->name, c->name_len);
-
- if (!(c->flags & CONST_CS)) {
- zend_str_tolower(lowercase_name, c->name_len);
- }
-
- if (zend_hash_add(EG(zend_constants), lowercase_name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {
- free(c->name);
- if (!(c->flags & CONST_PERSISTENT)) {
- zval_dtor(&c->value);
- }
- zend_error(E_NOTICE,"Constant %s already defined", lowercase_name);
- ret = FAILURE;
- }
- free_alloca(lowercase_name);
- return ret;
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h
deleted file mode 100644
index 1ec9211c5d..0000000000
--- a/Zend/zend_constants.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_CONSTANTS_H
-#define ZEND_CONSTANTS_H
-
-#include "zend_globals.h"
-
-#define CONST_CS (1<<0) /* Case Sensitive */
-#define CONST_PERSISTENT (1<<1) /* Persistent */
-
-typedef struct _zend_constant {
- zval value;
- int flags;
- char *name;
- uint name_len;
- int module_number;
-} zend_constant;
-
-#define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), module_number TSRMLS_CC)
-#define REGISTER_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), module_number TSRMLS_CC)
-#define REGISTER_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), module_number TSRMLS_CC)
-#define REGISTER_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), module_number TSRMLS_CC)
-
-#define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), 0 TSRMLS_CC)
-#define REGISTER_MAIN_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), 0 TSRMLS_CC)
-#define REGISTER_MAIN_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), 0 TSRMLS_CC)
-#define REGISTER_MAIN_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), 0 TSRMLS_CC)
-
-void clean_module_constants(int module_number TSRMLS_DC);
-void free_zend_constant(zend_constant *c);
-int zend_startup_constants(TSRMLS_D);
-int zend_shutdown_constants(TSRMLS_D);
-void zend_register_standard_constants(TSRMLS_D);
-void clean_non_persistent_constants(TSRMLS_D);
-ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC);
-ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC);
-ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC);
-ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC);
-ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC);
-ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC);
-void zend_copy_constants(HashTable *target, HashTable *sourc);
-void copy_zend_constant(zend_constant *c);
-
-#define ZEND_CONSTANT_DTOR (void (*)(void *)) free_zend_constant
-
-#endif
diff --git a/Zend/zend_dynamic_array.c b/Zend/zend_dynamic_array.c
deleted file mode 100644
index ad5b39c976..0000000000
--- a/Zend/zend_dynamic_array.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include "zend.h"
-
-typedef struct _dynamic_array {
- char *array;
- unsigned int element_size;
- unsigned int current;
- unsigned int allocated;
-} dynamic_array;
-
-ZEND_API int zend_dynamic_array_init(dynamic_array *da, unsigned int element_size, unsigned int size)
-{
- da->element_size = element_size;
- da->allocated = size;
- da->current = 0;
- da->array = (char *) emalloc(size*element_size);
- if (da->array == NULL) {
- return 1;
- }
- return 0;
-}
-
-ZEND_API void *zend_dynamic_array_push(dynamic_array *da)
-{
- if (da->current == da->allocated) {
- da->allocated *= 2;
- da->array = (char *) erealloc(da->array, da->allocated*da->element_size);
- }
- return (void *)(da->array+(da->current++)*da->element_size);
-}
-
-ZEND_API void *zend_dynamic_array_pop(dynamic_array *da)
-{
- return (void *)(da->array+(--(da->current))*da->element_size);
-
-}
-
-ZEND_API void *zend_dynamic_array_get_element(dynamic_array *da, unsigned int index)
-{
- if (index >= da->current) {
- return NULL;
- }
- return (void *)(da->array+index*da->element_size);
-}
diff --git a/Zend/zend_dynamic_array.h b/Zend/zend_dynamic_array.h
deleted file mode 100644
index 8ad2a7277a..0000000000
--- a/Zend/zend_dynamic_array.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_DYNAMIC_ARRAY_H
-#define ZEND_DYNAMIC_ARRAY_H
-
-typedef struct _dynamic_array {
- char *array;
- unsigned int element_size;
- unsigned int last_used;
- unsigned int allocated;
-} dynamic_array;
-
-BEGIN_EXTERN_C()
-ZEND_API int zend_dynamic_array_init(dynamic_array *da);
-ZEND_API void *zend_dynamic_array_push(dynamic_array *da);
-ZEND_API void *zend_dynamic_array_pop(dynamic_array *da);
-ZEND_API void *zend_dynamic_array_get_element(dynamic_array *da, unsigned int index);
-END_EXTERN_C()
-
-#endif /* ZEND_DYNAMIC_ARRAY_H */
diff --git a/Zend/zend_errors.h b/Zend/zend_errors.h
deleted file mode 100644
index 1535f49fc2..0000000000
--- a/Zend/zend_errors.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_ERRORS_H
-#define ZEND_ERRORS_H
-
-#define E_ERROR (1<<0L)
-#define E_WARNING (1<<1L)
-#define E_PARSE (1<<2L)
-#define E_NOTICE (1<<3L)
-#define E_CORE_ERROR (1<<4L)
-#define E_CORE_WARNING (1<<5L)
-#define E_COMPILE_ERROR (1<<6L)
-#define E_COMPILE_WARNING (1<<7L)
-#define E_USER_ERROR (1<<8L)
-#define E_USER_WARNING (1<<9L)
-#define E_USER_NOTICE (1<<10L)
-
-#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE)
-#define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
-
-#endif /* ZEND_ERRORS_H */
-
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
deleted file mode 100644
index b0584b7372..0000000000
--- a/Zend/zend_execute.c
+++ /dev/null
@@ -1,3182 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#define ZEND_INTENSIVE_DEBUGGING 0
-
-#include <stdio.h>
-#include <signal.h>
-
-#include "zend.h"
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_API.h"
-#include "zend_ptr_stack.h"
-#include "zend_constants.h"
-#include "zend_extensions.h"
-#include "zend_fast_cache.h"
-#include "zend_execute_locks.h"
-
-#define get_zval_ptr(node, Ts, should_free, type) _get_zval_ptr(node, Ts, should_free TSRMLS_CC)
-#define get_zval_ptr_ptr(node, Ts, type) _get_zval_ptr_ptr(node, Ts TSRMLS_CC)
-
-#define get_incdec_op(op, opcode) \
- switch (opcode) { \
- case ZEND_PRE_INC: \
- case ZEND_POST_INC: \
- case ZEND_PRE_INC_OBJ: \
- case ZEND_POST_INC_OBJ: \
- (op) = increment_function; \
- break; \
- case ZEND_PRE_DEC: \
- case ZEND_POST_DEC: \
- case ZEND_PRE_DEC_OBJ: \
- case ZEND_POST_DEC_OBJ: \
- (op) = decrement_function; \
- break; \
- default: \
- (op) = NULL; \
- break; \
- } \
-
-/* These globals don't have to be thread safe since they're never modified */
-
-
-/* Prototypes */
-static void zend_fetch_var_address(zend_op *opline, temp_variable *Ts, int type TSRMLS_DC);
-static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC);
-static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC);
-static void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts TSRMLS_DC);
-static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
-static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
-static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
-
-#define RETURN_VALUE_USED(opline) (!((opline)->result.u.EA.type & EXT_TYPE_UNUSED))
-
-static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, int *should_free TSRMLS_DC)
-{
- switch(node->op_type) {
- case IS_CONST:
- *should_free = 0;
- return &node->u.constant;
- break;
- case IS_TMP_VAR:
- *should_free = 1;
- return &Ts[node->u.var].tmp_var;
- break;
- case IS_VAR:
- if (Ts[node->u.var].var.ptr) {
- PZVAL_UNLOCK(Ts[node->u.var].var.ptr);
- *should_free = 0;
- return Ts[node->u.var].var.ptr;
- } else {
- *should_free = 1;
-
- switch (Ts[node->u.var].EA.type) {
- case IS_STRING_OFFSET: {
- temp_variable *T = &Ts[node->u.var];
- zval *str = T->EA.data.str_offset.str;
-
- if (T->EA.data.str_offset.str->type != IS_STRING
- || (T->EA.data.str_offset.offset<0)
- || (T->EA.data.str_offset.str->value.str.len <= T->EA.data.str_offset.offset)) {
- zend_error(E_NOTICE, "Uninitialized string offset: %d", T->EA.data.str_offset.offset);
- T->tmp_var.value.str.val = empty_string;
- T->tmp_var.value.str.len = 0;
- } else {
- char c = str->value.str.val[T->EA.data.str_offset.offset];
-
- T->tmp_var.value.str.val = estrndup(&c, 1);
- T->tmp_var.value.str.len = 1;
- }
- PZVAL_UNLOCK(str);
- T->tmp_var.refcount=1;
- T->tmp_var.is_ref=1;
- T->tmp_var.type = IS_STRING;
- return &T->tmp_var;
- }
- break;
- }
- }
- break;
- case IS_UNUSED:
- *should_free = 0;
- return NULL;
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- return NULL;
-}
-
-static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC)
-{
- if (node->op_type==IS_VAR) {
- if (Ts[node->u.var].var.ptr_ptr) {
- PZVAL_UNLOCK(*Ts[node->u.var].var.ptr_ptr);
- } else if (Ts[node->u.var].EA.type==IS_STRING_OFFSET) {
- PZVAL_UNLOCK(Ts[node->u.var].EA.data.str_offset.str);
- }
- return Ts[node->u.var].var.ptr_ptr;
- } else {
- return NULL;
- }
-}
-
-static inline zval **zend_fetch_property_address_inner(zval *object, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
-{
- zval *prop_ptr = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- zval **retval = NULL;
- zval tmp;
-
-
- switch (op2->op_type) {
- case IS_CONST:
- /* already a constant string */
- break;
- case IS_VAR:
- tmp = *prop_ptr;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- prop_ptr = &tmp;
- break;
- case IS_TMP_VAR:
- convert_to_string(prop_ptr);
- break;
- }
-
- if (Z_OBJ_HT_P(object)->get_property_ptr != NULL) {
- retval = Z_OBJ_HT_P(object)->get_property_ptr(object, prop_ptr TSRMLS_CC);
- }
-
- if (retval == NULL) {
- zend_error(E_WARNING, "This object doesn't support property references");
- retval = &EG(error_zval_ptr);
- }
-
- if (prop_ptr == &tmp) {
- zval_dtor(prop_ptr);
- }
- FREE_OP(Ts, op2, EG(free_op2));
- return retval;
-}
-
-
-
-static inline void zend_switch_free(zend_op *opline, temp_variable *Ts TSRMLS_DC)
-{
- switch (opline->op1.op_type) {
- case IS_VAR:
- if (!Ts[opline->op1.u.var].var.ptr_ptr) {
- get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R);
- FREE_OP(Ts, &opline->op1, EG(free_op1));
- } else {
- zval_ptr_dtor(&Ts[opline->op1.u.var].var.ptr);
- if (opline->extended_value) { /* foreach() free */
- zval_ptr_dtor(&Ts[opline->op1.u.var].var.ptr);
- }
- }
- break;
- case IS_TMP_VAR:
- zendi_zval_dtor(Ts[opline->op1.u.var].tmp_var);
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
-}
-
-void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts TSRMLS_DC)
-{
- zval *variable_ptr;
- zval *value_ptr;
-
- if (!value_ptr_ptr || !variable_ptr_ptr) {
- zend_error(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
- return;
- }
-
- variable_ptr = *variable_ptr_ptr;
- value_ptr = *value_ptr_ptr;
-
- if (variable_ptr == EG(error_zval_ptr) || value_ptr==EG(error_zval_ptr)) {
- variable_ptr_ptr = &EG(uninitialized_zval_ptr);
-/* } else if (variable_ptr==&EG(uninitialized_zval) || variable_ptr!=value_ptr) { */
- } else if (variable_ptr_ptr != value_ptr_ptr) {
- variable_ptr->refcount--;
- if (variable_ptr->refcount==0) {
- zendi_zval_dtor(*variable_ptr);
- FREE_ZVAL(variable_ptr);
- }
-
- if (!PZVAL_IS_REF(value_ptr)) {
- /* break it away */
- value_ptr->refcount--;
- if (value_ptr->refcount>0) {
- ALLOC_ZVAL(*value_ptr_ptr);
- **value_ptr_ptr = *value_ptr;
- value_ptr = *value_ptr_ptr;
- zendi_zval_copy_ctor(*value_ptr);
- }
- value_ptr->refcount = 1;
- value_ptr->is_ref = 1;
- }
-
- *variable_ptr_ptr = value_ptr;
- value_ptr->refcount++;
- } else {
- if (variable_ptr->refcount>1) { /* we need to break away */
- SEPARATE_ZVAL(variable_ptr_ptr);
- }
- (*variable_ptr_ptr)->is_ref = 1;
- }
-
- if (result && !(result->u.EA.type & EXT_TYPE_UNUSED)) {
- Ts[result->u.var].var.ptr_ptr = variable_ptr_ptr;
- SELECTIVE_PZVAL_LOCK(*variable_ptr_ptr, result);
- AI_USE_PTR(Ts[result->u.var].var);
- }
-}
-
-static inline void make_real_object(zval **object_ptr TSRMLS_DC)
-{
- if ((*object_ptr)->type == IS_NULL
- || ((*object_ptr)->type == IS_BOOL && (*object_ptr)->value.lval==0)
- || ((*object_ptr)->type == IS_STRING && (*object_ptr)->value.str.len == 0)) {
- if (!PZVAL_IS_REF(*object_ptr)) {
- SEPARATE_ZVAL(object_ptr);
- }
- zend_error(E_NOTICE, "Creating default object from empty value");
- object_init(*object_ptr);
- }
-}
-
-static inline void zend_assign_to_object(znode *result, znode *op1, znode *op2, zval *value, temp_variable *Ts TSRMLS_DC)
-{
- zval **object_ptr = get_zval_ptr_ptr(op1, Ts, BP_VAR_W);
- zval *object;
- zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- zval tmp;
- zval **retval = &Ts[result->u.var].var.ptr;
-
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
-
- if (object->type != IS_OBJECT) {
- zend_error(E_WARNING, "Attempt to assign property of non-object");
- FREE_OP(Ts, op2, EG(free_op2));
- *retval = EG(uninitialized_zval_ptr);
-
- SELECTIVE_PZVAL_LOCK(*retval, result);
- PZVAL_UNLOCK(value);
- return;
- }
-
- /* here we are sure we are dealing with an object */
- switch (op2->op_type) {
- case IS_CONST:
- /* already a constant string */
- break;
- case IS_VAR:
- tmp = *property;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- property = &tmp;
- break;
- case IS_TMP_VAR:
- convert_to_string(property);
- break;
- }
-
- /* here property is a string */
- PZVAL_UNLOCK(value);
-
- Z_OBJ_HT_P(object)->write_property(object, property, value TSRMLS_CC);
- if (property == &tmp) {
- zval_dtor(property);
- }
-
- FREE_OP(Ts, op2, EG(free_op2));
- if (result) {
- Ts[result->u.var].var.ptr = value;
- Ts[result->u.var].var.ptr_ptr = NULL; /* see if we can nuke this */
- SELECTIVE_PZVAL_LOCK(value, result);
- }
-}
-
-static inline void zend_assign_to_object_op(znode *result, znode *op1, znode *op2, zval *value, temp_variable *Ts, int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC) TSRMLS_DC)
-{
- zval **object_ptr = get_zval_ptr_ptr(op1, Ts, BP_VAR_W);
- zval *object;
- zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- zval tmp;
- zval **retval = &Ts[result->u.var].var.ptr;
- int have_get_ptr = 0;
-
- Ts[result->u.var].var.ptr_ptr = NULL;
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
-
- if (object->type != IS_OBJECT) {
- zend_error(E_WARNING, "Attempt to assign property of non-object");
- FREE_OP(Ts, op2, EG(free_op2));
- *retval = EG(uninitialized_zval_ptr);
-
- SELECTIVE_PZVAL_LOCK(*retval, result);
- return;
- }
-
- /* here we are sure we are dealing with an object */
- switch (op2->op_type) {
- case IS_CONST:
- /* already a constant string */
- break;
- case IS_VAR:
- tmp = *property;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- property = &tmp;
- break;
- case IS_TMP_VAR:
- convert_to_string(property);
- break;
- }
-
- /* here property is a string */
- PZVAL_UNLOCK(value);
-
- if (Z_OBJ_HT_P(object)->get_property_zval_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC);
- if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
- *retval = *zptr;
- SELECTIVE_PZVAL_LOCK(*retval, result);
- }
- }
-
- if (!have_get_ptr) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
- binary_op(z, z, value TSRMLS_CC);
- Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC);
- *retval = z;
- SELECTIVE_PZVAL_LOCK(*retval, result);
- if (z->refcount <= 1) {
- zval_dtor(z);
- }
- }
-
- if (property == &tmp) {
- zval_dtor(property);
- }
-
- FREE_OP(Ts, op2, EG(free_op2));
-}
-
-static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2, zval *value, int type, temp_variable *Ts TSRMLS_DC)
-{
- zval **variable_ptr_ptr = get_zval_ptr_ptr(op1, Ts, BP_VAR_W);
- zval *variable_ptr;
-
- if (!variable_ptr_ptr) {
- switch (Ts[op1->u.var].EA.type) {
- case IS_STRING_OFFSET: {
- temp_variable *T = &Ts[op1->u.var];
-
- if (T->EA.data.str_offset.str->type == IS_STRING) do {
- zval tmp;
- zval *final_value = value;
-
- if ((T->EA.data.str_offset.offset < 0)) {
- zend_error(E_WARNING, "Illegal string offset: %d", T->EA.data.str_offset.offset);
- break;
- }
- if (T->EA.data.str_offset.offset >= T->EA.data.str_offset.str->value.str.len) {
- zend_uint i;
-
- if (T->EA.data.str_offset.str->value.str.len==0) {
- STR_FREE(T->EA.data.str_offset.str->value.str.val);
- T->EA.data.str_offset.str->value.str.val = (char *) emalloc(T->EA.data.str_offset.offset+1+1);
- } else {
- T->EA.data.str_offset.str->value.str.val = (char *) erealloc(T->EA.data.str_offset.str->value.str.val, T->EA.data.str_offset.offset+1+1);
- }
- for (i=T->EA.data.str_offset.str->value.str.len; i<T->EA.data.str_offset.offset; i++) {
- T->EA.data.str_offset.str->value.str.val[i] = ' ';
- }
- T->EA.data.str_offset.str->value.str.val[T->EA.data.str_offset.offset+1] = 0;
- T->EA.data.str_offset.str->value.str.len = T->EA.data.str_offset.offset+1;
- }
-
- if (value->type!=IS_STRING) {
- tmp = *value;
- if (op2 && op2->op_type == IS_VAR) {
- zval_copy_ctor(&tmp);
- }
- convert_to_string(&tmp);
- final_value = &tmp;
- }
-
- T->EA.data.str_offset.str->value.str.val[T->EA.data.str_offset.offset] = final_value->value.str.val[0];
- if (op2
- && op2->op_type == IS_VAR
- && value==&Ts[op2->u.var].tmp_var) {
- STR_FREE(value->value.str.val);
- }
- if (final_value == &tmp) {
- zval_dtor(final_value);
- }
- /*
- * the value of an assignment to a string offset is undefined
- Ts[result->u.var].var = &T->EA.data.str_offset.str;
- */
- } while (0);
- /* zval_ptr_dtor(&T->EA.data.str_offset.str); Nuke this line if it doesn't cause a leak */
- T->tmp_var.type = IS_STRING;
- }
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- Ts[result->u.var].var.ptr_ptr = &EG(uninitialized_zval_ptr);
- SELECTIVE_PZVAL_LOCK(*Ts[result->u.var].var.ptr_ptr, result);
- AI_USE_PTR(Ts[result->u.var].var);
- return;
- }
-
- variable_ptr = *variable_ptr_ptr;
-
- if (variable_ptr == EG(error_zval_ptr)) {
- if (result) {
- Ts[result->u.var].var.ptr_ptr = &EG(uninitialized_zval_ptr);
- SELECTIVE_PZVAL_LOCK(*Ts[result->u.var].var.ptr_ptr, result);
- AI_USE_PTR(Ts[result->u.var].var);
- }
- if (type==IS_TMP_VAR) {
- zval_dtor(value);
- }
- return;
- }
-
- if (PZVAL_IS_REF(variable_ptr)) {
- if (variable_ptr!=value) {
- zend_uint refcount = variable_ptr->refcount;
- zval garbage;
-
- if (type!=IS_TMP_VAR) {
- value->refcount++;
- }
- garbage = *variable_ptr;
- *variable_ptr = *value;
- variable_ptr->refcount = refcount;
- variable_ptr->is_ref = 1;
- if (type!=IS_TMP_VAR) {
- zendi_zval_copy_ctor(*variable_ptr);
- value->refcount--;
- }
- zendi_zval_dtor(garbage);
- }
- } else {
- variable_ptr->refcount--;
- if (variable_ptr->refcount==0) {
- switch (type) {
- case IS_VAR:
- /* break missing intentionally */
- case IS_CONST:
- if (variable_ptr==value) {
- variable_ptr->refcount++;
- } else if (PZVAL_IS_REF(value)) {
- zval tmp;
-
- tmp = *value;
- zval_copy_ctor(&tmp);
- tmp.refcount=1;
- zendi_zval_dtor(*variable_ptr);
- *variable_ptr = tmp;
- } else {
- value->refcount++;
- zendi_zval_dtor(*variable_ptr);
- safe_free_zval_ptr(variable_ptr);
- *variable_ptr_ptr = value;
- }
- break;
- case IS_TMP_VAR:
- zendi_zval_dtor(*variable_ptr);
- value->refcount=1;
- *variable_ptr = *value;
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- } else { /* we need to split */
- switch (type) {
- case IS_VAR:
- /* break missing intentionally */
- case IS_CONST:
- if (PZVAL_IS_REF(value) && value->refcount > 0) {
- ALLOC_ZVAL(variable_ptr);
- *variable_ptr_ptr = variable_ptr;
- *variable_ptr = *value;
- zval_copy_ctor(variable_ptr);
- variable_ptr->refcount=1;
- break;
- }
- *variable_ptr_ptr = value;
- value->refcount++;
- break;
- case IS_TMP_VAR:
- ALLOC_ZVAL(*variable_ptr_ptr);
- value->refcount=1;
- **variable_ptr_ptr = *value;
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- }
- (*variable_ptr_ptr)->is_ref=0;
- }
- if (result) {
- Ts[result->u.var].var.ptr_ptr = variable_ptr_ptr;
- SELECTIVE_PZVAL_LOCK(*variable_ptr_ptr, result);
- AI_USE_PTR(Ts[result->u.var].var);
- }
-}
-
-
-/* Utility Functions for Extensions */
-static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
-{
- if (extension->statement_handler) {
- extension->statement_handler(op_array);
- }
-}
-
-
-static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
-{
- if (extension->fcall_begin_handler) {
- extension->fcall_begin_handler(op_array);
- }
-}
-
-
-static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
-{
- if (extension->fcall_end_handler) {
- extension->fcall_end_handler(op_array);
- }
-}
-
-
-static void print_refcount(zval *p, char *str)
-{
- print_refcount(NULL, NULL);
-}
-
-static inline HashTable *zend_get_target_symbol_table(zend_op *opline, temp_variable *Ts, int type TSRMLS_DC)
-{
- switch (opline->op2.u.EA.type) {
- case ZEND_FETCH_LOCAL:
- return EG(active_symbol_table);
- break;
- case ZEND_FETCH_GLOBAL:
- /* Don't think this is actually needed.
- if (opline->op1.op_type == IS_VAR) {
- PZVAL_LOCK(varname);
- }
-+ */
- return &EG(symbol_table);
- break;
- case ZEND_FETCH_STATIC:
- if (!EG(active_op_array)->static_variables) {
- ALLOC_HASHTABLE(EG(active_op_array)->static_variables);
- zend_hash_init(EG(active_op_array)->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0);
- }
- return EG(active_op_array)->static_variables;
- break;
- case ZEND_FETCH_STATIC_MEMBER:
- return Ts[opline->op2.u.var].EA.class_entry->static_members;
- break;
- case ZEND_FETCH_FROM_THIS:
- if (!EG(This)) {
- zend_error(E_ERROR, "Using $this when not in object context");
- }
- /* HACK!! 'this' should be always zend_object */
- return Z_OBJPROP_P(EG(This));
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- return NULL;
-}
-
-
-static void zend_fetch_var_address(zend_op *opline, temp_variable *Ts, int type TSRMLS_DC)
-{
- int free_op1;
- zval *varname = get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R);
- zval **retval;
- zval tmp_varname;
- HashTable *target_symbol_table;
-
- target_symbol_table = zend_get_target_symbol_table(opline, Ts, type TSRMLS_CC);
- if (!target_symbol_table) {
- return;
- }
-
- if (varname->type != IS_STRING) {
- tmp_varname = *varname;
- zval_copy_ctor(&tmp_varname);
- convert_to_string(&tmp_varname);
- varname = &tmp_varname;
- }
-
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &retval) == FAILURE) {
- switch (type) {
- case BP_VAR_R:
- zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val);
- /* break missing intentionally */
- case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
- break;
- case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val);
- /* break missing intentionally */
- case BP_VAR_W: {
- zval *new_zval = &EG(uninitialized_zval);
-
- new_zval->refcount++;
- zend_hash_update(target_symbol_table, varname->value.str.val, varname->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval);
- }
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- }
- if (opline->op2.u.EA.type == ZEND_FETCH_LOCAL) {
- FREE_OP(Ts, &opline->op1, free_op1);
- } else if (opline->op2.u.EA.type == ZEND_FETCH_STATIC || opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
- zval_update_constant(retval, (void *) 1 TSRMLS_CC);
- }
-
- if (varname == &tmp_varname) {
- zval_dtor(varname);
- }
- Ts[opline->result.u.var].var.ptr_ptr = retval;
- SELECTIVE_PZVAL_LOCK(*retval, &opline->result);
-}
-
-
-static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
-{
- zval *dim = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- zval **retval;
- char *offset_key;
- int offset_key_length;
-
- switch (dim->type) {
- case IS_NULL:
- offset_key = "";
- offset_key_length = 0;
- goto fetch_string_dim;
- case IS_STRING:
- offset_key = dim->value.str.val;
- offset_key_length = dim->value.str.len;
-
-fetch_string_dim:
- if (zend_hash_find(ht, offset_key, offset_key_length+1, (void **) &retval) == FAILURE) {
- switch (type) {
- case BP_VAR_R:
- zend_error(E_NOTICE,"Undefined index: %s", offset_key);
- /* break missing intentionally */
- case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
- break;
- case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined index: %s", offset_key);
- /* break missing intentionally */
- case BP_VAR_W: {
- zval *new_zval = &EG(uninitialized_zval);
-
- new_zval->refcount++;
- zend_hash_update(ht, offset_key, offset_key_length+1, &new_zval, sizeof(zval *), (void **) &retval);
- }
- break;
- }
- }
- break;
- case IS_DOUBLE:
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG: {
- long index;
-
- if (dim->type == IS_DOUBLE) {
- index = (long)dim->value.dval;
- } else {
- index = dim->value.lval;
- }
- if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) {
- switch (type) {
- case BP_VAR_R:
- zend_error(E_NOTICE,"Undefined offset: %d", index);
- /* break missing intentionally */
- case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
- break;
- case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined offset: %d", index);
- /* break missing intentionally */
- case BP_VAR_W: {
- zval *new_zval = &EG(uninitialized_zval);
-
- new_zval->refcount++;
- zend_hash_index_update(ht, index, &new_zval, sizeof(zval *), (void **) &retval);
- }
- break;
- }
- }
- }
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type");
- if (type == BP_VAR_R || type == BP_VAR_IS) {
- retval = &EG(uninitialized_zval_ptr);
- } else {
- retval = &EG(error_zval_ptr);
- }
- break;
- }
- FREE_OP(Ts, op2, EG(free_op2));
- return retval;
-}
-
-static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
-{
- zval **container_ptr = get_zval_ptr_ptr(op1, Ts, type);
- zval *container;
- zval ***retval = &Ts[result->u.var].var.ptr_ptr;
-
- container = *container_ptr;
-
- if (container == EG(error_zval_ptr)) {
- *retval = &EG(error_zval_ptr);
- SELECTIVE_PZVAL_LOCK(**retval, result);
- return;
- }
-
- if (container->type==IS_NULL
- || (container->type==IS_BOOL && container->value.lval==0)
- || (container->type==IS_STRING && container->value.str.len==0)) {
- switch (type) {
- case BP_VAR_RW:
- case BP_VAR_W:
- if (!PZVAL_IS_REF(container)) {
- SEPARATE_ZVAL(container_ptr);
- container = *container_ptr;
- }
- array_init(container);
- break;
- }
- }
-
- switch (container->type) {
- case IS_ARRAY:
- if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) {
- SEPARATE_ZVAL(container_ptr);
- container = *container_ptr;
- }
- if (op2->op_type == IS_UNUSED) {
- zval *new_zval = &EG(uninitialized_zval);
-
- new_zval->refcount++;
- if (zend_hash_next_index_insert(container->value.ht, &new_zval, sizeof(zval *), (void **) retval) == FAILURE) {
- zend_error(E_WARNING, "Cannot add element to the array as the nexxt element is already occupied");
- *retval = &EG(uninitialized_zval_ptr);
- new_zval->refcount--;
- }
- } else {
- *retval = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, type TSRMLS_CC);
- }
- SELECTIVE_PZVAL_LOCK(**retval, result);
- break;
- case IS_NULL:
- /* for read-mode only */
- get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- *retval = &EG(uninitialized_zval_ptr);
- SELECTIVE_PZVAL_LOCK(**retval, result);
- FREE_OP(Ts, op2, EG(free_op2));
- if (type==BP_VAR_W || type==BP_VAR_RW) {
- zend_error(E_WARNING, "Cannot use a NULL value as an array");
- }
- break;
- case IS_STRING: {
- zval *offset;
- zval tmp;
-
- if (op2->op_type==IS_UNUSED) {
- zend_error(E_ERROR, "[] operator not supported for strings");
- }
-
- offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
-
- if (offset->type != IS_LONG) {
- tmp = *offset;
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
- }
- if (type!=BP_VAR_R && type!=BP_VAR_IS) {
- SEPARATE_ZVAL_IF_NOT_REF(container_ptr);
- }
- container = *container_ptr;
- Ts[result->u.var].EA.data.str_offset.str = container;
- PZVAL_LOCK(container);
- Ts[result->u.var].EA.data.str_offset.offset = offset->value.lval;
- Ts[result->u.var].EA.type = IS_STRING_OFFSET;
- FREE_OP(Ts, op2, EG(free_op2));
- *retval = NULL;
- return;
- }
- break;
- default: {
- zval *offset;
-
- offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- if (type==BP_VAR_R || type==BP_VAR_IS) {
- *retval = &EG(uninitialized_zval_ptr);
- } else {
- *retval = &EG(error_zval_ptr);
- }
- FREE_OP(Ts, op2, EG(free_op2));
- SELECTIVE_PZVAL_LOCK(**retval, result);
- if (type==BP_VAR_W || type==BP_VAR_RW) {
- zend_error(E_WARNING, "Cannot use a scalar value as an array");
- }
- }
- break;
- }
-}
-
-
-static void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts TSRMLS_DC)
-{
- int free_op1;
- zval *container = get_zval_ptr(op1, Ts, &free_op1, BP_VAR_R);
-
- if (container->type != IS_ARRAY) {
- Ts[result->u.var].var.ptr_ptr = &EG(uninitialized_zval_ptr);
- SELECTIVE_PZVAL_LOCK(*Ts[result->u.var].var.ptr_ptr, result);
- return;
- }
-
- Ts[result->u.var].var.ptr_ptr = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, BP_VAR_R TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*Ts[result->u.var].var.ptr_ptr, result);
-}
-
-static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
-{
- zval **container_ptr = get_zval_ptr_ptr(op1, Ts, type);
- zval *container;
- zval ***retval = &Ts[result->u.var].var.ptr_ptr;
-
- container = *container_ptr;
- if (container == EG(error_zval_ptr)) {
- *retval = &EG(error_zval_ptr);
- SELECTIVE_PZVAL_LOCK(**retval, result);
- return;
- }
-
- if (container->type == IS_NULL
- || (container->type == IS_BOOL && container->value.lval==0)
- || (container->type == IS_STRING && container->value.str.len == 0)) {
- switch (type) {
- case BP_VAR_RW:
- case BP_VAR_W:
- if (!PZVAL_IS_REF(container)) {
- SEPARATE_ZVAL(container_ptr);
- container = *container_ptr;
- }
- object_init(container);
- break;
- }
- }
-
- if (container->type != IS_OBJECT) {
- zval *offset;
-
- offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- FREE_OP(Ts, op2, EG(free_op2));
- if (type == BP_VAR_R || type == BP_VAR_IS) {
- *retval = &EG(uninitialized_zval_ptr);
- } else {
- *retval = &EG(error_zval_ptr);
- }
- SELECTIVE_PZVAL_LOCK(**retval, result);
- return;
- }
-
-
- if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) {
- SEPARATE_ZVAL(container_ptr);
- container = *container_ptr;
- }
- *retval = zend_fetch_property_address_inner(container, op2, Ts, type TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(**retval, result);
-}
-
-static void zend_fetch_property_address_read(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
-{
- zval *container;
- zval **retval;
-
- retval = &Ts[result->u.var].var.ptr;
- Ts[result->u.var].var.ptr_ptr = retval;
-
- container = get_zval_ptr(op1, Ts, &EG(free_op1), type);
-
- if (container == EG(error_zval_ptr)) {
- *retval = EG(error_zval_ptr);
- SELECTIVE_PZVAL_LOCK(*retval, result);
- return;
- }
-
-
- if (container->type != IS_OBJECT) {
- zend_error(E_NOTICE, "Trying to get property of non-object");
-
- if (type==BP_VAR_R || type==BP_VAR_IS) {
- *retval = EG(uninitialized_zval_ptr);
- } else {
- *retval = EG(error_zval_ptr);
- }
- } else {
- zval *offset;
- zval tmp;
-
- offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- switch (op2->op_type) {
- case IS_CONST:
- /* already a constant string */
- break;
- case IS_VAR:
- tmp = *offset;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- offset = &tmp;
- break;
- case IS_TMP_VAR:
- convert_to_string(offset);
- break;
- }
-
- /* here we are sure we are dealing with an object */
- *retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC);
- if (offset == &tmp) {
- zval_dtor(offset);
- }
- FREE_OP(Ts, op2, EG(free_op2));
- }
-
- SELECTIVE_PZVAL_LOCK(*retval, result);
- return;
-}
-
-static void zend_pre_incdec_property(znode *result, znode *op1, znode *op2, temp_variable * Ts, int (*incdec_op)(zval *) TSRMLS_DC)
-{
- zval **object_ptr = get_zval_ptr_ptr(op1, Ts, BP_VAR_W);
- zval *object;
- zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- zval **retval = &Ts[result->u.var].var.ptr;
- int have_get_ptr = 0;
-
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
-
- if (object->type != IS_OBJECT) {
- zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- FREE_OP(Ts, op2, EG(free_op2));
- *retval = EG(uninitialized_zval_ptr);
-
- SELECTIVE_PZVAL_LOCK(*retval, result);
- return;
- }
-
- /* here we are sure we are dealing with an object */
-
- if (Z_OBJ_HT_P(object)->get_property_zval_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC);
- if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- have_get_ptr = 1;
- incdec_op(*zptr);
- *retval = *zptr;
- SELECTIVE_PZVAL_LOCK(*retval, result);
- }
- }
-
- if (!have_get_ptr) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
- incdec_op(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC);
- if (z->refcount <= 1) {
- zval_dtor(z);
- }
- }
-
- FREE_OP(Ts, op2, EG(free_op2));
-}
-
-static void zend_post_incdec_property(znode *result, znode *op1, znode *op2, temp_variable * Ts, int (*incdec_op)(zval *) TSRMLS_DC)
-{
- zval **object_ptr = get_zval_ptr_ptr(op1, Ts, BP_VAR_W);
- zval *object;
- zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
- zval *retval = &Ts[result->u.var].tmp_var;
- int have_get_ptr = 0;
-
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
-
- if (object->type != IS_OBJECT) {
- zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- FREE_OP(Ts, op2, EG(free_op2));
- *retval = *EG(uninitialized_zval_ptr);
- return;
- }
-
- /* here we are sure we are dealing with an object */
-
- if (Z_OBJ_HT_P(object)->get_property_zval_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC);
- if (zptr != NULL) { /* NULL means no success in getting PTR */
- have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- *retval = **zptr;
- zendi_zval_copy_ctor(*retval);
-
- incdec_op(*zptr);
-
- }
- }
-
- if (!have_get_ptr) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
- *retval = *z;
- zendi_zval_copy_ctor(*retval);
- incdec_op(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC);
- if (z->refcount <= 1) {
- zval_dtor(z);
- }
- }
-
- FREE_OP(Ts, op2, EG(free_op2));
-}
-
-
-#if ZEND_INTENSIVE_DEBUGGING
-
-#define CHECK_SYMBOL_TABLES() \
- zend_hash_apply(&EG(symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC); \
- if (&EG(symbol_table)!=EG(active_symbol_table)) { \
- zend_hash_apply(EG(active_symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC); \
- }
-
-static int zend_check_symbol(zval **pz TSRMLS_DC)
-{
- if (Z_TYPE_PP(pz) > 9) {
- fprintf(stderr, "Warning! %x has invalid type!\n", *pz);
- } else if (Z_TYPE_PP(pz) == IS_ARRAY) {
- zend_hash_apply(Z_ARRVAL_PP(pz), (apply_func_t) zend_check_symbol TSRMLS_CC);
- } else if (Z_TYPE_PP(pz) == IS_OBJECT) {
-
- /* OBJ-TBI - doesn't support new object model! */
- zend_hash_apply(Z_OBJPROP_PP(pz), (apply_func_t) zend_check_symbol TSRMLS_CC);
- }
-
- return 0;
-}
-
-
-#else
-#define CHECK_SYMBOL_TABLES()
-#endif
-
-#define NEXT_OPCODE() \
- CHECK_SYMBOL_TABLES() \
- EX(opline)++; \
- continue;
-
-#define RETURN_FROM_EXECUTE_LOOP(execute_data) \
- free_alloca(EX(Ts)); \
- EG(in_execution) = EX(original_in_execution); \
- EG(current_execute_data) = EX(prev_execute_data); \
- return;
-
-ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
-{
- zend_execute_data execute_data;
-
- /* Initialize execute_data */
- EX(fbc) = NULL;
- EX(object) = NULL;
- EX(Ts) = (temp_variable *) do_alloca(sizeof(temp_variable)*op_array->T);
- EX(op_array) = op_array;
- EX(original_in_execution) = EG(in_execution);
- EX(prev_execute_data) = EG(current_execute_data);
- EG(current_execute_data) = &execute_data;
-
- EG(in_execution) = 1;
- if (op_array->start_op) {
- EX(opline) = op_array->start_op;
- } else {
- EX(opline) = op_array->opcodes;
- }
-
- if (op_array->uses_this && EG(This)) {
- EG(This)->refcount++; /* For $this pointer */
- if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), NULL)==FAILURE) {
- EG(This)->refcount--;
- }
- }
-
- EG(opline_ptr) = &EX(opline);
-
- EX(function_state).function = (zend_function *) op_array;
- EG(function_state_ptr) = &EX(function_state);
-#if ZEND_DEBUG
- /* function_state.function_symbol_table is saved as-is to a stack,
- * which is an intentional UMR. Shut it up if we're in DEBUG.
- */
- EX(function_state).function_symbol_table = NULL;
-#endif
-
- while (1) {
-#ifdef ZEND_WIN32
- if (EG(timed_out)) {
- zend_timeout(0);
- }
-#endif
-
- zend_clean_garbage(TSRMLS_C);
-
- switch(EX(opline)->opcode) {
- case ZEND_ADD:
- EG(binary_op) = add_function;
- goto binary_op_addr;
- case ZEND_SUB:
- EG(binary_op) = sub_function;
- goto binary_op_addr;
- case ZEND_MUL:
- EG(binary_op) = mul_function;
- goto binary_op_addr;
- case ZEND_DIV:
- EG(binary_op) = div_function;
- goto binary_op_addr;
- case ZEND_MOD:
- EG(binary_op) = mod_function;
- goto binary_op_addr;
- case ZEND_SL:
- EG(binary_op) = shift_left_function;
- goto binary_op_addr;
- case ZEND_SR:
- EG(binary_op) = shift_right_function;
- goto binary_op_addr;
- case ZEND_CONCAT:
- EG(binary_op) = concat_function;
- goto binary_op_addr;
- case ZEND_IS_IDENTICAL:
- EG(binary_op) = is_identical_function;
- goto binary_op_addr;
- case ZEND_IS_NOT_IDENTICAL:
- EG(binary_op) = is_not_identical_function;
- goto binary_op_addr;
- case ZEND_IS_EQUAL:
- EG(binary_op) = is_equal_function;
- goto binary_op_addr;
- case ZEND_IS_NOT_EQUAL:
- EG(binary_op) = is_not_equal_function;
- goto binary_op_addr;
- case ZEND_IS_SMALLER:
- EG(binary_op) = is_smaller_function;
- goto binary_op_addr;
- case ZEND_IS_SMALLER_OR_EQUAL:
- EG(binary_op) = is_smaller_or_equal_function;
- goto binary_op_addr;
- case ZEND_BW_OR:
- EG(binary_op) = bitwise_or_function;
- goto binary_op_addr;
- case ZEND_BW_AND:
- EG(binary_op) = bitwise_and_function;
- goto binary_op_addr;
- case ZEND_BW_XOR:
- EG(binary_op) = bitwise_xor_function;
- goto binary_op_addr;
- case ZEND_BOOL_XOR:
- EG(binary_op) = boolean_xor_function;
- /* Fall through */
-binary_op_addr:
- EG(binary_op)(&EX(Ts)[EX(opline)->result.u.var].tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- NEXT_OPCODE();
- case ZEND_BW_NOT:
- case ZEND_BOOL_NOT:
- EG(unary_op) = get_unary_op(EX(opline)->opcode);
- EG(unary_op)(&EX(Ts)[EX(opline)->result.u.var].tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R) );
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- NEXT_OPCODE();
- case ZEND_ASSIGN_ADD:
- EG(binary_op) = add_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_SUB:
- EG(binary_op) = sub_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_MUL:
- EG(binary_op) = mul_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_DIV:
- EG(binary_op) = div_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_MOD:
- EG(binary_op) = mod_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_SL:
- EG(binary_op) = shift_left_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_SR:
- EG(binary_op) = shift_right_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_CONCAT:
- EG(binary_op) = concat_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_BW_OR:
- EG(binary_op) = bitwise_or_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_BW_AND:
- EG(binary_op) = bitwise_and_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_BW_XOR:
- EG(binary_op) = bitwise_xor_function;
- /* Fall through */
-binary_assign_op_addr: {
- zval **var_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_RW);
-
- if (!var_ptr) {
- zend_error(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
- }
- if (*var_ptr == EG(error_zval_ptr)) {
- EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr = &EG(uninitialized_zval_ptr);
- SELECTIVE_PZVAL_LOCK(*EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr, &EX(opline)->result);
- AI_USE_PTR(EX(Ts)[EX(opline)->result.u.var].var);
- EX(opline)++;
- continue;
- }
-
- SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
-
- EG(binary_op)(*var_ptr, *var_ptr, get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
- EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr = var_ptr;
- SELECTIVE_PZVAL_LOCK(*var_ptr, &EX(opline)->result);
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- AI_USE_PTR(EX(Ts)[EX(opline)->result.u.var].var);
- }
- NEXT_OPCODE();
-
- case ZEND_ASSIGN_ADD_OBJ:
- EG(binary_op) = add_function;
- goto binary_assign_op_addr_obj;
- case ZEND_ASSIGN_SUB_OBJ:
- EG(binary_op) = sub_function;
- goto binary_assign_op_addr_obj;
- case ZEND_ASSIGN_MUL_OBJ:
- EG(binary_op) = mul_function;
- goto binary_assign_op_addr_obj;
- case ZEND_ASSIGN_DIV_OBJ:
- EG(binary_op) = div_function;
- goto binary_assign_op_addr_obj;
- case ZEND_ASSIGN_MOD_OBJ:
- EG(binary_op) = mod_function;
- goto binary_assign_op_addr_obj;
- case ZEND_ASSIGN_SL_OBJ:
- EG(binary_op) = shift_left_function;
- goto binary_assign_op_addr_obj;
- case ZEND_ASSIGN_SR_OBJ:
- EG(binary_op) = shift_right_function;
- goto binary_assign_op_addr_obj;
- case ZEND_ASSIGN_CONCAT_OBJ:
- EG(binary_op) = concat_function;
- goto binary_assign_op_addr_obj;
- case ZEND_ASSIGN_BW_OR_OBJ:
- EG(binary_op) = bitwise_or_function;
- goto binary_assign_op_addr_obj;
- case ZEND_ASSIGN_BW_AND_OBJ:
- EG(binary_op) = bitwise_and_function;
- goto binary_assign_op_addr_obj;
- case ZEND_ASSIGN_BW_XOR_OBJ:
- EG(binary_op) = bitwise_xor_function;
- /* Fall through */
-binary_assign_op_addr_obj:
- zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts)[EX(opline)->extended_value].var.ptr, EX(Ts), EG(binary_op) TSRMLS_CC);
- NEXT_OPCODE();
- case ZEND_PRE_INC_OBJ:
- case ZEND_PRE_DEC_OBJ: {
- int (*incdec_op)(zval *op);
-
- get_incdec_op(incdec_op, EX(opline)->opcode);
- zend_pre_incdec_property(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), incdec_op TSRMLS_CC);
- }
- NEXT_OPCODE();
- case ZEND_POST_INC_OBJ:
- case ZEND_POST_DEC_OBJ: {
- int (*incdec_op)(zval *op);
-
- get_incdec_op(incdec_op, EX(opline)->opcode);
- zend_post_incdec_property(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), incdec_op TSRMLS_CC);
- }
- NEXT_OPCODE();
- case ZEND_PRE_INC:
- case ZEND_PRE_DEC:
- case ZEND_POST_INC:
- case ZEND_POST_DEC: {
- int (*incdec_op)(zval *op);
- zval **var_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_RW);
-
- if (!var_ptr) {
- zend_error(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
- }
- if (*var_ptr == EG(error_zval_ptr)) {
- EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr = &EG(uninitialized_zval_ptr);
- SELECTIVE_PZVAL_LOCK(*EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr, &EX(opline)->result);
- AI_USE_PTR(EX(Ts)[EX(opline)->result.u.var].var);
- EX(opline)++;
- continue;
- }
-
- get_incdec_op(incdec_op, EX(opline)->opcode);
-
- switch (EX(opline)->opcode) {
- case ZEND_POST_INC:
- case ZEND_POST_DEC:
- EX(Ts)[EX(opline)->result.u.var].tmp_var = **var_ptr;
- zendi_zval_copy_ctor(EX(Ts)[EX(opline)->result.u.var].tmp_var);
- break;
- }
-
- SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
-
- incdec_op(*var_ptr);
- switch (EX(opline)->opcode) {
- case ZEND_PRE_INC:
- case ZEND_PRE_DEC:
- EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr = var_ptr;
- SELECTIVE_PZVAL_LOCK(*var_ptr, &EX(opline)->result);
- AI_USE_PTR(EX(Ts)[EX(opline)->result.u.var].var);
- break;
- }
- }
- NEXT_OPCODE();
- case ZEND_PRINT:
- zend_print_variable(get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R));
- EX(Ts)[EX(opline)->result.u.var].tmp_var.value.lval = 1;
- EX(Ts)[EX(opline)->result.u.var].tmp_var.type = IS_LONG;
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- NEXT_OPCODE();
- case ZEND_ECHO:
- zend_print_variable(get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R));
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- NEXT_OPCODE();
- case ZEND_FETCH_R:
- zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_R TSRMLS_CC);
- AI_USE_PTR(EX(Ts)[EX(opline)->result.u.var].var);
- NEXT_OPCODE();
- case ZEND_FETCH_W:
- zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_W TSRMLS_CC);
- NEXT_OPCODE();
- case ZEND_FETCH_RW:
- zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_RW TSRMLS_CC);
- NEXT_OPCODE();
- case ZEND_FETCH_FUNC_ARG:
- if (ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->extended_value, EX(fbc), EX(fbc)->common.arg_types)) {
- /* Behave like FETCH_W */
- zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_W TSRMLS_CC);
- } else {
- /* Behave like FETCH_R */
- zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_R TSRMLS_CC);
- AI_USE_PTR(EX(Ts)[EX(opline)->result.u.var].var);
- }
- NEXT_OPCODE();
- case ZEND_FETCH_UNSET:
- zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_R TSRMLS_CC);
- PZVAL_UNLOCK(*EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr);
- if (EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr);
- }
- PZVAL_LOCK(*EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr);
- NEXT_OPCODE();
- case ZEND_FETCH_IS:
- zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_IS TSRMLS_CC);
- AI_USE_PTR(EX(Ts)[EX(opline)->result.u.var].var);
- NEXT_OPCODE();
- case ZEND_FETCH_DIM_R:
- if (EX(opline)->extended_value == ZEND_FETCH_ADD_LOCK) {
- PZVAL_LOCK(*EX(Ts)[EX(opline)->op1.u.var].var.ptr_ptr);
- }
- zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
- AI_USE_PTR(EX(Ts)[EX(opline)->result.u.var].var);
- NEXT_OPCODE();
- case ZEND_FETCH_DIM_W:
- zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_W TSRMLS_CC);
- NEXT_OPCODE();
- case ZEND_FETCH_DIM_RW:
- zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_RW TSRMLS_CC);
- NEXT_OPCODE();
- case ZEND_FETCH_DIM_IS:
- zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_IS TSRMLS_CC);
- AI_USE_PTR(EX(Ts)[EX(opline)->result.u.var].var);
- NEXT_OPCODE();
- case ZEND_FETCH_DIM_FUNC_ARG:
- if (ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->extended_value, EX(fbc), EX(fbc)->common.arg_types)) {
- /* Behave like FETCH_DIM_W */
- zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_W TSRMLS_CC);
- } else {
- /* Behave like FETCH_DIM_R, except for locking used for list() */
- zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
- AI_USE_PTR(EX(Ts)[EX(opline)->result.u.var].var);
- }
- NEXT_OPCODE();
- case ZEND_FETCH_DIM_UNSET:
- /* Not needed in DIM_UNSET
- if (EX(opline)->extended_value == ZEND_FETCH_ADD_LOCK) {
- PZVAL_LOCK(*EX(Ts)[EX(opline)->op1.u.var].var.ptr_ptr);
- }
- */
- zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
- PZVAL_UNLOCK(*EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr);
- if (EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr);
- }
- PZVAL_LOCK(*EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr);
- NEXT_OPCODE();
- case ZEND_FETCH_OBJ_R:
- zend_fetch_property_address_read(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
- AI_USE_PTR(EX(Ts)[EX(opline)->result.u.var].var);
- NEXT_OPCODE();
- case ZEND_FETCH_OBJ_W:
- zend_fetch_property_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_W TSRMLS_CC);
- NEXT_OPCODE();
- case ZEND_FETCH_OBJ_RW:
- zend_fetch_property_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_RW TSRMLS_CC);
- NEXT_OPCODE();
- case ZEND_FETCH_OBJ_IS:
- zend_fetch_property_address_read(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_IS TSRMLS_CC);
- AI_USE_PTR(EX(Ts)[EX(opline)->result.u.var].var);
- NEXT_OPCODE();
- case ZEND_FETCH_OBJ_FUNC_ARG:
- if (ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->extended_value, EX(fbc), EX(fbc)->common.arg_types)) {
- /* Behave like FETCH_OBJ_W */
- zend_fetch_property_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_W TSRMLS_CC);
- } else {
- zend_fetch_property_address_read(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
- AI_USE_PTR(EX(Ts)[EX(opline)->result.u.var].var);
- }
- NEXT_OPCODE();
- case ZEND_FETCH_OBJ_UNSET:
- zend_fetch_property_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
-
- PZVAL_UNLOCK(*EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr);
- if (EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr);
- }
- PZVAL_LOCK(*EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr);
- NEXT_OPCODE();
- case ZEND_FETCH_DIM_TMP_VAR:
- zend_fetch_dimension_address_from_tmp_var(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts) TSRMLS_CC);
- AI_USE_PTR(EX(Ts)[EX(opline)->result.u.var].var);
- NEXT_OPCODE();
- case ZEND_MAKE_VAR: {
- zval *value, *value2;
-
- value = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- switch(EX(opline)->op1.op_type) {
- case IS_TMP_VAR:
- value2 = value;
- ALLOC_ZVAL(value);
- *value = *value2;
- value->is_ref = 0;
- value->refcount = 0; /* lock will increase this */
- break;
- case IS_CONST:
- value2 = value;
- ALLOC_ZVAL(value);
- *value = *value2;
- zval_copy_ctor(value);
- value->is_ref = 0;
- value->refcount = 0; /* lock will increase this */
- break;
- }
-
- EX(Ts)[EX(opline)->result.u.var].var.ptr = value;
- PZVAL_LOCK(EX(Ts)[EX(opline)->result.u.var].var.ptr);
- }
- NEXT_OPCODE();
- case ZEND_ASSIGN_OBJ:
- zend_assign_to_object(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts)[EX(opline)->extended_value].var.ptr, EX(Ts) TSRMLS_CC);
- NEXT_OPCODE();
- case ZEND_ASSIGN: {
- zval *value;
- value = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
-
- zend_assign_to_variable(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, value, (EG(free_op2)?IS_TMP_VAR:EX(opline)->op2.op_type), EX(Ts) TSRMLS_CC);
- /* zend_assign_to_variable() always takes care of op2, never free it! */
- }
- NEXT_OPCODE();
- case ZEND_ASSIGN_REF:
- {
- zval **value_ptr_ptr = get_zval_ptr_ptr(&EX(opline)->op2, EX(Ts), BP_VAR_W);
-
- zend_assign_to_variable_reference(&EX(opline)->result, get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_W), value_ptr_ptr, EX(Ts) TSRMLS_CC);
- NEXT_OPCODE();
- }
- case ZEND_JMP:
-#if DEBUG_ZEND>=2
- printf("Jumping to %d\n", EX(opline)->op1.u.opline_num);
-#endif
- EX(opline) = &op_array->opcodes[EX(opline)->op1.u.opline_num];
- continue;
- break;
- case ZEND_JMPZ: {
- znode *op1 = &EX(opline)->op1;
-
- if (!i_zend_is_true(get_zval_ptr(op1, EX(Ts), &EG(free_op1), BP_VAR_R))) {
-#if DEBUG_ZEND>=2
- printf("Conditional jmp to %d\n", EX(opline)->op2.u.opline_num);
-#endif
- EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num];
- FREE_OP(EX(Ts), op1, EG(free_op1));
- continue;
- }
- FREE_OP(EX(Ts), op1, EG(free_op1));
- }
- NEXT_OPCODE();
- case ZEND_JMPNZ: {
- znode *op1 = &EX(opline)->op1;
-
- if (zend_is_true(get_zval_ptr(op1, EX(Ts), &EG(free_op1), BP_VAR_R))) {
-#if DEBUG_ZEND>=2
- printf("Conditional jmp to %d\n", EX(opline)->op2.u.opline_num);
-#endif
- EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num];
- FREE_OP(EX(Ts), op1, EG(free_op1));
- continue;
- }
- FREE_OP(EX(Ts), op1, EG(free_op1));
- }
- NEXT_OPCODE();
- case ZEND_JMPZNZ: {
- znode *res = &EX(opline)->op1;
-
- if (zend_is_true(get_zval_ptr(res, EX(Ts), &EG(free_op1), BP_VAR_R))) {
-#if DEBUG_ZEND>=2
- printf("Conditional jmp on true to %d\n", EX(opline)->extended_value);
-#endif
- EX(opline) = &op_array->opcodes[EX(opline)->extended_value];
- } else {
-#if DEBUG_ZEND>=2
- printf("Conditional jmp on false to %d\n", EX(opline)->op2.u.opline_num);
-#endif
- EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num];
- }
- FREE_OP(EX(Ts), res, EG(free_op1));
- }
- continue;
- break;
- case ZEND_JMPZ_EX: {
- zend_op *original_opline = EX(opline);
- int retval = zend_is_true(get_zval_ptr(&original_opline->op1, EX(Ts), &EG(free_op1), BP_VAR_R));
-
- FREE_OP(EX(Ts), &original_opline->op1, EG(free_op1));
- EX(Ts)[original_opline->result.u.var].tmp_var.value.lval = retval;
- EX(Ts)[original_opline->result.u.var].tmp_var.type = IS_BOOL;
- if (!retval) {
-#if DEBUG_ZEND>=2
- printf("Conditional jmp to %d\n", EX(opline)->op2.u.opline_num);
-#endif
- EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num];
- continue;
- }
- }
- NEXT_OPCODE();
- case ZEND_JMPNZ_EX: {
- zend_op *original_opline = EX(opline);
- int retval = zend_is_true(get_zval_ptr(&original_opline->op1, EX(Ts), &EG(free_op1), BP_VAR_R));
-
- FREE_OP(EX(Ts), &original_opline->op1, EG(free_op1));
- EX(Ts)[original_opline->result.u.var].tmp_var.value.lval = retval;
- EX(Ts)[original_opline->result.u.var].tmp_var.type = IS_BOOL;
- if (retval) {
-#if DEBUG_ZEND>=2
- printf("Conditional jmp to %d\n", EX(opline)->op2.u.opline_num);
-#endif
- EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num];
- continue;
- }
- }
- NEXT_OPCODE();
- case ZEND_FREE:
- zendi_zval_dtor(EX(Ts)[EX(opline)->op1.u.var].tmp_var);
- NEXT_OPCODE();
- case ZEND_INIT_STRING:
- EX(Ts)[EX(opline)->result.u.var].tmp_var.value.str.val = emalloc(1);
- EX(Ts)[EX(opline)->result.u.var].tmp_var.value.str.val[0] = 0;
- EX(Ts)[EX(opline)->result.u.var].tmp_var.value.str.len = 0;
- EX(Ts)[EX(opline)->result.u.var].tmp_var.refcount = 1;
- EX(Ts)[EX(opline)->result.u.var].tmp_var.type = IS_STRING;
- EX(Ts)[EX(opline)->result.u.var].tmp_var.is_ref = 0;
- NEXT_OPCODE();
- case ZEND_ADD_CHAR:
- add_char_to_string( &EX(Ts)[EX(opline)->result.u.var].tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_NA),
- &EX(opline)->op2.u.constant);
- /* FREE_OP is missing intentionally here - we're always working on the same temporary variable */
- NEXT_OPCODE();
- case ZEND_ADD_STRING:
- add_string_to_string( &EX(Ts)[EX(opline)->result.u.var].tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_NA),
- &EX(opline)->op2.u.constant);
- /* FREE_OP is missing intentionally here - we're always working on the same temporary variable */
- NEXT_OPCODE();
- case ZEND_ADD_VAR: {
- zval *var = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
- zval var_copy;
- int use_copy;
-
- zend_make_printable_zval(var, &var_copy, &use_copy);
- if (use_copy) {
- var = &var_copy;
- }
- add_string_to_string( &EX(Ts)[EX(opline)->result.u.var].tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_NA),
- var);
- if (use_copy) {
- zval_dtor(var);
- }
- /* original comment, possibly problematic:
- * FREE_OP is missing intentionally here - we're always working on the same temporary variable
- * (Zeev): I don't think it's problematic, we only use variables
- * which aren't affected by FREE_OP(Ts, )'s anyway, unless they're
- * string offsets or overloaded objects
- */
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- }
- NEXT_OPCODE();
- case ZEND_IMPORT_FUNCTION:
- {
- zend_class_entry *ce;
- zend_function *function;
-
- ce = EX(Ts)[EX(opline)->op1.u.var].EA.class_entry;
-
- if (EX(opline)->op2.op_type != IS_UNUSED) {
- char *function_name_strval;
- int function_name_strlen;
-
- function_name_strval = EX(opline)->op2.u.constant.value.str.val;
- function_name_strlen = EX(opline)->op2.u.constant.value.str.len;
-
- if (zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen + 1, (void **) &function)==FAILURE) {
- zend_error(E_ERROR, "Import: function %s() not found", function_name_strval);
- }
- if (zend_hash_add(EG(function_table), function_name_strval, function_name_strlen + 1, function, sizeof(zend_function), NULL) == FAILURE) {
- zend_error(E_ERROR, "Import: function %s() already exists in current scope", function_name_strval);
- }
- function_add_ref(function);
- } else {
- zend_function tmp_zend_function;
-
- zend_hash_copy(EG(function_table), &ce->function_table, (copy_ctor_func_t) function_add_ref, &tmp_zend_function, sizeof(zend_function));
- }
- NEXT_OPCODE();
- }
- case ZEND_IMPORT_CLASS:
- {
- zend_class_entry *ce;
- zend_class_entry **import_ce;
-
- ce = EX(Ts)[EX(opline)->op1.u.var].EA.class_entry;
-
- if (EX(opline)->op2.op_type != IS_UNUSED) {
- char *class_name_strval;
- int class_name_strlen;
-
- class_name_strval = EX(opline)->op2.u.constant.value.str.val;
- class_name_strlen = EX(opline)->op2.u.constant.value.str.len;
-
- if (zend_hash_find(&ce->class_table, class_name_strval, class_name_strlen + 1, (void **) &import_ce)==FAILURE) {
- zend_error(E_ERROR, "Import: class %s not found", class_name_strval);
- }
- if (zend_hash_add(EG(class_table), class_name_strval, class_name_strlen + 1, import_ce, sizeof(zend_class_entry *), NULL) == FAILURE) {
- zend_error(E_ERROR, "Import: class %s already exists in current scope", class_name_strval);
- }
- zend_class_add_ref(import_ce);
- } else {
- zend_class_entry *tmp_zend_class_entry;
-
- zend_hash_copy(EG(class_table), &ce->class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_zend_class_entry, sizeof(zend_class_entry *));
- }
-
- NEXT_OPCODE();
- }
- case ZEND_IMPORT_CONST:
- {
- zend_class_entry *ce;
- zval **import_constant;
- zend_constant c;
-
- ce = EX(Ts)[EX(opline)->op1.u.var].EA.class_entry;
- if (EX(opline)->op2.op_type != IS_UNUSED) {
- char *const_name_strval;
- int const_name_strlen;
-
- const_name_strval = EX(opline)->op2.u.constant.value.str.val;
- const_name_strlen = EX(opline)->op2.u.constant.value.str.len;
-
- if (zend_hash_find(&ce->constants_table, const_name_strval, const_name_strlen + 1, (void **) &import_constant)==FAILURE) {
- zend_error(E_ERROR, "Import: constant %s not found", const_name_strval);
- }
- c.value = **import_constant;
- zval_copy_ctor(&c.value);
- c.flags = CONST_CS;
- c.name = zend_strndup(const_name_strval, const_name_strlen);
- c.name_len = const_name_strlen + 1;
-
- if (zend_register_constant(&c TSRMLS_CC) == FAILURE) {
- zend_error(E_ERROR, "Import: unable to register constant %s", const_name_strval);
- }
- } else {
- HashPosition pos;
- char *key;
- uint key_length;
- int key_type;
- ulong dummy;
-
- zend_hash_internal_pointer_reset_ex(&ce->constants_table, &pos);
- while (zend_hash_get_current_data_ex(&ce->constants_table, (void **)&import_constant, &pos) == SUCCESS) {
- key_type = zend_hash_get_current_key_ex(&ce->constants_table, &key, &key_length, &dummy, 0, &pos);
-
- c.value = **import_constant;
- zval_copy_ctor(&c.value);
- c.flags = CONST_CS;
- c.name = zend_strndup(key, key_length - 1);
- c.name_len = key_length;
-
- if (zend_register_constant(&c TSRMLS_CC) == FAILURE) {
- zend_error(E_ERROR, "Import: unable to register constant %s", key);
- }
- zend_hash_move_forward_ex(&ce->constants_table, &pos);
- }
- }
- NEXT_OPCODE();
- }
- case ZEND_FETCH_CLASS:
- {
- zend_class_entry **pce;
-
- if (EX(opline)->op1.op_type == IS_UNUSED) {
- zval tmp;
- zval *class_name;
- zend_bool is_const;
- char *class_name_strval;
- zend_uint class_name_strlen;
-
- if (EX(opline)->extended_value == ZEND_FETCH_CLASS_SELF) {
- if (!EG(scope)) {
- zend_error(E_ERROR, "Cannot fetch self:: when no class scope is active");
- }
- EX(Ts)[EX(opline)->result.u.var].EA.class_entry = EG(scope);
- NEXT_OPCODE();
- } else if (EX(opline)->extended_value == ZEND_FETCH_CLASS_MAIN) {
- EX(Ts)[EX(opline)->result.u.var].EA.class_entry = EG(main_class_ptr);
- NEXT_OPCODE();
- } else if (EX(opline)->extended_value == ZEND_FETCH_CLASS_PARENT) {
- if (!EG(scope)) {
- zend_error(E_ERROR, "Cannot fetch parent:: when no class scope is active");
- }
- if (!EG(scope)->parent) {
- zend_error(E_ERROR, "Cannot fetch parent:: as current class scope has no parent");
- }
- EX(Ts)[EX(opline)->result.u.var].EA.class_entry = EG(scope)->parent;
- NEXT_OPCODE();
- }
-
- is_const = (EX(opline)->op2.op_type == IS_CONST);
-
- if (is_const) {
- class_name_strval = EX(opline)->op2.u.constant.value.str.val;
- class_name_strlen = EX(opline)->op2.u.constant.value.str.len;
- } else {
- class_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
-
- tmp = *class_name;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- zend_str_tolower(tmp.value.str.val, tmp.value.str.len);
-
- class_name_strval = tmp.value.str.val;
- class_name_strlen = tmp.value.str.len;
- }
-
- if (zend_lookup_class(class_name_strval, class_name_strlen, &pce TSRMLS_CC) == FAILURE) {
- zend_error(E_ERROR, "Class '%s' not found", class_name_strval);
- } else {
- EX(Ts)[EX(opline)->result.u.var].EA.class_entry = *pce;
- }
- if (!is_const) {
- zval_dtor(&tmp);
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- }
- } else {
- if (zend_hash_find(&EX(Ts)[EX(opline)->op1.u.var].EA.class_entry->class_table, EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len+1, (void **)&pce) == FAILURE) {
- zend_error(E_ERROR, "Class '%s' not found", EX(opline)->op2.u.constant.value.str.val);
- } else {
- EX(Ts)[EX(opline)->result.u.var].EA.class_entry = *pce;
- }
- }
- NEXT_OPCODE();
- }
- case ZEND_INIT_CTOR_CALL:
- {
- zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope));
-
- if (EX(opline)->op1.op_type == IS_VAR) {
- SELECTIVE_PZVAL_LOCK(*EX(Ts)[EX(opline)->op1.u.var].var.ptr_ptr, &EX(opline)->op1);
- }
-
- /* We are not handling overloaded classes right now */
- EX(object) = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- if (!PZVAL_IS_REF(EX(object))) {
- EX(object)->refcount++; /* For $this pointer */
- } else {
- zval *this_ptr;
-
- ALLOC_ZVAL(this_ptr);
- *this_ptr = *EX(object);
- INIT_PZVAL(this_ptr);
- zval_copy_ctor(this_ptr);
- EX(object) = this_ptr;
- }
-
- EX(fbc) = EX(fbc_constructor);
- if (EX(fbc)->type == ZEND_USER_FUNCTION) { /* HACK!! */
- /* The scope should be the scope of the class where the constructor
- was initially declared in */
- EX(calling_scope) = EX(fbc)->common.scope;
- } else {
- EX(calling_scope) = NULL;
- }
-
- NEXT_OPCODE();
- }
- case ZEND_INIT_METHOD_CALL:
- {
- zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
-
- zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope));
-
- function_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
- function_name_strval = function_name->value.str.val;
- function_name_strlen = function_name->value.str.len;
-
- EX(calling_scope) = EG(scope);
-
- if (EX(opline)->extended_value == ZEND_FETCH_FROM_THIS) {
- if (!EG(This)) {
- zend_error(E_ERROR, "Can't fetch $this as not in object context");
- }
- EX(object) = EG(This);
- } else {
- EX(object) = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- }
-
- if (EX(object) && EX(object)->type == IS_OBJECT) {
- EX(fbc) = Z_OBJ_HT_P(EX(object))->get_method(EX(object), function_name_strval, function_name_strlen TSRMLS_CC);
- } else {
- zend_error(E_ERROR, "Call to a member function on a non-object");
- }
- if (!EX(fbc)) {
- zend_error(E_ERROR, "Call to undefined function: %s()", function_name_strval);
- }
-
- if (!PZVAL_IS_REF(EX(object))) {
- EX(object)->refcount++; /* For $this pointer */
- } else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- *this_ptr = *EX(object);
- INIT_PZVAL(this_ptr);
- zval_copy_ctor(this_ptr);
- EX(object) = this_ptr;
- }
-
- if (EX(fbc)->type == ZEND_USER_FUNCTION) {
- EX(calling_scope) = EX(fbc)->common.scope;
- } else {
- EX(calling_scope) = NULL;
- }
-
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
-
- NEXT_OPCODE();
- }
- case ZEND_INIT_STATIC_METHOD_CALL:
- {
- zval *function_name;
- zend_function *function;
- zval tmp;
- zend_class_entry *ce;
- zend_bool is_const;
- char *function_name_strval;
- int function_name_strlen;
-
- zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope));
-
- is_const = (EX(opline)->op2.op_type == IS_CONST);
-
- if (is_const) {
- function_name_strval = EX(opline)->op2.u.constant.value.str.val;
- function_name_strlen = EX(opline)->op2.u.constant.value.str.len;
- } else {
- function_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
-
- tmp = *function_name;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- zend_str_tolower(tmp.value.str.val, tmp.value.str.len);
-
- function_name_strval = tmp.value.str.val;
- function_name_strlen = tmp.value.str.len;
- }
-
- if ((EX(object) = EG(This))) {
- EX(object)->refcount++;
- }
-
- ce = EX(Ts)[EX(opline)->op1.u.var].EA.class_entry;
-
- EX(calling_scope) = ce;
-
- if (zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen+1, (void **) &function)==FAILURE) {
- zend_error(E_ERROR, "Call to undefined function: %s()", function_name_strval);
- }
-
- if (!is_const) {
- zval_dtor(&tmp);
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- }
-
- EX(fbc) = function;
-
- NEXT_OPCODE();
- }
- case ZEND_INIT_FCALL_BY_NAME:
- {
- zval *function_name;
- zend_function *function;
- zval tmp;
- zend_bool is_const;
- char *function_name_strval;
- int function_name_strlen;
-
- zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope));
-
- is_const = (EX(opline)->op2.op_type == IS_CONST);
-
- if (is_const) {
- function_name_strval = EX(opline)->op2.u.constant.value.str.val;
- function_name_strlen = EX(opline)->op2.u.constant.value.str.len;
- } else {
- function_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
-
- tmp = *function_name;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- zend_str_tolower(tmp.value.str.val, tmp.value.str.len);
-
- function_name_strval = tmp.value.str.val;
- function_name_strlen = tmp.value.str.len;
- }
-
-
- do {
- /*
- if (EG(scope)) {
- if (zend_hash_find(&EG(scope)->function_table, function_name_strval, function_name_strlen+1, (void **) &function) == SUCCESS) {
- if ((EX(object) = EG(This))) {
- EX(object)->refcount++;
- }
- EX(calling_scope) = EG(scope);
- break;
- }
- }
- */
- if (zend_hash_find(EG(function_table), function_name_strval, function_name_strlen+1, (void **) &function)==FAILURE) {
- zend_error(E_ERROR, "Call to undefined function: %s()", function_name_strval);
- }
- EX(calling_scope) = function->common.scope;
- EX(object) = NULL;
- } while (0);
-
- if (!is_const) {
- zval_dtor(&tmp);
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- }
- EX(fbc) = function;
-
- NEXT_OPCODE();
- }
- case ZEND_DO_FCALL_BY_NAME:
- EX(function_state).function = EX(fbc);
- goto do_fcall_common;
- case ZEND_DO_FCALL: {
- zval *fname = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope));
-
- do {
- if (EG(scope)) {
- if (zend_hash_find(&EG(scope)->function_table, fname->value.str.val, fname->value.str.len+1, (void **) &EX(function_state).function) == SUCCESS) {
- if ((EX(object) = EG(This))) {
- EX(object)->refcount++;
- }
- EX(calling_scope) = EG(scope);
- break;
- }
- }
- if (zend_hash_find(EG(function_table), fname->value.str.val, fname->value.str.len+1, (void **) &EX(function_state).function)==FAILURE) {
- zend_error(E_ERROR, "Unknown function: %s()\n", fname->value.str.val);
- }
- EX(object) = NULL;
- EX(calling_scope) = EX(function_state).function->common.scope;
- } while (0);
-
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
-
- goto do_fcall_common;
- }
-do_fcall_common:
- {
- zval **original_return_value;
- zend_class_entry *current_scope;
- zval *current_this;
- int return_value_used = RETURN_VALUE_USED(EX(opline));
-
- zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) EX(opline)->extended_value, NULL);
- current_scope = EG(scope);
- EG(scope) = EX(calling_scope);
-
- current_this = EG(This);
- EG(This) = EX(object);
-
- EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr = &EX(Ts)[EX(opline)->result.u.var].var.ptr;
-
- if (EX(function_state).function->type==ZEND_INTERNAL_FUNCTION) {
- ALLOC_ZVAL(EX(Ts)[EX(opline)->result.u.var].var.ptr);
- INIT_ZVAL(*(EX(Ts)[EX(opline)->result.u.var].var.ptr));
- ((zend_internal_function *) EX(function_state).function)->handler(EX(opline)->extended_value, EX(Ts)[EX(opline)->result.u.var].var.ptr, EX(object), return_value_used TSRMLS_CC);
- EG(current_execute_data) = &execute_data;
- EX(Ts)[EX(opline)->result.u.var].var.ptr->is_ref = 0;
- EX(Ts)[EX(opline)->result.u.var].var.ptr->refcount = 1;
- if (!return_value_used) {
- zval_ptr_dtor(&EX(Ts)[EX(opline)->result.u.var].var.ptr);
- }
- } else if (EX(function_state).function->type==ZEND_USER_FUNCTION) {
- HashTable *calling_symbol_table;
-
- EX(Ts)[EX(opline)->result.u.var].var.ptr = NULL;
- if (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
- /*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/
- EX(function_state).function_symbol_table = *(EG(symtable_cache_ptr)--);
- } else {
- ALLOC_HASHTABLE(EX(function_state).function_symbol_table);
- zend_hash_init(EX(function_state).function_symbol_table, 0, NULL, ZVAL_PTR_DTOR, 0);
- /*printf("Cache miss! Initialized %x\n", function_state.function_symbol_table);*/
- }
- calling_symbol_table = EG(active_symbol_table);
- EG(active_symbol_table) = EX(function_state).function_symbol_table;
- original_return_value = EG(return_value_ptr_ptr);
- EG(return_value_ptr_ptr) = EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr;
- EG(active_op_array) = (zend_op_array *) EX(function_state).function;
-
- zend_execute(EG(active_op_array) TSRMLS_CC);
-
- if (return_value_used && !EX(Ts)[EX(opline)->result.u.var].var.ptr) {
- if (!EG(exception)) {
- ALLOC_ZVAL(EX(Ts)[EX(opline)->result.u.var].var.ptr);
- INIT_ZVAL(*EX(Ts)[EX(opline)->result.u.var].var.ptr);
- }
- } else if (!return_value_used && EX(Ts)[EX(opline)->result.u.var].var.ptr) {
- zval_ptr_dtor(&EX(Ts)[EX(opline)->result.u.var].var.ptr);
- }
-
- EG(opline_ptr) = &EX(opline);
- EG(active_op_array) = op_array;
- EG(return_value_ptr_ptr)=original_return_value;
- if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) {
- zend_hash_destroy(EX(function_state).function_symbol_table);
- FREE_HASHTABLE(EX(function_state).function_symbol_table);
- } else {
- *(++EG(symtable_cache_ptr)) = EX(function_state).function_symbol_table;
- zend_hash_clean(*EG(symtable_cache_ptr));
- }
- EG(active_symbol_table) = calling_symbol_table;
- } else { /* ZEND_OVERLOADED_FUNCTION */
- ALLOC_ZVAL(EX(Ts)[EX(opline)->result.u.var].var.ptr);
- INIT_ZVAL(*(EX(Ts)[EX(opline)->result.u.var].var.ptr));
-
- if (EX(object)) {
- Z_OBJ_HT_P(EX(object))->call_method(EX(fbc)->common.function_name, EX(opline)->extended_value, EX(Ts)[EX(opline)->result.u.var].var.ptr, EX(object), return_value_used TSRMLS_CC);
- } else {
- zend_error(E_ERROR, "Cannot call overloaded function for non-object");
- }
-
- efree(EX(fbc));
- if (!return_value_used) {
- zval_ptr_dtor(&EX(Ts)[EX(opline)->result.u.var].var.ptr);
- }
- }
- zend_ptr_stack_n_pop(&EG(arg_types_stack), 3, &EX(calling_scope), &EX(object), &EX(fbc));
-
- EX(function_state).function = (zend_function *) op_array;
- EG(function_state_ptr) = &EX(function_state);
- zend_ptr_stack_clear_multiple(TSRMLS_C);
-
- EG(scope) = current_scope;
-
- if (EG(This)) {
- zval_ptr_dtor(&EG(This));
- }
-
- EG(This) = current_this;
-
- if (EG(exception)) {
- if (EX(opline)->op2.u.opline_num == -1) {
- RETURN_FROM_EXECUTE_LOOP(execute_data);
- } else {
- EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num];
- continue;
- }
- }
- }
- NEXT_OPCODE();
- case ZEND_RETURN: {
- zval *retval_ptr;
- zval **retval_ptr_ptr;
-
- if ((EG(active_op_array)->return_reference == ZEND_RETURN_REF) &&
- (EX(opline)->op1.op_type != IS_CONST) &&
- (EX(opline)->op1.op_type != IS_TMP_VAR)) {
-
- retval_ptr_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_W);
-
- if (!retval_ptr_ptr) {
- zend_error(E_ERROR, "Cannot return overloaded elements or string offsets by reference");
- }
-
- SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr);
- (*retval_ptr_ptr)->refcount++;
-
- (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr);
- } else {
- retval_ptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- if (!EG(free_op1)) { /* Not a temp var */
- if (PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0) {
- ALLOC_ZVAL(*(EG(return_value_ptr_ptr)));
- **EG(return_value_ptr_ptr) = *retval_ptr;
- (*EG(return_value_ptr_ptr))->is_ref = 0;
- (*EG(return_value_ptr_ptr))->refcount = 1;
- zval_copy_ctor(*EG(return_value_ptr_ptr));
- } else {
- *EG(return_value_ptr_ptr) = retval_ptr;
- retval_ptr->refcount++;
- }
- } else {
- ALLOC_ZVAL(*(EG(return_value_ptr_ptr)));
- **EG(return_value_ptr_ptr) = *retval_ptr;
- (*EG(return_value_ptr_ptr))->refcount = 1;
- (*EG(return_value_ptr_ptr))->is_ref = 0;
- }
- }
- RETURN_FROM_EXECUTE_LOOP(execute_data);
- }
- break;
- case ZEND_THROW:
- {
- zval *value;
- zval *exception;
-
- value = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- if (value->type != IS_OBJECT) {
- zend_error(E_ERROR, "Can only throw objects");
- }
- /* Not sure if a complete copy is what we want here */
- MAKE_STD_ZVAL(exception);
- *exception = *value;
- if (!EG(free_op1)) {
- zval_copy_ctor(exception);
- }
- INIT_PZVAL(exception);
- EG(exception) = exception;
-
- if (EX(opline)->op2.u.opline_num == -1) {
- RETURN_FROM_EXECUTE_LOOP(execute_data);
- } else {
- EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num];
- continue;
- }
- }
- NEXT_OPCODE();
- case ZEND_CATCH:
- {
- zend_class_entry *ce;
-
- /* Check if this is really an exception, if not, jump over code */
- if (EG(exception) == NULL) {
- EX(opline) = &op_array->opcodes[EX(opline)->extended_value];
- continue;
- }
- ce = Z_OBJCE_P(EG(exception));
- if (ce != EX(Ts)[EX(opline)->op1.u.var].EA.class_entry) {
- while (ce->parent) {
- if (ce->parent == EX(Ts)[EX(opline)->op1.u.var].EA.class_entry) {
- goto exception_should_be_taken;
- }
- ce = ce->parent;
- }
- EX(opline) = &op_array->opcodes[EX(opline)->extended_value];
- continue;
- }
-exception_should_be_taken:
- zend_hash_update(EG(active_symbol_table), EX(opline)->op2.u.constant.value.str.val,
- EX(opline)->op2.u.constant.value.str.len+1, &EG(exception), sizeof(zval *), (void **) NULL);
- EG(exception) = NULL;
- NEXT_OPCODE();
- }
- case ZEND_SEND_VAL:
- if (EX(opline)->extended_value==ZEND_DO_FCALL_BY_NAME
- && ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->op2.u.opline_num, EX(fbc), EX(fbc)->common.arg_types)) {
- zend_error(E_ERROR, "Cannot pass parameter %d by reference", EX(opline)->op2.u.opline_num);
- }
- {
- zval *valptr;
- zval *value;
-
- value = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- ALLOC_ZVAL(valptr);
- *valptr = *value;
- if (!EG(free_op1)) {
- zval_copy_ctor(valptr);
- }
- INIT_PZVAL(valptr);
- zend_ptr_stack_push(&EG(argument_stack), valptr);
- }
- NEXT_OPCODE();
- case ZEND_SEND_VAR_NO_REF:
- if (EX(opline)->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */
- if (!(EX(opline)->extended_value & ZEND_ARG_SEND_BY_REF)) {
- goto send_by_var;
- }
- } else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->op2.u.opline_num, EX(fbc), EX(fbc)->common.arg_types)) {
- goto send_by_var;
- }
- {
- zval *varptr;
- varptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- if (varptr != &EG(uninitialized_zval) && (PZVAL_IS_REF(varptr) || varptr->refcount == 1)) {
- varptr->is_ref = 1;
- varptr->refcount++;
- zend_ptr_stack_push(&EG(argument_stack), varptr);
- NEXT_OPCODE();
- }
- zend_error(E_ERROR, "Only variables can be passed by reference");
- }
- NEXT_OPCODE();
- case ZEND_SEND_VAR:
- if ((EX(opline)->extended_value == ZEND_DO_FCALL_BY_NAME)
- && ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->op2.u.opline_num, EX(fbc), EX(fbc)->common.arg_types)) {
- goto send_by_ref;
- }
-send_by_var:
- {
- zval *varptr;
- varptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- if (varptr == &EG(uninitialized_zval)) {
- ALLOC_ZVAL(varptr);
- INIT_ZVAL(*varptr);
- varptr->refcount = 0;
- } else if (PZVAL_IS_REF(varptr)) {
- zval *original_var = varptr;
-
- ALLOC_ZVAL(varptr);
- *varptr = *original_var;
- varptr->is_ref = 0;
- varptr->refcount = 0;
- zval_copy_ctor(varptr);
- }
- varptr->refcount++;
- zend_ptr_stack_push(&EG(argument_stack), varptr);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); /* for string offsets */
- }
- NEXT_OPCODE();
-send_by_ref:
- case ZEND_SEND_REF: {
- zval **varptr_ptr;
- zval *varptr;
- varptr_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_W);
-
- if (!varptr_ptr) {
- zend_error(E_ERROR, "Only variables can be passed by reference");
- }
-
- SEPARATE_ZVAL_TO_MAKE_IS_REF(varptr_ptr);
- varptr = *varptr_ptr;
- varptr->refcount++;
- zend_ptr_stack_push(&EG(argument_stack), varptr);
- }
- NEXT_OPCODE();
- case ZEND_RECV: {
- zval **param;
-
- if (zend_ptr_stack_get_arg(EX(opline)->op1.u.constant.value.lval, (void **) &param TSRMLS_CC)==FAILURE) {
- zend_error(E_WARNING, "Missing argument %d for %s()\n", EX(opline)->op1.u.constant.value.lval, get_active_function_name(TSRMLS_C));
- if (EX(opline)->result.op_type == IS_VAR) {
- PZVAL_UNLOCK(*EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr);
- }
- } else if (PZVAL_IS_REF(*param)) {
- zend_assign_to_variable_reference(NULL, get_zval_ptr_ptr(&EX(opline)->result, EX(Ts), BP_VAR_W), param, NULL TSRMLS_CC);
- } else {
- zend_assign_to_variable(NULL, &EX(opline)->result, NULL, *param, IS_VAR, EX(Ts) TSRMLS_CC);
- }
- }
- NEXT_OPCODE();
- case ZEND_RECV_INIT: {
- zval **param, *assignment_value;
-
- if (zend_ptr_stack_get_arg(EX(opline)->op1.u.constant.value.lval, (void **) &param TSRMLS_CC)==FAILURE) {
- if (EX(opline)->op2.u.constant.type == IS_CONSTANT || EX(opline)->op2.u.constant.type==IS_CONSTANT_ARRAY) {
- zval *default_value;
-
- ALLOC_ZVAL(default_value);
- *default_value = EX(opline)->op2.u.constant;
- if (EX(opline)->op2.u.constant.type==IS_CONSTANT_ARRAY) {
- zval_copy_ctor(default_value);
- }
- default_value->refcount=1;
- zval_update_constant(&default_value, 0 TSRMLS_CC);
- default_value->refcount=0;
- default_value->is_ref=0;
- param = &default_value;
- assignment_value = default_value;
- } else {
- param = NULL;
- assignment_value = &EX(opline)->op2.u.constant;
- }
- zend_assign_to_variable(NULL, &EX(opline)->result, NULL, assignment_value, IS_VAR, EX(Ts) TSRMLS_CC);
- } else {
- assignment_value = *param;
- if (PZVAL_IS_REF(assignment_value)) {
- zend_assign_to_variable_reference(NULL, get_zval_ptr_ptr(&EX(opline)->result, EX(Ts), BP_VAR_W), param, NULL TSRMLS_CC);
- } else {
- zend_assign_to_variable(NULL, &EX(opline)->result, NULL, assignment_value, IS_VAR, EX(Ts) TSRMLS_CC);
- }
- }
- }
- NEXT_OPCODE();
- case ZEND_BOOL:
- /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */
- EX(Ts)[EX(opline)->result.u.var].tmp_var.value.lval = zend_is_true(get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R));
- EX(Ts)[EX(opline)->result.u.var].tmp_var.type = IS_BOOL;
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- NEXT_OPCODE();
- case ZEND_BRK:
- case ZEND_CONT: {
- zval *nest_levels_zval = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
- zval tmp;
- int array_offset, nest_levels, original_nest_levels;
- zend_brk_cont_element *jmp_to;
-
- if (nest_levels_zval->type != IS_LONG) {
- tmp = *nest_levels_zval;
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- nest_levels = tmp.value.lval;
- } else {
- nest_levels = nest_levels_zval->value.lval;
- }
- original_nest_levels = nest_levels;
- array_offset = EX(opline)->op1.u.opline_num;
- do {
- if (array_offset==-1) {
- zend_error(E_ERROR, "Cannot break/continue %d level%s", original_nest_levels, (original_nest_levels == 1) ? "" : "s");
- }
- jmp_to = &op_array->brk_cont_array[array_offset];
- if (nest_levels>1) {
- zend_op *brk_opline = &op_array->opcodes[jmp_to->brk];
-
- switch (brk_opline->opcode) {
- case ZEND_SWITCH_FREE:
- zend_switch_free(brk_opline, EX(Ts) TSRMLS_CC);
- break;
- case ZEND_FREE:
- zendi_zval_dtor(EX(Ts)[brk_opline->op1.u.var].tmp_var);
- break;
- }
- }
- array_offset = jmp_to->parent;
- } while (--nest_levels > 0);
-
- if (EX(opline)->opcode == ZEND_BRK) {
- EX(opline) = op_array->opcodes+jmp_to->brk;
- } else {
- EX(opline) = op_array->opcodes+jmp_to->cont;
- }
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- continue;
- }
- /* Never reaches this point */
- case ZEND_CASE: {
- int switch_expr_is_overloaded=0;
-
- if (EX(opline)->op1.op_type==IS_VAR) {
- if (EX(Ts)[EX(opline)->op1.u.var].var.ptr_ptr) {
- PZVAL_LOCK(*EX(Ts)[EX(opline)->op1.u.var].var.ptr_ptr);
- } else {
- switch_expr_is_overloaded = 1;
- if (EX(Ts)[EX(opline)->op1.u.var].EA.type==IS_STRING_OFFSET) {
- EX(Ts)[EX(opline)->op1.u.var].EA.data.str_offset.str->refcount++;
- }
- }
- }
- is_equal_function(&EX(Ts)[EX(opline)->result.u.var].tmp_var,
- get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R),
- get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC);
-
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- EX(Ts)[EX(opline)->op1.u.var].var.ptr_ptr = NULL;
- AI_USE_PTR(EX(Ts)[EX(opline)->op1.u.var].var);
- }
- }
- NEXT_OPCODE();
- case ZEND_SWITCH_FREE:
- zend_switch_free(EX(opline), EX(Ts) TSRMLS_CC);
- NEXT_OPCODE();
- case ZEND_NEW:
- {
- EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr = &EX(Ts)[EX(opline)->result.u.var].var.ptr;
- ALLOC_ZVAL(EX(Ts)[EX(opline)->result.u.var].var.ptr);
- object_init_ex(EX(Ts)[EX(opline)->result.u.var].var.ptr, EX(Ts)[EX(opline)->op1.u.var].EA.class_entry);
- EX(Ts)[EX(opline)->result.u.var].var.ptr->refcount=1;
- EX(Ts)[EX(opline)->result.u.var].var.ptr->is_ref=1;
- }
- NEXT_OPCODE();
- case ZEND_CLONE:
- {
- zval *obj = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr = &EX(Ts)[EX(opline)->result.u.var].var.ptr;
- ALLOC_ZVAL(EX(Ts)[EX(opline)->result.u.var].var.ptr);
- EX(Ts)[EX(opline)->result.u.var].var.ptr->value.obj = Z_OBJ_HT_P(obj)->clone_obj(obj TSRMLS_CC);
- EX(Ts)[EX(opline)->result.u.var].var.ptr->type = IS_OBJECT;
- EX(Ts)[EX(opline)->result.u.var].var.ptr->refcount=1;
- EX(Ts)[EX(opline)->result.u.var].var.ptr->is_ref=1;
- NEXT_OPCODE();
- }
- case ZEND_FETCH_CONSTANT:
- {
- zend_class_entry *ce;
- zval **value;
-
- if (EX(opline)->op1.op_type == IS_UNUSED) {
- if (EG(scope)) {
- ce = EG(scope);
- if (zend_hash_find(&ce->constants_table, EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) {
- zval_update_constant(value, (void *) 1 TSRMLS_CC);
- EX(Ts)[EX(opline)->result.u.var].tmp_var = **value;
- zval_copy_ctor(&EX(Ts)[EX(opline)->result.u.var].tmp_var);
- NEXT_OPCODE();
- }
- }
- if (!zend_get_constant(EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len, &EX(Ts)[EX(opline)->result.u.var].tmp_var TSRMLS_CC)) {
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
- EX(opline)->op2.u.constant.value.str.val,
- EX(opline)->op2.u.constant.value.str.val);
- EX(Ts)[EX(opline)->result.u.var].tmp_var = EX(opline)->op2.u.constant;
- zval_copy_ctor(&EX(Ts)[EX(opline)->result.u.var].tmp_var);
- }
- NEXT_OPCODE();
- }
-
- ce = EX(Ts)[EX(opline)->op1.u.var].EA.class_entry;
-
- if (&ce->constants_table == &EG(main_class_ptr)->constants_table) {
- if (!zend_get_constant(EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len, &EX(Ts)[EX(opline)->result.u.var].tmp_var TSRMLS_CC)) {
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
- EX(opline)->op2.u.constant.value.str.val,
- EX(opline)->op2.u.constant.value.str.val);
- EX(Ts)[EX(opline)->result.u.var].tmp_var = EX(opline)->op2.u.constant;
- zval_copy_ctor(&EX(Ts)[EX(opline)->result.u.var].tmp_var);
- }
- NEXT_OPCODE();
- }
- if (zend_hash_find(&ce->constants_table, EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) {
- zval_update_constant(value, (void *) 1 TSRMLS_CC);
- EX(Ts)[EX(opline)->result.u.var].tmp_var = **value;
- zval_copy_ctor(&EX(Ts)[EX(opline)->result.u.var].tmp_var);
- } else {
- zend_error(E_ERROR, "Undefined class constant '%s'", EX(opline)->op2.u.constant.value.str.val);
- }
- }
- NEXT_OPCODE();
- case ZEND_INIT_ARRAY:
- case ZEND_ADD_ARRAY_ELEMENT: {
- zval *array_ptr = &EX(Ts)[EX(opline)->result.u.var].tmp_var;
- zval *expr_ptr, **expr_ptr_ptr = NULL;
- zval *offset=get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
-
- if (EX(opline)->extended_value) {
- expr_ptr_ptr=get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_R);
- expr_ptr = *expr_ptr_ptr;
- } else {
- expr_ptr=get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- }
-
- if (EX(opline)->opcode==ZEND_INIT_ARRAY) {
- array_init(array_ptr);
- if (!expr_ptr) {
- NEXT_OPCODE();
- }
- }
- if (!EX(opline)->extended_value && EG(free_op1)) { /* temporary variable */
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- *new_expr = *expr_ptr;
- expr_ptr = new_expr;
- INIT_PZVAL(expr_ptr);
- } else {
- if (EX(opline)->extended_value) {
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
- expr_ptr->refcount++;
- } else if (PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- *new_expr = *expr_ptr;
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
- INIT_PZVAL(expr_ptr);
- } else {
- expr_ptr->refcount++;
- }
- }
- if (offset) {
- switch(offset->type) {
- case IS_DOUBLE:
- zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL);
- break;
- case IS_LONG:
- zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL);
- break;
- case IS_STRING:
- zend_hash_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL);
- break;
- case IS_NULL:
- zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
- break;
- default:
- zval_ptr_dtor(&expr_ptr);
- /* do nothing */
- break;
- }
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- } else {
- zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL);
- }
- }
- NEXT_OPCODE();
- case ZEND_CAST: {
- zval *expr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- zval *result = &EX(Ts)[EX(opline)->result.u.var].tmp_var;
-
- *result = *expr;
- if (!EG(free_op1)) {
- zendi_zval_copy_ctor(*result);
- }
- switch (EX(opline)->extended_value) {
- case IS_NULL:
- convert_to_null(result);
- break;
- case IS_BOOL:
- convert_to_boolean(result);
- break;
- case IS_LONG:
- convert_to_long(result);
- break;
- case IS_DOUBLE:
- convert_to_double(result);
- break;
- case IS_STRING:
- convert_to_string(result);
- break;
- case IS_ARRAY:
- convert_to_array(result);
- break;
- case IS_OBJECT:
- convert_to_object(result);
- break;
- }
- }
- NEXT_OPCODE();
- case ZEND_INCLUDE_OR_EVAL: {
- zend_op_array *new_op_array=NULL;
- zval **original_return_value = EG(return_value_ptr_ptr);
- int return_value_used;
- zval *inc_filename = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- zval tmp_inc_filename;
- zend_bool failure_retval=0;
-
- if (inc_filename->type!=IS_STRING) {
- tmp_inc_filename = *inc_filename;
- zval_copy_ctor(&tmp_inc_filename);
- convert_to_string(&tmp_inc_filename);
- inc_filename = &tmp_inc_filename;
- }
-
- return_value_used = RETURN_VALUE_USED(EX(opline));
-
- switch (EX(opline)->op2.u.constant.value.lval) {
- case ZEND_INCLUDE_ONCE:
- case ZEND_REQUIRE_ONCE: {
- char *opened_path=NULL;
- int dummy = 1;
- zend_file_handle file_handle;
-
- file_handle.handle.fp = zend_fopen(inc_filename->value.str.val, &opened_path);
- file_handle.type = ZEND_HANDLE_FP;
- file_handle.filename = inc_filename->value.str.val;
- file_handle.opened_path = opened_path;
- file_handle.free_filename = 0;
-
- if (file_handle.handle.fp) {
- if (!opened_path) {
- opened_path = file_handle.opened_path = estrndup(inc_filename->value.str.val, inc_filename->value.str.len);
- }
-
- if (zend_hash_add(&EG(included_files), opened_path, strlen(opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) {
- new_op_array = zend_compile_file(&file_handle, (EX(opline)->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
- zend_destroy_file_handle(&file_handle TSRMLS_CC);
- opened_path = NULL; /* zend_destroy_file_handle() already frees it */
- } else {
- fclose(file_handle.handle.fp);
- failure_retval=1;
- }
- } else {
- if (EX(opline)->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE) {
- zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle.filename);
- } else {
- zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle.filename);
- }
- }
- if (opened_path) {
- efree(opened_path);
- }
- break;
- }
- break;
- case ZEND_INCLUDE:
- case ZEND_REQUIRE:
- new_op_array = compile_filename(EX(opline)->op2.u.constant.value.lval, inc_filename TSRMLS_CC);
- break;
- case ZEND_EVAL: {
- char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
-
- new_op_array = compile_string(inc_filename, eval_desc TSRMLS_CC);
- efree(eval_desc);
- }
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- if (inc_filename==&tmp_inc_filename) {
- zval_dtor(&tmp_inc_filename);
- }
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr = &EX(Ts)[EX(opline)->result.u.var].var.ptr;
- if (new_op_array) {
- zval *saved_object;
- zend_function *saved_function;
-
-
- EG(return_value_ptr_ptr) = EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr;
- EG(active_op_array) = new_op_array;
- EX(Ts)[EX(opline)->result.u.var].var.ptr = NULL;
-
- saved_object = EX(object);
- saved_function = EX(function_state).function;
-
- EX(function_state).function = (zend_function *) new_op_array;
- EX(object) = NULL;
-
- zend_execute(new_op_array TSRMLS_CC);
-
- EX(function_state).function = saved_function;
- EX(object) = saved_object;
-
- if (!return_value_used) {
- if (EX(Ts)[EX(opline)->result.u.var].var.ptr) {
- zval_ptr_dtor(&EX(Ts)[EX(opline)->result.u.var].var.ptr);
- }
- } else { /* return value is used */
- if (!EX(Ts)[EX(opline)->result.u.var].var.ptr) { /* there was no return statement */
- ALLOC_ZVAL(EX(Ts)[EX(opline)->result.u.var].var.ptr);
- INIT_PZVAL(EX(Ts)[EX(opline)->result.u.var].var.ptr);
- EX(Ts)[EX(opline)->result.u.var].var.ptr->value.lval = 1;
- EX(Ts)[EX(opline)->result.u.var].var.ptr->type = IS_BOOL;
- }
- }
-
- EG(opline_ptr) = &EX(opline);
- EG(active_op_array) = op_array;
- EG(function_state_ptr) = &EX(function_state);
- destroy_op_array(new_op_array);
- efree(new_op_array);
- } else {
- if (return_value_used) {
- ALLOC_ZVAL(EX(Ts)[EX(opline)->result.u.var].var.ptr);
- INIT_ZVAL(*EX(Ts)[EX(opline)->result.u.var].var.ptr);
- EX(Ts)[EX(opline)->result.u.var].var.ptr->value.lval = failure_retval;
- EX(Ts)[EX(opline)->result.u.var].var.ptr->type = IS_BOOL;
- }
- }
- EG(return_value_ptr_ptr) = original_return_value;
- }
- NEXT_OPCODE();
- case ZEND_UNSET_VAR:
- {
- zval tmp, *variable;
- HashTable *target_symbol_table;
-
- variable = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- target_symbol_table = zend_get_target_symbol_table(EX(opline), EX(Ts), BP_VAR_IS TSRMLS_CC);
-
- if (variable->type != IS_STRING) {
- tmp = *variable;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- variable = &tmp;
- }
-
- zend_hash_del(target_symbol_table, variable->value.str.val, variable->value.str.len+1);
-
- if (variable == &tmp) {
- zval_dtor(&tmp);
- }
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- }
- NEXT_OPCODE();
- case ZEND_UNSET_DIM_OBJ: {
- zval **container = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_R);
- zval *offset = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
-
- if (container) {
- HashTable *ht;
-
- if ((*container)->type == IS_ARRAY) {
- ht = (*container)->value.ht;
- } else {
- ht = NULL;
- if ((*container)->type == IS_OBJECT) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC);
- }
- }
- if (ht) {
- switch (offset->type) {
- case IS_DOUBLE:
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- {
- long index;
-
- if (offset->type == IS_DOUBLE) {
- index = (long) offset->value.lval;
- } else {
- index = offset->value.lval;
- }
-
- zend_hash_index_del(ht, index);
- break;
- }
- case IS_STRING:
- zend_hash_del(ht, offset->value.str.val, offset->value.str.len+1);
- break;
- case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
- }
- } else {
- /* overloaded element */
- }
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- }
- NEXT_OPCODE();
- case ZEND_FE_RESET: {
- zval *array_ptr, **array_ptr_ptr;
- HashTable *fe_ht;
-
- if (EX(opline)->extended_value) {
- array_ptr_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_R);
- if (array_ptr_ptr == NULL) {
- MAKE_STD_ZVAL(array_ptr);
- } else {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
- array_ptr = *array_ptr_ptr;
- array_ptr->refcount++;
- }
- } else {
- array_ptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- if (EG(free_op1)) { /* IS_TMP_VAR */
- zval *tmp;
-
- ALLOC_ZVAL(tmp);
- *tmp = *array_ptr;
- INIT_PZVAL(tmp);
- array_ptr = tmp;
- } else {
- array_ptr->refcount++;
- }
- }
- PZVAL_LOCK(array_ptr);
- EX(Ts)[EX(opline)->result.u.var].var.ptr = array_ptr;
- EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr = &EX(Ts)[EX(opline)->result.u.var].var.ptr;
-
- if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
- /* probably redundant */
- zend_hash_internal_pointer_reset(fe_ht);
- } else {
- /* JMP to the end of foreach - TBD */
- }
- }
- NEXT_OPCODE();
- case ZEND_FE_FETCH: {
- zval *array = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- zval *result = &EX(Ts)[EX(opline)->result.u.var].tmp_var;
- zval **value, *key;
- char *str_key;
- ulong int_key;
- HashTable *fe_ht;
-
- PZVAL_LOCK(array);
-
- fe_ht = HASH_OF(array);
- if (!fe_ht) {
- zend_error(E_WARNING, "Invalid argument supplied for foreach()");
- EX(opline) = op_array->opcodes+EX(opline)->op2.u.opline_num;
- continue;
- } else if (zend_hash_get_current_data(fe_ht, (void **) &value)==FAILURE) {
- EX(opline) = op_array->opcodes+EX(opline)->op2.u.opline_num;
- continue;
- }
- array_init(result);
-
-
- (*value)->refcount++;
- zend_hash_index_update(result->value.ht, 0, value, sizeof(zval *), NULL);
-
- ALLOC_ZVAL(key);
- INIT_PZVAL(key);
- switch (zend_hash_get_current_key(fe_ht, &str_key, &int_key, 1)) {
- case HASH_KEY_IS_STRING:
- key->value.str.val = str_key;
- key->value.str.len = strlen(str_key);
- key->type = IS_STRING;
- break;
- case HASH_KEY_IS_LONG:
- key->value.lval = int_key;
- key->type = IS_LONG;
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- zend_hash_index_update(result->value.ht, 1, &key, sizeof(zval *), NULL);
- zend_hash_move_forward(fe_ht);
- }
- NEXT_OPCODE();
- case ZEND_JMP_NO_CTOR: {
- zval *object_zval;
- zend_function *constructor;
-
- if (EX(opline)->op1.op_type == IS_VAR) {
- PZVAL_LOCK(*EX(Ts)[EX(opline)->op1.u.var].var.ptr_ptr);
- }
-
- object_zval = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- constructor = Z_OBJ_HT_P(object_zval)->get_constructor(object_zval TSRMLS_CC);
-
- EX(fbc_constructor) = NULL;
- if (constructor == NULL) {
- EX(opline) = op_array->opcodes + EX(opline)->op2.u.opline_num;
- continue;
- } else {
- EX(fbc_constructor) = constructor;
- }
-
- }
- NEXT_OPCODE();
- case ZEND_ISSET_ISEMPTY_VAR:
- {
- zval tmp, *variable = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- zval **value;
- zend_bool isset = 1;
- HashTable *target_symbol_table;
-
- target_symbol_table = zend_get_target_symbol_table(EX(opline), EX(Ts), BP_VAR_IS TSRMLS_CC);
-
- if (variable->type != IS_STRING) {
- tmp = *variable;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- variable = &tmp;
- }
-
- if (zend_hash_find(target_symbol_table, variable->value.str.val, variable->value.str.len+1, (void **) &value) == FAILURE) {
- isset = 0;
- }
-
- EX(Ts)[EX(opline)->result.u.var].tmp_var.type = IS_BOOL;
-
- switch (EX(opline)->extended_value) {
- case ZEND_ISSET:
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- EX(Ts)[EX(opline)->result.u.var].tmp_var.value.lval = 0;
- } else {
- EX(Ts)[EX(opline)->result.u.var].tmp_var.value.lval = isset;
- }
- break;
- case ZEND_ISEMPTY:
- if (!isset || !zend_is_true(*value)) {
- EX(Ts)[EX(opline)->result.u.var].tmp_var.value.lval = 1;
- } else {
- EX(Ts)[EX(opline)->result.u.var].tmp_var.value.lval = 0;
- }
- break;
- }
-
- if (variable == &tmp) {
- zval_dtor(&tmp);
- }
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- }
- NEXT_OPCODE();
- case ZEND_ISSET_ISEMPTY_DIM_OBJ:
- {
- zval **container = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_R);
- zval *offset = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
- zval **value = NULL;
- int result = 0;
-
- if (container) {
-
- if ((*container)->type == IS_ARRAY) {
- HashTable *ht;
- int isset = 0;
-
- ht = (*container)->value.ht;
-
- switch (offset->type) {
- case IS_DOUBLE:
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- {
- long index;
-
- if (offset->type == IS_DOUBLE) {
- index = (long) offset->value.lval;
- } else {
- index = offset->value.lval;
- }
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- }
- case IS_STRING:
- if (zend_hash_find(ht, offset->value.str.val, offset->value.str.len+1, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
-
- break;
- }
-
- switch (EX(opline)->extended_value) {
- case ZEND_ISSET:
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
- }
- break;
- case ZEND_ISEMPTY:
- if (!isset || !zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
- }
- break;
- }
- } else {
- if ((*container)->type == IS_OBJECT) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (EX(opline)->extended_value == ZEND_ISEMPTY) TSRMLS_CC);
- }
- }
- } else {
- /* string offsets */
- }
-
- EX(Ts)[EX(opline)->result.u.var].tmp_var.type = IS_BOOL;
-
- switch (EX(opline)->extended_value) {
- case ZEND_ISSET:
- EX(Ts)[EX(opline)->result.u.var].tmp_var.value.lval = result;
- break;
- case ZEND_ISEMPTY:
- EX(Ts)[EX(opline)->result.u.var].tmp_var.value.lval = !result;
- break;
- }
-
- FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2));
- }
- NEXT_OPCODE();
- break;
- case ZEND_EXIT:
- if (EX(opline)->op1.op_type != IS_UNUSED) {
- zval *ptr;
-
- ptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- if (Z_TYPE_P(ptr) == IS_LONG) {
- EG(exit_status) = Z_LVAL_P(ptr);
- } else {
- zend_print_variable(ptr);
- }
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- }
- zend_bailout();
- NEXT_OPCODE();
- case ZEND_BEGIN_SILENCE:
- EX(Ts)[EX(opline)->result.u.var].tmp_var.value.lval = EG(error_reporting);
- EX(Ts)[EX(opline)->result.u.var].tmp_var.type = IS_LONG; /* shouldn't be necessary */
- EG(error_reporting) = 0;
- NEXT_OPCODE();
- case ZEND_END_SILENCE:
- EG(error_reporting) = EX(Ts)[EX(opline)->op1.u.var].tmp_var.value.lval;
- NEXT_OPCODE();
- case ZEND_QM_ASSIGN: {
- zval *value = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
-
- EX(Ts)[EX(opline)->result.u.var].tmp_var = *value;
- if (!EG(free_op1)) {
- zval_copy_ctor(&EX(Ts)[EX(opline)->result.u.var].tmp_var);
- }
- }
- NEXT_OPCODE();
- case ZEND_EXT_STMT:
- if (!EG(no_extensions)) {
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, op_array TSRMLS_CC);
- }
- NEXT_OPCODE();
- case ZEND_EXT_FCALL_BEGIN:
- if (!EG(no_extensions)) {
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, op_array TSRMLS_CC);
- }
- NEXT_OPCODE();
- case ZEND_EXT_FCALL_END:
- if (!EG(no_extensions)) {
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, op_array TSRMLS_CC);
- }
- NEXT_OPCODE();
- case ZEND_DECLARE_CLASS:
- do_bind_class(EX(opline), EG(function_table), EG(class_table));
- NEXT_OPCODE()
- break;
- case ZEND_DECLARE_INHERITED_CLASS:
- do_bind_inherited_class(EX(opline), EG(function_table), EG(class_table), EX(Ts)[EX(opline)->extended_value].EA.class_entry);
- NEXT_OPCODE();
- break;
- case ZEND_DECLARE_FUNCTION:
- do_bind_function(EX(opline), EG(function_table), EG(class_table), 0);
- NEXT_OPCODE();
- case ZEND_TICKS:
- if (++EG(ticks_count)>=EX(opline)->op1.u.constant.value.lval) {
- EG(ticks_count)=0;
- if (zend_ticks_function) {
- zend_ticks_function(EX(opline)->op1.u.constant.value.lval);
- }
- }
- NEXT_OPCODE();
- case ZEND_IS_CLASS: {
- zval *expr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
- is_class_function(&EX(Ts)[EX(opline)->result.u.var].tmp_var, expr,
- EX(Ts)[EX(opline)->op2.u.var].EA.class_entry TSRMLS_CC);
- FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
- }
- NEXT_OPCODE();
- case ZEND_EXT_NOP:
- case ZEND_NOP:
- NEXT_OPCODE();
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- }
- zend_error(E_ERROR, "Arrived at end of main loop which shouldn't happen");
-}
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
deleted file mode 100644
index e578842231..0000000000
--- a/Zend/zend_execute.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_EXECUTE_H
-#define ZEND_EXECUTE_H
-
-#include "zend_compile.h"
-#include "zend_hash.h"
-#include "zend_variables.h"
-#include "zend_operators.h"
-
-typedef union _temp_variable {
- zval tmp_var;
- struct {
- zval **ptr_ptr;
- zval *ptr;
- } var;
- struct {
- zval tmp_var; /* a dummy */
-
- union {
- struct {
- zval *str;
- zend_uint offset;
- } str_offset;
- zend_property_reference overloaded_element;
- } data;
-
- unsigned char type;
- zend_class_entry *class_entry;
- } EA;
-} temp_variable;
-
-
-BEGIN_EXTERN_C()
-ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
-
-void init_executor(TSRMLS_D);
-void shutdown_executor(TSRMLS_D);
-ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
-ZEND_API int zend_is_true(zval *op);
-static inline void safe_free_zval_ptr(zval *p)
-{
- TSRMLS_FETCH();
-
- if (p!=EG(uninitialized_zval_ptr)) {
- FREE_ZVAL(p);
- }
-}
-ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
-ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
-
-static inline int i_zend_is_true(zval *op)
-{
- int result;
-
- switch (op->type) {
- case IS_NULL:
- result = 0;
- break;
- case IS_LONG:
- case IS_BOOL:
- case IS_RESOURCE:
- result = (op->value.lval?1:0);
- break;
- case IS_DOUBLE:
- result = (op->value.dval ? 1 : 0);
- break;
- case IS_STRING:
- if (op->value.str.len == 0
- || (op->value.str.len==1 && op->value.str.val[0]=='0')) {
- result = 0;
- } else {
- result = 1;
- }
- break;
- case IS_ARRAY:
- result = (zend_hash_num_elements(op->value.ht)?1:0);
- break;
- case IS_OBJECT:
- /* OBJ-TBI */
- result = 1;
- break;
- default:
- result = 0;
- break;
- }
- return result;
-}
-
-ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC);
-
-/* dedicated Zend executor functions - do not use! */
-static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)
-{
- void **p = EG(argument_stack).top_element-2;
- int delete_count = (ulong) *p;
-
- EG(argument_stack).top -= (delete_count+2);
- while (--delete_count>=0) {
- zval_ptr_dtor((zval **) --p);
- }
- EG(argument_stack).top_element = p;
-}
-
-static inline int zend_ptr_stack_get_arg(int requested_arg, void **data TSRMLS_DC)
-{
- void **p = EG(argument_stack).top_element-2;
- int arg_count = (ulong) *p;
-
- if (requested_arg>arg_count) {
- return FAILURE;
- }
- *data = (p-arg_count+requested_arg-1);
- return SUCCESS;
-}
-
-void execute_new_code(TSRMLS_D);
-
-
-/* services */
-ZEND_API char *get_active_function_name(TSRMLS_D);
-ZEND_API char *zend_get_executed_filename(TSRMLS_D);
-ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
-ZEND_API zend_bool zend_is_executing(TSRMLS_D);
-
-ZEND_API void zend_set_timeout(long seconds);
-ZEND_API void zend_unset_timeout(TSRMLS_D);
-ZEND_API void zend_timeout(int dummy);
-
-#ifdef ZEND_WIN32
-void zend_init_timeout_thread();
-void zend_shutdown_timeout_thread();
-#define WM_REGISTER_ZEND_TIMEOUT (WM_USER+1)
-#define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2)
-#endif
-
-#define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p))
-#define zendi_zval_dtor(p) zval_dtor(&(p))
-
-#define active_opline (*EG(opline_ptr))
-
-void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts TSRMLS_DC);
-
-#define IS_OVERLOADED_OBJECT 1
-#define IS_STRING_OFFSET 2
-
-END_EXTERN_C()
-
-#endif /* ZEND_EXECUTE_H */
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
deleted file mode 100644
index e3903e291b..0000000000
--- a/Zend/zend_execute_API.c
+++ /dev/null
@@ -1,990 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include <stdio.h>
-#include <signal.h>
-
-#include "zend.h"
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_API.h"
-#include "zend_ptr_stack.h"
-#include "zend_constants.h"
-#include "zend_extensions.h"
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-
-ZEND_API void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
-
-#ifdef ZEND_WIN32
-#include <process.h>
-/* true global */
-static WNDCLASS wc;
-static HWND timeout_window;
-static HANDLE timeout_thread_event;
-static DWORD timeout_thread_id;
-static int timeout_thread_initialized=0;
-#endif
-
-
-#if ZEND_DEBUG
-static void (*original_sigsegv_handler)(int);
-static void zend_handle_sigsegv(int dummy)
-{
- fflush(stdout);
- fflush(stderr);
- if (original_sigsegv_handler==zend_handle_sigsegv) {
- signal(SIGSEGV, original_sigsegv_handler);
- } else {
- signal(SIGSEGV, SIG_DFL);
- }
- {
- TSRMLS_FETCH();
-
- fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %s() at %s:%d\n\n",
- active_opline->opcode,
- active_opline-EG(active_op_array)->opcodes,
- get_active_function_name(TSRMLS_C),
- zend_get_executed_filename(TSRMLS_C),
- zend_get_executed_lineno(TSRMLS_C));
- }
- if (original_sigsegv_handler!=zend_handle_sigsegv) {
- original_sigsegv_handler(dummy);
- }
-}
-#endif
-
-
-static void zend_extension_activator(zend_extension *extension TSRMLS_DC)
-{
- if (extension->activate) {
- extension->activate();
- }
-}
-
-
-static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC)
-{
- if (extension->deactivate) {
- extension->deactivate();
- }
-}
-
-
-static int is_not_internal_function(zend_function *function TSRMLS_DC)
-{
- if (function->type == ZEND_INTERNAL_FUNCTION) {
- return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
- } else {
- return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
- }
-}
-
-
-static int is_not_internal_class(zend_class_entry **ce TSRMLS_DC)
-{
- if ((*ce)->type == ZEND_INTERNAL_CLASS) {
- return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
- } else {
- return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
- }
-}
-
-
-void init_executor(TSRMLS_D)
-{
- INIT_ZVAL(EG(uninitialized_zval));
-/* trick to make uninitialized_zval never be modified, passed by ref, etc. */
- EG(uninitialized_zval).refcount++;
- INIT_ZVAL(EG(error_zval));
- EG(uninitialized_zval_ptr)=&EG(uninitialized_zval);
- EG(error_zval_ptr)=&EG(error_zval);
- zend_ptr_stack_init(&EG(arg_types_stack));
-/* destroys stack frame, therefore makes core dumps worthless */
-#if 0&&ZEND_DEBUG
- original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv);
-#endif
- EG(return_value_ptr_ptr) = NULL;
-
- EG(symtable_cache_ptr) = EG(symtable_cache)-1;
- EG(symtable_cache_limit)=EG(symtable_cache)+SYMTABLE_CACHE_SIZE-1;
- EG(no_extensions)=0;
-
- EG(function_table) = CG(function_table);
- EG(class_table) = CG(class_table);
-
- EG(in_execution) = 0;
-
- zend_ptr_stack_init(&EG(argument_stack));
-
- zend_hash_init(&EG(symbol_table), 50, NULL, ZVAL_PTR_DTOR, 0);
- {
- zval *globals;
-
- ALLOC_ZVAL(globals);
- globals->refcount=1;
- globals->is_ref=1;
- globals->type = IS_ARRAY;
- globals->value.ht = &EG(symbol_table);
- zend_hash_update(&EG(symbol_table), "GLOBALS", sizeof("GLOBALS"), &globals, sizeof(zval *), NULL);
- }
- EG(active_symbol_table) = &EG(symbol_table);
-
- zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator TSRMLS_CC);
- EG(opline_ptr) = NULL;
- EG(garbage_ptr) = 0;
-
- zend_hash_init(&EG(included_files), 5, NULL, NULL, 0);
-
- EG(ticks_count) = 0;
-
- EG(user_error_handler) = NULL;
-
- zend_ptr_stack_init(&EG(user_error_handlers));
- zend_ptr_stack_init(&EG(user_exception_handlers));
-
- EG(orig_error_reporting) = EG(error_reporting);
- zend_objects_store_init(&EG(objects_store), 1024);
-
- EG(full_tables_cleanup) = 0;
-#ifdef ZEND_WIN32
- EG(timed_out) = 0;
-#endif
-
- EG(exception) = NULL;
-
- EG(scope) = NULL;
-
- EG(main_class_ptr) = &CG(main_class);
- CG(main_class).static_members = &EG(symbol_table);
-
- EG(current_execute_data) = NULL;
-
- EG(This) = NULL;
-}
-
-
-void shutdown_executor(TSRMLS_D)
-{
- zend_try {
- zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC);
-
- zend_ptr_stack_destroy(&EG(arg_types_stack));
-
- while (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
- zend_hash_destroy(*EG(symtable_cache_ptr));
- efree(*EG(symtable_cache_ptr));
- EG(symtable_cache_ptr)--;
- }
- zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_deactivator TSRMLS_CC);
-
- zend_hash_destroy(&EG(symbol_table));
-
- while (EG(garbage_ptr)--) {
- if (EG(garbage)[EG(garbage_ptr)]->refcount==1) {
- zval_ptr_dtor(&EG(garbage)[EG(garbage_ptr)]);
- }
- }
-
- zend_ptr_stack_destroy(&EG(argument_stack));
-
- /* Destroy all op arrays */
- if (EG(full_tables_cleanup)) {
- zend_hash_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC);
- zend_hash_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC);
- } else {
- zend_hash_reverse_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC);
- zend_hash_reverse_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC);
- }
- } zend_end_try();
-
- zend_try {
- clean_non_persistent_constants(TSRMLS_C);
- } zend_end_try();
-
- /* The regular list must be destroyed after the main symbol table,
- * op arrays, and constants are destroyed.
- */
- zend_destroy_rsrc_list(&EG(regular_list) TSRMLS_CC);
-
- zend_try {
-#if ZEND_DEBUG
- signal(SIGSEGV, original_sigsegv_handler);
-#endif
-
- zend_hash_destroy(&EG(included_files));
-
- if (EG(user_error_handler)) {
- zval_dtor(EG(user_error_handler));
- FREE_ZVAL(EG(user_error_handler));
- }
-
- if (EG(user_exception_handler)) {
- zval_dtor(EG(user_exception_handler));
- FREE_ZVAL(EG(user_exception_handler));
- }
-
- zend_ptr_stack_clean(&EG(user_error_handlers), ZVAL_DESTRUCTOR, 1);
- zend_ptr_stack_destroy(&EG(user_error_handlers));
-
- zend_ptr_stack_clean(&EG(user_exception_handlers), ZVAL_DESTRUCTOR, 1);
- zend_ptr_stack_destroy(&EG(user_exception_handlers));
-
- EG(error_reporting) = EG(orig_error_reporting);
- zend_objects_store_destroy(&EG(objects_store));
- } zend_end_try();
-}
-
-
-ZEND_API char *get_active_function_name(TSRMLS_D)
-{
- if (!zend_is_executing(TSRMLS_C)) {
- return NULL;
- }
- switch(EG(function_state_ptr)->function->type) {
- case ZEND_USER_FUNCTION: {
- char *function_name = ((zend_op_array *) EG(function_state_ptr)->function)->function_name;
-
- if (function_name) {
- return function_name;
- } else {
- return "main";
- }
- }
- break;
- case ZEND_INTERNAL_FUNCTION:
- return ((zend_internal_function *) EG(function_state_ptr)->function)->function_name;
- break;
- default:
- return NULL;
- }
-}
-
-
-ZEND_API char *zend_get_executed_filename(TSRMLS_D)
-{
- if (EG(active_op_array)) {
- return EG(active_op_array)->filename;
- } else {
- return "[no active file]";
- }
-}
-
-
-ZEND_API uint zend_get_executed_lineno(TSRMLS_D)
-{
- if (EG(opline_ptr)) {
- return active_opline->lineno;
- } else {
- return 0;
- }
-}
-
-
-ZEND_API zend_bool zend_is_executing(TSRMLS_D)
-{
- return EG(in_execution);
-}
-
-
-ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC)
-{
-#if DEBUG_ZEND>=2
- printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, (*zval_ptr)->refcount, (*zval_ptr)->refcount-1);
-#endif
- (*zval_ptr)->refcount--;
- if ((*zval_ptr)->refcount==0) {
- zval_dtor(*zval_ptr);
- safe_free_zval_ptr(*zval_ptr);
- } else if ((*zval_ptr)->refcount == 1) {
- (*zval_ptr)->is_ref = 0;
- }
-}
-
-
-ZEND_API int zend_is_true(zval *op)
-{
- return i_zend_is_true(op);
-}
-
-#include "../TSRM/tsrm_strtok_r.h"
-
-ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
-{
- zval *p = *pp;
- zend_bool inline_change = (zend_bool) (unsigned long) arg;
- zval const_value;
-
- if (p->type == IS_CONSTANT) {
- int refcount;
-
- SEPARATE_ZVAL(pp);
- p = *pp;
-
- refcount = p->refcount;
-
- if (strchr(p->value.str.val, ':')) {
- char *cur, *temp;
- char *last;
- zend_class_entry **ce;
- zval **value;
-
- last = tsrm_strtok_r(p->value.str.val, ":", &temp);
-
- if (zend_lookup_class(last, strlen(last), &ce TSRMLS_CC) == FAILURE) {
- zend_error(E_ERROR, "Undefined class '%s'", last);
- }
-
- last = tsrm_strtok_r(NULL, ":", &temp);
-
- for(;;) {
- cur = tsrm_strtok_r(NULL, ":", &temp);
- if (!cur) {
- break;
- }
- if (zend_hash_find(&(*ce)->class_table, last, strlen(last)+1, (void **)&ce) == FAILURE) {
- zend_error(E_ERROR, "Undefined sub-class '%s'", last);
- }
- last = cur;
- }
- if (zend_hash_find(&(*ce)->constants_table, last, strlen(last)+1, (void **) &value) == FAILURE) {
- zend_error(E_ERROR, "Undefined class constant '%s'", last);
- }
- const_value = **value;
- zval_copy_ctor(&const_value);
- if (inline_change) {
- STR_FREE(p->value.str.val);
- }
- *p = const_value;
- } else {
- if (!zend_get_constant(p->value.str.val, p->value.str.len, &const_value TSRMLS_CC)) {
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
- p->value.str.val,
- p->value.str.val);
- p->type = IS_STRING;
- if (!inline_change) {
- zval_copy_ctor(p);
- }
- } else {
- if (inline_change) {
- STR_FREE(p->value.str.val);
- }
- *p = const_value;
- }
- }
- INIT_PZVAL(p);
- p->refcount = refcount;
- } else if (p->type == IS_CONSTANT_ARRAY) {
- zval **element;
- char *str_index;
- uint str_index_len;
- ulong num_index;
-
- SEPARATE_ZVAL(pp);
- p = *pp;
- p->type = IS_ARRAY;
-
- /* First go over the array and see if there are any constant indices */
- zend_hash_internal_pointer_reset(p->value.ht);
- while (zend_hash_get_current_data(p->value.ht, (void **) &element)==SUCCESS) {
- if (!(Z_TYPE_PP(element) & IS_CONSTANT_INDEX)) {
- zend_hash_move_forward(p->value.ht);
- continue;
- }
- Z_TYPE_PP(element) &= ~IS_CONSTANT_INDEX;
- if (zend_hash_get_current_key_ex(p->value.ht, &str_index, &str_index_len, &num_index, 0, NULL)!=HASH_KEY_IS_STRING) {
- zend_hash_move_forward(p->value.ht);
- continue;
- }
- if (!zend_get_constant(str_index, str_index_len-1, &const_value TSRMLS_CC)) {
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", str_index, str_index);
- zend_hash_move_forward(p->value.ht);
- continue;
- }
-
- if (const_value.type == IS_STRING && const_value.value.str.len == str_index_len-1 &&
- !strncmp(const_value.value.str.val, str_index, str_index_len)) {
- /* constant value is the same as its name */
- zval_dtor(&const_value);
- zend_hash_move_forward(p->value.ht);
- continue;
- }
-
- switch (const_value.type) {
- case IS_STRING:
- zend_hash_update(p->value.ht, const_value.value.str.val, const_value.value.str.len+1, element, sizeof(zval *), NULL);
- (*element)->refcount++;
- break;
- case IS_LONG:
- zend_hash_index_update(p->value.ht, const_value.value.lval, element, sizeof(zval *), NULL);
- (*element)->refcount++;
- break;
- }
- zend_hash_del(p->value.ht, str_index, str_index_len);
- zval_dtor(&const_value);
- }
- zend_hash_apply_with_argument(p->value.ht, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
- }
- return 0;
-}
-
-
-int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC)
-{
- zval ***params_array = (zval ***) emalloc(sizeof(zval **)*param_count);
- int i;
- int ex_retval;
- zval *local_retval_ptr;
-
- for (i=0; i<param_count; i++) {
- params_array[i] = &params[i];
- }
- ex_retval = call_user_function_ex(function_table, object_pp, function_name, &local_retval_ptr, param_count, params_array, 1, NULL TSRMLS_CC);
- if (local_retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*retval_ptr, local_retval_ptr);
- } else {
- INIT_ZVAL(*retval_ptr);
- }
- efree(params_array);
- return ex_retval;
-}
-
-
-int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC)
-{
- int i;
- zval **original_return_value;
- HashTable *calling_symbol_table;
- zend_function_state *original_function_state_ptr;
- zend_op_array *original_op_array;
- zend_op **original_opline_ptr;
- int orig_free_op1, orig_free_op2;
- int (*orig_unary_op)(zval *result, zval *op1);
- int (*orig_binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
- zval function_name_copy;
- zend_class_entry *current_scope;
- zend_class_entry *calling_scope = NULL;
- zval *current_this;
-
- zend_execute_data execute_data;
-
- /* Initialize execute_data */
- EX(fbc) = NULL;
- EX(object) = NULL;
- EX(Ts) = NULL;
- EX(op_array) = NULL;
- EX(opline) = NULL;
- *retval_ptr_ptr = NULL;
-
- if (function_name->type==IS_ARRAY) { /* assume array($obj, $name) couple */
- zval **tmp_object_ptr, **tmp_real_function_name;
-
- if (zend_hash_index_find(function_name->value.ht, 0, (void **) &tmp_object_ptr)==FAILURE) {
- return FAILURE;
- }
- if (zend_hash_index_find(function_name->value.ht, 1, (void **) &tmp_real_function_name)==FAILURE) {
- return FAILURE;
- }
- function_name = *tmp_real_function_name;
- SEPARATE_ZVAL_IF_NOT_REF(tmp_object_ptr);
- object_pp = tmp_object_ptr;
- (*object_pp)->is_ref = 1;
- }
-
- if (object_pp && !*object_pp) {
- object_pp = NULL;
- }
-
- if (object_pp) {
- /* TBI!! new object handlers */
- if (Z_TYPE_PP(object_pp) == IS_OBJECT) {
- if (!IS_ZEND_STD_OBJECT(**object_pp)) {
- zend_error(E_WARNING, "Cannot use call_user_function on overloaded objects");
- return FAILURE;
- }
-
- function_table = &Z_OBJCE_PP(object_pp)->function_table;
- EX(object) = *object_pp;
- calling_scope = Z_OBJCE_PP(object_pp);
- } else if (Z_TYPE_PP(object_pp) == IS_STRING) {
- zend_class_entry **ce;
- char *lc_class;
- int found;
-
- lc_class = estrndup(Z_STRVAL_PP(object_pp), Z_STRLEN_PP(object_pp));
- zend_str_tolower(lc_class, Z_STRLEN_PP(object_pp));
- found = zend_lookup_class(lc_class, Z_STRLEN_PP(object_pp), &ce TSRMLS_CC);
- efree(lc_class);
- if (found == FAILURE)
- return FAILURE;
-
- function_table = &(*ce)->function_table;
- calling_scope = *ce;
- object_pp = NULL;
- } else
- return FAILURE;
- }
-
- if (function_name->type!=IS_STRING) {
- return FAILURE;
- }
-
- function_name_copy = *function_name;
- zval_copy_ctor(&function_name_copy);
- zend_str_tolower(function_name_copy.value.str.val, function_name_copy.value.str.len);
-
- original_function_state_ptr = EG(function_state_ptr);
- if (zend_hash_find(function_table, function_name_copy.value.str.val, function_name_copy.value.str.len+1, (void **) &EX(function_state).function)==FAILURE) {
- zval_dtor(&function_name_copy);
- return FAILURE;
- }
- zval_dtor(&function_name_copy);
-
- for (i=0; i<param_count; i++) {
- zval *param;
-
- if (EX(function_state).function->common.arg_types
- && i<EX(function_state).function->common.arg_types[0]
- && EX(function_state).function->common.arg_types[i+1]==BYREF_FORCE
- && !PZVAL_IS_REF(*params[i])) {
- if ((*params[i])->refcount>1) {
- zval *new_zval;
-
- if (no_separation) {
- return FAILURE;
- }
- ALLOC_ZVAL(new_zval);
- *new_zval = **params[i];
- zval_copy_ctor(new_zval);
- new_zval->refcount = 1;
- (*params[i])->refcount--;
- *params[i] = new_zval;
- }
- (*params[i])->refcount++;
- (*params[i])->is_ref = 1;
- param = *params[i];
- } else if (*params[i] != &EG(uninitialized_zval)) {
- (*params[i])->refcount++;
- param = *params[i];
- } else {
- ALLOC_ZVAL(param);
- *param = **(params[i]);
- INIT_PZVAL(param);
- }
- zend_ptr_stack_push(&EG(argument_stack), param);
- }
-
- zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (long) param_count, NULL);
-
- EG(function_state_ptr) = &EX(function_state);
-
- current_scope = EG(scope);
- EG(scope) = calling_scope;
-
- current_this = EG(This);
-
- if (object_pp) {
- EG(This) = *object_pp;
-
- if (!PZVAL_IS_REF(EG(This))) {
- EG(This)->refcount++; /* For $this pointer */
- } else {
- zval *this_ptr;
-
- ALLOC_ZVAL(this_ptr);
- *this_ptr = *EG(This);
- INIT_PZVAL(this_ptr);
- zval_copy_ctor(this_ptr);
- EG(This) = this_ptr;
- }
- } else {
- EG(This) = NULL;
- }
-
- EX(prev_execute_data) = EG(current_execute_data);
- EG(current_execute_data) = &execute_data;
-
- if (EX(function_state).function->type == ZEND_USER_FUNCTION) {
- calling_symbol_table = EG(active_symbol_table);
- if (symbol_table) {
- EG(active_symbol_table) = symbol_table;
- } else {
- ALLOC_HASHTABLE(EG(active_symbol_table));
- zend_hash_init(EG(active_symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0);
- }
-
- original_return_value = EG(return_value_ptr_ptr);
- original_op_array = EG(active_op_array);
- EG(return_value_ptr_ptr) = retval_ptr_ptr;
- EG(active_op_array) = (zend_op_array *) EX(function_state).function;
- original_opline_ptr = EG(opline_ptr);
- orig_free_op1 = EG(free_op1);
- orig_free_op2 = EG(free_op2);
- orig_unary_op = EG(unary_op);
- orig_binary_op = EG(binary_op);
- zend_execute(EG(active_op_array) TSRMLS_CC);
- if (!symbol_table) {
- zend_hash_destroy(EG(active_symbol_table));
- FREE_HASHTABLE(EG(active_symbol_table));
- }
- EG(active_symbol_table) = calling_symbol_table;
- EG(active_op_array) = original_op_array;
- EG(return_value_ptr_ptr)=original_return_value;
- EG(opline_ptr) = original_opline_ptr;
- EG(free_op1) = orig_free_op1;
- EG(free_op2) = orig_free_op2;
- EG(unary_op) = orig_unary_op;
- EG(binary_op) = orig_binary_op;
- } else {
- ALLOC_INIT_ZVAL(*retval_ptr_ptr);
- ((zend_internal_function *) EX(function_state).function)->handler(param_count, *retval_ptr_ptr, (object_pp?*object_pp:NULL), 1 TSRMLS_CC);
- INIT_PZVAL(*retval_ptr_ptr);
- }
- zend_ptr_stack_clear_multiple(TSRMLS_C);
- EG(function_state_ptr) = original_function_state_ptr;
-
- if (EG(This)) {
- zval_ptr_dtor(&EG(This));
- }
- EG(scope) = current_scope;
- EG(This) = current_this;
- EG(current_execute_data) = EX(prev_execute_data); \
-
- return SUCCESS;
-}
-
-ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
-{
- zval **args[1];
- zval *autoload_function;
- zval *class_name;
- zval *retval_ptr;
- int retval;
-
- if (EG(scope)) {
- if (zend_hash_find(&EG(scope)->class_table, name, name_length+1, (void **) ce) == SUCCESS) {
- return SUCCESS;
- }
- }
- if (zend_hash_find(EG(class_table), name, name_length+1, (void **) ce) == SUCCESS) {
- return SUCCESS;
- }
-
- MAKE_STD_ZVAL(autoload_function);
- ZVAL_STRINGL(autoload_function, "__autoload", sizeof("__autoload")-1, 1);
-
- MAKE_STD_ZVAL(class_name);
- ZVAL_STRINGL(class_name, name, name_length, 1);
- args[0] = &class_name;
-
- retval = call_user_function_ex(EG(function_table), NULL, autoload_function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC);
-
- zval_ptr_dtor(&autoload_function);
- zval_ptr_dtor(&class_name);
-
- if (retval == FAILURE) {
- return FAILURE;
- }
-
- if (EG(exception)) {
- zend_error(E_ERROR, "__autoload threw an exception");
- }
-
- /* If an exception is thrown retval_ptr will be NULL but we bailout before we reach this point */
- zval_ptr_dtor(&retval_ptr);
-
- return zend_hash_find(EG(class_table), name, name_length + 1, (void **) ce);
-}
-
-ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC)
-{
- zval pv;
- zend_op_array *new_op_array;
- zend_op_array *original_active_op_array = EG(active_op_array);
- zend_function_state *original_function_state_ptr = EG(function_state_ptr);
- zend_uchar original_handle_op_arrays;
- int retval;
-
- if (retval_ptr) {
- pv.value.str.len = strlen(str)+sizeof("return ;")-1;
- pv.value.str.val = emalloc(pv.value.str.len+1);
- strcpy(pv.value.str.val, "return ");
- strcat(pv.value.str.val, str);
- strcat(pv.value.str.val, " ;");
- } else {
- pv.value.str.len = strlen(str);
- pv.value.str.val = estrndup(str, pv.value.str.len);
- }
- pv.type = IS_STRING;
-
- /*printf("Evaluating '%s'\n", pv.value.str.val);*/
-
- original_handle_op_arrays = CG(handle_op_arrays);
- CG(handle_op_arrays) = 0;
- new_op_array = compile_string(&pv, string_name TSRMLS_CC);
- CG(handle_op_arrays) = original_handle_op_arrays;
-
- if (new_op_array) {
- zval *local_retval_ptr=NULL;
- zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr);
- zend_op **original_opline_ptr = EG(opline_ptr);
-
- EG(return_value_ptr_ptr) = &local_retval_ptr;
- EG(active_op_array) = new_op_array;
- EG(no_extensions)=1;
-
- zend_execute(new_op_array TSRMLS_CC);
-
- if (local_retval_ptr) {
- if (retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*retval_ptr, local_retval_ptr);
- } else {
- zval_ptr_dtor(&local_retval_ptr);
- }
- } else {
- if (retval_ptr) {
- INIT_ZVAL(*retval_ptr);
- }
- }
-
- EG(no_extensions)=0;
- EG(opline_ptr) = original_opline_ptr;
- EG(active_op_array) = original_active_op_array;
- EG(function_state_ptr) = original_function_state_ptr;
- destroy_op_array(new_op_array);
- efree(new_op_array);
- EG(return_value_ptr_ptr) = original_return_value_ptr_ptr;
- retval = SUCCESS;
- } else {
- retval = FAILURE;
- }
- zval_dtor(&pv);
- return retval;
-}
-
-
-void execute_new_code(TSRMLS_D)
-{
- zend_op *opline, *end;
- zend_op *ret_opline;
- zval *local_retval=NULL;
-
- if (!CG(interactive)
- || CG(active_op_array)->backpatch_count>0
- || CG(active_op_array)->function_name
- || CG(active_op_array)->type!=ZEND_USER_FUNCTION) {
- return;
- }
-
- ret_opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- ret_opline->opcode = ZEND_RETURN;
- ret_opline->op1.op_type = IS_CONST;
- INIT_ZVAL(ret_opline->op1.u.constant);
- SET_UNUSED(ret_opline->op2);
-
- if (!CG(active_op_array)->start_op) {
- CG(active_op_array)->start_op = CG(active_op_array)->opcodes;
- }
-
- opline=CG(active_op_array)->start_op;
- end=CG(active_op_array)->opcodes+CG(active_op_array)->last;
-
- while (opline<end) {
- if (opline->op1.op_type==IS_CONST) {
- opline->op1.u.constant.is_ref = 1;
- opline->op1.u.constant.refcount = 2; /* Make sure is_ref won't be reset */
- }
- if (opline->op2.op_type==IS_CONST) {
- opline->op2.u.constant.is_ref = 1;
- opline->op2.u.constant.refcount = 2;
- }
- opline++;
- }
-
- EG(return_value_ptr_ptr) = &local_retval;
- EG(active_op_array) = CG(active_op_array);
- zend_execute(CG(active_op_array) TSRMLS_CC);
- if (local_retval) {
- zval_ptr_dtor(&local_retval);
- }
-
- CG(active_op_array)->last--; /* get rid of that ZEND_RETURN */
- CG(active_op_array)->start_op = CG(active_op_array)->opcodes+CG(active_op_array)->last;
-}
-
-
-ZEND_API void zend_timeout(int dummy)
-{
- TSRMLS_FETCH();
-
- zend_error(E_ERROR, "Maximum execution time of %d second%s exceeded",
- EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s");
- if (zend_on_timeout) {
- zend_on_timeout(EG(timeout_seconds) TSRMLS_CC);
- }
-}
-
-
-#ifdef ZEND_WIN32
-static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch (message) {
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
- case WM_REGISTER_ZEND_TIMEOUT:
- /* wParam is the thread id pointer, lParam is the timeout amount in seconds */
- if (lParam==0) {
- KillTimer(timeout_window, wParam);
- } else {
- SetTimer(timeout_window, wParam, lParam*1000, NULL);
- }
- break;
- case WM_UNREGISTER_ZEND_TIMEOUT:
- /* wParam is the thread id pointer */
- KillTimer(timeout_window, wParam);
- break;
- case WM_TIMER: {
-#ifdef ZTS
- void ***tsrm_ls;
-
- tsrm_ls = ts_resource_ex(0, &wParam);
- if (!tsrm_ls) {
- /* Thread died before receiving its timeout? */
- break;
- }
-#endif
- KillTimer(timeout_window, wParam);
- EG(timed_out) = 1;
- }
- break;
- default:
- return DefWindowProc(hWnd, message, wParam, lParam);
- }
- return 0;
-}
-
-
-
-static unsigned __stdcall timeout_thread_proc(void *pArgs)
-{
- MSG message;
-
- wc.style=0;
- wc.lpfnWndProc = zend_timeout_WndProc;
- wc.cbClsExtra=0;
- wc.cbWndExtra=0;
- wc.hInstance=NULL;
- wc.hIcon=NULL;
- wc.hCursor=NULL;
- wc.hbrBackground=(HBRUSH)(COLOR_BACKGROUND + 5);
- wc.lpszMenuName=NULL;
- wc.lpszClassName = "Zend Timeout Window";
- if (!RegisterClass(&wc)) {
- return -1;
- }
- timeout_window = CreateWindow(wc.lpszClassName, wc.lpszClassName, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL);
- SetEvent(timeout_thread_event);
- while (GetMessage(&message, NULL, 0, 0)) {
- SendMessage(timeout_window, message.message, message.wParam, message.lParam);
- if (message.message == WM_QUIT) {
- break;
- }
- }
- DestroyWindow(timeout_window);
- UnregisterClass(wc.lpszClassName, NULL);
- return 0;
-}
-
-
-void zend_init_timeout_thread()
-{
- timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL);
- _beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0, &timeout_thread_id);
- WaitForSingleObject(timeout_thread_event, INFINITE);
-}
-
-
-void zend_shutdown_timeout_thread()
-{
- if (!timeout_thread_initialized) {
- return;
- }
- PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0);
-}
-
-#endif
-
-/* This one doesn't exists on QNX */
-#ifndef SIGPROF
-#define SIGPROF 27
-#endif
-
-void zend_set_timeout(long seconds)
-{
- TSRMLS_FETCH();
-
- EG(timeout_seconds) = seconds;
-#ifdef ZEND_WIN32
- if (timeout_thread_initialized==0 && InterlockedIncrement(&timeout_thread_initialized)==1) {
- /* We start up this process-wide thread here and not in zend_startup(), because if Zend
- * is initialized inside a DllMain(), you're not supposed to start threads from it.
- */
- zend_init_timeout_thread();
- }
- PostThreadMessage(timeout_thread_id, WM_REGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) seconds);
-#else
-# ifdef HAVE_SETITIMER
- {
- struct itimerval t_r; /* timeout requested */
- sigset_t sigset;
-
- t_r.it_value.tv_sec = seconds;
- t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0;
-
- setitimer(ITIMER_PROF, &t_r, NULL);
- signal(SIGPROF, zend_timeout);
- sigemptyset(&sigset);
- sigaddset(&sigset, SIGPROF);
- sigprocmask(SIG_UNBLOCK, &sigset, NULL);
- }
-# endif
-#endif
-}
-
-
-void zend_unset_timeout(TSRMLS_D)
-{
-#ifdef ZEND_WIN32
- PostThreadMessage(timeout_thread_id, WM_UNREGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) 0);
-#else
-# ifdef HAVE_SETITIMER
- {
- struct itimerval no_timeout;
-
- no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0;
-
- setitimer(ITIMER_PROF, &no_timeout, NULL);
- }
-# endif
-#endif
-}
diff --git a/Zend/zend_execute_locks.h b/Zend/zend_execute_locks.h
deleted file mode 100644
index 88381268a2..0000000000
--- a/Zend/zend_execute_locks.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef ZEND_EXECUTE_LOCKS_H
-#define ZEND_EXECUTE_LOCKS_H
-
-#define PZVAL_LOCK(z) zend_pzval_lock_func(z)
-
-static inline void zend_pzval_lock_func(zval *z)
-{
- z->refcount++;
-}
-
-#define PZVAL_UNLOCK(z) zend_pzval_unlock_func(z TSRMLS_CC)
-
-static inline void zend_pzval_unlock_func(zval *z TSRMLS_DC)
-{
- z->refcount--;
- if (!z->refcount) {
- z->refcount = 1;
- z->is_ref = 0;
- EG(garbage)[EG(garbage_ptr)++] = z;
- }
-}
-
-static inline void zend_clean_garbage(TSRMLS_D)
-{
- while (EG(garbage_ptr)) {
- zval_ptr_dtor(&EG(garbage)[--EG(garbage_ptr)]);
- }
-}
-
-#define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
-
-#endif /* ZEND_EXECUTE_LOCKS_H */
diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c
deleted file mode 100644
index 8104a583d8..0000000000
--- a/Zend/zend_extensions.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "zend_extensions.h"
-
-ZEND_API zend_llist zend_extensions;
-static int last_resource_number;
-
-int zend_load_extension(char *path)
-{
-#if ZEND_EXTENSIONS_SUPPORT
- DL_HANDLE handle;
- zend_extension *new_extension;
- zend_extension_version_info *extension_version_info;
-
- handle = DL_LOAD(path);
- if (!handle) {
-#ifndef ZEND_WIN32
- fprintf(stderr, "Failed loading %s: %s\n", path, DL_ERROR());
-#else
- fprintf(stderr, "Failed loading %s\n", path);
-#endif
- return FAILURE;
- }
-
- extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "extension_version_info");
- new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, "zend_extension_entry");
- if (!extension_version_info || !new_extension) {
- fprintf(stderr, "%s doesn't appear to be a valid Zend extension\n", path);
- return FAILURE;
- }
-
-
- /* allow extension to proclaim compatibility with any Zend version */
- if (extension_version_info->zend_extension_api_no != ZEND_EXTENSION_API_NO &&(!new_extension->api_no_check || new_extension->api_no_check(ZEND_EXTENSION_API_NO) != SUCCESS)) {
- if (extension_version_info->zend_extension_api_no > ZEND_EXTENSION_API_NO) {
- fprintf(stderr, "%s requires Zend Engine API version %d.\n"
- "The Zend Engine API version %d which is installed, is outdated.\n\n",
- new_extension->name,
- extension_version_info->zend_extension_api_no,
- ZEND_EXTENSION_API_NO);
- DL_UNLOAD(handle);
- return FAILURE;
- } else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) {
- fprintf(stderr, "%s requires Zend Engine API version %d.\n"
- "The Zend Engine API version %d which is installed, is newer.\n"
- "Contact %s at %s for a later version of %s.\n\n",
- new_extension->name,
- extension_version_info->zend_extension_api_no,
- ZEND_EXTENSION_API_NO,
- new_extension->author,
- new_extension->URL,
- new_extension->name);
- DL_UNLOAD(handle);
- return FAILURE;
- }
- } else if (ZTS_V!=extension_version_info->thread_safe) {
- fprintf(stderr, "Cannot load %s - it %s thread safe, whereas Zend %s\n",
- new_extension->name,
- (extension_version_info->thread_safe?"is":"isn't"),
- (ZTS_V?"is":"isn't"));
- DL_UNLOAD(handle);
- return FAILURE;
- } else if (ZEND_DEBUG!=extension_version_info->debug) {
- fprintf(stderr, "Cannot load %s - it %s debug information, whereas Zend %s\n",
- new_extension->name,
- (extension_version_info->debug?"contains":"does not contain"),
- (ZEND_DEBUG?"does":"does not"));
- DL_UNLOAD(handle);
- return FAILURE;
- }
-
- return zend_register_extension(new_extension, handle);
-#else
- fprintf(stderr, "Extensions are not supported on this platform.\n");
- return FAILURE;
-#endif
-}
-
-
-int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle)
-{
-#if ZEND_EXTENSIONS_SUPPORT
- zend_extension extension;
-
- extension = *new_extension;
- extension.handle = handle;
-
- zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension);
-
- zend_llist_add_element(&zend_extensions, &extension);
-
- /*fprintf(stderr, "Loaded %s, version %s\n", extension.name, extension.version);*/
-#endif
-
- return SUCCESS;
-}
-
-
-static void zend_extension_shutdown(zend_extension *extension TSRMLS_DC)
-{
-#if ZEND_EXTENSIONS_SUPPORT
- if (extension->shutdown) {
- extension->shutdown(extension);
- }
-#endif
-}
-
-static int zend_extension_startup(zend_extension *extension)
-{
-#if ZEND_EXTENSIONS_SUPPORT
- if (extension->startup) {
- if (extension->startup(extension)!=SUCCESS) {
- return 1;
- }
- zend_append_version_info(extension);
- }
-#endif
- return 0;
-}
-
-
-int zend_startup_extensions_mechanism()
-{
- /* Startup extensions mechanism */
- zend_llist_init(&zend_extensions, sizeof(zend_extension), (void (*)(void *)) zend_extension_dtor, 1);
- last_resource_number = 0;
- return SUCCESS;
-}
-
-
-int zend_startup_extensions()
-{
- zend_llist_apply_with_del(&zend_extensions, (int (*)(void *)) zend_extension_startup);
- return SUCCESS;
-}
-
-
-void zend_shutdown_extensions(TSRMLS_D)
-{
- zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_shutdown TSRMLS_CC);
- zend_llist_destroy(&zend_extensions);
-}
-
-
-void zend_extension_dtor(zend_extension *extension)
-{
-#if ZEND_EXTENSIONS_SUPPORT && !ZEND_DEBUG
- if (extension->handle) {
- DL_UNLOAD(extension->handle);
- }
-#endif
-}
-
-
-static void zend_extension_message_dispatcher(zend_extension *extension, int num_args, va_list args TSRMLS_DC)
-{
- int message;
- void *arg;
-
- if (!extension->message_handler || num_args!=2) {
- return;
- }
- message = va_arg(args, int);
- arg = va_arg(args, void *);
- extension->message_handler(message, arg);
-}
-
-
-ZEND_API void zend_extension_dispatch_message(int message, void *arg)
-{
- TSRMLS_FETCH();
-
- zend_llist_apply_with_arguments(&zend_extensions, (llist_apply_with_args_func_t) zend_extension_message_dispatcher TSRMLS_CC, 2, message, arg);
-}
-
-
-ZEND_API int zend_get_resource_handle(zend_extension *extension)
-{
- if (last_resource_number<ZEND_MAX_RESERVED_RESOURCES) {
- extension->resource_number = last_resource_number;
- return last_resource_number++;
- } else {
- return -1;
- }
-}
-
-
-ZEND_API zend_extension *zend_get_extension(char *extension_name)
-{
- zend_llist_element *element;
-
- for (element = zend_extensions.head; element; element = element->next) {
- zend_extension *extension = (zend_extension *) element->data;
-
- if (!strcmp(extension->name, extension_name)) {
- return extension;
- }
- }
- return NULL;
-}
-
-/*
- * Support for dynamic loading of MH_BUNDLEs on Darwin / Mac OS X
- *
- */
-
-#if HAVE_MACH_O_DYLD_H
-
-void *zend_mh_bundle_load(char* bundle_path)
-{
- NSObjectFileImage bundle_image;
- NSModule bundle_handle;
- NSSymbol bundle_init_nssymbol;
- void (*bundle_init)(void);
-
- if (NSCreateObjectFileImageFromFile(bundle_path, &bundle_image) != NSObjectFileImageSuccess) {
- return NULL;
- }
-
- bundle_handle = NSLinkModule(bundle_image, bundle_path, NSLINKMODULE_OPTION_PRIVATE);
- NSDestroyObjectFileImage(bundle_image);
-
- /* call the init function of the bundle */
- bundle_init_nssymbol = NSLookupSymbolInModule(bundle_handle, "__init");
- if (bundle_init_nssymbol != NULL) {
- bundle_init = NSAddressOfSymbol(bundle_init_nssymbol);
- bundle_init();
- }
-
- return bundle_handle;
-}
-
-int zend_mh_bundle_unload(void *bundle_handle)
-{
- NSSymbol bundle_fini_nssymbol;
- void (*bundle_fini)(void);
-
- /* call the fini function of the bundle */
- bundle_fini_nssymbol = NSLookupSymbolInModule(bundle_handle, "__fini");
- if (bundle_fini_nssymbol != NULL) {
- bundle_fini = NSAddressOfSymbol(bundle_fini_nssymbol);
- bundle_fini();
- }
-
- return (int) NSUnLinkModule(bundle_handle, NULL);
-}
-
-void *zend_mh_bundle_symbol(void *bundle_handle, const char *symbol_name)
-{
- NSSymbol symbol;
- symbol = NSLookupSymbolInModule(bundle_handle, symbol_name);
- return NSAddressOfSymbol(symbol);
-}
-
-const char *zend_mh_bundle_error(void)
-{
- /* Witness the state of the art error reporting */
- return NULL;
-}
-
-#endif /* HAVE_MACH_O_DYLD_H */
diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h
deleted file mode 100644
index 1724f79e21..0000000000
--- a/Zend/zend_extensions.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_EXTENSIONS_H
-#define ZEND_EXTENSIONS_H
-
-#include "zend_compile.h"
-
-#define ZEND_EXTENSION_API_NO 90020901
-
-typedef struct _zend_extension_version_info {
- int zend_extension_api_no;
- char *required_zend_version;
- unsigned char thread_safe;
- unsigned char debug;
-} zend_extension_version_info;
-
-
-typedef struct _zend_extension zend_extension;
-
-/* Typedef's for zend_extension function pointers */
-typedef int (*startup_func_t)(zend_extension *extension);
-typedef void (*shutdown_func_t)(zend_extension *extension);
-typedef void (*activate_func_t)(void);
-typedef void (*deactivate_func_t)(void);
-
-typedef void (*message_handler_func_t)(int message, void *arg);
-
-typedef void (*op_array_handler_func_t)(zend_op_array *op_array);
-
-typedef void (*statement_handler_func_t)(zend_op_array *op_array);
-typedef void (*fcall_begin_handler_func_t)(zend_op_array *op_array);
-typedef void (*fcall_end_handler_func_t)(zend_op_array *op_array);
-
-typedef void (*op_array_ctor_func_t)(zend_op_array *op_array);
-typedef void (*op_array_dtor_func_t)(zend_op_array *op_array);
-
-struct _zend_extension {
- char *name;
- char *version;
- char *author;
- char *URL;
- char *copyright;
-
- startup_func_t startup;
- shutdown_func_t shutdown;
- activate_func_t activate;
- deactivate_func_t deactivate;
-
- message_handler_func_t message_handler;
-
- op_array_handler_func_t op_array_handler;
-
- statement_handler_func_t statement_handler;
- fcall_begin_handler_func_t fcall_begin_handler;
- fcall_end_handler_func_t fcall_end_handler;
-
- op_array_ctor_func_t op_array_ctor;
- op_array_dtor_func_t op_array_dtor;
-
- int (*api_no_check)(int api_no);
- void *reserved2;
- void *reserved3;
- void *reserved4;
- void *reserved5;
- void *reserved6;
- void *reserved7;
- void *reserved8;
-
- DL_HANDLE handle;
- int resource_number;
-};
-
-
-ZEND_API int zend_get_resource_handle(zend_extension *extension);
-ZEND_API void zend_extension_dispatch_message(int message, void *arg);
-
-#define ZEND_EXTMSG_NEW_EXTENSION 1
-
-
-#define ZEND_EXTENSION() \
- ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, ZEND_VERSION, ZTS_V, ZEND_DEBUG }
-
-#define STANDARD_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
-#define COMPAT_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
-
-
-ZEND_API extern zend_llist zend_extensions;
-
-void zend_extension_dtor(zend_extension *extension);
-ZEND_API int zend_load_extension(char *path);
-ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle);
-void zend_append_version_info(zend_extension *extension);
-int zend_startup_extensions_mechanism(void);
-int zend_startup_extensions(void);
-void zend_shutdown_extensions(TSRMLS_D);
-ZEND_API zend_extension *zend_get_extension(char *extension_name);
-
-#endif /* ZEND_EXTENSIONS_H */
diff --git a/Zend/zend_fast_cache.h b/Zend/zend_fast_cache.h
deleted file mode 100644
index 399a90ca1b..0000000000
--- a/Zend/zend_fast_cache.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_FAST_CACHE_H
-#define ZEND_FAST_CACHE_H
-
-#ifndef ZEND_ENABLE_FAST_CACHE
-# if ZEND_DEBUG
-# define ZEND_ENABLE_FAST_CACHE 0
-# else
-# define ZEND_ENABLE_FAST_CACHE 0
-# endif
-#endif
-
-typedef struct _zend_fast_cache_list_entry {
- struct _zend_fast_cache_list_entry *next;
-} zend_fast_cache_list_entry;
-
-#define MAX_FAST_CACHE_TYPES 4
-
-
-#define ZVAL_CACHE_LIST 0
-#define HASHTABLE_CACHE_LIST 1
-
-#if ZEND_ENABLE_FAST_CACHE
-
-
-#include "zend_globals.h"
-#include "zend_globals_macros.h"
-#include "zend_alloc.h"
-
-
-#if ZEND_DEBUG
-# define RECORD_ZVAL_CACHE_HIT(fc_type) AG(fast_cache_stats)[fc_type][1]++;
-# define RECORD_ZVAL_CACHE_MISS(fc_type) AG(fast_cache_stats)[fc_type][0]++;
-#else
-# define RECORD_ZVAL_CACHE_HIT(fc_type)
-# define RECORD_ZVAL_CACHE_MISS(fc_type)
-#endif
-
-
-#define ZEND_FAST_ALLOC(p, type, fc_type) \
- { \
- TSRMLS_FETCH(); \
- \
- if (((p) = (type *) AG(fast_cache_list_head)[fc_type])) { \
- AG(fast_cache_list_head)[fc_type] = ((zend_fast_cache_list_entry *) AG(fast_cache_list_head)[fc_type])->next; \
- RECORD_ZVAL_CACHE_HIT(fc_type); \
- } else { \
- (p) = (type *) emalloc(sizeof(type)); \
- RECORD_ZVAL_CACHE_MISS(fc_type); \
- } \
- }
-
-
-#define ZEND_FAST_FREE(p, fc_type) \
- { \
- TSRMLS_FETCH(); \
- \
- ((zend_fast_cache_list_entry *) (p))->next = (zend_fast_cache_list_entry *) AG(fast_cache_list_head)[fc_type]; \
- AG(fast_cache_list_head)[fc_type] = (zend_fast_cache_list_entry *) (p); \
- }
-
-#define ZEND_FAST_ALLOC_REL(p, type, fc_type) \
- ZEND_FAST_ALLOC(p, type, fc_type)
-
-#define ZEND_FAST_FREE_REL(p, fc_type) \
- ZEND_FAST_FREE(p, fc_type)
-
-
-#else /* !ZEND_ENABLE_FAST_CACHE */
-
-#define ZEND_FAST_ALLOC(p, type, fc_type) \
- (p) = (type *) emalloc(sizeof(type))
-
-#define ZEND_FAST_FREE(p, fc_type) \
- efree(p)
-
-#define ZEND_FAST_ALLOC_REL(p, type, fc_type) \
- (p) = (type *) emalloc_rel(sizeof(type))
-
-#define ZEND_FAST_FREE_REL(p, fc_type) \
- efree_rel(p)
-
-#endif /* ZEND_ENABLE_FAST_CACHE */
-
-
-
-
-/* fast cache for zval's */
-#define ALLOC_ZVAL(z) \
- ZEND_FAST_ALLOC(z, zval, ZVAL_CACHE_LIST)
-
-#define FREE_ZVAL(z) \
- ZEND_FAST_FREE(z, ZVAL_CACHE_LIST)
-
-#define ALLOC_ZVAL_REL(z) \
- ZEND_FAST_ALLOC_REL(z, zval, ZVAL_CACHE_LIST)
-
-#define FREE_ZVAL_REL(z) \
- ZEND_FAST_FREE_REL(z, ZVAL_CACHE_LIST)
-
-/* fast cache for HashTables */
-#define ALLOC_HASHTABLE(ht) \
- ZEND_FAST_ALLOC(ht, HashTable, HASHTABLE_CACHE_LIST)
-
-#define FREE_HASHTABLE(ht) \
- ZEND_FAST_FREE(ht, HASHTABLE_CACHE_LIST)
-
-#define ALLOC_HASHTABLE_REL(ht) \
- ZEND_FAST_ALLOC_REL(ht, HashTable, HASHTABLE_CACHE_LIST)
-
-#define FREE_HASHTABLE_REL(ht) \
- ZEND_FAST_FREE_REL(ht, HASHTABLE_CACHE_LIST)
-
-#endif /* ZEND_FAST_CACHE_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
deleted file mode 100644
index 12311fdb97..0000000000
--- a/Zend/zend_globals.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_GLOBALS_H
-#define ZEND_GLOBALS_H
-
-
-#include <setjmp.h>
-
-#include "zend_globals_macros.h"
-
-#include "zend_stack.h"
-#include "zend_ptr_stack.h"
-#include "zend_hash.h"
-#include "zend_llist.h"
-#include "zend_fast_cache.h"
-#include "zend_objects.h"
-#include "zend_objects_API.h"
-
-/* Define ZTS if you want a thread-safe Zend */
-/*#undef ZTS*/
-
-#ifdef ZTS
-
-BEGIN_EXTERN_C()
-ZEND_API extern int compiler_globals_id;
-ZEND_API extern int executor_globals_id;
-ZEND_API extern int alloc_globals_id;
-END_EXTERN_C()
-
-#endif
-
-#define SYMTABLE_CACHE_SIZE 32
-
-
-#include "zend_compile.h"
-
-/* excpt.h on Digital Unix 4.0 defines function_table */
-#undef function_table
-
-
-typedef struct _zend_declarables {
- zval ticks;
-} zend_declarables;
-
-
-struct _zend_compiler_globals {
- zend_stack bp_stack;
- zend_stack switch_cond_stack;
- zend_stack foreach_copy_stack;
- zend_stack object_stack;
- zend_stack declare_stack;
-
- zend_class_entry *active_class_entry;
- zval active_ce_parent_class_name;
-
- /* variables for list() compilation */
- zend_llist list_llist;
- zend_llist dimension_llist;
- zend_stack list_stack;
-
- zend_stack function_call_stack;
-
- char *compiled_filename;
-
- int zend_lineno;
- int comment_start_line;
- char *heredoc;
- int heredoc_len;
-
- zend_op_array *active_op_array;
-
- zend_class_entry main_class;
- HashTable *function_table; /* function symbol table */
- HashTable *class_table; /* class table */
-
- HashTable filenames_table;
-
- HashTable *auto_globals;
-
- zend_bool in_compilation;
- zend_bool short_tags;
- zend_bool asp_tags;
- zend_bool allow_call_time_pass_reference;
-
- zend_declarables declarables;
-
- /* For extensions support */
- zend_bool extended_info; /* generate extension information for debugger/profiler */
- zend_bool handle_op_arrays; /* run op_arrays through op_array handlers */
-
- zend_bool unclean_shutdown;
-
- zend_bool ini_parser_unbuffered_errors;
-
- zend_llist open_files;
-
- zend_llist *throw_list;
- long catch_begin;
-
- struct _zend_ini_parser_param *ini_parser_param;
-
- int interactive;
-
- zend_bool in_clone_method;
- zend_bool increment_lineno;
-
- zend_llist import_commands;
-};
-
-
-struct _zend_executor_globals {
- zval **return_value_ptr_ptr;
-
- zval uninitialized_zval;
- zval *uninitialized_zval_ptr;
-
- zval error_zval;
- zval *error_zval_ptr;
-
- zend_function_state *function_state_ptr;
- zend_ptr_stack arg_types_stack;
-
- /* symbol table cache */
- HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
- HashTable **symtable_cache_limit;
- HashTable **symtable_cache_ptr;
-
- zend_op **opline_ptr;
-
- HashTable *active_symbol_table;
- HashTable symbol_table; /* main symbol table */
-
- HashTable included_files; /* files already included */
-
- jmp_buf bailout;
-
- int error_reporting;
- int orig_error_reporting;
- int exit_status;
-
- zend_op_array *active_op_array;
-
- HashTable *function_table; /* function symbol table */
- HashTable *class_table; /* class table */
- HashTable *zend_constants; /* constants table */
-
- zend_class_entry *scope;
- zend_class_entry *main_class_ptr;
-
- zval *This;
-
- long precision;
-
- int ticks_count;
-
- zend_bool in_execution;
- zend_bool bailout_set;
- zend_bool full_tables_cleanup;
-
- /* for extended information support */
- zend_bool no_extensions;
-
-#ifdef ZEND_WIN32
- zend_bool timed_out;
-#endif
-
- HashTable regular_list;
- HashTable persistent_list;
-
- zend_ptr_stack argument_stack;
- int free_op1, free_op2;
- int (*unary_op)(zval *result, zval *op1);
- int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-
- zval *garbage[2];
- int garbage_ptr;
-
- zval *user_error_handler;
- zval *user_exception_handler;
- zend_ptr_stack user_error_handlers;
- zend_ptr_stack user_exception_handlers;
-
- /* timeout support */
- int timeout_seconds;
-
- int lambda_count;
-
- HashTable *ini_directives;
- zend_objects_store objects_store;
- zval *exception;
-
- struct _zend_execute_data *current_execute_data;
-
- void *reserved[ZEND_MAX_RESERVED_RESOURCES];
-};
-
-#include "zend_mm.h"
-
-struct _zend_alloc_globals {
- zend_mem_header *head; /* standard list */
- void *cache[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES];
- unsigned int cache_count[MAX_CACHED_MEMORY];
- void *fast_cache_list_head[MAX_FAST_CACHE_TYPES];
-
-#ifdef ZEND_WIN32
- HANDLE memory_heap;
-#endif
-
-#if ZEND_DEBUG
- /* for performance tuning */
- int cache_stats[MAX_CACHED_MEMORY][2];
- int fast_cache_stats[MAX_FAST_CACHE_TYPES][2];
-#endif
-#if MEMORY_LIMIT
- unsigned int memory_limit;
- unsigned int allocated_memory;
- unsigned int allocated_memory_peak;
- unsigned char memory_exhausted;
-#endif
-#ifdef ZEND_MM
- zend_mm_heap mm_heap;
-#endif
-};
-
-struct _zend_scanner_globals {
- FILE *yy_in;
- FILE *yy_out;
- int yy_leng;
- char *yy_text;
- struct yy_buffer_state *current_buffer;
- char *c_buf_p;
- int init;
- int start;
- char _yy_hold_char;
- int yy_n_chars;
- int _yy_did_buffer_switch_on_eof;
- int _yy_last_accepting_state; /* Must be of the same type as yy_state_type,
- * if for whatever reason it's no longer int!
- */
- char *_yy_last_accepting_cpos;
- int _yy_more_flag;
- int _yy_more_len;
- int yy_start_stack_ptr;
- int yy_start_stack_depth;
- int *yy_start_stack;
-};
-
-#endif /* ZEND_GLOBALS_H */
diff --git a/Zend/zend_globals_macros.h b/Zend/zend_globals_macros.h
deleted file mode 100644
index f03a9845ad..0000000000
--- a/Zend/zend_globals_macros.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_GLOBALS_MACROS_H
-#define ZEND_GLOBALS_MACROS_H
-
-typedef struct _zend_compiler_globals zend_compiler_globals;
-typedef struct _zend_executor_globals zend_executor_globals;
-typedef struct _zend_alloc_globals zend_alloc_globals;
-typedef struct _zend_scanner_globals zend_scanner_globals;
-
-/* Compiler */
-#ifdef ZTS
-# define CG(v) TSRMG(compiler_globals_id, zend_compiler_globals *, v)
-BEGIN_EXTERN_C()
-int zendparse(void *compiler_globals);
-END_EXTERN_C()
-#else
-# define CG(v) (compiler_globals.v)
-extern ZEND_API struct _zend_compiler_globals compiler_globals;
-int zendparse(void);
-#endif
-
-
-/* Executor */
-#ifdef ZTS
-# define EG(v) TSRMG(executor_globals_id, zend_executor_globals *, v)
-#else
-# define EG(v) (executor_globals.v)
-extern ZEND_API zend_executor_globals executor_globals;
-#endif
-
-
-/* Memory Manager */
-#ifdef ZTS
-# define AG(v) TSRMG(alloc_globals_id, zend_alloc_globals *, v)
-#else
-# define AG(v) (alloc_globals.v)
-extern ZEND_API zend_alloc_globals alloc_globals;
-#endif
-
-
-/* Language Scanner */
-#ifdef ZTS
-# define LANG_SCNG(v) TSRMG(language_scanner_globals_id, zend_scanner_globals *, v)
-extern ZEND_API ts_rsrc_id language_scanner_globals_id;
-#else
-# define LANG_SCNG(v) (language_scanner_globals.v)
-extern ZEND_API zend_scanner_globals language_scanner_globals;
-#endif
-
-
-/* INI Scanner */
-#ifdef ZTS
-# define INI_SCNG(v) TSRMG(ini_scanner_globals_id, zend_scanner_globals *, v)
-extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
-#else
-# define INI_SCNG(v) (ini_scanner_globals.v)
-extern ZEND_API zend_scanner_globals ini_scanner_globals;
-#endif
-
-
-/* For limited downwards source compatibility */
-#define CLS_FETCH()
-#define ELS_FETCH()
-#define ALS_FETCH()
-#define PLS_FETCH()
-#define SLS_FETCH()
-#define CLS_D
-#define ELS_D
-#define ALS_D
-#define PLS_D
-#define SLS_D
-#define CLS_DC
-#define ELS_DC
-#define ALS_DC
-#define PLS_DC
-#define SLS_DC
-#define CLS_C
-#define ELS_C
-#define ALS_C
-#define PLS_C
-#define SLS_C
-#define CLS_CC
-#define ELS_CC
-#define ALS_CC
-#define PLS_CC
-#define SLS_CC
-
-
-#endif /* ZEND_GLOBALS_MACROS_H */
-
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
deleted file mode 100644
index 61b3b036f6..0000000000
--- a/Zend/zend_hash.c
+++ /dev/null
@@ -1,1324 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "zend.h"
-
-#define HANDLE_NUMERIC(key, length, func) { \
- register char *tmp=key; \
- \
- if ((*tmp>='0' && *tmp<='9')) do { /* possibly a numeric index */ \
- char *end=tmp+length-1; \
- ulong idx; \
- \
- if (*tmp++=='0' && length>2) { /* don't accept numbers with leading zeros */ \
- break; \
- } \
- while (tmp<end) { \
- if (!(*tmp>='0' && *tmp<='9')) { \
- break; \
- } \
- tmp++; \
- } \
- if (tmp==end && *tmp=='\0') { /* a numeric index */ \
- idx = strtol(key, NULL, 10); \
- if (idx!=LONG_MAX) { \
- return func; \
- } \
- } \
- } while (0); \
-}
-
-
-#define CONNECT_TO_BUCKET_DLLIST(element, list_head) \
- (element)->pNext = (list_head); \
- (element)->pLast = NULL; \
- if ((element)->pNext) { \
- (element)->pNext->pLast = (element); \
- }
-
-#define CONNECT_TO_GLOBAL_DLLIST(element, ht) \
- (element)->pListLast = (ht)->pListTail; \
- (ht)->pListTail = (element); \
- (element)->pListNext = NULL; \
- if ((element)->pListLast != NULL) { \
- (element)->pListLast->pListNext = (element); \
- } \
- if (!(ht)->pListHead) { \
- (ht)->pListHead = (element); \
- } \
- if ((ht)->pInternalPointer == NULL) { \
- (ht)->pInternalPointer = (element); \
- }
-
-#if ZEND_DEBUG
-#define HT_OK 0
-#define HT_IS_DESTROYING 1
-#define HT_DESTROYED 2
-#define HT_CLEANING 3
-
-static void _zend_is_inconsistent(HashTable *ht, char *file, int line)
-{
- if (ht->inconsistent==HT_OK) {
- return;
- }
- switch (ht->inconsistent) {
- case HT_IS_DESTROYING:
- zend_output_debug_string(1, "%s(%d) : ht=0x%08x is being destroyed", file, line, ht);
- break;
- case HT_DESTROYED:
- zend_output_debug_string(1, "%s(%d) : ht=0x%08x is already destroyed", file, line, ht);
- break;
- case HT_CLEANING:
- zend_output_debug_string(1, "%s(%d) : ht=0x%08x is being cleaned", file, line, ht);
- break;
- }
- zend_bailout();
-}
-#define IS_CONSISTENT(a) _zend_is_inconsistent(a, __FILE__, __LINE__);
-#define SET_INCONSISTENT(n) ht->inconsistent = n;
-#else
-#define IS_CONSISTENT(a)
-#define SET_INCONSISTENT(n)
-#endif
-
-#define HASH_PROTECT_RECURSION(ht) \
- if ((ht)->bApplyProtection) { \
- if ((ht)->nApplyCount++ >= 3) { \
- zend_error(E_ERROR, "Nesting level too deep - recursive dependency?"); \
- } \
- }
-
-
-#define HASH_UNPROTECT_RECURSION(ht) \
- if ((ht)->bApplyProtection) { \
- (ht)->nApplyCount--; \
- }
-
-
-#define ZEND_HASH_IF_FULL_DO_RESIZE(ht) \
- if ((ht)->nNumOfElements > (ht)->nTableSize) { \
- zend_hash_do_resize(ht); \
- }
-
-static int zend_hash_do_resize(HashTable *ht);
-
-ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength)
-{
- return zend_inline_hash_func(arKey, nKeyLength);
-}
-
-
-#define UPDATE_DATA(ht, p, pData, nDataSize) \
- if (nDataSize == sizeof(void*)) { \
- if (!(p)->pDataPtr) { \
- pefree((p)->pData, (ht)->persistent); \
- } \
- memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
- (p)->pData = &(p)->pDataPtr; \
- } else { \
- if ((p)->pDataPtr) { \
- (p)->pData = (void *) pemalloc(nDataSize, (ht)->persistent); \
- (p)->pDataPtr=NULL; \
- } \
- memcpy((p)->pData, pData, nDataSize); \
- }
-
-#define INIT_DATA(ht, p, pData, nDataSize); \
- if (nDataSize == sizeof(void*)) { \
- memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
- (p)->pData = &(p)->pDataPtr; \
- } else { \
- (p)->pData = (void *) pemalloc(nDataSize, (ht)->persistent); \
- if (!(p)->pData) { \
- pefree(p, (ht)->persistent); \
- return FAILURE; \
- } \
- memcpy((p)->pData, pData, nDataSize); \
- (p)->pDataPtr=NULL; \
- }
-
-
-ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
-{
- uint i = 3;
-
- SET_INCONSISTENT(HT_OK);
-
- while ((1U << i) < nSize) {
- i++;
- }
-
- ht->nTableSize = 1 << i;
- ht->nTableMask = ht->nTableSize - 1;
-
- /* Uses ecalloc() so that Bucket* == NULL */
- if (persistent) {
- ht->arBuckets = (Bucket **) calloc(ht->nTableSize, sizeof(Bucket *));
- } else {
- ht->arBuckets = (Bucket **) ecalloc_rel(ht->nTableSize, sizeof(Bucket *));
- }
-
- if (!ht->arBuckets) {
- return FAILURE;
- }
-
- ht->pDestructor = pDestructor;
- ht->pListHead = NULL;
- ht->pListTail = NULL;
- ht->nNumOfElements = 0;
- ht->nNextFreeElement = 0;
- ht->pInternalPointer = NULL;
- ht->persistent = persistent;
- ht->nApplyCount = 0;
- ht->bApplyProtection = 1;
- return SUCCESS;
-}
-
-
-ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC)
-{
- int retval = _zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent ZEND_FILE_LINE_CC);
-
- ht->bApplyProtection = bApplyProtection;
- return retval;
-}
-
-
-ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProtection)
-{
- ht->bApplyProtection = bApplyProtection;
-}
-
-
-
-ZEND_API int zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag)
-{
- ulong h;
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- if (nKeyLength <= 0) {
-#if ZEND_DEBUG
- ZEND_PUTS("zend_hash_update: Can't put in empty key\n");
-#endif
- return FAILURE;
- }
-
- HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_update_or_next_insert(ht, idx, pData, nDataSize, pDest, flag));
-
- h = zend_inline_hash_func(arKey, nKeyLength);
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- if (flag & HASH_ADD) {
- return FAILURE;
- }
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG
- if (p->pData == pData) {
- ZEND_PUTS("Fatal error in zend_hash_update: p->pData == pData\n");
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return FAILURE;
- }
-#endif
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- UPDATE_DATA(ht, p, pData, nDataSize);
- if (pDest) {
- *pDest = p->pData;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return SUCCESS;
- }
- }
- p = p->pNext;
- }
-
- p = (Bucket *) pemalloc(sizeof(Bucket)-1+nKeyLength, ht->persistent);
- if (!p) {
- return FAILURE;
- }
- memcpy(p->arKey, arKey, nKeyLength);
- p->nKeyLength = nKeyLength;
- INIT_DATA(ht, p, pData, nDataSize);
- p->h = h;
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]);
- if (pDest) {
- *pDest = p->pData;
- }
-
- HANDLE_BLOCK_INTERRUPTIONS();
- CONNECT_TO_GLOBAL_DLLIST(p, ht);
- ht->arBuckets[nIndex] = p;
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- ht->nNumOfElements++;
- ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
- return SUCCESS;
-}
-
-ZEND_API int zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag)
-{
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- if (nKeyLength <= 0) {
-#if ZEND_DEBUG
- ZEND_PUTS("zend_hash_update: Can't put in empty key\n");
-#endif
- return FAILURE;
- }
-
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- if (flag & HASH_ADD) {
- return FAILURE;
- }
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG
- if (p->pData == pData) {
- ZEND_PUTS("Fatal error in zend_hash_update: p->pData == pData\n");
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return FAILURE;
- }
-#endif
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- UPDATE_DATA(ht, p, pData, nDataSize);
- if (pDest) {
- *pDest = p->pData;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return SUCCESS;
- }
- }
- p = p->pNext;
- }
-
- p = (Bucket *) pemalloc(sizeof(Bucket)-1+nKeyLength, ht->persistent);
- if (!p) {
- return FAILURE;
- }
-
- memcpy(p->arKey, arKey, nKeyLength);
- p->nKeyLength = nKeyLength;
- INIT_DATA(ht, p, pData, nDataSize);
- p->h = h;
-
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]);
-
- if (pDest) {
- *pDest = p->pData;
- }
-
- HANDLE_BLOCK_INTERRUPTIONS();
- ht->arBuckets[nIndex] = p;
- CONNECT_TO_GLOBAL_DLLIST(p, ht);
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- ht->nNumOfElements++;
- ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
- return SUCCESS;
-}
-
-
-ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLength)
-{
- void *dummy = (void *) 1;
-
- return zend_hash_add(ht, arKey, nKeyLength, &dummy, sizeof(void *), NULL);
-}
-
-
-ZEND_API int zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag)
-{
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- if (flag & HASH_NEXT_INSERT) {
- h = ht->nNextFreeElement;
- }
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->nKeyLength == 0) && (p->h == h)) {
- if (flag & HASH_NEXT_INSERT || flag & HASH_ADD) {
- return FAILURE;
- }
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG
- if (p->pData == pData) {
- ZEND_PUTS("Fatal error in zend_hash_index_update: p->pData == pData\n");
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return FAILURE;
- }
-#endif
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- UPDATE_DATA(ht, p, pData, nDataSize);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- if ((long)h >= (long)ht->nNextFreeElement) {
- ht->nNextFreeElement = h + 1;
- }
- if (pDest) {
- *pDest = p->pData;
- }
- return SUCCESS;
- }
- p = p->pNext;
- }
- p = (Bucket *) pemalloc(sizeof(Bucket)-1, ht->persistent);
- if (!p) {
- return FAILURE;
- }
- p->nKeyLength = 0; /* Numeric indices are marked by making the nKeyLength == 0 */
- p->h = h;
- INIT_DATA(ht, p, pData, nDataSize);
- if (pDest) {
- *pDest = p->pData;
- }
-
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]);
-
- HANDLE_BLOCK_INTERRUPTIONS();
- ht->arBuckets[nIndex] = p;
- CONNECT_TO_GLOBAL_DLLIST(p, ht);
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- if ((long)h >= (long)ht->nNextFreeElement) {
- ht->nNextFreeElement = h + 1;
- }
- ht->nNumOfElements++;
- ZEND_HASH_IF_FULL_DO_RESIZE(ht);
- return SUCCESS;
-}
-
-
-static int zend_hash_do_resize(HashTable *ht)
-{
- Bucket **t;
-
- IS_CONSISTENT(ht);
-
- if ((ht->nTableSize << 1) > 0) { /* Let's double the table size */
- t = (Bucket **) perealloc_recoverable(ht->arBuckets, (ht->nTableSize << 1) * sizeof(Bucket *), ht->persistent);
- if (t) {
- HANDLE_BLOCK_INTERRUPTIONS();
- ht->arBuckets = t;
- ht->nTableSize = (ht->nTableSize << 1);
- ht->nTableMask = ht->nTableSize - 1;
- zend_hash_rehash(ht);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return SUCCESS;
- }
- return FAILURE;
- }
- return SUCCESS;
-}
-
-ZEND_API int zend_hash_rehash(HashTable *ht)
-{
- Bucket *p;
- uint nIndex;
-
- IS_CONSISTENT(ht);
-
- memset(ht->arBuckets, 0, ht->nTableSize * sizeof(Bucket *));
- p = ht->pListHead;
- while (p != NULL) {
- nIndex = p->h & ht->nTableMask;
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]);
- ht->arBuckets[nIndex] = p;
- p = p->pListNext;
- }
- return SUCCESS;
-}
-
-ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag)
-{
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- if (flag == HASH_DEL_KEY) {
- HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_del_key_or_index(ht, arKey, nKeyLength, idx, HASH_DEL_INDEX));
- h = zend_inline_hash_func(arKey, nKeyLength);
- }
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && ((p->nKeyLength == 0) || /* Numeric index */
- ((p->nKeyLength == nKeyLength) && (!memcmp(p->arKey, arKey, nKeyLength))))) {
- HANDLE_BLOCK_INTERRUPTIONS();
- if (p == ht->arBuckets[nIndex]) {
- ht->arBuckets[nIndex] = p->pNext;
- } else {
- p->pLast->pNext = p->pNext;
- }
- if (p->pNext) {
- p->pNext->pLast = p->pLast;
- }
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p->pListNext;
- } else {
- /* Deleting the head of the list */
- ht->pListHead = p->pListNext;
- }
- if (p->pListNext != NULL) {
- p->pListNext->pListLast = p->pListLast;
- } else {
- ht->pListTail = p->pListLast;
- }
- if (ht->pInternalPointer == p) {
- ht->pInternalPointer = p->pListNext;
- }
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- if (!p->pDataPtr) {
- pefree(p->pData, ht->persistent);
- }
- pefree(p, ht->persistent);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- ht->nNumOfElements--;
- return SUCCESS;
- }
- p = p->pNext;
- }
- return FAILURE;
-}
-
-
-ZEND_API void zend_hash_destroy(HashTable *ht)
-{
- Bucket *p, *q;
-
- IS_CONSISTENT(ht);
-
- SET_INCONSISTENT(HT_IS_DESTROYING);
-
- p = ht->pListHead;
- while (p != NULL) {
- q = p;
- p = p->pListNext;
- if (ht->pDestructor) {
- ht->pDestructor(q->pData);
- }
- if (!q->pDataPtr && q->pData) {
- pefree(q->pData, ht->persistent);
- }
- pefree(q, ht->persistent);
- }
- pefree(ht->arBuckets, ht->persistent);
-
- SET_INCONSISTENT(HT_DESTROYED);
-}
-
-
-ZEND_API void zend_hash_clean(HashTable *ht)
-{
- Bucket *p, *q;
-
- IS_CONSISTENT(ht);
-
- SET_INCONSISTENT(HT_CLEANING);
-
- p = ht->pListHead;
- while (p != NULL) {
- q = p;
- p = p->pListNext;
- if (ht->pDestructor) {
- ht->pDestructor(q->pData);
- }
- if (!q->pDataPtr && q->pData) {
- pefree(q->pData, ht->persistent);
- }
- pefree(q, ht->persistent);
- }
- memset(ht->arBuckets, 0, ht->nTableSize*sizeof(Bucket *));
- ht->pListHead = NULL;
- ht->pListTail = NULL;
- ht->nNumOfElements = 0;
- ht->nNextFreeElement = 0;
- ht->pInternalPointer = NULL;
-
- SET_INCONSISTENT(HT_OK);
-}
-
-/* This function is used by the various apply() functions.
- * It deletes the passed bucket, and returns the address of the
- * next bucket. The hash *may* be altered during that time, the
- * returned value will still be valid.
- */
-static Bucket *zend_hash_apply_deleter(HashTable *ht, Bucket *p)
-{
- Bucket *retval;
-
- HANDLE_BLOCK_INTERRUPTIONS();
-
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- if (!p->pDataPtr) {
- pefree(p->pData, ht->persistent);
- }
- retval = p->pListNext;
-
- if (p->pLast) {
- p->pLast->pNext = p->pNext;
- } else {
- uint nIndex;
-
- nIndex = p->h & ht->nTableMask;
- ht->arBuckets[nIndex] = p->pNext;
- }
- if (p->pNext) {
- p->pNext->pLast = p->pLast;
- } else {
- /* Nothing to do as this list doesn't have a tail */
- }
-
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p->pListNext;
- } else {
- /* Deleting the head of the list */
- ht->pListHead = p->pListNext;
- }
- if (p->pListNext != NULL) {
- p->pListNext->pListLast = p->pListLast;
- } else {
- ht->pListTail = p->pListLast;
- }
- if (ht->pInternalPointer == p) {
- ht->pInternalPointer = p->pListNext;
- }
- pefree(p, ht->persistent);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- ht->nNumOfElements--;
-
- return retval;
-}
-
-
-ZEND_API void zend_hash_graceful_destroy(HashTable *ht)
-{
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- p = ht->pListHead;
- while (p != NULL) {
- p = zend_hash_apply_deleter(ht, p);
- }
- pefree(ht->arBuckets, ht->persistent);
-
- SET_INCONSISTENT(HT_DESTROYED);
-}
-
-ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht)
-{
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- p = ht->pListTail;
- while (p != NULL) {
- zend_hash_apply_deleter(ht, p);
- p = ht->pListTail;
- }
-
- pefree(ht->arBuckets, ht->persistent);
-
- SET_INCONSISTENT(HT_DESTROYED);
-}
-
-/* This is used to selectively delete certain entries from a hashtable.
- * destruct() receives the data and decides if the entry should be deleted
- * or not
- */
-
-
-ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
-{
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- HASH_PROTECT_RECURSION(ht);
- p = ht->pListHead;
- while (p != NULL) {
- if (apply_func(p->pData TSRMLS_CC)) {
- p = zend_hash_apply_deleter(ht, p);
- } else {
- p = p->pListNext;
- }
- }
- HASH_UNPROTECT_RECURSION(ht);
-}
-
-
-ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC)
-{
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- HASH_PROTECT_RECURSION(ht);
- p = ht->pListHead;
- while (p != NULL) {
- if (apply_func(p->pData, argument TSRMLS_CC)) {
- p = zend_hash_apply_deleter(ht, p);
- } else {
- p = p->pListNext;
- }
- }
- HASH_UNPROTECT_RECURSION(ht);
-}
-
-
-ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t destruct, int num_args, ...)
-{
- Bucket *p;
- va_list args;
- zend_hash_key hash_key;
-
- IS_CONSISTENT(ht);
-
- HASH_PROTECT_RECURSION(ht);
-
- va_start(args, num_args);
- p = ht->pListHead;
- while (p != NULL) {
- hash_key.arKey = p->arKey;
- hash_key.nKeyLength = p->nKeyLength;
- hash_key.h = p->h;
- if (destruct(p->pData, num_args, args, &hash_key)) {
- p = zend_hash_apply_deleter(ht, p);
- } else {
- p = p->pListNext;
- }
- }
- va_end(args);
-
- HASH_UNPROTECT_RECURSION(ht);
-}
-
-
-ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
-{
- Bucket *p, *q;
-
- IS_CONSISTENT(ht);
-
- HASH_PROTECT_RECURSION(ht);
- p = ht->pListTail;
- while (p != NULL) {
- int result = apply_func(p->pData TSRMLS_CC);
-
- q = p;
- p = p->pListLast;
- if (result & ZEND_HASH_APPLY_REMOVE) {
- if (q->nKeyLength>0) {
- zend_hash_del(ht, q->arKey, q->nKeyLength);
- } else {
- zend_hash_index_del(ht, q->h);
- }
- }
- if (result & ZEND_HASH_APPLY_STOP) {
- break;
- }
- }
- HASH_UNPROTECT_RECURSION(ht);
-}
-
-
-ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size)
-{
- Bucket *p;
- void *new_entry;
-
- IS_CONSISTENT(source);
- IS_CONSISTENT(target);
-
- p = source->pListHead;
- while (p) {
- if (p->nKeyLength) {
- zend_hash_update(target, p->arKey, p->nKeyLength, p->pData, size, &new_entry);
- } else {
- zend_hash_index_update(target, p->h, p->pData, size, &new_entry);
- }
- if (pCopyConstructor) {
- pCopyConstructor(new_entry);
- }
- p = p->pListNext;
- }
- target->pInternalPointer = target->pListHead;
-}
-
-
-ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite)
-{
- Bucket *p;
- void *t;
- int mode = (overwrite?HASH_UPDATE:HASH_ADD);
-
- IS_CONSISTENT(source);
- IS_CONSISTENT(target);
-
- p = source->pListHead;
- while (p) {
- if (p->nKeyLength>0) {
- if (zend_hash_add_or_update(target, p->arKey, p->nKeyLength, p->pData, size, &t, mode)==SUCCESS && pCopyConstructor) {
- pCopyConstructor(t);
- }
- } else {
- if ((mode==HASH_UPDATE || !zend_hash_index_exists(target, p->h)) && zend_hash_index_update(target, p->h, p->pData, size, &t)==SUCCESS && pCopyConstructor) {
- pCopyConstructor(t);
- }
- }
- p = p->pListNext;
- }
- target->pInternalPointer = target->pListHead;
-}
-
-
-ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, zend_bool (*pReplaceOrig)(void *orig, void *p_new))
-{
- Bucket *p;
- void *t;
- void *pOrig;
-
- IS_CONSISTENT(source);
- IS_CONSISTENT(target);
-
- p = source->pListHead;
- while (p) {
- if (p->nKeyLength>0) {
- if (zend_hash_find(target, p->arKey, p->nKeyLength, &pOrig)==FAILURE
- || pReplaceOrig(pOrig, p->pData)) {
- if (zend_hash_update(target, p->arKey, p->nKeyLength, p->pData, size, &t)==SUCCESS && pCopyConstructor) {
- pCopyConstructor(t);
- }
- }
- } else {
- if (zend_hash_index_find(target, p->h, &pOrig)==FAILURE
- || pReplaceOrig(pOrig, p->pData)) {
- if (zend_hash_index_update(target, p->h, p->pData, size, &t)==SUCCESS && pCopyConstructor) {
- pCopyConstructor(t);
- }
- }
- }
- p = p->pListNext;
- }
- target->pInternalPointer = target->pListHead;
-}
-
-
-ZEND_API ulong zend_get_hash_value(HashTable *ht, char *arKey, uint nKeyLength)
-{
- IS_CONSISTENT(ht);
-
- return zend_inline_hash_func(arKey, nKeyLength);
-}
-
-
-/* Returns SUCCESS if found and FAILURE if not. The pointer to the
- * data is returned in pData. The reason is that there's no reason
- * someone using the hash table might not want to have NULL data
- */
-ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData)
-{
- ulong h;
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht, idx, pData));
-
- h = zend_inline_hash_func(arKey, nKeyLength);
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- *pData = p->pData;
- return SUCCESS;
- }
- }
- p = p->pNext;
- }
- return FAILURE;
-}
-
-
-ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData)
-{
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- *pData = p->pData;
- return SUCCESS;
- }
- }
- p = p->pNext;
- }
- return FAILURE;
-}
-
-
-ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength)
-{
- ulong h;
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx));
-
- h = zend_inline_hash_func(arKey, nKeyLength);
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- return 1;
- }
- }
- p = p->pNext;
- }
- return 0;
-}
-
-
-ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData)
-{
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == 0)) {
- *pData = p->pData;
- return SUCCESS;
- }
- p = p->pNext;
- }
- return FAILURE;
-}
-
-
-ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h)
-{
- uint nIndex;
- Bucket *p;
-
- IS_CONSISTENT(ht);
-
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == 0)) {
- return 1;
- }
- p = p->pNext;
- }
- return 0;
-}
-
-
-ZEND_API int zend_hash_num_elements(HashTable *ht)
-{
- IS_CONSISTENT(ht);
-
- return ht->nNumOfElements;
-}
-
-
-ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos)
-{
- IS_CONSISTENT(ht);
-
- if (pos)
- *pos = ht->pListHead;
- else
- ht->pInternalPointer = ht->pListHead;
-}
-
-
-/* This function will be extremely optimized by remembering
- * the end of the list
- */
-ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos)
-{
- IS_CONSISTENT(ht);
-
- if (pos)
- *pos = ht->pListTail;
- else
- ht->pInternalPointer = ht->pListTail;
-}
-
-
-ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos)
-{
- HashPosition *current = pos ? pos : &ht->pInternalPointer;
-
- IS_CONSISTENT(ht);
-
- if (*current) {
- *current = (*current)->pListNext;
- return SUCCESS;
- } else
- return FAILURE;
-}
-
-ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos)
-{
- HashPosition *current = pos ? pos : &ht->pInternalPointer;
-
- IS_CONSISTENT(ht);
-
- if (*current) {
- *current = (*current)->pListLast;
- return SUCCESS;
- } else
- return FAILURE;
-}
-
-
-/* This function should be made binary safe */
-ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos)
-{
- Bucket *p;
-
- p = pos ? (*pos) : ht->pInternalPointer;
-
- IS_CONSISTENT(ht);
-
- if (p) {
- if (p->nKeyLength) {
- if (duplicate) {
- *str_index = estrndup(p->arKey, p->nKeyLength);
- } else {
- *str_index = p->arKey;
- }
- if (str_length) {
- *str_length = p->nKeyLength;
- }
- return HASH_KEY_IS_STRING;
- } else {
- *num_index = p->h;
- return HASH_KEY_IS_LONG;
- }
- }
- return HASH_KEY_NON_EXISTANT;
-}
-
-
-ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos)
-{
- Bucket *p;
-
- p = pos ? (*pos) : ht->pInternalPointer;
-
- IS_CONSISTENT(ht);
-
- if (p) {
- if (p->nKeyLength) {
- return HASH_KEY_IS_STRING;
- } else {
- return HASH_KEY_IS_LONG;
- }
- }
- return HASH_KEY_NON_EXISTANT;
-}
-
-
-ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos)
-{
- Bucket *p;
-
- p = pos ? (*pos) : ht->pInternalPointer;
-
- IS_CONSISTENT(ht);
-
- if (p) {
- *pData = p->pData;
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-
-ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
- compare_func_t compar, int renumber TSRMLS_DC)
-{
- Bucket **arTmp;
- Bucket *p;
- int i, j;
-
- IS_CONSISTENT(ht);
-
- if (!(ht->nNumOfElements>1) && !(renumber && ht->nNumOfElements>0)) { /* Doesn't require sorting */
- return SUCCESS;
- }
- arTmp = (Bucket **) pemalloc(ht->nNumOfElements * sizeof(Bucket *), ht->persistent);
- if (!arTmp) {
- return FAILURE;
- }
- p = ht->pListHead;
- i = 0;
- while (p) {
- arTmp[i] = p;
- p = p->pListNext;
- i++;
- }
-
- (*sort_func)((void *) arTmp, i, sizeof(Bucket *), compar TSRMLS_CC);
-
- HANDLE_BLOCK_INTERRUPTIONS();
- ht->pListHead = arTmp[0];
- ht->pListTail = NULL;
- ht->pInternalPointer = ht->pListHead;
-
- for (j = 0; j < i; j++) {
- if (ht->pListTail) {
- ht->pListTail->pListNext = arTmp[j];
- }
- arTmp[j]->pListLast = ht->pListTail;
- arTmp[j]->pListNext = NULL;
- ht->pListTail = arTmp[j];
- }
- pefree(arTmp, ht->persistent);
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- if (renumber) {
- p = ht->pListHead;
- i=0;
- while (p != NULL) {
- p->nKeyLength = 0;
- p->h = i++;
- p = p->pListNext;
- }
- ht->nNextFreeElement = i;
- zend_hash_rehash(ht);
- }
- return SUCCESS;
-}
-
-
-ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC)
-{
- Bucket *p1, *p2;
- int result;
- void *pData2;
-
- IS_CONSISTENT(ht1);
- IS_CONSISTENT(ht2);
-
- HASH_PROTECT_RECURSION(ht1);
- HASH_PROTECT_RECURSION(ht2);
-
- result = ht1->nNumOfElements - ht2->nNumOfElements;
- if (result!=0) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return result;
- }
-
- p1 = ht1->pListHead;
- if (ordered) {
- p2 = ht2->pListHead;
- }
-
- while (p1) {
- if (ordered && !p2) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return 1; /* That's not supposed to happen */
- }
- if (ordered) {
- if (p1->nKeyLength==0 && p2->nKeyLength==0) { /* numeric indices */
- result = p1->h - p2->h;
- if (result!=0) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return result;
- }
- } else { /* string indices */
- result = p1->nKeyLength - p2->nKeyLength;
- if (result!=0) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return result;
- }
- result = memcmp(p1->arKey, p2->arKey, p1->nKeyLength);
- if (result!=0) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return result;
- }
- }
- pData2 = p2->pData;
- } else {
- if (p1->nKeyLength==0) { /* numeric index */
- if (zend_hash_index_find(ht2, p1->h, &pData2)==FAILURE) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return 1;
- }
- } else { /* string index */
- if (zend_hash_find(ht2, p1->arKey, p1->nKeyLength, &pData2)==FAILURE) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return 1;
- }
- }
- }
- result = compar(p1->pData, pData2 TSRMLS_CC);
- if (result!=0) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return result;
- }
- p1 = p1->pListNext;
- if (ordered) {
- p2 = p2->pListNext;
- }
- }
-
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return 0;
-}
-
-
-ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC)
-{
- Bucket *p, *res;
-
- IS_CONSISTENT(ht);
-
- if (ht->nNumOfElements == 0 ) {
- *pData=NULL;
- return FAILURE;
- }
-
- res = p = ht->pListHead;
- while ((p = p->pListNext)) {
- if (flag) {
- if (compar(&res, &p TSRMLS_CC) < 0) { /* max */
- res = p;
- }
- } else {
- if (compar(&res, &p TSRMLS_CC) > 0) { /* min */
- res = p;
- }
- }
- }
- *pData = res->pData;
- return SUCCESS;
-}
-
-ZEND_API ulong zend_hash_next_free_element(HashTable *ht)
-{
- IS_CONSISTENT(ht);
-
- return ht->nNextFreeElement;
-
-}
-
-
-#if ZEND_DEBUG
-void zend_hash_display_pListTail(HashTable *ht)
-{
- Bucket *p;
-
- p = ht->pListTail;
- while (p != NULL) {
- zend_output_debug_string(0, "pListTail has key %s\n", p->arKey);
- p = p->pListLast;
- }
-}
-
-void zend_hash_display(HashTable *ht)
-{
- Bucket *p;
- uint i;
-
- for (i = 0; i < ht->nTableSize; i++) {
- p = ht->arBuckets[i];
- while (p != NULL) {
- zend_output_debug_string(0, "%s <==> 0x%X\n", p->arKey, p->h);
- p = p->pNext;
- }
- }
-
- p = ht->pListTail;
- while (p != NULL) {
- zend_output_debug_string(0, "%s <==> 0x%X\n", p->arKey, p->h);
- p = p->pListLast;
- }
-}
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
deleted file mode 100644
index 6962d06629..0000000000
--- a/Zend/zend_hash.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef ZEND_HASH_H
-#define ZEND_HASH_H
-
-#include <sys/types.h>
-#include "zend.h"
-
-#define HASH_KEY_IS_STRING 1
-#define HASH_KEY_IS_LONG 2
-#define HASH_KEY_NON_EXISTANT 3
-
-#define HASH_UPDATE (1<<0)
-#define HASH_ADD (1<<1)
-#define HASH_NEXT_INSERT (1<<2)
-
-#define HASH_DEL_KEY 0
-#define HASH_DEL_INDEX 1
-
-typedef ulong (*hash_func_t)(char *arKey, uint nKeyLength);
-typedef int (*compare_func_t)(const void *, const void * TSRMLS_DC);
-typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t TSRMLS_DC);
-typedef void (*dtor_func_t)(void *pDest);
-typedef void (*copy_ctor_func_t)(void *pElement);
-
-struct _hashtable;
-
-typedef struct bucket {
- ulong h; /* Used for numeric indexing */
- uint nKeyLength;
- void *pData;
- void *pDataPtr;
- struct bucket *pListNext;
- struct bucket *pListLast;
- struct bucket *pNext;
- struct bucket *pLast;
- char arKey[1]; /* Must be last element */
-} Bucket;
-
-typedef struct _hashtable {
- uint nTableSize;
- uint nTableMask;
- uint nNumOfElements;
- ulong nNextFreeElement;
- Bucket *pInternalPointer; /* Used for element traversal */
- Bucket *pListHead;
- Bucket *pListTail;
- Bucket **arBuckets;
- dtor_func_t pDestructor;
- zend_bool persistent;
- unsigned char nApplyCount;
- zend_bool bApplyProtection;
-#if ZEND_DEBUG
- int inconsistent;
-#endif
-} HashTable;
-
-typedef Bucket* HashPosition;
-
-BEGIN_EXTERN_C()
-
-/* startup/shutdown */
-ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC);
-ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC);
-ZEND_API void zend_hash_destroy(HashTable *ht);
-ZEND_API void zend_hash_clean(HashTable *ht);
-#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent) _zend_hash_init((ht), (nSize), (pHashFunction), (pDestructor), (persistent) ZEND_FILE_LINE_CC)
-#define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection) _zend_hash_init_ex((ht), (nSize), (pHashFunction), (pDestructor), (persistent), (bApplyProtection) ZEND_FILE_LINE_CC)
-
-/* additions/updates/changes */
-ZEND_API int zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag);
-#define zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
- zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE)
-#define zend_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
- zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD)
-
-ZEND_API int zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag);
-#define zend_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
- zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE)
-#define zend_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
- zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_ADD)
-
-ZEND_API int zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag);
-#define zend_hash_index_update(ht, h, pData, nDataSize, pDest) \
- zend_hash_index_update_or_next_insert(ht, h, pData, nDataSize, pDest, HASH_UPDATE)
-#define zend_hash_next_index_insert(ht, pData, nDataSize, pDest) \
- zend_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT)
-
-ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLength);
-
-
-#define ZEND_HASH_APPLY_KEEP 0
-#define ZEND_HASH_APPLY_REMOVE 1<<0
-#define ZEND_HASH_APPLY_STOP 1<<1
-
-typedef struct _zend_hash_key {
- char *arKey;
- uint nKeyLength;
- ulong h;
-} zend_hash_key;
-
-
-typedef int (*apply_func_t)(void *pDest TSRMLS_DC);
-typedef int (*apply_func_arg_t)(void *pDest, void *argument TSRMLS_DC);
-typedef int (*apply_func_args_t)(void *pDest, int num_args, va_list args, zend_hash_key *hash_key);
-
-ZEND_API void zend_hash_graceful_destroy(HashTable *ht);
-ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht);
-ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC);
-ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void * TSRMLS_DC);
-ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t apply_func, int, ...);
-
-/* This function should be used with special care (in other words,
- * it should usually not be used). When used with the ZEND_HASH_APPLY_STOP
- * return value, it assumes things about the order of the elements in the hash.
- * Also, it does not provide the same kind of reentrancy protection that
- * the standard apply functions do.
- */
-ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC);
-
-
-/* Deletes */
-ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag);
-#define zend_hash_del(ht, arKey, nKeyLength) \
- zend_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY)
-#define zend_hash_index_del(ht, h) \
- zend_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX)
-
-ZEND_API ulong zend_get_hash_value(HashTable *ht, char *arKey, uint nKeyLength);
-
-/* Data retreival */
-ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData);
-ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData);
-ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData);
-
-/* Misc */
-ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength);
-ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h);
-ZEND_API ulong zend_hash_next_free_element(HashTable *ht);
-
-/* traversing */
-ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos);
-ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos);
-ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos);
-ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos);
-ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos);
-ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos);
-ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos);
-
-#define zend_hash_move_forward(ht) \
- zend_hash_move_forward_ex(ht, NULL)
-#define zend_hash_move_backwards(ht) \
- zend_hash_move_backwards_ex(ht, NULL)
-#define zend_hash_get_current_key(ht, str_index, num_index, duplicate) \
- zend_hash_get_current_key_ex(ht, str_index, NULL, num_index, duplicate, NULL)
-#define zend_hash_get_current_key_type(ht) \
- zend_hash_get_current_key_type_ex(ht, NULL)
-#define zend_hash_get_current_data(ht, pData) \
- zend_hash_get_current_data_ex(ht, pData, NULL)
-#define zend_hash_internal_pointer_reset(ht) \
- zend_hash_internal_pointer_reset_ex(ht, NULL)
-#define zend_hash_internal_pointer_end(ht) \
- zend_hash_internal_pointer_end_ex(ht, NULL)
-
-/* Copying, merging and sorting */
-ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size);
-ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite);
-ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, zend_bool (*pReplaceOrig)(void *orig, void *p_new));
-ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC);
-ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC);
-ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC);
-
-ZEND_API int zend_hash_num_elements(HashTable *ht);
-
-ZEND_API int zend_hash_rehash(HashTable *ht);
-
-/*
- * DJBX33A (Daniel J. Bernstein, Times 33 with Addition)
- *
- * This is Daniel J. Bernstein's popular `times 33' hash function as
- * posted by him years ago on comp.lang.c. It basically uses a function
- * like ``hash(i) = hash(i-1) * 33 + str[i]''. This is one of the best
- * known hash functions for strings. Because it is both computed very
- * fast and distributes very well.
- *
- * The magic of number 33, i.e. why it works better than many other
- * constants, prime or not, has never been adequately explained by
- * anyone. So I try an explanation: if one experimentally tests all
- * multipliers between 1 and 256 (as RSE did now) one detects that even
- * numbers are not useable at all. The remaining 128 odd numbers
- * (except for the number 1) work more or less all equally well. They
- * all distribute in an acceptable way and this way fill a hash table
- * with an average percent of approx. 86%.
- *
- * If one compares the Chi^2 values of the variants, the number 33 not
- * even has the best value. But the number 33 and a few other equally
- * good numbers like 17, 31, 63, 127 and 129 have nevertheless a great
- * advantage to the remaining numbers in the large set of possible
- * multipliers: their multiply operation can be replaced by a faster
- * operation based on just one shift plus either a single addition
- * or subtraction operation. And because a hash function has to both
- * distribute good _and_ has to be very fast to compute, those few
- * numbers should be preferred and seems to be the reason why Daniel J.
- * Bernstein also preferred it.
- *
- *
- * -- Ralf S. Engelschall <rse@engelschall.com>
- */
-
-static inline ulong zend_inline_hash_func(char *arKey, uint nKeyLength)
-{
- register ulong hash = 5381;
-
- /* variant with the hash unrolled eight times */
- for (; nKeyLength >= 8; nKeyLength -= 8) {
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- }
- switch (nKeyLength) {
- case 7: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 6: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 5: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 4: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 3: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 2: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 1: hash = ((hash << 5) + hash) + *arKey++; break;
- case 0: break;
-EMPTY_SWITCH_DEFAULT_CASE()
- }
- return hash;
-}
-
-
-ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength);
-
-#if ZEND_DEBUG
-/* debug */
-void zend_hash_display_pListTail(HashTable *ht);
-void zend_hash_display(HashTable *ht);
-#endif
-
-END_EXTERN_C()
-
-#define ZEND_INIT_SYMTABLE(ht) \
- ZEND_INIT_SYMTABLE_EX(ht, 2, 0)
-
-#define ZEND_INIT_SYMTABLE_EX(ht, n, persistent) \
- zend_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent)
-
-
-#endif /* ZEND_HASH_H */
diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c
deleted file mode 100644
index 79f56fd87d..0000000000
--- a/Zend/zend_highlight.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "zend.h"
-#include "zend_language_parser.h"
-#include "zend_compile.h"
-#include "zend_highlight.h"
-#include "zend_ptr_stack.h"
-#include "zend_globals.h"
-
-ZEND_API void zend_html_putc(char c)
-{
- switch (c) {
- case '\n':
- ZEND_PUTS("<br />");
- break;
- case '<':
- ZEND_PUTS("&lt;");
- break;
- case '>':
- ZEND_PUTS("&gt;");
- break;
- case '&':
- ZEND_PUTS("&amp;");
- break;
- case ' ':
- ZEND_PUTS("&nbsp;");
- break;
- case '\t':
- ZEND_PUTS("&nbsp;&nbsp;&nbsp;&nbsp;");
- break;
- default:
- ZEND_PUTC(c);
- break;
- }
-}
-
-
-ZEND_API void zend_html_puts(const char *s, uint len)
-{
- const char *ptr=s, *end=s+len;
-
- while (ptr<end) {
- if (*ptr==' ') {
- /* Series of spaces should be displayed as &nbsp;'s
- * whereas single spaces should be displayed as a space
- */
- if ((ptr+1) < end && *(ptr+1)==' ') {
- do {
- zend_html_putc(*ptr);
- } while ((++ptr < end) && (*ptr==' '));
- } else {
- ZEND_PUTC(*ptr);
- ptr++;
- }
- } else {
- zend_html_putc(*ptr++);
- }
- }
-}
-
-
-
-ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC)
-{
- zval token;
- int token_type;
- char *last_color = syntax_highlighter_ini->highlight_html;
- char *next_color;
- int in_string=0;
-
- zend_printf("<code>");
- zend_printf("<font color=\"%s\">\n", last_color);
- /* highlight stuff coming back from zendlex() */
- token.type = 0;
- while ((token_type=lex_scan(&token TSRMLS_CC))) {
- switch (token_type) {
- case T_INLINE_HTML:
- next_color = syntax_highlighter_ini->highlight_html;
- break;
- case T_COMMENT:
- next_color = syntax_highlighter_ini->highlight_comment;
- break;
- case T_OPEN_TAG:
- case T_OPEN_TAG_WITH_ECHO:
- next_color = syntax_highlighter_ini->highlight_default;
- break;
- case T_CLOSE_TAG:
- next_color = syntax_highlighter_ini->highlight_default;
- break;
- case T_CONSTANT_ENCAPSED_STRING:
- next_color = syntax_highlighter_ini->highlight_string;
- break;
- case '"':
- next_color = syntax_highlighter_ini->highlight_string;
- in_string = !in_string;
- break;
- case T_WHITESPACE:
- zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng)); /* no color needed */
- token.type = 0;
- continue;
- break;
- default:
- if (token.type==0) {
- next_color = syntax_highlighter_ini->highlight_keyword;
- } else {
- if (in_string) {
- next_color = syntax_highlighter_ini->highlight_string;
- } else {
- next_color = syntax_highlighter_ini->highlight_default;
- }
- }
- break;
- }
-
- if (last_color != next_color) {
- if (last_color != syntax_highlighter_ini->highlight_html) {
- zend_printf("</font>");
- }
- last_color = next_color;
- if (last_color != syntax_highlighter_ini->highlight_html) {
- zend_printf("<font color=\"%s\">", last_color);
- }
- }
- switch (token_type) {
- case T_END_HEREDOC:
- zend_html_puts(token.value.str.val, token.value.str.len);
- break;
- default:
- zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
- break;
- }
-
- if (token.type == IS_STRING) {
- switch (token_type) {
- case T_OPEN_TAG:
- case T_OPEN_TAG_WITH_ECHO:
- case T_CLOSE_TAG:
- case T_WHITESPACE:
- case T_COMMENT:
- break;
- default:
- efree(token.value.str.val);
- break;
- }
- } else if (token_type == T_END_HEREDOC) {
- zend_bool has_semicolon=(strchr(token.value.str.val, ';')?1:0);
-
- efree(token.value.str.val);
- if (has_semicolon) {
- /* the following semicolon was unput(), ignore it */
- lex_scan(&token TSRMLS_CC);
- }
- }
- token.type = 0;
- }
- if (last_color != syntax_highlighter_ini->highlight_html) {
- zend_printf("</font>\n");
- }
- zend_printf("</font>\n");
- zend_printf("</code>");
-}
-
-
-
-ZEND_API void zend_strip(TSRMLS_D)
-{
- zval token;
- int token_type;
-
- token.type = 0;
- while ((token_type=lex_scan(&token TSRMLS_CC))) {
- switch (token_type) {
- case T_COMMENT:
- token.type = 0;
- continue;
-
- case T_WHITESPACE:
- if (token.type) {
- putchar(' ');
- token.type = 0;
- }
- continue;
- }
-
- switch (token_type) {
- case 349:
- break;
-
- default: {
- char c, *ptr=LANG_SCNG(yy_text), *end=LANG_SCNG(yy_text)+LANG_SCNG(yy_leng);
- while (ptr<end) {
- c = *ptr++;
- putchar(c);
- }
- }
- break;
- }
-
- if (token.type == IS_STRING) {
- switch (token_type) {
- case T_OPEN_TAG:
- case T_OPEN_TAG_WITH_ECHO:
- case T_CLOSE_TAG:
- case T_WHITESPACE:
- case T_COMMENT:
- break;
-
- default:
- efree(token.value.str.val);
- break;
- }
- } else if (token_type == T_END_HEREDOC) {
- zend_bool has_semicolon=(strchr(token.value.str.val, ';')?1:0);
-
- efree(token.value.str.val);
- if (has_semicolon) {
- /* the following semicolon was unput(), ignore it */
- lex_scan(&token TSRMLS_CC);
- }
- }
- token.type = 0;
- }
-}
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h
deleted file mode 100644
index 4c3d3dfaae..0000000000
--- a/Zend/zend_highlight.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_HIGHLIGHT_H
-#define ZEND_HIGHLIGHT_H
-
-#define HL_COMMENT_COLOR "#FF8000" /* orange */
-#define HL_DEFAULT_COLOR "#0000BB" /* blue */
-#define HL_HTML_COLOR "#000000" /* black */
-#define HL_STRING_COLOR "#DD0000" /* red */
-#define HL_BG_COLOR "#FFFFFF" /* white */
-#define HL_KEYWORD_COLOR "#007700" /* green */
-
-
-typedef struct _zend_syntax_highlighter_ini {
- char *highlight_html;
- char *highlight_comment;
- char *highlight_default;
- char *highlight_string;
- char *highlight_keyword;
-} zend_syntax_highlighter_ini;
-
-
-BEGIN_EXTERN_C()
-ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC);
-ZEND_API void zend_strip(TSRMLS_D);
-ZEND_API int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC);
-ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC);
-ZEND_API void zend_html_putc(char c);
-ZEND_API void zend_html_puts(const char *s, uint len);
-END_EXTERN_C()
-
-extern zend_syntax_highlighter_ini syntax_highlighter_ini;
-
-#endif
diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c
deleted file mode 100644
index 71f1fb7077..0000000000
--- a/Zend/zend_indent.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-/* This indenter doesn't really work, it's here for no particular reason. */
-
-
-#include "zend.h"
-#include "zend_language_parser.h"
-#include "zend_compile.h"
-#include "zend_indent.h"
-
-#define zendtext LANG_SCNG(yy_text)
-#define zendleng LANG_SCNG(yy_leng)
-
-
-static void handle_whitespace(int *emit_whitespace)
-{
- unsigned char c;
- int i;
-
- for (c=0; c<128; c++) {
- if (emit_whitespace[c]>0) {
- for (i=0; i<emit_whitespace[c]; i++) {
- zend_write((char *) &c, 1);
- }
- }
- }
- memset(emit_whitespace, 0, sizeof(int)*256);
-}
-
-
-ZEND_API void zend_indent()
-{
- zval token;
- int token_type;
- int in_string=0;
- int nest_level=0;
- int emit_whitespace[256];
- int i;
- TSRMLS_FETCH();
-
- memset(emit_whitespace, 0, sizeof(int)*256);
-
- /* highlight stuff coming back from zendlex() */
- token.type = 0;
- while ((token_type=lex_scan(&token TSRMLS_CC))) {
- switch (token_type) {
- case T_INLINE_HTML:
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
- break;
- case T_WHITESPACE: {
- token.type = 0;
- /* eat whitespace, emit newlines */
- for (i=0; i<LANG_SCNG(yy_leng); i++) {
- emit_whitespace[(unsigned char) LANG_SCNG(yy_text)[i]]++;
- }
- continue;
- }
- break;
- case '"':
- in_string = !in_string;
- /* break missing intentionally */
- default:
- if (token.type==0) {
- /* keyword */
- switch(token_type) {
- case ',':
- ZEND_PUTS(", ");
- goto dflt_printout;
- break;
- case '{':
- nest_level++;
- if (emit_whitespace['\n']>0) {
- ZEND_PUTS(" {\n");
- memset(emit_whitespace, 0, sizeof(int)*256);
- } else {
- ZEND_PUTS("{");
- }
- break;
- case '}':
- nest_level--;
- if (emit_whitespace['\n']==0) {
- ZEND_PUTS("\n");
- }
- for (i=0; i<nest_level; i++) {
- ZEND_PUTS(" ");
- }
- goto dflt_printout;
- break;
-dflt_printout:
- default:
- if (emit_whitespace['\n']>0) {
- for (i=0; i<emit_whitespace['\n']; i++) {
- ZEND_PUTS("\n");
- }
- memset(emit_whitespace, 0, sizeof(int)*256);
- for (i=0; i<nest_level; i++) {
- ZEND_PUTS(" ");
- }
- } else {
- handle_whitespace(emit_whitespace);
- }
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
- break;
- }
- } else {
- handle_whitespace(emit_whitespace);
- if (in_string) {
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
- /* a part of a string */
- } else {
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
- }
- }
- break;
- }
- if (token.type == IS_STRING) {
- switch (token_type) {
- case T_OPEN_TAG:
- case T_CLOSE_TAG:
- case T_WHITESPACE:
- break;
- default:
- efree(token.value.str.val);
- break;
- }
- }
- token.type = 0;
- }
-}
diff --git a/Zend/zend_indent.h b/Zend/zend_indent.h
deleted file mode 100644
index e3f1548431..0000000000
--- a/Zend/zend_indent.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_INDENT_H
-#define ZEND_INDENT_H
-
-ZEND_API void zend_indent(void);
-
-#endif /* ZEND_INDENT_H */
diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c
deleted file mode 100644
index 19a3453daf..0000000000
--- a/Zend/zend_ini.c
+++ /dev/null
@@ -1,509 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include "zend.h"
-#include "zend_qsort.h"
-#include "zend_API.h"
-#include "zend_ini.h"
-#include "zend_alloc.h"
-#include "zend_operators.h"
-
-static HashTable *registered_zend_ini_directives;
-
-#define NO_VALUE_PLAINTEXT "no value"
-#define NO_VALUE_HTML "<i>no value</i>"
-
-/*
- * hash_apply functions
- */
-static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number TSRMLS_DC)
-{
- if (ini_entry->module_number == *module_number) {
- return 1;
- } else {
- return 0;
- }
-}
-
-
-static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS_DC)
-{
- if (ini_entry->modified) {
- if (ini_entry->on_modify) {
- ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC);
- }
- efree(ini_entry->value);
- ini_entry->value = ini_entry->orig_value;
- ini_entry->value_length = ini_entry->orig_value_length;
- ini_entry->modified = 0;
- ini_entry->orig_value = NULL;
- ini_entry->orig_value_length = 0;
- }
- return 0;
-}
-
-/*
- * Startup / shutdown
- */
-ZEND_API int zend_ini_startup(TSRMLS_D)
-{
- registered_zend_ini_directives = (HashTable *) malloc(sizeof(HashTable));
-
- EG(ini_directives) = registered_zend_ini_directives;
- if (zend_hash_init_ex(registered_zend_ini_directives, 100, NULL, NULL, 1, 0)==FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int zend_ini_shutdown(TSRMLS_D)
-{
- zend_hash_destroy(EG(ini_directives));
- return SUCCESS;
-}
-
-
-ZEND_API int zend_ini_deactivate(TSRMLS_D)
-{
- zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_restore_ini_entry_cb, (void *) ZEND_INI_STAGE_DEACTIVATE TSRMLS_CC);
- return SUCCESS;
-}
-
-
-#ifdef ZTS
-ZEND_API int zend_copy_ini_directives(TSRMLS_D)
-{
- zend_ini_entry ini_entry;
-
- EG(ini_directives) = (HashTable *) malloc(sizeof(HashTable));
- if (zend_hash_init_ex(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0)==FAILURE) {
- return FAILURE;
- }
- zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, NULL, &ini_entry, sizeof(zend_ini_entry));
- zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC);
- return SUCCESS;
-}
-#endif
-
-
-static int ini_key_compare(const void *a, const void *b TSRMLS_DC)
-{
- Bucket *f;
- Bucket *s;
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- if (f->nKeyLength==0 && s->nKeyLength==0) { /* both numeric */
- return ZEND_NORMALIZE_BOOL(f->nKeyLength - s->nKeyLength);
- } else if (f->nKeyLength==0) { /* f is numeric, s is not */
- return -1;
- } else if (s->nKeyLength==0) { /* s is numeric, f is not */
- return 1;
- } else { /* both strings */
- return zend_binary_strcasecmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength);
- }
-}
-
-
-ZEND_API void zend_ini_sort_entries(TSRMLS_D)
-{
- zend_hash_sort(EG(ini_directives), zend_qsort, ini_key_compare, 0 TSRMLS_CC);
-}
-
-/*
- * Registration / unregistration
- */
-
-ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number TSRMLS_DC)
-{
- zend_ini_entry *p = ini_entry;
- zend_ini_entry *hashed_ini_entry;
- zval default_value;
-
- while (p->name) {
- p->module_number = module_number;
- if (zend_hash_add(registered_zend_ini_directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
- zend_unregister_ini_entries(module_number TSRMLS_CC);
- return FAILURE;
- }
- if ((zend_get_configuration_directive(p->name, p->name_length, &default_value))==SUCCESS) {
- if (!hashed_ini_entry->on_modify
- || hashed_ini_entry->on_modify(hashed_ini_entry, default_value.value.str.val, default_value.value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC)==SUCCESS) {
- hashed_ini_entry->value = default_value.value.str.val;
- hashed_ini_entry->value_length = default_value.value.str.len;
- }
- } else {
- if (hashed_ini_entry->on_modify) {
- hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
- }
- }
- p++;
- }
- return SUCCESS;
-}
-
-
-ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC)
-{
- zend_hash_apply_with_argument(registered_zend_ini_directives, (apply_func_arg_t) zend_remove_ini_entries, (void *) &module_number TSRMLS_CC);
-}
-
-
-static int zend_ini_refresh_cache(zend_ini_entry *p, int stage TSRMLS_DC)
-{
- if (p->on_modify) {
- p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage TSRMLS_CC);
- }
- return 0;
-}
-
-
-ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC)
-{
- zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_ini_refresh_cache, (void *)(long) stage TSRMLS_CC);
-}
-
-
-ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage)
-{
- zend_ini_entry *ini_entry;
- char *duplicate;
- TSRMLS_FETCH();
-
- if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) {
- return FAILURE;
- }
-
- if (!(ini_entry->modifyable & modify_type)) {
- return FAILURE;
- }
-
- duplicate = estrndup(new_value, new_value_length);
-
- if (!ini_entry->on_modify
- || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC)==SUCCESS) {
- if (!ini_entry->modified) {
- ini_entry->orig_value = ini_entry->value;
- ini_entry->orig_value_length = ini_entry->value_length;
- } else { /* we already changed the value, free the changed value */
- efree(ini_entry->value);
- }
- ini_entry->value = duplicate;
- ini_entry->value_length = new_value_length;
- ini_entry->modified = 1;
- } else {
- efree(duplicate);
- }
-
- return SUCCESS;
-}
-
-
-ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage)
-{
- zend_ini_entry *ini_entry;
- TSRMLS_FETCH();
-
- if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) {
- return FAILURE;
- }
-
- zend_restore_ini_entry_cb(ini_entry, stage TSRMLS_CC);
- return SUCCESS;
-}
-
-
-ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type))
-{
- zend_ini_entry *ini_entry;
-
- if (zend_hash_find(registered_zend_ini_directives, name, name_length, (void **) &ini_entry)==FAILURE) {
- return FAILURE;
- }
-
- ini_entry->displayer = displayer;
- return SUCCESS;
-}
-
-
-
-/*
- * Data retrieval
- */
-
-ZEND_API long zend_ini_long(char *name, uint name_length, int orig)
-{
- zend_ini_entry *ini_entry;
- TSRMLS_FETCH();
-
- if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
- if (orig && ini_entry->modified) {
- return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0);
- } else if (ini_entry->value) {
- return strtol(ini_entry->value, NULL, 0);
- }
- }
-
- return 0;
-}
-
-
-ZEND_API double zend_ini_double(char *name, uint name_length, int orig)
-{
- zend_ini_entry *ini_entry;
- TSRMLS_FETCH();
-
- if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
- if (orig && ini_entry->modified) {
- return (double) (ini_entry->orig_value ? strtod(ini_entry->orig_value, NULL) : 0.0);
- } else if (ini_entry->value) {
- return (double) strtod(ini_entry->value, NULL);
- }
- }
-
- return 0.0;
-}
-
-
-ZEND_API char *zend_ini_string(char *name, uint name_length, int orig)
-{
- zend_ini_entry *ini_entry;
- TSRMLS_FETCH();
-
- if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
- if (orig && ini_entry->modified) {
- return ini_entry->orig_value;
- } else {
- return ini_entry->value;
- }
- }
-
- return "";
-}
-
-
-static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type)
-{
- if (ini_entry->displayer) {
- ini_entry->displayer(ini_entry, type);
- } else {
- char *display_string;
- uint display_string_length;
-
- if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
- if (ini_entry->orig_value) {
- display_string = ini_entry->orig_value;
- display_string_length = ini_entry->orig_value_length;
- } else {
- if (zend_uv.html_errors) {
- display_string = NO_VALUE_HTML;
- display_string_length = sizeof(NO_VALUE_HTML)-1;
- } else {
- display_string = NO_VALUE_PLAINTEXT;
- display_string_length = sizeof(NO_VALUE_PLAINTEXT)-1;
- }
- }
- } else if (ini_entry->value && ini_entry->value[0]) {
- display_string = ini_entry->value;
- display_string_length = ini_entry->value_length;
- } else {
- if (zend_uv.html_errors) {
- display_string = NO_VALUE_HTML;
- display_string_length = sizeof(NO_VALUE_HTML)-1;
- } else {
- display_string = NO_VALUE_PLAINTEXT;
- display_string_length = sizeof(NO_VALUE_PLAINTEXT)-1;
- }
- }
- ZEND_WRITE(display_string, display_string_length);
- }
-}
-
-
-ZEND_INI_DISP(zend_ini_boolean_displayer_cb)
-{
- int value;
-
- if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = (ini_entry->orig_value ? atoi(ini_entry->orig_value) : 0);
- } else if (ini_entry->value) {
- value = atoi(ini_entry->value);
- } else {
- value = 0;
- }
- if (value) {
- ZEND_PUTS("On");
- } else {
- ZEND_PUTS("Off");
- }
-}
-
-
-ZEND_INI_DISP(zend_ini_color_displayer_cb)
-{
- char *value;
-
- if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
- if (value) {
- if (zend_uv.html_errors) {
- zend_printf("<font style=\"color: %s\">%s</font>", value, value);
- } else {
- ZEND_PUTS(value);
- }
- } else {
- if (zend_uv.html_errors) {
- ZEND_PUTS(NO_VALUE_HTML);
- } else {
- ZEND_PUTS(NO_VALUE_PLAINTEXT);
- }
- }
-}
-
-
-ZEND_INI_DISP(display_link_numbers)
-{
- char *value;
-
- if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (value) {
- if (atoi(value)==-1) {
- ZEND_PUTS("Unlimited");
- } else {
- zend_printf("%s", value);
- }
- }
-}
-
-
-/* Standard message handlers */
-
-ZEND_API ZEND_INI_MH(OnUpdateBool)
-{
- zend_bool *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (zend_bool *) (base+(size_t) mh_arg1);
-
- *p = (zend_bool) atoi(new_value);
- return SUCCESS;
-}
-
-
-ZEND_API ZEND_INI_MH(OnUpdateInt)
-{
- long *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (long *) (base+(size_t) mh_arg1);
-
- *p = zend_atoi(new_value, new_value_length);
- return SUCCESS;
-}
-
-
-ZEND_API ZEND_INI_MH(OnUpdateReal)
-{
- double *p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (double *) (base+(size_t) mh_arg1);
-
- *p = strtod(new_value, NULL);
- return SUCCESS;
-}
-
-
-ZEND_API ZEND_INI_MH(OnUpdateString)
-{
- char **p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- p = (char **) (base+(size_t) mh_arg1);
-
- *p = new_value;
- return SUCCESS;
-}
-
-
-ZEND_API ZEND_INI_MH(OnUpdateStringUnempty)
-{
- char **p;
-#ifndef ZTS
- char *base = (char *) mh_arg2;
-#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
- if (new_value && !new_value[0]) {
- return FAILURE;
- }
-
- p = (char **) (base+(size_t) mh_arg1);
-
- *p = new_value;
- return SUCCESS;
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h
deleted file mode 100644
index b1317a48c4..0000000000
--- a/Zend/zend_ini.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_INI_H
-#define ZEND_INI_H
-
-#define ZEND_INI_USER (1<<0)
-#define ZEND_INI_PERDIR (1<<1)
-#define ZEND_INI_SYSTEM (1<<2)
-
-#define ZEND_INI_ALL (ZEND_INI_USER|ZEND_INI_PERDIR|ZEND_INI_SYSTEM)
-
-#ifndef XtOffsetOf
-# if defined(CRAY) || (defined(__arm) && !defined(LINUX))
-# ifdef __STDC__
-# define XtOffset(p_type, field) _Offsetof(p_type, field)
-# else
-# ifdef CRAY2
-# define XtOffset(p_type, field) \
- (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
-
-# else /* !CRAY2 */
-
-# define XtOffset(p_type, field) ((unsigned int)&(((p_type)NULL)->field))
-
-# endif /* !CRAY2 */
-# endif /* __STDC__ */
-# else /* ! (CRAY || __arm) */
-
-# define XtOffset(p_type, field) \
- ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
-
-# endif /* !CRAY */
-
-# ifdef offsetof
-# define XtOffsetOf(s_type, field) offsetof(s_type, field)
-# else
-# define XtOffsetOf(s_type, field) XtOffset(s_type*, field)
-# endif
-
-#endif
-
-typedef struct _zend_ini_entry zend_ini_entry;
-
-#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC)
-#define ZEND_INI_DISP(name) void name(zend_ini_entry *ini_entry, int type)
-
-struct _zend_ini_entry {
- int module_number;
- int modifyable;
- char *name;
- uint name_length;
- ZEND_INI_MH((*on_modify));
- void *mh_arg1;
- void *mh_arg2;
- void *mh_arg3;
-
- char *value;
- uint value_length;
-
- char *orig_value;
- uint orig_value_length;
- int modified;
-
- void (*displayer)(zend_ini_entry *ini_entry, int type);
-};
-
-
-ZEND_API int zend_ini_startup(TSRMLS_D);
-ZEND_API int zend_ini_shutdown(TSRMLS_D);
-ZEND_API int zend_ini_deactivate(TSRMLS_D);
-
-ZEND_API int zend_copy_ini_directives(TSRMLS_D);
-
-ZEND_API void zend_ini_sort_entries(TSRMLS_D);
-
-ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number TSRMLS_DC);
-ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC);
-ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC);
-ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage);
-ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage);
-ZEND_API void display_ini_entries(zend_module_entry *module);
-
-ZEND_API long zend_ini_long(char *name, uint name_length, int orig);
-ZEND_API double zend_ini_double(char *name, uint name_length, int orig);
-ZEND_API char *zend_ini_string(char *name, uint name_length, int orig);
-
-ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type));
-
-ZEND_API ZEND_INI_DISP(zend_ini_boolean_displayer_cb);
-ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb);
-ZEND_API ZEND_INI_DISP(display_link_numbers);
-
-#define ZEND_INI_BEGIN() static zend_ini_entry ini_entries[] = {
-#define ZEND_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, NULL } };
-
-#define ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, displayer) \
- { 0, modifyable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, displayer },
-
-#define ZEND_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, arg3) \
- ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, NULL)
-
-#define ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, displayer) \
- ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL, displayer)
-
-#define ZEND_INI_ENTRY2(name, default_value, modifyable, on_modify, arg1, arg2) \
- ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL)
-
-#define ZEND_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, displayer) \
- ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, NULL, NULL, displayer)
-
-#define ZEND_INI_ENTRY1(name, default_value, modifyable, on_modify, arg1) \
- ZEND_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, NULL)
-
-#define ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, displayer) \
- ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, NULL, NULL, NULL, displayer)
-
-#define ZEND_INI_ENTRY(name, default_value, modifyable, on_modify) \
- ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, NULL)
-
-#ifdef ZTS
-#define STD_ZEND_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
- ZEND_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id)
-#define STD_ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \
- ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, displayer)
-#define STD_ZEND_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
- ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, NULL, zend_ini_boolean_displayer_cb)
-#else
-#define STD_ZEND_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
- ZEND_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr)
-#define STD_ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \
- ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, displayer)
-#define STD_ZEND_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
- ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, zend_ini_boolean_displayer_cb)
-#endif
-
-#define INI_INT(name) zend_ini_long((name), sizeof(name), 0)
-#define INI_FLT(name) zend_ini_double((name), sizeof(name), 0)
-#define INI_STR(name) zend_ini_string((name), sizeof(name), 0)
-#define INI_BOOL(name) ((zend_bool) INI_INT(name))
-
-#define INI_ORIG_INT(name) zend_ini_long((name), sizeof(name), 1)
-#define INI_ORIG_FLT(name) zend_ini_double((name), sizeof(name), 1)
-#define INI_ORIG_STR(name) zend_ini_string((name), sizeof(name), 1)
-#define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name))
-
-
-#define REGISTER_INI_ENTRIES() zend_register_ini_entries(ini_entries, module_number TSRMLS_CC)
-#define UNREGISTER_INI_ENTRIES() zend_unregister_ini_entries(module_number TSRMLS_CC)
-#define DISPLAY_INI_ENTRIES() display_ini_entries(zend_module)
-
-#define REGISTER_INI_DISPLAYER(name, displayer) zend_ini_register_displayer((name), sizeof(name), displayer)
-#define REGISTER_INI_BOOLEAN(name) REGISTER_INI_DISPLAYER(name, zend_ini_boolean_displayer_cb)
-
-/* Standard message handlers */
-ZEND_API ZEND_INI_MH(OnUpdateBool);
-ZEND_API ZEND_INI_MH(OnUpdateInt);
-ZEND_API ZEND_INI_MH(OnUpdateReal);
-ZEND_API ZEND_INI_MH(OnUpdateString);
-ZEND_API ZEND_INI_MH(OnUpdateStringUnempty);
-
-
-#define ZEND_INI_DISPLAY_ORIG 1
-#define ZEND_INI_DISPLAY_ACTIVE 2
-
-#define ZEND_INI_STAGE_STARTUP (1<<0)
-#define ZEND_INI_STAGE_SHUTDOWN (1<<1)
-#define ZEND_INI_STAGE_ACTIVATE (1<<2)
-#define ZEND_INI_STAGE_DEACTIVATE (1<<3)
-#define ZEND_INI_STAGE_RUNTIME (1<<4)
-
-/* INI parsing engine */
-typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, int callback_type, void *arg);
-int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg);
-#define ZEND_INI_PARSER_ENTRY 1
-#define ZEND_INI_PARSER_SECTION 2
-
-typedef struct _zend_ini_parser_param {
- zend_ini_parser_cb_t ini_parser_cb;
- void *arg;
-} zend_ini_parser_param;
-
-#endif /* ZEND_INI_H */
diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y
deleted file mode 100644
index 23f4054e09..0000000000
--- a/Zend/zend_ini_parser.y
+++ /dev/null
@@ -1,236 +0,0 @@
-%{
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-/* $Id$ */
-
-#define DEBUG_CFG_PARSER 0
-#include "zend.h"
-#include "zend_API.h"
-#include "zend_ini.h"
-#include "zend_constants.h"
-#include "zend_ini_scanner.h"
-#include "zend_extensions.h"
-
-
-#if WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <winbase.h>
-#endif
-
-#define YYSTYPE zval
-
-#ifdef ZTS
-#define YYPARSE_PARAM tsrm_ls
-#define YYLEX_PARAM tsrm_ls
-#endif
-
-#define ZEND_INI_PARSER_CB (CG(ini_parser_param))->ini_parser_cb
-#define ZEND_INI_PARSER_ARG (CG(ini_parser_param))->arg
-
-int ini_lex(zval *ini_lval TSRMLS_DC);
-#ifdef ZTS
-int ini_parse(void *arg);
-#else
-int ini_parse(void);
-#endif
-
-zval yylval;
-
-#ifndef ZTS
-extern int ini_lex(zval *ini_lval TSRMLS_DC);
-extern FILE *ini_in;
-extern int ini_lineno;
-extern void init_cfg_scanner(void);
-#endif
-
-void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
-{
- int i_result;
- int i_op1, i_op2;
- char str_result[MAX_LENGTH_OF_LONG];
-
- i_op1 = atoi(op1->value.str.val);
- free(op1->value.str.val);
- if (op2) {
- i_op2 = atoi(op2->value.str.val);
- free(op2->value.str.val);
- } else {
- i_op2 = 0;
- }
-
- switch (type) {
- case '|':
- i_result = i_op1 | i_op2;
- break;
- case '&':
- i_result = i_op1 & i_op2;
- break;
- case '~':
- i_result = ~i_op1;
- break;
- case '!':
- i_result = !i_op1;
- break;
- default:
- i_result = 0;
- break;
- }
-
- result->value.str.len = zend_sprintf(str_result, "%d", i_result);
- result->value.str.val = (char *) malloc(result->value.str.len+1);
- memcpy(result->value.str.val, str_result, result->value.str.len);
- result->value.str.val[result->value.str.len] = 0;
- result->type = IS_STRING;
-}
-
-
-void zend_ini_get_constant(zval *result, zval *name)
-{
- zval z_constant;
- TSRMLS_FETCH();
-
- if (zend_get_constant(name->value.str.val, name->value.str.len, &z_constant TSRMLS_CC)) {
- /* z_constant is emalloc()'d */
- convert_to_string(&z_constant);
- result->value.str.val = zend_strndup(z_constant.value.str.val, z_constant.value.str.len);
- result->value.str.len = z_constant.value.str.len;
- result->type = z_constant.type;
- zval_dtor(&z_constant);
- free(name->value.str.val);
- } else {
- *result = *name;
- }
-}
-
-
-static void ini_error(char *str)
-{
- char *error_buf;
- int error_buf_len;
- char *currently_parsed_filename;
- TSRMLS_FETCH();
-
- currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C);
- error_buf_len = 128+strlen(currently_parsed_filename); /* should be more than enough */
- error_buf = (char *) emalloc(error_buf_len);
-
- sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C));
-
- if (CG(ini_parser_unbuffered_errors)) {
-#ifdef PHP_WIN32
- MessageBox(NULL, error_buf, "PHP Error", MB_OK|MB_TOPMOST|0x00200000L);
-#else
- fprintf(stderr, "PHP: %s", error_buf);
-#endif
- } else {
- zend_error(E_CORE_WARNING, error_buf);
- }
- efree(error_buf);
-}
-
-
-int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg)
-{
- int retval;
- zend_ini_parser_param ini_parser_param;
- TSRMLS_FETCH();
-
- ini_parser_param.ini_parser_cb = ini_parser_cb;
- ini_parser_param.arg = arg;
-
- CG(ini_parser_param) = &ini_parser_param;
- if (zend_ini_open_file_for_scanning(fh TSRMLS_CC)==FAILURE) {
- return FAILURE;
- }
-
- CG(ini_parser_unbuffered_errors) = unbuffered_errors;
- retval = ini_parse(TSRMLS_C);
-
- zend_ini_close_file(fh TSRMLS_CC);
-
- if (retval==0) {
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-
-%}
-
-%pure_parser
-%token TC_STRING
-%token TC_ENCAPSULATED_STRING
-%token SECTION
-%token CFG_TRUE
-%token CFG_FALSE
-%left '|' '&'
-%right '~' '!'
-
-%%
-
-statement_list:
- statement_list statement
- | /* empty */
-;
-
-statement:
- TC_STRING '=' string_or_value {
-#if DEBUG_CFG_PARSER
- printf("'%s' = '%s'\n", $1.value.str.val, $3.value.str.val);
-#endif
- ZEND_INI_PARSER_CB(&$1, &$3, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG);
- free($1.value.str.val);
- free($3.value.str.val);
- }
- | TC_STRING { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free($1.value.str.val); }
- | SECTION { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free($1.value.str.val); }
- | '\n'
-;
-
-
-string_or_value:
- expr { $$ = $1; }
- | TC_ENCAPSULATED_STRING { $$ = $1; }
- | CFG_TRUE { $$ = $1; }
- | CFG_FALSE { $$ = $1; }
- | '\n' { $$.value.str.val = strdup(""); $$.value.str.len=0; $$.type = IS_STRING; }
- | '\0' { $$.value.str.val = strdup(""); $$.value.str.len=0; $$.type = IS_STRING; }
-;
-
-expr:
- constant_string { $$ = $1; }
- | expr '|' expr { zend_ini_do_op('|', &$$, &$1, &$3); }
- | expr '&' expr { zend_ini_do_op('&', &$$, &$1, &$3); }
- | '~' expr { zend_ini_do_op('~', &$$, &$2, NULL); }
- | '!' expr { zend_ini_do_op('!', &$$, &$2, NULL); }
- | '(' expr ')' { $$ = $2; }
-;
-
-constant_string:
- TC_STRING { zend_ini_get_constant(&$$, &$1); }
-;
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_ini_scanner.h b/Zend/zend_ini_scanner.h
deleted file mode 100644
index c683f0b33c..0000000000
--- a/Zend/zend_ini_scanner.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _ZEND_INI_SCANNER_H
-#define _ZEND_INI_SCANNER_H
-
-BEGIN_EXTERN_C()
-int zend_ini_scanner_get_lineno(TSRMLS_D);
-char *zend_ini_scanner_get_filename(TSRMLS_D);
-int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC);
-void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC);
-int ini_lex(zval *ini_lval TSRMLS_DC);
-END_EXTERN_C()
-
-#endif /* _ZEND_INI_SCANNER_H */
diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l
deleted file mode 100644
index fe14e92b69..0000000000
--- a/Zend/zend_ini_scanner.l
+++ /dev/null
@@ -1,228 +0,0 @@
-%{
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#define yyleng SCNG(yy_leng)
-#define yytext SCNG(yy_text)
-#define yytext_ptr SCNG(yy_text)
-#define yyin SCNG(yy_in)
-#define yyout SCNG(yy_out)
-#define yy_last_accepting_state SCNG(_yy_last_accepting_state)
-#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos)
-#define yy_more_flag SCNG(_yy_more_flag)
-#define yy_more_len SCNG(_yy_more_len)
-
-#include <errno.h>
-#include "zend.h"
-#include "zend_globals.h"
-#include "zend_ini_parser.h"
-#include "zend_ini_scanner.h"
-
-#undef YYSTYPE
-#define YYSTYPE zval
-
-#define YY_DECL int ini_lex(zval *ini_lval TSRMLS_DC)
-
-/* Globals Macros */
-#define SCNG INI_SCNG
-#ifdef ZTS
-ZEND_API ts_rsrc_id ini_scanner_globals_id;
-#else
-ZEND_API zend_scanner_globals ini_scanner_globals;
-#endif
-
-
-static char *ini_filename;
-
-void init_ini_scanner()
-{
- ini_lineno=1;
-}
-
-
-int zend_ini_scanner_get_lineno(TSRMLS_D)
-{
- return ini_lineno;
-}
-
-
-char *zend_ini_scanner_get_filename(TSRMLS_D)
-{
- return ini_filename;
-}
-
-
-int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC)
-{
- FILE *fp;
-
- switch (fh->type) {
- case ZEND_HANDLE_FP:
- fp = fh->handle.fp;
- break;
- case ZEND_HANDLE_FILENAME:
- fp = zend_fopen(fh->filename, NULL);
- fh->type = ZEND_HANDLE_FP;
- break;
- default:
- return FAILURE;
- }
-
- init_ini_scanner();
- yyin = fp;
- yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC);
- ini_filename = fh->filename;
- return SUCCESS;
-}
-
-
-void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC)
-{
- switch (fh->type) {
- case ZEND_HANDLE_FP:
- fclose(fh->handle.fp);
- break;
- }
-}
-
-%}
-
-NEWLINE ("\r"|"\n"|"\r\n")
-
-%option noyywrap
-%option yylineno
-
-%%
-
-
-<INITIAL>[ ]*("true"|"on"|"yes")[ ]* {
- ini_lval->value.str.val = zend_strndup("1", 1);
- ini_lval->value.str.len = 1;
- ini_lval->type = IS_STRING;
- return CFG_TRUE;
-}
-
-
-<INITIAL>[ ]*("false"|"off"|"no"|"none")[ ]* {
- ini_lval->value.str.val = zend_strndup("", 0);
- ini_lval->value.str.len = 0;
- ini_lval->type = IS_STRING;
- return CFG_FALSE;
-}
-
-<INITIAL>[[][^[]+[\]][ ]*{NEWLINE}? {
- /* SECTION */
-
- /* eat trailng and spaces ] */
- while (yyleng>0 && (yytext[yyleng-1]=='\n' || yytext[yyleng-1]=='\r' || yytext[yyleng-1]==']' || yytext[yyleng-1]==' ')) {
- yyleng--;
- yytext[yyleng]=0;
- }
-
- /* eat leading [ */
- yytext++;
- yyleng--;
-
- ini_lval->value.str.val = zend_strndup(yytext, yyleng);
- ini_lval->value.str.len = yyleng;
- ini_lval->type = IS_STRING;
- return SECTION;
-}
-
-
-<INITIAL>["][^\n\r"]*["] {
- /* ENCAPSULATED TC_STRING */
-
- /* eat trailing " */
- yytext[yyleng-1]=0;
-
- /* eat leading " */
- yytext++;
-
- ini_lval->value.str.val = zend_strndup(yytext, yyleng - 2);
- ini_lval->value.str.len = yyleng - 2;
- ini_lval->type = IS_STRING;
- return TC_ENCAPSULATED_STRING;
-}
-
-<INITIAL>[&|~()!] {
- return yytext[0];
-}
-
-
-<INITIAL>[^=\n\r\t;|&~()!"]+ {
- /* STRING */
- register int i;
-
- /* eat trailing whitespace */
- for (i=yyleng-1; i>=0; i--) {
- if (yytext[i]==' ' || yytext[i]=='\t') {
- yytext[i]=0;
- yyleng--;
- } else {
- break;
- }
- }
- /* eat leading whitespace */
- while (yytext[0]) {
- if (yytext[0]==' ' || yytext[0]=='\t') {
- yytext++;
- yyleng--;
- } else {
- break;
- }
- }
- if (yyleng!=0) {
- ini_lval->value.str.val = zend_strndup(yytext, yyleng);
- ini_lval->value.str.len = yyleng;
- ini_lval->type = IS_STRING;
- return TC_STRING;
- } else {
- /* whitespace */
- }
-}
-
-
-
-<INITIAL>[=\n] {
- return yytext[0];
-}
-
-<INITIAL>{NEWLINE} {
- return '\n';
-}
-
-<INITIAL>[;][^\r\n]*{NEWLINE}? {
- /* comment */
- return '\n';
-}
-
-<INITIAL>[ \t] {
- /* eat whitespace */
-}
-
-<INITIAL>. {
-#if DEBUG
- php_error(E_NOTICE,"Unexpected character on line %d: '%s' (ASCII %d)\n", yylineno, yytext, yytext[0]);
-#endif
-}
-
-<<EOF>> {
- yy_delete_buffer(YY_CURRENT_BUFFER TSRMLS_CC);
- yyterminate();
-}
diff --git a/Zend/zend_istdiostream.h b/Zend/zend_istdiostream.h
deleted file mode 100644
index 00b65b3793..0000000000
--- a/Zend/zend_istdiostream.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _ZEND_STDIOSTREAM
-#define _ZEND_STDIOSTREAM
-
-#if defined(ZTS) && !defined(HAVE_CLASS_ISTDIOSTREAM)
-class istdiostream : public istream
-{
-private:
- stdiobuf _file;
-public:
- istdiostream (FILE* __f) : istream(), _file(__f) { init(&_file); }
- stdiobuf* rdbuf()/* const */ { return &_file; }
-};
-#endif
-
-#endif
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
deleted file mode 100644
index 3e7e2f4270..0000000000
--- a/Zend/zend_language_parser.y
+++ /dev/null
@@ -1,852 +0,0 @@
-%{
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/*
- * LALR shift/reduce conflicts and how they are resolved:
- *
- * - 2 shift/reduce conflicts due to the dangeling elseif/else ambiguity. Solved by shift.
- * - 1 shift/reduce conflict due to arrays within encapsulated strings. Solved by shift.
- * - 1 shift/reduce conflict due to objects within encapsulated strings. Solved by shift.
- *
- */
-
-
-#include "zend_compile.h"
-#include "zend.h"
-#include "zend_list.h"
-#include "zend_globals.h"
-#include "zend_API.h"
-
-#define YYERROR_VERBOSE
-#define YYSTYPE znode
-#ifdef ZTS
-# define YYPARSE_PARAM tsrm_ls
-# define YYLEX_PARAM tsrm_ls
-#endif
-
-
-%}
-
-%pure_parser
-%expect 4
-
-%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
-%left ','
-%left T_LOGICAL_OR
-%left T_LOGICAL_XOR
-%left T_LOGICAL_AND
-%right T_PRINT
-%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL
-%left '?' ':'
-%left T_BOOLEAN_OR
-%left T_BOOLEAN_AND
-%left '|'
-%left '^'
-%left '&'
-%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL
-%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
-%left T_SL T_SR
-%left '+' '-' '.'
-%left '*' '/' '%'
-%right '!' '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
-%right '['
-%nonassoc T_NEW T_IS_CLASS
-%token T_EXIT
-%token T_IF
-%left T_ELSEIF
-%left T_ELSE
-%left T_ENDIF
-%token T_LNUMBER
-%token T_DNUMBER
-%token T_STRING
-%token T_STRING_VARNAME
-%token T_VARIABLE
-%token T_NUM_STRING
-%token T_INLINE_HTML
-%token T_CHARACTER
-%token T_BAD_CHARACTER
-%token T_ENCAPSED_AND_WHITESPACE
-%token T_CONSTANT_ENCAPSED_STRING
-%token T_ECHO
-%token T_DO
-%token T_WHILE
-%token T_ENDWHILE
-%token T_FOR
-%token T_ENDFOR
-%token T_FOREACH
-%token T_ENDFOREACH
-%token T_DECLARE
-%token T_ENDDECLARE
-%token T_IS_CLASS
-%token T_AS
-%token T_SWITCH
-%token T_ENDSWITCH
-%token T_CASE
-%token T_DEFAULT
-%token T_BREAK
-%token T_CONTINUE
-%token T_OLD_FUNCTION
-%token T_FUNCTION
-%token T_CONST
-%token T_RETURN
-%token T_TRY
-%token T_CATCH
-%token T_THROW
-%token T_USE
-%token T_GLOBAL
-%token T_STATIC
-%token T_PRIVATE
-%token T_PROTECTED
-%token T_VAR
-%token T_UNSET
-%token T_ISSET
-%token T_EMPTY
-%token T_CLASS
-%token T_EXTENDS
-%token T_OBJECT_OPERATOR
-%token T_DOUBLE_ARROW
-%token T_LIST
-%token T_ARRAY
-%token T_CLASS_C
-%token T_FUNC_C
-%token T_LINE
-%token T_FILE
-%token T_COMMENT
-%token T_ML_COMMENT
-%token T_OPEN_TAG
-%token T_OPEN_TAG_WITH_ECHO
-%token T_CLOSE_TAG
-%token T_WHITESPACE
-%token T_START_HEREDOC
-%token T_END_HEREDOC
-%token T_DOLLAR_OPEN_CURLY_BRACES
-%token T_CURLY_OPEN
-%token T_PAAMAYIM_NEKUDOTAYIM
-%token T_IMPORT T_FROM
-
-%% /* Rules */
-
-start:
- top_statement_list
-;
-
-top_statement_list:
- top_statement_list { zend_do_extended_info(TSRMLS_C); } top_statement { HANDLE_INTERACTIVE(); }
- | /* empty */
-;
-
-
-top_statement:
- statement
- | function_declaration_statement { zend_do_early_binding(TSRMLS_C); }
- | class_declaration_statement
-;
-
-
-inner_statement_list:
- inner_statement_list { zend_do_extended_info(TSRMLS_C); } inner_statement { HANDLE_INTERACTIVE(); }
- | /* empty */
-;
-
-
-inner_statement:
- statement
- | function_declaration_statement
- | class_declaration_statement
-;
-
-
-statement:
- unticked_statement { zend_do_ticks(TSRMLS_C); }
-;
-
-unticked_statement:
- '{' inner_statement_list '}'
- | T_IF '(' expr ')' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } statement { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } elseif_list else_single { zend_do_if_end(TSRMLS_C); }
- | T_IF '(' expr ')' ':' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { zend_do_if_end(TSRMLS_C); }
- | T_WHILE '(' { $1.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' { zend_do_while_cond(&$4, &$5 TSRMLS_CC); } while_statement { zend_do_while_end(&$1, &$5 TSRMLS_CC); }
- | T_DO { $1.u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } statement T_WHILE '(' { $5.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' ';' { zend_do_do_while_end(&$1, &$5, &$7 TSRMLS_CC); }
- | T_FOR
- '('
- for_expr
- ';' { zend_do_free(&$3 TSRMLS_CC); $4.u.opline_num = get_next_op_number(CG(active_op_array)); }
- for_expr
- ';' { zend_do_extended_info(TSRMLS_C); zend_do_for_cond(&$6, &$7 TSRMLS_CC); }
- for_expr
- ')' { zend_do_free(&$9 TSRMLS_CC); zend_do_for_before_statement(&$4, &$7 TSRMLS_CC); }
- for_statement { zend_do_for_end(&$7 TSRMLS_CC); }
- | T_SWITCH '(' expr ')' { zend_do_switch_cond(&$3 TSRMLS_CC); } switch_case_list { zend_do_switch_end(&$6 TSRMLS_CC); }
- | T_BREAK ';' { zend_do_brk_cont(ZEND_BRK, NULL TSRMLS_CC); }
- | T_BREAK expr ';' { zend_do_brk_cont(ZEND_BRK, &$2 TSRMLS_CC); }
- | T_CONTINUE ';' { zend_do_brk_cont(ZEND_CONT, NULL TSRMLS_CC); }
- | T_CONTINUE expr ';' { zend_do_brk_cont(ZEND_CONT, &$2 TSRMLS_CC); }
- | T_RETURN ';' { zend_do_return(NULL, 0 TSRMLS_CC); }
- | T_RETURN expr_without_variable ';' { zend_do_return(&$2, 0 TSRMLS_CC); }
- | T_RETURN variable ';' { zend_do_return(&$2, 1 TSRMLS_CC); }
- | T_GLOBAL global_var_list ';'
- | T_STATIC static_var_list ';'
- | T_ECHO echo_expr_list ';'
- | T_INLINE_HTML { zend_do_echo(&$1 TSRMLS_CC); }
- | expr ';' { zend_do_free(&$1 TSRMLS_CC); }
- | T_USE use_filename ';' { zend_error(E_COMPILE_ERROR,"use: Not yet supported. Please use include_once() or require_once()"); zval_dtor(&$2.u.constant); }
- | T_UNSET '(' unset_variables ')' ';'
- | T_FOREACH '(' variable T_AS { zend_do_foreach_begin(&$1, &$3, &$2, &$4, 1 TSRMLS_CC); } w_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$6, &$7, &$4 TSRMLS_CC); } foreach_statement { zend_do_foreach_end(&$1, &$2 TSRMLS_CC); }
- | T_FOREACH '(' expr_without_variable T_AS { zend_do_foreach_begin(&$1, &$3, &$2, &$4, 0 TSRMLS_CC); } w_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$6, &$7, &$4 TSRMLS_CC); } foreach_statement { zend_do_foreach_end(&$1, &$2 TSRMLS_CC); }
- | T_DECLARE { $1.u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); }
- | ';' /* empty statement */
- | T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}'
- T_CATCH '(' catch_or_import_class_entry T_VARIABLE ')' { zend_do_begin_catch(&$1, &$8, &$9, 1 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
- additional_catches
- | T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); }
- | T_IMPORT { zend_do_begin_import(TSRMLS_C); } import_rule T_FROM catch_or_import_class_entry { zend_do_end_import(&$5 TSRMLS_CC); } ';'
-;
-
-
-import_rule:
- '*' { zend_do_import(T_FUNCTION, NULL TSRMLS_CC); zend_do_import(T_CLASS, NULL TSRMLS_CC); zend_do_import(T_CONST, NULL TSRMLS_CC); }
- | import_commands
-;
-
-import_commands:
- import_commands ',' import_command
- | import_command
-;
-
-import_command:
- T_FUNCTION T_STRING { zend_do_import(T_FUNCTION, &$2 TSRMLS_CC); }
- | T_CLASS T_STRING { zend_do_import(T_CLASS, &$2 TSRMLS_CC); }
- | T_CONST T_STRING { zend_do_import(T_CONST, &$2 TSRMLS_CC); }
- | T_FUNCTION '*' { zend_do_import(T_FUNCTION, NULL TSRMLS_CC); }
- | T_CLASS '*' { zend_do_import(T_CLASS, NULL TSRMLS_CC); }
- | T_CONST '*' { zend_do_import(T_CONST, NULL TSRMLS_CC); }
-;
-
-additional_catches:
- non_empty_additional_catches
- | /* empty */
-;
-
-non_empty_additional_catches:
- non_empty_additional_catches T_CATCH '(' catch_or_import_class_entry T_VARIABLE ')' { zend_do_begin_catch(&$2, &$4, &$5, 0 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$2 TSRMLS_CC); }
- | T_CATCH '(' catch_or_import_class_entry T_VARIABLE ')' { zend_do_begin_catch(&$1, &$3, &$4, 0 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
-;
-
-
-unset_variables:
- unset_variable
- | unset_variables ',' unset_variable
-;
-
-unset_variable:
- variable { zend_do_end_variable_parse(BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&$1 TSRMLS_CC); }
-;
-
-use_filename:
- T_CONSTANT_ENCAPSED_STRING { $$ = $1; }
- | '(' T_CONSTANT_ENCAPSED_STRING ')' { $$ = $2; }
-;
-
-
-function_declaration_statement:
- unticked_function_declaration_statement { zend_do_ticks(TSRMLS_C); }
-;
-
-class_declaration_statement:
- unticked_class_declaration_statement { zend_do_ticks(TSRMLS_C); }
-;
-
-
-unticked_function_declaration_statement:
- T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 0, $3.op_type TSRMLS_CC); }
- '(' parameter_list ')' '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
- | T_OLD_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 0, $3.op_type TSRMLS_CC); }
- parameter_list '(' inner_statement_list ')' ';' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
-;
-
-unticked_class_declaration_statement:
- T_CLASS declaration_class_name extends_from '{' { zend_do_begin_class_declaration(&$1, &$2, &$3 TSRMLS_CC); } class_statement_list '}' { zend_do_end_class_declaration(&$1 TSRMLS_CC); }
-;
-
-extends_from:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | T_EXTENDS catch_or_import_class_entry { $$ = $2; }
-;
-
-declaration_class_name:
- | parse_class_name_entry T_STRING { do_fetch_class_name(&$$, &$1, &$2, 0 TSRMLS_CC); }
- | T_STRING { $$ = $1; zend_str_tolower($$.u.constant.value.str.val, $$.u.constant.value.str.len); }
-;
-
-foreach_optional_arg:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | T_DOUBLE_ARROW w_variable { $$ = $2; }
-;
-
-for_statement:
- statement
- | ':' inner_statement_list T_ENDFOR ';'
-;
-
-
-foreach_statement:
- statement
- | ':' inner_statement_list T_ENDFOREACH ';'
-;
-
-
-declare_statement:
- statement
- | ':' inner_statement_list T_ENDDECLARE ';'
-;
-
-
-declare_list:
- T_STRING '=' static_scalar { zend_do_declare_stmt(&$1, &$3 TSRMLS_CC); }
- | declare_list ',' T_STRING '=' static_scalar { zend_do_declare_stmt(&$3, &$5 TSRMLS_CC); }
-;
-
-
-switch_case_list:
- '{' case_list '}' { $$ = $2; }
- | '{' ';' case_list '}' { $$ = $3; }
- | ':' case_list T_ENDSWITCH ';' { $$ = $2; }
- | ':' ';' case_list T_ENDSWITCH ';' { $$ = $3; }
-;
-
-
-case_list:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | case_list T_CASE expr case_separator { zend_do_extended_info(TSRMLS_C); zend_do_case_before_statement(&$1, &$2, &$3 TSRMLS_CC); } inner_statement_list { zend_do_case_after_statement(&$$, &$2 TSRMLS_CC); $$.op_type = IS_CONST; }
- | case_list T_DEFAULT case_separator { zend_do_extended_info(TSRMLS_C); zend_do_default_before_statement(&$1, &$2 TSRMLS_CC); } inner_statement_list { zend_do_case_after_statement(&$$, &$2 TSRMLS_CC); $$.op_type = IS_CONST; }
-;
-
-
-case_separator:
- ':'
- | ';'
-;
-
-
-while_statement:
- statement
- | ':' inner_statement_list T_ENDWHILE ';'
-;
-
-
-
-elseif_list:
- /* empty */
- | elseif_list T_ELSEIF '(' expr ')' { zend_do_if_cond(&$4, &$5 TSRMLS_CC); } statement { zend_do_if_after_statement(&$5, 0 TSRMLS_CC); }
-;
-
-
-new_elseif_list:
- /* empty */
- | new_elseif_list T_ELSEIF '(' expr ')' ':' { zend_do_if_cond(&$4, &$5 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$5, 0 TSRMLS_CC); }
-;
-
-
-else_single:
- /* empty */
- | T_ELSE statement
-;
-
-
-new_else_single:
- /* empty */
- | T_ELSE ':' inner_statement_list
-;
-
-
-parameter_list:
- non_empty_parameter_list
- | /* empty */
-;
-
-
-non_empty_parameter_list:
- T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$1, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE TSRMLS_CC); }
- | '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_FORCE TSRMLS_CC); }
- | '&' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$4, BYREF_FORCE TSRMLS_CC); }
- | T_CONST T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE TSRMLS_CC); }
- | T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$1, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$3, BYREF_NONE TSRMLS_CC); }
- | non_empty_parameter_list ',' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE TSRMLS_CC); }
- | non_empty_parameter_list ',' '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_FORCE TSRMLS_CC); }
- | non_empty_parameter_list ',' '&' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$6, BYREF_FORCE TSRMLS_CC); }
- | non_empty_parameter_list ',' T_CONST T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE TSRMLS_CC); }
- | non_empty_parameter_list ',' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$5, BYREF_NONE TSRMLS_CC); }
-;
-
-
-function_call_parameter_list:
- non_empty_function_call_parameter_list { $$ = $1; }
- | /* empty */ { $$.u.constant.value.lval = 0; }
-;
-
-
-non_empty_function_call_parameter_list:
- expr_without_variable { $$.u.constant.value.lval = 1; zend_do_pass_param(&$1, ZEND_SEND_VAL, $$.u.constant.value.lval TSRMLS_CC); }
- | variable { $$.u.constant.value.lval = 1; zend_do_pass_param(&$1, ZEND_SEND_VAR, $$.u.constant.value.lval TSRMLS_CC); }
- | '&' w_variable { $$.u.constant.value.lval = 1; zend_do_pass_param(&$2, ZEND_SEND_REF, $$.u.constant.value.lval TSRMLS_CC); }
- | non_empty_function_call_parameter_list ',' expr_without_variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$3, ZEND_SEND_VAL, $$.u.constant.value.lval TSRMLS_CC); }
- | non_empty_function_call_parameter_list ',' variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$3, ZEND_SEND_VAR, $$.u.constant.value.lval TSRMLS_CC); }
- | non_empty_function_call_parameter_list ',' '&' w_variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$4, ZEND_SEND_REF, $$.u.constant.value.lval TSRMLS_CC); }
-;
-
-global_var_list:
- global_var_list ',' global_var { zend_do_fetch_global_or_static_variable(&$3, NULL, ZEND_FETCH_GLOBAL TSRMLS_CC); }
- | global_var { zend_do_fetch_global_or_static_variable(&$1, NULL, ZEND_FETCH_GLOBAL TSRMLS_CC); }
-;
-
-
-global_var:
- T_VARIABLE { $$ = $1; }
- | '$' r_variable { $$ = $2; }
- | '$' '{' expr '}' { $$ = $3; }
-;
-
-
-static_var_list:
- static_var_list ',' T_VARIABLE { zend_do_fetch_global_or_static_variable(&$3, NULL, ZEND_FETCH_STATIC TSRMLS_CC); }
- | static_var_list ',' T_VARIABLE '=' static_scalar { zend_do_fetch_global_or_static_variable(&$3, &$5, ZEND_FETCH_STATIC TSRMLS_CC); }
- | T_VARIABLE { zend_do_fetch_global_or_static_variable(&$1, NULL, ZEND_FETCH_STATIC TSRMLS_CC); }
- | T_VARIABLE '=' static_scalar { zend_do_fetch_global_or_static_variable(&$1, &$3, ZEND_FETCH_STATIC TSRMLS_CC); }
-
-;
-
-
-class_statement_list:
- class_statement_list class_statement
- | /* empty */
-;
-
-
-class_statement:
- class_variable_declaration ';'
- | class_constant_declaration ';'
- | T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 1, $3.op_type TSRMLS_CC); } '('
- parameter_list ')' '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
- | T_OLD_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 1, $3.op_type TSRMLS_CC); }
- parameter_list '(' inner_statement_list ')' ';' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
- | T_CLASS T_STRING extends_from '{' { zend_do_begin_class_declaration(&$1, &$2, &$3 TSRMLS_CC); } class_statement_list '}' { zend_do_end_class_declaration(&$1 TSRMLS_CC); }
-;
-
-is_reference:
- /* empty */ { $$.op_type = ZEND_RETURN_VAL; }
- | '&' { $$.op_type = ZEND_RETURN_REF; }
-;
-
-class_variable_declaration:
- class_variable_declaration ',' T_VARIABLE { zend_do_declare_property(&$3, NULL, $1.op_type TSRMLS_CC); }
- | class_variable_declaration ',' T_VARIABLE '=' static_scalar { zend_do_declare_property(&$3, &$5, $1.op_type TSRMLS_CC); }
- | class_declaration_type T_VARIABLE { $$ = $1; zend_do_declare_property(&$2, NULL, $1.op_type TSRMLS_CC); }
- | class_declaration_type T_VARIABLE '=' static_scalar { $$ = $1; zend_do_declare_property(&$2, &$4, $1.op_type TSRMLS_CC); }
-;
-
-class_declaration_type:
- T_VAR { $$.op_type = T_VAR; }
- | T_STATIC { $$.op_type = T_STATIC; }
- | T_PRIVATE { $$.op_type = T_PRIVATE; }
- | T_PROTECTED { $$.op_type = T_PROTECTED; }
-;
-
-class_constant_declaration:
- | T_CONST ',' T_STRING '=' static_scalar { zend_do_declare_property(&$3, &$5, T_CONST TSRMLS_CC); }
- | T_CONST T_STRING '=' static_scalar { zend_do_declare_property(&$2, &$4, T_CONST TSRMLS_CC); }
-;
-
-echo_expr_list:
- | echo_expr_list ',' expr { zend_do_echo(&$3 TSRMLS_CC); }
- | expr { zend_do_echo(&$1 TSRMLS_CC); }
-;
-
-
-for_expr:
- /* empty */ { $$.op_type = IS_CONST; $$.u.constant.type = IS_BOOL; $$.u.constant.value.lval = 1; }
- | non_empty_for_expr { $$ = $1; }
-;
-
-non_empty_for_expr:
- non_empty_for_expr ',' { zend_do_free(&$1 TSRMLS_CC); } expr { $$ = $4; }
- | expr { $$ = $1; }
-;
-
-expr_without_variable:
- T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' '=' expr { zend_do_list_end(&$$, &$7 TSRMLS_CC); }
- | variable '=' expr { zend_check_writable_variable(&$$); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign(&$$, &$1, &$3 TSRMLS_CC); }
- | variable '=' '&' variable { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); }
- | variable '=' '&' T_NEW new_class_entry { zend_check_writable_variable(&$$); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); }
- | T_NEW new_class_entry { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$1, &$2 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$1, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
- | variable T_PLUS_EQUAL expr { zend_check_writable_variable(&$$); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_MINUS_EQUAL expr { zend_check_writable_variable(&$$); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_MUL_EQUAL expr { zend_check_writable_variable(&$$); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_DIV_EQUAL expr { zend_check_writable_variable(&$$); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_DIV, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_CONCAT_EQUAL expr { zend_check_writable_variable(&$$); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_CONCAT, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_MOD_EQUAL expr { zend_check_writable_variable(&$$); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MOD, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_AND_EQUAL expr { zend_check_writable_variable(&$$); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_AND, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_OR_EQUAL expr { zend_check_writable_variable(&$$); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_OR, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_XOR_EQUAL expr { zend_check_writable_variable(&$$); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_SL_EQUAL expr { zend_check_writable_variable(&$$); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_SR_EQUAL expr { zend_check_writable_variable(&$$); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 TSRMLS_CC); }
- | rw_variable T_INC { zend_do_post_incdec(&$$, &$1, ZEND_POST_INC TSRMLS_CC); }
- | T_INC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_INC TSRMLS_CC); }
- | rw_variable T_DEC { zend_do_post_incdec(&$$, &$1, ZEND_POST_DEC TSRMLS_CC); }
- | T_DEC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_DEC TSRMLS_CC); }
- | expr T_BOOLEAN_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
- | expr T_BOOLEAN_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
- | expr T_LOGICAL_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
- | expr T_LOGICAL_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
- | expr T_LOGICAL_XOR expr { zend_do_binary_op(ZEND_BOOL_XOR, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '|' expr { zend_do_binary_op(ZEND_BW_OR, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '&' expr { zend_do_binary_op(ZEND_BW_AND, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '^' expr { zend_do_binary_op(ZEND_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '.' expr { zend_do_binary_op(ZEND_CONCAT, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '+' expr { zend_do_binary_op(ZEND_ADD, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '-' expr { zend_do_binary_op(ZEND_SUB, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '*' expr { zend_do_binary_op(ZEND_MUL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '/' expr { zend_do_binary_op(ZEND_DIV, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '%' expr { zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_SL expr { zend_do_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_SR expr { zend_do_binary_op(ZEND_SR, &$$, &$1, &$3 TSRMLS_CC); }
- | '+' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); }
- | '-' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); }
- | '!' expr { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$2 TSRMLS_CC); }
- | '~' expr { zend_do_unary_op(ZEND_BW_NOT, &$$, &$2 TSRMLS_CC); }
- | expr T_IS_IDENTICAL expr { zend_do_binary_op(ZEND_IS_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_IS_NOT_IDENTICAL expr { zend_do_binary_op(ZEND_IS_NOT_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_IS_EQUAL expr { zend_do_binary_op(ZEND_IS_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_IS_NOT_EQUAL expr { zend_do_binary_op(ZEND_IS_NOT_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '<' expr { zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_IS_SMALLER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '>' expr { zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$3, &$1 TSRMLS_CC); }
- | expr T_IS_GREATER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$3, &$1 TSRMLS_CC); }
- | expr T_IS_CLASS is_class_expr { zend_do_is_class(&$$, &$1, &$3, 0 TSRMLS_CC); }
- | '(' expr ')' { $$ = $2; }
- | expr '?' { zend_do_begin_qm_op(&$1, &$2 TSRMLS_CC); }
- expr ':' { zend_do_qm_true(&$4, &$2, &$5 TSRMLS_CC); }
- expr { zend_do_qm_false(&$$, &$7, &$2, &$5 TSRMLS_CC); }
- | internal_functions_in_yacc { $$ = $1; }
- | T_INT_CAST expr { zend_do_cast(&$$, &$2, IS_LONG TSRMLS_CC); }
- | T_DOUBLE_CAST expr { zend_do_cast(&$$, &$2, IS_DOUBLE TSRMLS_CC); }
- | T_STRING_CAST expr { zend_do_cast(&$$, &$2, IS_STRING TSRMLS_CC); }
- | T_ARRAY_CAST expr { zend_do_cast(&$$, &$2, IS_ARRAY TSRMLS_CC); }
- | T_OBJECT_CAST expr { zend_do_cast(&$$, &$2, IS_OBJECT TSRMLS_CC); }
- | T_BOOL_CAST expr { zend_do_cast(&$$, &$2, IS_BOOL TSRMLS_CC); }
- | T_UNSET_CAST expr { zend_do_cast(&$$, &$2, IS_NULL TSRMLS_CC); }
- | T_EXIT exit_expr { zend_do_exit(&$$, &$2 TSRMLS_CC); }
- | '@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end_silence(&$1 TSRMLS_CC); $$ = $3; }
- | scalar { $$ = $1; }
- | T_ARRAY '(' array_pair_list ')' { $$ = $3; }
- | '`' encaps_list '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); }
- | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); }
-;
-
-function_call:
- T_STRING '(' { $2.u.opline_num = zend_do_begin_function_call(&$1 TSRMLS_CC); }
- function_call_parameter_list
- ')' { zend_do_end_function_call(&$1, &$$, &$4, 0, $2.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
- | parse_class_entry static_or_variable_string '(' { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_class_member_function_call(&$1, &$2 TSRMLS_CC); }
- function_call_parameter_list
- ')' { zend_do_end_function_call(&$2, &$$, &$5, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
- | variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1 TSRMLS_CC); }
- function_call_parameter_list ')'
- { zend_do_end_function_call(&$1, &$$, &$4, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
-;
-
-parse_class_entry:
- parse_class_entry T_STRING T_PAAMAYIM_NEKUDOTAYIM { do_fetch_class(&$$, &$1, &$2 TSRMLS_CC); }
- | T_STRING T_PAAMAYIM_NEKUDOTAYIM { do_fetch_class(&$$, NULL, &$1 TSRMLS_CC); }
-;
-
-parse_class_name_entry:
- parse_class_name_entry T_STRING T_PAAMAYIM_NEKUDOTAYIM { do_fetch_class_name(&$$, &$1, &$2, 0 TSRMLS_CC); }
- | T_STRING T_PAAMAYIM_NEKUDOTAYIM { $$ = $1; zend_str_tolower($$.u.constant.value.str.val, $$.u.constant.value.str.len); }
-;
-
-catch_or_import_class_entry:
- parse_class_entry T_STRING { do_fetch_class(&$$, &$1, &$2 TSRMLS_CC); }
- | T_STRING { do_fetch_class(&$$, NULL, &$1 TSRMLS_CC); }
-;
-
-new_class_entry:
- parse_class_entry T_STRING { do_fetch_class(&$$, &$1, &$2 TSRMLS_CC); }
- | static_or_variable_string { do_fetch_class(&$$, NULL, &$1 TSRMLS_CC); }
-;
-
-static_or_variable_string:
- T_STRING { $$ = $1; }
- | r_variable_without_static_member { $$ = $1; }
-;
-
-is_class_expr:
- parse_class_entry T_STRING { do_fetch_class(&$$, &$1, &$2 TSRMLS_CC); }
- | T_STRING { do_fetch_class(&$$, NULL, &$1 TSRMLS_CC); }
-;
-
-exit_expr:
- /* empty */ { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
- | '(' ')' { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
- | '(' expr ')' { $$ = $2; }
-;
-
-
-ctor_arguments:
- /* empty */ { $$.u.constant.value.lval=0; }
- | '(' function_call_parameter_list ')' { $$ = $2; }
-;
-
-
-common_scalar:
- T_LNUMBER { $$ = $1; }
- | T_DNUMBER { $$ = $1; }
- | T_CONSTANT_ENCAPSED_STRING { $$ = $1; }
- | T_LINE { $$ = $1; }
- | T_FILE { $$ = $1; }
- | T_CLASS_C { $$ = $1; }
- | T_FUNC_C { $$ = $1; }
-;
-
-
-static_scalar: /* compile-time evaluated scalars */
- common_scalar { $$ = $1; }
- | T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT TSRMLS_CC); }
- | '+' static_scalar { $$ = $2; }
- | '-' static_scalar { zval minus_one; minus_one.type = IS_LONG; minus_one.value.lval = -1; mul_function(&$2.u.constant, &$2.u.constant, &minus_one TSRMLS_CC); $$ = $2; }
- | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; $$.u.constant.type = IS_CONSTANT_ARRAY; }
- | parse_class_name_entry T_STRING { zend_do_fetch_constant(&$$, &$1, &$2, ZEND_CT TSRMLS_CC); }
-;
-
-
-scalar:
- T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT TSRMLS_CC); }
- | T_STRING_VARNAME { $$ = $1; }
- | parse_class_entry T_STRING { zend_do_fetch_constant(&$$, &$1, &$2, ZEND_RT TSRMLS_CC); }
- | common_scalar { $$ = $1; }
- | '"' encaps_list '"' { $$ = $2; }
- | '\'' encaps_list '\'' { $$ = $2; }
- | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; zend_do_end_heredoc(TSRMLS_C); }
-;
-
-
-static_array_pair_list:
- /* empty */ { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); }
- | non_empty_static_array_pair_list possible_comma { $$ = $1; }
-;
-
-possible_comma:
- /* empty */
- | ','
-;
-
-non_empty_static_array_pair_list:
- non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW static_scalar { zend_do_add_static_array_element(&$$, &$3, &$5); }
- | non_empty_static_array_pair_list ',' static_scalar { zend_do_add_static_array_element(&$$, NULL, &$3); }
- | static_scalar T_DOUBLE_ARROW static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); zend_do_add_static_array_element(&$$, &$1, &$3); }
- | static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); zend_do_add_static_array_element(&$$, NULL, &$1); }
-;
-
-expr:
- r_variable { $$ = $1; }
- | expr_without_variable { $$ = $1; }
-;
-
-
-r_variable:
- variable { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); $$ = $1; }
-;
-
-
-w_variable:
- variable { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); $$ = $1; }
- { zend_check_writable_variable(&$$); }
-;
-
-rw_variable:
- variable { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); $$ = $1; }
- { zend_check_writable_variable(&$$); }
-;
-
-r_variable_without_static_member:
- variable_without_objects { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); $$ = $1; }
-;
-
-variable:
- base_variable_without_objects T_OBJECT_OPERATOR { zend_do_push_object(&$1 TSRMLS_CC); }
- object_property { zend_do_push_object(&$4 TSRMLS_CC); } method_or_not variable_properties
- { zend_do_pop_object(&$$ TSRMLS_CC); $$.u.EA.type = $1.u.EA.type | ($7.u.EA.type ? $7.u.EA.type : $6.u.EA.type); }
- | base_variable_without_objects { $$ = $1; }
-;
-
-
-variable_properties:
- variable_properties variable_property { $$.u.EA.type = $2.u.EA.type; }
- | /* empty */ { $$.u.EA.type = 0; }
-;
-
-
-variable_property:
- T_OBJECT_OPERATOR object_property { zend_do_push_object(&$2 TSRMLS_CC); } method_or_not { $$.u.EA.type = $4.u.EA.type; }
-;
-
-method_or_not:
- '(' { zend_do_pop_object(&$1 TSRMLS_CC); zend_do_begin_method_call(&$1 TSRMLS_CC); }
- function_call_parameter_list ')'
- { zend_do_end_function_call(&$1, &$$, &$3, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);
- zend_do_push_object(&$$ TSRMLS_CC); $$.u.EA.type = ZEND_PARSED_METHOD_CALL; }
- | /* empty */ { $$.u.EA.type = ZEND_PARSED_MEMBER; }
-;
-
-variable_without_objects:
- reference_variable { $$ = $1; }
- | simple_indirect_reference reference_variable { zend_do_indirect_references(&$$, &$1, &$2 TSRMLS_CC); }
-;
-
-static_member:
- parse_class_entry variable_without_objects { $$ = $2; zend_do_fetch_static_member(&$1 TSRMLS_CC); }
-;
-
-
-base_variable_without_objects:
- reference_variable { $$ = $1; $$.u.EA.type = ZEND_PARSED_VARIABLE; }
- | simple_indirect_reference reference_variable { zend_do_indirect_references(&$$, &$1, &$2 TSRMLS_CC); $$.u.EA.type = ZEND_PARSED_VARIABLE; }
- | static_member { $$ = $1; $$.u.EA.type = ZEND_PARSED_STATIC_MEMBER; }
- | function_call { zend_do_begin_variable_parse(TSRMLS_C); $$ = $1; $$.u.EA.type = ZEND_PARSED_FUNCTION_CALL; }
-;
-
-reference_variable:
- reference_variable '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
- | reference_variable '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); }
- | compound_variable { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
-;
-
-
-compound_variable:
- T_VARIABLE { $$ = $1; }
- | '$' '{' expr '}' { $$ = $3; }
-;
-
-dim_offset:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | expr { $$ = $1; }
-;
-
-
-object_property:
- object_dim_list { $$ = $1; }
- | variable_without_objects { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); } { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);}
-;
-
-object_dim_list:
- object_dim_list '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
- | object_dim_list '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); }
- | variable_name { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);}
-;
-
-variable_name:
- T_STRING { $$ = $1; }
- | '{' expr '}' { $$ = $2; }
-;
-
-simple_indirect_reference:
- '$' { $$.u.constant.value.lval = 1; }
- | simple_indirect_reference '$' { $$.u.constant.value.lval++; }
-;
-
-assignment_list:
- assignment_list ',' assignment_list_element
- | assignment_list_element
-;
-
-
-assignment_list_element:
- variable { zend_do_add_list_element(&$1 TSRMLS_CC); }
- | T_LIST '(' { zend_do_new_list_begin(TSRMLS_C); } assignment_list ')' { zend_do_new_list_end(TSRMLS_C); }
- | /* empty */ { zend_do_add_list_element(NULL TSRMLS_CC); }
-;
-
-
-array_pair_list:
- /* empty */ { zend_do_init_array(&$$, NULL, NULL, 0 TSRMLS_CC); }
- | non_empty_array_pair_list possible_comma { $$ = $1; }
-;
-
-non_empty_array_pair_list:
- non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr { zend_do_add_array_element(&$$, &$5, &$3, 0 TSRMLS_CC); }
- | non_empty_array_pair_list ',' expr { zend_do_add_array_element(&$$, &$3, NULL, 0 TSRMLS_CC); }
- | expr T_DOUBLE_ARROW expr { zend_do_init_array(&$$, &$3, &$1, 0 TSRMLS_CC); }
- | expr { zend_do_init_array(&$$, &$1, NULL, 0 TSRMLS_CC); }
- | non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable { zend_do_add_array_element(&$$, &$6, &$3, 1 TSRMLS_CC); }
- | non_empty_array_pair_list ',' '&' w_variable { zend_do_add_array_element(&$$, &$4, NULL, 1 TSRMLS_CC); }
- | expr T_DOUBLE_ARROW '&' w_variable { zend_do_init_array(&$$, &$4, &$1, 1 TSRMLS_CC); }
- | '&' w_variable { zend_do_init_array(&$$, &$2, NULL, 1 TSRMLS_CC); }
-;
-
-encaps_list:
- encaps_list encaps_var { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list T_STRING { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list T_NUM_STRING { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list T_ENCAPSED_AND_WHITESPACE { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list T_CHARACTER { zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list T_BAD_CHARACTER { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list '[' { $2.u.constant.value.lval = (long) '['; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list ']' { $2.u.constant.value.lval = (long) ']'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list '{' { $2.u.constant.value.lval = (long) '{'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list '}' { $2.u.constant.value.lval = (long) '}'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list T_OBJECT_OPERATOR { znode tmp; $2.u.constant.value.lval = (long) '-'; zend_do_add_char(&tmp, &$1, &$2 TSRMLS_CC); $2.u.constant.value.lval = (long) '>'; zend_do_add_char(&$$, &tmp, &$2 TSRMLS_CC); }
- | /* empty */ { zend_do_init_string(&$$ TSRMLS_CC); }
-
-;
-
-
-
-encaps_var:
- T_VARIABLE { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
- | T_VARIABLE '[' { zend_do_begin_variable_parse(TSRMLS_C); } encaps_var_offset ']' { fetch_array_begin(&$$, &$1, &$4 TSRMLS_CC); }
- | T_VARIABLE T_OBJECT_OPERATOR T_STRING { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$2, &$1, 1 TSRMLS_CC); zend_do_fetch_property(&$$, &$2, &$3 TSRMLS_CC); }
- | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$2, 1 TSRMLS_CC); }
- | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_begin(&$$, &$2, &$4 TSRMLS_CC); }
- | T_CURLY_OPEN variable '}' { $$ = $2; }
-;
-
-
-encaps_var_offset:
- T_STRING { $$ = $1; }
- | T_NUM_STRING { $$ = $1; }
- | T_VARIABLE { fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
-;
-
-
-internal_functions_in_yacc:
- T_ISSET '(' isset_variables ')' { $$ = $3; }
- | T_EMPTY '(' variable ')' { zend_do_isset_or_isempty(ZEND_ISEMPTY, &$$, &$3 TSRMLS_CC); }
- | T_INCLUDE expr { zend_do_include_or_eval(ZEND_INCLUDE, &$$, &$2 TSRMLS_CC); }
- | T_INCLUDE_ONCE expr { zend_do_include_or_eval(ZEND_INCLUDE_ONCE, &$$, &$2 TSRMLS_CC); }
- | T_EVAL '(' expr ')' { zend_do_include_or_eval(ZEND_EVAL, &$$, &$3 TSRMLS_CC); }
- | T_REQUIRE expr { zend_do_include_or_eval(ZEND_REQUIRE, &$$, &$2 TSRMLS_CC); }
- | T_REQUIRE_ONCE expr { zend_do_include_or_eval(ZEND_REQUIRE_ONCE, &$$, &$2 TSRMLS_CC); }
-;
-
-isset_variables:
- variable { zend_do_isset_or_isempty(ZEND_ISSET, &$$, &$1 TSRMLS_CC); }
- | isset_variables ',' { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } variable { znode tmp; zend_do_isset_or_isempty(ZEND_ISSET, &tmp, &$4 TSRMLS_CC); zend_do_boolean_and_end(&$$, &$1, &tmp, &$2 TSRMLS_CC); }
-;
-
-%%
-
diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h
deleted file mode 100644
index ced224d518..0000000000
--- a/Zend/zend_language_scanner.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_SCANNER_H
-#define ZEND_SCANNER_H
-
-typedef struct _zend_lex_state {
- YY_BUFFER_STATE buffer_state;
- int state;
- FILE *in;
- uint lineno;
- char *filename;
-} zend_lex_state;
-
-
-void zend_fatal_scanner_error(char *);
-BEGIN_EXTERN_C()
-int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2);
-ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC);
-ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC);
-ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_DC);
-END_EXTERN_C()
-
-#endif
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
deleted file mode 100644
index 6baf43e40f..0000000000
--- a/Zend/zend_language_scanner.l
+++ /dev/null
@@ -1,1516 +0,0 @@
-%{
-
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#define yyleng SCNG(yy_leng)
-#define yytext SCNG(yy_text)
-#define yytext_ptr SCNG(yy_text)
-#define yyin SCNG(yy_in)
-#define yyout SCNG(yy_out)
-#define yy_last_accepting_state SCNG(_yy_last_accepting_state)
-#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos)
-#define yy_more_flag SCNG(_yy_more_flag)
-#define yy_more_len SCNG(_yy_more_len)
-
-%}
-
-%x ST_IN_SCRIPTING
-%x ST_DOUBLE_QUOTES
-%x ST_SINGLE_QUOTE
-%x ST_BACKQUOTE
-%x ST_HEREDOC
-%x ST_LOOKING_FOR_PROPERTY
-%x ST_LOOKING_FOR_VARNAME
-%x ST_COMMENT
-%x ST_ONE_LINE_COMMENT
-%option stack
-
-%{
-
-#ifdef ZEND_WIN32
-#include <io.h>
-#endif
-
-#include <errno.h>
-#include "zend.h"
-#include "zend_alloc.h"
-#include "zend_language_parser.h"
-#include "zend_compile.h"
-#include "zend_language_scanner.h"
-#include "zend_highlight.h"
-#include "zend_constants.h"
-#include "zend_variables.h"
-#include "zend_operators.h"
-
-#ifdef HAVE_STDARG_H
-# include <stdarg.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#define YY_DECL int lex_scan(zval *zendlval TSRMLS_DC)
-
-#define ECHO { ZEND_WRITE( yytext, yyleng ); }
-
-#ifdef ZTS
-# define MY_INPUT yyinput
-#else
-# define MY_INPUT input
-#endif
-
-
-/* Globals Macros */
-#define SCNG LANG_SCNG
-#ifdef ZTS
-ZEND_API ts_rsrc_id language_scanner_globals_id;
-#else
-ZEND_API zend_scanner_globals language_scanner_globals;
-#endif
-
-
-#define YY_FATAL_ERROR zend_fatal_scanner_error
-
-#define HANDLE_NEWLINES(s, l) \
-do { \
- char *p = (s), *boundary = p+(l); \
- \
- while (p<boundary) { \
- if (*p == '\n') { \
- CG(zend_lineno)++; \
- } else if ((*p == '\r') && (p+1 < boundary) && (*(p+1) != '\n')) { \
- CG(zend_lineno)++; \
- } \
- p++; \
- } \
-} while (0)
-
-#define HANDLE_NEWLINE(c) \
-{ \
- if (c == '\n' || c == '\r') { \
- CG(zend_lineno)++; \
- } \
-}
-
-
-#define ZEND_IS_OCT(c) ((c)>='0' && (c)<='7')
-#define ZEND_IS_HEX(c) (((c)>='0' && (c)<='9') || ((c)>='a' && (c)<='f') || ((c)>='A' && (c)<='F'))
-
-
-void zend_fatal_scanner_error(char *message)
-{
- zend_error(E_COMPILE_ERROR, message);
-}
-
-BEGIN_EXTERN_C()
-void startup_scanner(TSRMLS_D)
-{
- CG(heredoc) = NULL;
- CG(heredoc_len)=0;
- SCNG(yy_start_stack_ptr) = 0;
- SCNG(yy_start_stack_depth) = 0;
- SCNG(yy_start_stack) = 0;
-}
-
-
-void shutdown_scanner(TSRMLS_D)
-{
- if (CG(heredoc)) {
- efree(CG(heredoc));
- CG(heredoc_len)=0;
- }
-}
-END_EXTERN_C()
-
-
-ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
-{
- memcpy(&lex_state->buffer_state, &YY_CURRENT_BUFFER, sizeof(YY_BUFFER_STATE));
- lex_state->in = SCNG(yy_in);
- lex_state->state = YYSTATE;
- lex_state->filename = zend_get_compiled_filename(TSRMLS_C);
- lex_state->lineno = CG(zend_lineno);
-}
-
-
-ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
-{
- YY_BUFFER_STATE original_buffer_state = YY_CURRENT_BUFFER;
-
- if (lex_state->buffer_state) {
- yy_switch_to_buffer(lex_state->buffer_state TSRMLS_CC);
- } else {
- YY_CURRENT_BUFFER = NULL;
- }
-
- yy_delete_buffer(original_buffer_state TSRMLS_CC);
- SCNG(yy_in) = lex_state->in;
- BEGIN(lex_state->state);
- CG(zend_lineno) = lex_state->lineno;
- zend_restore_compiled_filename(lex_state->filename TSRMLS_CC);
-}
-
-
-BEGIN_EXTERN_C()
-
-
-ZEND_API void zend_file_handle_dtor(zend_file_handle *fh)
-{
- switch (fh->type) {
- case ZEND_HANDLE_FP:
- fclose(fh->handle.fp);
- break;
- case ZEND_HANDLE_FILENAME:
- /* We're only supposed to get here when destructing the used_files hash,
- * which doesn't really contain open files, but references to their names/paths
- */
- break;
- }
- if (fh->opened_path) {
- efree(fh->opened_path);
- }
- if (fh->free_filename && fh->filename) {
- efree(fh->filename);
- }
-}
-
-
-int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2)
-{
- if (fh1->type != fh2->type) {
- return 0;
- }
- switch (fh1->type) {
- case ZEND_HANDLE_FP:
- return fh1->handle.fp==fh2->handle.fp;
- break;
- }
- return 0;
-}
-
-
-ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC)
-{
- zend_llist_del_element(&CG(open_files), file_handle, (int (*)(void *, void *)) zend_compare_file_handles);
-}
-
-
-ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
-{
- char *file_path=NULL;
-
- switch (file_handle->type) {
- case ZEND_HANDLE_FILENAME:
- file_handle->handle.fp = zend_fopen(file_handle->filename, &file_handle->opened_path);
- break;
- case ZEND_HANDLE_FD:
- file_handle->handle.fp = fdopen(file_handle->handle.fd, "r");
- break;
- case ZEND_HANDLE_FP:
- file_handle->handle.fp = file_handle->handle.fp;
- break;
- }
- if (!file_handle->handle.fp) {
- return FAILURE;
- }
-
- file_handle->type = ZEND_HANDLE_FP;
- if (file_handle->handle.fp != stdin) {
- zend_llist_add_element(&CG(open_files), file_handle);
- }
- /* Reset the scanner for scanning the new file */
- SCNG(yy_in) = file_handle->handle.fp;
- yy_switch_to_buffer(yy_create_buffer(SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC);
- BEGIN(INITIAL);
-
- if (file_handle->opened_path) {
- file_path = file_handle->opened_path;
- } else {
- file_path = file_handle->filename;
- }
-
- zend_set_compiled_filename(file_path TSRMLS_CC);
- CG(zend_lineno) = 1;
- CG(increment_lineno) = 0;
- return SUCCESS;
-}
-END_EXTERN_C()
-
-
-ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
-{
- zend_lex_state original_lex_state;
- zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array));
- zend_op_array *original_active_op_array = CG(active_op_array);
- zend_op_array *retval=NULL;
- int compiler_result;
- zend_bool compilation_successful=0;
- znode retval_znode;
- zend_bool original_in_compilation = CG(in_compilation);
-
- retval_znode.op_type = IS_CONST;
- retval_znode.u.constant.type = IS_LONG;
- retval_znode.u.constant.value.lval = 1;
- retval_znode.u.constant.is_ref = 0;
- retval_znode.u.constant.refcount = 1;
-
- zend_save_lexical_state(&original_lex_state TSRMLS_CC);
-
- retval = op_array; /* success oriented */
-
- if (open_file_for_scanning(file_handle TSRMLS_CC)==FAILURE) {
- if (type==ZEND_REQUIRE) {
- zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
- zend_bailout();
- } else {
- zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
- }
- compilation_successful=0;
- } else {
- init_op_array(op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
- CG(in_compilation) = 1;
- CG(active_op_array) = op_array;
- compiler_result = zendparse(TSRMLS_C);
- zend_do_return(&retval_znode, 0 TSRMLS_CC);
- CG(in_compilation) = original_in_compilation;
- if (compiler_result==1) { /* parser error */
- CG(unclean_shutdown) = 1;
- retval = NULL;
- }
- compilation_successful=1;
- }
-
- if (retval) {
- CG(active_op_array) = original_active_op_array;
- if (compilation_successful) {
- pass_two(op_array TSRMLS_CC);
- } else {
- efree(op_array);
- retval = NULL;
- }
- }
- if (compilation_successful) {
- zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
- }
- return retval;
-}
-
-
-zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC)
-{
- zend_file_handle file_handle;
- zval tmp;
- zend_op_array *retval;
-
- if (filename->type != IS_STRING) {
- tmp = *filename;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- filename = &tmp;
- }
- file_handle.filename = filename->value.str.val;
- file_handle.free_filename = 0;
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.opened_path = NULL;
-
-
- retval = zend_compile_file(&file_handle, type TSRMLS_CC);
- if (retval && file_handle.opened_path) {
- int dummy = 1;
- zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL);
- }
- zend_destroy_file_handle(&file_handle TSRMLS_CC);
-
- if (filename==&tmp) {
- zval_dtor(&tmp);
- }
- return retval;
-}
-
-ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_DC)
-{
- /* enforce two trailing NULLs for flex... */
- STR_REALLOC(str->value.str.val, str->value.str.len+2);
-
- str->value.str.val[str->value.str.len+1]=0;
-
- SCNG(yy_in)=NULL;
- yy_scan_buffer(str->value.str.val, str->value.str.len+2 TSRMLS_CC);
-
- zend_set_compiled_filename(filename TSRMLS_CC);
- CG(zend_lineno) = 1;
- CG(increment_lineno) = 0;
- return SUCCESS;
-}
-
-
-zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
-{
- zend_lex_state original_lex_state;
- zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array));
- zend_op_array *original_active_op_array = CG(active_op_array);
- zend_op_array *retval;
- zval tmp;
- int compiler_result;
- zend_bool original_in_compilation = CG(in_compilation);
-
- if (source_string->value.str.len==0) {
- efree(op_array);
- return NULL;
- }
-
- CG(in_compilation) = 1;
-
- tmp = *source_string;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- source_string = &tmp;
-
- zend_save_lexical_state(&original_lex_state TSRMLS_CC);
- if (zend_prepare_string_for_scanning(source_string, filename TSRMLS_CC)==FAILURE) {
- efree(op_array);
- retval = NULL;
- } else {
- init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
- CG(active_op_array) = op_array;
- BEGIN(ST_IN_SCRIPTING);
- compiler_result = zendparse(TSRMLS_C);
-
- if (compiler_result==1) {
- CG(active_op_array) = original_active_op_array;
- CG(unclean_shutdown)=1;
- retval = NULL;
- } else {
- zend_do_return(NULL, 0 TSRMLS_CC);
- CG(active_op_array) = original_active_op_array;
- pass_two(op_array TSRMLS_CC);
- retval = op_array;
- }
- zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
- }
- zval_dtor(&tmp);
- CG(in_compilation) = original_in_compilation;
- return retval;
-}
-
-
-BEGIN_EXTERN_C()
-int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC)
-{
- zend_lex_state original_lex_state;
- zend_file_handle file_handle;
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = filename;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
- zend_save_lexical_state(&original_lex_state TSRMLS_CC);
- if (open_file_for_scanning(&file_handle TSRMLS_CC)==FAILURE) {
- zend_message_dispatcher(ZMSG_FAILED_HIGHLIGHT_FOPEN, filename);
- return FAILURE;
- }
- zend_highlight(syntax_highlighter_ini TSRMLS_CC);
- zend_destroy_file_handle(&file_handle TSRMLS_CC);
- zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
- return SUCCESS;
-}
-
-int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC)
-{
- zend_lex_state original_lex_state;
- zval tmp = *str;
-
- str = &tmp;
- zval_copy_ctor(str);
- zend_save_lexical_state(&original_lex_state TSRMLS_CC);
- if (zend_prepare_string_for_scanning(str, str_name TSRMLS_CC)==FAILURE) {
- return FAILURE;
- }
- zend_highlight(syntax_highlighter_ini TSRMLS_CC);
- zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
- zval_dtor(str);
- return SUCCESS;
-}
-END_EXTERN_C()
-
-%}
-
-LNUM [0-9]+
-DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*)
-EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM})
-HNUM "0x"[0-9a-fA-F]+
-LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*
-WHITESPACE [ \n\r\t]+
-TABS_AND_SPACES [ \t]*
-TOKENS [;:,.\[\]()|^&+-/*=%!~$<>?@]
-ENCAPSED_TOKENS [\[\]{}$]
-ESCAPED_AND_WHITESPACE [\n\t\r #'.:;,()|^&+-/*=%!~<>?@]+
-ANY_CHAR (.|[\n])
-NEWLINE ("\r"|"\n"|"\r\n")
-
-%option noyylineno
-%option noyywrap
-%%
-
-<ST_IN_SCRIPTING>"exit" {
- return T_EXIT;
-}
-
-<ST_IN_SCRIPTING>"die" {
- return T_EXIT;
-}
-
-<ST_IN_SCRIPTING>"old_function" {
- return T_OLD_FUNCTION;
-}
-
-<ST_IN_SCRIPTING>"function"|"cfunction" {
- return T_FUNCTION;
-}
-
-<ST_IN_SCRIPTING>"const" {
- return T_CONST;
-}
-
-<ST_IN_SCRIPTING>"return" {
- return T_RETURN;
-}
-
-<ST_IN_SCRIPTING>"try" {
- return T_TRY;
-}
-
-<ST_IN_SCRIPTING>"catch" {
- return T_CATCH;
-}
-
-<ST_IN_SCRIPTING>"throw" {
- return T_THROW;
-}
-
-<ST_IN_SCRIPTING>"if" {
- return T_IF;
-}
-
-<ST_IN_SCRIPTING>"elseif" {
- return T_ELSEIF;
-}
-
-<ST_IN_SCRIPTING>"endif" {
- return T_ENDIF;
-}
-
-<ST_IN_SCRIPTING>"else" {
- return T_ELSE;
-}
-
-<ST_IN_SCRIPTING>"while" {
- return T_WHILE;
-}
-
-<ST_IN_SCRIPTING>"endwhile" {
- return T_ENDWHILE;
-}
-
-<ST_IN_SCRIPTING>"do" {
- return T_DO;
-}
-
-<ST_IN_SCRIPTING>"for" {
- return T_FOR;
-}
-
-<ST_IN_SCRIPTING>"endfor" {
- return T_ENDFOR;
-}
-
-<ST_IN_SCRIPTING>"foreach" {
- return T_FOREACH;
-}
-
-<ST_IN_SCRIPTING>"endforeach" {
- return T_ENDFOREACH;
-}
-
-<ST_IN_SCRIPTING>"declare" {
- return T_DECLARE;
-}
-
-<ST_IN_SCRIPTING>"enddeclare" {
- return T_ENDDECLARE;
-}
-
-<ST_IN_SCRIPTING>"is" {
- return T_IS_CLASS;
-}
-
-<ST_IN_SCRIPTING>"as" {
- return T_AS;
-}
-
-<ST_IN_SCRIPTING>"switch" {
- return T_SWITCH;
-}
-
-<ST_IN_SCRIPTING>"endswitch" {
- return T_ENDSWITCH;
-}
-
-<ST_IN_SCRIPTING>"case" {
- return T_CASE;
-}
-
-<ST_IN_SCRIPTING>"default" {
- return T_DEFAULT;
-}
-
-<ST_IN_SCRIPTING>"break" {
- return T_BREAK;
-}
-
-<ST_IN_SCRIPTING>"continue" {
- return T_CONTINUE;
-}
-
-<ST_IN_SCRIPTING>"echo" {
- return T_ECHO;
-}
-
-<ST_IN_SCRIPTING>"print" {
- return T_PRINT;
-}
-
-<ST_IN_SCRIPTING>"class" {
- return T_CLASS;
-}
-
-<ST_IN_SCRIPTING>"extends" {
- return T_EXTENDS;
-}
-
-<ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"->" {
- yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
- return T_OBJECT_OPERATOR;
-}
-
-<ST_LOOKING_FOR_PROPERTY>{LABEL} {
- yy_pop_state(TSRMLS_C);
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_STRING;
-}
-
-<ST_LOOKING_FOR_PROPERTY>{ANY_CHAR} {
- yyless(0);
- yy_pop_state(TSRMLS_C);
-}
-
-<ST_IN_SCRIPTING>"::" {
- return T_PAAMAYIM_NEKUDOTAYIM;
-}
-
-<ST_IN_SCRIPTING>"new" {
- return T_NEW;
-}
-
-<ST_IN_SCRIPTING>"var" {
- return T_VAR;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("int"|"integer"){TABS_AND_SPACES}")" {
- return T_INT_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("real"|"double"|"float"){TABS_AND_SPACES}")" {
- return T_DOUBLE_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"string"{TABS_AND_SPACES}")" {
- return T_STRING_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"array"{TABS_AND_SPACES}")" {
- return T_ARRAY_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"object"{TABS_AND_SPACES}")" {
- return T_OBJECT_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("bool"|"boolean"){TABS_AND_SPACES}")" {
- return T_BOOL_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("unset"){TABS_AND_SPACES}")" {
- return T_UNSET_CAST;
-}
-
-<ST_IN_SCRIPTING>"eval" {
- return T_EVAL;
-}
-
-<ST_IN_SCRIPTING>"include" {
- return T_INCLUDE;
-}
-
-<ST_IN_SCRIPTING>"import" {
- return T_IMPORT;
-}
-
-<ST_IN_SCRIPTING>"from" {
- return T_FROM;
-}
-
-<ST_IN_SCRIPTING>"include_once" {
- return T_INCLUDE_ONCE;
-}
-
-<ST_IN_SCRIPTING>"require" {
- return T_REQUIRE;
-}
-
-<ST_IN_SCRIPTING>"require_once" {
- return T_REQUIRE_ONCE;
-}
-
-<ST_IN_SCRIPTING>"use" {
- return T_USE;
-}
-
-<ST_IN_SCRIPTING>"global" {
- return T_GLOBAL;
-}
-
-<ST_IN_SCRIPTING>"isset" {
- return T_ISSET;
-}
-
-<ST_IN_SCRIPTING>"empty" {
- return T_EMPTY;
-}
-
-<ST_IN_SCRIPTING>"static" {
- return T_STATIC;
-}
-
-<ST_IN_SCRIPTING>"private" {
- return T_PRIVATE;
-}
-
-<ST_IN_SCRIPTING>"protected" {
- return T_PROTECTED;
-}
-
-<ST_IN_SCRIPTING>"public" {
- return T_VAR;
-}
-
-
-<ST_IN_SCRIPTING>"unset" {
- return T_UNSET;
-}
-
-<ST_IN_SCRIPTING>"=>" {
- return T_DOUBLE_ARROW;
-}
-
-<ST_IN_SCRIPTING>"list" {
- return T_LIST;
-}
-
-<ST_IN_SCRIPTING>"array" {
- return T_ARRAY;
-}
-
-<ST_IN_SCRIPTING>"++" {
- return T_INC;
-}
-
-<ST_IN_SCRIPTING>"--" {
- return T_DEC;
-}
-
-<ST_IN_SCRIPTING>"===" {
- return T_IS_IDENTICAL;
-}
-
-<ST_IN_SCRIPTING>"!==" {
- return T_IS_NOT_IDENTICAL;
-}
-
-<ST_IN_SCRIPTING>"==" {
- return T_IS_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"!="|"<>" {
- return T_IS_NOT_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"<=" {
- return T_IS_SMALLER_OR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>">=" {
- return T_IS_GREATER_OR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"+=" {
- return T_PLUS_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"-=" {
- return T_MINUS_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"*=" {
- return T_MUL_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"/=" {
- return T_DIV_EQUAL;
-}
-
-<ST_IN_SCRIPTING>".=" {
- return T_CONCAT_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"%=" {
- return T_MOD_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"<<=" {
- return T_SL_EQUAL;
-}
-
-<ST_IN_SCRIPTING>">>=" {
- return T_SR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"&=" {
- return T_AND_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"|=" {
- return T_OR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"^=" {
- return T_XOR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"||" {
- return T_BOOLEAN_OR;
-}
-
-<ST_IN_SCRIPTING>"&&" {
- return T_BOOLEAN_AND;
-}
-
-<ST_IN_SCRIPTING>"OR" {
- return T_LOGICAL_OR;
-}
-
-<ST_IN_SCRIPTING>"AND" {
- return T_LOGICAL_AND;
-}
-
-<ST_IN_SCRIPTING>"XOR" {
- return T_LOGICAL_XOR;
-}
-
-<ST_IN_SCRIPTING>"<<" {
- return T_SL;
-}
-
-<ST_IN_SCRIPTING>">>" {
- return T_SR;
-}
-
-<ST_IN_SCRIPTING>{TOKENS} {
- return yytext[0];
-}
-
-
-<ST_IN_SCRIPTING>"{" {
- yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
- return '{';
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"${" {
- yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC);
- return T_DOLLAR_OPEN_CURLY_BRACES;
-}
-
-
-<ST_IN_SCRIPTING>"}" {
- /* This is a temporary fix which is dependant on flex and it's implementation */
- if (yy_start_stack_ptr) {
- yy_pop_state(TSRMLS_C);
- }
- return '}';
-}
-
-
-<ST_LOOKING_FOR_VARNAME>{LABEL} {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- yy_pop_state(TSRMLS_C);
- yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
- return T_STRING_VARNAME;
-}
-
-
-<ST_LOOKING_FOR_VARNAME>{ANY_CHAR} {
- yyless(0);
- yy_pop_state(TSRMLS_C);
- yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
-}
-
-
-<ST_IN_SCRIPTING>{LNUM} {
- errno = 0;
- zendlval->value.lval = strtol(yytext, NULL, 0);
- if (errno == ERANGE) { /* overflow */
- zendlval->value.dval = strtod(yytext, NULL);
- zendlval->type = IS_DOUBLE;
- return T_DNUMBER;
- } else {
- zendlval->type = IS_LONG;
- return T_LNUMBER;
- }
-}
-
-<ST_IN_SCRIPTING>{HNUM} {
- errno = 0;
- zendlval->value.lval = strtoul(yytext, NULL, 16);
- if (errno == ERANGE) { /* overflow */
- /* not trying strtod - it returns trash on 0x-es */
- zendlval->value.lval = LONG_MAX; /* maximal long */
- zend_error(E_NOTICE,"Hex number is too big: %s", yytext);
- } else {
- if (zendlval->value.lval < 0) {
- /* maintain consistency with the old way */
- zendlval->value.dval = (unsigned long) zendlval->value.lval;
- zendlval->type = IS_DOUBLE;
- return T_DNUMBER;
- }
- zendlval->type = IS_LONG;
- }
- zendlval->type = IS_LONG;
- return T_LNUMBER;
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{LNUM}|{HNUM} { /* treat numbers (almost) as strings inside encapsulated strings */
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_NUM_STRING;
-}
-
-<ST_IN_SCRIPTING>{DNUM}|{EXPONENT_DNUM} {
- zendlval->value.dval = strtod(yytext, NULL);
- zendlval->type = IS_DOUBLE;
- return T_DNUMBER;
-}
-
-<ST_IN_SCRIPTING>"__CLASS__" {
- char *class_name = CG(active_class_entry)->name;
-
- if (!class_name) {
- class_name = "";
- }
- zendlval->value.str.len = strlen(class_name);
- zendlval->value.str.val = estrndup(class_name, zendlval->value.str.len);
- zendlval->type = IS_STRING;
- return T_CLASS_C;
-}
-
-<ST_IN_SCRIPTING>"__FUNCTION__" {
- char *func_name = CG(active_op_array)->function_name;
-
- if (!func_name) {
- func_name = "";
- }
- zendlval->value.str.len = strlen(func_name);
- zendlval->value.str.val = estrndup(func_name, zendlval->value.str.len);
- zendlval->type = IS_STRING;
- return T_FUNC_C;
-}
-
-<ST_IN_SCRIPTING>"__LINE__" {
- zendlval->value.lval = CG(zend_lineno);
- zendlval->type = IS_LONG;
- return T_LINE;
-}
-
-<ST_IN_SCRIPTING>"__FILE__" {
- char *filename = zend_get_compiled_filename(TSRMLS_C);
-
- if (!filename) {
- filename = "";
- }
- zendlval->value.str.len = strlen(filename);
- zendlval->value.str.val = estrndup(filename, zendlval->value.str.len);
- zendlval->type = IS_STRING;
- return T_FILE;
-}
-
-
-<INITIAL>(([^<]|"<"[^?%s<]){1,400})|"<s"|"<" {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- HANDLE_NEWLINES(yytext, yyleng);
- return T_INLINE_HTML;
-}
-
-<INITIAL>"<?"|"<script"{WHITESPACE}+"language"{WHITESPACE}*"="{WHITESPACE}*("php"|"\"php\""|"\'php\'"){WHITESPACE}*">" {
- HANDLE_NEWLINES(yytext, yyleng);
- if (CG(short_tags) || yyleng>2) { /* yyleng>2 means it's not <? but <script> */
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG;
- } else {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_INLINE_HTML;
- }
-}
-
-
-<INITIAL>"<%="|"<?=" {
- if ((yytext[1]=='%' && CG(asp_tags)) || (yytext[1]=='?' && CG(short_tags))) {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG_WITH_ECHO;
- } else {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_INLINE_HTML;
- }
-}
-
-
-<INITIAL>"<%" {
- if (CG(asp_tags)) {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG;
- } else {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_INLINE_HTML;
- }
-}
-
-
-<INITIAL>"<?php"([ \t]|{NEWLINE}) {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- HANDLE_NEWLINE(yytext[yyleng-1]);
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG;
-}
-
-
-<INITIAL>"<?php_track_vars?>"{NEWLINE}? {
- zend_error(E_WARNING, "&lt;?php_track_vars?&gt; is no longer supported - please use the track_vars INI directive instead");
- HANDLE_NEWLINE(yytext[yyleng-1]);
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_INLINE_HTML;
-}
-
-<ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE>"$"{LABEL} {
- zendlval->value.str.val = (char *)estrndup(yytext+1, yyleng-1);
- zendlval->value.str.len = yyleng-1;
- zendlval->type = IS_STRING;
- return T_VARIABLE;
-}
-
-
-<ST_IN_SCRIPTING>{LABEL} {
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_STRING;
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{LABEL} {
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_STRING;
-}
-
-
-<ST_IN_SCRIPTING>{WHITESPACE} {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- HANDLE_NEWLINES(yytext, yyleng);
- return T_WHITESPACE;
-}
-
-
-<ST_IN_SCRIPTING>"#"|"//" {
- BEGIN(ST_ONE_LINE_COMMENT);
- yymore();
-}
-
-<ST_ONE_LINE_COMMENT>"?"|"%"|">" {
- yymore();
-}
-
-<ST_ONE_LINE_COMMENT>[^\n\r?%>]+ {
- yymore();
-}
-
-<ST_ONE_LINE_COMMENT>{NEWLINE} {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(ST_IN_SCRIPTING);
- CG(zend_lineno)++;
- return T_COMMENT;
-}
-
-<ST_ONE_LINE_COMMENT>"?>"|"%>" {
- if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- yyless(yyleng-2);
- BEGIN(ST_IN_SCRIPTING);
- return T_COMMENT;
- } else {
- yymore();
- }
-}
-
-<ST_IN_SCRIPTING>"/*" {
- CG(comment_start_line) = CG(zend_lineno);
- BEGIN(ST_COMMENT);
- yymore();
-}
-
-
-<ST_COMMENT>[^*]+ {
- yymore();
-}
-
-<ST_COMMENT>"*/" {
- HANDLE_NEWLINES(yytext, yyleng);
- BEGIN(ST_IN_SCRIPTING);
- return T_COMMENT;
-}
-
-<ST_COMMENT>"*" {
- yymore();
-}
-
-<ST_IN_SCRIPTING>("?>"|"</script"{WHITESPACE}*">"){NEWLINE}? {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(INITIAL);
- return T_CLOSE_TAG; /* implicit ';' at php-end tag */
-}
-
-
-<ST_IN_SCRIPTING>"%>"{NEWLINE}? {
- if (CG(asp_tags)) {
- BEGIN(INITIAL);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- zendlval->value.str.val = yytext; /* no copying - intentional */
- return T_CLOSE_TAG; /* implicit ';' at php-end tag */
- } else {
- yyless(1);
- return yytext[0];
- }
-}
-
-
-<ST_IN_SCRIPTING>(["]([^$"\\]|("\\".))*["]) {
- register char *s, *t;
- char *end;
-
- zendlval->value.str.val = estrndup(yytext+1, yyleng-2);
- zendlval->value.str.len = yyleng-2;
- zendlval->type = IS_STRING;
- HANDLE_NEWLINES(yytext, yyleng);
-
- /* convert escape sequences */
- s = t = zendlval->value.str.val;
- end = s+zendlval->value.str.len;
- while (s<end) {
- if (*s=='\\') {
- s++;
- if (s>=end) {
- continue;
- }
- switch(*s) {
- case 'n':
- *t++ = '\n';
- zendlval->value.str.len--;
- break;
- case 'r':
- *t++ = '\r';
- zendlval->value.str.len--;
- break;
- case 't':
- *t++ = '\t';
- zendlval->value.str.len--;
- break;
- case '\\':
- case '$':
- case '"':
- *t++ = *s;
- zendlval->value.str.len--;
- break;
- default:
- /* check for an octal */
- if (ZEND_IS_OCT(*s)) {
- char octal_buf[4] = { 0, 0, 0, 0 };
-
- octal_buf[0] = *s;
- zendlval->value.str.len--;
- if ((s+1)<end && ZEND_IS_OCT(*(s+1))) {
- octal_buf[1] = *(++s);
- zendlval->value.str.len--;
- if ((s+1)<end && ZEND_IS_OCT(*(s+1))) {
- octal_buf[2] = *(++s);
- zendlval->value.str.len--;
- }
- }
- *t++ = (char) strtol(octal_buf, NULL, 8);
- } else if (*s=='x' && (s+1)<end && ZEND_IS_HEX(*(s+1))) {
- char hex_buf[3] = { 0, 0, 0};
-
- zendlval->value.str.len--; /* for the 'x' */
-
- hex_buf[0] = *(++s);
- zendlval->value.str.len--;
- if ((s+1)<end && ZEND_IS_HEX(*(s+1))) {
- hex_buf[1] = *(++s);
- zendlval->value.str.len--;
- }
- *t++ = (char) strtol(hex_buf, NULL, 16);
- } else {
- *t++ = '\\';
- *t++ = *s;
- }
- break;
- }
- s++;
- } else {
- *t++ = *s++;
- }
- }
- *t = 0;
-
- return T_CONSTANT_ENCAPSED_STRING;
-}
-
-
-<ST_IN_SCRIPTING>([']([^'\\]|("\\".))*[']) {
- register char *s, *t;
- char *end;
-
- zendlval->value.str.val = estrndup(yytext+1, yyleng-2);
- zendlval->value.str.len = yyleng-2;
- zendlval->type = IS_STRING;
- HANDLE_NEWLINES(yytext, yyleng);
-
- /* convert escape sequences */
- s = t = zendlval->value.str.val;
- end = s+zendlval->value.str.len;
- while (s<end) {
- if (*s=='\\') {
- s++;
- if (s>=end) {
- continue;
- }
- switch(*s) {
- case '\\':
- case '\'':
- *t++ = *s;
- zendlval->value.str.len--;
- break;
- default:
- *t++ = '\\';
- *t++ = *s;
- break;
- }
- s++;
- } else {
- *t++ = *s++;
- }
- }
- *t = 0;
-
- return T_CONSTANT_ENCAPSED_STRING;
-}
-
-
-<ST_IN_SCRIPTING>["] {
- BEGIN(ST_DOUBLE_QUOTES);
- return '\"';
-}
-
-
-<ST_IN_SCRIPTING>"<<<"{TABS_AND_SPACES}{LABEL}{NEWLINE} {
- char *s;
- CG(zend_lineno)++;
- CG(heredoc_len) = yyleng-3-1-(yytext[yyleng-2]=='\r'?1:0);
- s = yytext+3;
- while ((*s == ' ') || (*s == '\t')) {
- s++;
- CG(heredoc_len)--;
- }
- CG(heredoc) = estrndup(s, CG(heredoc_len));
- BEGIN(ST_HEREDOC);
- return T_START_HEREDOC;
-}
-
-
-<ST_IN_SCRIPTING>[`] {
- BEGIN(ST_BACKQUOTE);
- return '`';
-}
-
-
-<ST_IN_SCRIPTING>['] {
- BEGIN(ST_SINGLE_QUOTE);
- return '\'';
-}
-
-
-<ST_HEREDOC>^{LABEL}(";")?{NEWLINE} {
- int label_len;
- unsigned char unput_semicolon;
-
- CG(zend_lineno)++;
- if (yytext[yyleng-2]=='\r') {
- label_len = yyleng-2;
- } else {
- label_len = yyleng-1;
- }
-
- if (yytext[label_len-1]==';') {
- label_len--;
- unput_semicolon=1;
- } else{
- unput_semicolon=0;
- }
-
- if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) {
- zendlval->value.str.val = estrndup(yytext, yyleng); /* unput destroys yytext */
- zendlval->value.str.len = yyleng;
- if (unput_semicolon) {
- unput(';');
- }
- efree(CG(heredoc));
- CG(heredoc)=NULL;
- CG(heredoc_len)=0;
- BEGIN(ST_IN_SCRIPTING);
- return T_END_HEREDOC;
- } else {
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_STRING;
- }
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{ESCAPED_AND_WHITESPACE} {
- HANDLE_NEWLINES(yytext, yyleng);
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_ENCAPSED_AND_WHITESPACE;
-}
-
-<ST_SINGLE_QUOTE>([^'\\]|\\[^'\\])+ {
- HANDLE_NEWLINES(yytext, yyleng);
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_ENCAPSED_AND_WHITESPACE;
-}
-
-
-<ST_DOUBLE_QUOTES>[`]+ {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_ENCAPSED_AND_WHITESPACE;
-}
-
-
-<ST_BACKQUOTE>["]+ {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_ENCAPSED_AND_WHITESPACE;
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"$"[^a-zA-Z_\x7f-\xff{] {
- zendlval->value.lval = (long) yytext[0];
- if (yyleng == 2) {
- yyless(1);
- }
- return T_CHARACTER;
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{ENCAPSED_TOKENS} {
- zendlval->value.lval = (long) yytext[0];
- return yytext[0];
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"{$" {
- zendlval->value.lval = (long) yytext[0];
- yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
- yyless(1);
- return T_CURLY_OPEN;
-}
-
-
-<ST_SINGLE_QUOTE>"\\'" {
- zendlval->value.lval = (long) '\'';
- return T_CHARACTER;
-}
-
-<ST_SINGLE_QUOTE>"\\\\" {
- zendlval->value.lval = (long)'\\';
- return T_CHARACTER;
-}
-
-<ST_DOUBLE_QUOTES>"\\\"" {
- zendlval->value.lval = (long) '"';
- return T_CHARACTER;
-}
-
-<ST_BACKQUOTE>"\\`" {
- zendlval->value.lval = (long) '`';
- return T_CHARACTER;
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\"[0-7]{1,3} {
- zendlval->value.lval = strtol(yytext+1, NULL, 8);
- return T_CHARACTER;
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\x"[0-9A-Fa-f]{1,2} {
- zendlval->value.lval = strtol (yytext+2, NULL, 16);
- return T_CHARACTER;
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\"{ANY_CHAR} {
- switch (yytext[1]) {
- case 'n':
- zendlval->value.lval = (long) '\n';
- break;
- case 't':
- zendlval->value.lval = (long) '\t';
- break;
- case 'r':
- zendlval->value.lval = (long) '\r';
- break;
- case '\\':
- zendlval->value.lval = (long) '\\';
- break;
- case '$':
- zendlval->value.lval = (long) yytext[1];
- break;
- case '{':
- zendlval->value.lval = (long) yytext[1];
- break;
- default:
- zendlval->value.str.val = estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_BAD_CHARACTER;
- break;
- }
- return T_CHARACTER;
-}
-
-
-<ST_HEREDOC>["'`]+ {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_ENCAPSED_AND_WHITESPACE;
-}
-
-
-<ST_DOUBLE_QUOTES>["] {
- BEGIN(ST_IN_SCRIPTING);
- return '\"';
-}
-
-
-<ST_BACKQUOTE>[`] {
- BEGIN(ST_IN_SCRIPTING);
- return '`';
-}
-
-
-<ST_SINGLE_QUOTE>['] {
- BEGIN(ST_IN_SCRIPTING);
- return '\'';
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,INITIAL,ST_IN_SCRIPTING,ST_LOOKING_FOR_PROPERTY><<EOF>> {
- return 0;
-}
-
-<ST_COMMENT><<EOF>> {
- zend_error(E_COMPILE_WARNING,"Unterminated comment starting line %d", CG(comment_start_line));
- return 0;
-}
-
-
-
-<ST_IN_SCRIPTING,INITIAL,ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_SINGLE_QUOTE,ST_HEREDOC>{ANY_CHAR} {
- zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
-}
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
deleted file mode 100644
index 2733cb42ff..0000000000
--- a/Zend/zend_list.c
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-/* resource lists */
-
-#include "zend.h"
-#include "zend_list.h"
-#include "zend_API.h"
-#include "zend_globals.h"
-
-ZEND_API int le_index_ptr;
-
-/* true global */
-static HashTable list_destructors;
-
-
-ZEND_API int zend_list_insert(void *ptr, int type)
-{
- int index;
- zend_rsrc_list_entry le;
- TSRMLS_FETCH();
-
- le.ptr=ptr;
- le.type=type;
- le.refcount=1;
-
- index = zend_hash_next_free_element(&EG(regular_list));
- zend_hash_index_update(&EG(regular_list), index, (void *) &le, sizeof(zend_rsrc_list_entry), NULL);
- return index;
-}
-
-ZEND_API int _zend_list_delete(int id TSRMLS_DC)
-{
- zend_rsrc_list_entry *le;
-
- if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
-/* printf("del(%d): %d->%d\n", id, le->refcount, le->refcount-1); */
- if (--le->refcount<=0) {
- return zend_hash_index_del(&EG(regular_list), id);
- } else {
- return SUCCESS;
- }
- } else {
- return FAILURE;
- }
-}
-
-
-ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC)
-{
- zend_rsrc_list_entry *le;
-
- if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
- *type = le->type;
- return le->ptr;
- } else {
- *type = -1;
- return NULL;
- }
-}
-
-
-ZEND_API int _zend_list_addref(int id TSRMLS_DC)
-{
- zend_rsrc_list_entry *le;
-
- if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
-/* printf("add(%d): %d->%d\n", id, le->refcount, le->refcount+1); */
- le->refcount++;
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-
-ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type)
-{
- int rsrc_id;
-
- rsrc_id = zend_list_insert(rsrc_pointer, rsrc_type);
-
- if (rsrc_result) {
- rsrc_result->value.lval = rsrc_id;
- rsrc_result->type = IS_RESOURCE;
- }
-
- return rsrc_id;
-}
-
-
-ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...)
-{
- int id;
- int actual_resource_type;
- void *resource;
- va_list resource_types;
- int i;
-
- if (default_id==-1) { /* use id */
- if (!passed_id) {
- if (resource_type_name) {
- zend_error(E_WARNING, "%s(): no %s resource supplied", get_active_function_name(TSRMLS_C), resource_type_name);
- }
- return NULL;
- } else if ((*passed_id)->type != IS_RESOURCE) {
- if (resource_type_name) {
- zend_error(E_WARNING, "%s(): supplied argument is not a valid %s resource", get_active_function_name(TSRMLS_C), resource_type_name);
- }
- return NULL;
- }
- id = (*passed_id)->value.lval;
- } else {
- id = default_id;
- }
-
- resource = zend_list_find(id, &actual_resource_type);
- if (!resource) {
- if (resource_type_name) {
- zend_error(E_WARNING, "%s(): %d is not a valid %s resource", get_active_function_name(TSRMLS_C), id, resource_type_name);
- }
- return NULL;
- }
-
- va_start(resource_types, num_resource_types);
- for (i=0; i<num_resource_types; i++) {
- if (actual_resource_type == va_arg(resource_types, int)) {
- va_end(resource_types);
- if (found_resource_type) {
- *found_resource_type = actual_resource_type;
- }
- return resource;
- }
- }
- va_end(resource_types);
-
- if (resource_type_name) {
- zend_error(E_WARNING, "%s(): supplied resource is not a valid %s resource", get_active_function_name(TSRMLS_C), resource_type_name);
- }
-
- return NULL;
-}
-
-
-void list_entry_destructor(void *ptr)
-{
- zend_rsrc_list_entry *le = (zend_rsrc_list_entry *) ptr;
- zend_rsrc_list_dtors_entry *ld;
- TSRMLS_FETCH();
-
- if (zend_hash_index_find(&list_destructors, le->type, (void **) &ld)==SUCCESS) {
- switch (ld->type) {
- case ZEND_RESOURCE_LIST_TYPE_STD:
- if (ld->list_dtor) {
- (ld->list_dtor)(le->ptr);
- }
- break;
- case ZEND_RESOURCE_LIST_TYPE_EX:
- if (ld->list_dtor_ex) {
- ld->list_dtor_ex(le TSRMLS_CC);
- }
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- } else {
- zend_error(E_WARNING,"Unknown list entry type in request shutdown (%d)", le->type);
- }
-}
-
-
-void plist_entry_destructor(void *ptr)
-{
- zend_rsrc_list_entry *le = (zend_rsrc_list_entry *) ptr;
- zend_rsrc_list_dtors_entry *ld;
- TSRMLS_FETCH();
-
- if (zend_hash_index_find(&list_destructors, le->type, (void **) &ld)==SUCCESS) {
- switch (ld->type) {
- case ZEND_RESOURCE_LIST_TYPE_STD:
- if (ld->plist_dtor) {
- (ld->plist_dtor)(le->ptr);
- }
- break;
- case ZEND_RESOURCE_LIST_TYPE_EX:
- if (ld->plist_dtor_ex) {
- ld->plist_dtor_ex(le TSRMLS_CC);
- }
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
- }
- } else {
- zend_error(E_WARNING,"Unknown persistent list entry type in module shutdown (%d)", le->type);
- }
-}
-
-
-int zend_init_rsrc_list(TSRMLS_D)
-{
- if (zend_hash_init(&EG(regular_list), 0, NULL, list_entry_destructor, 0)==SUCCESS) {
- EG(regular_list).nNextFreeElement=1; /* we don't want resource id 0 */
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-
-int zend_init_rsrc_plist(TSRMLS_D)
-{
- return zend_hash_init_ex(&EG(persistent_list), 0, NULL, plist_entry_destructor, 1, 0);
-}
-
-
-void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC)
-{
- zend_hash_graceful_reverse_destroy(ht);
-}
-
-static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id TSRMLS_DC)
-{
- if (le->type == *resource_id) {
- return 1;
- } else {
- return 0;
- }
-}
-
-
-static int zend_clean_module_rsrc_dtors_cb(zend_rsrc_list_dtors_entry *ld, int *module_number TSRMLS_DC)
-{
- if (ld->module_number == *module_number) {
- zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC);
- zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC);
- return 1;
- } else {
- return 0;
- }
-}
-
-
-void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC)
-{
- zend_hash_apply_with_argument(&list_destructors, (apply_func_arg_t) zend_clean_module_rsrc_dtors_cb, (void *) &module_number TSRMLS_CC);
-}
-
-
-ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number)
-{
- zend_rsrc_list_dtors_entry lde;
-
-#if 0
- printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number);
-#endif
-
- lde.list_dtor=(void (*)(void *)) ld;
- lde.plist_dtor=(void (*)(void *)) pld;
- lde.list_dtor_ex = lde.plist_dtor_ex = NULL;
- lde.module_number = module_number;
- lde.resource_id = list_destructors.nNextFreeElement;
- lde.type = ZEND_RESOURCE_LIST_TYPE_STD;
- lde.type_name = NULL;
-
- if (zend_hash_next_index_insert(&list_destructors, (void *) &lde, sizeof(zend_rsrc_list_dtors_entry), NULL)==FAILURE) {
- return FAILURE;
- }
- return list_destructors.nNextFreeElement-1;
-}
-
-
-ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_func_t pld, char *type_name, int module_number)
-{
- zend_rsrc_list_dtors_entry lde;
-
-#if 0
- printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number);
-#endif
-
- lde.list_dtor = NULL;
- lde.plist_dtor = NULL;
- lde.list_dtor_ex = ld;
- lde.plist_dtor_ex = pld;
- lde.module_number = module_number;
- lde.resource_id = list_destructors.nNextFreeElement;
- lde.type = ZEND_RESOURCE_LIST_TYPE_EX;
- lde.type_name = type_name;
-
- if (zend_hash_next_index_insert(&list_destructors, (void *) &lde, sizeof(zend_rsrc_list_dtors_entry), NULL)==FAILURE) {
- return FAILURE;
- }
- return list_destructors.nNextFreeElement-1;
-}
-
-ZEND_API int zend_fetch_list_dtor_id(char *type_name)
-{
- zend_rsrc_list_dtors_entry *lde;
- HashPosition pos;
-
- zend_hash_internal_pointer_reset_ex(&list_destructors, &pos);
- while (zend_hash_get_current_data_ex(&list_destructors, (void **)&lde, &pos) == SUCCESS) {
- if (strcmp(type_name, lde->type_name) == 0) {
-#if 0
- printf("Found resource id %d for resource type %s\n", (*lde).resource_id, type_name);
-#endif
- return lde->resource_id;
- }
- zend_hash_move_forward_ex(&list_destructors, &pos);
- }
-
- return 0;
-}
-
-int zend_init_rsrc_list_dtors(void)
-{
- int retval;
-
- retval = zend_hash_init(&list_destructors, 50, NULL, NULL, 1);
- list_destructors.nNextFreeElement=1; /* we don't want resource type 0 */
-
- return retval;
-}
-
-
-void zend_destroy_rsrc_list_dtors(void)
-{
- zend_hash_destroy(&list_destructors);
-}
-
-
-char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC)
-{
- zend_rsrc_list_dtors_entry *lde;
- int rsrc_type;
-
- if (!zend_list_find(resource, &rsrc_type))
- return NULL;
-
- if (zend_hash_index_find(&list_destructors, rsrc_type, (void **) &lde)==SUCCESS) {
- return lde->type_name;
- } else {
- return NULL;
- }
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_list.h b/Zend/zend_list.h
deleted file mode 100644
index 448e4576fb..0000000000
--- a/Zend/zend_list.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_LIST_H
-#define ZEND_LIST_H
-
-#include "zend_hash.h"
-#include "zend_globals.h"
-
-BEGIN_EXTERN_C()
-
-#define ZEND_RESOURCE_LIST_TYPE_STD 1
-#define ZEND_RESOURCE_LIST_TYPE_EX 2
-
-typedef struct _zend_rsrc_list_entry {
- void *ptr;
- int type;
- int refcount;
-} zend_rsrc_list_entry;
-
-typedef void (*rsrc_dtor_func_t)(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-#define ZEND_RSRC_DTOR_FUNC(name) void name(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-
-typedef struct _zend_rsrc_list_dtors_entry {
- /* old style destructors */
- void (*list_dtor)(void *);
- void (*plist_dtor)(void *);
-
- /* new style destructors */
- rsrc_dtor_func_t list_dtor_ex;
- rsrc_dtor_func_t plist_dtor_ex;
-
- char *type_name;
-
- int module_number;
- int resource_id;
- unsigned char type;
-} zend_rsrc_list_dtors_entry;
-
-
-#define register_list_destructors(ld, pld) zend_register_list_destructors((void (*)(void *))ld, (void (*)(void *))pld, module_number);
-ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number);
-ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_func_t pld, char *type_name, int module_number);
-
-void list_entry_destructor(void *ptr);
-void plist_entry_destructor(void *ptr);
-
-void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC);
-int zend_init_rsrc_list(TSRMLS_D);
-int zend_init_rsrc_plist(TSRMLS_D);
-void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC);
-int zend_init_rsrc_list_dtors(void);
-void zend_destroy_rsrc_list_dtors(void);
-
-ZEND_API int zend_list_insert(void *ptr, int type);
-ZEND_API int _zend_list_addref(int id TSRMLS_DC);
-ZEND_API int _zend_list_delete(int id TSRMLS_DC);
-ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC);
-
-#define zend_list_addref(id) _zend_list_addref(id TSRMLS_CC)
-#define zend_list_delete(id) _zend_list_delete(id TSRMLS_CC)
-#define zend_list_find(id, type) _zend_list_find(id, type TSRMLS_CC)
-
-ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type);
-ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...);
-
-ZEND_API char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC);
-ZEND_API int zend_fetch_list_dtor_id(char *type_name);
-
-extern ZEND_API int le_index_ptr; /* list entry type for index pointers */
-
-#define ZEND_VERIFY_RESOURCE(rsrc) \
- if (!rsrc) { \
- RETURN_NULL(); \
- }
-
-#define ZEND_FETCH_RESOURCE(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type) \
- rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 1, resource_type); \
- ZEND_VERIFY_RESOURCE(rsrc);
-
-#define ZEND_FETCH_RESOURCE2(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type1, resource_type2) \
- rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 2, resource_type1, resource_type2); \
- ZEND_VERIFY_RESOURCE(rsrc);
-
-#define ZEND_REGISTER_RESOURCE(rsrc_result, rsrc_pointer, rsrc_type) \
- zend_register_resource(rsrc_result, rsrc_pointer, rsrc_type);
-
-#define ZEND_GET_RESOURCE_TYPE_ID(le_id, le_type_name) \
- if (le_id == 0) { \
- le_id = zend_fetch_list_dtor_id(le_type_name); \
- }
-END_EXTERN_C()
-
-#endif
diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c
deleted file mode 100644
index bb47f9b459..0000000000
--- a/Zend/zend_llist.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "zend.h"
-#include "zend_llist.h"
-#include "zend_qsort.h"
-
-ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent)
-{
- l->head = NULL;
- l->tail = NULL;
- l->count = 0;
- l->size = size;
- l->dtor = dtor;
- l->persistent = persistent;
-}
-
-
-ZEND_API void zend_llist_add_element(zend_llist *l, void *element)
-{
- zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent);
-
- tmp->prev = l->tail;
- tmp->next = NULL;
- if (l->tail) {
- l->tail->next = tmp;
- } else {
- l->head = tmp;
- }
- l->tail = tmp;
- memcpy(tmp->data, element, l->size);
-
- ++l->count;
-}
-
-
-ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element)
-{
- zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent);
-
- tmp->next = l->head;
- tmp->prev = NULL;
- if (l->head) {
- l->head->prev = tmp;
- } else {
- l->tail = tmp;
- }
- l->head = tmp;
- memcpy(tmp->data, element, l->size);
-
- ++l->count;
-}
-
-
-#define DEL_LLIST_ELEMENT(current, l) \
- if ((current)->prev) {\
- (current)->prev->next = (current)->next;\
- } else {\
- (l)->head = (current)->next;\
- }\
- if ((current)->next) {\
- (current)->next->prev = (current)->prev;\
- } else {\
- (l)->tail = (current)->prev;\
- }\
- if ((l)->dtor) {\
- (l)->dtor((current)->data);\
- }\
- pefree((current), (l)->persistent);\
- --l->count;
-
-
-ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2))
-{
- zend_llist_element *current=l->head;
- zend_llist_element *next;
-
- while (current) {
- next = current->next;
- if (compare(current->data, element)) {
- DEL_LLIST_ELEMENT(current, l);
- break;
- }
- current = next;
- }
-}
-
-
-ZEND_API void zend_llist_destroy(zend_llist *l)
-{
- zend_llist_element *current=l->head, *next;
-
- while (current) {
- next = current->next;
- if (l->dtor) {
- l->dtor(current->data);
- }
- pefree(current, l->persistent);
- current = next;
- }
-
- l->count = 0;
-}
-
-
-ZEND_API void zend_llist_clean(zend_llist *l)
-{
- zend_llist_destroy(l);
- l->head = l->tail = NULL;
-}
-
-
-ZEND_API void *zend_llist_remove_tail(zend_llist *l)
-{
- zend_llist_element *old_tail;
- void *data;
-
- if ((old_tail = l->tail)) {
- if (l->tail->prev) {
- l->tail->prev->next = NULL;
- }
-
- data = old_tail->data;
-
- l->tail = l->tail->prev;
- if (l->dtor) {
- l->dtor(data);
- }
- pefree(old_tail, l->persistent);
-
- --l->count;
-
- return data;
- }
-
- return NULL;
-}
-
-
-ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src)
-{
- zend_llist_element *ptr;
-
- zend_llist_init(dst, src->size, src->dtor, src->persistent);
- ptr = src->head;
- while (ptr) {
- zend_llist_add_element(dst, ptr->data);
- ptr = ptr->next;
- }
-}
-
-
-ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data))
-{
- zend_llist_element *element, *next;
-
- element=l->head;
- while (element) {
- next = element->next;
- if (func(element->data)) {
- DEL_LLIST_ELEMENT(element, l);
- }
- element = next;
- }
-}
-
-
-ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC)
-{
- zend_llist_element *element;
-
- for (element=l->head; element; element=element->next) {
- func(element->data TSRMLS_CC);
- }
-}
-
-ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC)
-{
- size_t i;
-
- zend_llist_element **elements;
- zend_llist_element *element, **ptr;
-
- if (l->count <= 0) {
- return;
- }
-
- elements = (zend_llist_element **) emalloc(l->count * sizeof(zend_llist_element *));
-
- ptr = &elements[0];
-
- for (element=l->head; element; element=element->next) {
- *ptr++ = element;
- }
-
- zend_qsort(elements, l->count, sizeof(zend_llist_element *), (compare_func_t) comp_func TSRMLS_CC);
-
- l->head = elements[0];
- elements[0]->prev = NULL;
-
- for (i = 1; i < l->count; i++) {
- elements[i]->prev = elements[i-1];
- elements[i-1]->next = elements[i];
- }
- elements[i-1]->next = NULL;
- l->tail = elements[i-1];
- efree(elements);
-}
-
-
-ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC)
-{
- zend_llist_element *element;
-
- for (element=l->head; element; element=element->next) {
- func(element->data, arg TSRMLS_CC);
- }
-}
-
-
-ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...)
-{
- zend_llist_element *element;
- va_list args;
-
- va_start(args, num_args);
- for (element=l->head; element; element=element->next) {
- func(element->data, num_args, args TSRMLS_CC);
- }
- va_end(args);
-}
-
-
-ZEND_API int zend_llist_count(zend_llist *l)
-{
- return l->count;
-}
-
-
-ZEND_API void *zend_llist_get_first_ex(zend_llist *l, zend_llist_position *pos)
-{
- zend_llist_position *current = pos ? pos : &l->traverse_ptr;
-
- *current = l->head;
- if (*current) {
- return (*current)->data;
- } else {
- return NULL;
- }
-}
-
-
-ZEND_API void *zend_llist_get_last_ex(zend_llist *l, zend_llist_position *pos)
-{
- zend_llist_position *current = pos ? pos : &l->traverse_ptr;
-
- *current = l->tail;
- if (*current) {
- return (*current)->data;
- } else {
- return NULL;
- }
-}
-
-
-ZEND_API void *zend_llist_get_next_ex(zend_llist *l, zend_llist_position *pos)
-{
- zend_llist_position *current = pos ? pos : &l->traverse_ptr;
-
- if (*current) {
- *current = (*current)->next;
- if (*current) {
- return (*current)->data;
- }
- }
- return NULL;
-}
-
-
-ZEND_API void *zend_llist_get_prev_ex(zend_llist *l, zend_llist_position *pos)
-{
- zend_llist_position *current = pos ? pos : &l->traverse_ptr;
-
- if (*current) {
- *current = (*current)->prev;
- if (*current) {
- return (*current)->data;
- }
- }
- return NULL;
-}
diff --git a/Zend/zend_llist.h b/Zend/zend_llist.h
deleted file mode 100644
index 6fddbb2d92..0000000000
--- a/Zend/zend_llist.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_LLIST_H
-#define ZEND_LLIST_H
-
-typedef struct _zend_llist_element {
- struct _zend_llist_element *next;
- struct _zend_llist_element *prev;
- char data[1]; /* Needs to always be last in the struct */
-} zend_llist_element;
-
-typedef void (*llist_dtor_func_t)(void *);
-typedef int (*llist_compare_func_t)(const zend_llist_element *, const zend_llist_element * TSRMLS_DC);
-typedef void (*llist_apply_with_args_func_t)(void *data, int num_args, va_list args TSRMLS_DC);
-typedef void (*llist_apply_with_arg_func_t)(void *data, void *arg TSRMLS_DC);
-typedef void (*llist_apply_func_t)(void * TSRMLS_DC);
-
-typedef struct _zend_llist {
- zend_llist_element *head;
- zend_llist_element *tail;
- size_t count;
- size_t size;
- llist_dtor_func_t dtor;
- unsigned char persistent;
- zend_llist_element *traverse_ptr;
-} zend_llist;
-
-typedef zend_llist_element* zend_llist_position;
-
-BEGIN_EXTERN_C()
-ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent);
-ZEND_API void zend_llist_add_element(zend_llist *l, void *element);
-ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element);
-ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2));
-ZEND_API void zend_llist_destroy(zend_llist *l);
-ZEND_API void zend_llist_clean(zend_llist *l);
-ZEND_API void *zend_llist_remove_tail(zend_llist *l);
-ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src);
-ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC);
-ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data));
-ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC);
-ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...);
-ZEND_API int zend_llist_count(zend_llist *l);
-ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC);
-
-/* traversal */
-ZEND_API void *zend_llist_get_first_ex(zend_llist *l, zend_llist_position *pos);
-ZEND_API void *zend_llist_get_last_ex(zend_llist *l, zend_llist_position *pos);
-ZEND_API void *zend_llist_get_next_ex(zend_llist *l, zend_llist_position *pos);
-ZEND_API void *zend_llist_get_prev_ex(zend_llist *l, zend_llist_position *pos);
-
-#define zend_llist_get_first(l) zend_llist_get_first_ex(l, NULL)
-#define zend_llist_get_last(l) zend_llist_get_last_ex(l, NULL)
-#define zend_llist_get_next(l) zend_llist_get_next_ex(l, NULL)
-#define zend_llist_get_prev(l) zend_llist_get_prev_ex(l, NULL)
-
-END_EXTERN_C()
-
-#endif /* ZEND_LLIST_H */
diff --git a/Zend/zend_mm.c b/Zend/zend_mm.c
deleted file mode 100644
index 22850aadf2..0000000000
--- a/Zend/zend_mm.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include "zend.h"
-#include "zend_mm.h"
-
-#if WIN32|WINNT
-# ifndef inline
-# define inline __inline
-# endif
-#endif
-
-#define ZEND_MM_FREE_BLOCK 0
-#define ZEND_MM_USED_BLOCK 1
-
-#ifndef MAX
-#define MAX(a, b) (((a)>(b))?(a):(b))
-#endif
-
-#ifndef ZEND_MM_ALIGNMENT
-#define ZEND_MM_ALIGNMENT 8
-#define ZEND_MM_ALIGNMENT_LOG2 3
-#endif
-
-#define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT-1)
-
-#define ZEND_MM_BUCKET_INDEX(true_size) (true_size >> ZEND_MM_ALIGNMENT_LOG2)
-
-#define ZEND_MM_GET_FREE_LIST_BUCKET(index, free_list_bucket) \
- if (index < ZEND_MM_NUM_BUCKETS) { \
- free_list_bucket = &heap->free_buckets[index]; \
- } else { \
- /* This size doesn't exist */ \
- free_list_bucket = &heap->free_buckets[0]; \
- }
-
-
-/* Aligned header size */
-#define ZEND_MM_ALIGNED_SIZE(size) ((size + ZEND_MM_ALIGNMENT - 1) & ZEND_MM_ALIGNMENT_MASK)
-#define ZEND_MM_ALIGNED_HEADER_SIZE ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_block))
-#define ZEND_MM_ALIGNED_FREE_HEADER_SIZE ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_free_block))
-#define ZEND_MM_ALIGNED_SEGMENT_SIZE ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_segment))
-
-
-/* Memory calculations */
-#define ZEND_MM_BLOCK_AT(blk, offset) ((zend_mm_block *) (((char *) (blk))+(offset)))
-#define ZEND_MM_DATA_OF(p) ((void *) (((char *) (p))+ZEND_MM_ALIGNED_HEADER_SIZE))
-#define ZEND_MM_HEADER_OF(blk) ZEND_MM_BLOCK_AT(blk, -(int)ZEND_MM_ALIGNED_HEADER_SIZE)
-
-/* Debug output */
-#define ZEND_MM_DEBUG(stmt)
-
-
-static inline void zend_mm_add_to_free_list(zend_mm_heap *heap, zend_mm_free_block *mm_block)
-{
- zend_mm_free_block **free_list_bucket;
- size_t index = ZEND_MM_BUCKET_INDEX(mm_block->size);
-
- ZEND_MM_GET_FREE_LIST_BUCKET(index, free_list_bucket);
-
- mm_block->next_free_block = *free_list_bucket;
- mm_block->prev_free_block = NULL;
- *free_list_bucket = mm_block;
-
- if (mm_block->next_free_block) {
- mm_block->next_free_block->prev_free_block = mm_block;
- }
-}
-
-
-static inline void zend_mm_remove_from_free_list(zend_mm_heap *heap, zend_mm_free_block *mm_block)
-{
- if (mm_block->prev_free_block) {
- mm_block->prev_free_block->next_free_block = mm_block->next_free_block;
- } else {
- zend_mm_free_block **free_list_bucket;
- size_t index = ZEND_MM_BUCKET_INDEX(mm_block->size);
-
- ZEND_MM_GET_FREE_LIST_BUCKET(index, free_list_bucket);
-
- *free_list_bucket = mm_block->next_free_block;
- }
-
- if (mm_block->next_free_block) {
- mm_block->next_free_block->prev_free_block = mm_block->prev_free_block;
- }
-}
-
-static inline void zend_mm_create_new_free_block(zend_mm_heap *heap, zend_mm_block *mm_block, size_t true_size)
-{
- int remaining_size;
- zend_mm_free_block *new_free_block;
-
- /* calculate sizes */
- remaining_size = mm_block->size - true_size;
-
- if (remaining_size < ZEND_MM_ALIGNED_FREE_HEADER_SIZE) {
- /* keep best_fit->size as is, it'll include this extra space */
- return;
- }
-
- /* prepare new free block */
- mm_block->size = true_size;
- new_free_block = (zend_mm_free_block *) ZEND_MM_BLOCK_AT(mm_block, mm_block->size);
-
- new_free_block->type = ZEND_MM_FREE_BLOCK;
- new_free_block->size = remaining_size;
- new_free_block->prev_size = true_size;
-
- /* update the next block's prev_size */
- ZEND_MM_BLOCK_AT(new_free_block, new_free_block->size)->prev_size = new_free_block->size;
-
- /* add the new free block to the free list */
- zend_mm_add_to_free_list(heap, new_free_block);
- return;
-}
-
-zend_bool zend_mm_add_memory_block(zend_mm_heap *heap, size_t block_size)
-{
- /* We need to make sure that block_size is big enough for the minimum segment size */
- zend_mm_free_block *mm_block;
- zend_mm_block *guard_block;
- zend_mm_segment *segment;
-
- /* align block size downwards */
- block_size = block_size & ZEND_MM_ALIGNMENT_MASK;
-
- segment = (zend_mm_segment *) malloc(block_size);
- if (!segment) {
- return 1;
- }
-/* fprintf(stderr, "Allocating segment %X\n", segment); */
- segment->next_segment = heap->segments_list;
- heap->segments_list = segment;
-
- block_size -= ZEND_MM_ALIGNED_SEGMENT_SIZE;
- mm_block = (zend_mm_free_block *) ((char *) segment + ZEND_MM_ALIGNED_SEGMENT_SIZE);
-
- mm_block->size = block_size - ZEND_MM_ALIGNED_FREE_HEADER_SIZE; /* keep one guard block in the end */
- mm_block->type = ZEND_MM_FREE_BLOCK;
- mm_block->prev_size = 0; /* Size is always at least ZEND_MM_ALIGNED_HEADER_SIZE big (>0) so 0 is OK */
-
- /* setup guard block */
- guard_block = ZEND_MM_BLOCK_AT(mm_block, mm_block->size);
- guard_block->type = ZEND_MM_USED_BLOCK;
- guard_block->size = ZEND_MM_ALIGNED_FREE_HEADER_SIZE;
- guard_block->prev_size = mm_block->size;
- ZEND_MM_DEBUG(("Setup guard block at 0x%0.8X\n", guard_block));
-
- zend_mm_add_to_free_list(heap, mm_block);
-
- return 0;
-}
-
-/* Notes:
- * - This function may alter the block_sizes values to match platform alignment
- * - This function does *not* perform sanity checks on the arguments
- */
-zend_bool zend_mm_startup(zend_mm_heap *heap, size_t block_size)
-{
- heap->block_size = block_size;
- heap->segments_list = NULL;
- memset(heap->free_buckets, 0, sizeof(heap->free_buckets));
- return zend_mm_add_memory_block(heap, block_size);
-}
-
-
-void zend_mm_shutdown(zend_mm_heap *heap)
-{
- zend_mm_segment *segment = heap->segments_list;
- zend_mm_segment *prev;
-
- while (segment) {
- prev = segment;
- segment = segment->next_segment;
-/* fprintf(stderr, "Freeing segment %X\n", prev);*/
- free(prev);
- }
- heap->segments_list = NULL;
-}
-
-void *zend_mm_alloc(zend_mm_heap *heap, size_t size)
-{
- size_t true_size;
- zend_mm_free_block *p, *best_fit=NULL;
- zend_mm_free_block **free_list_bucket;
- size_t index;
-
- /* The max() can probably be optimized with an if() which checks more specific cases */
- true_size = MAX(ZEND_MM_ALIGNED_SIZE(size)+ZEND_MM_ALIGNED_HEADER_SIZE, ZEND_MM_ALIGNED_FREE_HEADER_SIZE);
-
- index = ZEND_MM_BUCKET_INDEX(true_size);
-
- if (index < ZEND_MM_NUM_BUCKETS) {
- ZEND_MM_GET_FREE_LIST_BUCKET(index, free_list_bucket);
-
- while (free_list_bucket != &heap->free_buckets[ZEND_MM_NUM_BUCKETS]) {
- if (*free_list_bucket) {
- best_fit = *free_list_bucket;
- goto zend_mm_finished_searching_for_block;
- }
- free_list_bucket++;
- }
- }
-
- for (p = heap->free_buckets[0]; p; p = p->next_free_block) {
- if (p->size == true_size) {
- best_fit = p;
- break;
- }
- if ((p->size > true_size) && (!best_fit || (best_fit->size > p->size))) { /* better fit */
- best_fit = p;
- }
- }
-
-zend_mm_finished_searching_for_block:
- if (!best_fit) {
- if (true_size > (heap->block_size - ZEND_MM_ALIGNED_SEGMENT_SIZE - ZEND_MM_ALIGNED_FREE_HEADER_SIZE)) {
- /* Make sure we add a memory block which is big enough */
- zend_mm_add_memory_block(heap, true_size + ZEND_MM_ALIGNED_SEGMENT_SIZE + ZEND_MM_ALIGNED_FREE_HEADER_SIZE);
- } else {
- zend_mm_add_memory_block(heap, heap->block_size);
- }
- return zend_mm_alloc(heap, size);
- }
-
- /* mark as used */
- best_fit->type = ZEND_MM_USED_BLOCK;
-
- /* remove from free list */
- zend_mm_remove_from_free_list(heap, best_fit);
-
- zend_mm_create_new_free_block(heap, (zend_mm_block *) best_fit, true_size);
-
- return ZEND_MM_DATA_OF(best_fit);
-}
-
-
-void zend_mm_free(zend_mm_heap *heap, void *p)
-{
- zend_mm_block *mm_block = ZEND_MM_HEADER_OF(p);
- zend_mm_block *prev_block, *next_block;
-
- if (mm_block->type!=ZEND_MM_USED_BLOCK) {
- /* error */
- return;
- }
-
- next_block = ZEND_MM_BLOCK_AT(mm_block, mm_block->size);
-
- /* merge with previous block if empty */
- if (mm_block->prev_size != 0
- && (prev_block=ZEND_MM_BLOCK_AT(mm_block, -(int)mm_block->prev_size))->type == ZEND_MM_FREE_BLOCK) {
- zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) prev_block);
- prev_block->size += mm_block->size;
- mm_block = prev_block;
- next_block->prev_size = mm_block->size;
- }
-
- /* merge with the next block if empty */
- if (next_block->type == ZEND_MM_FREE_BLOCK) {
- mm_block->size += next_block->size;
- zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) next_block);
- next_block = ZEND_MM_BLOCK_AT(mm_block, mm_block->size); /* recalculate */
- next_block->prev_size = mm_block->size;
- }
-
- mm_block->type = ZEND_MM_FREE_BLOCK;
- zend_mm_add_to_free_list(heap, (zend_mm_free_block *) mm_block);
-}
-
-void *zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size)
-{
- zend_mm_block *mm_block = ZEND_MM_HEADER_OF(p);
- zend_mm_block *next_block;
- size_t true_size = MAX(ZEND_MM_ALIGNED_SIZE(size)+ZEND_MM_ALIGNED_HEADER_SIZE, ZEND_MM_ALIGNED_FREE_HEADER_SIZE);
-
- if (true_size <= mm_block->size) {
- zend_mm_create_new_free_block(heap, mm_block, true_size);
- /* We don't yet merge this free block with the following one */
-
- return p;
- }
-
- next_block = ZEND_MM_BLOCK_AT(mm_block, mm_block->size);
-
- if (next_block->type != ZEND_MM_FREE_BLOCK || (mm_block->size + next_block->size < true_size)) {
- void *ptr;
-
- ptr = zend_mm_alloc(heap, size);
- memcpy(ptr, p, mm_block->size - ZEND_MM_ALIGNED_HEADER_SIZE);
- zend_mm_free(heap, p);
- return ptr;
- }
-
- zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) next_block);
- mm_block->size += next_block->size;
- /* update the next block's prev_size */
- ZEND_MM_BLOCK_AT(mm_block, mm_block->size)->prev_size = mm_block->size;
-
- zend_mm_create_new_free_block(heap, mm_block, true_size);
-
- return p;
-}
diff --git a/Zend/zend_mm.h b/Zend/zend_mm.h
deleted file mode 100644
index 988015b199..0000000000
--- a/Zend/zend_mm.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _ZEND_MM_H
-#define _ZEND_MM_H
-
-#include <sys/types.h>
-
-#include "zend_types.h"
-
-/* Define this to enable Zend MM */
-#define ZEND_MM
-
-/* mm block type */
-typedef struct _zend_mm_block {
- unsigned int size : 31;
- unsigned int type : 1;
- size_t prev_size;
-} zend_mm_block;
-
-typedef struct _zend_mm_free_block {
- unsigned int size : 31;
- unsigned int type : 1;
- size_t prev_size;
- struct _zend_mm_free_block *prev_free_block;
- struct _zend_mm_free_block *next_free_block;
-} zend_mm_free_block;
-
-typedef struct _zend_mm_segment {
- struct _zend_mm_segment *next_segment;
-} zend_mm_segment;
-
-#define ZEND_MM_NUM_BUCKETS 64
-
-typedef struct _zend_mm_heap {
- zend_mm_segment *segments_list;
- size_t block_size;
- zend_mm_free_block *free_buckets[ZEND_MM_NUM_BUCKETS];
-} zend_mm_heap;
-
-zend_bool zend_mm_startup(zend_mm_heap *heap, size_t block_size);
-void zend_mm_shutdown(zend_mm_heap *heap);
-void *zend_mm_alloc(zend_mm_heap *heap, size_t size);
-void zend_mm_free(zend_mm_heap *heap, void *p);
-void *zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size);
-
-#endif /* _ZEND_MM_H */
diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h
deleted file mode 100644
index 1e17139348..0000000000
--- a/Zend/zend_modules.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef MODULES_H
-#define MODULES_H
-
-#include "zend.h"
-
-#define INIT_FUNC_ARGS int type, int module_number TSRMLS_DC
-#define INIT_FUNC_ARGS_PASSTHRU type, module_number TSRMLS_CC
-#define SHUTDOWN_FUNC_ARGS int type, int module_number TSRMLS_DC
-#define SHUTDOWN_FUNC_ARGS_PASSTHRU type, module_number TSRMLS_CC
-#define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module TSRMLS_DC
-#define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module TSRMLS_CC
-
-ZEND_API extern unsigned char first_arg_force_ref[];
-ZEND_API extern unsigned char second_arg_force_ref[];
-ZEND_API extern unsigned char third_arg_force_ref[];
-
-#define ZEND_MODULE_API_NO 20020429
-#ifdef ZTS
-#define USING_ZTS 1
-#else
-#define USING_ZTS 0
-#endif
-
-#define STANDARD_MODULE_HEADER sizeof(zend_module_entry), ZEND_MODULE_API_NO, ZEND_DEBUG, USING_ZTS
-
-#define STANDARD_MODULE_PROPERTIES_EX 0, 0, 0, NULL, 0
-
-#define STANDARD_MODULE_PROPERTIES \
- NULL, NULL, STANDARD_MODULE_PROPERTIES_EX
-
-#define NO_VERSION_YET NULL
-
-#define MODULE_PERSISTENT 1
-#define MODULE_TEMPORARY 2
-
-typedef struct _zend_module_entry zend_module_entry;
-
-struct _zend_module_entry {
- unsigned short size;
- unsigned int zend_api;
- unsigned char zend_debug;
- unsigned char zts;
- char *name;
- zend_function_entry *functions;
- int (*module_startup_func)(INIT_FUNC_ARGS);
- int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS);
- int (*request_startup_func)(INIT_FUNC_ARGS);
- int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS);
- void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS);
- char *version;
- int (*global_startup_func)(void);
- int (*global_shutdown_func)(void);
- int globals_id;
- int module_started;
- unsigned char type;
- void *handle;
- int module_number;
-};
-
-
-extern ZEND_API HashTable module_registry;
-
-void module_destructor(zend_module_entry *module);
-int module_registry_cleanup(zend_module_entry *module TSRMLS_DC);
-int module_registry_request_startup(zend_module_entry *module TSRMLS_DC);
-
-#define ZEND_MODULE_DTOR (void (*)(void *)) module_destructor
-#endif
diff --git a/Zend/zend_multibyte.c b/Zend/zend_multibyte.c
deleted file mode 100644
index e69de29bb2..0000000000
--- a/Zend/zend_multibyte.c
+++ /dev/null
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
deleted file mode 100644
index b51b42b12e..0000000000
--- a/Zend/zend_object_handlers.c
+++ /dev/null
@@ -1,498 +0,0 @@
-#include "zend.h"
-#include "zend_globals.h"
-#include "zend_variables.h"
-#include "zend_API.h"
-#include "zend_objects.h"
-#include "zend_objects_API.h"
-#include "zend_object_handlers.h"
-
-#define DEBUG_OBJECT_HANDLERS 0
-
-/*
- __X accessors explanation:
-
- if we have __get and property that is not part of the properties array is
- requested, we call __get handler. If it fails, we return uninitialized.
-
- if we have __set and property that is not part of the properties array is
- set, we call __set handler. If it fails, we do not change the array.
-
- for both handlers above, when we are inside __get/__set, no further calls for
- __get/__set for these objects will be made, to prevent endless recursion and
- enable accessors to change properties array.
-
- if we have __call and method which is not part of the class function table is
- called, we cal __call handler.
-*/
-
-static HashTable *zend_std_get_properties(zval *object TSRMLS_DC)
-{
- zend_object *zobj;
- zobj = Z_OBJ_P(object);
- return zobj->properties;
-}
-
-static zval *zend_std_call_getter(zval *object, zval *member TSRMLS_DC)
-{
- zval **call_args[1];
- zval *retval = NULL;
- zval __get_name;
- int call_result;
-
- /* __get handler is called with two arguments:
- property name
- return value for the object (by reference)
-
- it should return whether the call was successfull or not
- */
- INIT_PZVAL(&__get_name);
- ZVAL_STRINGL(&__get_name, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1, 0);
-
- call_args[0] = &member;
-
- /* go call the __get handler */
- call_result = call_user_function_ex(NULL,
- &object,
- &__get_name,
- &retval,
- 1, call_args,
- 0, NULL TSRMLS_CC);
-
- /*
- call_result is if call_user_function gone OK.
- retval returns the value that is received
- */
-
-
- if (call_result == FAILURE) {
- zend_error(E_ERROR, "Could not call __get handler for class %s", Z_OBJCE_P(object)->name);
- return NULL;
- }
-
- retval->refcount--;
-
- return retval;
-}
-
-static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_DC)
-{
- zval **call_args[2];
- zval *retval = NULL;
- zval __set_name;
- int call_result;
- int ret;
-
- /* __set handler is called with two arguments:
- property name
- value to be set
-
- it should return whether the call was successfull or not
- */
- INIT_PZVAL(&__set_name);
- ZVAL_STRINGL(&__set_name, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1, 0);
-
- call_args[0] = &member;
- value->refcount++;
- call_args[1] = &value;
-
- /* go call the __set handler */
- call_result = call_user_function_ex(NULL,
- &object,
- &__set_name,
- &retval,
- 2, call_args,
- 0, NULL TSRMLS_CC);
-
- /*
- call_result is if call_user_function gone OK.
- retval shows if __get method went OK.
- */
-
-
- if (call_result == FAILURE) {
- zend_error(E_ERROR, "Could not call __set handler for class %s", Z_OBJCE_P(object)->name);
- return FAILURE;
- }
-
- zval_ptr_dtor(&value);
-
- if (retval && zval_is_true(retval)) {
- ret = SUCCESS;
- } else {
- ret = FAILURE;
- }
-
- if (retval) {
- zval_ptr_dtor(&retval);
- }
-
- return ret;
-}
-
-zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC)
-{
- zend_object *zobj;
- zval tmp_member;
- zval **retval;
- zval *rv = NULL;
-
- zobj = Z_OBJ_P(object);
-
- if (member->type != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
- member = &tmp_member;
- }
-
-#if DEBUG_OBJECT_HANDLERS
- fprintf(stderr, "Read object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member));
-#endif
-
- if (zend_hash_find(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &retval) == FAILURE) {
- if (zobj->ce->__get && !zobj->in_get) {
- /* have getter - try with it! */
- zobj->in_get = 1; /* prevent circular getting */
- rv = zend_std_call_getter(object, member TSRMLS_CC);
- zobj->in_get = 0;
-
- if (rv) {
- retval = &rv;
- } else {
- retval = &EG(uninitialized_zval_ptr);
- }
- } else {
- switch (type) {
- case BP_VAR_R:
- zend_error(E_NOTICE,"Undefined property: %s", Z_STRVAL_P(member));
- /* break missing intentionally */
- case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
- break;
- case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined property: %s", Z_STRVAL_P(member));
- /* break missing intentionally */
- case BP_VAR_W: {
- zval *new_zval = &EG(uninitialized_zval);
-
- new_zval->refcount++;
- zend_hash_update(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, &new_zval, sizeof(zval *), (void **) &retval);
- }
- break;
- EMPTY_SWITCH_DEFAULT_CASE()
-
- }
- }
- }
- if (member == &tmp_member) {
- zval_dtor(member);
- }
- return *retval;
-}
-
-static void zend_std_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
-{
- zend_object *zobj;
- zval tmp_member;
- zval **variable_ptr;
- int setter_done = 0;
-
- zobj = Z_OBJ_P(object);
-
- if (member->type != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
- member = &tmp_member;
- }
-
- if (zend_hash_find(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &variable_ptr) == SUCCESS) {
- if(*variable_ptr == value) {
- /* if we already have this value there, we don't actually need to do anything */
- setter_done = 1;
- } else {
- /* if we are assigning reference, we shouldn't move it, but instead assign variable
- to the same pointer */
- if (PZVAL_IS_REF(*variable_ptr)) {
- zval_dtor(*variable_ptr); /* old value should be destroyed */
- /* To check: can't *variable_ptr be some system variable like error_zval here? */
- (*variable_ptr)->type = value->type;
- (*variable_ptr)->value = value->value;
- zval_copy_ctor(*variable_ptr);
- setter_done = 1;
- }
- }
- } else {
- if (zobj->ce->__set && !zobj->in_set) {
- zobj->in_set = 1; /* prevent circular setting */
- if (zend_std_call_setter(object, member, value TSRMLS_CC) != SUCCESS) {
- /* for now, just ignore it - __set should take care of warnings, etc. */
- }
- setter_done = 1;
- zobj->in_set = 0;
- }
- }
-
- if (!setter_done) {
- /* if we assign referenced variable, we should separate it */
- value->refcount++;
- if (PZVAL_IS_REF(value)) {
- SEPARATE_ZVAL(&value);
- }
- zend_hash_update(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, &value, sizeof(zval *), NULL);
- }
- if (member == &tmp_member) {
- zval_dtor(member);
- }
-}
-
-static zval **zend_std_get_property_ptr(zval *object, zval *member TSRMLS_DC)
-{
- zend_object *zobj;
- zval tmp_member;
- zval **retval;
-
- zobj = Z_OBJ_P(object);
-
- if (member->type != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
- member = &tmp_member;
- }
-
-#if DEBUG_OBJECT_HANDLERS
- fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member));
-#endif
-
- if (zend_hash_find(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &retval) == FAILURE) {
- zval *new_zval;
-
- if (!zobj->ce->__get) {
- /* we don't have getter - will just add it */
- new_zval = &EG(uninitialized_zval);
-
- zend_error(E_NOTICE, "Undefined property: %s", Z_STRVAL_P(member));
- new_zval->refcount++;
- zend_hash_update(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, &new_zval, sizeof(zval *), (void **) &retval);
- } else {
- /* we do have getter - fail and let it try again with usual get/set */
- retval = NULL;
- }
- }
- if (member == &tmp_member) {
- zval_dtor(member);
- }
- return retval;
-}
-
-static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC)
-{
- zend_object *zobj;
- zval tmp_member;
-
- zobj = Z_OBJ_P(object);
-
- if (member->type != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
- member = &tmp_member;
- }
- zend_hash_del(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1);
- if (member == &tmp_member) {
- zval_dtor(member);
- }
-}
-
-static void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval ***args;
- zend_internal_function *func = (zend_internal_function *)EG(function_state_ptr)->function;
- zval method_name, method_args, __call_name;
- zval *method_name_ptr, *method_args_ptr;
- zval **call_args[2];
- zval *method_result_ptr = NULL;
- int i, call_result;
-
- args = (zval ***)emalloc(ZEND_NUM_ARGS() * sizeof(zval **));
-
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- efree(args);
- zend_error(E_ERROR, "Cannot get arguments for __call");
- RETURN_FALSE;
- }
-
- method_name_ptr = &method_name;
- INIT_PZVAL(method_name_ptr);
- ZVAL_STRING(method_name_ptr, func->function_name, 0); /* no dup - it's a copy */
-
- method_args_ptr = &method_args;
- INIT_PZVAL(method_args_ptr);
- array_init(method_args_ptr);
-
- for(i=0; i<ZEND_NUM_ARGS(); i++) {
- zval_add_ref(args[i]);
- add_next_index_zval(method_args_ptr, *args[i]);
- }
-
- efree(args);
-
- INIT_PZVAL(&__call_name);
- ZVAL_STRINGL(&__call_name, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1, 0);
-
- /* __call handler is called with two arguments:
- method name
- array of method parameters
-
- */
- call_args[0] = &method_name_ptr;
- call_args[1] = &method_args_ptr;
-
- /* go call the __call handler */
- call_result = call_user_function_ex(NULL,
- &this_ptr,
- &__call_name,
- &method_result_ptr,
- 2, call_args,
- 0, NULL TSRMLS_CC);
-
- /* call_result is if call_user_function gone OK.
- method_result_ptr is the true result of the called method
- */
-
- if (method_result_ptr) {
- *return_value = *method_result_ptr;
- zval_copy_ctor(return_value);
- zval_ptr_dtor(&method_result_ptr);
- }
-
- if (call_result == FAILURE) {
- zend_error(E_ERROR, "Could not call __call handler for class %s", Z_OBJCE_P(this_ptr)->name);
- }
-
- /* now destruct all auxiliaries */
- zval_dtor(method_args_ptr);
- zval_dtor(method_name_ptr);
-
- /* destruct the function also, then - we have allocated it in get_method */
- efree(func);
-}
-
-static union _zend_function *zend_std_get_method(zval *object, char *method_name, int method_len TSRMLS_DC)
-{
- zend_object *zobj;
- zend_function *func_method;
- char *lc_method_name;
-
- lc_method_name = do_alloca(method_len+1);
- /* Create a zend_copy_str_tolower(dest, src, src_length); */
- memcpy(lc_method_name, method_name, method_len+1);
- zend_str_tolower(lc_method_name, method_len);
-
- zobj = Z_OBJ_P(object);
- if (zend_hash_find(&zobj->ce->function_table, lc_method_name, method_len+1, (void **)&func_method) == FAILURE) {
- if (zobj->ce->__call != NULL) {
- zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function));
- call_user_call->type = ZEND_INTERNAL_FUNCTION;
- call_user_call->handler = zend_std_call_user_call;
- call_user_call->arg_types = NULL;
- call_user_call->scope = NULL;
- call_user_call->function_name = estrndup(method_name, method_len);
-
- free_alloca(lc_method_name);
- return (union _zend_function *)call_user_call;
- }
- zend_error(E_ERROR, "Call to undefined function %s()", method_name);
- }
-
- free_alloca(lc_method_name);
- return func_method;
-}
-
-static union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC)
-{
- zend_object *zobj;
-
- zobj = Z_OBJ_P(object);
- return zobj->ce->constructor;
-}
-
-int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC);
-
-static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC)
-{
- zend_object *zobj1, *zobj2;
-
- zobj1 = Z_OBJ_P(o1);
- zobj2 = Z_OBJ_P(o2);
-
- if (zobj1->ce != zobj2->ce) {
- return 1; /* different classes */
- }
- return zend_compare_symbol_tables_i(zobj1->properties, zobj2->properties TSRMLS_CC);
-}
-
-static int zend_std_has_property(zval *object, zval *member, int check_empty TSRMLS_DC)
-{
- zend_object *zobj;
- int result;
- zval **value;
- zval tmp_member;
-
- zobj = Z_OBJ_P(object);
-
- if (member->type != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
- member = &tmp_member;
- }
-
- if (zend_hash_find(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **)&value) == SUCCESS) {
- if (check_empty) {
- result = zend_is_true(*value);
- } else {
- result = (Z_TYPE_PP(value) != IS_NULL);
- }
- } else {
- result = 0;
- }
-
- if (member == &tmp_member) {
- zval_dtor(member);
- }
- return result;
-}
-
-zend_class_entry *zend_std_object_get_class(zval *object TSRMLS_DC)
-{
- zend_object *zobj;
- zobj = Z_OBJ_P(object);
-
- return zobj->ce;
-}
-
-zend_object_handlers std_object_handlers = {
- zend_objects_store_add_ref, /* add_ref */
- zend_objects_store_del_ref, /* del_ref */
- zend_objects_store_delete_obj, /* delete_obj */
- zend_objects_clone_obj, /* clone_obj */
-
- zend_std_read_property, /* read_property */
- zend_std_write_property, /* write_property */
- zend_std_get_property_ptr, /* get_property_ptr */
- zend_std_get_property_ptr, /* get_property_zval_ptr */
- NULL, /* get */
- NULL, /* set */
- zend_std_has_property, /* has_property */
- zend_std_unset_property, /* unset_property */
- zend_std_get_properties, /* get_properties */
- zend_std_get_method, /* get_method */
- NULL, /* call_method */
- zend_std_get_constructor, /* get_constructor */
- zend_std_object_get_class, /* get_class_entry */
- NULL, /* get_class_name */
- zend_std_compare_objects /* compare_objects */
-};
-
diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h
deleted file mode 100644
index 1cf015a343..0000000000
--- a/Zend/zend_object_handlers.h
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifndef ZEND_OBJECT_HANDLERS_H
-#define ZEND_OBJECT_HANDLERS_H
-
-union _zend_function;
-
-typedef zval *(*zend_object_read_property_t)(zval *object, zval *member, int type TSRMLS_DC);
-/* Used to fetch property from the object, read-only */
-typedef void (*zend_object_write_property_t)(zval *object, zval *member, zval *value TSRMLS_DC);
-/* Used to set property of the object */
-
-typedef zval **(*zend_object_get_property_ptr_t)(zval *object, zval *member TSRMLS_DC);
-/* Used to create pointer to the property of the object, for future r/w access via get/set */
-typedef zval **(*zend_object_get_property_zval_ptr_t)(zval *object, zval *member TSRMLS_DC);
-/* Used to create pointer to the property of the object, for future direct r/w access */
-typedef void (*zend_object_set_t)(zval **property, zval *value TSRMLS_DC);
-/* Used to set object value (most probably used in combination with
-typedef the result of the get_property_ptr) */
-typedef zval* (*zend_object_get_t)(zval *property TSRMLS_DC);
-/* Used to get object value (most probably used in combination with
-the result of the get_property_ptr or when converting object value to
-one of the basic types) */
-
-typedef int (*zend_object_has_property_t)(zval *object, zval *member, int check_empty TSRMLS_DC);
-/* Used to check if a property of the object exists */
-typedef void (*zend_object_unset_property_t)(zval *object, zval *member TSRMLS_DC);
-/* Used to remove a property of the object */
-
-typedef HashTable *(*zend_object_get_properties_t)(zval *object TSRMLS_DC);
-/* Used to get hash of the properties of the object, as hash of zval's */
-
-typedef int (*zend_object_call_method_t)(char *method, INTERNAL_FUNCTION_PARAMETERS);
-/* Used to call methods */
-/* args on stack! */
-/* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback fror this.
-*/
-typedef union _zend_function *(*zend_object_get_method_t)(zval *object, char *method, int method_len TSRMLS_DC);
-typedef union _zend_function *(*zend_object_get_constructor_t)(zval *object TSRMLS_DC);
-/* Get method parameter mask - by value/by reference, etc. */
-
-/* Object maintenance/destruction */
-typedef void (*zend_object_add_ref_t)(zval *object TSRMLS_DC);
-typedef void (*zend_object_del_ref_t)(zval *object TSRMLS_DC);
-typedef void (*zend_object_delete_obj_t)(zval *object TSRMLS_DC);
-typedef zend_object_value (*zend_object_clone_obj_t)(zval *object TSRMLS_DC);
-
-typedef zend_class_entry *(*zend_object_get_class_entry_t)(zval *object TSRMLS_DC);
-typedef int (*zend_object_get_class_name_t)(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC);
-typedef int (*zend_object_compare_t)(zval *object1, zval *object2 TSRMLS_DC);
-
-typedef struct _zend_object_handlers {
- /* general object functions */
- zend_object_add_ref_t add_ref;
- zend_object_del_ref_t del_ref;
- zend_object_delete_obj_t delete_obj;
- zend_object_clone_obj_t clone_obj;
- /* individual object functions */
- zend_object_read_property_t read_property;
- zend_object_write_property_t write_property;
- zend_object_get_property_ptr_t get_property_ptr;
- zend_object_get_property_zval_ptr_t get_property_zval_ptr;
- zend_object_get_t get;
- zend_object_set_t set;
- zend_object_has_property_t has_property;
- zend_object_unset_property_t unset_property;
- zend_object_get_properties_t get_properties;
- zend_object_get_method_t get_method;
- zend_object_call_method_t call_method;
- zend_object_get_constructor_t get_constructor;
- zend_object_get_class_entry_t get_class_entry;
- zend_object_get_class_name_t get_class_name;
- zend_object_compare_t compare_objects;
-} zend_object_handlers;
-
-extern zend_object_handlers std_object_handlers;
-
-#define IS_ZEND_STD_OBJECT(z) ((z).type == IS_OBJECT && Z_OBJ_HT(z) == &std_object_handlers)
-#define HAS_CLASS_ENTRY(z) (Z_OBJ_HT(z)->get_class_entry != NULL)
-
-#endif
diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c
deleted file mode 100644
index a6b7579350..0000000000
--- a/Zend/zend_objects.c
+++ /dev/null
@@ -1,124 +0,0 @@
-#include "zend.h"
-#include "zend_globals.h"
-#include "zend_variables.h"
-#include "zend_API.h"
-
-static inline void zend_objects_call_destructor(zend_object *object, zend_object_handle handle TSRMLS_DC)
-{
- if (object->ce->destructor) {
- zval *obj;
- zval *destructor_func_name;
- zval *retval_ptr;
- HashTable symbol_table;
-
- MAKE_STD_ZVAL(obj);
- obj->type = IS_OBJECT;
- obj->value.obj.handle = handle;
- obj->value.obj.handlers = &std_object_handlers;
- zval_copy_ctor(obj);
-
-
- /* FIXME: Optimize this so that we use the old_object->ce->destructor function pointer instead of the name */
- MAKE_STD_ZVAL(destructor_func_name);
- destructor_func_name->type = IS_STRING;
- destructor_func_name->value.str.val = estrndup("__destruct", sizeof("__destruct")-1);
- destructor_func_name->value.str.len = sizeof("__destruct")-1;
-
- ZEND_INIT_SYMTABLE(&symbol_table);
-
- call_user_function_ex(NULL, &obj, destructor_func_name, &retval_ptr, 0, NULL, 0, &symbol_table TSRMLS_CC);
-
- zend_hash_destroy(&symbol_table);
- zval_ptr_dtor(&obj);
- zval_ptr_dtor(&destructor_func_name);
- if (retval_ptr) {
- zval_ptr_dtor(&retval_ptr);
- }
- }
-}
-
-
-static inline void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC)
-{
- zend_objects_call_destructor(object, handle TSRMLS_CC);
- /* Nuke the object */
- zend_hash_destroy(object->properties);
- FREE_HASHTABLE(object->properties);
- efree(object);
-}
-
-ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class_type)
-{
- zend_object_value retval;
-
- TSRMLS_FETCH();
-
- *object = emalloc(sizeof(zend_object));
- (*object)->ce = class_type;
- retval.handle = zend_objects_store_put(*object, (zend_objects_store_dtor_t) zend_objects_destroy_object, NULL TSRMLS_CC);
- retval.handlers = &std_object_handlers;
- (*object)->in_get = 0;
- (*object)->in_set = 0;
- return retval;
-}
-
-ZEND_API zend_object *zend_objects_get_address(zval *zobject)
-{
- TSRMLS_FETCH();
- return (zend_object *)zend_object_store_get_object(zobject TSRMLS_CC);
-}
-
-ZEND_API zend_object_value zend_objects_clone_obj(zval *zobject TSRMLS_DC)
-{
- zend_object_value retval;
- zend_object *old_object;
- zend_object *new_object;
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
-
- old_object = zend_objects_get_address(zobject);
- retval = zend_objects_new(&new_object, old_object->ce);
-
- if (old_object->ce->clone) {
- zval *old_obj;
- zval *new_obj;
- zval *clone_func_name;
- zval *retval_ptr;
- HashTable symbol_table;
-
- MAKE_STD_ZVAL(new_obj);
- new_obj->type = IS_OBJECT;
- new_obj->value.obj = retval;
- zval_copy_ctor(new_obj);
-
- MAKE_STD_ZVAL(old_obj);
- old_obj->type = IS_OBJECT;
- old_obj->value.obj.handle = handle;
- old_obj->value.obj.handlers = &std_object_handlers; /* If we reached here than the handlers are standrd */
- zval_copy_ctor(old_obj);
-
- /* FIXME: Optimize this so that we use the old_object->ce->clone function pointer instead of the name */
- MAKE_STD_ZVAL(clone_func_name);
- clone_func_name->type = IS_STRING;
- clone_func_name->value.str.val = estrndup("__clone", sizeof("__clone")-1);
- clone_func_name->value.str.len = sizeof("__clone")-1;
-
- ALLOC_HASHTABLE(new_object->properties);
- zend_hash_init(new_object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- ZEND_INIT_SYMTABLE(&symbol_table);
- ZEND_SET_SYMBOL(&symbol_table, "clone", old_obj);
-
- call_user_function_ex(NULL, &new_obj, clone_func_name, &retval_ptr, 0, NULL, 0, &symbol_table TSRMLS_CC);
-
- zend_hash_destroy(&symbol_table);
- zval_ptr_dtor(&new_obj);
- zval_ptr_dtor(&clone_func_name);
- zval_ptr_dtor(&retval_ptr);
- } else {
- ALLOC_HASHTABLE(new_object->properties);
- zend_hash_init(new_object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref, (void *) NULL /* Not used anymore */, sizeof(zval *));
- }
-
- return retval;
-}
diff --git a/Zend/zend_objects.h b/Zend/zend_objects.h
deleted file mode 100644
index 74a9663375..0000000000
--- a/Zend/zend_objects.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef ZEND_OBJECTS_H
-#define ZEND_OBJECTS_H
-
-#include "zend.h"
-
-ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class_type);
-ZEND_API zend_object *zend_objects_get_address(zval *object);
-ZEND_API zend_object_value zend_objects_clone_obj(zval *object TSRMLS_DC);
-
-#endif /* ZEND_OBJECTS_H */
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c
deleted file mode 100644
index b2f0a9229c..0000000000
--- a/Zend/zend_objects_API.c
+++ /dev/null
@@ -1,263 +0,0 @@
-#include "zend.h"
-#include "zend_globals.h"
-#include "zend_variables.h"
-#include "zend_API.h"
-#include "zend_objects_API.h"
-
-#define ZEND_DEBUG_OBJECTS 0
-
-ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size)
-{
- objects->object_buckets = (zend_object_store_bucket *) emalloc(init_size * sizeof(zend_object_store_bucket));
- objects->top = 1; /* Skip 0 so that handles are true */
- objects->size = init_size;
- objects->free_list_head = -1;
-}
-
-ZEND_API void zend_objects_store_destroy(zend_objects_store *objects)
-{
- efree(objects->object_buckets);
-}
-
-ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC)
-{
- zend_uint i = 1;
-
- for (i = 1; i < objects->top ; i++) {
- if (objects->object_buckets[i].valid) {
- struct _store_object *obj = &objects->object_buckets[i].bucket.obj;
- if (obj->dtor) {
- objects->object_buckets[i].destructor_called = 1;
- obj->dtor(obj->object, i TSRMLS_CC);
- }
- objects->object_buckets[i].valid = 0;
- }
- }
-}
-
-/* Store objects API */
-
-ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_store_dtor_t dtor, zend_objects_store_clone_t clone TSRMLS_DC)
-{
- zend_object_handle handle;
- struct _store_object *obj;
-
- if (EG(objects_store).free_list_head != -1) {
- handle = EG(objects_store).free_list_head;
- EG(objects_store).free_list_head = EG(objects_store).object_buckets[handle].bucket.free_list.next;
- } else {
- if (EG(objects_store).top == EG(objects_store).size) {
- EG(objects_store).size <<= 1;
- EG(objects_store).object_buckets = (zend_object_store_bucket *) erealloc(EG(objects_store).object_buckets, EG(objects_store).size * sizeof(zend_object_store_bucket));
- }
- handle = EG(objects_store).top++;
- }
- obj = &EG(objects_store).object_buckets[handle].bucket.obj;
- EG(objects_store).object_buckets[handle].valid = 1;
- EG(objects_store).object_buckets[handle].destructor_called = 0;
-
- obj->refcount = 1;
- obj->object = object;
- obj->dtor = dtor;
- obj->clone = clone;
-
-#if ZEND_DEBUG_OBJECTS
- fprintf(stderr, "Allocated object id #%d\n", handle);
-#endif
- return handle;
-}
-
-ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC)
-{
- zend_object_handle handle = Z_OBJ_HANDLE_P(object);
-
- if (!EG(objects_store).object_buckets[handle].valid) {
- zend_error(E_ERROR, "Trying to add reference to invalid object");
- }
-
- EG(objects_store).object_buckets[handle].bucket.obj.refcount++;
-#if ZEND_DEBUG_OBJECTS
- fprintf(stderr, "Increased refcount of object id #%d\n", handle);
-#endif
-}
-
-ZEND_API void zend_objects_store_delete_obj(zval *zobject TSRMLS_DC)
-{
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
- struct _store_object *obj = &EG(objects_store).object_buckets[handle].bucket.obj;
-
- if (!EG(objects_store).object_buckets[handle].valid) {
- zend_error(E_ERROR, "Trying to delete invalid object");
- }
-
-
- if (obj->dtor && !EG(objects_store).object_buckets[handle].destructor_called) {
- EG(objects_store).object_buckets[handle].destructor_called = 1;
- obj->dtor(obj->object, handle TSRMLS_CC);
- }
- EG(objects_store).object_buckets[handle].valid = 0;
-
-#if ZEND_DEBUG_OBJECTS
- fprintf(stderr, "Deleted object id #%d\n", handle);
-#endif
-
-}
-
-#define ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST() \
- EG(objects_store).object_buckets[handle].bucket.free_list.next = EG(objects_store).free_list_head; \
- EG(objects_store).free_list_head = handle; \
- EG(objects_store).object_buckets[handle].valid = 0;
-
-ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC)
-{
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
- struct _store_object *obj = &EG(objects_store).object_buckets[handle].bucket.obj;
-
- if (--obj->refcount == 0) {
- if (EG(objects_store).object_buckets[handle].valid) {
- if (!EG(objects_store).object_buckets[handle].destructor_called) {
- EG(objects_store).object_buckets[handle].destructor_called = 1;
- if (obj->dtor) {
- obj->dtor(obj->object, handle TSRMLS_CC);
- }
- EG(objects_store).object_buckets[handle].valid = 0;
- if (obj->refcount == 0) {
- ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST();
- }
- }
- }
-#if ZEND_DEBUG_OBJECTS
- fprintf(stderr, "Deallocated object id #%d\n", handle);
-#endif
- }
-#if ZEND_DEBUG_OBJECTS
- else {
- fprintf(stderr, "Decreased refcount of object id #%d\n", handle);
- }
-#endif
-}
-
-ZEND_API zend_object_value zend_objects_store_clone_obj(zval *zobject TSRMLS_DC)
-{
- zend_object_value retval;
- void *new_object;
- struct _store_object *obj;
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
-
- if (!EG(objects_store).object_buckets[handle].valid) {
- zend_error(E_ERROR, "Trying to clone invalid object");
- }
- obj = &EG(objects_store).object_buckets[handle].bucket.obj;
-
- if (obj->clone == NULL) {
- zend_error(E_ERROR, "Trying to clone uncloneable object");
- }
-
- obj->clone(&obj->object, &new_object TSRMLS_CC);
-
- retval.handle = zend_objects_store_put(new_object, obj->dtor, obj->clone TSRMLS_CC);
- retval.handlers = Z_OBJ_HT_P(zobject);
-
- return retval;
-}
-
-ZEND_API void *zend_object_store_get_object(zval *zobject TSRMLS_DC)
-{
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
-
- if (!EG(objects_store).object_buckets[handle].valid) {
- zend_error(E_ERROR, "Trying to access invalid object");
- return NULL;
- }
-
- return EG(objects_store).object_buckets[handle].bucket.obj.object;
-}
-
-
-/* Proxy objects workings */
-typedef struct _zend_proxy_object {
- zval *object;
- zval *property;
-} zend_proxy_object;
-
-static zend_object_handlers zend_object_proxy_handlers;
-
-ZEND_API void zend_objects_proxy_dtor(zend_proxy_object *object, zend_object_handle handle TSRMLS_DC)
-{
- zval_ptr_dtor(&object->object);
- zval_ptr_dtor(&object->property);
- efree(object);
-}
-
-ZEND_API void zend_objects_proxy_clone(zend_proxy_object *object, zend_proxy_object **object_clone TSRMLS_DC)
-{
- *object_clone = emalloc(sizeof(zend_proxy_object));
- (*object_clone)->object = object->object;
- (*object_clone)->property = object->property;
- zval_add_ref(&(*object_clone)->property);
- zval_add_ref(&(*object_clone)->object);
-}
-
-ZEND_API zval **zend_object_create_proxy(zval *object, zval *member TSRMLS_DC)
-{
- zend_proxy_object *pobj = emalloc(sizeof(zend_proxy_object));
- zval *retval, **pretval;
-
- pobj->object = object;
- pobj->property = member;
- zval_add_ref(&pobj->property);
- zval_add_ref(&pobj->object);
-
- MAKE_STD_ZVAL(retval);
- retval->type = IS_OBJECT;
- Z_OBJ_HANDLE_P(retval) = zend_objects_store_put(pobj, (zend_objects_store_dtor_t)zend_objects_proxy_dtor, (zend_objects_store_clone_t)zend_objects_proxy_clone TSRMLS_CC);
- Z_OBJ_HT_P(retval) = &zend_object_proxy_handlers;
- pretval = emalloc(sizeof(zval *));
- *pretval = retval;
-
- return pretval;
-}
-
-ZEND_API void zend_object_proxy_set(zval **property, zval *value TSRMLS_DC)
-{
- zend_proxy_object *probj = zend_object_store_get_object(*property TSRMLS_CC);
-
- if (Z_OBJ_HT_P(probj->object) && Z_OBJ_HT_P(probj->object)->write_property) {
- Z_OBJ_HT_P(probj->object)->write_property(probj->object, probj->property, value TSRMLS_CC);
- } else {
- zend_error(E_WARNING, "Cannot write property of object - no write handler defined");
- }
-}
-
-ZEND_API zval* zend_object_proxy_get(zval *property TSRMLS_DC)
-{
- zend_proxy_object *probj = zend_object_store_get_object(property TSRMLS_CC);
-
- if (Z_OBJ_HT_P(probj->object) && Z_OBJ_HT_P(probj->object)->read_property) {
- return Z_OBJ_HT_P(probj->object)->read_property(probj->object, probj->property, BP_VAR_R TSRMLS_CC);
- } else {
- zend_error(E_WARNING, "Cannot read property of object - no read handler defined");
- }
-
- return NULL;
-}
-
-static zend_object_handlers zend_object_proxy_handlers = {
- ZEND_OBJECTS_STORE_HANDLERS,
-
- NULL, /* read_property */
- NULL, /* write_property */
- NULL, /* get_property_ptr */
- NULL, /* get_property_zval_ptr */
- zend_object_proxy_get, /* get */
- zend_object_proxy_set, /* set */
- NULL, /* has_property */
- NULL, /* unset_property */
- NULL, /* get_properties */
- NULL, /* get_method */
- NULL, /* call_method */
- NULL, /* get_constructor */
- NULL, /* get_class_entry */
- NULL, /* get_class_name */
- NULL /* compare_objects */
-};
diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h
deleted file mode 100644
index 87cbf020f2..0000000000
--- a/Zend/zend_objects_API.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef ZEND_OBJECTS_API_H
-#define ZEND_OBJECTS_API_H
-
-#include "zend.h"
-
-typedef void (*zend_objects_store_dtor_t)(void *object, zend_object_handle handle TSRMLS_DC);
-typedef void (*zend_objects_store_clone_t)(void *object, void **object_clone TSRMLS_DC);
-
-typedef struct _zend_object_store_bucket {
- zend_bool destructor_called;
- zend_bool valid;
- union _store_bucket {
- struct _store_object {
- void *object;
- zend_objects_store_dtor_t dtor;
- zend_objects_store_clone_t clone;
- zend_uint refcount;
- } obj;
- struct {
- int next;
- } free_list;
- } bucket;
-} zend_object_store_bucket;
-
-typedef struct _zend_objects_store {
- zend_object_store_bucket *object_buckets;
- zend_uint top;
- zend_uint size;
- int free_list_head;
-} zend_objects_store;
-
-/* Global store handling functions */
-ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size);
-ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC);
-ZEND_API void zend_objects_store_destroy(zend_objects_store *objects);
-
-/* Store API functions */
-ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_store_dtor_t dtor, zend_objects_store_clone_t clone TSRMLS_DC);
-
-ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC);
-ZEND_API void zend_objects_store_del_ref(zval *object TSRMLS_DC);
-ZEND_API void zend_objects_store_delete_obj(zval *object TSRMLS_DC);
-ZEND_API zend_object_value zend_objects_store_clone_obj(zval *object TSRMLS_DC);
-ZEND_API void *zend_object_store_get_object(zval *object TSRMLS_DC);
-
-#define ZEND_OBJECTS_STORE_HANDLERS zend_objects_store_add_ref, zend_objects_store_del_ref, zend_objects_store_delete_obj, zend_objects_store_clone_obj
-
-ZEND_API zval **zend_object_create_proxy(zval *object, zval *member TSRMLS_DC);
-#endif /* ZEND_OBJECTS_H */
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
deleted file mode 100644
index 94e587c8c2..0000000000
--- a/Zend/zend_opcode.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include <stdio.h>
-
-#include "zend.h"
-#include "zend_alloc.h"
-#include "zend_compile.h"
-#include "zend_extensions.h"
-#include "zend_API.h"
-
-
-static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
-{
- if (extension->op_array_ctor) {
- extension->op_array_ctor(op_array);
- }
-}
-
-
-static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
-{
- if (extension->op_array_dtor) {
- extension->op_array_dtor(op_array);
- }
-}
-
-
-static void op_array_alloc_ops(zend_op_array *op_array)
-{
- op_array->opcodes = erealloc(op_array->opcodes, (op_array->size)*sizeof(zend_op));
-}
-
-
-
-void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC)
-{
- op_array->type = type;
-
- op_array->backpatch_count = 0;
- if (CG(interactive)) {
- /* We must avoid a realloc() on the op_array in interactive mode, since pointers to constants
- * will become invalid
- */
- initial_ops_size = 8192;
- }
-
- op_array->refcount = (zend_uint *) emalloc(sizeof(zend_uint));
- *op_array->refcount = 1;
- op_array->size = initial_ops_size;
- op_array->last = 0;
- op_array->opcodes = NULL;
- op_array_alloc_ops(op_array);
-
- op_array->T = 0;
-
- op_array->function_name = NULL;
- op_array->filename = zend_get_compiled_filename(TSRMLS_C);
-
- op_array->arg_types = NULL;
-
- op_array->scope = NULL;
-
- op_array->brk_cont_array = NULL;
- op_array->last_brk_cont = 0;
- op_array->current_brk_cont = -1;
-
- op_array->static_variables = NULL;
-
- op_array->return_reference = 0;
- op_array->done_pass_two = 0;
-
- op_array->uses_this = 0;
-
- op_array->start_op = NULL;
-
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_ctor_handler, op_array TSRMLS_CC);
-}
-
-
-ZEND_API void destroy_zend_function(zend_function *function)
-{
- switch (function->type) {
- case ZEND_USER_FUNCTION:
- destroy_op_array((zend_op_array *) function);
- break;
- case ZEND_INTERNAL_FUNCTION:
- /* do nothing */
- break;
- }
-}
-
-
-ZEND_API void destroy_zend_class(zend_class_entry **pce)
-{
- zend_class_entry *ce = *pce;
-
- if (--ce->refcount > 0) {
- return;
- }
- switch (ce->type) {
- case ZEND_USER_CLASS:
- zend_hash_destroy(&ce->default_properties);
- zend_hash_destroy(&ce->private_properties);
- zend_hash_destroy(&ce->protected_properties);
- zend_hash_destroy(ce->static_members);
- efree(ce->name);
- zend_hash_destroy(&ce->function_table);
- FREE_HASHTABLE(ce->static_members);
- zend_hash_destroy(&ce->constants_table);
- zend_hash_destroy(&ce->class_table);
- efree(ce);
- break;
- case ZEND_INTERNAL_CLASS:
- zend_hash_destroy(&ce->default_properties);
- zend_hash_destroy(&ce->private_properties);
- zend_hash_destroy(&ce->protected_properties);
- zend_hash_destroy(ce->static_members);
- free(ce->name);
- zend_hash_destroy(&ce->function_table);
- free(ce->static_members);
- zend_hash_destroy(&ce->constants_table);
- zend_hash_destroy(&ce->class_table);
- free(ce);
- break;
- }
-}
-
-
-void zend_class_add_ref(zend_class_entry **ce)
-{
- (*ce)->refcount++;
-}
-
-
-ZEND_API void destroy_op_array(zend_op_array *op_array)
-{
- zend_op *opline = op_array->opcodes;
- zend_op *end = op_array->opcodes+op_array->last;
- TSRMLS_FETCH();
-
- if (op_array->static_variables) {
- zend_hash_destroy(op_array->static_variables);
- FREE_HASHTABLE(op_array->static_variables);
- }
-
- if (--(*op_array->refcount)>0) {
- return;
- }
-
- efree(op_array->refcount);
-
- while (opline<end) {
- if (opline->op1.op_type==IS_CONST) {
-#if DEBUG_ZEND>2
- printf("Reducing refcount for %x 1=>0 (destroying)\n", &opline->op1.u.constant);
-#endif
- zval_dtor(&opline->op1.u.constant);
- }
- if (opline->op2.op_type==IS_CONST) {
-#if DEBUG_ZEND>2
- printf("Reducing refcount for %x 1=>0 (destroying)\n", &opline->op2.u.constant);
-#endif
- zval_dtor(&opline->op2.u.constant);
- }
- opline++;
- }
- efree(op_array->opcodes);
- if (op_array->function_name) {
- efree(op_array->function_name);
- }
- if (op_array->arg_types) {
- efree(op_array->arg_types);
- }
- if (op_array->brk_cont_array) {
- efree(op_array->brk_cont_array);
- }
- if (op_array->done_pass_two) {
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_dtor_handler, op_array TSRMLS_CC);
- }
-}
-
-
-void init_op(zend_op *op TSRMLS_DC)
-{
- memset(&op->result, 0, sizeof(znode));
- op->lineno = CG(zend_lineno);
- SET_UNUSED(op->result);
- op->extended_value = 0;
- memset(&op->op1, 0, sizeof(znode));
- memset(&op->op2, 0, sizeof(znode));
-}
-
-zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC)
-{
- zend_uint next_op_num = op_array->last++;
- zend_op *next_op;
-
- if (next_op_num >= op_array->size) {
- if (CG(interactive)) {
- /* we messed up */
- zend_printf("Ran out of opcode space!\n"
- "You should probably consider writing this huge script into a file!\n");
- zend_bailout();
- }
- op_array->size *= 4;
- op_array_alloc_ops(op_array);
- }
-
- next_op = &(op_array->opcodes[next_op_num]);
-
- init_op(next_op TSRMLS_CC);
-
- return next_op;
-}
-
-
-int get_next_op_number(zend_op_array *op_array)
-{
- return op_array->last;
-}
-
-
-
-
-zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array)
-{
- op_array->last_brk_cont++;
- op_array->brk_cont_array = erealloc(op_array->brk_cont_array, sizeof(zend_brk_cont_element)*op_array->last_brk_cont);
- return &op_array->brk_cont_array[op_array->last_brk_cont-1];
-}
-
-
-static void zend_update_extended_info(zend_op_array *op_array TSRMLS_DC)
-{
- zend_op *opline = op_array->opcodes, *end=opline+op_array->last;
-
- while (opline<end) {
- if (opline->opcode == ZEND_EXT_STMT) {
- if (opline+1<end) {
- if ((opline+1)->opcode == ZEND_EXT_STMT) {
- opline->opcode = ZEND_NOP;
- opline++;
- continue;
- }
- if (opline+1<end) {
- opline->lineno = (opline+1)->lineno;
- }
- } else {
- opline->opcode = ZEND_NOP;
- }
- }
- opline++;
- }
-}
-
-
-
-static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
-{
- if (extension->op_array_handler) {
- extension->op_array_handler(op_array);
- }
-}
-
-
-int pass_two(zend_op_array *op_array TSRMLS_DC)
-{
- zend_op *opline, *end;
-
- if (op_array->type!=ZEND_USER_FUNCTION && op_array->type!=ZEND_EVAL_CODE) {
- return 0;
- }
- if (CG(extended_info)) {
- zend_update_extended_info(op_array TSRMLS_CC);
- }
- if (CG(handle_op_arrays)) {
- zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array TSRMLS_CC);
- }
-
- opline = op_array->opcodes;
- end = opline + op_array->last;
- while (opline < end) {
- if (opline->op1.op_type == IS_CONST) {
- opline->op1.u.constant.is_ref = 1;
- opline->op1.u.constant.refcount = 2; /* Make sure is_ref won't be reset */
- }
- if (opline->op2.op_type == IS_CONST) {
- opline->op2.u.constant.is_ref = 1;
- opline->op2.u.constant.refcount = 2;
- }
- opline++;
- }
- op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last);
- op_array->size = op_array->last;
- op_array->done_pass_two = 1;
- return 0;
-}
-
-
-int print_class(zend_class_entry *class_entry TSRMLS_DC)
-{
- printf("Class %s:\n", class_entry->name);
- zend_hash_apply(&class_entry->function_table, (apply_func_t) pass_two TSRMLS_CC);
- printf("End of class %s.\n\n", class_entry->name);
- return 0;
-}
-
-ZEND_API unary_op_type get_unary_op(int opcode)
-{
- switch(opcode) {
- case ZEND_BW_NOT:
- return (unary_op_type) bitwise_not_function;
- break;
- case ZEND_BOOL_NOT:
- return (unary_op_type) boolean_not_function;
- break;
- default:
- return (unary_op_type) NULL;
- break;
- }
-}
-
-
-ZEND_API void *get_binary_op(int opcode)
-{
- switch (opcode) {
- case ZEND_ADD:
- case ZEND_ASSIGN_ADD:
- return (void *) add_function;
- break;
- case ZEND_SUB:
- case ZEND_ASSIGN_SUB:
- return (void *) sub_function;
- break;
- case ZEND_MUL:
- case ZEND_ASSIGN_MUL:
- return (void *) mul_function;
- break;
- case ZEND_DIV:
- case ZEND_ASSIGN_DIV:
- return (void *) div_function;
- break;
- case ZEND_MOD:
- case ZEND_ASSIGN_MOD:
- return (void *) mod_function;
- break;
- case ZEND_SL:
- case ZEND_ASSIGN_SL:
- return (void *) shift_left_function;
- break;
- case ZEND_SR:
- case ZEND_ASSIGN_SR:
- return (void *) shift_right_function;
- break;
- case ZEND_CONCAT:
- case ZEND_ASSIGN_CONCAT:
- return (void *) concat_function;
- break;
- case ZEND_IS_IDENTICAL:
- return (void *) is_identical_function;
- break;
- case ZEND_IS_NOT_IDENTICAL:
- return (void *) is_not_identical_function;
- break;
- case ZEND_IS_EQUAL:
- return (void *) is_equal_function;
- break;
- case ZEND_IS_NOT_EQUAL:
- return (void *) is_not_equal_function;
- break;
- case ZEND_IS_SMALLER:
- return (void *) is_smaller_function;
- break;
- case ZEND_IS_SMALLER_OR_EQUAL:
- return (void *) is_smaller_or_equal_function;
- break;
- case ZEND_BW_OR:
- case ZEND_ASSIGN_BW_OR:
- return (void *) bitwise_or_function;
- break;
- case ZEND_BW_AND:
- case ZEND_ASSIGN_BW_AND:
- return (void *) bitwise_and_function;
- break;
- case ZEND_BW_XOR:
- case ZEND_ASSIGN_BW_XOR:
- return (void *) bitwise_xor_function;
- break;
- default:
- return (void *) NULL;
- break;
- }
-}
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
deleted file mode 100644
index 285cce834d..0000000000
--- a/Zend/zend_operators.c
+++ /dev/null
@@ -1,1766 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include "zend.h"
-#include "zend_operators.h"
-#include "zend_variables.h"
-#include "zend_globals.h"
-#include "zend_list.h"
-#include "zend_fast_cache.h"
-#include "zend_API.h"
-
-#if 0&&WITH_BCMATH
-#include "ext/bcmath/number.h"
-#endif
-
-ZEND_API int zend_atoi(const char *str, int str_len)
-{
- int retval;
-
- if (!str_len) {
- str_len = strlen(str);
- }
- retval = strtol(str, NULL, 0);
- if (str_len>0) {
- switch (str[str_len-1]) {
- case 'k':
- case 'K':
- retval *= 1024;
- break;
- case 'm':
- case 'M':
- retval *= 1048576;
- break;
- }
- }
- return retval;
-}
-
-
-ZEND_API double zend_string_to_double(const char *number, zend_uint length)
-{
- double divisor = 10.0;
- double result = 0.0;
- double exponent;
- const char *end = number+length;
- const char *digit = number;
-
- if (!length) {
- return result;
- }
-
- while (digit < end) {
- if ((*digit <= '9' && *digit >= '0')) {
- result *= 10;
- result += *digit - '0';
- } else if (*digit == '.') {
- digit++;
- break;
- } else if (toupper(*digit) == 'E') {
- exponent = (double) atoi(digit+1);
- result *= pow(10.0, exponent);
- return result;
- } else {
- return result;
- }
- digit++;
- }
-
- while (digit < end) {
- if ((*digit <= '9' && *digit >= '0')) {
- result += (*digit - '0') / divisor;
- divisor *= 10;
- } else if (toupper(*digit) == 'E') {
- exponent = (double) atoi(digit+1);
- result *= pow(10.0, exponent);
- return result;
- } else {
- return result;
- }
- digit++;
- }
- return result;
-}
-
-
-ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC)
-{
- switch (op->type) {
- case IS_STRING:
- {
- char *strval;
-
- strval = op->value.str.val;
- switch ((op->type=is_numeric_string(strval, op->value.str.len, &op->value.lval, &op->value.dval, 1))) {
- case IS_DOUBLE:
- case IS_LONG:
- break;
-#if 0 && WITH_BCMATH
- case FLAG_IS_BC:
- op->type = IS_DOUBLE; /* may have lost significant digits */
- break;
-#endif
- default:
- op->value.lval = strtol(op->value.str.val, NULL, 10);
- op->type = IS_LONG;
- break;
- }
- STR_FREE(strval);
- break;
- }
- case IS_BOOL:
- op->type = IS_LONG;
- break;
- case IS_RESOURCE:
- zend_list_delete(op->value.lval);
- op->type = IS_LONG;
- break;
- case IS_NULL:
- op->type = IS_LONG;
- op->value.lval = 0;
- break;
- }
-}
-
-#define zendi_convert_scalar_to_number(op, holder, result) \
- if (op==result) { \
- convert_scalar_to_number(op TSRMLS_CC); \
- } else { \
- switch ((op)->type) { \
- case IS_STRING: \
- { \
- switch (((holder).type=is_numeric_string((op)->value.str.val, (op)->value.str.len, &(holder).value.lval, &(holder).value.dval, 1))) { \
- case IS_DOUBLE: \
- case IS_LONG: \
- break; \
- case FLAG_IS_BC: \
- (holder).type = IS_DOUBLE; /* may have lost significant digits */ \
- break; \
- default: \
- (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \
- (holder).type = IS_LONG; \
- break; \
- } \
- (op) = &(holder); \
- break; \
- } \
- case IS_BOOL: \
- case IS_RESOURCE: \
- (holder).value.lval = (op)->value.lval; \
- (holder).type = IS_LONG; \
- (op) = &(holder); \
- break; \
- case IS_NULL: \
- (holder).value.lval = 0; \
- (holder).type = IS_LONG; \
- (op) = &(holder); \
- break; \
- } \
- }
-
-
-#define DVAL_TO_LVAL(d, l) (l) = (d) > LONG_MAX ? (unsigned long) (d) : (long) (d)
-
-#define zendi_convert_to_long(op, holder, result) \
- if (op==result) { \
- convert_to_long(op); \
- } else if ((op)->type != IS_LONG) { \
- switch ((op)->type) { \
- case IS_NULL: \
- (holder).value.lval = 0; \
- break; \
- case IS_DOUBLE: \
- DVAL_TO_LVAL((op)->value.dval, (holder).value.lval); \
- break; \
- case IS_STRING: \
- (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \
- break; \
- case IS_ARRAY: \
- (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \
- break; \
- case IS_OBJECT: \
- (holder).value.lval = 1; /* TBI!! */ \
- break; \
- case IS_BOOL: \
- case IS_RESOURCE: \
- (holder).value.lval = (op)->value.lval; \
- break; \
- default: \
- zend_error(E_WARNING, "Cannot convert to ordinal value"); \
- (holder).value.lval = 0; \
- break; \
- } \
- (holder).type = IS_LONG; \
- (op) = &(holder); \
- }
-
-
-#define zendi_convert_to_boolean(op, holder, result) \
- if (op==result) { \
- convert_to_boolean(op); \
- } else if ((op)->type != IS_BOOL) { \
- switch ((op)->type) { \
- case IS_NULL: \
- (holder).value.lval = 0; \
- break; \
- case IS_RESOURCE: \
- case IS_LONG: \
- (holder).value.lval = ((op)->value.lval ? 1 : 0); \
- break; \
- case IS_DOUBLE: \
- (holder).value.lval = ((op)->value.dval ? 1 : 0); \
- break; \
- case IS_STRING: \
- if ((op)->value.str.len == 0 \
- || ((op)->value.str.len==1 && (op)->value.str.val[0]=='0')) { \
- (holder).value.lval = 0; \
- } else { \
- (holder).value.lval = 1; \
- } \
- break; \
- case IS_ARRAY: \
- (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \
- break; \
- case IS_OBJECT: \
- (holder).value.lval = 1; /* TBI!! */ \
- break; \
- default: \
- (holder).value.lval = 0; \
- break; \
- } \
- (holder).type = IS_BOOL; \
- (op) = &(holder); \
- }
-
-
-ZEND_API void convert_to_long(zval *op)
-{
- convert_to_long_base(op, 10);
-}
-
-
-ZEND_API void convert_to_long_base(zval *op, int base)
-{
- char *strval;
- long tmp;
-
- switch (op->type) {
- case IS_NULL:
- op->value.lval = 0;
- break;
- case IS_RESOURCE: {
- TSRMLS_FETCH();
-
- zend_list_delete(op->value.lval);
- }
- /* break missing intentionally */
- case IS_BOOL:
- case IS_LONG:
- break;
- case IS_DOUBLE:
- DVAL_TO_LVAL(op->value.dval, op->value.lval);
- break;
- case IS_STRING:
- strval = op->value.str.val;
- op->value.lval = strtol(strval, NULL, base);
- STR_FREE(strval);
- break;
- case IS_ARRAY:
- tmp = (zend_hash_num_elements(op->value.ht)?1:0);
- zval_dtor(op);
- op->value.lval = tmp;
- break;
- case IS_OBJECT:
- zval_dtor(op);
- op->value.lval = 1; /* TBI!! */
- break;
- default:
- zend_error(E_WARNING, "Cannot convert to ordinal value");
- zval_dtor(op);
- op->value.lval = 0;
- break;
- }
-
- op->type = IS_LONG;
-}
-
-
-ZEND_API void convert_to_double(zval *op)
-{
- char *strval;
- double tmp;
-
- switch (op->type) {
- case IS_NULL:
- op->value.dval = 0.0;
- break;
- case IS_RESOURCE: {
- TSRMLS_FETCH();
-
- zend_list_delete(op->value.lval);
- }
- /* break missing intentionally */
- case IS_BOOL:
- case IS_LONG:
- op->value.dval = (double) op->value.lval;
- break;
- case IS_DOUBLE:
- break;
- case IS_STRING:
- strval = op->value.str.val;
-
- op->value.dval = strtod(strval, NULL);
- STR_FREE(strval);
- break;
- case IS_ARRAY:
- tmp = (zend_hash_num_elements(op->value.ht)?1:0);
- zval_dtor(op);
- op->value.dval = tmp;
- break;
- case IS_OBJECT:
- zval_dtor(op);
- op->value.dval = 1; /* TBI!! */
- break;
- default:
- zend_error(E_WARNING, "Cannot convert to real value (type=%d)", op->type);
- zval_dtor(op);
- op->value.dval = 0;
- break;
- }
- op->type = IS_DOUBLE;
-}
-
-
-ZEND_API void convert_to_null(zval *op)
-{
- zval_dtor(op);
- op->type = IS_NULL;
-}
-
-
-ZEND_API void convert_to_boolean(zval *op)
-{
- char *strval;
- int tmp;
-
- switch (op->type) {
- case IS_BOOL:
- break;
- case IS_NULL:
- op->value.lval = 0;
- break;
- case IS_RESOURCE: {
- TSRMLS_FETCH();
-
- zend_list_delete(op->value.lval);
- }
- /* break missing intentionally */
- case IS_LONG:
- op->value.lval = (op->value.lval ? 1 : 0);
- break;
- case IS_DOUBLE:
- op->value.lval = (op->value.dval ? 1 : 0);
- break;
- case IS_STRING:
- strval = op->value.str.val;
-
- if (op->value.str.len == 0
- || (op->value.str.len==1 && op->value.str.val[0]=='0')) {
- op->value.lval = 0;
- } else {
- op->value.lval = 1;
- }
- STR_FREE(strval);
- break;
- case IS_ARRAY:
- tmp = (zend_hash_num_elements(op->value.ht)?1:0);
- zval_dtor(op);
- op->value.lval = tmp;
- break;
- case IS_OBJECT:
- zval_dtor(op);
- op->value.lval = 1; /* TBI!! */
- break;
- default:
- zval_dtor(op);
- op->value.lval = 0;
- break;
- }
- op->type = IS_BOOL;
-}
-
-
-ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC)
-{
- long lval;
- double dval;
- TSRMLS_FETCH();
-
- switch (op->type) {
- case IS_NULL:
- op->value.str.val = empty_string;
- op->value.str.len = 0;
- break;
- case IS_STRING:
- break;
- case IS_BOOL:
- if (op->value.lval) {
- op->value.str.val = estrndup_rel("1", 1);
- op->value.str.len = 1;
- } else {
- op->value.str.val = empty_string;
- op->value.str.len = 0;
- }
- break;
- case IS_RESOURCE: {
- long tmp = op->value.lval;
-
- zend_list_delete(op->value.lval);
- op->value.str.val = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG);
- op->value.str.len = sprintf(op->value.str.val, "Resource id #%ld", tmp);
- break;
- }
- case IS_LONG:
- lval = op->value.lval;
-
- op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_LONG + 1);
- op->value.str.len = zend_sprintf(op->value.str.val, "%ld", lval); /* SAFE */
- break;
- case IS_DOUBLE: {
- dval = op->value.dval;
- op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
- op->value.str.len = zend_sprintf(op->value.str.val, "%.*G", (int) EG(precision), dval); /* SAFE */
- /* %G already handles removing trailing zeros from the fractional part, yay */
- break;
- }
- case IS_ARRAY:
- zval_dtor(op);
- op->value.str.val = estrndup_rel("Array", sizeof("Array")-1);
- op->value.str.len = sizeof("Array")-1;
- zend_error(E_NOTICE, "Array to string conversion");
- break;
- case IS_OBJECT:
- zval_dtor(op);
- op->value.str.val = estrndup_rel("Object", sizeof("Object")-1);
- op->value.str.len = sizeof("Object")-1;
- zend_error(E_NOTICE, "Object to string conversion");
- break;
- default:
- zval_dtor(op);
- ZVAL_BOOL(op, 0);
- break;
- }
- op->type = IS_STRING;
-}
-
-
-static void convert_scalar_to_array(zval *op, int type)
-{
- zval *entry;
-
- ALLOC_ZVAL(entry);
- *entry = *op;
- INIT_PZVAL(entry);
-
- switch (type) {
- case IS_ARRAY:
- ALLOC_HASHTABLE(op->value.ht);
- zend_hash_init(op->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_index_update(op->value.ht, 0, (void *) &entry, sizeof(zval *), NULL);
- op->type = IS_ARRAY;
- break;
- case IS_OBJECT:
- {
- /* OBJECTS_OPTIMIZE */
- TSRMLS_FETCH();
-
- object_init(op);
- zend_hash_update(Z_OBJPROP_P(op), "scalar", sizeof("scalar"), (void *) &entry, sizeof(zval *), NULL);
- }
- break;
- }
-}
-
-
-ZEND_API void convert_to_array(zval *op)
-{
- TSRMLS_FETCH();
-
- switch(op->type) {
- case IS_ARRAY:
- return;
- break;
-/* OBJECTS_OPTIMIZE */
- case IS_OBJECT:
- {
- zval *tmp;
- HashTable *ht;
-
- ALLOC_HASHTABLE(ht);
- zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0);
- if (Z_OBJ_HT_P(op)->get_properties) {
- zend_hash_copy(ht, Z_OBJ_HT_P(op)->get_properties(op TSRMLS_CC), (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
- }
- zval_dtor(op);
- op->type = IS_ARRAY;
- op->value.ht = ht;
- }
- return;
- case IS_NULL:
- ALLOC_HASHTABLE(op->value.ht);
- zend_hash_init(op->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0);
- op->type = IS_ARRAY;
- break;
- default:
- convert_scalar_to_array(op, IS_ARRAY);
- break;
- }
-}
-
-
-ZEND_API void convert_to_object(zval *op)
-{
- switch(op->type) {
- case IS_ARRAY:
- {
- /* OBJECTS_OPTIMIZE */
- TSRMLS_FETCH();
-
- object_and_properties_init(op, zend_standard_class_def, op->value.ht);
- return;
- break;
- }
- case IS_OBJECT:
- return;
- case IS_NULL:
- {
- /* OBJECTS_OPTIMIZE */
- TSRMLS_FETCH();
-
- object_init(op);
- break;
- }
- default:
- convert_scalar_to_array(op, IS_OBJECT);
- break;
- }
-}
-
-ZEND_API void multi_convert_to_long_ex(int argc, ...)
-{
- zval **arg;
- va_list ap;
-
- va_start(ap, argc);
-
- while (argc--) {
- arg = va_arg(ap, zval **);
- convert_to_long_ex(arg);
- }
-
- va_end(ap);
-}
-
-ZEND_API void multi_convert_to_double_ex(int argc, ...)
-{
- zval **arg;
- va_list ap;
-
- va_start(ap, argc);
-
- while (argc--) {
- arg = va_arg(ap, zval **);
- convert_to_double_ex(arg);
- }
-
- va_end(ap);
-}
-
-ZEND_API void multi_convert_to_string_ex(int argc, ...)
-{
- zval **arg;
- va_list ap;
-
- va_start(ap, argc);
-
- while (argc--) {
- arg = va_arg(ap, zval **);
- convert_to_string_ex(arg);
- }
-
- va_end(ap);
-}
-
-ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- if (op1->type == IS_ARRAY && op2->type == IS_ARRAY) {
- zval *tmp;
-
- if ((result == op1) && (result == op2)) {
- /* $a += $a */
- return SUCCESS;
- }
- if (result != op1) {
- *result = *op1;
- zval_copy_ctor(result);
- }
- zend_hash_merge(result->value.ht, op2->value.ht, (void (*)(void *pData)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0);
- return SUCCESS;
- }
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
-
-
- if (op1->type == IS_LONG && op2->type == IS_LONG) {
- double dval = (double) op1->value.lval + (double) op2->value.lval;
-
- if ((dval > (double) LONG_MAX) || (dval < (double) LONG_MIN)) {
- result->value.dval = dval;
- result->type = IS_DOUBLE;
- } else {
- result->value.lval = op1->value.lval + op2->value.lval;
- result->type = IS_LONG;
- }
- return SUCCESS;
- }
- if ((op1->type == IS_DOUBLE && op2->type == IS_LONG)
- || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) {
- result->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) + op2->value.dval) :
- (op1->value.dval + ((double) op2->value.lval)));
- result->type = IS_DOUBLE;
- return SUCCESS;
- }
- if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) {
- result->type = IS_DOUBLE;
- result->value.dval = op1->value.dval + op2->value.dval;
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE; /* unknown datatype */
-}
-
-
-ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
-
- if (op1->type == IS_LONG && op2->type == IS_LONG) {
- double dval = (double) op1->value.lval - (double) op2->value.lval;
-
- if ((dval < (double) LONG_MIN) || (dval > (double) LONG_MAX)) {
- result->value.dval = dval;
- result->type = IS_DOUBLE;
- } else {
- result->value.lval = op1->value.lval - op2->value.lval;
- result->type = IS_LONG;
- }
- return SUCCESS;
- }
- if ((op1->type == IS_DOUBLE && op2->type == IS_LONG)
- || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) {
- result->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) - op2->value.dval) :
- (op1->value.dval - ((double) op2->value.lval)));
- result->type = IS_DOUBLE;
- return SUCCESS;
- }
- if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) {
- result->type = IS_DOUBLE;
- result->value.dval = op1->value.dval - op2->value.dval;
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE; /* unknown datatype */
-}
-
-
-ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
-
- if (op1->type == IS_LONG && op2->type == IS_LONG) {
- double dval = (double) op1->value.lval * (double) op2->value.lval;
-
- if ((dval > (double) LONG_MAX) || (dval < (double) LONG_MIN)) {
- result->value.dval = dval;
- result->type = IS_DOUBLE;
- } else {
- result->value.lval = op1->value.lval * op2->value.lval;
- result->type = IS_LONG;
- }
- return SUCCESS;
- }
- if ((op1->type == IS_DOUBLE && op2->type == IS_LONG)
- || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) {
- result->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) * op2->value.dval) :
- (op1->value.dval * ((double) op2->value.lval)));
- result->type = IS_DOUBLE;
- return SUCCESS;
- }
- if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) {
- result->type = IS_DOUBLE;
- result->value.dval = op1->value.dval * op2->value.dval;
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE; /* unknown datatype */
-}
-
-ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
-
- if ((op2->type == IS_LONG && op2->value.lval == 0) || (op2->type == IS_DOUBLE && op2->value.dval == 0.0)) {
- zend_error(E_WARNING, "Division by zero");
- ZVAL_BOOL(result, 0);
- return FAILURE; /* division by zero */
- }
- if (op1->type == IS_LONG && op2->type == IS_LONG) {
- if (op1->value.lval % op2->value.lval == 0) { /* integer */
- result->type = IS_LONG;
- result->value.lval = op1->value.lval / op2->value.lval;
- } else {
- result->type = IS_DOUBLE;
- result->value.dval = ((double) op1->value.lval) / op2->value.lval;
- }
- return SUCCESS;
- }
- if ((op1->type == IS_DOUBLE && op2->type == IS_LONG)
- || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) {
- result->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) / op2->value.dval) :
- (op1->value.dval / ((double) op2->value.lval)));
- result->type = IS_DOUBLE;
- return SUCCESS;
- }
- if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) {
- result->type = IS_DOUBLE;
- result->value.dval = op1->value.dval / op2->value.dval;
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE; /* unknown datatype */
-}
-
-
-ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_to_long(op1, op1_copy, result);
- zendi_convert_to_long(op2, op2_copy, result);
-
- if (op2->value.lval == 0) {
- ZVAL_BOOL(result, 0);
- return FAILURE; /* modulus by zero */
- }
-
- result->type = IS_LONG;
- result->value.lval = op1->value.lval % op2->value.lval;
- return SUCCESS;
-}
-
-
-
-ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- result->type = IS_BOOL;
-
- zendi_convert_to_boolean(op1, op1_copy, result);
- zendi_convert_to_boolean(op2, op2_copy, result);
- result->value.lval = op1->value.lval ^ op2->value.lval;
- return SUCCESS;
-}
-
-
-ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC)
-{
- zval op1_copy;
-
- zendi_convert_to_boolean(op1, op1_copy, result);
-
- result->type = IS_BOOL;
- result->value.lval = !op1->value.lval;
- return SUCCESS;
-}
-
-
-ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC)
-{
- zval op1_copy = *op1;
-
- op1 = &op1_copy;
-
- if (op1->type == IS_DOUBLE) {
- op1->value.lval = (long) op1->value.dval;
- op1->type = IS_LONG;
- }
- if (op1->type == IS_LONG) {
- result->value.lval = ~op1->value.lval;
- result->type = IS_LONG;
- return SUCCESS;
- }
- if (op1->type == IS_STRING) {
- zend_uint i;
-
- result->type = IS_STRING;
- result->value.str.val = estrndup(op1->value.str.val, op1->value.str.len);
- result->value.str.len = op1->value.str.len;
- for (i = 0; i < op1->value.str.len; i++) {
- result->value.str.val[i] = ~op1->value.str.val[i];
- }
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE; /* unknown datatype */
-}
-
-
-ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- if (op1->type == IS_STRING && op2->type == IS_STRING) {
- zval *longer, *shorter;
- char *result_str;
- zend_uint i, result_len;
-
- if (op1->value.str.len >= op2->value.str.len) {
- longer = op1;
- shorter = op2;
- } else {
- longer = op2;
- shorter = op1;
- }
-
- result->type = IS_STRING;
- result_len = longer->value.str.len;
- result_str = estrndup(longer->value.str.val, longer->value.str.len);
- for (i = 0; i < shorter->value.str.len; i++) {
- result_str[i] |= shorter->value.str.val[i];
- }
- if (result==op1) {
- STR_FREE(result->value.str.val);
- }
- result->value.str.val = result_str;
- result->value.str.len = result_len;
- return SUCCESS;
- }
- zendi_convert_to_long(op1, op1_copy, result);
- zendi_convert_to_long(op2, op2_copy, result);
-
- result->type = IS_LONG;
- result->value.lval = op1->value.lval | op2->value.lval;
- return SUCCESS;
-}
-
-
-ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- if (op1->type == IS_STRING && op2->type == IS_STRING) {
- zval *longer, *shorter;
- char *result_str;
- zend_uint i, result_len;
-
- if (op1->value.str.len >= op2->value.str.len) {
- longer = op1;
- shorter = op2;
- } else {
- longer = op2;
- shorter = op1;
- }
-
- result->type = IS_STRING;
- result_len = shorter->value.str.len;
- result_str = estrndup(shorter->value.str.val, shorter->value.str.len);
- for (i = 0; i < shorter->value.str.len; i++) {
- result_str[i] &= longer->value.str.val[i];
- }
- if (result==op1) {
- STR_FREE(result->value.str.val);
- }
- result->value.str.val = result_str;
- result->value.str.len = result_len;
- return SUCCESS;
- }
-
-
- zendi_convert_to_long(op1, op1_copy, result);
- zendi_convert_to_long(op2, op2_copy, result);
-
- result->type = IS_LONG;
- result->value.lval = op1->value.lval & op2->value.lval;
- return SUCCESS;
-}
-
-
-ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- if (op1->type == IS_STRING && op2->type == IS_STRING) {
- zval *longer, *shorter;
- char *result_str;
- zend_uint i, result_len;
-
- if (op1->value.str.len >= op2->value.str.len) {
- longer = op1;
- shorter = op2;
- } else {
- longer = op2;
- shorter = op1;
- }
-
- result->type = IS_STRING;
- result_len = shorter->value.str.len;
- result_str = estrndup(shorter->value.str.val, shorter->value.str.len);
- for (i = 0; i < shorter->value.str.len; i++) {
- result_str[i] ^= longer->value.str.val[i];
- }
- if (result==op1) {
- STR_FREE(result->value.str.val);
- }
- result->value.str.val = result_str;
- result->value.str.len = result_len;
- return SUCCESS;
- }
-
- zendi_convert_to_long(op1, op1_copy, result);
- zendi_convert_to_long(op2, op2_copy, result);
-
- result->type = IS_LONG;
- result->value.lval = op1->value.lval ^ op2->value.lval;
- return SUCCESS;
-}
-
-
-ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_to_long(op1, op1_copy, result);
- zendi_convert_to_long(op2, op2_copy, result);
- result->value.lval = op1->value.lval << op2->value.lval;
- result->type = IS_LONG;
- return SUCCESS;
-}
-
-
-ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_to_long(op1, op1_copy, result);
- zendi_convert_to_long(op2, op2_copy, result);
- result->value.lval = op1->value.lval >> op2->value.lval;
- result->type = IS_LONG;
- return SUCCESS;
-}
-
-
-
-/* must support result==op1 */
-ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2)
-{
- result->value.str.len = op1->value.str.len + 1;
- result->value.str.val = (char *) erealloc(op1->value.str.val, result->value.str.len+1);
- result->value.str.val[result->value.str.len - 1] = (char) op2->value.lval;
- result->value.str.val[result->value.str.len] = 0;
- result->type = IS_STRING;
- return SUCCESS;
-}
-
-
-/* must support result==op1 */
-ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2)
-{
- int length = op1->value.str.len + op2->value.str.len;
- if (op1->value.str.val == empty_string) {
- result->value.str.val = (char *) emalloc(length+1);
- } else {
- result->value.str.val = (char *) erealloc(op1->value.str.val, length+1);
- }
- memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len);
- result->value.str.val[length] = 0;
- result->value.str.len = length;
- result->type = IS_STRING;
- return SUCCESS;
-}
-
-
-ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
- int use_copy1, use_copy2;
-
-
- zend_make_printable_zval(op1, &op1_copy, &use_copy1);
- zend_make_printable_zval(op2, &op2_copy, &use_copy2);
-
- if (use_copy1) {
- op1 = &op1_copy;
- }
- if (use_copy2) {
- op2 = &op2_copy;
- }
- if (result==op1) { /* special case, perform operations on result */
- uint res_len = op1->value.str.len + op2->value.str.len;
-
- if (result->value.str.len == 0) { /* handle empty_string */
- STR_FREE(result->value.str.val);
- result->value.str.val = emalloc(res_len+1);
- } else {
- result->value.str.val = erealloc(result->value.str.val, res_len+1);
- }
- memcpy(result->value.str.val+result->value.str.len, op2->value.str.val, op2->value.str.len);
- result->value.str.val[res_len]=0;
- result->value.str.len = res_len;
- } else {
- result->value.str.len = op1->value.str.len + op2->value.str.len;
- result->value.str.val = (char *) emalloc(result->value.str.len + 1);
- memcpy(result->value.str.val, op1->value.str.val, op1->value.str.len);
- memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len);
- result->value.str.val[result->value.str.len] = 0;
- result->type = IS_STRING;
- }
- if (use_copy1) {
- zval_dtor(op1);
- }
- if (use_copy2) {
- zval_dtor(op2);
- }
- return SUCCESS;
-}
-
-
-ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
- int use_copy1, use_copy2;
-
- zend_make_printable_zval(op1, &op1_copy, &use_copy1);
- zend_make_printable_zval(op2, &op2_copy, &use_copy2);
-
- if (use_copy1) {
- op1 = &op1_copy;
- }
- if (use_copy2) {
- op2 = &op2_copy;
- }
-
- result->value.lval = zend_binary_zval_strcmp(op1, op2);
- result->type = IS_LONG;
-
- if (use_copy1) {
- zval_dtor(op1);
- }
- if (use_copy2) {
- zval_dtor(op2);
- }
- return SUCCESS;
-}
-
-ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- op1_copy = *op1;
- zval_copy_ctor(&op1_copy);
-
- op2_copy = *op2;
- zval_copy_ctor(&op2_copy);
-
- convert_to_double(&op1_copy);
- convert_to_double(&op2_copy);
-
- result->value.lval = ZEND_NORMALIZE_BOOL(op1_copy.value.dval-op2_copy.value.dval);
- result->type = IS_LONG;
-
- return SUCCESS;
-}
-
-
-ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- zval op1_copy, op2_copy;
-
- if ((op1->type == IS_NULL && op2->type == IS_STRING)
- || (op2->type == IS_NULL && op1->type == IS_STRING)) {
- if (op1->type == IS_NULL) {
- result->type = IS_LONG;
- result->value.lval = zend_binary_strcmp("", 0, op2->value.str.val, op2->value.str.len);
- return SUCCESS;
- } else {
- result->type = IS_LONG;
- result->value.lval = zend_binary_strcmp(op1->value.str.val, op1->value.str.len, "", 0);
- return SUCCESS;
- }
- }
-
- if (op1->type == IS_STRING && op2->type == IS_STRING) {
- zendi_smart_strcmp(result, op1, op2);
- return SUCCESS;
- }
-
- if (op1->type == IS_BOOL || op2->type == IS_BOOL
- || op1->type == IS_NULL || op2->type == IS_NULL) {
- zendi_convert_to_boolean(op1, op1_copy, result);
- zendi_convert_to_boolean(op2, op2_copy, result);
- result->type = IS_LONG;
- result->value.lval = ZEND_NORMALIZE_BOOL(op1->value.lval-op2->value.lval);
- return SUCCESS;
- }
-
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
-
- if (op1->type == IS_LONG && op2->type == IS_LONG) {
- result->type = IS_LONG;
- result->value.lval = op1->value.lval>op2->value.lval?1:(op1->value.lval<op2->value.lval?-1:0);
- return SUCCESS;
- }
- if ((op1->type == IS_DOUBLE || op1->type == IS_LONG)
- && (op2->type == IS_DOUBLE || op2->type == IS_LONG)) {
- result->value.dval = (op1->type == IS_LONG ? (double) op1->value.lval : op1->value.dval) - (op2->type == IS_LONG ? (double) op2->value.lval : op2->value.dval);
- result->value.lval = ZEND_NORMALIZE_BOOL(result->value.dval);
- result->type = IS_LONG;
- return SUCCESS;
- }
- if (op1->type==IS_ARRAY && op2->type==IS_ARRAY) {
- zend_compare_arrays(result, op1, op2 TSRMLS_CC);
- return SUCCESS;
- }
-
- if (op1->type==IS_OBJECT && op2->type==IS_OBJECT) {
- zend_compare_objects(result, op1, op2 TSRMLS_CC);
- return SUCCESS;
- }
-
- if (op1->type==IS_ARRAY) {
- result->value.lval = 1;
- result->type = IS_LONG;
- return SUCCESS;
- }
- if (op2->type==IS_ARRAY) {
- result->value.lval = -1;
- result->type = IS_LONG;
- return SUCCESS;
- }
- if (op1->type==IS_OBJECT) {
- result->value.lval = 1;
- result->type = IS_LONG;
- return SUCCESS;
- }
- if (op2->type==IS_OBJECT) {
- result->value.lval = -1;
- result->type = IS_LONG;
- return SUCCESS;
- }
-
- ZVAL_BOOL(result, 0);
- return FAILURE;
-}
-
-
-static int hash_zval_identical_function(const zval **z1, const zval **z2)
-{
- zval result;
- TSRMLS_FETCH();
-
- /* is_identical_function() returns 1 in case of identity and 0 in case
- * of a difference;
- * whereas this comparison function is expected to return 0 on identity,
- * and non zero otherwise.
- */
- if (is_identical_function(&result, (zval *) *z1, (zval *) *z2 TSRMLS_CC)==FAILURE) {
- return 1;
- }
- return !result.value.lval;
-}
-
-
-ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- result->type = IS_BOOL;
- if (op1->type != op2->type) {
- result->value.lval = 0;
- return SUCCESS;
- }
- switch (op1->type) {
- case IS_NULL:
- result->value.lval = (op2->type==IS_NULL);
- break;
- case IS_BOOL:
- case IS_LONG:
- case IS_RESOURCE:
- result->value.lval = (op1->value.lval == op2->value.lval);
- break;
- case IS_DOUBLE:
- result->value.lval = (op1->value.dval == op2->value.dval);
- break;
- case IS_STRING:
- if ((op1->value.str.len == op2->value.str.len)
- && (!memcmp(op1->value.str.val, op2->value.str.val, op1->value.str.len))) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- break;
- case IS_ARRAY:
- if (zend_hash_compare(op1->value.ht, op2->value.ht, (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- break;
- case IS_OBJECT:
- if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2) && Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- break;
- default:
- ZVAL_BOOL(result, 0);
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- result->type = IS_BOOL;
- if (is_identical_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- result->value.lval = !result->value.lval;
- return SUCCESS;
-}
-
-
-ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- convert_to_boolean(result);
- if (result->value.lval == 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- convert_to_boolean(result);
- if (result->value.lval) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- if (result->type == IS_LONG) {
- result->type = IS_BOOL;
- if (result->value.lval < 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
- }
- if (result->type == IS_DOUBLE) {
- result->type = IS_BOOL;
- if (result->value.dval < 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE;
-}
-
-
-ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
-{
- if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
- if (result->type == IS_LONG) {
- result->type = IS_BOOL;
- if (result->value.lval <= 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
- }
- if (result->type == IS_DOUBLE) {
- result->type = IS_BOOL;
- if (result->value.dval <= 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE;
-}
-
-
-ZEND_API int is_class_function(zval *result, zval *op1, zend_class_entry *class TSRMLS_DC)
-{
- if (Z_TYPE_P(op1) == IS_OBJECT) {
- zend_class_entry *ce;
- for (ce = Z_OBJCE_P(op1); ce != NULL; ce = ce->parent) {
- if (ce == class) {
- ZVAL_BOOL(result, 1);
- return SUCCESS;
- }
- }
- }
- ZVAL_BOOL(result, 0);
- return SUCCESS;
-}
-
-#define LOWER_CASE 1
-#define UPPER_CASE 2
-#define NUMERIC 3
-
-
-static void increment_string(zval *str)
-{
- int carry=0;
- int pos=str->value.str.len-1;
- char *s=str->value.str.val;
- char *t;
- int last=0; /* Shut up the compiler warning */
- int ch;
-
- if (str->value.str.len == 0) {
- STR_FREE(str->value.str.val);
- str->value.str.val = estrndup("1", sizeof("1")-1);
- str->value.str.len = 1;
- return;
- }
-
- while (pos >= 0) {
- ch = s[pos];
- if (ch >= 'a' && ch <= 'z') {
- if (ch == 'z') {
- s[pos] = 'a';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last=LOWER_CASE;
- } else if (ch >= 'A' && ch <= 'Z') {
- if (ch == 'Z') {
- s[pos] = 'A';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last=UPPER_CASE;
- } else if (ch >= '0' && ch <= '9') {
- if (ch == '9') {
- s[pos] = '0';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last = NUMERIC;
- } else {
- carry=0;
- break;
- }
- if (carry == 0) {
- break;
- }
- pos--;
- }
-
- if (carry) {
- t = (char *) emalloc(str->value.str.len+1+1);
- memcpy(t+1, str->value.str.val, str->value.str.len);
- str->value.str.len++;
- t[str->value.str.len] = '\0';
- switch (last) {
- case NUMERIC:
- t[0] = '1';
- break;
- case UPPER_CASE:
- t[0] = 'A';
- break;
- case LOWER_CASE:
- t[0] = 'a';
- break;
- }
- STR_FREE(str->value.str.val);
- str->value.str.val = t;
- }
-}
-
-
-ZEND_API int increment_function(zval *op1)
-{
- switch (op1->type) {
- case IS_LONG:
- if (op1->value.lval == LONG_MAX) {
- /* switch to double */
- double d = (double)op1->value.lval;
- ZVAL_DOUBLE(op1, d+1);
- } else {
- op1->value.lval++;
- }
- break;
- case IS_DOUBLE:
- op1->value.dval = op1->value.dval + 1;
- break;
- case IS_NULL:
- op1->value.lval = 1;
- op1->type = IS_LONG;
- break;
- case IS_STRING: {
- long lval;
- double dval;
- char *strval = op1->value.str.val;
-
- switch (is_numeric_string(strval, op1->value.str.len, &lval, &dval, 0)) {
- case IS_LONG:
- if (lval == LONG_MAX) {
- /* switch to double */
- double d = (double)lval;
- ZVAL_DOUBLE(op1, d+1);
- } else {
- op1->value.lval = lval+1;
- op1->type = IS_LONG;
- }
- efree(strval); /* should never be empty_string */
- break;
- case IS_DOUBLE:
- op1->value.dval = dval+1;
- op1->type = IS_DOUBLE;
- efree(strval); /* should never be empty_string */
- break;
-#if 0
- case FLAG_IS_BC:
- /* Not implemented */
-#endif
- default:
- /* Perl style string increment */
- increment_string(op1);
- break;
- }
- }
- break;
- default:
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int decrement_function(zval *op1)
-{
- long lval;
- double dval;
-
- switch (op1->type) {
- case IS_LONG:
- if (op1->value.lval == LONG_MIN) {
- double d = (double)op1->value.lval;
- ZVAL_DOUBLE(op1, d-1);
- } else {
- op1->value.lval--;
- }
- break;
- case IS_DOUBLE:
- op1->value.dval = op1->value.dval - 1;
- break;
- case IS_STRING: /* Like perl we only support string increment */
- if (op1->value.str.len == 0) { /* consider as 0 */
- STR_FREE(op1->value.str.val);
- op1->value.lval = -1;
- op1->type = IS_LONG;
- break;
- }
- switch(is_numeric_string(op1->value.str.val, op1->value.str.len, &lval, &dval, 0)) {
- case IS_LONG:
- STR_FREE(op1->value.str.val);
- if (lval == LONG_MIN) {
- double d = (double)lval;
- ZVAL_DOUBLE(op1, d-1);
- } else {
- op1->value.lval = lval-1;
- op1->type = IS_LONG;
- }
- break;
- case IS_DOUBLE:
- STR_FREE(op1->value.str.val);
- op1->value.dval = dval - 1;
- op1->type = IS_DOUBLE;
- break;
- }
- break;
- default:
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-
-ZEND_API int zval_is_true(zval *op)
-{
- convert_to_boolean(op);
- return (op->value.lval ? 1 : 0);
-}
-
-ZEND_API void zend_str_tolower(char *str, unsigned int length)
-{
- register char *p=str, *end=p+length;
-
- while (p<end) {
- if (*p >= 'A' && *p <= 'Z') {
- *p = (*p)+32;
- }
- p++;
- }
-}
-
-ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2)
-{
- int retval;
-
- retval = memcmp(s1, s2, MIN(len1, len2));
- if (!retval) {
- return (len1 - len2);
- } else {
- return retval;
- }
-}
-
-ZEND_API int zend_binary_strncmp(char *s1, uint len1, char *s2, uint len2, uint length)
-{
- int retval;
-
- retval = memcmp(s1, s2, MIN(length, MIN(len1, len2)));
- if (!retval) {
- return (MIN(length, len1) - MIN(length, len2));
- } else {
- return retval;
- }
-}
-
-
-ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2)
-{
- int len;
- int c1, c2;
-
- len = MIN(len1, len2);
-
- while (len--) {
- c1 = tolower(*s1++);
- c2 = tolower(*s2++);
- if (c1 != c2) {
- return c1 - c2;
- }
- }
-
- return len1 - len2;
-}
-
-
-ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, uint length)
-{
- int len;
- int c1, c2;
-
- len = MIN(length, MIN(len1, len2));
-
- while (len--) {
- c1 = tolower(*s1++);
- c2 = tolower(*s2++);
- if (c1 != c2) {
- return c1 - c2;
- }
- }
-
- return MIN(length, len1) - MIN(length, len2);
-}
-
-
-ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2)
-{
- return zend_binary_strcmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len);
-}
-
-ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3)
-{
- return zend_binary_strncmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len, s3->value.lval);
-}
-
-
-ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2)
-{
- return zend_binary_strcasecmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len);
-}
-
-
-ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3)
-{
- return zend_binary_strncasecmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len, s3->value.lval);
-}
-
-
-ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2)
-{
- int ret1, ret2;
- long lval1, lval2;
- double dval1, dval2;
-
- if ((ret1=is_numeric_string(s1->value.str.val, s1->value.str.len, &lval1, &dval1, 0)) &&
- (ret2=is_numeric_string(s2->value.str.val, s2->value.str.len, &lval2, &dval2, 0))) {
-#if 0&&WITH_BCMATH
- if ((ret1==FLAG_IS_BC) || (ret2==FLAG_IS_BC)) {
- bc_num first, second;
-
- /* use the BC math library to compare the numbers */
- init_num(&first);
- init_num(&second);
- str2num(&first, s1->value.str.val, 100); /* this scale should do */
- str2num(&second, s2->value.str.val, 100); /* ditto */
- result->value.lval = bc_compare(first, second);
- result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval);
- result->type = IS_LONG;
- free_num(&first);
- free_num(&second);
- } else
-#endif
- if ((ret1==IS_DOUBLE) || (ret2==IS_DOUBLE)) {
- if (ret1!=IS_DOUBLE) {
- dval1 = strtod(s1->value.str.val, NULL);
- } else if (ret2!=IS_DOUBLE) {
- dval2 = strtod(s2->value.str.val, NULL);
- }
- result->value.dval = dval1 - dval2;
- result->value.lval = ZEND_NORMALIZE_BOOL(result->value.dval);
- result->type = IS_LONG;
- } else { /* they both have to be long's */
- result->value.lval = lval1 - lval2;
- result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval);
- result->type = IS_LONG;
- }
- } else {
- result->value.lval = zend_binary_zval_strcmp(s1, s2);
- result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval);
- result->type = IS_LONG;
- }
- return;
-}
-
-
-static int hash_zval_compare_function(const zval **z1, const zval **z2 TSRMLS_DC)
-{
- zval result;
-
- if (compare_function(&result, (zval *) *z1, (zval *) *z2 TSRMLS_CC)==FAILURE) {
- return 1;
- }
- return result.value.lval;
-}
-
-ZEND_API int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC)
-{
- return zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC);
-}
-
-
-
-ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC)
-{
- result->type = IS_LONG;
- result->value.lval = zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC);
-}
-
-
-ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC)
-{
- zend_compare_symbol_tables(result, a1->value.ht, a2->value.ht TSRMLS_CC);
-}
-
-
-ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC)
-{
- result->type = IS_LONG;
- if (Z_OBJ_HT_P(o1) != Z_OBJ_HT_P(o2)) {
- result->value.lval = 1; /* Comparing objects of different types is pretty much meaningless */
- return;
- }
-
- if (Z_OBJ_HT_P(o1)->compare_objects == NULL) {
- if (Z_OBJ_HANDLE_P(o1) == Z_OBJ_HANDLE_P(o2)) {
- result->value.lval = 0;
- } else {
- result->value.lval = 1;
- }
- return;
- } else {
- result->value.lval = Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC);
- }
-}
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
deleted file mode 100644
index c0fa057494..0000000000
--- a/Zend/zend_operators.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_OPERATORS_H
-#define ZEND_OPERATORS_H
-
-#include <errno.h>
-#include <math.h>
-
-#ifdef HAVE_IEEEFP_H
-#include <ieeefp.h>
-#endif
-
-
-#if 0&&WITH_BCMATH
-#include "ext/bcmath/libbcmath/src/bcmath.h"
-#endif
-
-#define MAX_LENGTH_OF_LONG 18
-#define MAX_LENGTH_OF_DOUBLE 32
-
-ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC);
-ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC);
-ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-
-ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-
-ZEND_API int is_class_function(zval *result, zval *op1, zend_class_entry *ce TSRMLS_DC);
-
-static inline zend_bool is_numeric_string(char *str, int length, long *lval, double *dval, zend_bool allow_errors)
-{
- long local_lval;
- double local_dval;
- char *end_ptr_long, *end_ptr_double;
- int conv_base=10;
-
- if (!length) {
- return 0;
- }
-
- /* handle hex numbers */
- if (length>=2 && str[0]=='0' && (str[1]=='x' || str[1]=='X')) {
- conv_base=16;
- }
- errno=0;
- local_lval = strtol(str, &end_ptr_long, conv_base);
- if (errno!=ERANGE) {
- if (end_ptr_long == str+length) { /* integer string */
- if (lval) {
- *lval = local_lval;
- }
- return IS_LONG;
- }
- } else {
- end_ptr_long=NULL;
- }
-
- if (conv_base==16) { /* hex string, under UNIX strtod() messes it up */
- return 0;
- }
-
- errno=0;
- local_dval = strtod(str, &end_ptr_double);
- if (errno!=ERANGE) {
- if (end_ptr_double == str+length) { /* floating point string */
- if (! zend_finite(local_dval)) {
- /* "inf","nan" and maybe other weird ones */
- return 0;
- }
-
- if (dval) {
- *dval = local_dval;
- }
-#if 0&&WITH_BCMATH
- if (length>16) {
- register char *ptr=str, *end=str+length;
-
- while (ptr<end) {
- switch(*ptr++) {
- case 'e':
- case 'E':
- /* scientific notation, not handled by the BC library */
- return IS_DOUBLE;
- break;
- default:
- break;
- }
- }
- return FLAG_IS_BC;
- } else {
- return IS_DOUBLE;
- }
-#else
- return IS_DOUBLE;
-#endif
- }
- } else {
- end_ptr_double=NULL;
- }
- if (allow_errors) {
- if (end_ptr_double>end_ptr_long && dval) {
- *dval = local_dval;
- return IS_DOUBLE;
- } else if (end_ptr_long && lval) {
- *lval = local_lval;
- return IS_LONG;
- }
- }
- return 0;
-}
-
-ZEND_API int increment_function(zval *op1);
-ZEND_API int decrement_function(zval *op2);
-
-BEGIN_EXTERN_C()
-ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC);
-ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC);
-ZEND_API void convert_to_long(zval *op);
-ZEND_API void convert_to_double(zval *op);
-ZEND_API void convert_to_long_base(zval *op, int base);
-ZEND_API void convert_to_null(zval *op);
-ZEND_API void convert_to_boolean(zval *op);
-ZEND_API void convert_to_array(zval *op);
-ZEND_API void convert_to_object(zval *op);
-ZEND_API void multi_convert_to_long_ex(int argc, ...);
-ZEND_API void multi_convert_to_double_ex(int argc, ...);
-ZEND_API void multi_convert_to_string_ex(int argc, ...);
-ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2);
-ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2);
-#define convert_to_string(op) _convert_to_string((op) ZEND_FILE_LINE_CC)
-
-ZEND_API double zend_string_to_double(const char *number, zend_uint length);
-END_EXTERN_C()
-
-ZEND_API int zval_is_true(zval *op);
-ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-
-ZEND_API void zend_str_tolower(char *str, unsigned int length);
-ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2);
-ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3);
-ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2);
-ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3);
-ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2);
-ZEND_API int zend_binary_strncmp(char *s1, uint len1, char *s2, uint len2, uint length);
-ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2);
-ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, uint length);
-
-ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
-ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC);
-ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC);
-ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC);
-
-ZEND_API int zend_atoi(const char *str, int str_len);
-
-#define convert_to_ex_master(ppzv, lower_type, upper_type) \
- if ((*ppzv)->type!=IS_##upper_type) { \
- if (!(*ppzv)->is_ref) { \
- SEPARATE_ZVAL(ppzv); \
- } \
- convert_to_##lower_type(*ppzv); \
- }
-
-#define convert_to_writable_ex_master(ppzv, lower_type, upper_type) \
- if ((*ppzv)->type!=IS_##upper_type) { \
- SEPARATE_ZVAL(ppzv); \
- convert_to_##lower_type(*ppzv); \
- }
-
-
-#define convert_to_boolean_ex(ppzv) convert_to_ex_master(ppzv, boolean, BOOL)
-#define convert_to_long_ex(ppzv) convert_to_ex_master(ppzv, long, LONG)
-#define convert_to_double_ex(ppzv) convert_to_ex_master(ppzv, double, DOUBLE)
-#define convert_to_string_ex(ppzv) convert_to_ex_master(ppzv, string, STRING)
-#define convert_to_array_ex(ppzv) convert_to_ex_master(ppzv, array, ARRAY)
-#define convert_to_object_ex(ppzv) convert_to_ex_master(ppzv, object, OBJECT)
-#define convert_to_null_ex(ppzv) convert_to_ex_master(ppzv, null, NULL)
-
-#define convert_to_writable_boolean_ex(ppzv) convert_to_writable_ex_master(ppzv, boolean, BOOL)
-#define convert_to_writable_long_ex(ppzv) convert_to_writable_ex_master(ppzv, long, LONG)
-#define convert_to_writable_double_ex(ppzv) convert_to_writable_ex_master(ppzv, double, DOUBLE)
-#define convert_to_writable_string_ex(ppzv) convert_to_writable_ex_master(ppzv, string, STRING)
-#define convert_to_writable_array_ex(ppzv) convert_to_writable_ex_master(ppzv, array, ARRAY)
-#define convert_to_writable_object_ex(ppzv) convert_to_writable_ex_master(ppzv, object, OBJECT)
-#define convert_to_writable_null_ex(ppzv) convert_to_writable_ex_master(ppzv, null, NULL)
-
-
-#define convert_scalar_to_number_ex(ppzv) \
- if ((*ppzv)->type!=IS_LONG && (*ppzv)->type!=IS_DOUBLE) { \
- if (!(*ppzv)->is_ref) { \
- SEPARATE_ZVAL(ppzv); \
- } \
- convert_scalar_to_number(*ppzv TSRMLS_CC); \
- }
-
-
-#define Z_LVAL(zval) (zval).value.lval
-#define Z_BVAL(zval) ((zend_bool)(zval).value.lval)
-#define Z_DVAL(zval) (zval).value.dval
-#define Z_STRVAL(zval) (zval).value.str.val
-#define Z_STRLEN(zval) (zval).value.str.len
-#define Z_ARRVAL(zval) (zval).value.ht
-#define Z_OBJ_HANDLE(zval) (zval).value.obj.handle
-#define Z_OBJ_HT(zval) (zval).value.obj.handlers
-#define Z_OBJ(zval) zend_objects_get_address(&(zval))
-#define Z_OBJCE(zval) zend_get_class_entry(&(zval))
-#define Z_OBJPROP(zval) Z_OBJ(zval)->properties
-#define Z_RESVAL(zval) (zval).value.lval
-
-#define Z_LVAL_P(zval_p) Z_LVAL(*zval_p)
-#define Z_BVAL_P(zval_p) Z_BVAL(*zval_p)
-#define Z_DVAL_P(zval_p) Z_DVAL(*zval_p)
-#define Z_STRVAL_P(zval_p) Z_STRVAL(*zval_p)
-#define Z_STRLEN_P(zval_p) Z_STRLEN(*zval_p)
-#define Z_ARRVAL_P(zval_p) Z_ARRVAL(*zval_p)
-#define Z_OBJ_P(zval_p) Z_OBJ(*zval_p)
-#define Z_OBJPROP_P(zval_p) Z_OBJPROP(*zval_p)
-#define Z_OBJCE_P(zval_p) Z_OBJCE(*zval_p)
-#define Z_RESVAL_P(zval_p) Z_RESVAL(*zval_p)
-#define Z_OBJ_HANDLE_P(zval_p) Z_OBJ_HANDLE(*zval_p)
-#define Z_OBJ_HT_P(zval_p) Z_OBJ_HT(*zval_p)
-
-#define Z_LVAL_PP(zval_pp) Z_LVAL(**zval_pp)
-#define Z_BVAL_PP(zval_pp) Z_BVAL(**zval_pp)
-#define Z_DVAL_PP(zval_pp) Z_DVAL(**zval_pp)
-#define Z_STRVAL_PP(zval_pp) Z_STRVAL(**zval_pp)
-#define Z_STRLEN_PP(zval_pp) Z_STRLEN(**zval_pp)
-#define Z_ARRVAL_PP(zval_pp) Z_ARRVAL(**zval_pp)
-#define Z_OBJ_PP(zval_pp) Z_OBJ(**zval_pp)
-#define Z_OBJPROP_PP(zval_pp) Z_OBJPROP(**zval_pp)
-#define Z_OBJCE_PP(zval_pp) Z_OBJCE(**zval_pp)
-#define Z_RESVAL_PP(zval_pp) Z_RESVAL(**zval_pp)
-#define Z_OBJ_HANDLE_PP(zval_p) Z_OBJ_HANDLE(**zval_p)
-#define Z_OBJ_HT_PP(zval_p) Z_OBJ_HT(**zval_p)
-
-#define Z_TYPE(zval) (zval).type
-#define Z_TYPE_P(zval_p) Z_TYPE(*zval_p)
-#define Z_TYPE_PP(zval_pp) Z_TYPE(**zval_pp)
-
-#endif
diff --git a/Zend/zend_ptr_stack.c b/Zend/zend_ptr_stack.c
deleted file mode 100644
index b50ac7510c..0000000000
--- a/Zend/zend_ptr_stack.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "zend.h"
-#include "zend_ptr_stack.h"
-#ifdef HAVE_STDARG_H
-# include <stdarg.h>
-#endif
-
-ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack)
-{
- stack->top_element = stack->elements = (void **) emalloc(sizeof(void *)*PTR_STACK_BLOCK_SIZE);
- stack->max = PTR_STACK_BLOCK_SIZE;
- stack->top = 0;
-}
-
-
-ZEND_API void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count, ...)
-{
- va_list ptr;
- void *elem;
-
- if (stack->top+count > stack->max) { /* we need to allocate more memory */
- stack->max *= 2;
- stack->max += count;
- stack->elements = (void **) erealloc(stack->elements, (sizeof(void *) * (stack->max)));
- stack->top_element = stack->elements+stack->top;
- }
- va_start(ptr, count);
- while (count>0) {
- elem = va_arg(ptr, void *);
- stack->top++;
- *(stack->top_element++) = elem;
- count--;
- }
- va_end(ptr);
-}
-
-
-ZEND_API void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count, ...)
-{
- va_list ptr;
- void **elem;
-
- va_start(ptr, count);
- while (count>0) {
- elem = va_arg(ptr, void **);
- *elem = *(--stack->top_element);
- stack->top--;
- count--;
- }
- va_end(ptr);
-}
-
-
-
-ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack)
-{
- if (stack->elements) {
- efree(stack->elements);
- }
-}
-
-
-ZEND_API void zend_ptr_stack_apply(zend_ptr_stack *stack, void (*func)(void *))
-{
- int i = stack->top;
-
- while (--i >= 0) {
- func(stack->elements[i]);
- }
-}
-
-
-ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *), zend_bool free_elements)
-{
- zend_ptr_stack_apply(stack, func);
- if (free_elements) {
- int i = stack->top;
-
- while (--i >= 0) {
- efree(stack->elements[i]);
- }
- }
- stack->top = 0;
- stack->top_element = stack->elements;
-}
-
-
-ZEND_API int zend_ptr_stack_num_elements(zend_ptr_stack *stack)
-{
- return stack->top;
-}
diff --git a/Zend/zend_ptr_stack.h b/Zend/zend_ptr_stack.h
deleted file mode 100644
index 5bfb91ab3a..0000000000
--- a/Zend/zend_ptr_stack.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_PTR_STACK_H
-#define ZEND_PTR_STACK_H
-
-typedef struct _zend_ptr_stack {
- int top, max;
- void **elements;
- void **top_element;
-} zend_ptr_stack;
-
-
-#define PTR_STACK_BLOCK_SIZE 64
-
-ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack);
-ZEND_API void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count, ...);
-ZEND_API void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count, ...);
-ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack);
-ZEND_API void zend_ptr_stack_apply(zend_ptr_stack *stack, void (*func)(void *));
-ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *), zend_bool free_elements);
-ZEND_API int zend_ptr_stack_num_elements(zend_ptr_stack *stack);
-
-static inline void zend_ptr_stack_push(zend_ptr_stack *stack, void *ptr)
-{
- if (stack->top >= stack->max) { /* we need to allocate more memory */
- stack->elements = (void **) erealloc(stack->elements, (sizeof(void *) * (stack->max *= 2 )));
- stack->top_element = stack->elements+stack->top;
- }
- stack->top++;
- *(stack->top_element++) = ptr;
-}
-
-static inline void *zend_ptr_stack_pop(zend_ptr_stack *stack)
-{
- stack->top--;
- return *(--stack->top_element);
-}
-
-
-#endif /* ZEND_PTR_STACK_H */
diff --git a/Zend/zend_qsort.c b/Zend/zend_qsort.c
deleted file mode 100644
index 778333e792..0000000000
--- a/Zend/zend_qsort.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-
-#include <limits.h>
-
-#define QSORT_STACK_SIZE (sizeof(size_t) * CHAR_BIT)
-
-static void _zend_qsort_swap(void *a, void *b, size_t siz)
-{
- register char *tmp_a_char;
- register char *tmp_b_char;
- register int *tmp_a_int;
- register int *tmp_b_int;
- register size_t i;
- int t_i;
- char t_c;
-
- tmp_a_int = (int *) a;
- tmp_b_int = (int *) b;
-
- for (i = sizeof(int); i <= siz; i += sizeof(int)) {
- t_i = *tmp_a_int;
- *tmp_a_int++ = *tmp_b_int;
- *tmp_b_int++ = t_i;
- }
-
- tmp_a_char = (char *) tmp_a_int;
- tmp_b_char = (char *) tmp_b_int;
-
- for (i = i - sizeof(int) + 1; i <= siz; ++i) {
- t_c = *tmp_a_char;
- *tmp_a_char++ = *tmp_b_char;
- *tmp_b_char++ = t_c;
- }
-}
-
-ZEND_API void zend_qsort(void *base, size_t nmemb, size_t siz, compare_func_t compare TSRMLS_DC)
-{
- void *begin_stack[QSORT_STACK_SIZE];
- void *end_stack[QSORT_STACK_SIZE];
- register char *begin;
- register char *end;
- register char *seg1;
- register char *seg2;
- register char *seg2p;
- register int loop;
- uint offset;
-
- begin_stack[0] = (char *) base;
- end_stack[0] = (char *) base + ((nmemb - 1) * siz);
-
- for (loop = 0; loop >= 0; --loop) {
- begin = begin_stack[loop];
- end = end_stack[loop];
-
- while (begin < end) {
- offset = (end - begin) >> 1;
- _zend_qsort_swap(begin, begin + (offset - (offset % siz)), siz);
-
- seg1 = begin + siz;
- seg2 = end;
-
- while (1) {
- for (; seg1 < seg2 && compare(begin, seg1 TSRMLS_CC) > 0;
- seg1 += siz);
-
- for (; seg2 >= seg1 && compare(seg2, begin TSRMLS_CC) > 0;
- seg2 -= siz);
-
- if (seg1 >= seg2)
- break;
-
- _zend_qsort_swap(seg1, seg2, siz);
-
- seg1 += siz;
- seg2 -= siz;
- }
-
- _zend_qsort_swap(begin, seg2, siz);
-
- seg2p = seg2;
-
- if ((seg2p - begin) <= (end - seg2p)) {
- if ((seg2p + siz) < end) {
- begin_stack[loop] = seg2p + siz;
- end_stack[loop++] = end;
- }
- end = seg2p - siz;
- }
- else {
- if ((seg2p - siz) > begin) {
- begin_stack[loop] = begin;
- end_stack[loop++] = seg2p - siz;
- }
- begin = seg2p + siz;
- }
- }
- }
-}
-
-/*
- * Local Variables:
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4
- */
diff --git a/Zend/zend_qsort.h b/Zend/zend_qsort.h
deleted file mode 100644
index b432014663..0000000000
--- a/Zend/zend_qsort.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef ZEND_QSORT_H
-#define ZEND_QSORT_H
-
-BEGIN_EXTERN_C()
-ZEND_API void zend_qsort(void *base, size_t nmemb, size_t siz, compare_func_t compare TSRMLS_DC);
-END_EXTERN_C()
-
-#endif /* ZEND_QSORT_H */
diff --git a/Zend/zend_sprintf.c b/Zend/zend_sprintf.c
deleted file mode 100644
index bf28c82e8a..0000000000
--- a/Zend/zend_sprintf.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include <stdio.h>
-
-#include "zend.h"
-
-#ifdef HAVE_STDARG_H
-# include <stdarg.h>
-#endif
-
-#if ZEND_BROKEN_SPRINTF
-int zend_sprintf(char *buffer, const char *format, ...)
-{
- va_list args;
-
- va_start(args, format);
- vsprintf(buffer, format, args);
- va_end(args);
-
- return strlen(buffer);
-}
-#endif
diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c
deleted file mode 100644
index 5bc941fa4a..0000000000
--- a/Zend/zend_stack.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "zend.h"
-#include "zend_stack.h"
-
-ZEND_API int zend_stack_init(zend_stack *stack)
-{
- stack->top = 0;
- stack->elements = (void **) emalloc(sizeof(void **) * STACK_BLOCK_SIZE);
- if (!stack->elements) {
- return FAILURE;
- } else {
- stack->max = STACK_BLOCK_SIZE;
- return SUCCESS;
- }
-}
-
-ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size)
-{
- if (stack->top >= stack->max) { /* we need to allocate more memory */
- stack->elements = (void **) erealloc(stack->elements,
- (sizeof(void **) * (stack->max += STACK_BLOCK_SIZE)));
- if (!stack->elements) {
- return FAILURE;
- }
- }
- stack->elements[stack->top] = (void *) emalloc(size);
- memcpy(stack->elements[stack->top], element, size);
- return stack->top++;
-}
-
-
-ZEND_API int zend_stack_top(zend_stack *stack, void **element)
-{
- if (stack->top > 0) {
- *element = stack->elements[stack->top - 1];
- return SUCCESS;
- } else {
- *element = NULL;
- return FAILURE;
- }
-}
-
-
-ZEND_API int zend_stack_del_top(zend_stack *stack)
-{
- if (stack->top > 0) {
- efree(stack->elements[--stack->top]);
- }
- return SUCCESS;
-}
-
-
-ZEND_API int zend_stack_int_top(zend_stack *stack)
-{
- int *e;
-
- if (zend_stack_top(stack, (void **) &e) == FAILURE) {
- return FAILURE; /* this must be a negative number, since negative numbers can't be address numbers */
- } else {
- return *e;
- }
-}
-
-
-ZEND_API int zend_stack_is_empty(zend_stack *stack)
-{
- if (stack->top == 0) {
- return 1;
- } else {
- return 0;
- }
-}
-
-
-ZEND_API int zend_stack_destroy(zend_stack *stack)
-{
- register int i;
-
- for (i = 0; i < stack->top; i++) {
- efree(stack->elements[i]);
- }
-
- if (stack->elements) {
- efree(stack->elements);
- }
- return SUCCESS;
-}
-
-
-ZEND_API void **zend_stack_base(zend_stack *stack)
-{
- return stack->elements;
-}
-
-
-ZEND_API int zend_stack_count(zend_stack *stack)
-{
- return stack->top;
-}
-
-
-ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element))
-{
- int i;
-
- switch (type) {
- case ZEND_STACK_APPLY_TOPDOWN:
- for (i=stack->top-1; i>=0; i--) {
- if (apply_function(stack->elements[i])) {
- break;
- }
- }
- break;
- case ZEND_STACK_APPLY_BOTTOMUP:
- for (i=0; i<stack->top; i++) {
- if (apply_function(stack->elements[i])) {
- break;
- }
- }
- break;
- }
-}
-
-
-ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg)
-{
- int i;
-
- switch (type) {
- case ZEND_STACK_APPLY_TOPDOWN:
- for (i=stack->top-1; i>=0; i--) {
- if (apply_function(stack->elements[i], arg)) {
- break;
- }
- }
- break;
- case ZEND_STACK_APPLY_BOTTOMUP:
- for (i=0; i<stack->top; i++) {
- if (apply_function(stack->elements[i], arg)) {
- break;
- }
- }
- break;
- }
-}
diff --git a/Zend/zend_stack.h b/Zend/zend_stack.h
deleted file mode 100644
index 71ba013230..0000000000
--- a/Zend/zend_stack.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_STACK_H
-#define ZEND_STACK_H
-
-typedef struct _zend_stack {
- int top, max;
- void **elements;
-} zend_stack;
-
-
-#define STACK_BLOCK_SIZE 64
-
-ZEND_API int zend_stack_init(zend_stack *stack);
-ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size);
-ZEND_API int zend_stack_top(zend_stack *stack, void **element);
-ZEND_API int zend_stack_del_top(zend_stack *stack);
-ZEND_API int zend_stack_int_top(zend_stack *stack);
-ZEND_API int zend_stack_is_empty(zend_stack *stack);
-ZEND_API int zend_stack_destroy(zend_stack *stack);
-ZEND_API void **zend_stack_base(zend_stack *stack);
-ZEND_API int zend_stack_count(zend_stack *stack);
-ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element));
-ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg);
-
-#define ZEND_STACK_APPLY_TOPDOWN 1
-#define ZEND_STACK_APPLY_BOTTOMUP 2
-
-#endif /* ZEND_STACK_H */
diff --git a/Zend/zend_static_allocator.c b/Zend/zend_static_allocator.c
deleted file mode 100644
index cd6b3ff724..0000000000
--- a/Zend/zend_static_allocator.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "zend_static_allocator.h"
-
-/* Not checking emalloc() and erealloc() return values as they are supposed to bailout */
-
-inline static void block_init(Block *block, zend_uint block_size)
-{
- block->pos = block->bp = (char *) emalloc(block_size);
- block->end = block->bp + block_size;
-}
-
-inline static char *block_allocate(Block *block, zend_uint size)
-{
- char *retval = block->pos;
- if ((block->pos += size) >= block->end) {
- return (char *)NULL;
- }
- return retval;
-}
-
-inline static void block_destroy(Block *block)
-{
- efree(block->bp);
-}
-
-void static_allocator_init(StaticAllocator *sa)
-{
- sa->Blocks = (Block *) emalloc(sizeof(Block));
- block_init(sa->Blocks, ALLOCATOR_BLOCK_SIZE);
- sa->num_blocks = 1;
- sa->current_block = 0;
-}
-
-char *static_allocator_allocate(StaticAllocator *sa, zend_uint size)
-{
- char *retval;
-
- retval = block_allocate(&sa->Blocks[sa->current_block], size);
- if (retval) {
- return retval;
- }
- sa->Blocks = (Block *) erealloc(sa->Blocks, ++sa->num_blocks);
- sa->current_block++;
- block_init(&sa->Blocks[sa->current_block], (size > ALLOCATOR_BLOCK_SIZE) ? size : ALLOCATOR_BLOCK_SIZE);
- retval = block_allocate(&sa->Blocks[sa->current_block], size);
- return retval;
-}
-
-void static_allocator_destroy(StaticAllocator *sa)
-{
- zend_uint i;
-
- for (i=0; i<sa->num_blocks; i++) {
- block_free(&sa->Blocks[i]);
- }
- efree(sa->Blocks);
-}
diff --git a/Zend/zend_static_allocator.h b/Zend/zend_static_allocator.h
deleted file mode 100644
index 8ae4ecca5d..0000000000
--- a/Zend/zend_static_allocator.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef ZEND_STATIC_ALLOCATOR_H
-#define ZEND_STATIC_ALLOCATOR_H
-
-#define ALLOCATOR_BLOCK_SIZE 400000
-
-/* Temporary */
-typedef unsigned int zend_uint;
-#define emalloc(s) malloc(s)
-#define efree(p) free(p)
-
-typedef struct _Block {
- char *bp;
- char *pos;
- char *end;
-} Block;
-
-typedef struct _StaticAllocator {
- Block *Blocks;
- zend_uint num_blocks;
- zend_uint current_block;
-} StaticAllocator;
-
-void static_allocator_init(StaticAllocator *sa);
-char *static_allocator_allocate(StaticAllocator *sa, zend_uint size);
-void static_allocator_destroy(StaticAllocator *sa);
-
-#endif /* ZEND_STATIC_ALLOCATOR_H */
diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c
deleted file mode 100644
index 116eb9c5d3..0000000000
--- a/Zend/zend_ts_hash.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Harald Radi <harald.radi@nme.at> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef ZTS
-
-#include "zend_ts_hash.h"
-
-/* ts management functions */
-static void begin_read(TsHashTable *ht)
-{
- tsrm_mutex_lock(ht->mx_reader);
- if ((++(ht->reader)) == 1) {
- tsrm_mutex_lock(ht->mx_writer);
- }
- tsrm_mutex_unlock(ht->mx_reader);
-}
-
-static void end_read(TsHashTable *ht)
-{
- tsrm_mutex_lock(ht->mx_reader);
- if ((--(ht->reader)) == 0) {
- tsrm_mutex_unlock(ht->mx_writer);
- }
- tsrm_mutex_unlock(ht->mx_reader);
-}
-
-static void begin_write(TsHashTable *ht)
-{
- tsrm_mutex_lock(ht->mx_writer);
-}
-
-static void end_write(TsHashTable *ht)
-{
- tsrm_mutex_unlock(ht->mx_writer);
-}
-
-/* delegates */
-ZEND_API int zend_ts_hash_init(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent)
-{
- ht->mx_reader = tsrm_mutex_alloc();
- ht->mx_writer = tsrm_mutex_alloc();
- ht->reader = 0;
- return zend_hash_init(TS_HASH(ht), nSize, pHashFunction, pDestructor, persistent);
-}
-
-ZEND_API int zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection)
-{
- ht->mx_reader = tsrm_mutex_alloc();
- ht->mx_writer = tsrm_mutex_alloc();
- ht->reader = 0;
- return zend_hash_init_ex(TS_HASH(ht), nSize, pHashFunction, pDestructor, persistent, bApplyProtection);
-}
-
-ZEND_API void zend_ts_hash_destroy(TsHashTable *ht)
-{
- tsrm_mutex_free(ht->mx_reader);
- tsrm_mutex_free(ht->mx_reader);
- zend_hash_destroy(TS_HASH(ht));
-}
-
-ZEND_API void zend_ts_hash_clean(TsHashTable *ht)
-{
- ht->reader = 0;
- zend_hash_clean(TS_HASH(ht));
-}
-
-ZEND_API int zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_add_or_update(TS_HASH(ht), arKey, nKeyLength, pData, nDataSize, pDest, flag);
- end_write(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_quick_add_or_update(TS_HASH(ht), arKey, nKeyLength, h, pData, nDataSize, pDest, flag);
- end_write(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_index_update_or_next_insert(TS_HASH(ht), h, pData, nDataSize, pDest, flag);
- end_write(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint nKeyLength)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_add_empty_element(TS_HASH(ht), arKey, nKeyLength);
- end_write(ht);
-
- return retval;
-}
-
-ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht)
-{
- tsrm_mutex_free(ht->mx_reader);
- tsrm_mutex_free(ht->mx_reader);
- zend_hash_graceful_destroy(TS_HASH(ht));
-}
-
-ZEND_API void zend_ts_hash_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC)
-{
- begin_write(ht);
- zend_hash_apply(TS_HASH(ht), apply_func TSRMLS_CC);
- end_write(ht);
-}
-
-ZEND_API void zend_ts_hash_apply_with_argument(TsHashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC)
-{
- begin_write(ht);
- zend_hash_apply_with_argument(TS_HASH(ht), apply_func, argument TSRMLS_CC);
- end_write(ht);
-}
-
-ZEND_API void zend_ts_hash_apply_with_arguments(TsHashTable *ht, apply_func_args_t apply_func, int num_args, ...)
-{
- va_list args;
-
- va_start(args, num_args);
- begin_write(ht);
- zend_hash_apply_with_arguments(TS_HASH(ht), apply_func, num_args, args);
- end_write(ht);
- va_end(args);
-}
-
-ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC)
-{
- begin_write(ht);
- zend_hash_reverse_apply(TS_HASH(ht), apply_func TSRMLS_CC);
- end_write(ht);
-}
-
-ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_del_key_or_index(TS_HASH(ht), arKey, nKeyLength, h, flag);
- end_write(ht);
-
- return retval;
-}
-
-ZEND_API ulong zend_ts_get_hash_value(TsHashTable *ht, char *arKey, uint nKeyLength)
-{
- ulong retval;
-
- begin_read(ht);
- retval = zend_get_hash_value(TS_HASH(ht), arKey, nKeyLength);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData)
-{
- int retval;
-
- begin_read(ht);
- retval = zend_hash_find(TS_HASH(ht), arKey, nKeyLength, pData);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData)
-{
- int retval;
-
- begin_read(ht);
- retval = zend_hash_quick_find(TS_HASH(ht), arKey, nKeyLength, h, pData);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, ulong h, void **pData)
-{
- int retval;
-
- begin_read(ht);
- retval = zend_hash_index_find(TS_HASH(ht), h, pData);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, uint nKeyLength)
-{
- int retval;
-
- begin_read(ht);
- retval = zend_hash_exists(TS_HASH(ht), arKey, nKeyLength);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, ulong h)
-{
- int retval;
-
- begin_read(ht);
- retval = zend_hash_index_exists(TS_HASH(ht), h);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size)
-{
- begin_read(source);
- begin_write(target);
- zend_hash_copy(TS_HASH(target), TS_HASH(source), pCopyConstructor, tmp, size);
- end_write(target);
- end_read(source);
-}
-
-ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite)
-{
- begin_read(source);
- begin_write(target);
- zend_hash_merge(TS_HASH(target), TS_HASH(source), pCopyConstructor, tmp, size, overwrite);
- end_write(target);
- end_read(source);
-}
-
-ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, uint size, zend_bool (*pReplaceOrig)(void *orig, void *p_new))
-{
- begin_read(source);
- begin_write(target);
- zend_hash_merge_ex(TS_HASH(target), TS_HASH(source), pCopyConstructor, size, pReplaceOrig);
- end_write(target);
- end_read(source);
-}
-
-ZEND_API int zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_sort(TS_HASH(ht), sort_func, compare_func, renumber TSRMLS_CC);
- end_write(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC)
-{
- int retval;
-
- begin_read(ht1);
- begin_read(ht2);
- retval = zend_hash_compare(TS_HASH(ht1), TS_HASH(ht2), compar, ordered TSRMLS_CC);
- end_read(ht2);
- end_read(ht1);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC)
-{
- int retval;
-
- begin_read(ht);
- retval = zend_hash_minmax(TS_HASH(ht), compar, flag, pData TSRMLS_CC);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht)
-{
- int retval;
-
- begin_read(ht);
- retval = zend_hash_num_elements(TS_HASH(ht));
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_rehash(TsHashTable *ht)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_rehash(TS_HASH(ht));
- end_write(ht);
-
- return retval;
-}
-
-#if ZEND_DEBUG
-void zend_ts_hash_display_pListTail(TsHashTable *ht)
-{
- begin_read(ht);
- zend_hash_display_pListTail(TS_HASH(ht));
- end_read(ht);
-}
-
-void zend_ts_hash_display(TsHashTable *ht)
-{
- begin_read(ht);
- zend_hash_display(TS_HASH(ht));
- end_read(ht);
-}
-#endif
-
-#endif /* ZTS */
diff --git a/Zend/zend_ts_hash.h b/Zend/zend_ts_hash.h
deleted file mode 100644
index e4c078084a..0000000000
--- a/Zend/zend_ts_hash.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Harald Radi <harald.radi@nme.at> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef ZEND_TS_HASH_H
-#define ZEND_TS_HASH_H
-
-#ifdef ZTS
-
-#include "zend.h"
-
-typedef struct _zend_ts_hashtable {
- HashTable hash;
- zend_uint reader;
- MUTEX_T mx_reader;
- MUTEX_T mx_writer;
-} TsHashTable;
-
-BEGIN_EXTERN_C()
-
-#define TS_HASH(table) (&(table->hash))
-
-/* startup/shutdown */
-ZEND_API int zend_ts_hash_init(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent);
-ZEND_API int zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection);
-ZEND_API void zend_ts_hash_destroy(TsHashTable *ht);
-ZEND_API void zend_ts_hash_clean(TsHashTable *ht);
-
-/* additions/updates/changes */
-ZEND_API int zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag);
-#define zend_ts_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
- zend_ts_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE)
-#define zend_ts_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
- zend_ts_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD)
-
-ZEND_API int zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag);
-#define zend_ts_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
- zend_ts_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE)
-#define zend_ts_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
- zend_ts_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_ADD)
-
-ZEND_API int zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag);
-#define zend_ts_hash_index_update(ht, h, pData, nDataSize, pDest) \
- zend_ts_hash_index_update_or_next_insert(ht, h, pData, nDataSize, pDest, HASH_UPDATE)
-#define zend_ts_hash_next_index_insert(ht, pData, nDataSize, pDest) \
- zend_ts_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT)
-
-ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint nKeyLength);
-
-ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht);
-ZEND_API void zend_ts_hash_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC);
-ZEND_API void zend_ts_hash_apply_with_argument(TsHashTable *ht, apply_func_arg_t apply_func, void * TSRMLS_DC);
-ZEND_API void zend_ts_hash_apply_with_arguments(TsHashTable *ht, apply_func_args_t apply_func, int, ...);
-
-ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC);
-
-
-/* Deletes */
-ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag);
-#define zend_ts_hash_del(ht, arKey, nKeyLength) \
- zend_ts_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY)
-#define zend_ts_hash_index_del(ht, h) \
- zend_ts_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX)
-
-ZEND_API ulong zend_ts_get_hash_value(TsHashTable *ht, char *arKey, uint nKeyLength);
-
-/* Data retreival */
-ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData);
-ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData);
-ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, ulong h, void **pData);
-
-/* Misc */
-ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, uint nKeyLength);
-ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, ulong h);
-
-/* Copying, merging and sorting */
-ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size);
-ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite);
-ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, uint size, zend_bool (*pReplaceOrig)(void *orig, void *p_new));
-ZEND_API int zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC);
-ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC);
-ZEND_API int zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC);
-
-ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht);
-
-ZEND_API int zend_ts_hash_rehash(TsHashTable *ht);
-
-ZEND_API ulong zend_ts_hash_func(char *arKey, uint nKeyLength);
-
-#if ZEND_DEBUG
-/* debug */
-void zend_ts_hash_display_pListTail(TsHashTable *ht);
-void zend_ts_hash_display(TsHashTable *ht);
-#endif
-
-END_EXTERN_C()
-
-#define ZEND_TS_INIT_SYMTABLE(ht) \
- ZEND_TS_INIT_SYMTABLE_EX(ht, 2, 0)
-
-#define ZEND_TS_INIT_SYMTABLE_EX(ht, n, persistent) \
- zend_ts_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent)
-
-
-#endif /* ZTS */
-
-#endif /* ZEND_HASH_H */
diff --git a/Zend/zend_types.h b/Zend/zend_types.h
deleted file mode 100644
index cad5b43a0f..0000000000
--- a/Zend/zend_types.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef ZEND_TYPES_H
-#define ZEND_TYPES_H
-
-typedef unsigned char zend_bool;
-typedef unsigned char zend_uchar;
-typedef unsigned int zend_uint;
-typedef unsigned long zend_ulong;
-typedef unsigned short zend_ushort;
-
-#endif /* ZEND_TYPES_H */
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
deleted file mode 100644
index b9eafec78f..0000000000
--- a/Zend/zend_variables.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include <stdio.h>
-#include "zend.h"
-#include "zend_API.h"
-#include "zend_globals.h"
-#include "zend_constants.h"
-#include "zend_list.h"
-
-ZEND_API char *empty_string = ""; /* in order to save emalloc() and efree() time for
- * empty strings (usually used to denote empty
- * return values in failed functions).
- * The macro STR_FREE() will not efree() it.
- */
-
-
-ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC)
-{
- if (zvalue->type==IS_LONG) {
- return;
- }
- switch(zvalue->type & ~IS_CONSTANT_INDEX) {
- case IS_STRING:
- case IS_CONSTANT:
- CHECK_ZVAL_STRING_REL(zvalue);
- STR_FREE_REL(zvalue->value.str.val);
- break;
- case IS_ARRAY:
- case IS_CONSTANT_ARRAY: {
- TSRMLS_FETCH();
-
- if (zvalue->value.ht && (zvalue->value.ht != &EG(symbol_table))) {
- zend_hash_destroy(zvalue->value.ht);
- FREE_HASHTABLE(zvalue->value.ht);
- }
- }
- break;
- case IS_OBJECT:
- {
- TSRMLS_FETCH();
-
- Z_OBJ_HT_P(zvalue)->del_ref(zvalue TSRMLS_CC);
- }
- break;
- case IS_RESOURCE:
- {
- TSRMLS_FETCH();
-
- /* destroy resource */
- zend_list_delete(zvalue->value.lval);
- }
- break;
- case IS_LONG:
- case IS_DOUBLE:
- case IS_BOOL:
- case IS_NULL:
- default:
- return;
- break;
- }
-}
-
-
-ZEND_API void zval_add_ref(zval **p)
-{
- (*p)->refcount++;
-}
-
-
-ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
-{
- switch (zvalue->type) {
- case IS_RESOURCE: {
- TSRMLS_FETCH();
-
- zend_list_addref(zvalue->value.lval);
- }
- break;
- case IS_BOOL:
- case IS_LONG:
- case IS_NULL:
- break;
- case IS_CONSTANT:
- case IS_STRING:
- if (zvalue->value.str.val) {
- if (zvalue->value.str.len==0) {
- zvalue->value.str.val = empty_string;
- return SUCCESS;
- }
- }
- CHECK_ZVAL_STRING_REL(zvalue);
- zvalue->value.str.val = (char *) estrndup_rel(zvalue->value.str.val, zvalue->value.str.len);
- break;
- case IS_ARRAY:
- case IS_CONSTANT_ARRAY: {
- zval *tmp;
- HashTable *original_ht = zvalue->value.ht;
- TSRMLS_FETCH();
-
- if (zvalue->value.ht == &EG(symbol_table)) {
- return SUCCESS; /* do nothing */
- }
- ALLOC_HASHTABLE_REL(zvalue->value.ht);
- zend_hash_init(zvalue->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(zvalue->value.ht, original_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
- }
- break;
- case IS_OBJECT:
- {
- TSRMLS_FETCH();
-#if 0
- zvalue->value.obj = zvalue->value.obj.handlers->clone_obj(zvalue->value.obj.handle);
-#else
- Z_OBJ_HT_P(zvalue)->add_ref(zvalue TSRMLS_CC);
-#endif
- }
- break;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int zend_print_variable(zval *var)
-{
- return zend_print_zval(var, 0);
-}
-
-
-#if ZEND_DEBUG
-ZEND_API int _zval_copy_ctor_wrapper(zval *zvalue)
-{
- return zval_copy_ctor(zvalue);
-}
-
-
-ZEND_API void _zval_dtor_wrapper(zval *zvalue)
-{
- zval_dtor(zvalue);
-}
-
-
-
-ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr)
-{
- zval_ptr_dtor(zval_ptr);
-}
-#endif
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h
deleted file mode 100644
index 0dd56b7d8b..0000000000
--- a/Zend/zend_variables.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef ZEND_VARIABLES_H
-#define ZEND_VARIABLES_H
-
-
-ZEND_API int zend_print_variable(zval *var);
-
-BEGIN_EXTERN_C()
-ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC);
-ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC);
-ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC);
-#define zval_copy_ctor(zvalue) _zval_copy_ctor((zvalue) ZEND_FILE_LINE_CC)
-#define zval_dtor(zvalue) _zval_dtor((zvalue) ZEND_FILE_LINE_CC)
-#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
-
-#if ZEND_DEBUG
-ZEND_API int _zval_copy_ctor_wrapper(zval *zvalue);
-ZEND_API void _zval_dtor_wrapper(zval *zvalue);
-ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr);
-#define zval_copy_ctor_wrapper _zval_copy_ctor_wrapper
-#define zval_dtor_wrapper _zval_dtor_wrapper
-#define zval_ptr_dtor_wrapper _zval_ptr_dtor_wrapper
-#else
-#define zval_copy_ctor_wrapper _zval_copy_ctor
-#define zval_dtor_wrapper _zval_dtor
-#define zval_ptr_dtor_wrapper _zval_ptr_dtor
-#endif
-
-END_EXTERN_C()
-
-
-ZEND_API void zval_add_ref(zval **p);
-
-#define ZVAL_DESTRUCTOR (void (*)(void *)) zval_dtor_wrapper
-#define ZVAL_PTR_DTOR (void (*)(void *)) zval_ptr_dtor_wrapper
-#define ZVAL_COPY_CTOR (void (*)(void *)) zval_copy_ctor_wrapper
-
-#endif
diff --git a/configure.in b/configure.in
index 7d0a8c994f..59746c3db7 100644
--- a/configure.in
+++ b/configure.in
@@ -40,7 +40,7 @@ AC_CONFIG_HEADER(main/php_config.h)
MAJOR_VERSION=4
MINOR_VERSION=3
RELEASE_VERSION=0
-EXTRA_VERSION="-dev"
+EXTRA_VERSION="-pre1"
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
dnl Define where extension directories are located in the configure context
diff --git a/ext/imap/imap.h b/ext/imap/imap.h
deleted file mode 100644
index 914d128316..0000000000
--- a/ext/imap/imap.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef _INCLUDED_IMAP_H
-#define _INCLUDED_IMAP_H
-
-#if COMPILE_DL
-#undef HAVE_IMAP
-#define HAVE_IMAP 1
-#endif
-
-#if HAVE_IMAP
-
-#ifndef PHP_WIN32
-#include "build-defs.h"
-#endif
-
-/* Functions accessable to PHP */
-extern zend_module_entry imap_module_entry;
-#define imap_module_ptr &imap_module_entry
-
-extern PHP_MINIT_FUNCTION(imap);
-extern PHP_RINIT_FUNCTION(imap);
-extern PHP_RSHUTDOWN_FUNCTION(imap);
-PHP_MINFO_FUNCTION(imap);
-PHP_FUNCTION(imap_open);
-PHP_FUNCTION(imap_popen);
-PHP_FUNCTION(imap_reopen);
-PHP_FUNCTION(imap_num_msg);
-PHP_FUNCTION(imap_num_recent);
-PHP_FUNCTION(imap_headers);
-PHP_FUNCTION(imap_headerinfo);
-PHP_FUNCTION(imap_rfc822_parse_headers);
-PHP_FUNCTION(imap_body);
-PHP_FUNCTION(imap_fetchstructure);
-PHP_FUNCTION(imap_fetchbody);
-PHP_FUNCTION(imap_expunge);
-PHP_FUNCTION(imap_delete);
-PHP_FUNCTION(imap_undelete);
-PHP_FUNCTION(imap_check);
-PHP_FUNCTION(imap_close);
-PHP_FUNCTION(imap_mail_copy);
-PHP_FUNCTION(imap_mail_move);
-PHP_FUNCTION(imap_createmailbox);
-PHP_FUNCTION(imap_renamemailbox);
-PHP_FUNCTION(imap_deletemailbox);
-PHP_FUNCTION(imap_listmailbox);
-PHP_FUNCTION(imap_scanmailbox);
-PHP_FUNCTION(imap_subscribe);
-PHP_FUNCTION(imap_unsubscribe);
-PHP_FUNCTION(imap_append);
-PHP_FUNCTION(imap_ping);
-PHP_FUNCTION(imap_base64);
-PHP_FUNCTION(imap_qprint);
-PHP_FUNCTION(imap_8bit);
-PHP_FUNCTION(imap_binary);
-PHP_FUNCTION(imap_mailboxmsginfo);
-PHP_FUNCTION(imap_rfc822_write_address);
-PHP_FUNCTION(imap_rfc822_parse_adrlist);
-PHP_FUNCTION(imap_setflag_full);
-PHP_FUNCTION(imap_clearflag_full);
-PHP_FUNCTION(imap_sort);
-PHP_FUNCTION(imap_fetchheader);
-PHP_FUNCTION(imap_fetchtext);
-PHP_FUNCTION(imap_uid);
-PHP_FUNCTION(imap_msgno);
-PHP_FUNCTION(imap_list);
-PHP_FUNCTION(imap_list_full);
-PHP_FUNCTION(imap_listscan);
-PHP_FUNCTION(imap_lsub);
-PHP_FUNCTION(imap_lsub_full);
-PHP_FUNCTION(imap_create);
-PHP_FUNCTION(imap_rename);
-PHP_FUNCTION(imap_status);
-PHP_FUNCTION(imap_bodystruct);
-PHP_FUNCTION(imap_fetch_overview);
-PHP_FUNCTION(imap_mail_compose);
-PHP_FUNCTION(imap_alerts);
-PHP_FUNCTION(imap_errors);
-PHP_FUNCTION(imap_last_error);
-PHP_FUNCTION(imap_mail);
-PHP_FUNCTION(imap_search);
-PHP_FUNCTION(imap_utf8);
-PHP_FUNCTION(imap_utf7_decode);
-PHP_FUNCTION(imap_utf7_encode);
-PHP_FUNCTION(imap_mime_header_decode);
-#else
-#define imap_module_ptr NULL
-#endif /* HAVE_IMAP */
-
-#endif
-
-
-
-
-
-
-#define phpext_imap_ptr imap_module_ptr
-
-
-
-
-
-
-
-
diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4
deleted file mode 100644
index 2563494468..0000000000
--- a/ext/pcre/config0.m4
+++ /dev/null
@@ -1,57 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-dnl By default we'll compile and link against the bundled PCRE library
-dnl if DIR is supplied, we'll use that for linking
-
-PHP_ARG_WITH(pcre-regex,for PCRE support,
-[ --without-pcre-regex Do not include Perl Compatible Regular Expressions
- support. Use --with-pcre-regex=DIR to specify DIR
- where PCRE's include and library files are located,
- if not using bundled library.],yes)
-
-if test "$PHP_PCRE_REGEX" != "no"; then
- if test "$PHP_PCRE_REGEX" = "yes"; then
- PHP_NEW_EXTENSION(pcre, pcrelib/maketables.c pcrelib/get.c pcrelib/study.c pcrelib/pcre.c php_pcre.c, $ext_shared,,-DSUPPORT_UTF8 -I@ext_srcdir@/pcrelib)
- PHP_ADD_BUILD_DIR($ext_builddir/pcrelib)
- AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
- else
- test -f $PHP_PCRE_REGEX/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX
- test -f $PHP_PCRE_REGEX/include/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX/include
- test -f $PHP_PCRE_REGEX/include/pcre/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX/include/pcre
-
- if test -z "$PCRE_INCDIR"; then
- AC_MSG_RESULT(Could not find pcre.h in $PHP_PCRE_REGEX)
- fi
-
- changequote({,})
- pcre_major=`grep PCRE_MAJOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
- pcre_minor=`grep PCRE_MINOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
- changequote([,])
- pcre_minor_length=`echo "$pcre_minor" | wc -c | sed -e 's/[^0-9]//g'`
- if test "$pcre_minor_length" -eq 2 ; then
- pcre_minor="$pcre_minor"0
- fi
- pcre_version=$pcre_major$pcre_minor
- if test "$pcre_version" -lt 208; then
- AC_MSG_ERROR(The PCRE extension requires PCRE library version >= 2.08)
- fi
-
- test -f $PHP_PCRE_REGEX/libpcre.a && PCRE_LIBDIR=$PHP_PCRE_REGEX
- test -f $PHP_PCRE_REGEX/lib/libpcre.a && PCRE_LIBDIR=$PHP_PCRE_REGEX/lib
-
- if test -z "$PCRE_LIBDIR" ; then
- AC_MSG_ERROR(Could not find libpcre.a in $PHP_PCRE_REGEX)
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR, PCRE_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_PCRE, 1, [ ])
- PHP_ADD_INCLUDE($PCRE_INCDIR)
- PHP_NEW_EXTENSION(pcre, php_pcre.c, $ext_shared,,-DSUPPORT_UTF8)
- fi
-fi
-PHP_SUBST(PCRE_SHARED_LIBADD)
-
-AC_CHECK_FUNC(memmove, [], [AC_DEFINE(USE_BCOPY, 1, [ ])])
diff --git a/ext/soap/EXPERIMENTAL b/ext/soap/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/soap/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/soap/Makefile b/ext/soap/Makefile
deleted file mode 100644
index 1107a700bd..0000000000
--- a/ext/soap/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-top_srcdir = /usr/local/src/php-4.2.0
-top_builddir = /usr/local/src/php-4.2.0
-srcdir = /usr/local/src/php-4.2.0/ext/soap
-builddir = /usr/local/src/php-4.2.0/ext/soap
-VPATH = /usr/local/src/php-4.2.0/ext/soap
-# $Id$
-
-LTLIBRARY_NAME = libsoap.la
-LTLIBRARY_SOURCES = soap.c php_sdl.c php_schema.c php_xml.c php_encoding.c php_http.c php_packet_soap.c
-LTLIBRARY_SHARED_NAME = soap.la
-LTLIBRARY_SHARED_LIBADD = $(SOAP_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/soap/Makefile.in b/ext/soap/Makefile.in
deleted file mode 100644
index eb52167d2d..0000000000
--- a/ext/soap/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libsoap.la
-LTLIBRARY_SOURCES = soap.c php_sdl.c php_schema.c php_xml.c php_encoding.c php_http.c php_packet_soap.c
-LTLIBRARY_SHARED_NAME = soap.la
-LTLIBRARY_SHARED_LIBADD = $(SOAP_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/soap/TODO b/ext/soap/TODO
deleted file mode 100644
index b70760add7..0000000000
--- a/ext/soap/TODO
+++ /dev/null
@@ -1,36 +0,0 @@
-TODO:
-make sure soap 1.1 and 1.2 is supported fully
-Better WSDL support Client and server (how much validation is needed here?)
-UDDI??
-make internal refrences for soap encoding (use seralization logic)
-add ini option for always soap_error_handler
-provide user space overriding of serialization certin objects and types
-serialization in general needs to be polished/finished... all xsd types
-make perstistant objects and work with or without register_globals on
-look to see if php-soap will work with out always_populate_raw_post_data on
-see if client will work with ssl.. should be eaiser with php_streams
-work on soap seralizer (php serialization)
-work on a soap-service 'regiestry' and 'proxy' (apache soap style)
-convert all string mainpulation to use smart_str
-make the 'soap' packet abstract.. maybe incorperate xml-rpc
-make the transport layer abstract.. what other transport layers are needed?... who uses smtp? what about jabber?
-make $soap_object->data = 'text'; maybe invoke a set_*() and/or get_*() method
-when using wsdls and function names are similar find the best match
- void test(int);
- void test(string);
- maybe use the same alogrithim as ext/java.
-investigate further http keep_alive... inital testing proved slower.. maybe php_streams will speed things up..
-provide schema 1999/2001 support....
-through memory leak testing
-possible using shared memory for sdl caching...
-api for clearing/checking sdl caching...
-make php-soap work as a standalone server using php_streams and the new socket extension
-http authication
-proxy support
-wsdl generation static and auto (.net style (http://server.com/soapserver.php?WSDL)) using phpdoc parsing engine
-interpo testing...
-BENCHMARKING...... lets prove how fast it is.
-do some more work on website
-
-does this list stop... what exactly have i done?
-im sure im forgetting 20 thousand more things....
diff --git a/ext/soap/config.m4 b/ext/soap/config.m4
deleted file mode 100644
index 44c12cb037..0000000000
--- a/ext/soap/config.m4
+++ /dev/null
@@ -1,16 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension soap
-
-dnl Comments in this file start with the string 'dnl'.
-dnl Remove where necessary. This file will not work
-dnl without editing.
-
-PHP_ARG_ENABLE(soap, whether to enable soap support,
-Make sure that the comment is aligned:
-[ --enable-soap Enable soap support])
-
-if test "$PHP_SOAP" != "no"; then
- PHP_ADD_INCLUDE(/usr/local/include/libxml2)
- PHP_ADD_LIBRARY_WITH_PATH(xml2,/usr/local/lib,SOAP_SHARED_LIBADD)
- PHP_EXTENSION(soap, $ext_shared)
-fi
diff --git a/ext/soap/interop/base.php b/ext/soap/interop/base.php
deleted file mode 100644
index 435d9aa6f0..0000000000
--- a/ext/soap/interop/base.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-class Interop_Base
-{
-}
-
-?> \ No newline at end of file
diff --git a/ext/soap/interop/client_round2.php b/ext/soap/interop/client_round2.php
deleted file mode 100644
index 5583bb6c17..0000000000
--- a/ext/soap/interop/client_round2.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
- <title>Round 2 Interop Client Tests</title>
-</head>
-
-<body>
-<a href="index.php">Back to Interop Index</a><br>
-<p>&nbsp;</p>
-<?php
-require_once 'SOAP/interop/client_round2_interop.php';
-
-$iop = new Interop_Client();
-
-function endpointList($test,$sel_endpoint)
-{
- global $iop;
- $iop->getEndpoints($test);
- echo "<select name='endpoint'>\n";
- foreach ($iop->endpoints as $epname => $epinfo) {
- $selected = '';
- if ($sel_endpoint == $epname) $selected = ' SELECTED';
- echo "<option value='$epname'$selected>$epname</option>\n";
- }
- echo "</select>\n";
-}
-function methodList($test,$sel_method)
-{
- global $iop;
-
- $ml = $iop->getMethodList($test);
- echo "<select name='method'>\n";
- foreach ($ml as $method) {
- $selected = '';
- if ($sel_method == $method) $selected = ' SELECTED';
- echo "<option value='$method'$selected>$method</option>\n";
- }
- echo "<option value='ALL'>Run All Methods</option>\n";
- echo "</select>\n";
-}
-
-function endpointTestForm($test, $endpoint, $method, $paramType, $useWSDL)
-{
- global $PHP_SELF;
- if (!$test) $test = 'base';
- echo "Round 2 '$test' Selected<br>\n";
- echo "Select endpoint and method to run:<br>\n";
- echo "<form action='$PHP_SELF' method='post'>\n";
- echo "<input type='hidden' name='test' value='$test'>\n";
- endpointList($test, $endpoint);
- methodList($test, $method);
- echo "<select name='paramType'><option value='soapval'>soap value</option>";
- echo "<option value='php'".($paramType=='php'?' selected':'').">php internal type</option></select>\n";
- echo "<select name='useWSDL'><option value='0'>go Direct</option><option value='1'".($useWSDL?' selected':'').">use WSDL</option></select>\n";
- echo "<input type='submit' value='Go'>\n";
- echo "</form><br>\n";
-}
-
-function testSelectForm($selected_test = NULL)
-{
- global $iop, $PHP_SELF;
- echo "Select a Round 2 test case to run:<br>\n";
- echo "<form action='$PHP_SELF' method='post'>\n";
- echo "<select name='test'>\n";
- foreach ($iop->tests as $test) {
- $selected = '';
- if ($selected_test == $test) $selected = ' SELECTED';
- echo "<option value='$test'$selected>$test</option>\n";
- }
- echo "</select>\n";
- echo "<input type='submit' value='Go'>\n";
- echo "</form><br>\n";
-}
-
-testSelectForm($_POST['test']);
-endpointTestForm($_POST['test'],$_POST['endpoint'],$_POST['method'],$_POST['paramType'],$_POST['useWSDL']);
-
-if ($_POST['test'] && array_key_exists('endpoint', $_POST) && array_key_exists('method', $_POST)) {
- // here we execute the orders
- echo "<h2>Calling {$_POST['method']} at {$_POST['endpoint']}</h2>\n";
- echo "NOTE: wire's are slightly modified to display better in web browsers.<br>\n";
-
- $iop->currentTest = $_POST['test']; // see $tests above
- $iop->paramType = $_POST['paramType']; // 'php' or 'soapval'
- $iop->useWSDL = $_POST['useWSDL']; // 1= do wsdl tests
- $iop->numServers = 0; // 0 = all
- $iop->specificEndpoint = $_POST['endpoint']; // test only this endpoint
- $iop->testMethod = $_POST['method']=='ALL'?'':$_POST['method']; // test only this method
- $iop->skipEndpointList = array(); // endpoints to skip
- $this->nosave = 0; // 1= disable saving results to database
- // debug output
- $iop->show = 1;
- $iop->debug = 1;
- $iop->showFaults = 0; // used in result table output
- echo '<pre>';
- $iop->doTest(); // run a single set of tests using above options
- echo '</pre>';
-}
-?>
-</body>
-</html>
diff --git a/ext/soap/interop/client_round2_interop.php b/ext/soap/interop/client_round2_interop.php
deleted file mode 100644
index 1e77ed92c8..0000000000
--- a/ext/soap/interop/client_round2_interop.php
+++ /dev/null
@@ -1,796 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-require_once 'DB.php'; // PEAR/DB
-require_once 'base.php';
-require_once 'client_round2_params.php';
-require_once 'test.utility.php';
-
-error_reporting(E_ALL ^ E_NOTICE);
-
-class Interop_Client extends Interop_Base
-{
- // database DNS
- var $DSN = 'mysql://user@localhost/interop2';
-
- // our central interop server, where we can get the list of endpoints
- var $interopServer = "http://www.whitemesa.net/interopInfo";
-
- // our local endpoint, will always get added to the database for all tests
- var $localEndpoint;
-
- // specify testing
- var $currentTest = 'base'; // see $tests above
- var $paramType = 'php'; // 'php' or 'soapval'
- var $useWSDL = 0; // 1= do wsdl tests
- var $numServers = 0; // 0 = all
- var $specificEndpoint = ''; // test only this endpoint
- var $testMethod = ''; // test only this method
- var $skipEndpointList = array(); // endpoints to skip
- var $nosave = 0;
- var $startAt = ''; // start in list at this endpoint
- // debug output
- var $show = 1;
- var $debug = 0;
- var $showFaults = 0; // used in result table output
-
- // PRIVATE VARIABLES
- var $dbc = NULL;
- var $totals = array();
- var $tests = array('base','GroupB', 'GroupC');
- var $paramTypes = array('php', 'soapval');
- var $endpoints = array();
-
- function Interop_Client() {
- // set up the database connection
- $this->dbc = DB::connect($this->DSN, true);
- // if it errors out, just ignore it and rely on regular methods
- if (DB::isError($this->dbc)) {
- echo $this->dbc->getMessage();
- $this->dbc = NULL;
- }
- // set up local endpoint
- $this->localEndpoint['base'] = array(
- 'endpointName'=>'PEAR SOAP',
- 'endpointURL'=>'http://localhost/soap_interop/server_round2.php',
- 'wsdlURL'=>'http://localhost/soap_interop/interop.wsdl'
- );
- $this->localEndpoint['GroupB'] = array(
- 'endpointName'=>'PEAR SOAP',
- 'endpointURL'=>'http://localhost/soap_interop/server_round2.php',
- 'wsdlURL'=>'http://localhost/soap_interop/interopB.wsdl'
- );
- $this->localEndpoint['GroupC'] = array(
- 'endpointName'=>'PEAR SOAP',
- 'endpointURL'=>'http://localhost/soap_interop/server_round2.php',
- 'wsdlURL'=>'http://localhost/soap_interop/echoheadersvc.wsdl'
- );
- }
-
- function _fetchEndpoints(&$soapclient, $test) {
- $this->_getEndpoints($test, 1);
-
- // retreive endpoints from the endpoint server
- $endpointArray = $soapclient->call("GetEndpointInfo",array("groupName"=>$test),"http://soapinterop.org/info/","http://soapinterop.org/info/");
- if (PEAR::isError($endpointArray)) {
- print $soapclient->wire;
- print_r($endpointArray);
- return;
- }
-
- // add our local endpoint
- if ($this->localEndpoint[$test]) {
- array_push($endpointArray, $this->localEndpoint[$test]);
- }
-
- if (!$endpointArray) return;
-
- // reset the status to zero
- $res = $this->dbc->query("update endpoints set status = 0 where class='$test'");
- if (DB::isError($res)) {
- die ($res->getMessage());
- }
- if (is_object($res)) $res->free();
- // save new endpoints into database
- foreach($endpointArray as $k => $v){
- if (array_key_exists($v['endpointName'],$this->endpoints)) {
- $res = $this->dbc->query("update endpoints set endpointURL='{$v['endpointURL']}', wsdlURL='{$v['wsdlURL']}', status=1 where id={$this->endpoints[$v['endpointName']]['id']}");
- } else {
- $res = $this->dbc->query("insert into endpoints (endpointName,endpointURL,wsdlURL,class) values('{$v['endpointName']}','{$v['endpointURL']}','{$v['wsdlURL']}','$test')");
- }
- if (DB::isError($res)) {
- die ($res->getMessage());
- }
- if (is_object($res)) $res->free();
- }
- }
-
- /**
- * fetchEndpoints
- * retreive endpoints interop server
- *
- * @return boolean result
- * @access private
- */
- function fetchEndpoints($test = NULL) {
- // fetch from the interop server
- $soapclient = new SoapObject($this->interopServer);
-
- if ($test) {
- $this->_fetchEndpoints($soapclient, $test);
- } else {
- foreach ($this->tests as $test) {
- $this->_fetchEndpoints($soapclient, $test);
- }
- $test = 'base';
- }
-
- // retreive all endpoints now
- $this->currentTest = $test;
- return $this->_getEndpoints($test);
- }
-
- /**
- * getEndpoints
- * retreive endpoints from either database or interop server
- *
- * @param string base (see local var $tests)
- * @param boolean all (if false, only get valid endpoints, status=1)
- * @return boolean result
- * @access private
- */
- function getEndpoints($base = 'base', $all = 0) {
- if (!$this->_getEndpoints($base, $all)) {
- return $this->fetchEndpoints($base);
- }
- return TRUE;
- }
-
- /**
- * _getEndpoints
- * retreive endpoints from database
- *
- * @param string base (see local var $tests)
- * @param boolean all (if false, only get valid endpoints, status=1)
- * @return boolean result
- * @access private
- */
- function _getEndpoints($base = "", $all = 0) {
- $this->endpoints = array();
-
- // build sql
- $sql = "select * from endpoints ";
- if ($base) {
- $sql .= "where class='$base' ";
- if (!$all) $sql .= "and status=1";
- } else
- if (!$all) $sql .= "where status=1";
-
- $db_ep = $this->dbc->getAll($sql,NULL, DB_FETCHMODE_ASSOC );
- if (DB::isError($db_ep)) {
- echo $sql."\n";
- echo $db_ep->getMessage();
- return FALSE;
- }
- // rearange the array
- foreach ($db_ep as $entry) {
- $this->endpoints[$entry['endpointName']] = $entry;
- }
- if (count($this->endpoints) > 0) {
- $this->currentTest = $base;
- return TRUE;
- }
- return FALSE;
- }
-
- /**
- * getResults
- * retreive results from the database, stuff them into the endpoint array
- *
- * @access private
- */
- function getResults($test = 'base', $type = 'php', $wsdl = 0) {
- // be sure we have the right endpoints for this test result
- $this->getEndpoints($test);
-
- // retreive the results and put them into the endpoint info
- $sql = "select * from results where class='$test' and type='$type' and wsdl=$wsdl";
- $results = $this->dbc->getAll($sql,NULL, DB_FETCHMODE_ASSOC );
- foreach ($results as $result) {
- // find the endpoint
- foreach ($this->endpoints as $epn => $epi) {
- if ($epi['id'] == $result['endpoint']) {
- // store the info
- $this->endpoints[$epn]['methods'][$result['function']] = $result;
- break;
- }
- }
- }
- }
-
- /**
- * saveResults
- * save the results of a method test into the database
- *
- * @access private
- */
- function _saveResults($endpoint_id, &$soap_test) {
- if ($this->nosave) return;
-
- $result = $soap_test->result;
- $wire = $result['wire'];
- if ($result['success']) {
- $success = 'OK';
- $error = '';
- } else {
- $success = $result['fault']->faultcode;
- $error = $result['fault']->faultstring;
- if (!$wire) $wire= $result['fault']->detail;
- }
-
- $test_name = $soap_test->test_name;
- // add header info to the test name
- if ($soap_test->headers) {
- foreach ($soap_test->headers as $h) {
- $destination = 0;
- if (get_class($h) == 'soap_header') {
- if ($h->attributes['SOAP-ENV:actor'] == 'http://schemas.xmlsoap.org/soap/actor/next') $destination = 1;
- $test_name .= ":{$h->name},$destination,{$h->attributes['SOAP-ENV:mustUnderstand']}";
- } else {
- if (!$h[3] || $h[3] == 'http://schemas.xmlsoap.org/soap/actor/next') $destination = 1;
- if (!$h[2]) $h[2] = 0;
- $qn = new QName($h[0]);
- $test_name .= ":{$qn->name},$destination,".(int)$h[2];
- }
- }
- }
-
- $sql = "delete from results where endpoint=$endpoint_id ".
- "and class='$this->currentTest' and type='$this->paramType' ".
- "and wsdl=$this->useWSDL and function=".
- $this->dbc->quote($test_name);
- #echo "\n".$sql;
- $res = $this->dbc->query($sql);
- if (DB::isError($res)) {
- die ($res->getMessage());
- }
- if (is_object($res)) $res->free();
-
- $sql = "insert into results (endpoint,stamp,class,type,wsdl,function,result,error,wire) ".
- "values($endpoint_id,".time().",'$this->currentTest',".
- "'$this->paramType',$this->useWSDL,".
- $this->dbc->quote($test_name).",".
- $this->dbc->quote($success).",".
- $this->dbc->quote($error).",".
- ($wire?$this->dbc->quote($wire):"''").")";
- #echo "\n".$sql;
- $res = $this->dbc->query($sql);
-
- if (DB::isError($res)) {
- die ($res->getMessage());
- }
- if (is_object($res)) $res->free();
- }
-
- /**
- * decodeSoapval
- * decodes a soap value to php type, used for test result comparisions
- *
- * @param SOAP_Value soapval
- * @return mixed result
- * @access public
- */
- function decodeSoapval($soapval)
- {
- if (gettype($soapval) == "object" &&
- (strcasecmp(get_class($soapval),"soapparam") == 0 ||
- strcasecmp(get_class($soapval),"soapvar") == 0)) {
- if (strcasecmp(get_class($soapval),"soapparam") == 0)
- $val = $soapval->param_data->enc_value;
- else
- $val = $soapval->enc_value;
- } else {
- $val = $soapval;
- }
- if (is_array($val)) {
- foreach($val as $k => $v) {
- if (gettype($v) == "object" &&
- (strcasecmp(get_class($soapval),"soapparam") == 0 ||
- strcasecmp(get_class($soapval),"soapvar") == 0)) {
- $val[$k] = $this->decodeSoapval($v);
- }
- }
- }
- return $val;
- }
-
- /**
- * compareResult
- * compare two php types for a match
- *
- * @param string expect
- * @param string test_result
- * @return boolean result
- * @access public
- */
- function compareResult($expect, $result, $type = NULL)
- {
- $ok = 0;
- $expect_type = gettype($expect);
- $result_type = gettype($result);
- if ($expect_type == "array" && $result_type == "array") {
- # compare arrays
- $ok = array_compare($expect, $result);
- } else {
- if ($type == 'boolean')
- $ok = boolean_compare($expect, $result);
- else
- $ok = string_compare($expect, $result);
- }
- return $ok;
- }
-
-
- /**
- * doEndpointMethod
- * run a method on an endpoint and store it's results to the database
- *
- * @param array endpoint_info
- * @param SOAP_Test test
- * @return boolean result
- * @access public
- */
- function doEndpointMethod(&$endpoint_info, &$soap_test) {
- $ok = FALSE;
-
- // prepare a holder for the test results
- $soap_test->result['class'] = $this->currentTest;
- $soap_test->result['type'] = $this->paramType;
- $soap_test->result['wsdl'] = $this->useWSDL;
-
- if ($this->useWSDL) {
- if (array_key_exists('wsdlURL',$endpoint_info)) {
- if (!array_key_exists('client',$endpoint_info)) {
- $endpoint_info['client'] = new SoapObject($endpoint_info['wsdlURL']);
- }
- $soap =& $endpoint_info['client'];
-
- # XXX how do we determine a failure on retreiving/parsing wsdl?
- if ($soap->wsdl->fault) {
- $fault = $soap->wsdl->fault->getFault();
- $soap_test->setResult(0,'WSDL',
- $fault->faultstring."\n\n".$fault->detail,
- $fault->faultstring,
- $fault
- );
- return FALSE;
- }
- } else {
- $fault = new SoapFault('WSDL',"no WSDL defined for $endpoint");
- $soap_test->setResult(0,'WSDL',
- $fault->faultstring,
- $fault->faultstring,
- $fault
- );
- return FALSE;
- }
- $namespace = false;
- $soapaction = false;
- } else {
- $namespace = $soapaction = 'http://soapinterop.org/';
- // hack to make tests work with MS SoapToolkit
- // it's the only one that uses this soapaction, and breaks if
- // it isn't right. Can't wait for soapaction to be fully depricated
- if ($this->currentTest == 'base' &&
- strstr($endpoint_info['endpointName'],'MS SOAP ToolKit 2.0')) {
- $soapaction = 'urn:soapinterop';
- }
- if (!array_key_exists('client',$endpoint_info)) {
- $endpoint_info['client'] = new SoapObject($endpoint_info['endpointURL'],$soapaction);
- }
- $soap = $endpoint_info['client'];
- }
- // add headers to the test
- if ($soap_test->headers) {
- // $header is already a SOAP_Header class
- foreach ($soap_test->headers as $header) {
- $soap->addHeader($header);
- }
- }
- // XXX no way to set encoding
- // this lets us set UTF-8, US-ASCII or other
- //$soap->setEncoding($soap_test->encoding);
-
- if ($this->useWSDL) {
- $args = '';
- foreach ($soap_test->method_params as $pname => $param) {
- $arg = '$soap_test->method_params["'.$pname.'"]';
- $args .= $args?','.$arg:$arg;
- }
- $return = eval('return $soap->'.$soap_test->method_name.'('.$args.');');
- } else {
- $return = $soap->__call($soap_test->method_name,$soap_test->method_params,$soapaction, $namespace);
- }
-
- // save the wire
- $wire = $soap->__getlastrequest()."\n\n".$soap->__getlastresponse();
- $wire = str_replace('>',">\n",$wire);
- $wire = str_replace('" ',"\" \n",$wire);
- #print $wire;
-
- if(!$soap->__isfault()){
- if (is_array($soap_test->method_params) && count($soap_test->method_params) == 1) {
- $sent = array_shift($soap_test->method_params);
- } else {
- $sent = $soap_test->method_params;
- }
-
- // compare header results
- $header_result = array();
- $headers_ok = TRUE;
-
- # XXX need to implement header support!
- #
- #if ($soap_test->headers) {
- # // $header is already a SOAP_Header class
- # foreach ($soap_test->headers as $header) {
- # if (get_class($header) != 'soap_header') {
- # // assume it's an array
- # $header = new SOAP_Header($header[0], NULL, $header[1], $header[2], $header[3], $header[4]);
- # }
- # $expect = $soap_test->headers_expect[$header->name];
- # $header_result[$header->name] = array();
- # // XXX need to fix need_result to identify the actor correctly
- # $need_result = $hresult ||
- # ($header->attributes['SOAP-ENV:actor'] == 'http://schemas.xmlsoap.org/soap/actor/next'
- # && $header->attributes['SOAP-ENV:mustUnderstand']);
- # if ($expect) {
- # $hresult = $soap->headers[key($expect)];
- # $ok = !$need_result || $this->compareResult($hresult ,$expect[key($expect)]);
- # } else {
- # $hresult = $soap->headers[$header->name];
- # $expect = $this->decodeSoapval($header);
- # $ok = !$need_result || $this->compareResult($hresult ,$expect);
- # }
- # $header_result[$header->name]['ok'] = $ok;
- # if (!$ok) $headers_ok = FALSE;
- # }
- #}
-
- # we need to decode what we sent so we can compare!
- $sent_d = $this->decodeSoapval($sent);
-
- $soap_test->result['sent'] = $sent;
- $soap_test->result['return'] = $return;
- // compare the results with what we sent
- $ok = $this->compareResult($sent_d,$return, $sent->type);
- if (!$ok && $soap_test->expect) {
- $ok = $this->compareResult($soap_test->expect,$return);
- }
-
- if($ok){
- if (!$headers_ok) {
- $fault = new SoapFault('HEADER','The returned result did not match what we expected to receive');
- $soap_test->setResult(0,$fault->faultcode,
- $wire,
- $fault->faultstring,
- $fault
- );
- } else {
- $soap_test->setResult(1,'OK',$wire);
- $success = TRUE;
- }
- } else {
- $fault = new SoapFault('RESULT','The returned result did not match what we expected to receive');
- $soap_test->setResult(0,$fault->faultcode,
- $wire,
- $fault->faultstring,
- $fault
- );
- }
- } else {
- $fault = $soap->__getfault();
- if ($soap_test->expect_fault) {
- $ok = 1;
- $res = 'OK';
- } else {
- $ok = 0;
- $res =$fault->faultcode;
- }
- $soap_test->setResult($ok,$res, $wire,$fault->faultstring, $fault);
- }
- return $ok;
- }
-
-
- /**
- * doTest
- * run a single round of tests
- *
- * @access public
- */
- function doTest() {
- global $soap_tests;
- // get endpoints for this test
- $this->getEndpoints($this->currentTest);
- #clear totals
- $this->totals = array();
-
- $i = 0;
- foreach($this->endpoints as $endpoint => $endpoint_info){
-
- // if we specify an endpoint, skip until we find it
- if ($this->specificEndpoint && $endpoint != $this->specificEndpoint) continue;
- if ($this->useWSDL && !$endpoint_info['endpointURL']) continue;
-
- $skipendpoint = FALSE;
- $this->totals['servers']++;
- #$endpoint_info['tests'] = array();
-
- if ($this->show) print "Processing $endpoint at {$endpoint_info['endpointURL']}<br>\n";
-
- foreach($soap_tests[$this->currentTest] as $soap_test) {
- //foreach(array_keys($method_params[$this->currentTest][$this->paramType]) as $method)
-
- // only run the type of test we're looking for (php or soapval)
- if ($soap_test->type != $this->paramType) continue;
-
- // if we haven't reached our startpoint, skip
- if ($this->startAt && $this->startAt != $endpoint_info['endpointName']) continue;
- $this->startAt = '';
-
- // if this is in our skip list, skip it
- if (in_array($endpoint, $this->skipEndpointList)) {
- $skipendpoint = TRUE;
- $skipfault = new SoapFault('SKIP','endpoint skipped');
- $soap_test->setResult(0,$fault->faultcode, '',
- $skipfault->faultstring,
- $skipfault
- );
- #$endpoint_info['tests'][] = &$soap_test;
- #$soap_test->showTestResult($this->debug);
- #$this->_saveResults($endpoint_info['id'], $soap_test->method_name);
- $soap_test->result = NULL;
- continue;
- }
-
- // if we're looking for a specific method, skip unless we have it
- if ($this->testMethod && !strstr($this->testMethod,$soap_test->test_name)) continue;
- if ($this->testMethod && $this->currentTest == 'GroupC') {
- // we have to figure things out now
- if (!preg_match('/(.*):(.*),(\d),(\d)/',$this->testMethod, $m)) continue;
-
- // is the header in the headers list?
- $gotit = FALSE;
- foreach ($soap_test->headers as $header) {
- if (get_class($header) == 'soap_header') {
- if ($header->name == $m[2]) {
- $gotit = $header->attributes['SOAP-ENV:actor'] == ($m[3]?SOAP_TEST_ACTOR_NEXT:SOAP_TEST_ACTOR_OTHER);
- $gotit = $gotit && $header->attributes['SOAP-ENV:mustUnderstand'] == $m[4];
- }
- } else {
- if ($header[0] == $m[2]) {
- $gotit = $gotit && $header[3] == ($m[3]?SOAP_TEST_ACTOR_NEXT:SOAP_TEST_ACTOR_OTHER);
- $gotit = $gotit && $header[4] == $m[4];
- }
- }
- }
- if (!$gotit) continue;
- }
-
- // if we are skipping the rest of the tests (due to error) note a fault
- if ($skipendpoint) {
- $soap_test->setResult(0,$fault->faultcode, '',
- $skipfault->faultstring,
- $skipfault
- );
- #$endpoint_info['tests'][] = &$soap_test;
- $this->totals['fail']++;
- } else {
- // run the endpoint test
- if ($this->doEndpointMethod($endpoint_info, $soap_test)) {
- $this->totals['success']++;
- } else {
- $skipendpoint = $soap_test->result['fault']->faultcode=='HTTP'
- && strstr($soap_test->result['fault']->faultstring,'Connect Error');
- $skipfault = $soap_test->result['fault'];
- $this->totals['fail']++;
- }
- #$endpoint_info['tests'][] = &$soap_test;
- }
- $soap_test->showTestResult($this->debug);
- $this->_saveResults($endpoint_info['id'], $soap_test);
- $soap_test->result = NULL;
- $this->totals['calls']++;
- }
- if ($this->numservers && ++$i >= $this->numservers) break;
- }
- }
-
- function doGroupTests() {
- $dowsdl = array(0,1);
- foreach($dowsdl as $usewsdl) {
- $this->useWSDL = $usewsdl;
- foreach($this->paramTypes as $ptype) {
- // skip a pointless test
- if ($usewsdl && $ptype == 'soapval') break;
- $this->paramType = $ptype;
- $this->doTest();
- }
- }
- }
-
- /**
- * doTests
- * go all out. This takes time.
- *
- * @access public
- */
- function doTests() {
- // the mother of all interop tests
- $dowsdl = array(0,1);
- foreach($this->tests as $test) {
- $this->currentTest = $test;
- foreach($dowsdl as $usewsdl) {
- $this->useWSDL = $usewsdl;
- foreach($this->paramTypes as $ptype) {
- // skip a pointless test
- if ($usewsdl && $ptype == 'soapval') break;
- $this->paramType = $ptype;
- $this->doTest();
- }
- }
- }
- }
-
- // ***********************************************************
- // output functions
-
- /**
- * getResults
- * retreive results from the database, stuff them into the endpoint array
- *
- * @access private
- */
- function getMethodList($test = 'base') {
- // retreive the results and put them into the endpoint info
- $sql = "select distinct(function) from results where class='$test' order by function";
- $results = $this->dbc->getAll($sql);
- $ar = array();
- foreach($results as $result) {
- $ar[] = $result[0];
- }
- return $ar;
- }
-
- function outputTable()
- {
- $methods = $this->getMethodList($this->currentTest);
- if (!$methods) return;
- $this->getResults($this->currentTest,$this->paramType,$this->useWSDL);
-
- echo "<b>Testing $this->currentTest ";
- if ($this->useWSDL) echo "using WSDL ";
- else echo "using Direct calls ";
- echo "with $this->paramType values</b><br>\n";
-
- // calculate totals for this table
- $this->totals['success'] = 0;
- $this->totals['fail'] = 0;
- $this->totals['servers'] = 0; #count($this->endpoints);
- foreach ($this->endpoints as $endpoint => $endpoint_info) {
- if (count($endpoint_info['methods']) > 0) {
- $this->totals['servers']++;
- foreach ($methods as $method) {
- $r = $endpoint_info['methods'][$method]['result'];
- if ($r == 'OK') $this->totals['success']++;
- else $this->totals['fail']++;
- }
- } else {
- unset($this->endpoints[$endpoint]);
- }
- }
- $this->totals['calls'] = count($methods) * $this->totals['servers'];
-
- if ($this->totals['fail'] == $this->totals['calls']) {
- // assume tests have not run, skip outputing table
- print "No Data Available<br>\n";
- return;
- }
-
- echo "\n\n<b>Servers: {$this->totals['servers']} Calls: {$this->totals['calls']} Success: {$this->totals['success']} Fail: {$this->totals['fail']}</b><br>\n";
-
- echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\">\n";
- echo "<tr><td class=\"BLANK\">Endpoint</td>\n";
- foreach ($methods as $method) {
- $info = split(':', $method);
- echo "<td class='BLANK' valign='top'>";
- foreach ($info as $m) {
- $hi = split(',',$m);
- echo '<b>'.$hi[0]."</b><br>\n";
- if (count($hi) > 1) {
- echo "&nbsp;&nbsp;Actor=".($hi[1]?'Target':'Not Target')."<br>\n";
- echo "&nbsp;&nbsp;MustUnderstand=$hi[2]<br>\n";
- }
- }
- echo "</td>\n";
- }
- echo "</tr>\n";
- $faults = array();
- $fi = 0;
- foreach ($this->endpoints as $endpoint => $endpoint_info) {
- if (array_key_exists('wsdlURL',$endpoint_info)) {
- echo "<tr><td class=\"BLANK\"><a href=\"{$endpoint_info['wsdlURL']}\">$endpoint</a></td>\n";
- } else {
- echo "<tr><td class=\"BLANK\">$endpoint</td>\n";
- }
- foreach ($methods as $method) {
- $id = $endpoint_info['methods'][$method]['id'];
- $r = $endpoint_info['methods'][$method]['result'];
- $e = $endpoint_info['methods'][$method]['error'];
- if ($e) {
- $faults[$fi++] = $e;
- }
- if ($r) {
- echo "<td class='$r'><a href='$PHP_SELF?wire=$id'>$r</a></td>\n";
- } else {
- echo "<td class='untested'>untested</td>\n";
- }
- }
- echo "</tr>\n";
- }
- echo "</table><br>\n";
- if ($this->showFaults && count($faults) > 0) {
- echo "<b>ERROR Details:</b><br>\n<ul>\n";
- # output more error detail
- foreach ($faults as $fault) {
- echo '<li>'.HTMLSpecialChars($fault)."</li>\n";
- }
- }
- echo "</ul><br><br>\n";
- }
-
- function outputTables() {
- // the mother of all interop tests
- $dowsdl = array(0,1);
- foreach($this->tests as $test) {
- $this->currentTest = $test;
- foreach($dowsdl as $usewsdl) {
- $this->useWSDL = $usewsdl;
- foreach($this->paramTypes as $ptype) {
- // skip a pointless test
- if ($usewsdl && $ptype == 'soapval') break;
- $this->paramType = $ptype;
- $this->outputTable();
- }
- }
- }
- }
-
- function showWire($id) {
- $results = $this->dbc->getAll("select * from results where id=$id",NULL, DB_FETCHMODE_ASSOC );
- #$wire = preg_replace("/>/",">\n",$results[0]['wire']);
- $wire = $results[0]['wire'];
- echo "<pre>\n".HTMLSpecialChars($wire)."</pre>\n";
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/ext/soap/interop/client_round2_params.php b/ext/soap/interop/client_round2_params.php
deleted file mode 100644
index aa50edb763..0000000000
--- a/ext/soap/interop/client_round2_params.php
+++ /dev/null
@@ -1,636 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-define('SOAP_TEST_ACTOR_NEXT','http://schemas.xmlsoap.org/soap/actor/next');
-define('SOAP_TEST_ACTOR_OTHER','http://some/other/actor');
-
-class SOAP_Test {
- var $type = 'php';
- var $test_name = NULL;
- var $method_name = NULL;
- var $method_params = NULL;
- var $expect = NULL;
- var $expect_fault = FALSE;
- var $headers = NULL;
- var $headers_expect = NULL;
- var $result = array();
- var $show = 1;
- var $debug = 0;
- var $encoding = 'UTF-8';
-
- function SOAP_Test($methodname, $params, $expect = NULL) {
- # XXX we have to do this to make php-soap happy with NULL params
- if (!$params) $params = array();
-
- if (strchr($methodname,'(')) {
- preg_match('/(.*)\((.*)\)/',$methodname,$matches);
- $this->test_name = $methodname;
- $this->method_name = $matches[1];
- } else {
- $this->test_name = $this->method_name = $methodname;
- }
- $this->method_params = $params;
- $this->expect = $expect;
-
- // determine test type
- if ($params) {
- $v = array_values($params);
- if (gettype($v[0]) == 'object' &&
- (get_class($v[0]) == 'soapvar' || get_class($v[0]) == 'soapparam'))
- $this->type = 'soapval';
- }
- }
-
- function setResult($ok, $result, $wire, $error = '', $fault = NULL)
- {
- $this->result['success'] = $ok;
- $this->result['result'] = $result;
- $this->result['error'] = $error;
- $this->result['wire'] = $wire;
- $this->result['fault'] = $fault;
- }
-
- /**
- * showMethodResult
- * print simple output about a methods result
- *
- * @param array endpoint_info
- * @param string method
- * @access public
- */
- function showTestResult($debug = 0) {
- // debug output
- if ($debug) $this->show = 1;
- if ($debug) {
- echo str_repeat("-",50)."<br>\n";
- }
-
- echo "testing $this->test_name : ";
- if ($this->headers) {
- foreach ($this->headers as $h) {
- if (get_class($h) == 'soap_header') {
-
- echo "\n {$h->name},{$h->attributes['SOAP-ENV:actor']},{$h->attributes['SOAP-ENV:mustUnderstand']} : ";
- } else {
- if (!$h[4]) $h[4] = SOAP_TEST_ACTOR_NEXT;
- if (!$h[3]) $h[3] = 0;
- echo "\n $h[0],$h[4],$h[3] : ";
- }
- }
- }
-
- if ($debug) {
- print "method params: ";
- print_r($this->params);
- print "\n";
- }
-
- $ok = $this->result['success'];
- if ($ok) {
- print "SUCCESS\n";
- } else {
- $fault = $this->result['fault'];
- if ($fault) {
- print "FAILED: {$fault->faultcode} {$fault->faultstring}\n";
- } else {
- print "FAILED: ".$this->result['result']."\n";
- }
- }
- if ($debug) {
- echo "<pre>\n".htmlentities($this->result['wire'])."</pre>\n";
- }
- }
-}
-
-# XXX I know this isn't quite right, need to deal with this better
-function make_2d($x, $y)
-{
- for ($_x = 0; $_x < $x; $_x++) {
- for ($_y = 0; $_y < $y; $_y++) {
- $a[$_x][$_y] = "x{$_x}y{$_y}";
- }
- }
- return $a;
-}
-
-function soap_value($name, $value, $type) {
- return new soapparam(new soapvar($value,$type),$name);
-}
-
-class SOAPStruct {
- var $varString;
- var $varInt;
- var $varFloat;
- function SOAPStruct($s, $i, $f) {
- $this->varString = $s;
- $this->varInt = $i;
- $this->varFloat = $f;
- }
-}
-
-//***********************************************************
-// Base echoString
-
-$soap_tests['base'][] = new SOAP_Test('echoString', array('inputString' => 'hello world!'));
-$soap_tests['base'][] = new SOAP_Test('echoString', array('inputString' => soap_value('inputString','hello world',XSD_STRING)));
-$soap_tests['base'][] = new SOAP_Test('echoString(null)', array('inputString' => ""));
-$soap_tests['base'][] = new SOAP_Test('echoString(null)', array('inputString' => soap_value('inputString','',XSD_STRING)));
-$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => 'hello world\nline 2\n'));
-$soap_tests['base'][] = new SOAP_Test('echoString(entities)', array('inputString' => soap_value('inputString','hello world\nline 2\n',XSD_STRING)));
-$test = new SOAP_Test('echoString(utf-8)', array('inputString' => utf8_encode('ỗÈéóÒ₧⅜ỗỸ')));
-$test->encoding = 'UTF-8';
-$soap_tests['base'][] = $test;
-$test = new SOAP_Test('echoString(utf-8)', array('inputString' => soap_value('inputString',utf8_encode('ỗÈéóÒ₧⅜ỗỸ'),XSD_STRING)));
-$test->encoding = 'UTF-8';
-$soap_tests['base'][] = $test;
-
-//***********************************************************
-// Base echoStringArray
-
-$soap_tests['base'][] = new SOAP_Test('echoStringArray',
- array('inputStringArray' => array('good','bad')));
-$soap_tests['base'][] = new SOAP_Test('echoStringArray',
- array('inputStringArray' =>
- soap_value('inputStringArray',array('good','bad'),SOAP_ENC_ARRAY)));
-
-// null array test
-# XXX NULL Arrays not supported
-#$soap_tests['base'][] = new SOAP_Test('echoStringArray(null)', array('inputStringArray' => NULL));
-#$soap_tests['base'][] = new SOAP_Test('echoStringArray(null)', array('inputStringArray' => soap_value('inputStringArray',NULL,XSD_STRING)));
-
-//***********************************************************
-// Base echoInteger
-
-$soap_tests['base'][] = new SOAP_Test('echoInteger', array('inputInteger' => 34345));
-$soap_tests['base'][] = new SOAP_Test('echoInteger', array('inputInteger' => soap_value('inputInteger',12345,XSD_INT)));
-
-//***********************************************************
-// Base echoIntegerArray
-
-$soap_tests['base'][] = new SOAP_Test('echoIntegerArray', array('inputIntegerArray' => array(1,234324324,2)));
-$soap_tests['base'][] = new SOAP_Test('echoIntegerArray',
- array('inputIntegerArray' =>
- soap_value('inputIntegerArray',
- array(new soapvar(12345,XSD_INT),new soapvar(654321,XSD_INT)),
- SOAP_ENC_ARRAY)));
-#
-#// null array test
-# XXX NULL Arrays not supported
-#$soap_tests['base'][] = new SOAP_Test('echoIntegerArray(null)', array('inputIntegerArray' => NULL));
-#$soap_tests['base'][] = new SOAP_Test('echoIntegerArray(null)', array('inputIntegerArray' => new SOAP_Value('inputIntegerArray','Array',NULL)));
-#
-//***********************************************************
-// Base echoFloat
-
-$soap_tests['base'][] = new SOAP_Test('echoFloat', array('inputFloat' => 342.23));
-$soap_tests['base'][] = new SOAP_Test('echoFloat', array('inputFloat' => soap_value('inputFloat',123.45,XSD_FLOAT)));
-
-//***********************************************************
-// Base echoFloatArray
-
-$soap_tests['base'][] = new SOAP_Test('echoFloatArray', array('inputFloatArray' => array(1.3223,34.2,325.325)));
-$soap_tests['base'][] = new SOAP_Test('echoFloatArray',
- array('inputFloatArray' =>
- soap_value('inputFloatArray',
- array(new soapvar(123.45,XSD_FLOAT),new soapvar(654.321,XSD_FLOAT)),
- SOAP_ENC_ARRAY)));
-//***********************************************************
-// Base echoStruct
-
-$soapstruct = new SOAPStruct('arg',34,325.325);
-# XXX no way to set a namespace!!!
-$soapsoapstruct = soap_value('inputStruct',$soapstruct,SOAP_ENC_OBJECT);
-$soap_tests['base'][] = new SOAP_Test('echoStruct', array('inputStruct' =>$soapstruct));
-$soap_tests['base'][] = new SOAP_Test('echoStruct', array('inputStruct' =>$soapsoapstruct));
-
-//***********************************************************
-// Base echoStructArray
-
-$soap_tests['base'][] = new SOAP_Test('echoStructArray', array('inputStructArray' => array(
- $soapstruct,$soapstruct,$soapstruct)));
-$soap_tests['base'][] = new SOAP_Test('echoStructArray', array('inputStructArray' =>
- soap_value('inputStructArray',array($soapstruct,$soapstruct,$soapstruct),SOAP_ENC_ARRAY)));
-
-
-//***********************************************************
-// Base echoVoid
-
-$soap_tests['base'][] = new SOAP_Test('echoVoid', NULL);
-$test = new SOAP_Test('echoVoid', NULL);
-$test->type = 'soapval';
-$soap_tests['base'][] = $test;
-
-//***********************************************************
-// Base echoBase64
-
-$soap_tests['base'][] = new SOAP_Test('echoBase64', array('inputBase64' => 'TmVicmFza2E='));
-$soap_tests['base'][] = new SOAP_Test('echoBase64', array('inputBase64' =>
- soap_value('inputBase64','TmVicmFza2E=',XSD_BASE64BINARY)));
-
-//***********************************************************
-// Base echoHexBinary
-
-$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' => '736F61707834'));
-$soap_tests['base'][] = new SOAP_Test('echoHexBinary', array('inputHexBinary' =>
- soap_value('inputHexBinary','736F61707834',XSD_HEXBINARY)));
-
-//***********************************************************
-// Base echoDecimal
-
-# XXX test fails because php-soap incorrectly sets decimal to long rather than float
-$soap_tests['base'][] = new SOAP_Test('echoDecimal', array('inputDecimal' => 12345.67890));
-$soap_tests['base'][] = new SOAP_Test('echoDecimal', array('inputDecimal' =>
- soap_value('inputDecimal',12345.67890,XSD_DECIMAL)));
-
-//***********************************************************
-// Base echoDate
-
-# php-soap doesn't handle datetime types properly yet
-$soap_tests['base'][] = new SOAP_Test('echoDate', array('inputDate' => '2001-05-24T17:31:41Z'));
-$soap_tests['base'][] = new SOAP_Test('echoDate', array('inputDate' =>
- soap_value('inputDate','2001-05-24T17:31:41Z',XSD_DATETIME)));#'2001-04-25T13:31:41-0700'
-
-//***********************************************************
-// Base echoBoolean
-
-# php-soap sends boolean as zero or one, which is ok, but to be explicit, send true or false.
-$soap_tests['base'][] = new SOAP_Test('echoBoolean', array('inputBoolean' => TRUE));
-$soap_tests['base'][] = new SOAP_Test('echoBoolean', array('inputBoolean' =>
- soap_value('inputBoolean',TRUE,XSD_BOOLEAN)));
-$soap_tests['base'][] = new SOAP_Test('echoBoolean', array('inputBoolean' => FALSE));
-$soap_tests['base'][] = new SOAP_Test('echoBoolean', array('inputBoolean' =>
- soap_value('inputBoolean',FALSE,XSD_BOOLEAN)));
-
-#
-#
-#//***********************************************************
-#// GROUP B
-#
-#
-#//***********************************************************
-#// GroupB echoStructAsSimpleTypes
-#
-#$expect = array(
-# 'outputString'=>'arg',
-# 'outputInteger'=>34,
-# 'outputFloat'=>325.325
-# );
-#$soap_tests['GroupB'][] = new SOAP_Test('echoStructAsSimpleTypes',
-# array('inputStruct' => array(
-# 'varString'=>'arg',
-# 'varInt'=>34,
-# 'varFloat'=>325.325
-# )), $expect);
-#$soap_tests['GroupB'][] = new SOAP_Test('echoStructAsSimpleTypes',
-# array('inputStruct' =>
-# new SOAP_Value('inputStruct','SOAPStruct',
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# ))), $expect);
-#
-#//***********************************************************
-#// GroupB echoSimpleTypesAsStruct
-#
-#$expect =
-# array(
-# 'varString'=>'arg',
-# 'varInt'=>34,
-# 'varFloat'=>325.325
-# );
-#$soap_tests['GroupB'][] = new SOAP_Test('echoSimpleTypesAsStruct',
-# array(
-# 'inputString'=>'arg',
-# 'inputInteger'=>34,
-# 'inputFloat'=>325.325
-# ), $expect);
-#$soap_tests['GroupB'][] = new SOAP_Test('echoSimpleTypesAsStruct',
-# array(
-# new SOAP_Value('inputString','string','arg'),
-# new SOAP_Value('inputInteger','int',34),
-# new SOAP_Value('inputFloat','float',325.325)
-# ), $expect);
-#
-#//***********************************************************
-#// GroupB echo2DStringArray
-#
-#$soap_tests['GroupB'][] = new SOAP_Test('echo2DStringArray',
-# array('input2DStringArray' => make_2d(3,3)));
-#
-#$multidimarray =
-# new SOAP_Value('input2DStringArray','Array',
-# array(
-# array(
-# new SOAP_Value('item','string','row0col0'),
-# new SOAP_Value('item','string','row0col1'),
-# new SOAP_Value('item','string','row0col2')
-# ),
-# array(
-# new SOAP_Value('item','string','row1col0'),
-# new SOAP_Value('item','string','row1col1'),
-# new SOAP_Value('item','string','row1col2')
-# )
-# )
-# );
-#$multidimarray->options['flatten'] = TRUE;
-#$soap_tests['GroupB'][] = new SOAP_Test('echo2DStringArray',
-# array('input2DStringArray' => $multidimarray));
-#
-#//***********************************************************
-#// GroupB echoNestedStruct
-#
-#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedStruct',
-# array('inputStruct' => array(
-# 'varString'=>'arg',
-# 'varInt'=>34,
-# 'varFloat'=>325.325,
-# 'varStruct' => array(
-# 'varString'=>'arg',
-# 'varInt'=>34,
-# 'varFloat'=>325.325
-# )
-# )));
-#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedStruct',
-# array('inputStruct' =>
-# new SOAP_Value('inputStruct','struct',
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325),
-# new SOAP_Value('varStruct','SOAPStruct',
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# )
-# /*,NULL,'http://soapinterop.org/xsd'*/)
-# )
-# )));
-#
-#//***********************************************************
-#// GroupB echoNestedArray
-#
-#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedArray',
-# array('inputStruct' => array(
-# 'varString'=>'arg',
-# 'varInt'=>34,
-# 'varFloat'=>325.325,
-# 'varArray' => array('red','blue','green')
-# )));
-#$soap_tests['GroupB'][] = new SOAP_Test('echoNestedArray',
-# array('inputStruct' =>
-# new SOAP_Value('inputStruct','struct',
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325),
-# new SOAP_Value('varArray','Array',
-# array( #push struct elements into one soap value
-# new SOAP_Value('item','string','red'),
-# new SOAP_Value('item','string','blue'),
-# new SOAP_Value('item','string','green')
-# )
-# )
-# )
-# )));
-#
-#
-#//***********************************************************
-#// GROUP C header tests
-#
-#//***********************************************************
-#// echoMeStringRequest php val tests
-#
-#// echoMeStringRequest with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 0,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 1,SOAP_TEST_ACTOR_NEXT);
-#$this->type = 'soapval'; // force a soapval version of this test
-#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStringRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'hello world', 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStringRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// echoMeStringRequest soapval tests
-#
-#// echoMeStringRequest with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world');
-#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1);
-#$this->type = 'soapval'; // force a soapval version of this test
-#$test->headers_expect['echoMeStringRequest'] = array('echoMeStringResponse'=>'hello world');
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStringRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStringRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStringRequest with endpoint header destination, must understand,
-#// invalid namespace, should recieve a fault
-##$test = new SOAP_Test('echoVoid', NULL);
-##$test->type = 'soapval';
-##$test->headers[] = new SOAP_Header('{http://unknown.org/echoheader/}echoMeStringRequest', 'string', 'hello world', 1);
-##$test->headers_expect['echoMeStringRequest'] = array();
-##$test->expect_fault = TRUE;
-##$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// php val tests
-#// echoMeStructRequest with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
-# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
-# 0,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeStructRequest'] =
-# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
-# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
-# 1,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeStructRequest'] =
-# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
-# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
-# 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStructRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeStructRequest',
-# array('varString'=>'arg', 'varInt'=>34, 'varFloat'=>325.325),
-# 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStructRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// soapval tests
-#// echoMeStructRequest with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# ));
-#$test->headers_expect['echoMeStructRequest'] =
-# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# ), 1);
-#$test->headers_expect['echoMeStructRequest'] =
-# array('echoMeStructResponse'=> array('varString'=>'arg','varInt'=>34,'varFloat'=>325.325));
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# ), 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStructRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeStructRequest with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeStructRequest',NULL,
-# array( #push struct elements into one soap value
-# new SOAP_Value('varString','string','arg'),
-# new SOAP_Value('varInt','int',34),
-# new SOAP_Value('varFloat','float',325.325)
-# ), 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeStructRequest'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// echoMeUnknown php val tests
-#// echoMeUnknown with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',0,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',1,SOAP_TEST_ACTOR_NEXT);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$test->expect_fault = TRUE;
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!',0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->headers[] = array('{http://soapinterop.org/echoheader/}echoMeUnknown', 'nobody understands me!', 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#//***********************************************************
-#// echoMeUnknown soapval tests
-#// echoMeUnknown with endpoint as header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!');
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint as header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!',1);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$test->expect_fault = TRUE;
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint NOT header destination, doesn't have to understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!', 0, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-#
-#// echoMeUnknown with endpoint NOT header destination, must understand
-#$test = new SOAP_Test('echoVoid', NULL);
-#$test->type = 'soapval';
-#$test->headers[] = new SOAP_Header('{http://soapinterop.org/echoheader/}echoMeUnknown','string','nobody understands me!', 1, SOAP_TEST_ACTOR_OTHER);
-#$test->headers_expect['echoMeUnknown'] = array();
-#$soap_tests['GroupC'][] = $test;
-
-
-?> \ No newline at end of file
diff --git a/ext/soap/interop/client_round2_results.php b/ext/soap/interop/client_round2_results.php
deleted file mode 100644
index 538513e3e0..0000000000
--- a/ext/soap/interop/client_round2_results.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-// NOTE: do not run this directly under a web server, as it will take a very long
-// time to execute. Run from a command line or something, and redirect output
-// to an html file.
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-require_once 'client_round2_interop.php';
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
-<style>
-TD { background-color: Red; }
-TD.BLANK { background-color: White; }
-TD.OK { background-color: Lime; }
-TD.RESULT { background-color: Green; }
-TD.untested { background-color: White; }
-TD.CONNECT { background-color: Yellow; }
-TD.TRANSPORT { background-color: Yellow; }
-TD.WSDL { background-color: Yellow; }
-TD.WSDLCACHE { background-color: Yellow; }
-TD.WSDLPARSER { background-color: Yellow; }
-TD.HTTP { background-color: Yellow; }
-TD.SMTP { background-color: Yellow; }
-</style>
- <title>PEAR-PHP SOAP Interop Tests</title>
-</head>
-
-<body bgcolor="White" text="Black">
-<h2 align="center">SOAP Client Interop Test Results: Round2</h2>
-
-<a href="index.php">Back to Interop Index</a><br>
-<p>&nbsp;</p>
-
-<?php
-$iop = new Interop_Client();
-
-if ($_GET['detail'] == 1) $iop->showFaults = 1;
-
-if ($_GET['wire']) {
- $iop->showWire($_GET['wire']);
-} else {
- $iop->getEndpoints();
- $iop->getResults();
-
- if ($_GET['test']) {
- $iop->currentTest = $_GET['test'];
- $iop->useWSDL = $_GET['wsdl']?$_GET['wsdl']:0;
- $iop->paramType = $_GET['type']?$_GET['type']:'php';
- $iop->outputTable();
- } else {
- $iop->outputTables();
- }
-}
-?>
-</body>
-</html>
diff --git a/ext/soap/interop/client_round2_run.php b/ext/soap/interop/client_round2_run.php
deleted file mode 100644
index 3b8910e6b6..0000000000
--- a/ext/soap/interop/client_round2_run.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-// this script is usefull for quickly testing stuff, use the 'pretty' file for html output
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-set_time_limit(0);
-require_once 'client_round2_interop.php';
-
-$iop = new Interop_Client();
-// force a fetch of endpoints, this happens irregardless if no endpoints in database
-#$iop->fetchEndpoints();
-
-// set some options
-$iop->currentTest = 'base'; // see $tests above
-$iop->paramType = 'php'; // 'php' or 'soapval'
-$iop->useWSDL = 1; // 1= do wsdl tests
-$iop->numServers = 0; // 0 = all
-$iop->specificEndpoint = '4s4c'; // test only this endpoint
-$iop->testMethod = 'echoString'; // test only this method
-
-#XXX MS SOAP ToolKit 2.0/3.0 crashes php-soap in __getfault!
-
-// endpoints to skip
-$iop->skipEndpointList = array('Apache Axis','IONA XMLBus','IONA XMLBus (CORBA)','MS SOAP ToolKit 2.0','MS SOAP ToolKit 3.0','Spheon JSOAP','SQLData SOAP Server','WASP Advanced 3.0');
-$iop->startAt='';
-$this->nosave = 0; // 1= disable saving results to database
-// debug output
-$iop->show = 1;
-$iop->debug = 0;
-$iop->showFaults = 0; // used in result table output
-
-$iop->doTest(); // run a single set of tests using above options
-#$iop->doGroupTests(); // run a group of tests set in $currentTest
-#$iop->doTests(); // run all tests, ignore above options
-#$iop->outputTables();
-echo "done";
-
-?>
diff --git a/ext/soap/interop/database_round2.sql b/ext/soap/interop/database_round2.sql
deleted file mode 100644
index 79669a04c2..0000000000
--- a/ext/soap/interop/database_round2.sql
+++ /dev/null
@@ -1,45 +0,0 @@
-# phpMyAdmin MySQL-Dump
-# version 2.2.5
-# http://phpwizard.net/phpMyAdmin/
-# http://phpmyadmin.sourceforge.net/ (download page)
-#
-# Host: localhost
-# Generation Time: Apr 08, 2002 at 08:32 PM
-# Server version: 3.23.49
-# PHP Version: 4.1.1
-# Database : `interop`
-# --------------------------------------------------------
-
-#
-# Table structure for table `endpoints`
-#
-
-CREATE TABLE endpoints (
- id int(11) NOT NULL auto_increment,
- endpointName varchar(50) NOT NULL default '',
- endpointURL varchar(255) NOT NULL default '',
- wsdlURL varchar(255) NOT NULL default '',
- class varchar(20) NOT NULL default '',
- status int(11) NOT NULL default '1',
- PRIMARY KEY (id)
-) TYPE=MyISAM;
-# --------------------------------------------------------
-
-#
-# Table structure for table `results`
-#
-
-CREATE TABLE results (
- id int(11) NOT NULL auto_increment,
- endpoint int(11) NOT NULL default '0',
- stamp int(11) NOT NULL default '0',
- class varchar(10) NOT NULL default '',
- type varchar(10) default NULL,
- wsdl int(11) NOT NULL default '0',
- function varchar(255) NOT NULL default '',
- result varchar(25) NOT NULL default '',
- error text,
- wire text NOT NULL,
- PRIMARY KEY (id)
-) TYPE=MyISAM;
-
diff --git a/ext/soap/interop/echoheadersvc.wsdl b/ext/soap/interop/echoheadersvc.wsdl
deleted file mode 100644
index a279580dc3..0000000000
--- a/ext/soap/interop/echoheadersvc.wsdl
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<definitions name="InteropTest" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://soapinterop.org/" xmlns:s="http://soapinterop.org/xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
-
- <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/"/>
- <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/xsd"/>
- <import location="http://www.whitemesa.com/interop/InteropTestC.wsdl" namespace="http://soapinterop.org/"/>
-
- <service name="interopLabEchoHeader">
-
- <port name="interopPortEchoHdr" binding="tns:InteropEchoHeaderBinding">
- <soap:address location="http://localhost/soap_interop/server_round2.php"/>
- </port>
-
- </service>
-
-</definitions>
diff --git a/ext/soap/interop/endpointdata.sql b/ext/soap/interop/endpointdata.sql
deleted file mode 100644
index 80d9d5ac9c..0000000000
--- a/ext/soap/interop/endpointdata.sql
+++ /dev/null
@@ -1,85 +0,0 @@
-# phpMyAdmin MySQL-Dump
-# version 2.2.5
-# http://phpwizard.net/phpMyAdmin/
-# http://phpmyadmin.sourceforge.net/ (download page)
-#
-# Host: localhost
-# Generation Time: Jul 14, 2002 at 03:13 PM
-# Server version: 3.23.49
-# PHP Version: 4.2.1
-# Database : `interop2`
-
-#
-# Dumping data for table `endpoints`
-#
-
-INSERT INTO endpoints VALUES (1, '4s4c', 'http://soap.4s4c.com/ilab/soap.asp', 'http://www.pocketsoap.com/services/ilab.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (2, '4s4c v2.0', 'http://soap.4s4c.com/ilab2/soap.asp', 'http://soap.4s4c.com/ilab2/ilab.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (3, 'Apache Axis', 'http://nagoya.apache.org:5049/axis/services/echo', 'http://nagoya.apache.org:5049/axis/services/echo?wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (4, 'Apache SOAP 2.2', 'http://nagoya.apache.org:5049/soap/servlet/rpcrouter', 'http://www.apache.org/~rubys/ApacheSoap.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (5, 'ASP.NET Web Services', 'http://www.mssoapinterop.org/asmx/simple.asmx', 'http://www.mssoapinterop.org/asmx/simple.asmx?wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (6, 'CapeConnect', 'http://interop.capeclear.com/ccx/soapbuilders-round2', 'http://interop.capeclear.com/wsdl/soapbuilders-round2.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (7, 'Delphi SOAP', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropService.exe/soap/InteropTestPortType', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropService.exe/wsdl/InteropTestPortType', 'base', 1);
-INSERT INTO endpoints VALUES (8, 'EasySoap++', 'http://easysoap.sourceforge.net/cgi-bin/interopserver', 'http://easysoap.sourceforge.net/interopA.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (9, 'eSOAP', 'http://www.quakersoft.net/cgi-bin/interop2_server.cgi', 'http://www.quakersoft.net/wsdl/interop2.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (10, 'gSOAP', 'http://websrv.cs.fsu.edu/~engelen/interop2.cgi', 'http://www.cs.fsu.edu/~engelen/interop2.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (11, 'Frontier', 'http://www.soapware.org/xmethodsInterop', '', 'base', 1);
-INSERT INTO endpoints VALUES (12, 'GLUE', 'http://www.themindelectric.net:8005/glue/round2', 'http://www.themindelectric.net:8005/glue/round2.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (13, 'HP SOAP', 'http://soap.bluestone.com/hpws/soap/EchoService', 'http://soap.bluestone.com/hpws/soap/EchoService.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (14, 'IONA XMLBus', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/BaseService/BasePort', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/BaseService/BasePort', 'base', 1);
-INSERT INTO endpoints VALUES (15, 'IONA XMLBus (CORBA)', 'http://interop.xmlbus.com:7002/xmlbus/container/CORBAInterop/BaseService/BasePort', 'http://interop.xmlbus.com:7002/xmlbus/container/CORBAInterop/BaseService/BasePort', 'base', 1);
-INSERT INTO endpoints VALUES (16, 'kSOAP', 'http://kissen.cs.uni-dortmund.de:8080/ksoapinterop', 'http://www.whitemesa.com/interop/kSOAP.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (17, 'MS .NET Remoting', 'http://www.mssoapinterop.org/remoting/ServiceA.soap', 'http://www.mssoapinterop.org/remoting/ServiceA.soap?wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (18, 'MS SOAP ToolKit 2.0', 'http://mssoapinterop.org/stk/Interop.wsdl', 'http://mssoapinterop.org/stk/Interop.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (19, 'MS SOAP ToolKit 3.0', 'http://mssoapinterop.org/stkV3/Interop.wsdl', 'http://mssoapinterop.org/stkV3/Interop.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (20, 'NuSOAP', 'http://dietrich.ganx4.com/nusoap/testbed/round2_base_server.php', 'http://dietrich.ganx4.com/nusoap/testbed/round2_base.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (21, 'OpenLink', 'http://demo.openlinksw.com:8890/Interop', 'http://demo.openlinksw.com:8890/Interop/services.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (24, 'SIM', 'http://soapinterop.simdb.com/round2', 'http://soapinterop.simdb.com/round2?WSDL', 'base', 1);
-INSERT INTO endpoints VALUES (25, 'SOAP4R', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/SOAP4R_SOAPBuildersInteropTest_R2base.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (26, 'SOAP:Lite', 'http://services.soaplite.com/interop.cgi', 'http://services.soaplite.com/interop2.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (27, 'Spheon JSOAP', 'http://213.23.125.181:8081/RPC', 'http://213.23.125.181:8081/interop.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (28, 'Spray 2001', 'http://www.dolphinharbor.org/services/interop2001', 'http://www.dolphinharbor.org/services/interop2001/service.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (29, 'SQLData SOAP Server', 'http://soapclient.com/interop/sqldatainterop.wsdl', 'http://soapclient.com/interop/sqldatainterop.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (30, 'WASP Advanced 3.0', 'http://soap.systinet.net:6060/InteropService/', 'http://soap.systinet.net:6060/InteropService/', 'base', 1);
-INSERT INTO endpoints VALUES (32, 'White Mesa SOAP Server', 'http://www.whitemesa.net/interop/std', 'http://www.whitemesa.net/wsdl/std/interop.wsdl', 'base', 1);
-INSERT INTO endpoints VALUES (33, 'PEAR SOAP', 'http://localhost/soap_interop/server_round2.php', 'http://localhost/soap_interop/interop.wsdl.php', 'base', 1);
-INSERT INTO endpoints VALUES (34, '4s4c', 'http://soap.4s4c.com/ilab/soap.asp', 'http://www.pocketsoap.com/services/ilab_b.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (35, '4s4c v2.0', 'http://soap.4s4c.com/ilab2/soap.asp', 'http://soap.4s4c.com/ilab2/ilab_b.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (36, 'Apache Axis', 'http://nagoya.apache.org:5049/axis/services/echo', 'http://nagoya.apache.org:5049/axis/services/echo?wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (37, 'ASP.NET Web Services', 'http://www.mssoapinterop.org/asmx/simpleB.asmx', 'http://www.mssoapinterop.org/asmx/simpleb.asmx?wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (38, 'Delphi SOAP', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropGroupB.exe/soap/InteropTestPortTypeB', 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropGroupB.exe/wsdl/InteropTestPortTypeB', 'GroupB', 1);
-INSERT INTO endpoints VALUES (39, 'EasySoap++', 'http://easysoap.sourceforge.net/cgi-bin/interopserver', 'http://easysoap.sourceforge.net/interopB.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (40, 'GLUE', 'http://www.themindelectric.net:8005/glue/round2B', 'http://www.themindelectric.net:8005/glue/round2B.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (41, 'gSOAP', 'http://websrv.cs.fsu.edu/~engelen/interop2B.cgi', 'http://www.cs.fsu.edu/~engelen/interop2B.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (42, 'HP SOAP', 'http://soap.bluestone.com/hpws/soap/EchoService', 'http://soap.bluestone.com/hpws/soap/EchoService.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (43, 'IONA XMLBus', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/GroupBService/GroupBPort', 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/GroupBService/GroupBPort', 'GroupB', 1);
-INSERT INTO endpoints VALUES (44, 'MS .NET Remoting', 'http://www.mssoapinterop.org/remoting/ServiceB.soap', 'http://www.mssoapinterop.org/remoting/ServiceB.soap?wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (45, 'MS SOAP ToolKit 2.0', 'http://mssoapinterop.org/stk/InteropBtyped.wsdl', 'http://mssoapinterop.org/stk/InteropBtyped.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (46, 'MS SOAP ToolKit 3.0', 'http://mssoapinterop.org/stkV3/InteropB.wsdl', 'http://mssoapinterop.org/stkV3/InteropB.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (47, 'NuSOAP', 'http://dietrich.ganx4.com/nusoap/testbed/round2_groupb_server.php', 'http://dietrich.ganx4.com/nusoap/testbed/round2_groupb.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (48, 'OpenLink', 'http://demo.openlinksw.com:8890/Interop', 'http://demo.openlinksw.com:8890/Interop/services.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (50, 'SIM', 'http://soapinterop.simdb.com/round2B', 'http://soapinterop.simdb.com/round2B?WSDL', 'GroupB', 1);
-INSERT INTO endpoints VALUES (51, 'SOAP4R', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/', 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/SOAP4R_SOAPBuildersInteropTest_R2GroupB.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (52, 'SOAP:Lite', 'http://services.soaplite.com/interop.cgi', 'http://services.soaplite.com/InteropTestB.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (53, 'Spheon JSOAP', 'http://213.23.125.181:8081/RPC', 'http://213.23.125.181:8081/interopb.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (54, 'Spray 2001', 'http://www.dolphinharbor.org/services/interopB2001', 'http://www.dolphinharbor.org/services/interopB2001/service.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (55, 'SQLData SOAP Server', 'http://soapclient.com/interop/InteropB.wsdl', 'http://soapclient.com/interop/InteropB.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (56, 'WASP Advanced 3.0', 'http://soap.systinet.net:6060/InteropBService/', 'http://soap.systinet.net:6060/InteropBService/', 'GroupB', 1);
-INSERT INTO endpoints VALUES (58, 'White Mesa SOAP Server', 'http://www.whitemesa.net/interop/std/groupB', 'http://www.whitemesa.net/wsdl/std/interopB.wsdl', 'GroupB', 1);
-INSERT INTO endpoints VALUES (59, 'PEAR SOAP', 'http://localhost/soap_interop/server_round2.php', 'http://localhost/soap_interop/interopB.wsdl.php', 'GroupB', 1);
-INSERT INTO endpoints VALUES (60, '4s4c v2.0', 'http://soap.4s4c.com/ilab2/soap.asp', 'http://soap.4s4c.com/ilab2/ilab_c.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (61, 'Apache Axis', 'http://nagoya.apache.org:5049/axis/services/echo', 'http://nagoya.apache.org:5049/axis/services/echo?wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (62, 'ASP.NET Web Services', 'http://mssoapinterop.org/asmx/header.asmx', 'http://mssoapinterop.org/asmx/header.asmx?wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (63, 'EasySoap++', 'http://easysoap.sourceforge.net/cgi-bin/interopserver', 'http://easysoap.sourceforge.net/interopC.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (64, 'MS SOAP ToolKit 2.0', 'http://mssoapinterop.org/stk/InteropC.wsdl', 'http://mssoapinterop.org/stk/InteropC.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (65, 'MS SOAP ToolKit 3.0', 'http://mssoapinterop.org/stkV3/InteropC.wsdl', 'http://mssoapinterop.org/stkV3/InteropC.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (66, 'OpenLink', 'http://demo.openlinksw.com:8890/Interop', 'http://demo.openlinksw.com:8890/Interop/services.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (67, 'SOAP:Lite', 'http://services.soaplite.com/interopC.cgi', 'http://services.soaplite.com/InteropTestC.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (68, 'Spray 2001', 'http://www.dolphinharbor.org/services/interopC', 'http://www.dolphinharbor.org/services/interopC/service.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (69, 'SQLData SOAP Server', 'http://soapclient.com/interop/interopC.wsdl', 'http://soapclient.com/interop/interopC.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (70, 'WASP Advanced 3.0', 'http://soap.systinet.net:6060/InteropCService/', 'http://soap.systinet.net:6060/InteropCService/', 'GroupC', 1);
-INSERT INTO endpoints VALUES (71, 'White Mesa SOAP Server', 'http://www.whitemesa.net/interop/std/echohdr', 'http://www.whitemesa.net/wsdl/std/echoheadersvc.wsdl', 'GroupC', 1);
-INSERT INTO endpoints VALUES (72, 'PEAR SOAP', 'http://localhost/soap_interop/server_round2.php', 'http://localhost/soap_interop/echoheadersvc.wsdl.php', 'GroupC', 1);
-
-
-
diff --git a/ext/soap/interop/index.php b/ext/soap/interop/index.php
deleted file mode 100644
index ed222479b2..0000000000
--- a/ext/soap/interop/index.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
- <title>PEAR SOAP Interop</title>
-</head>
-<?php
-// get our endpoint
-$server = $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'];
-$endpoint = 'http://'.$server."/soap_interop/server_round2.php";
-$base = 'http://'.$server."/soap_interop/interop.wsdl";
-$groupb = 'http://'.$server."/soap_interop/interopB.wsdl";
-$groupc = 'http://'.$server."/soap_interop/echoheadersvc.wsdl";
-?>
-<body>
-
-<h2 align='center'>PEAR SOAP Interop</h2>
-<p>Welcome to the PEAR SOAP Interop pages. These pages are set up for
-SOAP Builder interop tests. You can find out more about the interop tests
-at <a href="http://www.whitemesa.com/interop.htm">White Mesa</a>.</p>
-<p>Currently Round 2 base, Group B and Group C interop tests are enabled.</p>
-
-<h3>Round 2 Interop Server</h3>
-Endpoint: <?php echo $endpoint; ?><br>
-Base WSDL: <a href="<?php echo $base ?>"><?php echo $base ?></a><br>
-Group B WSDL: <a href="<?php echo $groupb ?>"><?php echo $groupb ?></a><br>
-Group C WSDL: <a href="<?php echo $groupc ?>"><?php echo $groupc ?></a><br>
-
-<h3>Interop Client</h3>
-
-<p>
-Notes:
-Tests are done both "Direct" and with "WSDL". WSDL tests use the supplied interop WSDL
-to run the tests against. The Direct method uses an internal prebuilt list of methods and parameters
-for the test.</p>
-<p>
-Tests are also run against two methods of generating method parameters. The first, 'php', attempts
-to directly serialize PHP variables into soap values. The second method, 'soapval', uses a SOAP_Value
-class to define what the type of the value is. The second method is more interopable than the first
-by nature.
-</p>
-
-<h3>Client Test Interface</h3>
-<p>The <a href="client_round2.php">client interface</a> allows you to run the PEAR SOAP
-Client against a choosen interop server. Each run updates the results database below.</p>
-
-<h3>Interop Client Test Results</h3>
-<p>This is a database of the current test results using PEAR SOAP Clients against interop servers.</p>
-<p>
-More detail (wire) about errors (marked yellow or red) can be obtained by clicking on the
-link in the result box. If we have an HTTP error
-attempting to connect to the endpoint, we will mark all consecutive attempts as errors, and skip
-testing that endpoint. This reduces the time it takes to run the tests if a server is unavailable.
-WSDLCACHE errors mean we cannot retreive the WSDL file specified for the endpoint.
-</p>
-
-<ul>
-<li><a href="client_round2_results.php?test=base&type=php&wsdl=0">Base results using PHP native types</a></li>
-<li><a href="client_round2_results.php?test=base&type=soapval&wsdl=0">Base results using SOAP types</a></li>
-<li><a href="client_round2_results.php?test=base&type=php&wsdl=1">Base results using PHP native types with WSDL</a></li>
-<li><a href="client_round2_results.php?test=GroupB&type=php&wsdl=0">Group B results using PHP native types</a></li>
-<li><a href="client_round2_results.php?test=GroupB&type=soapval&wsdl=0">Group B results using SOAP types</a></li>
-<li><a href="client_round2_results.php?test=GroupB&type=php&wsdl=1">Group B results using PHP native types with WSDL</a></li>
-<li><a href="client_round2_results.php?test=GroupC&type=php&wsdl=0">Group C results using PHP native types</a></li>
-<li><a href="client_round2_results.php?test=GroupC&type=soapval&wsdl=0">Group C results using SOAP types</a></li>
-<li><a href="client_round2_results.php?test=GroupC&type=php&wsdl=1">Group C results using PHP native types with WSDL</a></li>
-<li><a href="client_round2_results.php">Show All Results</a></li>
-</ul>
-</body>
-</html>
diff --git a/ext/soap/interop/info.php b/ext/soap/interop/info.php
deleted file mode 100644
index 147cebcdd4..0000000000
--- a/ext/soap/interop/info.php
+++ /dev/null
@@ -1 +0,0 @@
-<?php phpinfo(); ?>
diff --git a/ext/soap/interop/interop.wsdl b/ext/soap/interop/interop.wsdl
deleted file mode 100644
index 6a835b571f..0000000000
--- a/ext/soap/interop/interop.wsdl
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-
-<definitions name="InteropTest" targetNamespace="http://soapinterop.org/"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://soapinterop.org/">
-
- <import location="http://www.whitemesa.com/wsdl/wmmsgrouter.xsd" namespace="http://whitemesa.com/headers/soapmsgrouter.xsd"/>
- <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/"/>
- <import location="http://www.whitemesa.com/interop/InteropTest.wsdl" namespace="http://soapinterop.org/xsd"/>
-
- <service name="interopLab">
- <port name="interopTestPort" binding="tns:InteropTestSoapBinding">
- <soap:address location="http://localhost/soap_interop/server_round2.php"/>
- </port>
- </service>
-
-</definitions>
diff --git a/ext/soap/interop/interopB.wsdl b/ext/soap/interop/interopB.wsdl
deleted file mode 100644
index 92301af334..0000000000
--- a/ext/soap/interop/interopB.wsdl
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<definitions name="InteropTest" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://soapinterop.org/" xmlns:s="http://soapinterop.org/xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
-
- <import location="http://www.whitemesa.com/interop/InteropTestB.wsdl" namespace="http://soapinterop.org/"/>
- <import location="http://www.whitemesa.com/interop/InteropTestB.wsdl" namespace="http://soapinterop.org/xsd"/>
-
- <service name="interopLabB">
- <port name="interopTestPortB" binding="tns:InteropTestSoapBindingB">
- <soap:address location="http://localhost/soap_interop/server_round2.php"/>
- </port>
- </service>
-
-</definitions>
diff --git a/ext/soap/interop/server_round2.php b/ext/soap/interop/server_round2.php
deleted file mode 100644
index 84a8333c7b..0000000000
--- a/ext/soap/interop/server_round2.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'SOAP/Server.php';
-
-$server = new SOAP_Server;
-
-require_once 'server_round2_base.php';
-require_once 'server_round2_groupB.php';
-require_once 'server_round2_groupC.php';
-
-$server->service(isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:NULL);
-#echo "Content-Length is {$_SERVER['CONTENT_LENGTH']}\n\n";
-#echo "<!---\n\nlen:".strlen($HTTP_RAW_POST_DATA)."\n\n";
-#echo "[$HTTP_RAW_POST_DATA";
-#print "]\n\nend of input data-->";
-?> \ No newline at end of file
diff --git a/ext/soap/interop/server_round2_base.php b/ext/soap/interop/server_round2_base.php
deleted file mode 100644
index abbd9223bb..0000000000
--- a/ext/soap/interop/server_round2_base.php
+++ /dev/null
@@ -1,184 +0,0 @@
-<?
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more |
-// | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-require_once 'SOAP/Server.php';
-
-function generateFault($short, $long)
-{
- $params = array(
- "faultcode" => "Server",
- "faultstring" => $short,
- "detail" => $long
- );
-
- $faultmsg = new SOAP_Message("Fault",$params,"http://schemas.xmlsoap.org/soap/envelope/");
- return $faultmsg;
-}
-
-function hex2bin($data)
-{
- $len = strlen($data);
- return pack("H" . $len, $data);
-}
-
-
-class SOAP_Interop_Base {
- var $method_namespace = 'http://soapinterop.org/';
-
- function SOAP_Interop_Base() {
- #if ($server) {
- # $server->addToMap("echoString",array("string"),array("string"));
- # $server->addToMap("echoStringArray",array(),array());
- # $server->addToMap("echoInteger",array("int"),array("int"));
- # $server->addToMap("echoIntegerArray",array(),array());
- # $server->addToMap("echoFloat",array("float"),array("float"));
- # $server->addToMap("echoFloatArray",array(),array());
- # $server->addToMap("echoStruct",array(),array());
- # $server->addToMap("echoStructArray",array(),array());
- # $server->addToMap("echoVoid",array(),array());
- # $server->addToMap("echoBase64",array("base64Binary"),array("base64Binary"));
- # $server->addToMap("echoDate",array("dateTime"),array("dateTime"));
- # $server->addToMap("echoHexBinary",array("hexBinary"),array("hexBinary"));
- # $server->addToMap("echoDecimal",array("decimal"),array("decimal"));
- # $server->addToMap("echoBoolean",array("boolean"),array("boolean"));
- #}
- }
-
- function echoString($inputString)
- {
- return new SOAP_Value('outputString','string',$inputString);
- }
-
- function echoStringArray($inputStringArray)
- {
- $ra = array();
- if ($inputStringArray) {
- foreach($inputStringArray as $s) {
- $ra[] = new SOAP_Value('item','string',$s);
- }
- }
- return new SOAP_Value('outputStringArray',NULL,$ra);
- }
-
-
- function echoInteger($inputInteger)
- {
- return new SOAP_Value('outputInteger','int',(integer)$inputInteger);
- }
-
- function echoIntegerArray($inputIntegerArray)
- {
- $ra = array();
- if ($inputIntegerArray) {
- foreach ($inputIntegerArray as $i) {
- $ra[] = new SOAP_Value('item','int',$i);
- }
- }
- return new SOAP_Value('outputIntArray',NULL,$ra);
- }
-
- function echoFloat($inputFloat)
- {
- return new SOAP_Value('outputFloat','float',(FLOAT)$inputFloat);
- }
-
- function echoFloatArray($inputFloatArray)
- {
- $ra = array();
- if ($inputFloatArray) {
- foreach($inputFloatArray as $float) {
- $ra[] = new SOAP_Value('item','float',(FLOAT)$float);
- }
- }
- return new SOAP_Value('outputFloatArray',NULL,$ra);
- }
-
- function echoStruct($inputStruct)
- {
- return new SOAP_Value('return','{http://soapinterop.org/xsd}SOAPStruct',
- array(
- new SOAP_Value('varInt','int',$inputStruct['varInt']),
- new SOAP_Value('varFloat','float',$inputStruct['varFloat']),
- new SOAP_Value('varString','string',$inputStruct['varString'])
- ));
- }
-
- function echoStructArray($inputStructArray)
- {
- $ra = array();
- if ($inputStructArray) {
- foreach($inputStructArray as $struct) {
- $ra[] = new SOAP_Value('item','{http://soapinterop.org/xsd}SOAPStruct',
- array(
- new SOAP_Value('varInt','int',$struct['varInt']),
- new SOAP_Value('varFloat','float',$struct['varFloat']),
- new SOAP_Value('varString','string',$struct['varString'])
- ));
- }
- }
- return $ra;
- }
-
- function echoVoid()
- {
- return NULL;
- }
-
- function echoBase64($b_encoded)
- {
- return new SOAP_Value('return','base64Binary',base64_encode(base64_decode($b_encoded)));
- }
-
- function echoDate($timeInstant)
- {
- $dt = new SOAP_Type_dateTime($timeInstant);
- if ($dt->toUnixtime() != -1) {
- $value = $dt->toSOAP();
- return new SOAP_Value('return','dateTime',$value);
- } else {
- return new SOAP_Fault("Value $timeInstant is not a dateTime value");
- }
- }
-
- function echoHexBinary($hb)
- {
- return new SOAP_Value('return','hexBinary',bin2hex(hex2bin($hb)));
- }
-
- function echoDecimal($dec)
- {
- return new SOAP_Value('return','decimal',(FLOAT)$dec);
- }
-
- function echoBoolean($boolean)
- {
- return new SOAP_Value('return','boolean',$boolean);
- }
-
- function echoMimeAttachment($stuff)
- {
- return new SOAP_Attachment('return','application/octet-stream',NULL,$stuff);
- }
-}
-
-$base = new SOAP_Interop_Base();
-$server->addObjectMap($base);
-?> \ No newline at end of file
diff --git a/ext/soap/interop/server_round2_groupB.php b/ext/soap/interop/server_round2_groupB.php
deleted file mode 100644
index cf28f58de1..0000000000
--- a/ext/soap/interop/server_round2_groupB.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more |
-// | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-require_once 'SOAP/Server.php';
-
-class SOAP_Interop_GroupB {
- var $method_namespace = 'http://soapinterop.org/';
- var $dispatch_map = array();
-
- function SOAP_Interop_GroupB() {
- $this->dispatch_map['echoStructAsSimpleTypes'] =
- array('in' => array('inputStruct' => 'SOAPStruct'),
- 'out' => array('outputString' => 'string', 'outputInteger' => 'int', 'outputFloat' => 'float')
- );
-
-# $server->addToMap('echoSimpleTypesAsStruct',
-# array('outputString' => 'string', 'outputInteger' => 'int', 'outputFloat' => 'float'),
-# array('return' => 'struct'));
-# $server->addToMap('echoNestedStruct', array(), array());
-# $server->addToMap('echo2DStringArray', array(), array());
-# $server->addToMap('echoNestedArray', array(), array());
- }
- function echoStructAsSimpleTypes ($struct)
- {
- # convert a SOAPStruct to an array
- $vals = array_values($struct);
- return array(
- new SOAP_Value('outputString','string',$struct['varString']),
- new SOAP_Value('outputInteger','int',$struct['varInt']),
- new SOAP_Value('outputFloat','float',$struct['varFloat'])
- );
- return array_values($struct);
- }
-
- function echoSimpleTypesAsStruct($string, $int, $float)
- {
- # convert a input into struct
- $ret = new SOAP_Value('return','{http://soapinterop.org/xsd}SOAPStruct',
- array( #push struct elements into one soap value
- new SOAP_Value('varString','string',$string),
- new SOAP_Value('varInt','int',(int)$int),
- new SOAP_Value('varFloat','float',(FLOAT)$float)
- )
- );
- return $ret;
- }
-
- function echoNestedStruct($struct)
- {
- return $struct;
- }
-
- function echo2DStringArray($ary)
- {
- $ret = new SOAP_Value('return','Array',$ary);
- $ret->options['flatten'] = TRUE;
- return $ret;
- }
-
- function echoNestedArray($ary)
- {
- return $ary;
- }
-}
-
-$groupb = new SOAP_Interop_GroupB();
-$server->addObjectMap($groupb);
-
-?> \ No newline at end of file
diff --git a/ext/soap/interop/server_round2_groupC.php b/ext/soap/interop/server_round2_groupC.php
deleted file mode 100644
index 02d9804bee..0000000000
--- a/ext/soap/interop/server_round2_groupC.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-require_once 'SOAP/Server.php';
-require_once 'SOAP/Value.php';
-
-class SOAP_Interop_GroupC {
- var $method_namespace = 'http://soapinterop.org/echoheader/';
-
- function echoMeStringRequest($string)
- {
- return new SOAP_Value('{'.$this->method_namespace.'}echoMeStringResponse','string',$string);
- }
-
- function echoMeStructRequest($struct)
- {
- return new SOAP_Value('{'.$this->method_namespace.'}echoMeStructResponse','SOAPStruct',$struct);
- }
-}
-
-$groupc = new SOAP_Interop_GroupC();
-$server->addObjectMap($groupc);
-
-?> \ No newline at end of file
diff --git a/ext/soap/interop/server_round2_test.php b/ext/soap/interop/server_round2_test.php
deleted file mode 100644
index 1158abe563..0000000000
--- a/ext/soap/interop/server_round2_test.php
+++ /dev/null
@@ -1,258 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'SOAP/Server.php';
-
-$server = new SOAP_Server;
-
-require_once 'server_round2_base.php';
-require_once 'server_round2_groupB.php';
-require_once 'server_round2_groupC.php';
-
-$test = '<?xml version="1.0"?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:si="http://soapinterop.org/xsd"
- xmlns:ns6="http://soapinterop.org/echoheader/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<SOAP-ENV:Header>
-
-<ns6:echoMeStringRequest xsi:type="xsd:string" SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:mustUnderstand="0">hello world</ns6:echoMeStringRequest>
-</SOAP-ENV:Header>
-<SOAP-ENV:Body>
-
-<echoVoid></echoVoid>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>';
-
-$test = '<?xml version="1.0"?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:si="http://soapinterop.org/xsd"
- xmlns:ns6="http://soapinterop.org/echoheader/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<SOAP-ENV:Header>
-
-<ns6:echoMeStructRequest xsi:type="si:SOAPStruct"
- SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next"
- SOAP-ENV:mustUnderstand="1">
-<varString xsi:type="xsd:string">arg</varString>
-
-<varInt xsi:type="xsd:int">34</varInt>
-
-<varFloat xsi:type="xsd:float">325.325</varFloat>
-</ns6:echoMeStructRequest>
-</SOAP-ENV:Header>
-<SOAP-ENV:Body>
-
-<echoVoid></echoVoid>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-';
-
-$test = '<?xml version="1.0"?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:si="http://soapinterop.org/xsd"
- xmlns:ns6="http://soapinterop.org/echoheader/"
- xmlns:ns7="http://soapinterop.org/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<SOAP-ENV:Body>
-
-<ns7:echoString>
-<inputString xsi:type="xsd:string"></inputString>
-</ns7:echoString>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-';
-$test = '<?xml version="1.0" encoding="US-ASCII"?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:si="http://soapinterop.org/xsd"
- xmlns:ns6="http://soapinterop.org/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<SOAP-ENV:Body>
-<ns6:echoVoid/>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>';
-
-$test = '<?xml version="1.0" encoding="US-ASCII"?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:si="http://soapinterop.org/xsd"
- xmlns:ns6="http://soapinterop.org/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<SOAP-ENV:Body>
-<ns6:echoIntegerArray><inputIntegerArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:int[3]" SOAP-ENC:offset="[0]"><item xsi:type="xsd:int">1</item>
-<item xsi:type="xsd:int">234324324</item>
-<item xsi:type="xsd:int">2</item>
-</inputIntegerArray>
-</ns6:echoIntegerArray>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>';
-
-#$test = "<S:Envelope
-#S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
-#xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/'
-#xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'
-#xmlns:a='http://soapinterop.org/'
-#xmlns:b='http://soapinterop.org/xsd'
-#xmlns:XS='http://www.w3.org/2001/XMLSchema'
-#xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'>
-#<S:Body>
-#<b:SOAPStruct Enc:root='0' id='21b56c4' XI:type='b:SOAPStruct'>
-#<varInt XI:type='XS:int'>1</varInt>
-#<varFloat XI:type='XS:float'>2</varFloat>
-#<varString XI:type='XS:string'>wilma</varString>
-#</b:SOAPStruct>
-#<a:echoStructArray>
-#<inputStructArray XI:type='Enc:Array' Enc:arrayType='XS:anyType[3]'>
-#<fred href='#21b56c4'/>
-#<i href='#21b56c4'/>
-#<i href='#21b56c4'/>
-#</inputStructArray>
-#</a:echoStructArray>
-#</S:Body></S:Envelope>";
-
-#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:b='http://soapinterop.org/xsd' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoStructArray><inputStructArray XI:type='Enc:Array' Enc:arrayType='b:SOAPStruct[2]'><inputStruct href='#213e654'/> <inputStruct href='#21b8c4c'/> </inputStructArray> </a:echoStructArray> <b:SOAPStruct Enc:root='0' id='21b8c4c' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>-1</varInt> <varFloat XI:type='XS:float'>-1</varFloat> <varString XI:type='XS:string'>lean on into the groove y'all</varString> </b:SOAPStruct> <b:SOAPStruct Enc:root='0' id='213e654' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>1073741824</varInt> <varFloat XI:type='XS:float'>-42.24</varFloat> <varString XI:type='XS:string'>pocketSOAP rocks!&lt;g&gt;</varString> </b:SOAPStruct> </S:Body></S:Envelope>";
-
-#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:b='http://soapinterop.org/' xmlns:a='http://soapinterop.org/headers/' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Header> <a:Transaction S:mustUnderstand='1' XI:type='XS:short'>5</a:Transaction> </S:Header> <S:Body><b:echoString><inputString XI:type='XS:string'>Opps, should never see me</inputString> </b:echoString> </S:Body></S:Envelope>";
-#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:b='http://soapinterop.org/' xmlns:a='http://soapinterop.org/headers/' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Header> <a:Transaction XI:type='XS:short'>5</a:Transaction> </S:Header> <S:Body><b:echoString><inputString XI:type='XS:string'>Opps, should never see me</inputString> </b:echoString> </S:Body></S:Envelope>";
-#$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:Enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:b='http://soapinterop.org/xsd' xmlns:XS='http://www.w3.org/2001/XMLSchema' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoStructAsSimpleTypes><inputStruct href='#213e59c'/> </a:echoStructAsSimpleTypes> <b:SOAPStruct Enc:root='0' id='213e59c' XI:type='b:SOAPStruct'><varInt XI:type='XS:int'>42</varInt> <varString XI:type='XS:string'>Orbital</varString> <varFloat XI:type='XS:float'>-42.42</varFloat> </b:SOAPStruct> </S:Body></S:Envelope>";
-
-// white mesa failures
-/*$test = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><h:echoMeStringRequest SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:mustUnderstand="1" xmlns:h="http://unknown.org/">White Mesa Test Header String.</h:echoMeStringRequest></SOAP-ENV:Header><SOAP-ENV:Body><m:echoVoid SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:m="http://soapinterop.org/" /></SOAP-ENV:Body></SOAP-ENV:Envelope>';
-*/
-/*
-$test = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><h:echoMeStringRequest SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:mustUnderstand="1" xmlns:h="http://unknown.org/">White Mesa Test Header String.</h:echoMeStringRequest></SOAP-ENV:Header><SOAP-ENV:Body><m:echoVoid SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:m="http://soapinterop.org/" /></SOAP-ENV:Body></SOAP-ENV:Envelope>';
-*/
-//$test = "<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:a='http://soapinterop.org/' xmlns:XI='http://www.w3.org/2001/XMLSchema-instance'> <S:Body><a:echoIntegerArray><inputIntegerArray XI:nil='true'></inputIntegerArray> </a:echoIntegerArray> </S:Body></S:Envelope>";
-
-$test = '<?xml version="1.0" encoding="UTF-8"?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:ns4="http://soapinterop.org/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<SOAP-ENV:Body>
-
-<ns4:echo2DStringArray>
-<input2DStringArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[2,3]">
-<item xsi:type="xsd:string">row0col0</item>
-<item xsi:type="xsd:string">row0col1</item>
-<item xsi:type="xsd:string">row0col2</item>
-<item xsi:type="xsd:string">row1col0</item>
-<item xsi:type="xsd:string">row1col1</item>
-<item xsi:type="xsd:string">row1col2</item></input2DStringArray></ns4:echo2DStringArray>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>';
-
-$_SERVER['REQUEST_METHOD'] = "POST";
-$_SERVER['CONTENT_TYPE'] = 'multipart/related; type=text/xml; boundary="=_d624611fe466a88d956a205651c74fdb"';
-
-$test = '--=_d624611fe466a88d956a205651c74fdb
-Content-Type: text/xml; charset="UTF-8"
-Content-Transfer-Encoding: base64
-
-PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCg0KPFNPQVAtRU5WOkVudmVs
-b3BlICB4bWxuczpTT0FQLUVOVj0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZl
-bG9wZS8iDQogIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiDQog
-IHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiDQog
-IHhtbG5zOlNPQVAtRU5DPSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy9zb2FwL2VuY29kaW5n
-LyINCiAgU09BUC1FTlY6ZW5jb2RpbmdTdHlsZT0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcv
-c29hcC9lbmNvZGluZy8iPg0KPFNPQVAtRU5WOkJvZHk+DQoNCjxlY2hvTWltZUF0dGFjaG1lbnQ+
-DQo8dGVzdCBocmVmPSJjaWQ6ZTZiOTg0M2JiYzUxY2JiMDAzOTk0MGVmN2VlNzY2MDMiLz48L2Vj
-aG9NaW1lQXR0YWNobWVudD4NCjwvU09BUC1FTlY6Qm9keT4NCjwvU09BUC1FTlY6RW52ZWxvcGU+
-DQo=
---=_d624611fe466a88d956a205651c74fdb
-Content-Disposition: attachment.php
-Content-Type: text/plain
-Content-Transfer-Encoding: base64
-Content-ID: <e6b9843bbc51cbb0039940ef7ee76603>
-
-PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
-QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
-Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
-Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
-dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
-DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
-cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
-X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
-KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
-Ow0KcHJpbnRfcigkcmVzcCk7DQpwcmludCAkY2xpZW50LT53aXJlOw0KPz4=
---=_d624611fe466a88d956a205651c74fdb--';
-
-$_SERVER['CONTENT_TYPE'] = 'multipart/related; type=text/xml; boundary="=_a2cbb051424cc43e72d3c8c8d0b8f70e"';
-$test='--=_a2cbb051424cc43e72d3c8c8d0b8f70e
-Content-Type: text/xml; charset="UTF-8"
-
-<?xml version="1.0" encoding="UTF-8"?>
-
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<SOAP-ENV:Body>
-
-<echoMimeAttachment>
-<test href="cid:a223fea3c35b5f0e6dedf8da75efd6b3"/></echoMimeAttachment>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-
---=_a2cbb051424cc43e72d3c8c8d0b8f70e
-Content-Disposition: attachment.php
-Content-Type: text/plain
-Content-Transfer-Encoding: base64
-Content-ID: <a223fea3c35b5f0e6dedf8da75efd6b3>
-
-PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
-QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
-Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
-Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
-dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
-DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
-cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
-X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
-KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
-Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
---=_a2cbb051424cc43e72d3c8c8d0b8f70e--
-';
-$server->service($test, '',TRUE);
-print $server->response;
-?> \ No newline at end of file
diff --git a/ext/soap/interop/test.utility.php b/ext/soap/interop/test.utility.php
deleted file mode 100644
index 9af61c22fb..0000000000
--- a/ext/soap/interop/test.utility.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-require_once("SOAP/Parser.php");
-require_once("SOAP/Value.php");
-
-function number_compare($f1, $f2)
-{
- # figure out which has the least fractional digits
- preg_match('/.*?\.(.*)/',$f1,$m1);
- preg_match('/.*?\.(.*)/',$f2,$m2);
- #print_r($m1);
- # always use at least 2 digits of precision
- $d = max(min(strlen(count($m1)?$m1[1]:'0'),strlen(count($m2)?$m2[1]:'0')),2);
- $f1 = round($f1, $d);
- $f2 = round($f2, $d);
- return bccomp($f1, $f2, $d) == 0;
-}
-
-function boolean_compare($f1, $f2)
-{
- if (($f1 == 'true' || $f1 === TRUE || $f1 != 0) &&
- ($f2 == 'true' || $f2 === TRUE || $f2 != 0)) return TRUE;
- if (($f1 == 'false' || $f1 === FALSE || $f1 == 0) &&
- ($f2 == 'false' || $f2 === FALSE || $f2 == 0)) return TRUE;
- return FALSE;
-}
-
-function string_compare($e1, $e2)
-{
- if (is_numeric($e1) && is_numeric($e2)) {
- return number_compare($e1, $e2);
- }
- # handle dateTime comparison
- $e1_type = gettype($e1);
- $e2_type = gettype($e2);
- $ok = FALSE;
- if ($e1_type == "string") {
- $dt = new SOAP_Type_dateTime();
- $ok = $dt->compare($e1, $e2) == 0;
- }
- return $ok || $e1 == $e2 || strcasecmp(trim($e1), trim($e2)) == 0;
-}
-
-function array_compare(&$ar1, &$ar2)
-{
- if (gettype($ar1) != 'array' || gettype($ar2) != 'array') return FALSE;
- # first a shallow diff
- if (count($ar1) != count($ar2)) return FALSE;
- $diff = array_diff($ar1, $ar2);
- if (count($diff) == 0) return TRUE;
-
- # diff failed, do a full check of the array
- foreach ($ar1 as $k => $v) {
- #print "comparing $v == $ar2[$k]\n";
- if (gettype($v) == "array") {
- if (!array_compare($v, $ar2[$k])) return FALSE;
- } else {
- if (!string_compare($v, $ar2[$k])) return FALSE;
- }
- }
- return TRUE;
-}
-
-
-function parseMessage($msg)
-{
- # strip line endings
- #$msg = preg_replace('/\r|\n/', ' ', $msg);
- $response = new SOAP_Parser($msg);
- if ($response->fault) {
- return $response->fault->getFault();
- }
- $return = $response->getResponse();
- $v = $response->decode($return);
- if (gettype($v) == 'array' && count($v)==1) {
- return array_shift($v);
- }
- return $v;
-}
-
-
-?> \ No newline at end of file
diff --git a/ext/soap/interop/testclient.php b/ext/soap/interop/testclient.php
deleted file mode 100644
index b70c628ee5..0000000000
--- a/ext/soap/interop/testclient.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<html><body>
-<?
-error_reporting(2039);
-include("SOAP/Client.php");
-
-$txt = "Bjoern";
-
-$soapc = new SOAP_Client("http://localhost/soap_interop/testserver.php");
-$soapc->debug_flag = TRUE;
-print_r($soapc->call("testMethod",array("txt" => $txt)));
-print "<br>Debug: ";
-print $soapc->wire;
-print "<br><br>";
-unset($soapc);
-
-?>
-</html></body> \ No newline at end of file
diff --git a/ext/soap/interop/testserver.php b/ext/soap/interop/testserver.php
deleted file mode 100644
index 03973c8863..0000000000
--- a/ext/soap/interop/testserver.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-include "SOAP/Server.php";
-
-function testMethod($arg) {
- if ($arg != "") {
- return crypt($arg);
- } else {
- return "Please supply a text";
- }
-}
-
-$server = new soap_server();
-
-$server->addToMap("testMethod",array("string"),array("string"));
-$server->service($HTTP_RAW_POST_DATA);
-echo "<!-- this is a test -->";
-?> \ No newline at end of file
diff --git a/ext/soap/libs.mk b/ext/soap/libs.mk
deleted file mode 100644
index 7c6e176717..0000000000
--- a/ext/soap/libs.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-include $(top_builddir)/config_vars.mk
-LTLIBRARY_OBJECTS = $(LTLIBRARY_SOURCES:.c=.lo) $(LTLIBRARY_OBJECTS_X)
-LTLIBRARY_SHARED_OBJECTS = $(LTLIBRARY_OBJECTS:.lo=.slo)
-$(LTLIBRARY_NAME): $(LTLIBRARY_OBJECTS) $(LTLIBRARY_DEPENDENCIES)
- $(LINK) $(LTLIBRARY_LDFLAGS) $(LTLIBRARY_OBJECTS) $(LTLIBRARY_LIBADD)
-
-targets = $(LTLIBRARY_NAME)
diff --git a/ext/soap/package.xml b/ext/soap/package.xml
deleted file mode 100644
index 34c0395dcf..0000000000
--- a/ext/soap/package.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!-- do not use the "Type" attribute here, that one is only for
- generated package.xml files -->
-<package>
- <name>soap</name>
- <summary>Provides SOAP Services</summary>
- <description>
- Description of package....
- </description>
- <status>beta</status>
- <maintainers>
- <maintainer>
- <user>rodif_bl</user>
- <name>Brad Lafountain</name>
- <email>rodif_bl@yahoo.com</email>
- <role>lead</role>
- </maintainer>
- <maintainer>
- <user>shane</user>
- <name>Shane Caraveo</name>
- <email>shane@caraveo.com</email>
- <role>lead</role>
- </maintainer>
- </maintainers>
- <license>PHP</license>
- <release>
- <version>0.1</version>
- <date>2002-07-07</date>
- <state>alpha</state>
- <notes>
- - First offical PEAR/PECL release
- </notes>
- </release>
- <filelist>
- <dir name="/">
- <file role="doc">EXPERIMENTAL</file>
- <file role="doc">TODO</file>
- <file role="src">config.m4</file>
- <file role="src">Makefile</file>
- <file role="src">Makefile.in</file>
- <file role="src">libs.mk</file>
- <file role="src">php_encoding.c</file>
- <file role="src">php_encoding.h</file>
- <file role="src">php_http.c</file>
- <file role="src">php_http.h</file>
- <file role="src">php_packet_soap.c</file>
- <file role="src">php_packet_soap.h</file>
- <file role="src">php_schema.c</file>
- <file role="src">php_schema.h</file>
- <file role="src">php_sdl.c</file>
- <file role="src">php_sdl.h</file>
- <file role="src">php_soap.h</file>
- <file role="src">php_soap.h</file>
- <file role="src">php_xml.c</file>
- <file role="src">php_xml.h</file>
- <file role="src">soap.c</file>
- <file role="src">soap.dsp</file>
- </dir>
- </filelist>
-</package>
-
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
deleted file mode 100644
index d48bccc918..0000000000
--- a/ext/soap/php_encoding.c
+++ /dev/null
@@ -1,1125 +0,0 @@
-#include <time.h>
-
-#include "php_soap.h"
-
-encode defaultEncoding[] = {
- {{UNKNOWN_TYPE, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert},
-
- {{IS_NULL, "null", "null", NULL}, to_zval_null, to_xml_null},
- {{IS_STRING, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
- {{IS_LONG, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{IS_DOUBLE, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
- {{IS_BOOL, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
- {{IS_CONSTANT, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
- {{IS_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_ENC_NAMESPACE, NULL}, to_zval_array, guess_array_map},
- {{IS_CONSTANT_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_ENC_NAMESPACE, NULL}, to_zval_array, to_xml_array},
- {{IS_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_ENC_NAMESPACE, NULL}, to_zval_object, to_xml_object},
-
- {{XSD_STRING, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
- {{XSD_BOOLEAN, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
- {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
- {{XSD_FLOAT, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
- {{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
- {{XSD_DATETIME, XSD_DATETIME_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_datetime},
- {{XSD_TIME, XSD_TIME_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_time},
- {{XSD_DATE, XSD_DATE_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_date},
- {{XSD_GYEARMONTH, XSD_GYEARMONTH_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gyearmonth},
- {{XSD_GYEAR, XSD_GYEAR_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gyear},
- {{XSD_GMONTHDAY, XSD_GMONTHDAY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gmonthday},
- {{XSD_GDAY, XSD_GDAY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gday},
- {{XSD_GMONTH, XSD_GMONTH_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gmonth},
- {{XSD_HEXBINARY, XSD_HEXBINARY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_stringl},
- {{XSD_BASE64BINARY, XSD_BASE64BINARY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_stringl},
-
- {{XSD_LONG, XSD_LONG_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_INT, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_string},
- {{XSD_SHORT, XSD_SHORT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_string},
-
- {{APACHE_MAP, APACHE_MAP_STRING, APACHE_NAMESPACE, NULL}, to_zval_map, to_xml_map},
-
- {{SOAP_ENC_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_ENC_NAMESPACE, NULL}, to_zval_object, to_xml_object},
- {{SOAP_ENC_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_ENC_NAMESPACE, NULL}, to_zval_array, to_xml_array},
-
- //support some of the 1999 data types
- {{XSD_STRING, XSD_STRING_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_string, to_xml_string},
- {{XSD_BOOLEAN, XSD_BOOLEAN_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
- {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_string},
- {{XSD_FLOAT, XSD_FLOAT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_string},
- {{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_string},
- {{XSD_LONG, XSD_LONG_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
- {{XSD_INT, XSD_INT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_string},
- {{XSD_SHORT, XSD_SHORT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_string},
- {{XSD_1999_TIMEINSTANT, XSD_1999_TIMEINSTANT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_string, to_xml_string},
-
- {{END_KNOWN_TYPES, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert}
-
-//TODO: finish off encoding
-/*
-#define XSD_DURATION 107
-#define XSD_DURATION_STRING "duration"
-#define XSD_ANYURI 118
-#define XSD_ANYURI_STRING "anyURI"
-#define XSD_QNAME 119
-#define XSD_QNAME_STRING "QName"
-#define XSD_NOTATION 120
-#define XSD_NOTATION_STRING "NOTATION"
-*/
-
-/*
-#define XSD_NORMALIZEDSTRING 121
-#define XSD_NORMALIZEDSTRING_STRING "normalizedString"
-#define XSD_TOKEN 122
-#define XSD_TOKEN_STRING "token"
-#define XSD_LANGUAGE 123
-#define XSD_LANGUAGE_STRING "language"
-#define XSD_NMTOKEN 124
-#define XSD_NMTOKEN_STRING "NMTOKEN"
-#define XSD_NAME 124
-#define XSD_NAME_STRING "Name"
-#define XSD_NCNAME 125
-#define XSD_NCNAME_STRING "NCName"
-#define XSD_ID 126
-#define XSD_ID_STRING "ID"
-#define XSD_IDREF 127
-#define XSD_IDREF_STRING "IDREF"
-#define XSD_IDREFS 127
-#define XSD_IDREFS_STRING "IDREFS"
-#define XSD_ENTITY 128
-#define XSD_ENTITY_STRING "ENTITY"
-#define XSD_ENTITYS 129
-#define XSD_ENTITYS_STRING "ENTITYS"
-#define XSD_INTEGER 130
-#define XSD_INTEGER_STRING "integer"
-#define XSD_NONPOSITIVEINTEGER 131
-#define XSD_NONPOSITIVEINTEGER_STRING "nonPositiveInteger"
-#define XSD_NEGATIVEINTEGER 132
-#define XSD_NEGATIVEINTEGER_STRING "negativeInteger"
-#define XSD_NONNEGATIVEINTEGER 137
-#define XSD_NONNEGATIVEINTEGER_STRING "nonNegativeInteger"
-#define XSD_UNSIGNEDLONG 138
-#define XSD_UNSIGNEDLONG_STRING "unsignedLong"
-#define XSD_UNSIGNEDINT 139
-#define XSD_UNSIGNEDINT_STRING "unsignedInt"
-#define XSD_UNSIGNEDSHORT 140
-#define XSD_UNSIGNEDSHORT_STRING "unsignedShort"
-#define XSD_UNSIGNEDBYTE 141
-#define XSD_UNSIGNEDBYTE_STRING "unsignedByte"
-#define XSD_POSITIVEINTEGER 142
-#define XSD_POSITIVEINTEGER_STRING "positiveInteger"
-*/
-};
-
-xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style)
-{
- xmlNodePtr node;
-
- if(encode->to_xml_before)
- data = encode->to_xml_before(encode->details, data);
- if(encode->to_xml)
- node = encode->to_xml(encode->details, data, style);
- if(encode->to_xml_after)
- node = encode->to_xml_after(encode->details, node, style);
-
- return node;
-}
-
-zval *master_to_zval(encodePtr encode, xmlNodePtr data)
-{
- zval *ret;
-
- data = check_and_resolve_href(data);
- if(encode->to_zval_before)
- data = encode->to_zval_before(encode->details, data, 0);
- if(encode->to_zval)
- ret = encode->to_zval(encode->details, data);
- if(encode->to_zval_after)
- ret = encode->to_zval_after(encode->details, ret);
-
- return ret;
-}
-
-#ifdef HAVE_PHP_DOMXML
-zval *to_xml_before_user(encodeType type, zval *data)
-{
- TSRMLS_FETCH();
-
- if(type.map->map_functions.to_xml_before)
- {
- if(call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml_before, data, 1, &data TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Error calling to_xml_before");
- }
- return data;
-}
-
-xmlNodePtr to_xml_user(encodeType type, zval *data, int style)
-{
- zval *ret, **addr;
- xmlNodePtr node;
- TSRMLS_FETCH();
-
- if(type.map->map_functions.to_xml)
- {
- MAKE_STD_ZVAL(ret);
- if(call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml, ret, 1, &data TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Error calling to_xml");
-
- if(Z_TYPE_P(ret) != IS_OBJECT)
- php_error(E_ERROR, "Error serializing object from to_xml_user");
-
- if(zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS)
- {
- node = (xmlNodePtr)Z_LVAL_PP(addr);
- node = xmlCopyNode(node, 1);
- set_ns_and_type(node, type);
- }
- zval_ptr_dtor(&ret);
- }
- return node;
-}
-
-xmlNodePtr to_xml_after_user(encodeType type, xmlNodePtr node, int style)
-{
- zval *ret, *param, **addr;
- int found;
- TSRMLS_FETCH();
-
- if(type.map->map_functions.to_xml_after)
- {
- MAKE_STD_ZVAL(ret);
- MAKE_STD_ZVAL(param);
- param = php_domobject_new(node, &found, NULL TSRMLS_CC);
-
- if(call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml_after, ret, 1, &param TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Error calling to_xml_after");
- if(zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS)
- {
- node = (xmlNodePtr)Z_LVAL_PP(addr);
- set_ns_and_type(node, type);
- }
- zval_ptr_dtor(&ret);
- zval_ptr_dtor(&param);
- }
- return node;
-}
-
-xmlNodePtr to_zval_before_user(encodeType type, xmlNodePtr node, int style)
-{
- zval *ret, *param, **addr;
- int found;
- TSRMLS_FETCH();
-
- if(type.map->map_functions.to_zval_before)
- {
- MAKE_STD_ZVAL(ret);
- MAKE_STD_ZVAL(param);
- param = php_domobject_new(node, &found, NULL TSRMLS_CC);
-
- if(call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval_before, ret, 1, &param TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Error calling to_zval_before");
- if(zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS)
- {
- node = (xmlNodePtr)Z_LVAL_PP(addr);
- set_ns_and_type(node, type);
- }
- zval_ptr_dtor(&ret);
- zval_ptr_dtor(&param);
- }
- return node;
-}
-
-zval *to_zval_user(encodeType type, xmlNodePtr node)
-{
- zval *ret, *param;
- int found;
- TSRMLS_FETCH();
-
- if(type.map->map_functions.to_zval)
- {
- MAKE_STD_ZVAL(ret);
- MAKE_STD_ZVAL(param);
- param = php_domobject_new(node, &found, NULL TSRMLS_CC);
-
- if(call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval, ret, 1, &param TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Error calling to_zval");
- zval_ptr_dtor(&param);
- }
- return ret;
-}
-
-zval *to_zval_after_user(encodeType type, zval *data)
-{
- TSRMLS_FETCH();
-
- if(type.map->map_functions.to_zval_after)
- {
- if(call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval_after, data, 1, &data TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Error calling to_xml_before");
- }
- return data;
-}
-#endif
-
-//TODO: get rid of "bogus".. ither by passing in the already created xmlnode or passing in the node name
-//String encode/decode
-zval *to_zval_string(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- if(data && data->children)
- ZVAL_STRING(ret, data->children->content, 1);
- return ret;
-}
-
-zval *to_zval_stringl(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- if(data && data->children)
- ZVAL_STRINGL(ret, data->children->content, xmlStrlen(data->children->content), 1);
- return ret;
-}
-
-xmlNodePtr to_xml_string(encodeType type, zval *data, int style)
-{
- xmlNodePtr ret;
- char *str;
- int new_len;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret);
-
- convert_to_string(data);
- str = php_escape_html_entities(Z_STRVAL_P(data), Z_STRLEN_P(data), &new_len, 0, 0, NULL);
- xmlNodeSetContentLen(ret, str, new_len);
-
- if(style == SOAP_ENCODED)
- set_ns_and_type(ret, type);
- return ret;
-}
-
-xmlNodePtr to_xml_stringl(encodeType type, zval *data, int style)
-{
- xmlNodePtr ret;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret);
-
- convert_to_string(data);
- xmlNodeSetContentLen(ret, estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data)), Z_STRLEN_P(data));
-
- if(style == SOAP_ENCODED)
- set_ns_and_type(ret, type);
- return ret;
-}
-
-zval *to_zval_double(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- ZVAL_DOUBLE(ret, atof(data->children->content));
- return ret;
-}
-
-zval *to_zval_long(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- ZVAL_LONG(ret, atol(data->children->content));
- return ret;
-}
-
-xmlNodePtr to_xml_long(encodeType type, zval *data, int style)
-{
- xmlNodePtr ret;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret);
-
- convert_to_long(data);
- convert_to_string(data);
- xmlNodeSetContentLen(ret, Z_STRVAL_P(data), Z_STRLEN_P(data));
-
- if(style == SOAP_ENCODED)
- set_ns_and_type(ret, type);
- return ret;
-}
-
-zval *to_zval_bool(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- if(stricmp(data->children->content,"true") == 0 ||
- stricmp(data->children->content,"t") == 0 ||
- strcmp(data->children->content,"1") == 0)
- {
- ZVAL_BOOL(ret, 1);
- }
- else
- {
- ZVAL_BOOL(ret, 0);
- }
- return ret;
-}
-
-xmlNodePtr to_xml_bool(encodeType type, zval *data, int style)
-{
- xmlNodePtr ret;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret);
-
- convert_to_boolean(data);
- if(data->value.lval == 1)
- xmlNodeSetContent(ret, "1");
- else
- xmlNodeSetContent(ret, "0");
-
- if(style == SOAP_ENCODED)
- set_ns_and_type(ret, type);
- return ret;
-}
-
-//Null encode/decode
-zval *to_zval_null(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- ZVAL_NULL(ret);
- return ret;
-}
-
-xmlNodePtr to_xml_null(encodeType type, zval *data, int style)
-{
- xmlNodePtr ret;
-
- ret = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, ret);
-
- if(style == SOAP_ENCODED)
- xmlSetProp(ret, "xsi:null", "1");
- return ret;
-}
-
-//Struct encode/decode
-zval *to_zval_object(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- xmlNodePtr trav;
- encodePtr enc;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- object_init(ret);
- trav = data->children;
-
- enc = get_conversion(UNKNOWN_TYPE);
- do
- {
- if(trav->type == XML_ELEMENT_NODE)
- {
- zval *tmpVal;
-
- tmpVal = master_to_zval(enc, trav);
- add_property_zval(ret, (char *)trav->name, tmpVal);
- }
- }
- while(trav = trav->next);
-
- return ret;
-}
-
-xmlNodePtr to_xml_object(encodeType type, zval *data, int style)
-{
- xmlNodePtr xmlParam;
- HashTable *prop;
- int i;
- TSRMLS_FETCH();
-
- //Special handling of class SoapVar
- if(data && Z_TYPE_P(data) == IS_OBJECT && !strcmp(Z_OBJCE_P(data)->name, soap_var_class_entry.name))
- {
- zval **ztype, **zdata, **zns, **zstype, **zname, **znamens;
- encodePtr enc;
-
- if(zend_hash_find(Z_OBJPROP_P(data), "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE)
- php_error(E_ERROR, "error encoding SoapVar");
- if(zend_hash_find(Z_OBJPROP_P(data), "enc_value", sizeof("enc_value"), (void **)&zdata) == FAILURE)
- php_error(E_ERROR, "error encoding SoapVar");
-
- enc = get_conversion(Z_LVAL_P(*ztype));
- xmlParam = master_to_xml(enc, *zdata, style);
-
- if(zend_hash_find(Z_OBJPROP_P(data), "enc_stype", sizeof("enc_stype"), (void **)&zstype) == SUCCESS)
- {
- if(zend_hash_find(Z_OBJPROP_P(data), "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS)
- set_ns_and_type_ex(xmlParam, Z_STRVAL_PP(zns), Z_STRVAL_PP(zstype));
- else
- set_ns_and_type_ex(xmlParam, NULL, Z_STRVAL_PP(zstype));
- }
-
- if(zend_hash_find(Z_OBJPROP_P(data), "enc_name", sizeof("enc_name"), (void **)&zname) == SUCCESS)
- xmlNodeSetName(xmlParam, Z_STRVAL_PP(zname));
- if(zend_hash_find(Z_OBJPROP_P(data), "enc_namens", sizeof("enc_namens"), (void **)&znamens) == SUCCESS)
- {
- smart_str *ns;
- xmlNsPtr nsp;
-
- ns = encode_new_ns();
- nsp = xmlNewNs(xmlParam, Z_STRVAL_PP(znamens), ns->c);
- xmlSetNs(xmlParam, nsp);
- smart_str_free(ns);
- efree(ns);
- }
- }
- else
- {
- xmlParam = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, xmlParam);
-
- if(Z_TYPE_P(data) == IS_OBJECT)
- {
- prop = Z_OBJPROP_P(data);
- i = zend_hash_num_elements(prop);
- zend_hash_internal_pointer_reset(prop);
-
- for(;i > 0;i--)
- {
- xmlNodePtr property;
- encodePtr enc;
- zval **zprop;
- char *str_key;
-
- zend_hash_get_current_key(prop, &str_key, NULL, FALSE);
- zend_hash_get_current_data(prop, (void **)&zprop);
-
- enc = get_conversion((*zprop)->type);
- property = master_to_xml(enc, (*zprop), style);
-
- xmlNodeSetName(property, str_key);
- xmlAddChild(xmlParam, property);
- zend_hash_move_forward(prop);
- }
- }
-
- if(style == SOAP_ENCODED)
- set_ns_and_type(xmlParam, type);
- }
- return xmlParam;
-}
-
-//Array encode/decode
-xmlNodePtr guess_array_map(encodeType type, zval *data, int style)
-{
- encodePtr enc = NULL;
- TSRMLS_FETCH();
-
- if(data && Z_TYPE_P(data) == IS_ARRAY)
- {
- if(zend_hash_num_elements(Z_ARRVAL_P(data)) > 0)
- {
- if(is_map(data))
- enc = get_conversion(APACHE_MAP);
- else
- enc = get_conversion(SOAP_ENC_ARRAY);
- }
- }
- if(!enc)
- enc = get_conversion(IS_NULL);
-
- return master_to_xml(enc, data, style);
-}
-
-xmlNodePtr to_xml_array(encodeType type, zval *data, int style)
-{
- smart_str array_type_and_size = {0}, array_type = {0};
- int i;
- xmlNodePtr xmlParam;
- TSRMLS_FETCH();
-
- xmlParam = xmlNewNode(NULL,"BOGUS");
-
- FIND_ZVAL_NULL(data, xmlParam);
-
- if(Z_TYPE_P(data) == IS_ARRAY)
- {
- i = zend_hash_num_elements(Z_ARRVAL_P(data));
-
- if(style == SOAP_ENCODED)
- {
- get_array_type(data, &array_type);
- smart_str_append(&array_type_and_size, &array_type);
- smart_str_appendc(&array_type_and_size, '[');
- smart_str_append_long(&array_type_and_size, i);
- smart_str_appendc(&array_type_and_size, ']');
- smart_str_0(&array_type_and_size);
-
- xmlSetProp(xmlParam, "SOAP-ENC:arrayType", array_type_and_size.c);
-
- smart_str_free(&array_type_and_size);
- smart_str_free(&array_type);
- }
-
- zend_hash_internal_pointer_reset(data->value.ht);
- for(;i > 0;i--)
- {
- xmlNodePtr xparam;
- zval **zdata;
- encodePtr enc;
- zend_hash_get_current_data(data->value.ht, (void **)&zdata);
-
- enc = get_conversion((*zdata)->type);
- xparam = master_to_xml(enc, (*zdata), style);
-
- if(style == SOAP_LITERAL)
- xmlNodeSetName(xparam, enc->details.type_str);
- else
- xmlNodeSetName(xparam, "val");
-
- xmlAddChild(xmlParam, xparam);
- zend_hash_move_forward(data->value.ht);
- }
- }
- if(style == SOAP_ENCODED)
- set_ns_and_type(xmlParam, type);
- return xmlParam;
-}
-
-zval *to_zval_array(encodeType type, xmlNodePtr data)
-{
- zval *ret;
- xmlNodePtr trav;
- encodePtr enc;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- array_init(ret);
- trav = data->children;
-
- enc = get_conversion(UNKNOWN_TYPE);
- while(trav)
- {
- if(trav->type == XML_ELEMENT_NODE)
- {
- zval *tmpVal;
- tmpVal = master_to_zval(enc, trav);
- zend_hash_next_index_insert(Z_ARRVAL_P(ret), &tmpVal, sizeof(zval *), NULL);
- }
- trav = trav->next;
- }
-
- return ret;
-}
-
-//Map encode/decode
-xmlNodePtr to_xml_map(encodeType type, zval *data, int style)
-{
- xmlNodePtr xmlParam;
- int i;
- TSRMLS_FETCH();
-
- xmlParam = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, xmlParam);
-
- if(Z_TYPE_P(data) == IS_ARRAY)
- {
- i = zend_hash_num_elements(Z_ARRVAL_P(data));
- //TODO: Register namespace...???
- xmlSetProp(xmlParam, "xmlns:apache", "http://xml.apache.org/xml-soap");
- zend_hash_internal_pointer_reset(data->value.ht);
- for(;i > 0;i--)
- {
- xmlNodePtr xparam, item;
- xmlNodePtr key;
- zval **temp_data;
- char *key_val;
- int int_val;
- encodePtr enc;
-
- zend_hash_get_current_data(data->value.ht, (void **)&temp_data);
- if(Z_TYPE_PP(temp_data) != IS_NULL)
- {
- item = xmlNewNode(NULL, "item");
- key = xmlNewNode(NULL, "key");
- if(zend_hash_get_current_key(data->value.ht, &key_val, (long *)&int_val, FALSE) == HASH_KEY_IS_STRING)
- {
- if(style == SOAP_ENCODED)
- xmlSetProp(key, "xsi:type", "xsd:string");
- xmlNodeSetContent(key, key_val);
- }
- else
- {
- smart_str tmp = {0};
- smart_str_append_long(&tmp, int_val);
- smart_str_0(&tmp);
-
- if(style == SOAP_ENCODED)
- xmlSetProp(key, "xsi:type", "xsd:int");
- xmlNodeSetContentLen(key, tmp.c, tmp.len);
-
- smart_str_free(&tmp);
- }
-
-
- enc = get_conversion((*temp_data)->type);
- xparam = master_to_xml(enc, (*temp_data), style);
-
- xmlNodeSetName(xparam, "value");
- xmlAddChild(item, key);
- xmlAddChild(item, xparam);
- xmlAddChild(xmlParam, item);
- }
- zend_hash_move_forward(data->value.ht);
- }
- }
- if(style == SOAP_ENCODED)
- set_ns_and_type(xmlParam, type);
-
- return xmlParam;
-}
-
-zval *to_zval_map(encodeType type, xmlNodePtr data)
-{
- zval *ret, *key, *value;
- xmlNodePtr trav, item, xmlKey, xmlValue;
- encodePtr enc;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(ret);
- FIND_XML_NULL(data, ret);
-
- array_init(ret);
- trav = data->children;
-
- enc = get_conversion(UNKNOWN_TYPE);
- trav = data->children;
- FOREACHNODE(trav, "item", item)
- {
- xmlKey = get_node(item->children, "key");
- if(!xmlKey)
- php_error(E_ERROR, "Error encoding apache map, missing key");
-
- xmlValue = get_node(item->children, "value");
- if(!xmlKey)
- php_error(E_ERROR, "Error encoding apache map, missing value");
-
- key = master_to_zval(enc, xmlKey);
- value = master_to_zval(enc, xmlValue);
-
- if(Z_TYPE_P(key) == IS_STRING)
- zend_hash_update(Z_ARRVAL_P(ret), Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL);
- else if(Z_TYPE_P(key) == IS_LONG)
- zend_hash_index_update(Z_ARRVAL_P(ret), Z_LVAL_P(key), &value, sizeof(zval *), NULL);
- else
- php_error(E_ERROR, "Error encoding apache map, only Strings or Longs are allowd as keys");
- }
- ENDFOREACH(trav);
-
- return ret;
-}
-
-//Unknown encode/decode
-xmlNodePtr guess_xml_convert(encodeType type, zval *data, int style)
-{
- encodePtr enc;
- TSRMLS_FETCH();
-
- if(data)
- enc = get_conversion(data->type);
- else
- enc = get_conversion(IS_NULL);
- return master_to_xml(enc, data, style);
-}
-
-zval *guess_zval_convert(encodeType type, xmlNodePtr data)
-{
- encodePtr enc = NULL;
- xmlAttrPtr tmpattr;
- TSRMLS_FETCH();
-
- data = check_and_resolve_href(data);
-
- if(data == NULL || data->children == NULL)
- enc = get_conversion(IS_NULL);
- else
- {
- tmpattr = get_attribute(data->properties,"type");
- if(tmpattr != NULL)
- {
- enc = get_conversion_from_type(data, tmpattr->children->content);
- // if(enc == NULL)
- // php_error(E_ERROR, "Error (Don't know how to encode/decode \"%s\")", tmpattr->children->content);
- }
-
- if(enc == NULL)
- {
- //Didn't have a type, totally guess here
- //Logic: has children = IS_OBJECT else IS_STRING
- xmlNodePtr trav;
-
- if(get_attribute(data->properties, "arrayType"))
- enc = get_conversion(SOAP_ENC_ARRAY);
- else
- {
- enc = get_conversion(XSD_STRING);
- trav = data->children;
- do
- {
- if(trav->type == XML_ELEMENT_NODE)
- {
- enc = get_conversion(SOAP_ENC_OBJECT);
- break;
- }
- }
- while(trav = trav->next);
- }
- }
- }
- return master_to_zval(enc, data);
-}
-
-//Time encode/decode
-xmlNodePtr to_xml_datetime_ex(encodeType type, zval *data, char *format, int style)
-{
- //logic hacked from ext/standard/datetime.c
- struct tm *ta, tmbuf;
- time_t timestamp;
- int max_reallocs = 5;
- size_t buf_len=64, real_len;
- char *buf;
- xmlNodePtr xmlParam;
-
- xmlParam = xmlNewNode(NULL, "BOGUS");
- FIND_ZVAL_NULL(data, xmlParam);
-
- timestamp = Z_LVAL_P(data);
-
- time(&timestamp);
- ta = php_localtime_r(&timestamp, &tmbuf);
-
- buf = (char *) emalloc(buf_len);
- while ((real_len = strftime(buf, buf_len, format, ta)) == buf_len || real_len == 0)
- {
- buf_len *= 2;
- buf = (char *) erealloc(buf, buf_len);
- if(!--max_reallocs) break;
- }
-
- xmlNodeSetContent(xmlParam, buf);
- efree(buf);
-
- if(style == SOAP_ENCODED)
- set_ns_and_type(xmlParam, type);
- return xmlParam;
-}
-
-xmlNodePtr to_xml_datetime(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%Y-%m-%dT%H:%M:%S", style);
-}
-
-xmlNodePtr to_xml_time(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%H:%M:%S", style);
-}
-
-xmlNodePtr to_xml_date(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%Y-%m-%d", style);
-}
-
-xmlNodePtr to_xml_gyearmonth(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%Y-%m", style);
-}
-
-xmlNodePtr to_xml_gyear(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%Y", style);
-}
-
-xmlNodePtr to_xml_gmonthday(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "--%m-%d", style);
-}
-
-xmlNodePtr to_xml_gday(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%d", style);
-}
-
-xmlNodePtr to_xml_gmonth(encodeType type, zval *data, int style)
-{
- return to_xml_datetime_ex(type, data, "%m", style);
-}
-
-void set_ns_and_type(xmlNodePtr node, encodeType type)
-{
- set_ns_and_type_ex(node, type.ns, type.type_str);
-}
-
-void set_ns_and_type_ex(xmlNodePtr node, char *ns, char *type)
-{
- if(ns != NULL)
- {
- char *sprefix;
- smart_str *prefix;
- smart_str xmlns = {0}, nstype = {0};
-
- TSRMLS_FETCH();
-
- if(zend_hash_find(SOAP_GLOBAL(defEncNs), ns, strlen(ns) + 1, (void **)&sprefix) == FAILURE)
- {
- prefix = encode_new_ns();
- smart_str_appendl(&xmlns, "xmlns:", 6);
- smart_str_append(&xmlns, prefix);
- smart_str_0(&xmlns);
-
- xmlSetProp(node, xmlns.c, ns);
- }
- else
- {
- prefix = emalloc(sizeof(smart_str));
- memset(prefix, 0, sizeof(smart_str));
- smart_str_appends(prefix, sprefix);
- }
-
- smart_str_append(&nstype, prefix);
- smart_str_appendc(&nstype, ':');
- smart_str_appends(&nstype, type);
- smart_str_0(&nstype);
- xmlSetProp(node, "xsi:type", nstype.c);
- smart_str_free(&nstype);
- smart_str_free(&xmlns);
- smart_str_free(prefix);
- efree(prefix);
- }
- else
- xmlSetProp(node, "xsi:type", type);
-}
-
-smart_str *encode_new_ns()
-{
- int num;
- smart_str *ns = emalloc(sizeof(smart_str));
-
- TSRMLS_FETCH();
-
- memset(ns, 0, sizeof(smart_str));
- num = ++SOAP_GLOBAL(cur_uniq_ns);
- smart_str_appendl(ns, "ns", 2);
- smart_str_append_long(ns, num);
- smart_str_0(ns);
- return ns;
-}
-
-void encode_reset_ns()
-{
- TSRMLS_FETCH();
- SOAP_GLOBAL(cur_uniq_ns) = 0;
-}
-
-encodePtr get_conversion_ex(HashTable *encoding, int encode)
-{
- encodePtr *enc;
- TSRMLS_FETCH();
-
- if(zend_hash_index_find(encoding, encode, (void **)&enc) == FAILURE)
- php_error(E_ERROR, "Cannot find encoding");
-
- if(SOAP_GLOBAL(overrides))
- {
- smart_str nscat = {0};
-
- smart_str_appendl(&nscat, (*enc)->details.ns, strlen((*enc)->details.ns));
- smart_str_appendc(&nscat, ':');
- smart_str_appendl(&nscat, (*enc)->details.type_str, strlen((*enc)->details.type_str));
- smart_str_0(&nscat);
-
- zend_hash_find(SOAP_GLOBAL(overrides), nscat.c, nscat.len + 1, (void **)&enc);
- smart_str_free(&nscat);
- }
-
- return *enc;
-}
-
-encodePtr get_conversion_from_href_type_ex(HashTable *encoding, char *type, int len)
-{
- encodePtr *enc = NULL;
-
- if(encoding == NULL)
- return NULL;
-
- if(zend_hash_find(encoding, type, len + 1, (void **)&enc) == FAILURE)
- return NULL;
-
- return (*enc);
-}
-
-encodePtr get_conversion_from_type_ex(HashTable *encoding, xmlNodePtr node, char *type)
-{
- encodePtr *enc = NULL;
- xmlNsPtr nsptr;
- char *ns, *cptype;
- smart_str nscat = {0};
-
- if(encoding == NULL)
- return NULL;
-
- parse_namespace(type, &cptype, &ns);
- nsptr = xmlSearchNs(node->doc, node, ns);
- if(nsptr != NULL)
- {
- smart_str_appends(&nscat, nsptr->href);
- smart_str_appendc(&nscat, ':');
- smart_str_appends(&nscat, cptype);
- smart_str_0(&nscat);
-
- if(zend_hash_find(encoding, nscat.c, nscat.len + 1, (void **)&enc) == FAILURE)
- {
- if(zend_hash_find(encoding, type, strlen(type) + 1, (void **)&enc) == FAILURE)
- enc = NULL;
- }
- smart_str_free(&nscat);
- }
- else
- {
- if(zend_hash_find(encoding, type, strlen(type) + 1, (void **)&enc) == FAILURE)
- enc = NULL;
- }
-
- if(cptype) efree(cptype);
- if(ns) efree(ns);
- if(enc == NULL)
- return NULL;
- else
- return (*enc);
-}
-
-int is_map(zval *array)
-{
- int i, count = zend_hash_num_elements(Z_ARRVAL_P(array));
- for(i = 0;i < count;i++)
- {
- if(zend_hash_get_current_key_type(Z_ARRVAL_P(array)) == HASH_KEY_IS_STRING)
- return TRUE;
- zend_hash_move_forward(Z_ARRVAL_P(array));
- }
- return FALSE;
-}
-
-void get_array_type(zval *array, smart_str *type)
-{
- HashTable *ht = array->value.ht;
- int i, count, cur_type, prev_type, different;
- char *name = NULL;
- zval **tmp;
- TSRMLS_FETCH();
-
- if(!array || Z_TYPE_P(array) != IS_ARRAY)
- smart_str_appendl(type, "xsd:ur-type", 11);
-
- different = FALSE;
- cur_type = prev_type = 0;
- count = zend_hash_num_elements(ht);
-
- zend_hash_internal_pointer_reset(ht);
- for(i = 0;i < count;i++)
- {
- zend_hash_get_current_data(ht, (void **)&tmp);
-
- if(Z_TYPE_PP(tmp) == IS_OBJECT && !strcmp(Z_OBJCE_PP(tmp)->name, soap_var_class_entry.name))
- {
- zval **ztype;
-
- if(zend_hash_find(Z_OBJPROP_PP(tmp), "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE)
- php_error(E_ERROR, "error encoding SoapVar");
- cur_type = Z_LVAL_P(*ztype);
- }
- else if(Z_TYPE_PP(tmp) == IS_ARRAY && is_map(*tmp))
- cur_type = APACHE_MAP;
- else
- cur_type = Z_TYPE_PP(tmp);
-
- if(i > 0)
- {
- if(cur_type != prev_type)
- {
- different = TRUE;
- break;
- }
- }
-
- prev_type = cur_type;
- zend_hash_move_forward(ht);
- }
-
- if(different)
- smart_str_appendl(type, "xsd:ur-type", 11);
- else
- {
- encodePtr enc;
- char *prefix;
-
- enc = get_conversion(cur_type);
-
- if(enc->details.ns != NULL)
- {
- if(zend_hash_find(SOAP_GLOBAL(defEncNs), enc->details.ns, strlen(enc->details.ns) + 1, (void **)&prefix) == FAILURE)
- php_error(E_ERROR, "fix me");
-
- smart_str_appendl(type, prefix, strlen(prefix));
- smart_str_appendc(type, ':');
- smart_str_appendl(type, enc->details.type_str, strlen(enc->details.type_str));
- smart_str_0(type);
- }
- else
- smart_str_appendl(type, enc->details.type_str, strlen(enc->details.type_str));
- }
-}
-
-
-smart_str *build_soap_action(zval *this_ptr, char *soapaction)
-{
- zval **uri;
- smart_str *tmp;
-
- tmp = emalloc(sizeof(smart_str));
- memset(tmp, 0, sizeof(smart_str));
-
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "uri", sizeof("uri"), (void *)&uri) == FAILURE)
- php_error(E_ERROR, "Error finding uri");
-
- smart_str_appendl(tmp, Z_STRVAL_PP(uri), Z_STRLEN_PP(uri));
- smart_str_appends(tmp, "#");
- smart_str_appendl(tmp, soapaction, strlen(soapaction));
- smart_str_0(tmp);
-
- return tmp;
-}
-
-void delete_encoder(void *encode)
-{
- encodePtr t = *((encodePtr*)encode);
- if(t->details.ns)
- free(t->details.ns);
- if(t->details.type_str)
- free(t->details.type_str);
- if(t->details.map)
- delete_mapping(t->details.map);
- free(t);
-}
-
diff --git a/ext/soap/php_encoding.h b/ext/soap/php_encoding.h
deleted file mode 100644
index 0fe9559973..0000000000
--- a/ext/soap/php_encoding.h
+++ /dev/null
@@ -1,256 +0,0 @@
-#ifndef PHP_ENCODING_H
-#define PHP_ENCODING_H
-
-#define XSD_1999_NAMESPACE "http://www.w3.org/1999/XMLSchema"
-#define XSD_1999_TIMEINSTANT 401
-#define XSD_1999_TIMEINSTANT_STRING "timeInstant"
-
-#define XSD_NAMESPACE "http://www.w3.org/2001/XMLSchema"
-#define XSD_NS_PREFIX "xsd"
-#define XSD_STRING 101
-#define XSD_STRING_STRING "string"
-#define XSD_BOOLEAN 103
-#define XSD_BOOLEAN_STRING "boolean"
-#define XSD_DECIMAL 104
-#define XSD_DECIMAL_STRING "decimal"
-#define XSD_FLOAT 105
-#define XSD_FLOAT_STRING "float"
-#define XSD_DOUBLE 106
-#define XSD_DOUBLE_STRING "double"
-#define XSD_DURATION 107
-#define XSD_DURATION_STRING "duration"
-#define XSD_DATETIME 108
-#define XSD_DATETIME_STRING "dateTime"
-#define XSD_TIME 109
-#define XSD_TIME_STRING "time"
-#define XSD_DATE 110
-#define XSD_DATE_STRING "date"
-#define XSD_GYEARMONTH 111
-#define XSD_GYEARMONTH_STRING "gYearMonth"
-#define XSD_GYEAR 112
-#define XSD_GYEAR_STRING "gYear"
-#define XSD_GMONTHDAY 113
-#define XSD_GMONTHDAY_STRING "gMonthDay"
-#define XSD_GDAY 114
-#define XSD_GDAY_STRING "gDay"
-#define XSD_GMONTH 115
-#define XSD_GMONTH_STRING "gMonth"
-#define XSD_HEXBINARY 116
-#define XSD_HEXBINARY_STRING "hexBinary"
-#define XSD_BASE64BINARY 117
-#define XSD_BASE64BINARY_STRING "base64Binary"
-#define XSD_ANYURI 118
-#define XSD_ANYURI_STRING "anyURI"
-#define XSD_QNAME 119
-#define XSD_QNAME_STRING "QName"
-#define XSD_NOTATION 120
-#define XSD_NOTATION_STRING "NOTATION"
-#define XSD_NORMALIZEDSTRING 121
-#define XSD_NORMALIZEDSTRING_STRING "normalizedString"
-#define XSD_TOKEN 122
-#define XSD_TOKEN_STRING "token"
-#define XSD_LANGUAGE 123
-#define XSD_LANGUAGE_STRING "language"
-#define XSD_NMTOKEN 124
-#define XSD_NMTOKEN_STRING "NMTOKEN"
-#define XSD_NAME 124
-#define XSD_NAME_STRING "Name"
-#define XSD_NCNAME 125
-#define XSD_NCNAME_STRING "NCName"
-#define XSD_ID 126
-#define XSD_ID_STRING "ID"
-#define XSD_IDREF 127
-#define XSD_IDREF_STRING "IDREF"
-#define XSD_IDREFS 127
-#define XSD_IDREFS_STRING "IDREFS"
-#define XSD_ENTITY 128
-#define XSD_ENTITY_STRING "ENTITY"
-#define XSD_ENTITYS 129
-#define XSD_ENTITYS_STRING "ENTITYS"
-#define XSD_INTEGER 130
-#define XSD_INTEGER_STRING "integer"
-#define XSD_NONPOSITIVEINTEGER 131
-#define XSD_NONPOSITIVEINTEGER_STRING "nonPositiveInteger"
-#define XSD_NEGATIVEINTEGER 132
-#define XSD_NEGATIVEINTEGER_STRING "negativeInteger"
-#define XSD_LONG 133
-#define XSD_LONG_STRING "long"
-#define XSD_INT 134
-#define XSD_INT_STRING "int"
-#define XSD_SHORT 135
-#define XSD_SHORT_STRING "short"
-#define XSD_BYTE 136
-#define XSD_BYTE_STRING "byte"
-#define XSD_NONNEGATIVEINTEGER 137
-#define XSD_NONNEGATIVEINTEGER_STRING "nonNegativeInteger"
-#define XSD_UNSIGNEDLONG 138
-#define XSD_UNSIGNEDLONG_STRING "unsignedLong"
-#define XSD_UNSIGNEDINT 139
-#define XSD_UNSIGNEDINT_STRING "unsignedInt"
-#define XSD_UNSIGNEDSHORT 140
-#define XSD_UNSIGNEDSHORT_STRING "unsignedShort"
-#define XSD_UNSIGNEDBYTE 141
-#define XSD_UNSIGNEDBYTE_STRING "unsignedByte"
-#define XSD_POSITIVEINTEGER 142
-#define XSD_POSITIVEINTEGER_STRING "positiveInteger"
-
-#define APACHE_NAMESPACE "http://xml.apache.org/xml-soap"
-#define APACHE_NS_PREFIX "apache"
-#define APACHE_MAP 200
-#define APACHE_MAP_STRING "Map"
-
-#define SOAP_ENC_NAMESPACE "http://schemas.xmlsoap.org/soap/encoding/"
-#define SOAP_ENC_NS_PREFIX "SOAP-ENC"
-#define SOAP_ENC_ARRAY 300
-#define SOAP_ENC_ARRAY_STRING "Array"
-#define SOAP_ENC_OBJECT 301
-#define SOAP_ENC_OBJECT_STRING "Struct"
-
-#define SCHEMA_NAMESPACE "http://www.w3.org/2001/XMLSchema"
-#define SCHEMA_NS_PREFIX "s"
-
-#define WSDL_NAMESPACE "http://schemas.xmlsoap.org/wsdl/"
-#define WSDL_NS_PREFIX "wsdl"
-
-#define WSDL_SOAP_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap/"
-#define WSDL_SOAP_NS_PREFIX "wsdlSoap"
-
-#define WSDL_HTTP_NAMESPACE "http://schemas.xmlsoap.org/wsdl/http/"
-#define WSDL_HTTP_NS_PREFIX "http"
-
-#define WSDL_HTTP_TRANSPORT "http://schemas.xmlsoap.org/soap/http"
-
-#define UNKNOWN_TYPE 999998
-#define END_KNOWN_TYPES 999999
-
-struct _encodeType
-{
- int type;
- char *type_str;
- char *ns;
- sdlTypePtr sdl_type;
- soapMappingPtr map;
-};
-
-struct _encode
-{
- encodeType details;
- zval *(*to_zval)(encodeType type, xmlNodePtr data);
- xmlNodePtr (*to_xml)(encodeType type, zval *data, int style);
-
- xmlNodePtr (*to_zval_before)(encodeType type, xmlNodePtr data, int style);
- zval *(*to_zval_after)(encodeType type, zval *data);
-
- zval *(*to_xml_before)(encodeType type, zval *data);
- xmlNodePtr (*to_xml_after)(encodeType type, xmlNodePtr data, int style);
-};
-
-smart_str *build_soap_action(zval *this_ptr, char *soapaction);
-
-// Master functions all encode/decode should be called thur these functions
-xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style);
-zval *master_to_zval(encodePtr encode, xmlNodePtr data);
-
-#ifdef HAVE_PHP_DOMXML
-//user defined mapping
-zval *to_xml_before_user(encodeType type, zval *data);
-xmlNodePtr to_xml_user(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_after_user(encodeType type, xmlNodePtr node, int style);
-xmlNodePtr to_zval_before_user(encodeType type, xmlNodePtr node, int style);
-zval *to_zval_user(encodeType type, xmlNodePtr node);
-zval *to_zval_after_user(encodeType type, zval *data);
-#endif
-
-//zval type decode
-zval *to_zval_double(encodeType type, xmlNodePtr data);
-zval *to_zval_long(encodeType type, xmlNodePtr data);
-zval *to_zval_bool(encodeType type, xmlNodePtr data);
-zval *to_zval_object(encodeType type, xmlNodePtr data);
-zval *to_zval_string(encodeType type, xmlNodePtr data);
-zval *to_zval_array(encodeType type, xmlNodePtr data);
-zval *to_zval_map(encodeType type, xmlNodePtr data);
-zval *to_zval_null(encodeType type, xmlNodePtr data);
-zval *guess_zval_convert(encodeType type, xmlNodePtr data);
-
-xmlNodePtr to_xml_long(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_bool(encodeType type, zval *data, int style);
-
-//String encode
-xmlNodePtr to_xml_string(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_stringl(encodeType type, zval *data, int style);
-
-//Null encode
-xmlNodePtr to_xml_null(encodeType type, zval *data, int style);
-
-//Struct encode
-xmlNodePtr to_xml_object(encodeType type, zval *data, int style);
-
-//Array encode
-xmlNodePtr guess_array_map(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_array(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_map(encodeType type, zval *data, int style);
-
-//Try and guess for non-wsdl clients and servers
-xmlNodePtr guess_xml_convert(encodeType type, zval *data, int style);
-
-//Datetime encode/decode
-xmlNodePtr to_xml_datetime_ex(encodeType type, zval *data, char *format, int style);
-xmlNodePtr to_xml_datetime(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_time(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_date(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_gyearmonth(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_gyear(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_gmonthday(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_gday(encodeType type, zval *data, int style);
-xmlNodePtr to_xml_gmonth(encodeType type, zval *data, int style);
-
-#define get_conversion(e) get_conversion_ex(SOAP_GLOBAL(defEncIndex), e)
-#define get_conversion_from_type(n, t) get_conversion_from_type_ex(SOAP_GLOBAL(defEnc), n, t)
-#define get_conversion_from_href_type(t) get_conversion_from_href_type_ex(SOAP_GLOBAL(defEnc), t, strlen(t))
-
-void encode_reset_ns();
-smart_str *encode_new_ns();
-
-void set_ns_and_type(xmlNodePtr node, encodeType type);
-void set_ns_and_type_ex(xmlNodePtr node, char *ns, char *type);
-encodePtr get_conversion_ex(HashTable *encoding, int encode);
-encodePtr get_conversion_from_type_ex(HashTable *encoding, xmlNodePtr node, char *type);
-encodePtr get_conversion_from_href_type_ex(HashTable *encoding, char *type, int len);
-
-int is_map(zval *array);
-void get_array_type(zval *array, smart_str *out_type);
-
-void delete_encoder(void *handle);
-
-extern encode defaultEncoding[];
-
-#define FIND_XML_NULL(xml,zval) \
- { \
- xmlAttrPtr null; \
- if(!xml || !xml->children) \
- { \
- ZVAL_NULL(zval); \
- return zval; \
- } \
- if(xml->properties) \
- { \
- null = get_attribute(xml->properties, "null"); \
- if(null) \
- { \
- ZVAL_NULL(zval); \
- return zval; \
- } \
- } \
- }
-
-#define FIND_ZVAL_NULL(zval, xml) \
-{ \
- if(!zval) \
- { \
- xmlSetProp(xml, "xsi:null", "1"); \
- return xml; \
- } \
-}
-
-
-#endif
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
deleted file mode 100644
index 38243dbb93..0000000000
--- a/ext/soap/php_http.c
+++ /dev/null
@@ -1,494 +0,0 @@
-#include "php_soap.h"
-
-void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, char *soapaction)
-{
- xmlChar *buf;
- char *soap_headers;
- int buf_size,err,ret;
- sdlPtr sdl;
- php_url *phpurl = NULL;
- SOAP_STREAM stream;
- zval **trace;
-
- TSRMLS_FETCH();
-
- FETCH_THIS_SOCKET(stream);
- FETCH_THIS_URL(phpurl);
- FETCH_THIS_SDL(sdl);
-
- xmlDocDumpMemory(doc, &buf, &buf_size);
-
- if(!buf)
- php_error(E_ERROR, "Error build soap request");
-
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS
- && Z_LVAL_PP(trace) > 0)
- add_property_stringl(this_ptr, "__last_request", buf, buf_size, 1);
-
- if(!stream)
- {
- char *url;
-
- if(!sdl)
- {
- zval **location;
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "location", sizeof("location"),(void **) &location) == FAILURE)
- php_error(E_ERROR, "Error could not find location");
- url = Z_STRVAL_PP(location);
- }
- else
- {
- sdlBindingPtr binding;
- FETCH_THIS_PORT(binding);
- url = binding->location;
- }
-
- phpurl = php_url_parse(url);
-
-#ifdef PHP_STREAMS
- stream = php_stream_sock_open_host(phpurl->host, (unsigned short)(phpurl->port == 0 ? 80 : phpurl->port), SOCK_STREAM, 0, 0);
-#else
- stream = get_socket(phpurl->host, (phpurl->port == 0 ? 80 : phpurl->port), 10);
-#endif
- if(stream)
- {
- ret = zend_list_insert((void *)stream, le_http_socket);
- add_property_resource(this_ptr, "httpsocket", ret);
- zend_list_addref(ret);
-
- ret = zend_list_insert(phpurl, le_url);
- add_property_resource(this_ptr, "httpurl", ret);
- zend_list_addref(ret);
- }
- else
- php_error(E_ERROR,"Could not connect to host");
- //php_url_free(phpurl);
- }
-
- if(stream)
- {
- zval **cookies;
- char *header = "POST %s HTTP/1.1\r\nConnection: close\r\nAccept: text/html; text/xml; text/plain\r\nUser-Agent: PHP SOAP 0.1\r\nHost: %s\r\nContent-Type: text/xml\r\nContent-Length: %d\r\nSOAPAction: \"%s\"\r\n";
- int size = strlen(header) + strlen(phpurl->host) + strlen(phpurl->path) + 10;
-
- // TODO: Add authication
- if(sdl != NULL)
- {
- // TODO: need to grab soap action from wsdl....
- soap_headers = emalloc(size + strlen(soapaction));
- sprintf(soap_headers, header, phpurl->path, phpurl->host, buf_size, soapaction);
- }
- else
- {
- soap_headers = emalloc(size + strlen(soapaction));
- sprintf(soap_headers, header, phpurl->path, phpurl->host, buf_size, soapaction);
- }
-
-#ifdef PHP_STREAMS
- err = php_stream_write(stream, soap_headers, strlen(soap_headers));
-#else
- err = send(stream, soap_headers, strlen(soap_headers), 0);
-#endif
- if(err != (int)strlen(soap_headers))
- php_error(E_ERROR,"Failed Sending HTTP Headers");
-
- // Send cookies along with request
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS)
- {
- smart_str cookie_str = {0};
- zval **data;
- char *key;
- int index, i;
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(cookies));
- for(i = 0;i < (int)Z_ARRVAL_PP(cookies)->nNumOfElements;i++)
- {
- zend_hash_get_current_data(Z_ARRVAL_PP(cookies), (void **)&data);
- zend_hash_get_current_key(Z_ARRVAL_PP(cookies), &key, (long *)&index, FALSE);
-
- smart_str_appendl(&cookie_str, "Cookie: ", 8);
- smart_str_appendl(&cookie_str, key, strlen(key));
- smart_str_appendc(&cookie_str, '=');
- smart_str_appendl(&cookie_str, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- smart_str_appendc(&cookie_str, ';');
- zend_hash_move_forward(Z_ARRVAL_PP(cookies));
- }
- smart_str_appendl(&cookie_str, "\r\n", 2);
- smart_str_0(&cookie_str);
-
-#ifdef PHP_STREAMS
- err = php_stream_write(stream, cookie_str.c, cookie_str.len);
-#else
- err = send(stream, cookie_str.c, cookie_str.len,0);
-#endif
- if(err != (int)cookie_str.len)
- php_error(E_ERROR,"Failed Sending HTTP Headers");
-
- smart_str_free(&cookie_str);
- }
-
-#ifdef PHP_STREAMS
- err = php_stream_write(stream, "\r\n", 2);
-#else
- err = send(stream, "\r\n", 2, 0);
-#endif
- if(err != 2)
- php_error(E_ERROR,"Failed Sending HTTP Headers");
-
-
-#ifdef PHP_STREAMS
- err = php_stream_write(stream, buf, buf_size);
-#else
- err = send(stream, buf, buf_size, 0);
-#endif
- if(err != (int)strlen(buf))
- php_error(E_ERROR,"Failed Sending HTTP Content");
-
- efree(soap_headers);
- }
- xmlFree(buf);
-}
-
-void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len)
-{
- char *http_headers, *http_body, *content_type, *http_version, http_status[4], *cookie_itt;
- int http_header_size, http_body_size, http_close;
- sdlPtr sdl;
- zval **socket_ref;
- SOAP_STREAM stream;
- zval **trace;
-
- TSRMLS_FETCH();
-
- FETCH_THIS_SDL(sdl);
-
- if(FIND_SOCKET_PROPERTY(this_ptr, socket_ref) != FAILURE)
- {
- FETCH_SOCKET_RES(stream, socket_ref);
- }
-
- if(!get_http_headers(stream, &http_headers, &http_header_size))
- php_error(E_ERROR, "Error Fetching http headers");
-
- //Check to see what HTTP status was sent
- http_version = get_http_header_value(http_headers,"HTTP/");
- if(http_version)
- {
- char *tmp;
-
- tmp = strstr(http_version," ");
-
- if(tmp != NULL)
- {
- tmp++;
- strncpy(http_status,tmp,4);
- http_status[3] = '\0';
- }
-
- /*
- Try and process any respsone that is xml might contain fault code
-
- Maybe try and test for some of the 300's 400's specfics but not
- right now.
-
- if(strcmp(http_status,"200"))
- {
- zval *err;
- char *http_err;
-
- MAKE_STD_ZVAL(err);
- ZVAL_STRING(err, http_body, 1);
- http_err = emalloc(strlen("HTTP request failed ()") + 4);
- sprintf(http_err, "HTTP request failed (%s)", http_status);
- add_soap_fault(thisObj, "SOAP-ENV:Client", http_err, NULL, err);
- efree(http_err);
- return;
- }*/
-
- //Try and get headers again
- if(!strcmp(http_status, "100"))
- {
- if(!get_http_headers(stream, &http_headers, &http_header_size))
- php_error(E_ERROR, "Error Fetching http headers");
- }
-
- efree(http_version);
- }
-
-
- if(!get_http_body(stream, http_headers, &http_body, &http_body_size))
- php_error(E_ERROR, "Error Fetching http body");
-
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS
- && Z_LVAL_PP(trace) > 0)
- add_property_stringl(this_ptr, "__last_response", http_body, http_body_size, 1);
-
- // Close every time right now till i can spend more time on it
- // it works.. it's just slower??
- //See if the server requested a close
- http_close = TRUE;
- /*
- connection = get_http_header_value(http_headers,"Connection: ");
- if(connection)
- {
- if(!strcmp(connection, "Keep-Alive"))
- http_close = FALSE;
- efree(connection);
- }
- else
- {
- if(!strncmp(http_version,"1.1", 3))
- http_close = FALSE;
- }
- */
-
- if(http_close)
- {
-#ifdef PHP_STREAMS
- php_stream_close(stream);
-#else
- SOCK_CLOSE(stream);
-#endif
- zend_list_delete(Z_RESVAL_PP(socket_ref));
- zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", strlen("httpsocket") + 1);
- }
-
- //Check and see if the server even sent a xml document
- content_type = get_http_header_value(http_headers,"Content-Type: ");
- if(content_type)
- {
- char *pos = NULL;
- int cmplen;
- pos = strstr(content_type,";");
- if(pos != NULL)
- cmplen = pos - content_type;
- else
- cmplen = strlen(content_type);
-
- if(strncmp(content_type, "text/xml", cmplen))
- {
- if(strncmp(http_body, "<?xml", 5))
- {
- zval *err;
- MAKE_STD_ZVAL(err);
- ZVAL_STRINGL(err, http_body, http_body_size, 1);
- add_soap_fault(this_ptr, "SOAP-ENV:Client", "Didn't recieve an xml document", NULL, err);
- efree(content_type);
- return;
- }
- }
- efree(content_type);
- }
-
- //Grab and send back every cookie
- //Not going to worry about Path: because
- //we shouldn't be changing urls so path dont
- //matter too much
- cookie_itt = strstr(http_headers,"Set-Cookie: ");
- while(cookie_itt)
- {
- char *end_pos, *cookie;
- char *eqpos, *sempos;
- smart_str name = {0}, value = {0};
- zval **cookies, *z_cookie;
-
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == FAILURE)
- {
- zval *tmp_cookies;
- MAKE_STD_ZVAL(tmp_cookies);
- array_init(tmp_cookies);
- zend_hash_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), &tmp_cookies, sizeof(zval *), (void **)&cookies);
- }
-
- end_pos = strstr(cookie_itt,"\r\n");
- cookie = get_http_header_value(cookie_itt,"Set-Cookie: ");
-
- eqpos = strstr(cookie, "=");
- sempos = strstr(cookie, ";");
-
- smart_str_appendl(&name, cookie, eqpos - cookie);
- smart_str_0(&name);
-
- smart_str_appendl(&value, eqpos + 1, sempos - (eqpos + 1));
- smart_str_0(&value);
-
- MAKE_STD_ZVAL(z_cookie);
- ZVAL_STRINGL(z_cookie, value.c, value.len, 1);
-
- zend_hash_update(Z_ARRVAL_PP(cookies), name.c, name.len + 1, &z_cookie, sizeof(zval *), NULL);
-
- cookie_itt = strstr(cookie_itt + sizeof("Set-Cookie: "), "Set-Cookie: ");
-
- smart_str_free(&value);
- smart_str_free(&name);
- efree(cookie);
- cookie_itt = FALSE;
- }
-
- *buffer = http_body;
- *buffer_len = http_body_size;
- efree(http_headers);
-}
-
-char *get_http_header_value(char *headers, char *type)
-{
- char *tmp = NULL,*var = NULL;
- int size;
-
- tmp = strstr(headers, type);
- if(tmp != NULL)
- {
- tmp += strlen(type);
- size = strstr(tmp, "\r\n") - tmp;
- var = emalloc(size + 1);
- strncpy(var, tmp, size);
- var[size] = '\0';
- }
- return var;
-}
-
-int get_http_body(SOAP_STREAM stream, char *headers, char **response, int *out_size)
-{
- char *trans_enc, *content_length, *http_buf;
- int http_buf_size = 0;
- TSRMLS_FETCH();
-
- trans_enc = get_http_header_value(headers, "Transfer-Encoding: ");
- content_length = get_http_header_value(headers, "Content-Length: ");
-
- //this is temp...
- // netscape enterprise server sends in lowercase???
- if(content_length == NULL)
- content_length = get_http_header_value(headers, "Content-length: ");
-
- if(trans_enc && !strcmp(trans_enc, "chunked"))
- {
- int cur = 0, size = 0, buf_size = 0, len_size;
- char done, chunk_size[10];
-
- done = FALSE;
- http_buf = emalloc(1);
- while(!done)
- {
- cur = 0;
- while(!(chunk_size[cur - 2] == '\r' && chunk_size[cur - 1] == '\n'))
-#ifdef PHP_STREAMS
- chunk_size[cur++] = php_stream_getc(stream);
-#else
- chunk_size[cur++] = php_sock_fgetc(stream);
-#endif
- if(sscanf(chunk_size,"%x",&buf_size) != -1)
- {
- http_buf = erealloc(http_buf,http_buf_size + buf_size);
- len_size = 0;
- while(http_buf_size < buf_size)
- {
-#ifdef PHP_STREAMS
- len_size += php_stream_read(stream, &http_buf[http_buf_size], buf_size - len_size);
-#else
- len_size += php_sock_fread(&http_buf[http_buf_size], buf_size - len_size, stream);
-#endif
- http_buf_size += len_size;
- }
-#ifdef PHP_STREAMS
- php_stream_getc(stream);php_stream_getc(stream);
-#else
- //Eat up '\r' '\n'
- php_sock_fgetc(stream);php_sock_fgetc(stream);
-#endif
- }
- if(buf_size == 0)
- done = TRUE;
- }
- efree(trans_enc);
- }
- else if(content_length)
- {
- int size;
- size = atoi(content_length);
- http_buf = emalloc(size + 1);
-
- while(http_buf_size < size)
-#ifdef PHP_STREAMS
- http_buf_size += php_stream_read(stream, &http_buf[http_buf_size], size - http_buf_size);
-#else
- http_buf_size += php_sock_fread(&http_buf[http_buf_size], size - http_buf_size, stream);
-#endif
- http_buf[size] = '\0';
- efree(content_length);
- }
- else
- php_error(E_ERROR,"Don't know how to read http body, No Content-Length or chunked data");
-
- (*response) = http_buf;
- (*out_size) = http_buf_size;
- return TRUE;
-}
-
-int get_http_headers(SOAP_STREAM stream, char **response, int *out_size)
-{
- int done;
- char chr;
- smart_str tmp_response = {0};
- TSRMLS_FETCH();
-
- done = FALSE;
-
- while(!done)
- {
-#ifdef PHP_STREAMS
- chr = php_stream_getc(stream);
-#else
- chr = php_sock_fgetc(stream);
-#endif
- if(chr != EOF)
- {
- smart_str_appendc(&tmp_response, chr);
- if(tmp_response.c[tmp_response.len - 2] == '\r' && tmp_response.c[tmp_response.len - 1] == '\n' &&
- tmp_response.c[tmp_response.len - 4] == '\r' && tmp_response.c[tmp_response.len - 3] == '\n')
- {
- smart_str_0(&tmp_response);
- done = TRUE;
- }
- }
- else
- return FALSE;
- }
- (*response) = tmp_response.c;
- (*out_size) = tmp_response.len;
- return TRUE;
-}
-
-#ifndef PHP_STREAMS
-SOCKET get_socket(char* host,int portno,int time)
-{
- SOCKET socketd = -1;
- struct sockaddr_in server;
- struct timeval timeout;
-
- memset(&server, 0, sizeof(server));
- socketd = socket(AF_INET,SOCK_STREAM,0);
- if (socketd == SOCK_ERR) {
- if(socketd > 0)
- SOCK_CLOSE(socketd);
- return FALSE;
- }
- server.sin_family = AF_INET;
-
- if(php_lookup_hostname(host,&server.sin_addr)) {
- if(socketd > 0)
- SOCK_CLOSE(socketd);
- return FALSE;
- }
- server.sin_port = htons((unsigned short)portno);
- timeout.tv_sec = time;
- timeout.tv_usec = 0;
- if (php_connect_nonb(socketd, (struct sockaddr *)&server, sizeof(struct sockaddr_in), &timeout) == SOCK_CONN_ERR) {
- if(socketd > 0)
- SOCK_CLOSE(socketd);
- return FALSE;
- }
-
- return socketd;
-}
-#endif
diff --git a/ext/soap/php_http.h b/ext/soap/php_http.h
deleted file mode 100644
index 4e4fff7f4d..0000000000
--- a/ext/soap/php_http.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef PHP_HTTP_H
-#define PHP_HTTP_H
-
-void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, char *soapaction);
-void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len);
-
-char *get_http_header_value(char *headers, char *type);
-int get_http_body(SOAP_STREAM socketd, char *headers, char **response, int *out_size);
-int get_http_headers(SOAP_STREAM socketd,char **response, int *out_size);
-
-#ifndef PHP_STREAMS
-#ifndef ZEND_WIN32
-# ifndef closesocket
-# define closesocket close
-# endif
-#endif
-
-#ifndef SOCK_CLOSE
-# define SOCK_CLOSE(s) shutdown(s, 0); closesocket(s)
-#endif
-
-SOCKET get_socket(char* host,int portno,int timeout);
-#endif
-
-#endif
diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c
deleted file mode 100644
index 9a05e5ed97..0000000000
--- a/ext/soap/php_packet_soap.c
+++ /dev/null
@@ -1,138 +0,0 @@
-#include "php_soap.h"
-
-int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval ***ret, int *num_params)
-{
- xmlDocPtr response;
- xmlNodePtr trav, trav2, env, body, resp, cur, fault;
- zval **tmp_ret;
- TSRMLS_FETCH();
-
- response = xmlParseMemory(buffer, buffer_size);
- xmlCleanupParser();
-
- (*num_params) = 0;
-
- trav = response->children;
- FOREACHNODE(trav,"Envelope",env)
- {
- trav2 = env->children;
- FOREACHNODE(trav2,"Body",body)
- {
- fault = get_node(body->children,"Fault");
- if(fault != NULL)
- {
- char *faultcode = NULL, *faultstring = NULL, *faultactor = NULL;
- zval *details = NULL;
- xmlNodePtr tmp;
-
- tmp = get_node(fault->children,"faultcode");
- if(tmp != NULL && tmp->children != NULL)
- faultcode = tmp->children->content;
-
- tmp = get_node(fault->children,"faultstring");
- if(tmp != NULL && tmp->children != NULL)
- faultstring = tmp->children->content;
-
- tmp = get_node(fault->children,"faultactor");
- if(tmp != NULL && tmp->children != NULL)
- faultactor = tmp->children->content;
-
- tmp = get_node(fault->children,"detail");
- if(tmp != NULL)
- {
- encodePtr enc;
- enc = get_conversion(UNKNOWN_TYPE);
- details = enc->to_zval(enc->details, tmp);
- }
-
- add_soap_fault(this_ptr, faultcode, faultstring, faultactor, details);
- }
- else
- {
- resp = body->children;
- if(fn != NULL)
- {
- sdlParamPtr *h_param, param = NULL;
- xmlNodePtr val = NULL;
- encodePtr enc;
- char *name, *ns;
-
- if(fn->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes;
-
- zend_hash_internal_pointer_reset(fn->responseParameters);
- if(zend_hash_get_current_data(fn->responseParameters, (void **)&h_param) != SUCCESS)
- php_error(E_ERROR, "Can't find response parameter \"%s\"", param->paramName);
-
- param = (*h_param);
- if(fnb->style == SOAP_DOCUMENT)
- {
- name = (*h_param)->encode->details.type_str;
- ns = (*h_param)->encode->details.ns;
- }
- else
- {
- name = fn->responseName;
- /* ns = ? */
- }
-
- cur = get_node_ex(resp, name, ns);
- /* TODO: produce warning invalid ns */
- if(!cur)
- cur = get_node(resp, name);
-
- if(!cur)
- php_error(E_ERROR, "Can't find response data");
-
-
- if(fnb->style == SOAP_DOCUMENT)
- val = cur;
- else
- val = get_node(cur->children, param->paramName);
-
- if(!val)
- php_error(E_ERROR, "Can't find response data");
-
- tmp_ret = emalloc(sizeof(zval **));
- if(param != NULL)
- enc = param->encode;
- else
- enc = get_conversion(UNKNOWN_TYPE);
-
- tmp_ret[0] = master_to_zval(enc, val);
- (*ret) = tmp_ret;
- (*num_params) = 1;
- }
- }
- else
- {
- cur = resp;
- while(cur && cur->type != XML_ELEMENT_NODE)
- cur = cur->next;
- if(cur != NULL)
- {
- xmlNodePtr val;
- val = cur->children;
- while(val && val->type != XML_ELEMENT_NODE)
- val = val->next;
-
- if(val != NULL)
- {
- encodePtr enc;
- enc = get_conversion(UNKNOWN_TYPE);
- tmp_ret = emalloc(sizeof(zval **));
- tmp_ret[0] = master_to_zval(enc, val);
- (*ret) = tmp_ret;
- (*num_params) = 1;
- }
- }
- }
- }
- }
- ENDFOREACH(trav2);
- }
- ENDFOREACH(trav);
- xmlFreeDoc(response);
- return TRUE;
-}
diff --git a/ext/soap/php_packet_soap.h b/ext/soap/php_packet_soap.h
deleted file mode 100644
index 0d094269da..0000000000
--- a/ext/soap/php_packet_soap.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef PHP_PACKET_SOAP_H
-#define PHP_PACKET_SOAP_H
-
-int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval ***ret, int *num_params);
-
-#endif \ No newline at end of file
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
deleted file mode 100644
index 10e88716e0..0000000000
--- a/ext/soap/php_schema.c
+++ /dev/null
@@ -1,1076 +0,0 @@
-#include "php_soap.h"
-/*
-2.6.1 xsi:type
-2.6.2 xsi:nil
-2.6.3 xsi:schemaLocation, xsi:noNamespaceSchemaLocation
-*/
-
-/*
-<schema
- attributeFormDefault = (qualified | unqualified) : unqualified
- blockDefault = (#all | List of (extension | restriction | substitution)) : ''
- elementFormDefault = (qualified | unqualified) : unqualified
- finalDefault = (#all | List of (extension | restriction)) : ''
- id = ID
- targetNamespace = anyURI
- version = token
- xml:lang = language
- {any attributes with non-schema namespace . . .}>
- Content: ((include | import | redefine | annotation)*, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*)
-</schema>
-*/
-int load_schema(sdlPtr *sdl,xmlNodePtr schema)
-{
- xmlNodePtr trav, element, compType, simpleType, attribute;
- xmlAttrPtr tns;
-
- if(!(*sdl)->types)
- {
- (*sdl)->types = malloc(sizeof(HashTable));
- zend_hash_init((*sdl)->types, 0, NULL, delete_type, 1);
- }
-
- tns = get_attribute(schema->properties, "targetNamespace");
-
- trav = schema->children;
- FOREACHNODE(trav,"complexType",compType)
- {
- schema_complexType(sdl, tns, compType, NULL);
- }
- ENDFOREACH(trav);
-
- trav = schema->children;
- FOREACHNODE(trav,"simpleType",simpleType)
- {
- schema_simpleType(sdl, tns, simpleType, NULL);
- }
- ENDFOREACH(trav);
-
- trav = schema->children;
- FOREACHNODE(trav,"element",element)
- {
- schema_element(sdl, tns, element, NULL);
- }
- ENDFOREACH(trav);
-
- trav = schema->children;
- FOREACHNODE(trav, "attribute", attribute)
- {
- schema_attribute(sdl, tns, attribute, NULL);
- }
- ENDFOREACH(trav);
- return FALSE;
-}
-/*
-<simpleType
- final = (#all | (list | union | restriction))
- id = ID
- name = NCName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (restriction | list | union))
-</simpleType>
-*/
-int schema_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpleType, sdlTypePtr cur_type)
-{
- xmlNodePtr content;
- xmlAttrPtr name, ns;
-
- ns = get_attribute(simpleType->properties, "targetNamespace");
- if(ns == NULL)
- ns = tsn;
-
- name = get_attribute(simpleType->properties, "name");
- if(name != NULL)
- {
- HashTable *ht;
- smart_str key = {0};
- sdlTypePtr newType, *ptr;
-
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
- newType->name = strdup(name->children->content);
- newType->namens = strdup(ns->children->content);
-
- if(cur_type == NULL)
- {
- ht = (*sdl)->types;
- smart_str_appends(&key, newType->namens);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, newType->name);
- smart_str_0(&key);
- }
- else
- {
- if(cur_type->elements == NULL)
- {
- cur_type->elements = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
- }
- ht = cur_type->elements;
- smart_str_appends(&key, cur_type->name);
- }
-
- zend_hash_add(ht, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), (void **)&ptr);
- cur_type = (*ptr);
- smart_str_free(&key);
- }
-
- content = get_node(simpleType->children, "restriction");
- if(content != NULL)
- {
- schema_restriction_simpleType(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(simpleType->children, "list");
- if(content != NULL)
- {
- schema_list(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(simpleType->children, "union");
- if(content != NULL)
- {
- schema_union(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*
-<list
- id = ID
- itemType = QName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleType?))
-</list>
-*/
-int schema_list(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr listType, sdlTypePtr cur_type)
-{
- return TRUE;
-}
-
-/*
-<union
- id = ID
- memberTypes = List of QName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleType*))
-</union>
-*/
-int schema_union(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr unionType, sdlTypePtr cur_type)
-{
- return TRUE;
-}
-
-/*
-<simpleContent
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (restriction | extension))
-</simpleContent>
-*/
-int schema_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpCompType, sdlTypePtr cur_type)
-{
- xmlNodePtr content;
-
- content = get_node(simpCompType->children, "restriction");
- if(content == NULL)
- {
- schema_restriction_simpleContent(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(simpCompType->children, "extension");
- if(content == NULL)
- {
- //schema_extension(sdl, tsn, content, cur_type);
- php_error(E_ERROR, "Error parsing schema (doesn't support extensions on simpleContent)");
- return TRUE;
- }
-
- php_error(E_ERROR, "Error parsing schema (simpleContent)");
- return FALSE;
-}
-
-/*
-<restriction
- base = QName
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*)?, ((attribute | attributeGroup)*, anyAttribute?))
-</restriction>
-*/
-int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type)
-{
- xmlNodePtr content, trav;
- xmlAttrPtr base;
-
- content = get_node(restType->children, "simpleType");
- if(content != NULL)
- {
- schema_simpleType(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- base = get_attribute(restType->properties, "base");
- if(base != NULL)
- {
- //cur_type->base = estrdup(base->children->content);
- }
-
- if(cur_type->restrictions == NULL)
- {
- cur_type->restrictions = malloc(sizeof(sdlRestrictions));
- memset(cur_type->restrictions, 0, sizeof(sdlRestrictions));
- }
-
- trav = restType->children;
- do
- {
- if(trav->type == XML_ELEMENT_NODE)
- {
- if(!strcmp(trav->name, "minExclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->minExclusive);
- else if(!strcmp(trav->name, "minInclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->minInclusive);
- else if(!strcmp(trav->name, "maxExclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->maxExclusive);
- else if(!strcmp(trav->name, "maxInclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->maxInclusive);
- else if(!strcmp(trav->name, "totalDigits"))
- schema_restriction_var_int(trav, &cur_type->restrictions->totalDigits);
- else if(!strcmp(trav->name, "fractionDigits"))
- schema_restriction_var_int(trav, &cur_type->restrictions->fractionDigits);
- else if(!strcmp(trav->name, "length"))
- schema_restriction_var_int(trav, &cur_type->restrictions->length);
- else if(!strcmp(trav->name, "minLength"))
- schema_restriction_var_int(trav, &cur_type->restrictions->minLength);
- else if(!strcmp(trav->name, "maxLength"))
- schema_restriction_var_int(trav, &cur_type->restrictions->maxLength);
- else if(!strcmp(trav->name, "whiteSpace"))
- schema_restriction_var_char(trav, &cur_type->restrictions->whiteSpace);
- else if(!strcmp(trav->name, "pattern"))
- schema_restriction_var_char(trav, &cur_type->restrictions->pattern);
- else if(!strcmp(trav->name, "enumeration"))
- {
- sdlRestrictionCharPtr enumval = NULL;
-
- schema_restriction_var_char(trav, &enumval);
- if(cur_type->restrictions->enumeration == NULL)
- {
- cur_type->restrictions->enumeration = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->restrictions->enumeration, 0, NULL, delete_schema_restriction_var_char, 1);
- }
- zend_hash_next_index_insert(cur_type->restrictions->enumeration, &enumval, sizeof(sdlRestrictionCharPtr), NULL);
- }
- }
- }while(trav = trav->next);
-
- return TRUE;
-}
-
-/*
-<restriction
- base = QName
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))
-</restriction>
-*/
-int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type)
-{
- xmlAttrPtr base;
- xmlNodePtr trav;
-
- base = get_attribute(restType->properties, "base");
- if(base != NULL)
- {
- char *type, *ns;
- xmlNsPtr nsptr;
-
- parse_namespace(base->children->content, &type, &ns);
- nsptr = xmlSearchNs(restType->doc, restType, ns);
- if(nsptr != NULL)
- {
- cur_type->encode = get_encoder((*sdl), (char *)nsptr->href, type);
- }
- if(type) efree(type);
- if(ns) efree(ns);
- }
-
- trav = restType->children;
- do
- {
- if(trav->type == XML_ELEMENT_NODE)
- {
- if(!strcmp(trav->name, "group"))
- {
- schema_group(sdl, tsn, trav, cur_type);
- return TRUE;
- }
- else if(!strcmp(trav->name, "all"))
- {
- schema_all(sdl, tsn, trav, cur_type);
- return TRUE;
- }
- else if(!strcmp(trav->name, "choice"))
- {
- schema_choice(sdl, tsn, trav, cur_type);
- return TRUE;
- }
- else if(!strcmp(trav->name, "sequence"))
- {
- schema_sequence(sdl, tsn, trav, cur_type);
- return TRUE;
- }
- else if(!strcmp(trav->name, "attribute"))
- {
- schema_attribute(sdl, tsn, trav, cur_type);
- }
- }
- }while(trav = trav->next);
-
- return TRUE;
-}
-
-/*
-<restriction
- base = QName
- id = ID
- {any attributes with non-schema Namespace . . .}>
- Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*))
-</restriction>
-*/
-int schema_restriction_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type)
-{
- xmlNodePtr content, trav;
- xmlAttrPtr base;
-
- base = get_attribute(restType->properties, "base");
- if(base != NULL)
- cur_type->encode = get_encoder_from_prefix((*sdl), restType, base->children->content);
-
- content = get_node(restType->children, "simpleType");
- if(content != NULL)
- {
- schema_simpleType(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- if(cur_type->restrictions == NULL)
- cur_type->restrictions = malloc(sizeof(sdlRestrictions));
-
- trav = restType->children;
- do
- {
- if(trav->type == XML_ELEMENT_NODE)
- {
- if(!strcmp(trav->name, "minExclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->minExclusive);
- else if(!strcmp(trav->name, "minInclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->minInclusive);
- else if(!strcmp(trav->name, "maxExclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->maxExclusive);
- else if(!strcmp(trav->name, "maxInclusive"))
- schema_restriction_var_int(trav, &cur_type->restrictions->maxInclusive);
- else if(!strcmp(trav->name, "totalDigits"))
- schema_restriction_var_int(trav, &cur_type->restrictions->totalDigits);
- else if(!strcmp(trav->name, "fractionDigits"))
- schema_restriction_var_int(trav, &cur_type->restrictions->fractionDigits);
- else if(!strcmp(trav->name, "length"))
- schema_restriction_var_int(trav, &cur_type->restrictions->length);
- else if(!strcmp(trav->name, "minLength"))
- schema_restriction_var_int(trav, &cur_type->restrictions->minLength);
- else if(!strcmp(trav->name, "maxLength"))
- schema_restriction_var_int(trav, &cur_type->restrictions->maxLength);
- else if(!strcmp(trav->name, "whiteSpace"))
- schema_restriction_var_char(trav, &cur_type->restrictions->whiteSpace);
- else if(!strcmp(trav->name, "pattern"))
- schema_restriction_var_char(trav, &cur_type->restrictions->pattern);
- else if(!strcmp(trav->name, "enumeration"))
- {
- sdlRestrictionCharPtr enumval = NULL;
-
- schema_restriction_var_char(trav, &enumval);
- if(cur_type->restrictions->enumeration == NULL)
- {
- cur_type->restrictions->enumeration = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->restrictions->enumeration, 0, NULL, delete_schema_restriction_var_char, 1);
- }
- zend_hash_next_index_insert(cur_type->restrictions->enumeration, &enumval, sizeof(sdlRestrictionCharPtr), NULL);
- }
- }
- }while(trav = trav->next);
-
- return TRUE;
-}
-
-int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr)
-{
- xmlAttrPtr fixed, value, id;
-
- if((*valptr) == NULL)
- (*valptr) = malloc(sizeof(sdlRestrictionInt));
-
- fixed = get_attribute(val->properties, "fixed");
- (*valptr)->fixed = FALSE;
- if(fixed != NULL)
- {
- if(!strcmp(fixed->children->content, "true") ||
- !strcmp(fixed->children->content, "1"))
- (*valptr)->fixed = TRUE;
- }
-
- id = get_attribute(val->properties, "id");
- if(id != NULL)
- (*valptr)->id = strdup(id->children->content);
-
- value = get_attribute(val->properties, "value");
- if(value == NULL)
- php_error(E_ERROR, "Error parsing wsdl schema \"missing value for minExclusive\"");
-
- (*valptr)->value = atoi(value->children->content);
-
- return TRUE;
-}
-
-void delete_restriction_var_int(void *rvi)
-{
- sdlRestrictionIntPtr ptr = *((sdlRestrictionIntPtr*)rvi);
- if(ptr->id);
- free(ptr->id);
- free(ptr);
-}
-
-int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr)
-{
- xmlAttrPtr fixed, value, id;
-
- if((*valptr) == NULL)
- (*valptr) = malloc(sizeof(sdlRestrictionChar));
-
- fixed = get_attribute(val->properties, "fixed");
- (*valptr)->fixed = FALSE;
- if(fixed != NULL)
- {
- if(!strcmp(fixed->children->content, "true") ||
- !strcmp(fixed->children->content, "1"))
- (*valptr)->fixed = TRUE;
- }
-
- id = get_attribute(val->properties, "id");
- if(id != NULL)
- (*valptr)->id = strdup(id->children->content);
-
- value = get_attribute(val->properties, "value");
- if(value == NULL)
- php_error(E_ERROR, "Error parsing wsdl schema \"missing value restriction\"");
-
- (*valptr)->value = strdup(value->children->content);
- return TRUE;
-}
-
-void delete_schema_restriction_var_char(void *srvc)
-{
- sdlRestrictionCharPtr ptr = *((sdlRestrictionCharPtr*)srvc);
- if(ptr->id)
- free(ptr->id);
- if(ptr->value)
- free(ptr->value);
- free(ptr);
-}
-
-/*
-From simpleContent (not supported):
-<extension
- base = QName
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?))
-</extension>
-
-From complexContent:
-<extension
- base = QName
- id = ID
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))
-</extension>
-*/
-int schema_extension(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type)
-{
- xmlNodePtr content;
- xmlAttrPtr base;
-
- base = get_attribute(extType->properties, "base");
-
- content = get_node(extType->children, "group");
- if(content != NULL)
- {
- schema_group(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(extType->children, "all");
- if(content != NULL)
- {
- schema_all(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(extType->children, "choice");
- if(content != NULL)
- {
- schema_choice(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(extType->children, "sequence");
- if(content != NULL)
- {
- schema_sequence(sdl, tsn, content, cur_type);
- return TRUE;
- }
- return FALSE;
-}
-
-/*
-<all
- id = ID
- maxOccurs = 1 : 1
- minOccurs = (0 | 1) : 1
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, element*)
-</all>
-*/
-int schema_all(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr all, sdlTypePtr cur_type)
-{
- xmlNodePtr element, trav;
-
- trav = all->children;
- FOREACHNODE(trav, "element", element)
- {
- schema_element(sdl, tsn, element, cur_type);
- }
- ENDFOREACH(trav);
- return TRUE;
-}
-
-/*
-<group
- name = NCName>
- Content: (annotation?, (all | choice | sequence))
-</group>
-*/
-int schema_group(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr cur_type)
-{
- xmlNodePtr content;
- xmlAttrPtr name;
-
- name = get_attribute(groupType->properties, "name");
- if(name != NULL)
- {
-
- }
-
- content = get_node(groupType->children, "all");
- if(content != NULL)
- {
- schema_all(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(groupType->children, "choice");
- if(content != NULL)
- {
- schema_choice(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(groupType->children, "sequence");
- if(content != NULL)
- {
- schema_sequence(sdl, tsn, content, cur_type);
- return TRUE;
- }
- return FALSE;
-}
-/*
-<choice
- id = ID
- maxOccurs = (nonNegativeInteger | unbounded) : 1
- minOccurs = nonNegativeInteger : 1
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (element | group | choice | sequence | any)*)
-</choice>
-*/
-int schema_choice(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr cur_type)
-{
- xmlNodePtr trav, data;
-
- //cur_type->property_type = CHOICE;
-
- trav = choiceType->children;
- FOREACHNODE(trav, "element", data)
- {
- schema_element(sdl, tsn, data, cur_type);
- }
- ENDFOREACH(trav);
-
- trav = choiceType->children;
- FOREACHNODE(trav, "group", data)
- {
- schema_group(sdl, tsn, data, cur_type);
- }
- ENDFOREACH(trav);
-
- trav = choiceType->children;
- FOREACHNODE(trav, "choice", data)
- {
- schema_choice(sdl, tsn, data, cur_type);
- }
- ENDFOREACH(trav);
-
- trav = choiceType->children;
- FOREACHNODE(trav, "sequence", data)
- {
- schema_sequence(sdl, tsn, data, cur_type);
- }
- ENDFOREACH(trav);
-
- trav = choiceType->children;
- FOREACHNODE(trav, "any", data)
- {
- schema_any(sdl, tsn, data, cur_type);
- }
- ENDFOREACH(trav);
-
- return TRUE;
-}
-
-/*
-<sequence
- id = ID
- maxOccurs = (nonNegativeInteger | unbounded) : 1
- minOccurs = nonNegativeInteger : 1
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (element | group | choice | sequence | any)*)
-</sequence>
-*/
-int schema_sequence(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr seqType, sdlTypePtr cur_type)
-{
- xmlNodePtr trav;
-
- trav = seqType->children;
- do
- {
- if(trav->type == XML_ELEMENT_NODE)
- {
- if(!strcmp(trav->name, "element"))
- {
- schema_element(sdl, tsn, trav, cur_type);
- }
- else if(!strcmp(trav->name, "group"))
- {
- schema_group(sdl, tsn, trav, cur_type);
- }
- else if(!strcmp(trav->name, "choice"))
- {
- schema_choice(sdl, tsn, trav, cur_type);
- }
- else if(!strcmp(trav->name, "sequence"))
- {
- schema_sequence(sdl, tsn, trav, cur_type);
- }
- else if(!strcmp(trav->name, "any"))
- {
- schema_any(sdl, tsn, trav, cur_type);
- }
- }
- }
- while(trav = trav->next);
-
- return TRUE;
-}
-
-int schema_any(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type)
-{
- return TRUE;
-}
-
-/*
-<complexContent
- id = ID
- mixed = boolean
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (restriction | extension))
-</complexContent>
-*/
-int schema_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compCont, sdlTypePtr cur_type)
-{
- xmlNodePtr content;
-
- content = get_node(compCont->children, "restriction");
- if(content != NULL)
- {
- schema_restriction_complexContent(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- return TRUE;
-}
-
-/*
-<complexType
- abstract = boolean : false
- block = (#all | List of (extension | restriction))
- final = (#all | List of (extension | restriction))
- id = ID
- mixed = boolean : false
- name = NCName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))))
-</complexType>
-*/
-int schema_complexType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compType, sdlTypePtr cur_type)
-{
- xmlNodePtr content;
- xmlAttrPtr attrs, name, ns;
-
- attrs = compType->properties;
- ns = get_attribute(attrs, "targetNamespace");
- if(ns == NULL)
- ns = tsn;
-
- name = get_attribute(attrs, "name");
- if(name)
- {
- HashTable *ht;
- sdlTypePtr newType, *ptr;
- smart_str key = {0};
-
- newType = malloc(sizeof(sdlType));
- memset(newType, 0, sizeof(sdlType));
- newType->name = strdup(name->children->content);
- newType->namens = strdup(ns->children->content);
-
- if(cur_type == NULL)
- {
- ht = (*sdl)->types;
- smart_str_appends(&key, newType->namens);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, newType->name);
- smart_str_0(&key);
- }
- else
- {
- if(cur_type->elements == NULL)
- {
- cur_type->elements = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
- }
- ht = cur_type->elements;
- smart_str_appends(&key, newType->name);
- }
-
- zend_hash_add(ht, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), (void **)&ptr);
- cur_type = (*ptr);
- create_encoder((*sdl), cur_type, ns->children->content, name->children->content);
- smart_str_free(&key);
- }
-
- content = get_node(compType->children, "simpleContent");
- if(content != NULL)
- {
- schema_simpleContent(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(compType->children, "complexContent");
- if(content != NULL)
- {
- schema_complexContent(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- //(group | all | choice | sequence)
- content = get_node(compType->children, "group");
- if(content != NULL)
- {
- schema_group(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(compType->children, "all");
- if(content != NULL)
- {
- schema_all(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(compType->children, "choice");
- if(content != NULL)
- {
- schema_choice(sdl, tsn, content, cur_type);
- return TRUE;
- }
-
- content = get_node(compType->children, "sequence");
- if(content != NULL)
- schema_sequence(sdl, tsn, content, cur_type);
-
- return TRUE;
-}
-/*
-<element
- abstract = boolean : false
- block = (#all | List of (extension | restriction | substitution))
- default = string
- final = (#all | List of (extension | restriction))
- fixed = string
- form = (qualified | unqualified)
- id = ID
- maxOccurs = (nonNegativeInteger | unbounded) : 1
- minOccurs = nonNegativeInteger : 1
- name = NCName
- nillable = boolean : false
- ref = QName
- substitutionGroup = QName
- type = QName
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*))
-</element>
-*/
-int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr cur_type)
-{
- xmlNodePtr content;
- xmlAttrPtr attrs, curattr, name, ns;
- TSRMLS_FETCH();
-
- attrs = element->properties;
- ns = get_attribute(attrs, "targetNamespace");
- if(ns == NULL)
- ns = tsn;
-
- name = get_attribute(attrs, "name");
- if(!name)
- name = get_attribute(attrs, "ref");
- if(name)
- {
- HashTable *addHash;
- sdlTypePtr newType, *tmp;
- smart_str key = {0};
-
- newType = malloc(sizeof(sdlType));
-
- memset(newType, 0, sizeof(sdlType));
- newType->name = strdup(name->children->content);
- newType->namens = strdup(tsn->children->content);
- newType->nullable = FALSE;
- newType->min_occurs = 1;
- newType->max_occurs = 1;
-
- if(cur_type == NULL)
- {
- addHash = (*sdl)->types;
- smart_str_appends(&key, newType->namens);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, newType->name);
- }
- else
- {
- if(cur_type->elements == NULL)
- {
- cur_type->elements = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
- }
- addHash = cur_type->elements;
- smart_str_appends(&key, newType->name);
- }
-
- smart_str_0(&key);
- zend_hash_add(addHash, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), (void **)&tmp);
- cur_type = (*tmp);
- create_encoder((*sdl), cur_type, ns->children->content, name->children->content);
- smart_str_free(&key);
- }
-
- curattr = get_attribute(attrs, "maxOccurs");
- if(curattr)
- {
- if(!strcmp(curattr->children->content, "unbounded"))
- cur_type->max_occurs = -1;
- else
- cur_type->max_occurs = atoi(curattr->children->content);
- }
-
- curattr = get_attribute(attrs, "minOccurs");
- if(curattr)
- cur_type->min_occurs = atoi(curattr->children->content);
-
- //nillable = boolean : false
- attrs = element->properties;
- curattr = get_attribute(attrs, "nillable");
- if(curattr)
- {
- if(!stricmp(curattr->children->content, "true") ||
- !stricmp(curattr->children->content, "1"))
- cur_type->nullable = TRUE;
- else
- cur_type->nullable = FALSE;
- }
- else
- cur_type->nullable = FALSE;
-
- //type = QName
- curattr = get_attribute(attrs, "type");
- if(!curattr)
- curattr = name;
- if(curattr)
- {
- char *cptype, *str_ns;
- xmlNsPtr nsptr;
-
- parse_namespace(curattr->children->content, &cptype, &str_ns);
- if(str_ns)
- nsptr = xmlSearchNs(element->doc, element, str_ns);
- else
- nsptr = xmlSearchNsByHref(element->doc, element, ns->children->content);
-
- cur_type->encode = get_create_encoder((*sdl), cur_type, (char *)nsptr->href, (char *)cptype);
- if(str_ns) efree(str_ns);
- if(cptype) efree(cptype);
- }
-
- if(cur_type->max_occurs == -1 || cur_type->max_occurs > 1)
- cur_type->encode = get_conversion(SOAP_ENC_ARRAY);
-
- content = get_node(element->children, "simpleType");
- if(content)
- schema_simpleType(sdl, tsn, content, cur_type);
-
- content = get_node(element->children, "complexType");
- if(content)
- schema_complexType(sdl, tsn, content, cur_type);
-
- return FALSE;
-}
-
-/*
-<attribute
- default = string
- fixed = string
- form = (qualified | unqualified)
- id = ID
- name = NCName
- ref = QName
- type = QName
- use = (optional | prohibited | required) : optional
- {any attributes with non-schema namespace . . .}>
- Content: (annotation?, (simpleType?))
-</attribute>
-*/
-int schema_attribute(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type)
-{
- xmlAttrPtr attr;
- sdlAttributePtr newAttr;
- xmlAttrPtr trav;
- smart_str key = {0};
-
- newAttr = malloc(sizeof(sdlAttribute));
- memset(newAttr, 0, sizeof(sdlAttribute));
-
- if(cur_type->attributes == NULL)
- {
- cur_type->attributes = malloc(sizeof(HashTable));
- zend_hash_init(cur_type->attributes, 0, NULL, delete_attribute, 1);
- }
-
- trav = attrType->properties;
- FOREACHATTRNODE(trav, NULL, attr)
- {
- if(attr_is_equal_ex(trav, "default", SCHEMA_NAMESPACE))
- newAttr->def = strdup(attr->children->content);
- else if(attr_is_equal_ex(trav, "fixed", SCHEMA_NAMESPACE))
- newAttr->fixed = strdup(attr->children->content);
- else if(attr_is_equal_ex(trav, "form", SCHEMA_NAMESPACE))
- newAttr->form = strdup(attr->children->content);
- else if(attr_is_equal_ex(trav, "id", SCHEMA_NAMESPACE))
- newAttr->id = strdup(attr->children->content);
- else if(attr_is_equal_ex(trav, "name", SCHEMA_NAMESPACE))
- newAttr->name = strdup(attr->children->content);
- else if(attr_is_equal_ex(trav, "ref", SCHEMA_NAMESPACE))
- newAttr->ref= strdup(attr->children->content);
- else if(attr_is_equal_ex(trav, "type", SCHEMA_NAMESPACE))
- newAttr->type = strdup(attr->children->content);
- else if(attr_is_equal_ex(trav, "use", SCHEMA_NAMESPACE))
- newAttr->use = strdup(attr->children->content);
- else
- {
- xmlNsPtr nsPtr = attr_find_ns(trav);
-
- if(strcmp(nsPtr->href, SCHEMA_NAMESPACE))
- {
- smart_str key2 = {0};
-
- if(!newAttr->extraAttributes)
- {
- newAttr->extraAttributes = malloc(sizeof(HashTable));
- zend_hash_init(newAttr->extraAttributes, 0, NULL, NULL, 1);
- }
-
- smart_str_appends(&key2, nsPtr->href);
- smart_str_appendc(&key2, ':');
- smart_str_appends(&key2, trav->name);
- smart_str_0(&key2);
- zend_hash_add(newAttr->extraAttributes, key2.c, key2.len + 1, &trav, sizeof(xmlAttrPtr), NULL);
- smart_str_free(&key2);
- }
- }
- }
- ENDFOREACH(trav);
-
-
- if(newAttr->ref || newAttr->name)
- {
- xmlNsPtr ns;
-
- if(newAttr->ref)
- {
- char *value, *prefix = NULL;
-
- parse_namespace(newAttr->ref, &value, &prefix);
- ns = xmlSearchNs(attrType->doc, attrType, prefix);
- smart_str_appends(&key, ns->href);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, value);
-
- if(value)
- efree(value);
- if(prefix)
- efree(prefix);
- }
- else
- {
- ns = node_find_ns(attrType);
- smart_str_appends(&key, ns->href);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, newAttr->name);
- }
-
-
- if(ns)
- {
- smart_str_0(&key);
- zend_hash_add(cur_type->attributes, key.c, key.len + 1, &newAttr, sizeof(sdlAttributePtr), NULL);
- smart_str_free(&key);
- return TRUE;
- }
- }
-
- zend_hash_next_index_insert(cur_type->attributes, &newAttr, sizeof(sdlAttributePtr), NULL);
- return TRUE;
-} \ No newline at end of file
diff --git a/ext/soap/php_schema.h b/ext/soap/php_schema.h
deleted file mode 100644
index c43a221608..0000000000
--- a/ext/soap/php_schema.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef PHP_SCHEMA_H
-#define PHP_SCHEMA_H
-
-int load_schema(sdlPtr *sdl,xmlNodePtr schema);
-int schema_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpleType, sdlTypePtr cur_type);
-int schema_complexType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compType, sdlTypePtr cur_type);
-int schema_sequence(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr seqType, sdlTypePtr cur_type);
-int schema_list(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr listType, sdlTypePtr cur_type);
-int schema_union(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr unionType, sdlTypePtr cur_type);
-int schema_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpCompType, sdlTypePtr cur_type);
-int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
-int schema_restriction_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
-int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
-int schema_extension(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
-int schema_all(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
-int schema_group(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr cur_type);
-int schema_choice(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr cur_type);
-int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr cur_type);
-int schema_attribute(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type);
-int schema_any(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
-
-int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr);
-void delete_restriction_var_int(void *rvi);
-
-int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr);
-void delete_schema_restriction_var_char(void *srvc);
-
-#endif
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
deleted file mode 100644
index 9a9ce59dff..0000000000
--- a/ext/soap/php_sdl.c
+++ /dev/null
@@ -1,1126 +0,0 @@
-#include "php_soap.h"
-
-encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, char *type)
-{
- encodePtr enc = NULL;
- TSRMLS_FETCH();
-
- enc = get_conversion_from_type(data, type);
- if(enc == NULL && sdl)
- enc = get_conversion_from_type_ex(sdl->encoders, data, type);
- if(enc == NULL)
- enc = get_conversion(UNKNOWN_TYPE);
-
- return enc;
-}
-
-encodePtr get_encoder(sdlPtr sdl, char *ns, char *type)
-{
- encodePtr enc = NULL;
- char *nscat;
- TSRMLS_FETCH();
-
- nscat = emalloc(strlen(ns) + strlen(type) + 2);
- sprintf(nscat, "%s:%s", ns, type);
-
- enc = get_encoder_ex(sdl, nscat);
-
- efree(nscat);
- return enc;
-}
-
-encodePtr get_encoder_ex(sdlPtr sdl, char *nscat)
-{
- encodePtr enc = NULL;
- TSRMLS_FETCH();
-
- enc = get_conversion_from_href_type(nscat);
- if(enc == NULL && sdl)
- enc = get_conversion_from_href_type_ex(sdl->encoders, nscat, strlen(nscat));
- if(enc == NULL)
- enc = get_conversion(UNKNOWN_TYPE);
- return enc;
-}
-
-encodePtr get_create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type)
-{
- encodePtr enc = NULL;
- smart_str nscat = {0};
- TSRMLS_FETCH();
-
- smart_str_appends(&nscat, ns);
- smart_str_appendc(&nscat, ':');
- smart_str_appends(&nscat, type);
- smart_str_0(&nscat);
-
- enc = get_conversion_from_href_type(nscat.c);
- if(enc == NULL)
- enc = get_conversion_from_href_type_ex(sdl->encoders, nscat.c, nscat.len);
- if(enc == NULL)
- enc = create_encoder(sdl, cur_type, ns, type);
-
- smart_str_free(&nscat);
- return enc;
-}
-
-encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type)
-{
- smart_str nscat = {0};
- encodePtr enc;
-
- enc = malloc(sizeof(encode));
- memset(enc, 0, sizeof(encode));
-
- smart_str_appends(&nscat, ns);
- smart_str_appendc(&nscat, ':');
- smart_str_appends(&nscat, type);
- smart_str_0(&nscat);
-
- enc->details.ns = strdup(ns);
- enc->details.type_str = strdup(type);
- enc->details.sdl_type = cur_type;
- enc->to_xml = sdl_guess_convert_xml;
- enc->to_zval = sdl_guess_convert_zval;
-
- if(sdl->encoders == NULL)
- {
- sdl->encoders = malloc(sizeof(HashTable));
- zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, 1);
- }
- zend_hash_add(sdl->encoders, nscat.c, nscat.len + 1, &enc, sizeof(encodePtr), NULL);
- smart_str_free(&nscat);
- return enc;
-}
-
-zval *sdl_guess_convert_zval(encodeType enc, xmlNodePtr data)
-{
- sdlTypePtr type;
- zval *ret;
-
- type = enc.sdl_type;
-
- if(type->encode)
- {
- if(type->encode->details.type == IS_ARRAY ||
- type->encode->details.type == SOAP_ENC_ARRAY)
- ret = to_zval_array(enc, data);
- else
- ret = master_to_zval(type->encode, data);
- }
- else if(zend_hash_num_elements(type->elements) == 1)
- {
- sdlTypePtr *t;
- zend_hash_internal_pointer_reset(type->elements);
- if(zend_hash_get_current_data(type->elements, (void **)&t) != FAILURE &&
- (*t)->max_occurs != 1)
- ret = to_zval_array(enc, data);
- }
- if(ret)
- return ret;
- else
- return guess_zval_convert(enc, data);
-}
-
-xmlNodePtr sdl_guess_convert_xml(encodeType enc, zval *data, int style)
-{
- sdlTypePtr type;
- xmlNodePtr ret = NULL;
-
- type = enc.sdl_type;
-
- if(type->encode)
- {
- if(type->encode->details.type == IS_ARRAY ||
- type->encode->details.type == SOAP_ENC_ARRAY)
- ret = sdl_to_xml_array(type, data, style);
- else
- ret = master_to_xml(type->encode, data, style);
- }
- else if(type->elements)
- {
- sdlTypePtr *t;
- if(zend_hash_num_elements(type->elements) == 1)
- {
- zend_hash_internal_pointer_reset(type->elements);
- if(zend_hash_get_current_data(type->elements, (void **)&t) != FAILURE &&
- (*t)->max_occurs != 1)
- ret = sdl_to_xml_array((*t), data, style);
- }
- if(!ret)
- ret = sdl_to_xml_object(type, data, style);
- }
- else
- ret = guess_xml_convert(enc, data, style);
-
- //set_ns_and_type(ret, enc);
- return ret;
-}
-
-xmlNodePtr sdl_to_xml_object(sdlTypePtr type, zval *data, int style)
-{
- xmlNodePtr ret;
- sdlTypePtr *t, tmp;
-
- ret = xmlNewNode(NULL, "BOGUS");
-
- zend_hash_internal_pointer_reset(type->elements);
- while(zend_hash_get_current_data(type->elements, (void **)&t) != FAILURE)
- {
- zval **prop;
- tmp = *t;
- if(zend_hash_find(Z_OBJPROP_P(data), tmp->name, strlen(tmp->name) + 1, (void **)&prop) == FAILURE)
- {
- if(tmp->nullable == FALSE)
- php_error(E_ERROR, "Error encoding object to xml missing property \"%s\"", tmp->name);
- }
- else
- {
- xmlNodePtr newNode;
-
- newNode = master_to_xml(tmp->encode, (*prop), style);
- xmlNodeSetName(newNode, tmp->name);
- xmlAddChild(ret, newNode);
- }
- zend_hash_move_forward(type->elements);
- }
-
- return ret;
-}
-
-xmlNodePtr sdl_to_xml_array(sdlTypePtr type, zval *data, int style)
-{
- smart_str array_type_and_size = {0}, array_type = {0};
- int i;
- xmlNodePtr xmlParam;
- TSRMLS_FETCH();
-
- xmlParam = xmlNewNode(NULL,"BOGUS");
-
- FIND_ZVAL_NULL(data, xmlParam);
-
- if(Z_TYPE_P(data) == IS_ARRAY)
- {
- sdlAttributePtr *arrayType;
- i = zend_hash_num_elements(Z_ARRVAL_P(data));
-
- if(style == SOAP_ENCODED)
- {
- if(type->attributes &&
- zend_hash_find(type->attributes, SOAP_ENC_NAMESPACE":arrayType",
- sizeof(SOAP_ENC_NAMESPACE":arrayType"),
- (void **)&arrayType) == SUCCESS)
- {
- xmlAttrPtr *wsdl;
- if(zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arrayType", sizeof(WSDL_NAMESPACE":arrayType"), (void **)&wsdl) == SUCCESS)
- {
- char *ns = NULL, *value;
- smart_str *prefix = encode_new_ns();
- smart_str smart_ns = {0};
- xmlNsPtr myNs;
-
- parse_namespace((*wsdl)->children->content, &value, &ns);
- myNs = xmlSearchNs((*wsdl)->doc, (*wsdl)->parent, ns);
-
- smart_str_appendl(&smart_ns, "xmlns:", sizeof("xmlns:") - 1);
- smart_str_appendl(&smart_ns, prefix->c, prefix->len);
- smart_str_0(&smart_ns);
-
- xmlSetProp(xmlParam, smart_ns.c, myNs->href);
- smart_str_appends(&array_type_and_size, prefix->c);
- smart_str_appendc(&array_type_and_size, ':');
- smart_str_appends(&array_type_and_size, value);
- smart_str_0(&array_type_and_size);
- }
- }
- else
- {
- smart_str_appends(&array_type_and_size, type->name);
- smart_str_appendc(&array_type_and_size, '[');
- smart_str_append_long(&array_type_and_size, i);
- smart_str_appendc(&array_type_and_size, ']');
- smart_str_0(&array_type_and_size);
- }
- xmlSetProp(xmlParam, SOAP_ENC_NS_PREFIX":arrayType", array_type_and_size.c);
-
- smart_str_free(&array_type_and_size);
- smart_str_free(&array_type);
- }
-
- zend_hash_internal_pointer_reset(data->value.ht);
- for(;i > 0;i--)
- {
- xmlNodePtr xparam;
- zval **zdata;
- encodePtr enc;
- zend_hash_get_current_data(data->value.ht, (void **)&zdata);
-
- enc = get_conversion((*zdata)->type);
- xparam = master_to_xml(enc, (*zdata), style);
-
- xmlNodeSetName(xparam, type->name);
- xmlAddChild(xmlParam, xparam);
- zend_hash_move_forward(data->value.ht);
- }
- }
-
- if(style == SOAP_ENCODED)
- set_ns_and_type_ex(xmlParam, type->namens, type->name);
- return xmlParam;
-}
-
-zval *sdl_convert_zval(encodeType enc, xmlNodePtr data)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
- ZVAL_STRING(ret, "blah", 1);
-
- return ret;
-}
-
-/*
-zval *sdl_convert_zval(xmlNodePtr data, sdlTypePtr type)
-{
- found = zend_hash_find(EG(class_table), class_name, class_name_len + 1, (void **)&ce);
- if(found != FAILURE)
- {
- service->type = SOAP_CLASS;
- service->soap_class.ce = ce;
- }
-}
-//this function will take a zval and apply all attributes of sldTypePtr
-zval *sdl_convert_zval_to_zval(zval *data, sdlTypePtr type)
-{
-}
-*/
-
-sdlPtr get_sdl(char *uri)
-{
- sdlPtr tmp, *hndl;
- TSRMLS_FETCH();
-
- tmp = NULL;
- hndl = NULL;
- if(zend_hash_find(SOAP_GLOBAL(sdls), uri, strlen(uri), (void **)&hndl) == FAILURE)
- {
- tmp = load_wsdl(uri, NULL);
- zend_hash_add(SOAP_GLOBAL(sdls), uri, strlen(uri), &tmp, sizeof(sdlPtr), NULL);
- }
- else
- tmp = *hndl;
-
- return tmp;
-}
-
-sdlBindingPtr get_binding_from_type(sdlPtr sdl, int type)
-{
- sdlBindingPtr *binding;
-
- for(zend_hash_internal_pointer_reset(sdl->bindings);
- zend_hash_get_current_data(sdl->bindings, (void **) &binding) == SUCCESS;
- zend_hash_move_forward(sdl->bindings))
- {
- if((*binding)->bindingType == type)
- return *binding;
- }
- return NULL;
-}
-
-sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns)
-{
- sdlBindingPtr binding = NULL;
- smart_str key = {0};
-
- smart_str_appends(&key, ns);
- smart_str_appendc(&key, ':');
- smart_str_appends(&key, name);
-
- zend_hash_find(sdl->bindings, key.c, key.len, (void **)&binding);
-
- smart_str_free(&key);
- return binding;
-}
-
-int load_php_sdl()
-{
-/* xmlNodePtr rootElement;
- xmlNodePtr services;
-
- SOAP_SERVER_GLOBAL_VARS();
- SOAP_SERVER_GLOBAL(availableServices) = xmlParseFile(servicesFile);
- rootElement = SOAP_SERVER_GLOBAL(availableServices)->children;
- services = rootElement->children;
-
- do
- {
- if(IS_ELEMENT_TYPE(services,PHP_SOAPSERVER_SERVICE))
- {
- phpSoapServicePtr newService;
- xmlNodePtr attrib, trav;
- HashTable *fn = NULL;
- HashTable *include = NULL;
- HashTable *cl = NULL;
-
- //Init New Service
- newService = emalloc(sizeof(phpSoapService));
- newService->serviceNode = services;
- newService->started = FALSE;
-
- fn = newService->functions = emalloc(sizeof(HashTable));
- include = newService->include_files = emalloc(sizeof(HashTable));
- zend_hash_init(fn, 0, NULL, free_function, 0);
- zend_hash_init(include, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- attrib = services->properties;
- trav = attrib;
- //Get Attributes of Service
- do
- {
- if(IS_ATTRIBUTE_TYPE(trav,PHP_SOAPSERVER_SERVICE_NAME))
- {
- char* name = ATTRIBUTE_VALUE(trav);
-
- //Assign Service Vals
- ALLOC_INIT_ZVAL(newService->serviceName);
- ZVAL_STRING(newService->serviceName,name,1);
- }
-
- if(IS_ATTRIBUTE_TYPE(trav,PHP_SOAPSERVER_SERVICE_STARTED))
- {
- char* started = ATTRIBUTE_VALUE(trav);
-
- //Assign Service Vals
- if(!stricmp(started,"true"))
- newService->started = TRUE;
- }
- }
- while(trav = trav->next);
-
- //Get ChildNodes of Service
- trav = services->children;
- do
- {
- //Include Files
- if(IS_ELEMENT_TYPE(trav,PHP_SOAPSERVER_SERVICE_INCLUDE_FILE))
- {
- xmlNodePtr trav1 = trav->properties;
- do
- {
- if(IS_ATTRIBUTE_TYPE(trav1,PHP_SOAPSERVER_SERVICE_INCLUDE_FILE_NAME))
- {
- char* name = ATTRIBUTE_VALUE(trav1);
- zval* z_name;
- ALLOC_INIT_ZVAL(z_name);
- ZVAL_STRING(z_name,name,1);
- zend_hash_next_index_insert(include,&z_name,sizeof(zval),NULL);
- }
- }
- while(trav1 = trav1->next);
- }
-
- //Functions
- if(IS_ELEMENT_TYPE(trav,PHP_SOAPSERVER_SERVICE_FUNCTION))
- {
- phpSoapServiceFunctionPtr function;
- xmlNodePtr trav1;
- HashTable *par = NULL;
-
- function = emalloc(sizeof(phpSoapServiceFunction));
- function->functionNode = trav;
-
- par = function->functionParams = emalloc(sizeof(HashTable));
- zend_hash_init(par, 0, NULL, free_param, 0);
-
- trav1 = trav->properties;
-
- do
- {
- if(IS_ATTRIBUTE_TYPE(trav1,PHP_SOAPSERVER_SERVICE_FUNCTION_NAME))
- {
- char* name = ATTRIBUTE_VALUE(trav1);
- ALLOC_INIT_ZVAL(function->functionName);
- ZVAL_STRING(function->functionName,name,1);
- }
- }
- while(trav1 = trav1->next);
-
- trav1 = trav->children;
- do
- {
- if(IS_ELEMENT_TYPE(trav1,PHP_SOAPSERVER_SERVICE_FUNCTION_PARAM))
- {
- phpSoapServiceParamPtr param;
- xmlNodePtr trav2;
-
- param = emalloc(sizeof(phpSoapServiceParam));
- param->paramNode = trav1;
-
- trav2 = trav1->properties;
-
- do
- {
- if(IS_ATTRIBUTE_TYPE(trav2,PHP_SOAPSERVER_SERVICE_FUNCTION_PARAM_NAME))
- {
- char* name = ATTRIBUTE_VALUE(trav2);
- ALLOC_INIT_ZVAL(param->paramName);
- ZVAL_STRING(param->paramName,name,1);
- }
- else if(IS_ATTRIBUTE_TYPE(trav2,PHP_SOAPSERVER_SERVICE_FUNCTION_PARAM_TYPE))
- {
- char* type = ATTRIBUTE_VALUE(trav2);
- ALLOC_INIT_ZVAL(param->paramType);
- ZVAL_STRING(param->paramType,type,1);
- }
- else if(IS_ATTRIBUTE_TYPE(trav2,PHP_SOAPSERVER_SERVICE_FUNCTION_PARAM_POSITION))
- {
- char* val = ATTRIBUTE_VALUE(trav2);
- ALLOC_INIT_ZVAL(param->paramName);
- ZVAL_LONG(param->paramName,atoi(val));
- }
- }
- while(trav2 = trav2->next);
- zend_hash_add(par,Z_STRVAL_P(param->paramName),Z_STRLEN_P(param->paramName),param,sizeof(phpSoapServiceParam),NULL);
- }
- }
- while(trav1 = trav1->next);
- zend_hash_add(fn,Z_STRVAL_P(function->functionName),Z_STRLEN_P(function->functionName),function,sizeof(phpSoapServiceFunction),NULL);
- }
-
- //Classes
- if(IS_ELEMENT_TYPE(trav,PHP_SOAPSERVER_SERVICE_CLASS))
- {
- xmlNodePtr att, func;
- att = trav->properties;
-
- if(fn == NULL)
- {
- fn = newService->functions = emalloc(sizeof(HashTable));
- zend_hash_init(fn, 0, NULL, ZVAL_PTR_DTOR, 0);
- }
-
- }
-
- }while(trav = trav->next);
-
- zend_hash_add(SOAP_SERVER_GLOBAL(services),Z_STRVAL_P(newService->serviceName),Z_STRLEN_P(newService->serviceName),newService,sizeof(phpSoapService),NULL);
- }
- }
- while(services = services->next);
-*/
- return TRUE;
-}
-
-int write_php_sdl()
-{
- return TRUE;
-}
-
-sdlPtr load_wsdl(char *struri, sdlPtr parent)
-{
- xmlDocPtr wsdl;
- xmlNodePtr root, definitions, types, binding, schema, service, import;
- xmlNodePtr trav, trav2, trav3;
- xmlAttrPtr targetNamespace;
- sdlPtr tmpsdl;
- TSRMLS_FETCH();
-
- if(!parent)
- {
- tmpsdl = malloc(sizeof(sdl));
- memset(tmpsdl, 0, sizeof(sdl));
- tmpsdl->source = strdup(struri);
- }
- else
- tmpsdl = parent;
-
- wsdl = xmlParseFile(struri);
- xmlCleanupParser();
-
- if(!wsdl)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Could't load");
-
- tmpsdl->doc = wsdl;
- root = wsdl->children;
- definitions = get_node(root, "definitions");
- if(!definitions)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Could't find definitions");
-
- targetNamespace = get_attribute(definitions->properties, "targetNamespace");
- if(targetNamespace)
- tmpsdl->target_ns = strdup(targetNamespace->children->content);
-
- types = get_node(definitions->children, "types");
- if(types)
- {
- trav = types->children;
- FOREACHNODE(trav, "schema", schema)
- {
- load_schema(&tmpsdl, schema);
- }
- ENDFOREACH(trav);
- }
-
- trav = definitions->children;
- FOREACHNODE(trav, "import", import)
- {
- xmlAttrPtr tmp = get_attribute(import->properties, "location");
- if(tmp)
- load_wsdl(tmp->children->content, tmpsdl);
- }
- ENDFOREACH(trav);
-
- service = get_node(definitions->children, "service");
- if(service != NULL)
- {
- xmlAttrPtr name;
- xmlNodePtr trav, port;
-
- name = get_attribute(service->properties, "name");
- if(!name)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No name associated with service");
-
- trav = service->children;
- FOREACHNODE(trav, "port", port)
- {
- xmlAttrPtr type, name, bindingAttr, location;
- xmlNodePtr portType, operation;
- xmlNodePtr address;
- char *ns, *ctype;
- sdlBindingPtr tmpbinding;
-
- tmpbinding = malloc(sizeof(sdlBinding));
- memset(tmpbinding, 0, sizeof(sdlBinding));
-
- name = get_attribute(port->properties, "name");
- if(!name)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No name associated with port");
-
- bindingAttr = get_attribute(port->properties, "binding");
- if(bindingAttr == NULL)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No binding associated with port");
-
- //find address and figure out binding type
- address = get_node(port->children, "address");
- if(!address)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No address associated with port");
-
- location = get_attribute(address->properties, "location");
- if(!location)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No location associated with port");
-
- tmpbinding->location = strdup(location->children->content);
-
- if(address->ns && !strcmp(address->ns->href, WSDL_SOAP_NAMESPACE))
- tmpbinding->bindingType = BINDING_SOAP;
- else if(address->ns && !strcmp(address->ns->href, WSDL_HTTP_NAMESPACE))
- tmpbinding->bindingType = BINDING_HTTP;
-
- parse_namespace(bindingAttr->children->content, &ctype, &ns);
- binding = get_node_with_attribute(definitions->children, "binding", "name", ctype);
- if(ns) efree(ns); if(ctype) efree(ctype);
-
- if(!binding)
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No binding");
-
- if(tmpbinding->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingPtr soapBinding;
- xmlNodePtr soapBindingNode;
- xmlAttrPtr tmp;
-
- soapBinding = malloc(sizeof(sdlSoapBinding));
- memset(soapBinding, 0, sizeof(sdlSoapBinding));
-
- soapBindingNode = get_node_ex(binding->children, "binding", WSDL_SOAP_NAMESPACE);
- if(soapBindingNode)
- {
- tmp = get_attribute(soapBindingNode->properties, "style");
- if(tmp && !strcmp(tmp->children->content, "document"))
- soapBinding->style = SOAP_DOCUMENT;
- else
- soapBinding->style = SOAP_RPC;
-
- tmp = get_attribute(soapBindingNode->properties, "transport");
- if(tmp)
- {
- if(strcmp(tmp->children->content, WSDL_HTTP_TRANSPORT))
- php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: PHP-SOAP doesn't support transport '%s'", tmp->children->content);
-
- soapBinding->transport = strdup(tmp->children->content);
- }
- tmpbinding->bindingAttributes = (void *)soapBinding;
- }
- }
-
- name = get_attribute(binding->properties, "name");
- if(name == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing \"name\" attribute for \"binding\")");
-
- tmpbinding->name = strdup(name->children->content);
-
- type = get_attribute(binding->properties, "type");
- if(type == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing \"type\" attribute for \"binding\")");
-
- parse_namespace(type->children->content, &ctype, &ns);
- portType = get_node_with_attribute(definitions->children, "portType", "name", ctype);
- if(portType == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing \"portType\" with name \"%s\")", name->children->content);
- if(ctype) efree(ctype); if(ns) efree(ns);
-
- trav2 = binding->children;
- FOREACHNODE(trav2, "operation", operation)
- {
- sdlFunctionPtr function;
- xmlNodePtr input, output, fault, portTypeOperation, portTypeInput, msgInput, msgOutput;
- xmlAttrPtr op_name, paramOrder;
-
- op_name = get_attribute(operation->properties, "name");
- if(op_name == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing \"name\" attribute for \"operation\")");
-
- portTypeOperation = get_node_with_attribute(portType->children, "operation", "name", op_name->children->content);
- if(portTypeOperation == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing \"portType/operation\" with name \"%s\")", op_name->children->content);
-
- function = malloc(sizeof(sdlFunction));
- function->functionName = strdup(op_name->children->content);
- function->requestParameters = NULL;
- function->responseParameters = NULL;
- function->responseName = NULL;
- function->bindingAttributes = NULL;
- function->bindingType = tmpbinding->bindingType;
-
- if(tmpbinding->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingFunctionPtr soapFunctionBinding;
- sdlSoapBindingPtr soapBinding;
- xmlNodePtr soapOperation;
- xmlAttrPtr tmp;
-
- soapFunctionBinding = malloc(sizeof(sdlSoapBindingFunction));
- memset(soapFunctionBinding, 0, sizeof(sdlSoapBindingFunction));
- soapBinding = (sdlSoapBindingPtr)tmpbinding->bindingAttributes;
- soapFunctionBinding->style = soapBinding->style;
-
- soapOperation = get_node_ex(operation->children, "operation", WSDL_SOAP_NAMESPACE);
- if(soapOperation)
- {
- tmp = get_attribute(soapOperation->properties, "soapAction");
- if(tmp)
- soapFunctionBinding->soapAction = strdup(tmp->children->content);
-
- tmp = get_attribute(soapOperation->properties, "style");
- if(tmp && !strcmp(tmp->children->content, "rpc"))
- soapFunctionBinding->style = SOAP_RPC;
- else if(!soapBinding->style)
- soapFunctionBinding->style = SOAP_DOCUMENT;
- }
-
- function->bindingAttributes = (void *)soapFunctionBinding;
- }
-
- input = get_node(operation->children, "input");
- if(input != NULL)
- {
- xmlAttrPtr message;
- xmlNodePtr part;
- char *ns, *ctype;
-
- portTypeInput = get_node(portTypeOperation->children, "input");
- message = get_attribute(portTypeInput->properties, "message");
- if(message == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing name for \"input\" of \"%s\")", op_name->children->content);
-
- function->requestName = strdup(function->functionName);
- function->requestParameters = malloc(sizeof(HashTable));
- zend_hash_init(function->requestParameters, 0, NULL, delete_paramater, 1);
-
- parse_namespace(message->children->content, &ctype, &ns);
- msgInput = get_node_with_attribute(definitions->children, "message", "name", ctype);
- if(msgInput == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing \"message\" with name \"%s\")", message->children->content);
- if(ctype) efree(ctype); if(ns) efree(ns);
-
- if(tmpbinding->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingFunctionPtr soapFunctionBinding = function->bindingAttributes;
- xmlNodePtr body;
- xmlAttrPtr tmp;
-
- body = get_node_ex(input->children, "body", WSDL_SOAP_NAMESPACE);
- if(body)
- {
- tmp = get_attribute(body->properties, "use");
- if(tmp && !strcmp(tmp->children->content, "literal"))
- soapFunctionBinding->input.use = SOAP_LITERAL;
- else
- soapFunctionBinding->input.use = SOAP_ENCODED;
-
- tmp = get_attribute(body->properties, "namespace");
- if(tmp)
- soapFunctionBinding->input.ns = strdup(tmp->children->content);
-
- tmp = get_attribute(body->properties, "parts");
- if(tmp)
- soapFunctionBinding->input.parts = strdup(tmp->children->content);
-
- tmp = get_attribute(body->properties, "encodingStyle");
- if(tmp)
- soapFunctionBinding->input.encodingStyle = strdup(tmp->children->content);
- }
- }
-
- trav3 = msgInput->children;
- FOREACHNODE(trav3, "part", part)
- {
- xmlAttrPtr element, type, name;
- sdlParamPtr param;
-
- param = malloc(sizeof(sdlParam));
- param->order = 0;
-
- name = get_attribute(part->properties, "name");
- if(name == NULL)
- php_error(E_ERROR, "Error parsing wsdl (No name associated with part \"%s\")", msgInput->name);
-
- param->paramName = strdup(name->children->content);
-
- element = get_attribute(part->properties, "element");
- if(element != NULL)
- param->encode = get_encoder_from_prefix(tmpsdl, part, element->children->content);
-
- type = get_attribute(part->properties, "type");
- if(type != NULL)
- param->encode = get_encoder_from_prefix(tmpsdl, part, type->children->content);
-
- zend_hash_next_index_insert(function->requestParameters, &param, sizeof(sdlParamPtr), NULL);
- }
- ENDFOREACH(trav3);
- }
-
- paramOrder = get_attribute(portTypeOperation->properties, "parameterOrder");
- if(paramOrder)
- {
-
- }
-
- output = get_node(portTypeOperation->children, "output");
- if(output != NULL)
- {
- xmlAttrPtr message;
- xmlNodePtr part;
- char *ns, *ctype;
-
-
- function->responseName = malloc(strlen(function->functionName) + strlen("Response") + 1);
- sprintf(function->responseName, "%sResponse\0", function->functionName);
- function->responseParameters = malloc(sizeof(HashTable));
- zend_hash_init(function->responseParameters, 0, NULL, delete_paramater, 1);
-
- message = get_attribute(output->properties, "message");
- if(message == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing name for \"output\" of \"%s\")", op_name->children->content);
-
- parse_namespace(message->children->content, &ctype, &ns);
- msgOutput = get_node_with_attribute(definitions->children, "message", "name", ctype);
- if(msgOutput == NULL)
- php_error(E_ERROR, "Error parsing wsdl (Missing \"message\" with name \"%s\")", message->children->content);
- if(ctype) efree(ctype); if(ns) efree(ns);
-
- if(tmpbinding->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingFunctionPtr soapFunctionBinding = function->bindingAttributes;
- xmlNodePtr body;
- xmlAttrPtr tmp;
-
- body = get_node_ex(output->children, "body", WSDL_SOAP_NAMESPACE);
- if(body)
- {
- tmp = get_attribute(body->properties, "use");
- if(tmp && !strcmp(tmp->children->content, "literal"))
- soapFunctionBinding->output.use = SOAP_LITERAL;
- else
- soapFunctionBinding->output.use = SOAP_ENCODED;
-
- tmp = get_attribute(body->properties, "namespace");
- if(tmp)
- soapFunctionBinding->output.ns = strdup(tmp->children->content);
-
- tmp = get_attribute(body->properties, "parts");
- if(tmp)
- soapFunctionBinding->output.parts = strdup(tmp->children->content);
-
- tmp = get_attribute(body->properties, "encodingStyle");
- if(tmp)
- soapFunctionBinding->output.encodingStyle = strdup(tmp->children->content);
- }
- }
-
- trav3 = msgOutput->children;
- FOREACHNODE(trav3, "part", part)
- {
- sdlParamPtr param;
- xmlAttrPtr element, type, name;
-
- param = malloc(sizeof(sdlParam));
- param->order = 0;
-
- name = get_attribute(part->properties, "name");
- if(name == NULL)
- php_error(E_ERROR, "Error parsing wsdl (No name associated with part \"%s\")", msgOutput->name);
-
- param->paramName = strdup(name->children->content);
-
- element = get_attribute(part->properties, "element");
- if(element)
- param->encode = get_encoder_from_prefix(tmpsdl, part, element->children->content);
-
- type = get_attribute(part->properties, "type");
- if(type)
- param->encode = get_encoder_from_prefix(tmpsdl, part, type->children->content);
-
- zend_hash_next_index_insert(function->responseParameters, &param, sizeof(sdlParamPtr), NULL);
- }
- ENDFOREACH(trav3);
- }
-
- fault = get_node(operation->children, "fault");
- if(!fault)
- {
- }
-
- if(!tmpbinding->functions)
- {
- tmpbinding->functions = malloc(sizeof(HashTable));
- zend_hash_init(tmpbinding->functions, 0, NULL, delete_function, 1);
- }
-
- zend_hash_add(tmpbinding->functions, php_strtolower(function->functionName, strlen(function->functionName)), strlen(function->functionName), &function, sizeof(sdlFunctionPtr), NULL);
- }
- ENDFOREACH(trav2);
-
- if(!tmpsdl->bindings)
- {
- tmpsdl->bindings = malloc(sizeof(HashTable));
- zend_hash_init(tmpsdl->bindings, 0, NULL, delete_binding, 1);
- }
-
- zend_hash_add(tmpsdl->bindings, tmpbinding->name, strlen(tmpbinding->name), &tmpbinding, sizeof(sdlBindingPtr), NULL);
- }
- ENDFOREACH(trav);
-
- }
- else
- php_error(E_ERROR, "Error parsing wsdl (\"Couldn't bind to service\")");
-
- return tmpsdl;
-}
-
-int write_wsdl()
-{
- return TRUE;
-}
-
-int write_ms_sdl()
-{
- return TRUE;
-}
-
-int load_ms_sdl(char *struri,int force_load)
-{
-/* Commenting this out. Does anyone need it?
-
- if(get_sdl(struri) == NULL || force_load)
- {
- SOAP_TLS_VARS();
- xmlDocPtr sdl = xmlParseFile(struri);
- xmlNodePtr schema,trav,trav2,req,res,paramOrd,reqRes,address,serviceAdd,service,soap,serviceDesc,root = sdl->children;
- xmlAttrPtr tmpattr,uri;
- char *add,*functionName,*soapAction,*request,*response,*parameterOrder,*value,*namespace;
- SDLPtr sdlPtr;
- SoapFunctionPtr tmpFunction;
- zval *tempZval;
- serviceDesc = get_node(root,"serviceDescription");
- soap = get_node(serviceDesc->children,"soap");
- trav = soap->children;
- sdlPtr = emalloc(sizeof(SDL));
-
- ALLOC_INIT_ZVAL(sdlPtr->sdlUri);
- ZVAL_STRING(sdlPtr->sdlUri,struri,1);
-
- FOREACHNODE(trav,"service",service)
- {
- sdlPtr->soapFunctions = emalloc(sizeof(HashTable));
- sdlPtr->addresses = emalloc(sizeof(HashTable));
- zend_hash_init(sdlPtr->soapFunctions, 0, NULL, delete_function, 0);
- zend_hash_init(sdlPtr->addresses, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- serviceAdd = get_node(service->children,"addresses");
- trav2 = serviceAdd->children;
- ALLOC_INIT_ZVAL(tempZval);
- FOREACHNODE(trav2,"address",address)
- {
- uri = get_attribute(address->properties,"uri");
- add = uri->children->content;
- ZVAL_STRING(tempZval,add,1);
- zend_hash_next_index_insert(sdlPtr->addresses,tempZval,sizeof(zval),NULL);
- }
- ENDFOREACH(trav2);
- trav2 = service->children;
- FOREACHNODE(trav2,"requestResponse",reqRes)
- {
- tmpFunction = emalloc(sizeof(SoapFunction));
-
- tmpattr = get_attribute(reqRes->properties,"name");
- functionName = tmpattr->children->content;
- ALLOC_INIT_ZVAL(tmpFunction->functionName);
- ZVAL_STRING(tmpFunction->functionName,functionName,1);
-
- tmpattr = get_attribute(reqRes->properties,"soapAction");
- soapAction = tmpattr->children->content;
- ALLOC_INIT_ZVAL(tmpFunction->soapAction);
- ZVAL_STRING(tmpFunction->soapAction,soapAction,1);
-
- //Request
- req = get_node(reqRes->children,"request");
- tmpattr = get_attribute(req->properties,"ref");
- if(tmpattr != NULL)
- {
- request = tmpattr->children->content;
- parse_namespace(request,&value,&namespace);
- ALLOC_INIT_ZVAL(tmpFunction->requestName);
- ZVAL_STRING(tmpFunction->requestName,value,1);
- tmpFunction->requestParameters = emalloc(sizeof(HashTable));
- zend_hash_init(tmpFunction->requestParameters, 0, NULL, delete_paramater, 0);
- efree(value);
- efree(namespace);
- }
-
- //Response
- res = get_node(reqRes->children,"response");
- tmpattr = get_attribute(res->properties,"ref");
- if(tmpattr != NULL)
- {
- response = tmpattr->children->content;
- parse_namespace(response,&value,&namespace);
- ALLOC_INIT_ZVAL(tmpFunction->responseName);
- ZVAL_STRING(tmpFunction->responseName,value,1);
- tmpFunction->responseParameters = emalloc(sizeof(HashTable));
- zend_hash_init(tmpFunction->responseParameters, 0, NULL, delete_paramater, 0);
- efree(value);
- efree(namespace);
- }
-
- //Parameters
- paramOrd = get_node(reqRes->children,"parameterorder");
- if(paramOrd != NULL)
- {
- zval *space,*array,**strval;
- int count,i;
- ALLOC_INIT_ZVAL(space);
- ZVAL_STRING(space," ",0);
- parameterOrder = paramOrd->children->content;
- ZVAL_STRING(tempZval,parameterOrder,1);
- ALLOC_INIT_ZVAL(array);
- array_init(array);
-
- //Split on space
- php_explode(space, tempZval, array, -1);
- zend_hash_internal_pointer_reset(array->value.ht);
- count = zend_hash_num_elements(array->value.ht);
-
- for(i = 0;i < count;i++)
- {
- SoapParamPtr param;
- param = emalloc(sizeof(SoapParam));
- param->order = i+1;
- param->type = NULL;
- zend_hash_get_current_data(array->value.ht,(void **)&strval);
- ALLOC_INIT_ZVAL(param->paramName);
- ZVAL_STRING(param->paramName,Z_STRVAL_PP(strval),1);
- zend_hash_next_index_insert(tmpFunction->requestParameters,param,sizeof(SoapParam),NULL);
- zend_hash_move_forward(array->value.ht);
- }
- }
- zend_hash_add(sdlPtr->soapFunctions,(char *)php_strtolower(functionName,strlen(functionName)),strlen(functionName),tmpFunction,sizeof(SoapFunction),NULL);
- }
- ENDFOREACH(trav2);
- }
- ENDFOREACH(trav);
-
- trav = serviceDesc->children;
- FOREACHNODE(trav,"schema",schema)
- {
- load_schema(&sdlPtr, schema);
- }
- ENDFOREACH(trav);
- sdlPtr->have_sdl = 1;
- map_types_to_functions(sdlPtr);
- zend_hash_add(SOAP_GLOBAL(SDLs),struri,strlen(struri),sdlPtr,sizeof(SDL),NULL);
- }*/
- return FALSE;
-}
-
-void delete_type(void *data)
-{
- sdlTypePtr type = *((sdlTypePtr*)data);
- if(type->name)
- free(type->name);
- if(type->namens)
- free(type->namens);
- if(type->elements)
- {
- zend_hash_destroy(type->elements);
- free(type->elements);
- }
- if(type->attributes)
- {
- zend_hash_destroy(type->attributes);
- free(type->attributes);
- }
- if(type->restrictions)
- {
- delete_restriction_var_int(&type->restrictions->minExclusive);
- delete_restriction_var_int(&type->restrictions->minInclusive);
- delete_restriction_var_int(&type->restrictions->maxExclusive);
- delete_restriction_var_int(&type->restrictions->maxInclusive);
- delete_restriction_var_int(&type->restrictions->totalDigits);
- delete_restriction_var_int(&type->restrictions->fractionDigits);
- delete_restriction_var_int(&type->restrictions->length);
- delete_restriction_var_int(&type->restrictions->minLength);
- delete_restriction_var_int(&type->restrictions->maxLength);
- delete_schema_restriction_var_char(&type->restrictions->whiteSpace);
- delete_schema_restriction_var_char(&type->restrictions->pattern);
- zend_hash_destroy(type->restrictions->enumeration);
- free(type->restrictions->enumeration);
- free(type->restrictions);
- }
- free(type);
-}
-
-void delete_attribute(void *attribute)
-{
- sdlAttributePtr attr = *((sdlAttributePtr*)attribute);
-
- if(attr->def)
- free(attr->def);
- if(attr->fixed)
- free(attr->fixed);
- if(attr->form)
- free(attr->form);
- if(attr->id)
- free(attr->id);
- if(attr->name)
- free(attr->name);
- if(attr->ref)
- free(attr->ref);
- if(attr->type)
- free(attr->type);
- if(attr->use)
- free(attr->use);
- if(attr->extraAttributes)
- {
- zend_hash_destroy(attr->extraAttributes);
- free(attr->extraAttributes);
- }
-}
diff --git a/ext/soap/php_sdl.h b/ext/soap/php_sdl.h
deleted file mode 100644
index b061b4aded..0000000000
--- a/ext/soap/php_sdl.h
+++ /dev/null
@@ -1,167 +0,0 @@
-#ifndef PHP_SDL_H
-#define PHP_SDL_H
-
-#define XSD_WHITESPACE_COLLAPSE 1
-#define XSD_WHITESPACE_PRESERVE 1
-#define XSD_WHITESPACE_REPLACE 1
-
-#define BINDING_SOAP 1
-#define BINDING_HTTP 2
-
-#define SOAP_RPC 1
-#define SOAP_DOCUMENT 2
-
-#define SOAP_ENCODED 1
-#define SOAP_LITERAL 2
-
-struct _sdl
-{
- xmlDocPtr doc; //pointer to the parsed xml file
- HashTable *types; //array of sdlTypesPtr
- HashTable *encoders; //array of encodePtr
- HashTable *bindings; //array of sdlBindings (key'd by name)
- char *target_ns;
- char *source;
-};
-
-struct _sdlBinding
-{
- char *name;
- HashTable *functions;
- char *location;
- int bindingType;
- void *bindingAttributes;
-};
-
-//Soap Binding Specfic stuff
-struct _sdlSoapBinding
-{
- char *transport;
- int style;
-};
-
-struct _sdlSoapBindingFunctionBody
-{
- char *ns;
- int use;
- char *parts; //not implemented yet
- char *encodingStyle; //not implemented yet
-};
-
-struct _sdlSoapBindingFunction
-{
- char *soapAction;
- int style;
-
- sdlSoapBindingFunctionBody input;
- sdlSoapBindingFunctionBody output;
- sdlSoapBindingFunctionBody falut;
-};
-
-//HTTP Binding Specfic stuff
-/*********** not implemented yet ************
-struct _sdlHttpBinding
-{
- int holder;
-};
-*********************************************/
-
-struct _sdlRestrictionInt
-{
- int value;
- char fixed;
- char *id;
-};
-
-struct _sdlRestrictionChar
-{
- char *value;
- char fixed;
- char *id;
-};
-
-struct _sdlRestrictions
-{
- HashTable *enumeration; //array of sdlRestrictionCharPtr
- sdlRestrictionIntPtr minExclusive;
- sdlRestrictionIntPtr minInclusive;
- sdlRestrictionIntPtr maxExclusive;
- sdlRestrictionIntPtr maxInclusive;
- sdlRestrictionIntPtr totalDigits;
- sdlRestrictionIntPtr fractionDigits;
- sdlRestrictionIntPtr length;
- sdlRestrictionIntPtr minLength;
- sdlRestrictionIntPtr maxLength;
- sdlRestrictionCharPtr whiteSpace;
- sdlRestrictionCharPtr pattern;
-};
-
-struct _sdlType
-{
- char *name;
- char *namens;
- int nullable;
- int min_occurs;
- int max_occurs;
- HashTable *elements; //array of sdlTypePtr
- HashTable *attributes; //array of sdlAttributePtr
- sdlRestrictionsPtr restrictions;
- encodePtr encode;
-};
-
-struct _sdlParam
-{
- int order;
- encodePtr encode;
- char *paramName;
-};
-
-struct _sdlFunction
-{
- char *functionName;
- char *requestName;
- char *responseName;
- HashTable *requestParameters; //array of sdlParamPtr
- HashTable *responseParameters; //array of sdlParamPtr (this should only be one)
- int bindingType;
- void *bindingAttributes;
-};
-
-struct _sdlAttribute
-{
- char *def;
- char *fixed;
- char *form;
- char *id;
- char *name;
- char *ref;
- char *type;
- char *use;
- HashTable *extraAttributes; //array of xmlNodePtr
-};
-
-sdlPtr get_sdl(char *uri);
-sdlPtr load_wsdl(char *struri, sdlPtr parent);
-int load_sdl(char *struri, int force_load);
-int load_ms_sdl(char *struri, int force_load);
-
-encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, char *type);
-encodePtr get_encoder(sdlPtr sdl, char *ns, char *type);
-encodePtr get_encoder_ex(sdlPtr sdl, char *nscat);
-encodePtr get_create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type);
-encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, char *ns, char *type);
-
-sdlBindingPtr get_binding_from_type(sdlPtr sdl, int type);
-sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns);
-
-xmlNodePtr sdl_guess_convert_xml(encodeType enc, zval* data, int style);
-zval *sdl_guess_convert_zval(encodeType enc, xmlNodePtr data);
-
-xmlNodePtr sdl_to_xml_array(sdlTypePtr type, zval *data, int style);
-xmlNodePtr sdl_to_xml_object(sdlTypePtr type, zval *data, int style);
-
-void delete_type(void *type);
-void delete_attribute(void *attribute);
-#endif
-
-
diff --git a/ext/soap/php_soap.dsp b/ext/soap/php_soap.dsp
deleted file mode 100644
index a80142d6c3..0000000000
--- a/ext/soap/php_soap.dsp
+++ /dev/null
@@ -1,148 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php_soap" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php_soap - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php_soap.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php_soap.mak" CFG="php_soap - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php_soap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php_soap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php_soap - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\libxml2-2.4.12\include" /I "..\..\bind" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTSWS" /D "PHP_SOAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "ZTS" /D ZEND_DEBUG=0 /D "COMPILE_DL_SOAP" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib libxml2.lib wsock32.lib resolv.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_soap.dll" /libpath:"..\..\\" /libpath:"..\..\..\libxml2-2.4.12\lib" /libpath:"..\..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php_soap - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\libxml2-2.4.12\include" /I "..\..\bind" /D "WS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "ZTS" /D ZEND_DEBUG=1 /D "COMPILE_DL_SOAP" /FR"Release_TS/" /Fp"Release_TS/gd.pch" /YX /Fo"Release_TS/" /Fd"Release_TS/" /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib libxml2.lib wsock32.lib resolv.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_soap.dll" /implib:"Release_TS/php_gd.lib" /pdbtype:sept /libpath:"..\..\\" /libpath:"..\..\..\libxml2-2.4.12\lib" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none /incremental:no
-
-!ENDIF
-
-# Begin Target
-
-# Name "php_soap - Win32 Release"
-# Name "php_soap - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_encoding.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_http.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_schema.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_sdl.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_xml.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\soap.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_encoding.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_http.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_schema.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_sdl.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_soap.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_xml.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h
deleted file mode 100644
index 301a594a3a..0000000000
--- a/ext/soap/php_soap.h
+++ /dev/null
@@ -1,418 +0,0 @@
-#ifndef PHP_SOAP_H
-#define PHP_SOAP_H
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_standard.h"
-#include "ext/session/php_session.h"
-#include "ext/standard/php_smart_str.h"
-#include "php_ini.h"
-#include "SAPI.h"
-#include <libxml/parser.h>
-#include <libxml/xpath.h>
-
-#ifdef HAVE_PHP_DOMXML
-# include "ext/domxml/php_domxml.h"
-#endif
-
-// PHP_STREAMS were introduced php-4.2.0.. i think
-// Make this part of configure
-#ifdef STREAMS_DC
-# define PHP_STREAMS
-#endif
-
-#ifdef PHP_WIN32
-# ifdef PHP_STREAMS
-# define SOAP_STREAM php_stream *
-# else
-# define SOAP_STREAM SOCKET
-# endif
-#else
-# ifdef PHP_STREAMS
-# define SOAP_STREAM php_stream *
-# else
-# define SOCKET unsigned int
-# define SOAP_STREAM SOCKET
-# endif
-# define TRUE 1
-# define FALSE 0
-# define stricmp strcasecmp
-#endif
-
-typedef struct _encodeType encodeType, *encodeTypePtr;
-typedef struct _encode encode, *encodePtr;
-
-typedef struct _sdl sdl, *sdlPtr;
-typedef struct _sdlRestrictionInt sdlRestrictionInt, *sdlRestrictionIntPtr;
-typedef struct _sdlRestrictionChar sdlRestrictionChar, *sdlRestrictionCharPtr;
-typedef struct _sdlRestrictions sdlRestrictions, *sdlRestrictionsPtr;
-typedef struct _sdlType sdlType, *sdlTypePtr;
-typedef struct _sdlParam sdlParam, *sdlParamPtr;
-typedef struct _sdlFunction sdlFunction, *sdlFunctionPtr;
-typedef struct _sdlAttribute sdlAttribute, *sdlAttributePtr;
-typedef struct _sdlBinding sdlBinding, *sdlBindingPtr;
-typedef struct _sdlSoapBinding sdlSoapBinding, *sdlSoapBindingPtr;
-typedef struct _sdlSoapBindingFunction sdlSoapBindingFunction, *sdlSoapBindingFunctionPtr;
-typedef struct _sdlSoapBindingFunctionBody sdlSoapBindingFunctionBody, *sdlSoapBindingFunctionBodyPtr;
-
-typedef struct _soapMapping soapMapping, *soapMappingPtr;
-typedef struct _soapService soapService, *soapServicePtr;
-
-#include "php_xml.h"
-#include "php_encoding.h"
-#include "php_sdl.h"
-#include "php_schema.h"
-#include "php_http.h"
-#include "php_packet_soap.h"
-
-extern int le_sdl;
-extern int le_http_socket;
-extern int le_url;
-extern int le_service;
-
-
-struct _soapHeaderHandler
-{
- char *ns;
- int type;
-
- struct _function_handler
- {
- char *functionName;
- char *type;
- } function_handler;
-
- struct _class_handler
- {
- zend_class_entry *ce;
- } class_handler;
-};
-
-struct _soapMapping
-{
- char *ns;
- char *ctype;
- int type;
-
- struct _map_functions
- {
- zval *to_xml_before;
- zval *to_xml;
- zval *to_xml_after;
- zval *to_zval_before;
- zval *to_zval;
- zval *to_zval_after;
- } map_functions;
-
- struct _map_class
- {
- int type;
- zend_class_entry *ce;
- } map_class;
-};
-
-struct _soapService
-{
- sdlPtr sdl;
-
- struct _soap_functions
- {
- HashTable *ft;
- int functions_all;
- } soap_functions;
-
- struct _soap_class
- {
- zend_class_entry *ce;
- zval **argv;
- int argc;
- int persistance;
- } soap_class;
-
- HashTable *mapping;
- int type;
- int enabled;
- char *uri;
-};
-
-#define SOAP_CLASS 1
-#define SOAP_FUNCTIONS 2
-#define SOAP_FUNCTIONS_ALL 999
-
-#define SOAP_MAP_FUNCTION 1
-#define SOAP_MAP_CLASS 2
-
-#define SOAP_PERSISTENCE_SESSION 1
-#define SOAP_PERSISTENCE_REQUEST 2
-
-ZEND_BEGIN_MODULE_GLOBALS(soap)
- HashTable *defEncNs;
- HashTable *defEncPrefix;
- HashTable *defEnc;
- HashTable *defEncIndex;
- HashTable *sdls;
- HashTable *services;
- HashTable *overrides;
- int cur_uniq_ns;
-ZEND_END_MODULE_GLOBALS(soap)
-
-ZEND_EXTERN_MODULE_GLOBALS(soap);
-
-#ifdef ZTS
-# define SOAP_GLOBAL(v) TSRMG(soap_globals_id, zend_soap_globals *, v)
-#else
-# define SOAP_GLOBAL(v) (soap_globals.v)
-#endif
-
-#define PHP_SOAP_SERVER_CLASSNAME "soapserver"
-#define PHP_SOAP_CLASSNAME "soapobject"
-#define PHP_SOAP_VAR_CLASSNAME "soapvar"
-#define PHP_SOAP_FAULT_CLASSNAME "soapfault"
-#define PHP_SOAP_PARAM_CLASSNAME "soapparam"
-
-
-extern zend_module_entry soap_module_entry;
-#define soap_module_ptr & soap_module_entry
-
-PHP_MINIT_FUNCTION(soap);
-PHP_MSHUTDOWN_FUNCTION(soap);
-PHP_MINFO_FUNCTION(soap);
-
-//Registry Functions
-//TODO: this!
-PHP_FUNCTION(load_sdl);
-PHP_FUNCTION(unload_sdl);
-PHP_FUNCTION(unload_all_sdls);
-PHP_FUNCTION(get_available_sdls);
-PHP_FUNCTION(get_available_functions);
-PHP_FUNCTION(get_function_parameters);
-PHP_FUNCTION(soap_encode_to_xml);
-PHP_FUNCTION(soap_encode_to_zval);
-
-
-//Server Functions
-PHP_FUNCTION(soapserver);
-PHP_FUNCTION(setclass);
-PHP_FUNCTION(addfunction);
-PHP_FUNCTION(getfunctions);
-PHP_FUNCTION(handle);
-PHP_FUNCTION(setpersistence);
-PHP_FUNCTION(bind);
-#ifdef HAVE_PHP_DOMXML
-PHP_FUNCTION(map);
-#endif
-
-//Client Functions
-PHP_FUNCTION(soapobject);
-PHP_FUNCTION(__use);
-PHP_FUNCTION(__style);
-PHP_FUNCTION(__isfault);
-PHP_FUNCTION(__getfault);
-PHP_FUNCTION(__call);
-PHP_FUNCTION(__parse);
-PHP_FUNCTION(__generate);
-PHP_FUNCTION(__trace);
-PHP_FUNCTION(__getfunctions);
-PHP_FUNCTION(__gettypes);
-PHP_FUNCTION(__getlastresponse);
-PHP_FUNCTION(__getlastrequest);
-PHP_FUNCTION(__headerclass);
-PHP_FUNCTION(__headerfunction);
-
-//SoapVar Functions
-PHP_FUNCTION(soapvar);
-
-//SoapFault Functions
-PHP_FUNCTION(soapfault);
-
-//SoapParam Functions
-PHP_FUNCTION(soapparam);
-
-
-#define DECLARE_TRACE(file) \
- FILE *trace_fp; \
- char *trace_file = file;
-
-#define TRACE(place) \
- trace_fp = fopen(trace_file, "a+"); \
- fwrite(place, strlen(place), 1, trace_fp); \
- fclose(trace_fp);
-
-extern zend_class_entry soap_var_class_entry;
-
-PS_SERIALIZER_FUNCS(soap);
-
-void clear_soap_fault(zval *obj);
-void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail);
-void add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail);
-
-sdlParamPtr get_param(sdlFunctionPtr function, char *param_name, int index, int);
-sdlFunctionPtr get_function(sdlBindingPtr sdl, char *function_name);
-
-void delete_sdl(void *handle);
-void delete_binding(void *binding);
-void delete_sdl_soap_binding_function_body(sdlSoapBindingFunctionBody body);
-void delete_function(void *function);
-void delete_paramater(void *paramater);
-void delete_service(void *service);
-void delete_http_socket(void *handle);
-void delete_url(void *handle);
-void delete_mapping(void *data);
-
-void soap_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
-zval soap_get_property_handler(zend_property_reference *property_reference);
-int soap_set_property_handler(zend_property_reference *property_reference, zval *value);
-void soap_destructor(void *jobject);
-
-void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *function_name, int *num_params, zval **parameters[]);
-xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_name,char *uri,zval *ret);
-xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function, char *function_name, char *uri, zval **arguments, int arg_count);
-xmlNodePtr seralize_parameter(sdlParamPtr param,zval *param_val,int index,char *name, int style);
-xmlNodePtr seralize_zval(zval *val, sdlParamPtr param, char *paramName, int style);
-zval *desearlize_zval(sdlPtr sdl, xmlNodePtr data, sdlParamPtr param);
-
-void soap_error_handler(int error_num, const char *error_filename, const uint error_lineno, const char *format, va_list args);
-int my_call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC);
-
-#define phpext_soap_ptr soap_module_ptr
-
-#define HTTP_RAW_POST_DATA "HTTP_RAW_POST_DATA"
-
-#define SOAP_SERVER_BEGIN_CODE() \
- zend_error_cb = soap_error_handler
-
-#define SOAP_SERVER_END_CODE() \
- zend_error_cb = old_handler
-
-
-#define FOREACHATTRNODE(n,c,i) \
- do \
- { \
- if(n == NULL) \
- break; \
- if(c) \
- i = get_attribute(n,c); \
- else \
- i = n; \
- if(i != NULL) \
- { \
- n = i;
-
-#define FOREACHNODE(n,c,i) \
- do \
- { \
- if(n == NULL) \
- break; \
- if(c) \
- i = get_node(n,c); \
- else \
- i = n; \
- if(i != NULL) \
- { \
- n = i;
-
-#define ENDFOREACH(n) \
- } \
- } while(n = n->next);
-
-#define ZERO_PARAM() \
- if(ZEND_NUM_ARGS() != 0) \
- WRONG_PARAM_COUNT;
-
-#define ONE_PARAM(p) \
- if(ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &p) == FAILURE) \
- WRONG_PARAM_COUNT;
-
-#define TWO_PARAM(p,p1) \
- if(ZEND_NUM_ARGS() != 1 || getParameters(ht, 2, &p, &p1) == FAILURE) \
- WRONG_PARAM_COUNT;
-
-#define THREE_PARAM(p,p1,p2) \
- if(ZEND_NUM_ARGS() != 1 || getParameters(ht, 3, &p, &p1, &p2) == FAILURE) \
- WRONG_PARAM_COUNT;
-
-#define FETCH_THIS_PORT(ss) \
- { \
- zval *__thisObj; zval *__port; sdlBindingPtr *__tmp; \
- GET_THIS_OBJECT(__thisObj) \
- if(FIND_PORT_PROPERTY(__thisObj, __port) == FAILURE) { \
- ss = NULL; \
- php_error(E_ERROR, "Error could find current port"); \
- } \
- __tmp = (sdlBindingPtr*)Z_LVAL_P(__port); \
- ss = *__tmp; \
- }
-
-#define FIND_PORT_PROPERTY(ss,tmp) zend_hash_find(ss->value.obj.properties, "port", sizeof("port"), (void **)&tmp)
-
-#define FETCH_THIS_SDL(ss) \
- { \
- zval *__thisObj,**__tmp; \
- GET_THIS_OBJECT(__thisObj) \
- if(FIND_SDL_PROPERTY(__thisObj,__tmp) != FAILURE) \
- { \
- FETCH_SDL_RES(ss,__tmp); \
- } \
- else \
- ss = NULL; \
- }
-
-#define FIND_SDL_PROPERTY(ss,tmp) zend_hash_find(ss->value.obj.properties, "sdl", sizeof("sdl"), (void **)&tmp)
-#define FETCH_SDL_RES(ss,tmp) ss = (sdlPtr) zend_fetch_resource(tmp TSRMLS_CC, -1, "sdl", NULL, 1, le_sdl)
-
-#define FETCH_THIS_SERVICE(ss) \
- { \
- zval *__thisObj,**__tmp; \
- GET_THIS_OBJECT(__thisObj) \
- if(FIND_SERVICE_PROPERTY(__thisObj,__tmp) != FAILURE) \
- { \
- FETCH_SERVICE_RES(ss,__tmp); \
- } \
- else \
- ss = NULL; \
- }
-
-#define FIND_SERVICE_PROPERTY(ss,tmp) zend_hash_find(ss->value.obj.properties, "service", sizeof("service"), (void **)&tmp)
-#define FETCH_SERVICE_RES(ss,tmp) ss = (soapServicePtr) zend_fetch_resource(tmp TSRMLS_CC, -1, "service", NULL, 1, le_service)
-
-#define FETCH_THIS_URL(ss) \
- { \
- zval *__thisObj,**__tmp; \
- GET_THIS_OBJECT(__thisObj) \
- if(FIND_URL_PROPERTY(__thisObj,__tmp) != FAILURE) \
- { \
- FETCH_URL_RES(ss,__tmp); \
- } \
- else \
- ss = NULL; \
- }
-
-#define FIND_URL_PROPERTY(ss,tmp) zend_hash_find(ss->value.obj.properties, "httpurl", sizeof("httpurl"), (void **)&tmp)
-#define FETCH_URL_RES(ss,tmp) ss = (php_url *) zend_fetch_resource(tmp TSRMLS_CC, -1, "httpurl", NULL, 1, le_url)
-
-#define FETCH_THIS_SOCKET(ss) \
- { \
- zval *__thisObj,**__tmp; \
- GET_THIS_OBJECT(__thisObj) \
- if(FIND_SOCKET_PROPERTY(__thisObj,__tmp) != FAILURE) \
- { \
- FETCH_SOCKET_RES(ss,__tmp); \
- } \
- else \
- ss = NULL; \
- }
-
-#define FIND_SOCKET_PROPERTY(ss,tmp) zend_hash_find(ss->value.obj.properties, "httpsocket", sizeof("httpsocket"), (void **)&tmp)
-#define FETCH_SOCKET_RES(ss,tmp) ss = (SOAP_STREAM)zend_fetch_resource(tmp TSRMLS_CC, -1, "httpsocket", NULL, 1, le_http_socket)
-
-#define GET_THIS_OBJECT(o) \
- o = getThis(); \
- if (!o) \
- { \
- php_error(E_WARNING, "Cannot Get Class Info"); \
- return; \
- }
-
-
-#endif
diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c
deleted file mode 100644
index e3505e2890..0000000000
--- a/ext/soap/php_xml.c
+++ /dev/null
@@ -1,214 +0,0 @@
-#include "php_soap.h"
-
-xmlNsPtr attr_find_ns(xmlAttrPtr node)
-{
- if(node->ns)
- return node->ns;
- else if(node->parent->ns)
- return node->parent->ns;
- else
- return xmlSearchNs(node->doc, node->parent, NULL);
-}
-
-xmlNsPtr node_find_ns(xmlNodePtr node)
-{
- if(node->ns)
- return node->ns;
- else
- return xmlSearchNs(node->doc, node, NULL);
-}
-
-int attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns)
-{
- if(!strcmp(node->name, name))
- {
- if(ns)
- {
- xmlNsPtr nsPtr;
- if(node->ns)
- nsPtr = node->ns;
- else if(node->parent->ns)
- nsPtr = node->parent->ns;
- else
- nsPtr = xmlSearchNs(node->doc, node->parent, NULL);
- if(!strcmp(nsPtr->href, ns))
- return TRUE;
- return FALSE;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-int node_is_equal_ex(xmlNodePtr node, char *name, char *ns)
-{
- if(!strcmp(node->name, name))
- {
- if(ns)
- {
- xmlNsPtr nsPtr;
- if(node->ns)
- nsPtr = node->ns;
- else
- nsPtr = xmlSearchNs(node->doc, node, NULL);
- if(!strcmp(nsPtr->href, ns))
- return TRUE;
- return FALSE;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-xmlAttrPtr get_attribute_ex(xmlAttrPtr node, char *name, char *ns)
-{
- xmlAttrPtr trav = node;
- if(node == NULL) return NULL;
- do {
- if(attr_is_equal_ex(trav, name, ns))
- return trav;
- } while(trav = trav->next);
- return NULL;
-}
-
-xmlNodePtr get_node_ex(xmlNodePtr node, char *name, char *ns)
-{
- xmlNodePtr trav = node;
- if(node == NULL) return NULL;
- do {
- if(node_is_equal_ex(trav, name, ns))
- return trav;
- } while(trav = trav->next);
- return NULL;
-}
-
-xmlNodePtr get_node_recurisve_ex(xmlNodePtr node, char *name, char *ns)
-{
- xmlNodePtr trav = node;
- if(node == NULL) return NULL;
- do
- {
- if(node_is_equal_ex(trav, name, ns))
- return trav;
- else
- {
- if(node->children != NULL)
- {
- xmlNodePtr tmp;
- tmp = get_node_recurisve_ex(node->children, name, ns);
- if(tmp)
- return tmp;
- }
- }
- } while(trav = trav->next);
- return NULL;
-}
-
-xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns)
-{
- xmlNodePtr trav = node, cur = NULL;
- xmlAttrPtr attr;
-
- if(node == NULL) return NULL;
- do
- {
- if(name != NULL)
- {
- cur = get_node_ex(trav, name, name_ns);
- if(!cur)
- return cur;
- }
- else
- cur = trav;
-
- attr = get_attribute_ex(cur->properties, attribute, attr_ns);
- if(attr != NULL && strcmp(attr->children->content, value) == 0)
- return cur;
- else
- {
- if(cur->children != NULL)
- {
- xmlNodePtr tmp;
- tmp = get_node_with_attribute_ex(cur->children, name, name_ns, attribute, value, attr_ns);
- if(tmp)
- return tmp;
- }
- }
- }while(trav = trav->next);
- return NULL;
-}
-
-xmlNodePtr get_node_with_attribute_recursive_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns)
-{
- xmlNodePtr trav = node, cur;
- xmlAttrPtr attr;
-
- if(node == NULL) return NULL;
- do
- {
- if(name != NULL)
- {
- cur = get_node_recurisve_ex(trav, name, name_ns);
- if(!cur)
- return cur;
- }
- else
- cur = trav;
-
- attr = get_attribute_ex(cur->properties, attribute, attr_ns);
- if(attr != NULL && strcmp(attr->children->content, value) == 0)
- return cur;
- else
- {
- if(cur->children != NULL)
- {
- xmlNodePtr tmp;
- tmp = get_node_with_attribute_recursive_ex(cur->children, name, name_ns, attribute, value, attr_ns);
- if(tmp)
- return tmp;
- }
- }
- }while(trav = trav->next);
- return NULL;
-}
-
-xmlNodePtr check_and_resolve_href(xmlNodePtr data)
-{
- xmlAttrPtr href;
- xmlNodePtr ret = data;
-
- if(!data || !data->properties)
- return ret;
-
- href = get_attribute(data->properties, "href");
- if(href)
- {
- // Internal href try and find node
- if(href->children->content[0] == '#')
- {
- ret = get_node_with_attribute_recursive(data->doc->children, NULL, "id", &href->children->content[1]);
- }
- // External href....?
- }
-
- return ret;
-}
-
-int parse_namespace(char *inval, char **value, char **namespace)
-{
- char *found = strchr(inval, ':');
-
- if(found != NULL)
- {
- (*namespace) = estrndup(inval, found - inval);
- (*value) = estrdup(++found);
- }
- else
- {
- (*value) = estrdup(inval);
- (*namespace) = NULL;
- }
-
- return FALSE;
-}
-
diff --git a/ext/soap/php_xml.h b/ext/soap/php_xml.h
deleted file mode 100644
index d17caba007..0000000000
--- a/ext/soap/php_xml.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef PHP_SOAP_XML_H
-#define PHP_SOAP_XML_H
-
-#define get_attribute(node, name) get_attribute_ex(node, name, NULL)
-#define get_node(node, name) get_node_ex(node, name, NULL)
-#define get_node_recursive(node, name) get_node_recursive_ex(node, name, NULL)
-#define get_node_with_attribute(node, name, attr, val) get_node_with_attribute_ex(node, name, NULL, attr, val, NULL)
-#define get_node_with_attribute_recursive(node, name, attr, val) get_node_with_attribute_recursive_ex(node, name, NULL, attr, val, NULL)
-#define attr_is_equal(node, name) attr_is_equal_ex(node, name, NULL)
-
-xmlNsPtr attr_find_ns(xmlAttrPtr node);
-xmlNsPtr node_find_ns(xmlNodePtr node);
-int attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns);
-int node_is_equal_ex(xmlNodePtr node, char *name, char *ns);
-xmlAttrPtr get_attribute_ex(xmlAttrPtr node,char *name, char *ns);
-xmlNodePtr get_node_ex(xmlNodePtr node,char *name, char *ns);
-xmlNodePtr get_node_recurisve_ex(xmlNodePtr node,char *name, char *ns);
-xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns);
-xmlNodePtr get_node_with_attribute_recursive_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns);
-int parse_namespace(char *inval,char **value,char **namespace);
-xmlNodePtr check_and_resolve_href(xmlNodePtr data);
-
-#endif
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
deleted file mode 100644
index c67171c5a9..0000000000
--- a/ext/soap/soap.c
+++ /dev/null
@@ -1,2268 +0,0 @@
-#include "php_soap.h"
-
-int le_sdl = 0;
-int le_http_socket = 0;
-int le_url = 0;
-int le_service = 0;
-
-// Local functions
-static void function_to_string(sdlFunctionPtr function, smart_str *buf);
-static void type_to_string(sdlTypePtr type, smart_str *buf, int level);
-
-static zend_class_entry soap_class_entry;
-static zend_class_entry soap_server_class_entry;
-static zend_class_entry soap_fault_class_entry;
-zend_class_entry soap_var_class_entry;
-zend_class_entry soap_param_class_entry;
-
-ZEND_DECLARE_MODULE_GLOBALS(soap);
-
-static void (*old_handler)(int, const char *, const uint, const char*, va_list);
-
-static zend_function_entry soap_functions[] = {
-#ifdef HAVE_PHP_DOMXML
- PHP_FE(soap_encode_to_xml, NULL)
- PHP_FE(soap_encode_to_zval, NULL)
-#endif
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_fault_functions[] = {
- PHP_FE(soapfault, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_server_functions[] = {
- PHP_FE(soapserver,NULL)
- PHP_FE(setpersistence,NULL)
- PHP_FE(setclass,NULL)
- PHP_FE(addfunction,NULL)
- PHP_FE(getfunctions,NULL)
- PHP_FE(handle,NULL)
- PHP_FE(bind,NULL)
-#ifdef HAVE_PHP_DOMXML
- PHP_FE(map, NULL)
-#endif
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_client_functions[] = {
- PHP_FE(soapobject, NULL)
- PHP_FE(__isfault, NULL)
- PHP_FE(__getfault, NULL)
- PHP_FE(__use, NULL)
- PHP_FE(__style, NULL)
- PHP_FE(__call, NULL)
- PHP_FE(__parse, NULL)
- PHP_FE(__generate, NULL)
- PHP_FE(__trace, NULL)
- PHP_FE(__headerclass, NULL)
- PHP_FE(__headerfunction, NULL)
- PHP_FE(__getlastrequest, NULL)
- PHP_FE(__getlastresponse, NULL)
- PHP_FE(__getfunctions, NULL)
- PHP_FE(__gettypes, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_var_functions[] = {
- PHP_FE(soapvar, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry soap_param_functions[] = {
- PHP_FE(soapparam, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry soap_module_entry = {
-#ifdef STANDARD_MODULE_HEADER
- STANDARD_MODULE_HEADER,
-#endif
- "soap",
- soap_functions,
- PHP_MINIT(soap),
- PHP_MSHUTDOWN(soap),
- NULL,
- NULL,
- PHP_MINFO(soap),
-#ifdef STANDARD_MODULE_HEADER
- NO_VERSION_YET,
-#endif
- STANDARD_MODULE_PROPERTIES,
-};
-
-#ifdef COMPILE_DL_SOAP
-ZEND_GET_MODULE(soap)
-#endif
-
-static void php_soap_init_globals(zend_soap_globals *soap_globals)
-{
- int i;
- long enc;
-
- soap_globals->sdls = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->sdls, 0, NULL, delete_sdl, 1);
-
- soap_globals->services = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->services, 0, NULL, delete_service, 1);
-
- soap_globals->defEnc = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEnc, 0, NULL, NULL, 1);
-
- soap_globals->defEncIndex = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEncIndex, 0, NULL, NULL, 1);
-
- soap_globals->defEncNs = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEncNs, 0, NULL, NULL, 1);
-
- soap_globals->defEncPrefix = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEncPrefix, 0, NULL, NULL, 1);
-
- soap_globals->overrides = NULL;
-
- i = 0;
- do
- {
- enc = (long)&defaultEncoding[i];
-
- //If has a ns and a str_type then index it
- if(defaultEncoding[i].details.type_str)
- {
- if(defaultEncoding[i].details.ns != NULL)
- {
- char *ns_type;
- ns_type = emalloc(strlen(defaultEncoding[i].details.ns) + strlen(defaultEncoding[i].details.type_str) + 2);
- sprintf(ns_type, "%s:%s", defaultEncoding[i].details.ns, defaultEncoding[i].details.type_str);
- zend_hash_add(soap_globals->defEnc, ns_type, strlen(ns_type) + 1, &enc, sizeof(encodePtr), NULL);
- efree(ns_type);
- }
- else
- {
- zend_hash_add(soap_globals->defEnc, defaultEncoding[i].details.type_str, strlen(defaultEncoding[i].details.type_str) + 1, &enc, sizeof(encodePtr), NULL);
- }
- }
- //Index everything by number
- zend_hash_index_update(soap_globals->defEncIndex, defaultEncoding[i].details.type, &enc, sizeof(encodePtr), NULL);
- i++;
- }
- while(defaultEncoding[i].details.type != END_KNOWN_TYPES);
-
- //hash by namespace
- zend_hash_add(soap_globals->defEncNs, XSD_1999_NAMESPACE, sizeof(XSD_1999_NAMESPACE), XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX), NULL);
- zend_hash_add(soap_globals->defEncNs, XSD_NAMESPACE, sizeof(XSD_NAMESPACE), XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX), NULL);
- zend_hash_add(soap_globals->defEncNs, APACHE_NAMESPACE, sizeof(APACHE_NAMESPACE), APACHE_NS_PREFIX, sizeof(APACHE_NS_PREFIX), NULL);
- zend_hash_add(soap_globals->defEncNs, SOAP_ENC_NAMESPACE, sizeof(SOAP_ENC_NAMESPACE), SOAP_ENC_NS_PREFIX, sizeof(SOAP_ENC_NS_PREFIX), NULL);
- //and by prefix
- zend_hash_add(soap_globals->defEncPrefix, XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX), XSD_NAMESPACE, sizeof(XSD_NAMESPACE), NULL);
- zend_hash_add(soap_globals->defEncPrefix, APACHE_NS_PREFIX, sizeof(APACHE_NS_PREFIX), APACHE_NAMESPACE, sizeof(APACHE_NAMESPACE), NULL);
- zend_hash_add(soap_globals->defEncPrefix, SOAP_ENC_NS_PREFIX, sizeof(SOAP_ENC_NS_PREFIX), SOAP_ENC_NAMESPACE, sizeof(SOAP_ENC_NAMESPACE), NULL);
-
-}
-
-static void php_soap_del_globals(zend_soap_globals *soap_globals)
-{
-/* zend_hash_destroy(soap_globals->sdls);
- zend_hash_destroy(soap_globals->services);
- zend_hash_destroy(soap_globals->defEnc);
- zend_hash_destroy(soap_globals->defEncIndex);
- zend_hash_destroy(soap_globals->defEncNs);*/
-}
-
-PHP_MSHUTDOWN_FUNCTION(soap)
-{
- zend_hash_destroy(SOAP_GLOBAL(sdls));
- zend_hash_destroy(SOAP_GLOBAL(services));
- zend_hash_destroy(SOAP_GLOBAL(defEnc));
- zend_hash_destroy(SOAP_GLOBAL(defEncIndex));
- zend_hash_destroy(SOAP_GLOBAL(defEncNs));
- zend_hash_destroy(SOAP_GLOBAL(defEncPrefix));
- return SUCCESS;
-}
-
-PHP_MINIT_FUNCTION(soap)
-{
- //TODO: add ini entry for always use soap errors
- ZEND_INIT_MODULE_GLOBALS(soap, php_soap_init_globals, php_soap_del_globals);
-
- //Register SoapObject class
- INIT_OVERLOADED_CLASS_ENTRY(soap_class_entry, PHP_SOAP_CLASSNAME, soap_client_functions, soap_call_function_handler, NULL, NULL);
- zend_register_internal_class(&soap_class_entry TSRMLS_CC);
-
- //Register SoapVar class
- INIT_CLASS_ENTRY(soap_var_class_entry, PHP_SOAP_VAR_CLASSNAME, soap_var_functions);
- zend_register_internal_class(&soap_var_class_entry TSRMLS_CC);
-
- //Register SoapServer class
- INIT_CLASS_ENTRY(soap_server_class_entry, PHP_SOAP_SERVER_CLASSNAME, soap_server_functions);
- zend_register_internal_class(&soap_server_class_entry TSRMLS_CC);
-
- //Register SoapFault class
- INIT_CLASS_ENTRY(soap_fault_class_entry, PHP_SOAP_FAULT_CLASSNAME, soap_fault_functions);
- zend_register_internal_class(&soap_fault_class_entry TSRMLS_CC);
-
- //Register SoapParam class
- INIT_CLASS_ENTRY(soap_param_class_entry, PHP_SOAP_PARAM_CLASSNAME, soap_param_functions);
- zend_register_internal_class(&soap_param_class_entry TSRMLS_CC);
-
- le_sdl = register_list_destructors(NULL, NULL);
- le_http_socket = register_list_destructors(delete_http_socket, NULL);
- le_url = register_list_destructors(delete_url, NULL);
- le_service = register_list_destructors(delete_service, NULL);
-
- REGISTER_LONG_CONSTANT("SOAP_PERSISTENCE_SESSION", SOAP_PERSISTENCE_SESSION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_PERSISTENCE_REQUEST", SOAP_PERSISTENCE_REQUEST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_FUNCTIONS_ALL", SOAP_FUNCTIONS_ALL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("SOAP_ENCODED", SOAP_ENCODED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_LITERAL", SOAP_LITERAL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("SOAP_RPC", SOAP_RPC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_DOCUMENT", SOAP_DOCUMENT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("XSD_1999_TIMEINSTANT", XSD_1999_TIMEINSTANT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UNKNOWN_TYPE", UNKNOWN_TYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_ENC_OBJECT", SOAP_ENC_OBJECT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOAP_ENC_ARRAY", SOAP_ENC_ARRAY, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("XSD_STRING", XSD_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_BOOLEAN", XSD_BOOLEAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_DECIMAL", XSD_DECIMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_FLOAT", XSD_FLOAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_DOUBLE", XSD_DOUBLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_DURATION", XSD_DURATION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_DATETIME", XSD_DATETIME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_TIME", XSD_TIME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_DATE", XSD_DATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GYEARMONTH", XSD_GYEARMONTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GYEAR", XSD_GYEAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GMONTHDAY", XSD_GMONTHDAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GDAY", XSD_GDAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_GMONTH", XSD_GMONTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_HEXBINARY", XSD_HEXBINARY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_BASE64BINARY", XSD_BASE64BINARY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_ANYURI", XSD_ANYURI, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_QNAME", XSD_QNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NOTATION", XSD_NOTATION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NORMALIZEDSTRING", XSD_NORMALIZEDSTRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_TOKEN", XSD_TOKEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_LANGUAGE", XSD_LANGUAGE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NMTOKEN", XSD_NMTOKEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NAME", XSD_NAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NCNAME", XSD_NCNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_ID", XSD_ID, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_IDREF", XSD_IDREF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_IDREFS", XSD_IDREFS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_ENTITY", XSD_ENTITY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_ENTITYS", XSD_ENTITYS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_INTEGER", XSD_INTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NONPOSITIVEINTEGER", XSD_NONPOSITIVEINTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NEGATIVEINTEGER", XSD_NEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_LONG", XSD_LONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_INT", XSD_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_SHORT", XSD_SHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_BYTE", XSD_BYTE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_NONNEGATIVEINTEGER", XSD_NONNEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_UNSIGNEDLONG", XSD_UNSIGNEDLONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_UNSIGNEDINT", XSD_UNSIGNEDINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_UNSIGNEDSHORT", XSD_UNSIGNEDSHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_UNSIGNEDBYTE", XSD_UNSIGNEDBYTE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XSD_POSITIVEINTEGER", XSD_POSITIVEINTEGER, CONST_CS | CONST_PERSISTENT);
-
- old_handler = zend_error_cb;
-
-#if HAVE_PHP_SESSION
- php_session_register_serializer("soap", PS_SERIALIZER_ENCODE_NAME(soap), PS_SERIALIZER_DECODE_NAME(soap));
-#endif
-
- return SUCCESS;
-}
-
-#if HAVE_PHP_SESSION
-PS_SERIALIZER_ENCODE_FUNC(soap)
-{
-/*
- char *key; \
- uint key_length; \
- ulong num_key; \
- zval **struc;
-
- wddx_packet *packet;
- PS_ENCODE_VARS;
-
- packet = php_wddx_constructor();
- if (!packet)
- return FAILURE;
-
- php_wddx_packet_start(packet, NULL, 0);
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
-
- PS_ENCODE_LOOP(
-
- php_wddx_serialize_var(packet, *struc, key, key_length);
- );
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
- php_wddx_packet_end(packet);
- *newstr = php_wddx_gather(packet);
- php_wddx_destructor(packet);
-
- if (newlen)
- *newlen = strlen(*newstr);
-*/
- return SUCCESS;
-}
-
-PS_SERIALIZER_DECODE_FUNC(soap)
-{
-/* zval *retval;
- zval **ent;
- char *key;
- uint key_length;
- char tmp[128];
- ulong idx;
- int hash_type;
- int ret;
-
- if (vallen == 0)
- return SUCCESS;
-
- MAKE_STD_ZVAL(retval);
-
- if ((ret = php_wddx_deserialize_ex((char *)val, vallen, retval)) == SUCCESS) {
-
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(retval));
- zend_hash_get_current_data(Z_ARRVAL_P(retval), (void **) &ent) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_P(retval))) {
- hash_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(retval), &key, &key_length, &idx, 0, NULL);
-
- switch (hash_type) {
- case HASH_KEY_IS_LONG:
- sprintf(tmp, "%ld", idx);
- key = tmp;
- case HASH_KEY_IS_STRING:
- php_set_session_var(key, key_length-1, *ent, NULL TSRMLS_CC);
- PS_ADD_VAR(key);
- }
- }
- }
-
- zval_ptr_dtor(&retval);
-*/
- return TRUE;
-}
-#endif
-
-
-PHP_MINFO_FUNCTION(soap)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Soap Client", "enabled");
- php_info_print_table_row(2, "Soap Server", "enabled");
-#if HAVE_PHP_SESSION
- php_info_print_table_row(2, "Soap Serializer", "enabled");
-#endif
- php_info_print_table_end();
-}
-
-#ifdef HAVE_PHP_DOMXML
-PHP_FUNCTION(soap_encode_to_xml)
-{
- zval *pzval, *ret;
- encodePtr enc;
- char *name;
- int found, name_len;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &name_len, &pzval) == FAILURE)
- php_error(E_ERROR, "wrong number of parameters to soap_encode_to_xml");
-
- enc = get_conversion(Z_TYPE_P(pzval));
- ret = php_domobject_new(seralize_zval(pzval, NULL, name, SOAP_ENCODED), &found, NULL TSRMLS_CC);
- *return_value = *ret;
- zval_copy_ctor(return_value);
- zval_ptr_dtor(&ret);
-}
-
-PHP_FUNCTION(soap_encode_to_zval)
-{
- zval *dom, **addr, *ret;
- xmlNodePtr node;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &dom) == FAILURE)
- php_error(E_ERROR, "wrong number of parameters to soap_encode_to_zval");
-
- if(zend_hash_index_find(Z_OBJPROP_P(dom), 1, (void **)&addr) == FAILURE)
- php_error(E_ERROR, "Cannot find domaddress to parameter passed to soap_encode_to_zval");
-
- node = (xmlNodePtr)Z_LVAL_PP(addr);
- ret = master_to_zval(get_conversion(UNKNOWN_TYPE), node);
- *return_value = *ret;
-}
-#endif
-
-//SoapParam functions
-PHP_FUNCTION(soapparam)
-{
- zval *thisObj, *data;
- char *name;
- int name_length;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &data, &name, &name_length) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapParam constructor");
-
- GET_THIS_OBJECT(thisObj);
-
- zval_add_ref(&data);
- add_property_stringl(thisObj, "param_name", name, name_length, 1);
- add_property_zval(thisObj, "param_data", data);
-}
-
-//SoapFault functions
-PHP_FUNCTION(soapfault)
-{
- char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL;
- int fault_string_len, fault_code_len, fault_actor_len;
- zval *thisObj, *details = NULL;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|zs", &fault_string, &fault_string_len,
- &fault_code, &fault_code_len, &details, &fault_actor, &fault_actor_len) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapFault constructor");
-
- GET_THIS_OBJECT(thisObj);
-
- if(details)
- zval_add_ref(&details);
- set_soap_fault(thisObj, fault_code, fault_string, fault_actor, details);
-}
-
-//SoapVar functions
-PHP_FUNCTION(soapvar)
-{
- zval *data, *thisObj, *type;
- char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL;
- int stype_len, ns_len, name_len, namens_len;
-
- GET_THIS_OBJECT(thisObj);
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!z|ssss", &data, &type, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapVal constructor");
-
- zval_add_ref(&data);
- if(Z_TYPE_P(type) == IS_NULL)
- add_property_long(thisObj, "enc_type", UNKNOWN_TYPE);
- else
- {
- if(zend_hash_index_exists(SOAP_GLOBAL(defEncIndex), Z_LVAL_P(type)))
- add_property_long(thisObj, "enc_type", Z_LVAL_P(type));
- else
- php_error(E_ERROR, "Cannot find encoding for SoapVar");
- }
-
- add_property_zval(thisObj, "enc_value", data);
-
- if(stype && strlen(stype) > 0)
- add_property_stringl(thisObj, "enc_stype", stype, stype_len, 1);
- if(ns && strlen(ns) > 0)
- add_property_stringl(thisObj, "enc_ns", ns, ns_len, 1);
- if(name && strlen(name) > 0)
- add_property_stringl(thisObj, "enc_name", name, name_len, 1);
- if(namens && strlen(namens) > 0)
- add_property_stringl(thisObj, "enc_namens", namens, namens_len, 1);
-}
-
-//SoapServer functions
-PHP_FUNCTION(soapserver)
-{
- zval *thisObj;
- soapServicePtr service;
- char *uri;
- int ret, uri_len;
-
- SOAP_SERVER_BEGIN_CODE();
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uri, &uri_len) == FAILURE)
- php_error(E_ERROR, "Wrong number of parameters to SoapServer constructor");
-
- GET_THIS_OBJECT(thisObj);
-
- service = emalloc(sizeof(soapService));
- memset(service, 0, sizeof(soapService));
-
- service->uri = estrndup(uri, uri_len);
- service->type = SOAP_FUNCTIONS;
- service->soap_functions.functions_all = FALSE;
- service->soap_functions.ft = emalloc(sizeof(HashTable));
- zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- ret = zend_list_insert(service, le_service);
- add_property_resource(thisObj, "service", ret);
- zend_list_addref(ret);
-
- SOAP_SERVER_END_CODE();
-}
-
-#define NULL_OR_STRING(zval) \
- (!zval || Z_TYPE_P(zval) == IS_NULL || Z_TYPE_P(zval) == IS_STRING)
-
-#define IS_VALID_FUNCTION(zval) \
- (zval && Z_TYPE_P(zval) != IS_NULL)
-
-#ifdef HAVE_PHP_DOMXML
-PHP_FUNCTION(map)
-{
- char *type, *class_name;
- zval *to_xml_before = NULL, *to_xml = NULL, *to_xml_after = NULL,
- *to_zval_before = NULL, *to_zval = NULL, *to_zval_after = NULL;
- int type_len, class_name_len;
- char *ns, *ctype;
- soapServicePtr service;
-
- SOAP_SERVER_BEGIN_CODE();
-
- if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sz|zzzzz",
- &type, &type_len, &to_xml_before, &to_xml, &to_xml_after, &to_zval_before, &to_zval,
- &to_zval_after) == SUCCESS && NULL_OR_STRING(to_xml_before) && NULL_OR_STRING(to_xml) &&
- NULL_OR_STRING(to_xml_after) && NULL_OR_STRING(to_zval_before) && NULL_OR_STRING(to_zval) &&
- NULL_OR_STRING(to_zval_after))
- {
- soapMappingPtr map;
- encodePtr enc, new_enc;
- smart_str resloved_ns = {0};
-
- FETCH_THIS_SERVICE(service);
-
- new_enc = malloc(sizeof(encode));
- memset(new_enc, 0, sizeof(encode));
-
- ctype = strrchr(type, ':');
- if(ctype) {
- smart_str_appendl(&resloved_ns, type, ctype - type);
- smart_str_0(&resloved_ns);
- ctype++;
- } else {
- ns = NULL;
- }
-
- if(ns)
- {
- if(zend_hash_find(SOAP_GLOBAL(defEncPrefix), resloved_ns.c, resloved_ns.len + 1, &ns) == SUCCESS)
- {
- enc = get_encoder(service->sdl, ns, ctype);
- smart_str_free(&resloved_ns);
- smart_str_appendl(&resloved_ns, ns, strlen(ns));
- smart_str_appendc(&resloved_ns, ':');
- smart_str_appendl(&resloved_ns, ctype, strlen(ctype));
- smart_str_0(&resloved_ns);
- type = resloved_ns.c;
- type_len = resloved_ns.len;
- }
- else
- enc = get_encoder_ex(service->sdl, type);
- }
- else
- enc = get_encoder_ex(service->sdl, type);
-
- new_enc->details.type = enc->details.type;
- new_enc->details.ns = strdup(enc->details.ns);
- new_enc->details.type_str = strdup(enc->details.type_str);
- new_enc->details.sdl_type = enc->details.sdl_type;
- new_enc->to_xml = enc->to_xml;
- new_enc->to_zval = enc->to_zval;
- new_enc->to_xml_before = enc->to_xml_before;
- new_enc->to_zval_before = enc->to_zval_before;
- new_enc->to_xml_after = enc->to_xml_after;
- new_enc->to_zval_after = enc->to_zval_after;
-
- map = emalloc(sizeof(soapMapping));
- memset(map, 0, sizeof(soapMapping));
-
- map->type = SOAP_MAP_FUNCTION;
- if(IS_VALID_FUNCTION(to_xml_before))
- {
- zval_add_ref(&to_xml_before);
- map->map_functions.to_xml_before = to_xml_before;
- new_enc->to_xml_before = to_xml_before_user;
- }
- if(IS_VALID_FUNCTION(to_xml))
- {
- zval_add_ref(&to_xml);
- map->map_functions.to_xml = to_xml;
- new_enc->to_xml = to_xml_user;
- }
- if(IS_VALID_FUNCTION(to_xml_after))
- {
- zval_add_ref(&to_xml_after);
- map->map_functions.to_xml_after = to_xml_after;
- new_enc->to_xml_after = to_xml_after_user;
- }
- if(IS_VALID_FUNCTION(to_zval_before))
- {
- zval_add_ref(&to_zval_before);
- map->map_functions.to_zval_before = to_zval_before;
- new_enc->to_zval_before = to_zval_before_user;
- }
- if(IS_VALID_FUNCTION(to_zval))
- {
- zval_add_ref(&to_zval);
- map->map_functions.to_zval = to_zval;
- new_enc->to_zval = to_zval_user;
- }
- if(IS_VALID_FUNCTION(to_zval_after))
- {
- zval_add_ref(&to_zval_after);
- map->map_functions.to_zval_after = to_zval_after;
- new_enc->to_zval_after = to_zval_after_user;
- }
-
- new_enc->details.map = map;
-
- if(!service->mapping)
- {
- service->mapping = emalloc(sizeof(HashTable));
- zend_hash_init(service->mapping, 0, NULL, delete_encoder, 0);
- }
- zend_hash_update(service->mapping, type, type_len + 1, &new_enc, sizeof(encodePtr), NULL);
- smart_str_free(&resloved_ns);
- }
- else if(zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &type, &type_len, &class_name, &class_name_len, &type) == SUCCESS)
- {
- }
- else
- php_error(E_ERROR, "Wrong number of parameters to SoapServer->map");
-}
-#endif
-
-PHP_FUNCTION(bind)
-{
- char *wsdl;
- int wsdl_len;
- soapServicePtr service;
-
- SOAP_SERVER_BEGIN_CODE();
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &wsdl, &wsdl_len) == FAILURE)
- php_error(E_ERROR, "Wrong number of parameters to SoapServer->bind");
-
- FETCH_THIS_SERVICE(service);
- service->sdl = get_sdl(wsdl);
-
- SOAP_SERVER_END_CODE();
-}
-
-PHP_FUNCTION(setpersistence)
-{
- soapServicePtr service;
- int value;
-
- SOAP_SERVER_BEGIN_CODE();
- FETCH_THIS_SERVICE(service);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) != FAILURE)
- {
- if(service->type == SOAP_CLASS)
- {
- if(value == SOAP_PERSISTENCE_SESSION ||
- value == SOAP_PERSISTENCE_REQUEST)
- service->soap_class.persistance = value;
- else
- php_error(E_ERROR, "Tried to set persistence with bogus value (%ld)", value);
- }
- else
- php_error(E_ERROR, "Tried to set persistence when you are using you SOAP SERVER in function mode, no persistence needed");
- }
-
- SOAP_SERVER_END_CODE();
-}
-
-PHP_FUNCTION(setclass)
-{
- soapServicePtr service;
- zend_class_entry *ce;
- char *class_name = NULL;
- int found, argc;
- zval ***argv;
-
- SOAP_SERVER_BEGIN_CODE();
-
- FETCH_THIS_SERVICE(service);
-
- argc = ZEND_NUM_ARGS();
- argv = emalloc(argc * sizeof(zval **));
-
- if (argc < 1 || zend_get_parameters_array_ex(argc, argv) == FAILURE)
- {
- efree(argv);
- WRONG_PARAM_COUNT;
- }
-
- if(Z_TYPE_PP(argv[0]) == IS_STRING)
- {
- class_name = estrdup(Z_STRVAL_PP(argv[0]));
-
- found = zend_hash_find(EG(class_table), php_strtolower(class_name, Z_STRLEN_PP(argv[0])), Z_STRLEN_PP(argv[0]) + 1, (void **)&ce);
- efree(class_name);
- if(found != FAILURE)
- {
- service->type = SOAP_CLASS;
- service->soap_class.ce = ce;
- service->soap_class.persistance = SOAP_PERSISTENCE_REQUEST;
- service->soap_class.argc = argc - 1;
- if(service->soap_class.argc > 0)
- {
- int i;
- service->soap_class.argv = emalloc(sizeof(zval) * service->soap_class.argc);
- for(i = 0;i < service->soap_class.argc;i++)
- {
- service->soap_class.argv[i] = *(argv[i + 1]);
- zval_add_ref(&service->soap_class.argv[i]);
- }
- }
- }
- else
- php_error(E_ERROR, "Tried to set a non existant class (%s)", Z_STRVAL_PP(argv[0]));
- }
- else
- php_error(E_ERROR, "You must pass in a string to setclass");
-
- efree(argv);
- SOAP_SERVER_END_CODE();
-}
-
-PHP_FUNCTION(getfunctions)
-{
- soapServicePtr service;
-
- SOAP_SERVER_BEGIN_CODE();
-
- FETCH_THIS_SERVICE(service);
-
- array_init(return_value);
- if(service->type == SOAP_CLASS)
- {
- zend_function *f;
- zend_hash_internal_pointer_reset(&service->soap_class.ce->function_table);
- while(zend_hash_get_current_data(&service->soap_class.ce->function_table, (void **)&f) != FAILURE)
- {
- add_next_index_string(return_value, f->common.function_name, 1);
- zend_hash_move_forward(&service->soap_class.ce->function_table);
- }
- }
- else if(service->soap_functions.functions_all == TRUE)
- {
- zend_function *f;
- zend_hash_internal_pointer_reset(EG(function_table));
- while(zend_hash_get_current_data(EG(function_table), (void **)&f) != FAILURE)
- {
- add_next_index_string(return_value, f->common.function_name, 1);
- zend_hash_move_forward(EG(function_table));
- }
- }
- else if(service->soap_functions.ft != NULL)
- zend_hash_copy(Z_ARRVAL_P(return_value), service->soap_functions.ft, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
-
- SOAP_SERVER_END_CODE();
-}
-
-PHP_FUNCTION(addfunction)
-{
- soapServicePtr service;
- zval *function_name, *function_copy;
-
- SOAP_SERVER_BEGIN_CODE();
-
- FETCH_THIS_SERVICE(service);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &function_name) == FAILURE)
- php_error(E_ERROR, "Invalid parameters passed to addfunction");
-
- if(function_name->type == IS_ARRAY)
- {
- if(service->type == SOAP_FUNCTIONS)
- {
- zval **tmp_function, *function_copy;
-
- if(service->soap_functions.ft == NULL)
- {
- service->soap_functions.ft = emalloc(sizeof(HashTable));
- zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
- }
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(function_name));
- while(zend_hash_get_current_data(Z_ARRVAL_P(function_name), (void **)&tmp_function) != FAILURE)
- {
- if(Z_TYPE_PP(tmp_function) != IS_STRING)
- php_error(E_ERROR, "Tried to add a function that isn't a string");
-
- MAKE_STD_ZVAL(function_copy);
- *function_copy = *(*tmp_function);
- zval_copy_ctor(function_copy);
-
- php_strtolower(Z_STRVAL_P(function_copy), Z_STRLEN_P(function_copy));
-
- if(zend_hash_exists(EG(function_table), Z_STRVAL_P(function_copy), Z_STRLEN_P(function_copy) + 1) == FALSE)
- php_error(E_ERROR, "Tried to add a non existant function (\"%s\")", Z_STRVAL_PP(tmp_function));
-
- zend_hash_update(service->soap_functions.ft, Z_STRVAL_P(function_copy), Z_STRLEN_P(function_copy) + 1, &function_copy, sizeof(zval *), NULL);
- zend_hash_move_forward(Z_ARRVAL_P(function_name));
- }
- }
- }
- else if(function_name->type == IS_STRING)
- {
- MAKE_STD_ZVAL(function_copy);
- *function_copy = *function_name;
- zval_copy_ctor(function_copy);
-
- php_strtolower(Z_STRVAL_P(function_copy), Z_STRLEN_P(function_copy));
-
- if(zend_hash_exists(EG(function_table), Z_STRVAL_P(function_copy), Z_STRLEN_P(function_copy) + 1) == FALSE)
- php_error(E_ERROR, "Tried to add a non existant function (\"%s\")", Z_STRVAL_P(function_name));
- if(service->soap_functions.ft == NULL)
- {
- service->soap_functions.functions_all = FALSE;
- service->soap_functions.ft = emalloc(sizeof(HashTable));
- zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
- }
-
- zend_hash_update(service->soap_functions.ft, Z_STRVAL_P(function_copy), Z_STRLEN_P(function_copy) + 1, &function_copy, sizeof(zval *), NULL);
- }
- else if(function_name->type == IS_LONG)
- {
- if(Z_LVAL_P(function_name) == SOAP_FUNCTIONS_ALL)
- {
- if(service->soap_functions.ft != NULL)
- {
- zend_hash_destroy(service->soap_functions.ft);
- efree(service->soap_functions.ft);
- service->soap_functions.ft = NULL;
- }
- service->soap_functions.functions_all = TRUE;
- }
- else
- php_error(E_ERROR, "Invalid value passed to addfunction (%ld)", Z_LVAL_P(function_name));
- }
-
- SOAP_SERVER_END_CODE();
-}
-
-PHP_FUNCTION(handle)
-{
- soapServicePtr service;
- xmlDocPtr doc_request, doc_return;
- zval function_name, **params, **raw_post, *soap_obj, retval, **server_vars;
- char *fn_name, cont_len[30], *response_name;
- int num_params = 0, size, i, call_status;
- xmlChar *buf;
- HashTable *function_table;
-
- FETCH_THIS_SERVICE(service);
-
- SOAP_SERVER_BEGIN_CODE();
- ZERO_PARAM();
-
- INIT_ZVAL(retval);
-
- if(zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **)&server_vars) == SUCCESS)
- {
- zval **req_method, **query_string;
- if(zend_hash_find(Z_ARRVAL_PP(server_vars), "REQUEST_METHOD", sizeof("REQUEST_METHOD"), (void **)&req_method) == SUCCESS)
- {
- if(!strcmp(Z_STRVAL_PP(req_method), "GET") && zend_hash_find(Z_ARRVAL_PP(server_vars), "QUERY_STRING", sizeof("QUERY_STRING"), (void **)&query_string) == SUCCESS)
- {
- if(!strcmp(Z_STRVAL_PP(query_string), "WSDL"))
- {
- if(service->sdl)
- {
- zval readfile, readfile_ret, *param;
-
- INIT_ZVAL(readfile);
- INIT_ZVAL(readfile_ret);
- MAKE_STD_ZVAL(param);
-
- sapi_add_header("Content-Type: text/xml", sizeof("Content-Type: text/xml"), 1);
- ZVAL_STRING(param, service->sdl->source, 1);
- ZVAL_STRING(&readfile, "readfile", 1);
- if(call_user_function(EG(function_table), NULL, &readfile, &readfile_ret, 1, &param TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Couldn't find WSDL");
-
- zval_ptr_dtor(&param);
- zval_dtor(&readfile);
- zval_dtor(&readfile_ret);
- SOAP_SERVER_END_CODE();
- return;
- }
- }
- }
- }
- }
-
-//Turn on output buffering... we don't want people print in their methods
-//#if PHP_API_VERSION <= 20010901
-// if(php_start_ob_buffer(NULL, 0 TSRMLS_CC) != SUCCESS)
-//#else
- if(php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC) != SUCCESS)
-//#endif
- php_error(E_ERROR,"ob_start failed");
-
- if (zend_hash_find(&EG(symbol_table), HTTP_RAW_POST_DATA, sizeof(HTTP_RAW_POST_DATA), (void **) &raw_post)!=FAILURE
- && ((*raw_post)->type==IS_STRING))
- {
- doc_request = xmlParseMemory(Z_STRVAL_PP(raw_post),Z_STRLEN_PP(raw_post));
- xmlCleanupParser();
-
- deseralize_function_call(service->sdl, doc_request, &function_name, &num_params, &params);
- xmlFreeDoc(doc_request);
-
- fn_name = estrndup(Z_STRVAL(function_name),Z_STRLEN(function_name));
- response_name = emalloc(Z_STRLEN(function_name) + strlen("Response") + 1);
- sprintf(response_name,"%sResponse\0",fn_name);
-
- if(service->type == SOAP_CLASS)
- {
- soap_obj = NULL;
- //If persistent then set soap_obj from from the previous created session (if available)
- if(service->soap_class.persistance == SOAP_PERSISTENCE_SESSION)
- {
- zval **tmp_soap;
-
- //Try and call session regiser for our dummy session object
- //The only reason that i use call_user_function is that
- //their isn't a way to start the session from an extension
- //so calling session_register will both register the var
- //and start the session
- {
- zval *bogus_session_name, session_register, sess_retval;
-
- INIT_ZVAL(session_register);
- INIT_ZVAL(sess_retval);
-
- if(!zend_ini_long("register_globals", sizeof("register_globals"), 0))
- php_error(E_ERROR, "PHP-SOAP requires 'register_globals' to be on when using persistent objects please check your php.ini file");
-
- MAKE_STD_ZVAL(bogus_session_name);
-
- ZVAL_STRING(bogus_session_name, "_bogus_session_name", 1);
- ZVAL_STRING(&session_register, "session_register", 1);
-
- if(call_user_function(EG(function_table), NULL, &session_register, &sess_retval, 1, &bogus_session_name TSRMLS_CC) == FAILURE)
- php_error(E_ERROR,"session_register failed");
-
- zval_ptr_dtor(&bogus_session_name);
- zval_dtor(&session_register);
- zval_dtor(&sess_retval);
- }
-
- //Find the soap object and assign
- if(zend_hash_find(&EG(symbol_table), "_bogus_session_name", sizeof("_bogus_session_name"), (void **) &tmp_soap) == SUCCESS)
- soap_obj = *tmp_soap;
- }
-
- //If new session or something wierd happned
- if(soap_obj == NULL)
- {
- zval *tmp_soap;
- MAKE_STD_ZVAL(tmp_soap);
- object_init_ex(tmp_soap, service->soap_class.ce);
-
- //Call constructor
- if(zend_hash_exists(&Z_OBJCE_P(tmp_soap)->function_table, service->soap_class.ce->name, strlen(service->soap_class.ce->name) + 1))
- {
- zval c_ret, constructor;
-
- INIT_ZVAL(c_ret);
- INIT_ZVAL(constructor);
-
- ZVAL_STRING(&constructor, service->soap_class.ce->name, 1);
- if(call_user_function(NULL, &tmp_soap, &constructor, &c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) == FAILURE)
- php_error(E_ERROR, "Error calling constructor");
- zval_dtor(&constructor);
- zval_dtor(&c_ret);
- }
-
- //If session then update session hash with new object
- if(service->soap_class.persistance == SOAP_PERSISTENCE_SESSION)
- {
- zval **tmp_soap_pp;
- if(zend_hash_update(&EG(symbol_table), "_bogus_session_name", sizeof("_bogus_session_name"), &tmp_soap, sizeof(zval *), (void **)&tmp_soap_pp) == SUCCESS)
- soap_obj = *tmp_soap_pp;
- }
- else
- soap_obj = tmp_soap;
- }
- function_table = &(soap_obj->value.obj.ce->function_table);
- }
- else
- {
- if(service->soap_functions.functions_all == TRUE)
- function_table = EG(function_table);
- else
- function_table = service->soap_functions.ft;
- }
-
- doc_return = NULL;
- if(zend_hash_exists(function_table, php_strtolower(Z_STRVAL(function_name), Z_STRLEN(function_name)), Z_STRLEN(function_name) + 1))
- {
- if(service->type == SOAP_CLASS)
- {
- call_status = call_user_function(NULL, &soap_obj, &function_name, &retval, num_params, params TSRMLS_CC);
- if(service->soap_class.persistance != SOAP_PERSISTENCE_SESSION)
- zval_ptr_dtor(&soap_obj);
- }
- else
- call_status = call_user_function(EG(function_table), NULL, &function_name, &retval, num_params, params TSRMLS_CC);
- }
- else
- php_error(E_ERROR, "Function (%s) doesn't exist", Z_STRVAL(function_name));
-
- if(call_status == SUCCESS)
- {
- sdlFunctionPtr function;
- function = get_function(get_binding_from_type(service->sdl, BINDING_SOAP), Z_STRVAL(function_name));
- SOAP_GLOBAL(overrides) = service->mapping;
- doc_return = seralize_response_call(function, response_name, service->uri, &retval);
- SOAP_GLOBAL(overrides) = NULL;
- }
- else
- php_error(E_ERROR, "Function (%s) call failed", Z_STRVAL(function_name));
-
- //Flush buffer
- php_end_ob_buffer(0, 0 TSRMLS_CC);
-
- //xmlDocDumpMemoryEnc(doc_return, &buf, &size, XML_CHAR_ENCODING_UTF8);
- xmlDocDumpMemory(doc_return, &buf, &size);
-
- if(size == 0)
- php_error(E_ERROR, "Dump memory failed");
-
- sprintf(cont_len, "Content-Length: %d\0", size);
- sapi_add_header("Content-Type: text/xml", sizeof("Content-Type: text/xml"), 1);
- sapi_add_header(cont_len, strlen(cont_len) + 1, 1);
-
- //Free Memory
- if(num_params > 0)
- {
- for(i = 0; i < num_params;i++)
- zval_ptr_dtor(&params[i]);
- efree(params);
- }
-
- zval_dtor(&function_name);
- xmlFreeDoc(doc_return);
- efree(response_name);
- efree(fn_name);
-
- php_write(buf, size TSRMLS_CC);
- xmlFree(buf);
- }
- else
- {
- if(!zend_ini_long("always_populate_raw_post_data", sizeof("always_populate_raw_post_data"), 0))
- php_error(E_ERROR, "PHP-SOAP requires 'always_populate_raw_post_data' to be on please check your php.ini file");
-
- php_error(E_ERROR, "Couln't find HTTP_RAW_POST_DATA");
- }
-
- zval_dtor(&retval);
- SOAP_SERVER_END_CODE();
-}
-
-void soap_error_handler(int error_num, const char *error_filename, const uint error_lineno, const char *format, va_list args)
-{
- char buffer[1024];
- int buffer_len;
- TSRMLS_FETCH();
-
- buffer_len = vsnprintf(buffer, sizeof(buffer)-1, format, args);
- buffer[sizeof(buffer)-1]=0;
- if(buffer_len > sizeof(buffer) - 1 || buffer_len < 0) {
- buffer_len = sizeof(buffer) - 1;
- }
-
- //Trap all errors
- //What do do with these warnings
- // E_WARNING, E_NOTICE, E_CORE_WARNING, E_COMPILE_WARNING, E_USER_WARNING, E_USER_NOTICE
- if(error_num == E_USER_ERROR || error_num == E_COMPILE_ERROR || error_num == E_CORE_ERROR ||
- error_num == E_ERROR || error_num == E_PARSE)
- {
- zval outbuf, outbuflen, ret;
- xmlChar *buf, cont_len[30];
- int size;
- xmlDocPtr doc_return;
-
- INIT_ZVAL(outbuf);
- INIT_ZVAL(outbuflen);
- INIT_ZVAL(ret);
-
- //Get output buffer and send as fault detials
- if(php_ob_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_LVAL(outbuflen) != 0)
- php_ob_get_buffer(&outbuf TSRMLS_CC);
- php_end_ob_buffer(0, 0 TSRMLS_CC);
-
- set_soap_fault(&ret, "SOAP-ENV:Server", buffer, NULL, &outbuf);
- doc_return = seralize_response_call(NULL, NULL, NULL, &ret);
-
- //Build and send our headers + http 500 status
- //xmlDocDumpMemoryEnc(doc_return, &buf, &size, XML_CHAR_ENCODING_UTF8);
- xmlDocDumpMemory(doc_return, &buf, &size);
- sprintf(cont_len,"Content-Length: %d\0", size);
- sapi_add_header(cont_len, strlen(cont_len) + 1, 1);
- sapi_add_header("Content-Type: text/xml", sizeof("Content-Type: text/xml"), 1);
-
- // Want to return HTTP 500 but apache wants to over write
- // our fault code with their own handling... Figure this out later
- // sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error"), 1);
- php_write(buf, size TSRMLS_CC);
-
- xmlFreeDoc(doc_return);
- xmlFree(buf);
-
- zval_dtor(&outbuf);
- zval_dtor(&outbuflen);
- zval_dtor(&ret);
-
- zend_bailout();
- }
-}
-
-// SoapObject functions
-PHP_FUNCTION(soapobject)
-{
- char *location, *uri = NULL;
- int location_len, uri_len = 0;
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &location, &location_len, &uri, &uri_len) == SUCCESS)
- {
- if(uri)
- {
- // if two parameters assume 'proxy' and 'uri'
- add_property_stringl(thisObj, "location", location, location_len, 1);
- add_property_stringl(thisObj, "uri", uri, uri_len, 1);
- }
- else
- {
- // if one parameter assume 'wsdl'
- sdlPtr sdl;
- int ret;
-
- sdl = get_sdl(location);
- ret = zend_list_insert(sdl, le_sdl);
-
- add_property_resource(thisObj, "sdl", ret);
- add_property_resource(thisObj, "port", (long)get_binding_from_type(sdl, BINDING_SOAP));
- zend_list_addref(ret);
- }
- }
-}
-
-PHP_FUNCTION(__headerclass)
-{
- char *classname, *ns;
- int classname_len, ns_len;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &classname, &classname_len, &ns, &ns_len) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapObject->__headerclass");
-}
-
-PHP_FUNCTION(__headerfunction)
-{
- char *functionname, *headername, *ns;
- int functionname_len, *headername_len, ns_len;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &functionname, &functionname_len, &headername,
- &headername_len, &ns, &ns_len) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapObject->__headerfunction");
-}
-
-PHP_FUNCTION(__use)
-{
- int use;
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &use) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapObject->__use");
-
- if(use == SOAP_DOCUMENT || use == SOAP_LITERAL)
- {
- add_property_long(thisObj, "use", use);
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-
-PHP_FUNCTION(__style)
-{
- int style;
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &style))
- php_error(E_ERROR, "Invalid arguments to SoapObject->__style");
-
- if(style == SOAP_RPC || style == SOAP_DOCUMENT)
- {
- add_property_long(thisObj, "style", style);
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-
-PHP_FUNCTION(__trace)
-{
- int level;
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &level))
- php_error(E_ERROR, "Invalid arguments to SoapObject->__trace");
-
- add_property_long(thisObj, "trace", level);
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(__generate)
-{
- char *function, *soap_action, *uri;
- int function_len, soap_action_len, uri_len, i = 0;
- zval *args;
- zval **real_args;
- zval **param;
- xmlDocPtr request = NULL;
- int arg_count;
- xmlChar *buf;
- int size;
- sdlPtr sdl;
-
- FETCH_THIS_SDL(sdl);
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|ss",
- &function, &function_len, &args, &soap_action, &soap_action_len, &uri, &uri_len) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapObject->__call");
-
- arg_count = zend_hash_num_elements(Z_ARRVAL_P(args));
-
- real_args = emalloc(sizeof(zval *) * arg_count);
- for(zend_hash_internal_pointer_reset(Z_ARRVAL_P(args));
- zend_hash_get_current_data(Z_ARRVAL_P(args), (void **) &param) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_P(args)))
- {
- zval_add_ref(param);
- real_args[i++] = *param;
- }
-
-
- if(sdl)
- {
- sdlBindingPtr binding;
- sdlFunctionPtr sdlFunction;
- FETCH_THIS_PORT(binding);
-
- php_strtolower(function, function_len);
- sdlFunction = get_function(binding, function);
- request = seralize_function_call(this_ptr, sdlFunction, NULL, uri, real_args, arg_count);
- }
- else
- {
- request = seralize_function_call(this_ptr, NULL, function, uri, real_args, arg_count);
- }
-
- xmlDocDumpMemory(request, &buf, &size);
- ZVAL_STRINGL(return_value, buf, size, 1);
- xmlFree(buf);
-}
-
-PHP_FUNCTION(__parse)
-{
- char *message, *function;
- int message_len, function_len;
- int num_params;
- zval **ret_params;
- sdlPtr sdl;
- sdlFunctionPtr fn;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &message, &message_len, &function, &function_len) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapObject->__parse");
-
- FETCH_THIS_SDL(sdl);
-
- if(sdl != NULL)
- {
- sdlBindingPtr binding;
-
- FETCH_THIS_PORT(binding);
- fn = get_function(binding, function);
- if(fn != NULL)
- parse_packet_soap(getThis(), message, message_len, fn, NULL, &ret_params, &num_params);
- }
- else
- parse_packet_soap(getThis(), message, message_len, NULL, function, &ret_params, &num_params);
-
- if(num_params > 0)
- {
- *return_value = *ret_params[0];
- zval_add_ref(&return_value);
- efree(ret_params);
- }
- else
- ZVAL_NULL(return_value)
-}
-
-PHP_FUNCTION(__call)
-{
- char *function, *soap_action, *uri;
- int function_len, soap_action_len, uri_len, i = 0;
- zval *args;
- zval **real_args;
- zval **param;
- xmlDocPtr request = NULL;
- int num_params, arg_count;
- zval **ret_params;
- char *buffer;
- int len;
-
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|ss",
- &function, &function_len, &args, &soap_action, &soap_action_len, &uri, &uri_len) == FAILURE)
- php_error(E_ERROR, "Invalid arguments to SoapObject->__call");
-
- arg_count = zend_hash_num_elements(Z_ARRVAL_P(args));
-
- real_args = emalloc(sizeof(zval *) * arg_count);
- for(zend_hash_internal_pointer_reset(Z_ARRVAL_P(args));
- zend_hash_get_current_data(Z_ARRVAL_P(args), (void **) &param) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_P(args)))
- {
- zval_add_ref(param);
- real_args[i++] = *param;
- }
-
- request = seralize_function_call(this_ptr, NULL, function, uri, real_args, arg_count);
- send_http_soap_request(getThis(), request, function, soap_action);
- xmlFreeDoc(request);
-
- get_http_soap_response(getThis(), &buffer, &len);
- parse_packet_soap(getThis(), buffer, len, NULL, function, &ret_params, &num_params);
- efree(buffer);
-
- if(num_params > 0)
- {
- *return_value = *ret_params[0];
- zval_add_ref(&return_value);
- efree(ret_params);
- }
- else
- ZVAL_NULL(return_value)
-}
-
-PHP_FUNCTION(__isfault)
-{
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_hash_exists(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault")))
- RETURN_TRUE
- else
- RETURN_FALSE
-}
-
-PHP_FUNCTION(__getfault)
-{
- zval *thisObj;
- zval **tmp;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_hash_find(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault"), (void **)&tmp) == SUCCESS)
- {
- *return_value = *(*tmp);
- zval_copy_ctor(return_value);
- return;
- }
- RETURN_NULL();
-}
-
-PHP_FUNCTION(__getfunctions)
-{
- sdlPtr sdl;
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- FETCH_THIS_SDL(sdl);
-
- if(sdl)
- {
- smart_str buf = {0};
- sdlFunctionPtr *function;
- sdlBindingPtr binding;
-
- FETCH_THIS_PORT(binding);
-
- array_init(return_value);
- zend_hash_internal_pointer_reset(binding->functions);
- while(zend_hash_get_current_data(binding->functions, (void **)&function) != FAILURE)
- {
- function_to_string((*function), &buf);
- add_next_index_stringl(return_value, buf.c, buf.len, 1);
- zend_hash_move_forward(binding->functions);
- smart_str_free(&buf);
- }
- }
-}
-
-PHP_FUNCTION(__gettypes)
-{
- sdlPtr sdl;
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- FETCH_THIS_SDL(sdl);
-
- if(sdl)
- {
- sdlTypePtr *type;
- smart_str buf = {0};
-
- array_init(return_value);
- if(sdl->types)
- {
- zend_hash_internal_pointer_reset(sdl->types);
- while(zend_hash_get_current_data(sdl->types, (void **)&type) != FAILURE)
- {
- type_to_string((*type), &buf, 0);
- add_next_index_stringl(return_value, buf.c, buf.len, 1);
- zend_hash_move_forward(sdl->types);
- smart_str_free(&buf);
- }
- }
- }
-}
-
-PHP_FUNCTION(__getlastrequest)
-{
- zval *thisObj;
- zval **tmp;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_hash_find(Z_OBJPROP_P(thisObj), "__last_request", sizeof("__last_request"), (void **)&tmp) == SUCCESS)
- {
- *return_value = *(*tmp);
- zval_copy_ctor(return_value);
- return;
- }
- RETURN_NULL();
-}
-
-PHP_FUNCTION(__getlastresponse)
-{
- zval *thisObj;
- zval **tmp;
-
- GET_THIS_OBJECT(thisObj);
-
- if(zend_hash_find(Z_OBJPROP_P(thisObj), "__last_response", sizeof("__last_response"), (void **)&tmp) == SUCCESS)
- {
- *return_value = *(*tmp);
- zval_copy_ctor(return_value);
- return;
- }
- RETURN_NULL();
-}
-
-void soap_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *)property_reference->elements_list->tail->data;
- zval *thisObj;
- char *function = Z_STRVAL(function_name->element);
- zend_function *builtin_function;
-
- GET_THIS_OBJECT(thisObj);
-
- //Find if the function being called is already defined...
- // ( IMHO: zend should handle this functionality )
- if(zend_hash_find(&Z_OBJCE_P(thisObj)->function_table, function, Z_STRLEN(function_name->element) + 1, (void **) &builtin_function) == SUCCESS)
- {
- builtin_function->internal_function.handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- else
- {
- zval **arguments = (zval **) emalloc(sizeof(zval *) * ZEND_NUM_ARGS());
- int arg_count = ZEND_NUM_ARGS();
- xmlDocPtr request = NULL;
- sdlPtr sdl;
- sdlFunctionPtr fn;
-
- zend_get_parameters_array(ht, arg_count, arguments);
-
- FETCH_THIS_SDL(sdl);
-
- clear_soap_fault(thisObj);
-
- if(sdl != NULL)
- {
- sdlBindingPtr binding;
-
- FETCH_THIS_PORT(binding);
- fn = get_function(binding, function);
- if(fn != NULL)
- {
- int num_params;
- zval **ret_params;
- char *buffer;
- char *ns;
- int len;
-
- if(binding->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes;
- request = seralize_function_call(this_ptr, fn, NULL, fnb->input.ns, arguments, arg_count);
- send_http_soap_request(getThis(), request, fn->functionName, fnb->soapAction);
- }
- else
- {
- request = seralize_function_call(this_ptr, fn, NULL, sdl->target_ns, arguments, arg_count);
- send_http_soap_request(getThis(), request, fn->functionName, NULL);
- }
-
- xmlFreeDoc(request);
-
- get_http_soap_response(getThis(), &buffer, &len);
- parse_packet_soap(getThis(), buffer, len, fn, NULL, &ret_params, &num_params);
- efree(buffer);
-
- if(num_params > 0)
- {
- *return_value = *ret_params[0];
- zval_add_ref(&return_value);
- efree(ret_params);
- }
- else
- ZVAL_NULL(return_value);
- }
- else
- {
- php_error(E_WARNING,"Function (\"%s\") not is not a valid method for this service", function);
- }
- }
- else
- {
- int num_params;
- zval **ret_params;
- zval **uri;
- smart_str *action;
- char *buffer;
- int len;
-
- if(zend_hash_find(Z_OBJPROP_P(thisObj), "uri", sizeof("uri"), (void *)&uri) == FAILURE)
- php_error(E_ERROR, "Error finding uri in soap_call_function_handler");
-
- request = seralize_function_call(this_ptr, NULL, function, Z_STRVAL_PP(uri), arguments, arg_count);
- action = build_soap_action(thisObj, function);
- send_http_soap_request(getThis(), request, function, action->c);
-
- smart_str_free(action);
- xmlFreeDoc(request);
-
- get_http_soap_response(getThis(), &buffer, &len);
- parse_packet_soap(getThis(), buffer, len, NULL, function, &ret_params, &num_params);
- efree(buffer);
-
- if(num_params > 0)
- {
- *return_value = *ret_params[0];
- zval_add_ref(&return_value);
- efree(ret_params);
- }
- else
- ZVAL_NULL(return_value);
- }
- efree(arguments);
- }
-
- zval_dtor(&function_name->element);
-}
-
-void clear_soap_fault(zval *obj)
-{
- if(obj != NULL && obj->type == IS_OBJECT)
- zend_hash_del(obj->value.obj.properties, "__soap_fault", sizeof("__soap_fault"));
-}
-
-void add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail)
-{
- zval *fault;
- MAKE_STD_ZVAL(fault);
- set_soap_fault(fault, fault_string, fault_code, fault_actor, fault_detail);
- add_property_zval(obj, "__soap_fault", fault);
-}
-
-void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail)
-{
- TSRMLS_FETCH();
-
- if(Z_TYPE_P(obj) != IS_OBJECT)
- object_init_ex(obj, &soap_fault_class_entry);
-
- if(fault_string != NULL)
- add_property_string(obj, "faultstring", fault_string, 1);
-
- if(fault_code != NULL)
- add_property_string(obj, "faultcode", fault_code, 1);
-
- if(fault_actor != NULL)
- add_property_string(obj, "faultactor", fault_actor, 1);
-
- if(fault_detail != NULL)
- {
- zval_add_ref(&fault_detail);
- add_property_zval(obj, "detail", fault_detail);
- }
-}
-
-void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *function_name, int *num_params, zval ***parameters)
-{
- xmlNodePtr trav,trav2,trav3,trav4,env,body;
- int cur_param = 0,num_of_params = 0;
- TSRMLS_FETCH();
-
- trav = request->children;
- FOREACHNODE(trav,"Envelope",env)
- {
- trav2 = env->children;
- FOREACHNODE(trav2,"Body",body)
- {
- trav3 = body->children;
- do
- {
- // TODO: make 'strict' (use th sdl defnintions)
- if(trav3->type == XML_ELEMENT_NODE)
- {
- zval tmp_function_name, **tmp_parameters;
- sdlFunctionPtr function;
- sdlBindingPtr binding = get_binding_from_type(sdl, BINDING_SOAP);
-
- INIT_ZVAL(tmp_function_name);
- ZVAL_STRING(&tmp_function_name, (char *)trav3->name, 1);
-
- (*function_name) = tmp_function_name;
-
- function = get_function(binding, php_strtolower((char *)trav3->name, strlen(trav3->name)));
- if(sdl != NULL && function == NULL)
- php_error(E_ERROR, "Error function \"%s\" doesn't exists for this service \"%s\"", trav3->name, binding->location);
-
- if(trav3->children)
- {
- trav4 = trav3->children;
- if(function == NULL)
- {
- do
- {
- if(trav4->type == XML_ELEMENT_NODE)
- num_of_params++;
-
- }while(trav4 = trav4->next);
- }
- else
- num_of_params = zend_hash_num_elements(function->requestParameters);
-
- tmp_parameters = emalloc(num_of_params * sizeof(zval *));
- trav4 = trav3->children;
- do
- {
- if(trav4->type == XML_ELEMENT_NODE)
- {
- encodePtr enc;
- sdlParamPtr *param = NULL;
-
- if(function != NULL && zend_hash_index_find(function->requestParameters, cur_param, (void **)&param) == FAILURE)
- php_error(E_ERROR, "Error cannot find parameter");
- if(param == NULL)
- enc = get_conversion(UNKNOWN_TYPE);
- else
- enc = (*param)->encode;
-
- tmp_parameters[cur_param] = master_to_zval(enc, trav4);
- cur_param++;
- }
-
- }while(trav4 = trav4->next);
- }
- (*parameters) = tmp_parameters;
- (*num_params) = num_of_params;
- break;
- }
- }while(trav3 = trav3->next);
-
- }
- ENDFOREACH(trav2);
- }
- ENDFOREACH(trav);
-}
-
-xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_name, char *uri, zval *ret)
-{
- xmlDoc *doc;
- xmlNode *envelope,*body,*method, *param;
- xmlNs *ns;
- sdlParamPtr parameter = NULL;
- smart_str *gen_ns;
-
- encode_reset_ns();
-
- doc = xmlNewDoc("1.0");
- doc->charset = XML_CHAR_ENCODING_UTF8;
- doc->encoding = xmlStrdup((xmlChar*)"UTF-8");
- doc->children = xmlNewDocNode(doc, NULL, "SOAP-ENV:Envelope", NULL);
- envelope = doc->children;
-
- xmlSetProp(envelope, "SOAP-ENV:encodingStyle", "http://schemas.xmlsoap.org/soap/encoding/");
- xmlSetProp(envelope, "xmlns:SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/");
- xmlSetProp(envelope, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
- xmlSetProp(envelope, "xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
- xmlSetProp(envelope, "xmlns:" APACHE_NS_PREFIX , APACHE_NAMESPACE);
-
- ns = xmlNewNs(envelope,"http://schemas.xmlsoap.org/soap/envelope/","SOAP-ENV");
- body = xmlNewChild(envelope, ns, "Body", NULL);
-
- if(Z_TYPE_P(ret) == IS_OBJECT &&
- Z_OBJCE_P(ret)->refcount == soap_fault_class_entry.refcount)
- {
- param = seralize_zval(ret, NULL, "SOAP-ENV:Fault", SOAP_ENCODED);
- xmlAddChild(body, param);
- }
- else
- {
- gen_ns = encode_new_ns();
- ns = xmlNewNs(envelope, uri, gen_ns->c);
-
- if(function != NULL)
- method = xmlNewChild(body, ns, function->responseName , NULL);
- else
- method = xmlNewChild(body, ns, function_name, NULL);
-
- if(uri)
- ns = xmlNewNs(method, uri, NULL);
-
- parameter = get_param(function, NULL, 0, TRUE);
-
- if(Z_TYPE_P(ret) == IS_OBJECT &&
- Z_OBJCE_P(ret)->refcount == soap_param_class_entry.refcount)
- {
- zval **ret_name;
- zval **ret_data;
-
- if(zend_hash_find(Z_OBJPROP_P(ret), "param_name", sizeof("param_name"), (void **)&ret_name) == SUCCESS &&
- zend_hash_find(Z_OBJPROP_P(ret), "param_data", sizeof("param_data"), (void **)&ret_data) == SUCCESS)
- param = seralize_parameter(parameter, *ret_data, 0, Z_STRVAL_PP(ret_name), SOAP_ENCODED);
- else
- param = seralize_parameter(parameter, ret, 0, "return", SOAP_ENCODED);
- }
- else
- param = seralize_parameter(parameter, ret, 0, "return", SOAP_ENCODED);
-
- xmlAddChild(method,param);
- }
-
- return doc;
-}
-
-xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function, char *function_name, char *uri, zval **arguments, int arg_count)
-{
- xmlDoc *doc;
- xmlNode *envelope, *body, *method;
- xmlNs *ns, *tmpns;
- zval **zstyle, **zuse;
- int i, style, use;
- smart_str *gen_ns;
-
- encode_reset_ns();
-
- doc = xmlNewDoc("1.0");
- doc->encoding = xmlStrdup((xmlChar*)"UTF-8");
- doc->charset = XML_CHAR_ENCODING_UTF8;
- envelope = xmlNewDocNode(doc, NULL, "SOAP-ENV:Envelope", NULL);
- xmlDocSetRootElement(doc, envelope);
- xmlSetProp(envelope, "SOAP-ENV:encodingStyle", "http://schemas.xmlsoap.org/soap/encoding/");
- xmlSetProp(envelope, "xmlns:SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/");
- xmlSetProp(envelope, "xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
- xmlSetProp(envelope, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
-
- ns = xmlNewNs(envelope, "http://schemas.xmlsoap.org/soap/envelope/", "SOAP-ENV");
- body = xmlNewChild(envelope, ns, "Body", NULL);
-
- gen_ns = encode_new_ns();
-
- if(function)
- {
- if(function->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes;
-
- style = fnb->style;
- use = fnb->input.use;
- if(style == SOAP_RPC)
- {
- ns = xmlNewNs(body, fnb->input.ns, gen_ns->c);
- method = xmlNewChild(body, ns, function->requestName , NULL);
- }
- }
- }
- else
- {
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "style", sizeof("style"), (void **)&zstyle) == SUCCESS)
- style = Z_LVAL_PP(zstyle);
- else
- style = SOAP_RPC;
-
- if(style == SOAP_RPC)
- {
- ns = xmlNewNs(body, uri, gen_ns->c);
- method = xmlNewChild(body, ns, function_name, NULL);
- }
-
- if(zend_hash_find(Z_OBJPROP_P(this_ptr), "use", sizeof("use"), (void **)&zuse) == SUCCESS)
- use = Z_LVAL_PP(zuse);
- else
- use = SOAP_ENCODED;
- }
-
- for(i = 0;i < arg_count;i++)
- {
- xmlNodePtr param;
- sdlParamPtr parameter = get_param(function, NULL, i, FALSE);
-
- if(Z_TYPE_P(arguments[i]) == IS_OBJECT &&
- Z_OBJCE_P(arguments[i])->refcount == soap_param_class_entry.refcount)
- {
- zval **ret_name;
- zval **ret_data;
-
- if(zend_hash_find(Z_OBJPROP_P(arguments[i]), "param_name", sizeof("param_name"), (void **)&ret_name) == SUCCESS &&
- zend_hash_find(Z_OBJPROP_P(arguments[i]), "param_data", sizeof("param_data"), (void **)&ret_data) == SUCCESS)
- param = seralize_parameter(parameter, *ret_data, i, Z_STRVAL_PP(ret_name), use);
- else
- param = seralize_parameter(parameter, arguments[i], i, NULL, use);
- }
- else
- param = seralize_parameter(parameter, arguments[i], i, NULL, use);
-
- if(style == SOAP_RPC)
- xmlAddChild(method, param);
- else if(style == SOAP_DOCUMENT)
- {
- if(function && function->bindingType == BINDING_SOAP)
- {
- sdlParamPtr *sparam;
-
- if(zend_hash_index_find(function->requestParameters, 0, (void **)&sparam) == SUCCESS)
- {
- ns = xmlNewNs(param, (*sparam)->encode->details.ns, gen_ns->c);
- xmlNodeSetName(param, (*sparam)->encode->details.type_str);
- xmlSetNs(param, ns);
- }
- }
- xmlAddChild(body, param);
- }
- }
- smart_str_free(gen_ns);
-
- return doc;
-}
-
-xmlNodePtr seralize_parameter(sdlParamPtr param, zval *param_val, int index, char *name, int style)
-{
- int type = 0;
- char *paramName;
- xmlNodePtr xmlParam;
-
- if(param != NULL && param->paramName != NULL)
- paramName = estrdup(param->paramName);
- else
- {
- if(name == NULL)
- {
- paramName = emalloc(10);
- sprintf(paramName,"param%d",index);
- }
- else
- paramName = estrdup(name);
- }
-
- xmlParam = seralize_zval(param_val, param, paramName, style);
-
- efree(paramName);
-
- return xmlParam;
-}
-
-zval *desearlize_zval(sdlPtr sdl, xmlNodePtr data, sdlParamPtr param)
-{
- encodePtr enc;
- TSRMLS_FETCH();
-
- if(param != NULL)
- enc = param->encode;
- else
- enc = get_conversion(UNKNOWN_TYPE);
-
- return enc->to_zval(enc->details, data);
-}
-
-xmlNodePtr seralize_zval(zval *val, sdlParamPtr param, char *paramName, int style)
-{
- xmlNodePtr xmlParam;
- encodePtr enc;
- TSRMLS_FETCH();
-
- if(param != NULL)
- enc = param->encode;
- else
- enc = get_conversion(val->type);
-
- xmlParam = master_to_xml(enc, val, style);
- if(!strcmp(xmlParam->name, "BOGUS"))
- xmlNodeSetName(xmlParam, paramName);
-
- return xmlParam;
-}
-
-sdlParamPtr get_param(sdlFunctionPtr function, char *param_name, int index, int response)
-{
- sdlParamPtr *tmp = NULL;
- HashTable *h;
-
- if(function == NULL)
- return NULL;
-
- if(response == FALSE)
- h = function->requestParameters;
- else
- h = function->responseParameters;
-
- if (function != NULL && (param_name == NULL || zend_hash_find(h, param_name, strlen(param_name), (void **)&tmp) == FAILURE))
- {
- if(index != -1)
- if(zend_hash_index_find(h, index, (void **)&tmp) != FAILURE)
- return (*tmp);
- }
- else
- return (*tmp);
-
- return NULL;
-}
-
-sdlFunctionPtr get_function(sdlBindingPtr sdl, char *function_name)
-{
- sdlFunctionPtr *tmp;
- if(sdl != NULL)
- if(zend_hash_find(sdl->functions, function_name, strlen(function_name), (void **)&tmp) != FAILURE)
- return (*tmp);
- return NULL;
-}
-
-static void function_to_string(sdlFunctionPtr function, smart_str *buf)
-{
- int i = 0;
-
- if(function->responseParameters)
- {
- sdlParamPtr *param;
- param = function->responseParameters->pListHead->pData;
- smart_str_appendl(buf, (*param)->encode->details.type_str, strlen((*param)->encode->details.type_str));
- smart_str_appendc(buf, ' ');
- }
- else
- smart_str_appendl(buf, "void ", 5);
-
- smart_str_appendl(buf, function->functionName, strlen(function->functionName));
-
- smart_str_appendc(buf, '(');
- if(function->requestParameters)
- {
- sdlParamPtr *param;
-
- i = 0;
- zend_hash_internal_pointer_reset(function->requestParameters);
- while(zend_hash_get_current_data(function->requestParameters, (void **)&param) != FAILURE)
- {
- smart_str_appendl(buf, (*param)->encode->details.type_str, strlen((*param)->encode->details.type_str));
- smart_str_appendc(buf, ' ');
- smart_str_appendc(buf, '$');
- smart_str_appendl(buf, (*param)->paramName, strlen((*param)->paramName));
- if(zend_hash_num_elements(function->requestParameters) > i + 1)
- smart_str_appendl(buf, ", ", 2);
- zend_hash_move_forward(function->requestParameters);
- i++;
- }
- }
- smart_str_appendc(buf, ')');
-}
-
-static void type_to_string(sdlTypePtr type, smart_str *buf, int level)
-{
- int i;
- smart_str spaces = {0};
-
- for(i = 0;i < level;i++)
- smart_str_appendc(&spaces, ' ');
-
- smart_str_appendl(buf, spaces.c, spaces.len);
- if(type->elements)
- {
- sdlTypePtr *t_type;
-
- smart_str_appendl(buf, "struct ", 7);
- smart_str_appendl(buf, type->name, strlen(type->name));
- smart_str_appendc(buf, '\n');
- smart_str_appendl(buf, spaces.c, spaces.len);
- smart_str_appendl(buf, "{\n", 2);
-
- zend_hash_internal_pointer_reset(type->elements);
- level++;
- while(zend_hash_get_current_data(type->elements, (void **)&t_type) != FAILURE)
- {
- type_to_string((*t_type), buf, level);
- zend_hash_move_forward(type->elements);
- }
-
- smart_str_appendl(buf, spaces.c, spaces.len);
- smart_str_appendl(buf, "}\n", 2);
- }
- else
- {
- smart_str_appendl(buf, type->encode->details.type_str, strlen(type->encode->details.type_str));
- smart_str_appendc(buf, ' ');
- smart_str_appendl(buf, type->name, strlen(type->name));
- smart_str_appendl(buf, ";\n", 2);
- }
-}
-
-//Deletes
-void delete_sdl(void *handle)
-{
- sdlPtr tmp = *((sdlPtr*)handle);
-
- xmlFreeDoc(tmp->doc);
- if(tmp->source)
- free(tmp->source);
- if(tmp->target_ns)
- free(tmp->target_ns);
- if(tmp->encoders)
- {
- zend_hash_destroy(tmp->encoders);
- free(tmp->encoders);
- }
- if(tmp->types)
- {
- zend_hash_destroy(tmp->types);
- free(tmp->types);
- }
- if(tmp->bindings)
- {
- zend_hash_destroy(tmp->bindings);
- free(tmp->bindings);
- }
- free(tmp);
-}
-
-void delete_http_socket(void *handle)
-{
- SOAP_STREAM stream = (SOAP_STREAM)handle;
-#ifdef PHP_STREAMS
- TSRMLS_FETCH();
- php_stream_close(stream);
-#else
- SOCK_CLOSE(stream);
-#endif
-}
-
-void delete_url(void *handle)
-{
- php_url_free((php_url*)handle);
-}
-
-void delete_service(void *data)
-{
- soapServicePtr service = (soapServicePtr)data;
-
- if(service->soap_functions.ft)
- {
- zend_hash_destroy(service->soap_functions.ft);
- efree(service->soap_functions.ft);
- }
-
- if(service->mapping)
- {
- zend_hash_destroy(service->mapping);
- efree(service->mapping);
- }
-
- if(service->soap_class.argc)
- {
- int i;
- for(i = 0; i < service->soap_class.argc;i++)
- zval_ptr_dtor(&service->soap_class.argv[i]);
- efree(service->soap_class.argv);
- }
-
- efree(service->uri);
- efree(service);
-}
-
-void delete_binding(void *data)
-{
- sdlBindingPtr binding = *((sdlBindingPtr*)data);
-
- if(binding->functions)
- {
- zend_hash_destroy(binding->functions);
- free(binding->functions);
- }
-
- if(binding->location)
- free(binding->location);
- if(binding->name)
- free(binding->name);
-
- if(binding->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingPtr soapBind = binding->bindingAttributes;
- free(soapBind->transport);
- }
-}
-
-void delete_function(void *data)
-{
- sdlFunctionPtr function = *((sdlFunctionPtr*)data);
-
- if(function->functionName)
- free(function->functionName);
- if(function->requestName)
- free(function->requestName);
- if(function->responseName)
- free(function->responseName);
-
- if(function->requestParameters)
- {
- zend_hash_destroy(function->requestParameters);
- free(function->requestParameters);
- }
- if(function->responseParameters)
- {
- zend_hash_destroy(function->responseParameters);
- free(function->responseParameters);
- }
-
- if(function->bindingType == BINDING_SOAP)
- {
- sdlSoapBindingFunctionPtr soapFunction = function->bindingAttributes;
- if(soapFunction->soapAction)
- free(soapFunction->soapAction);
- delete_sdl_soap_binding_function_body(soapFunction->input);
- delete_sdl_soap_binding_function_body(soapFunction->output);
- delete_sdl_soap_binding_function_body(soapFunction->falut);
- }
-}
-
-void delete_sdl_soap_binding_function_body(sdlSoapBindingFunctionBody body)
-{
- if(body.ns)
- free(body.ns);
- if(body.parts)
- free(body.parts);
- if(body.encodingStyle)
- free(body.encodingStyle);
-}
-
-void delete_paramater(void *data)
-{
- sdlParamPtr param = *((sdlParamPtr*)data);
- if(param->paramName)
- free(param->paramName);
- free(param);
-}
-
-void delete_mapping(void *data)
-{
- soapMappingPtr map = (soapMappingPtr)data;
-
- if(map->ns)
- efree(map->ns);
- if(map->ctype)
- efree(map->ctype);
-
- if(map->type == SOAP_MAP_FUNCTION)
- {
- if(map->map_functions.to_xml_before)
- zval_ptr_dtor(&map->map_functions.to_xml_before);
- if(map->map_functions.to_xml)
- zval_ptr_dtor(&map->map_functions.to_xml);
- if(map->map_functions.to_xml_after)
- zval_ptr_dtor(&map->map_functions.to_xml_after);
-
- if(map->map_functions.to_zval_before)
- zval_ptr_dtor(&map->map_functions.to_zval_before);
- if(map->map_functions.to_zval)
- zval_ptr_dtor(&map->map_functions.to_zval);
- if(map->map_functions.to_zval_after)
- zval_ptr_dtor(&map->map_functions.to_zval_after);
- }
- efree(map);
-}
-
-// Should not need
-int my_call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC)
-{
- if(call_user_function(function_table, object_pp, function_name, retval_ptr, param_count, params TSRMLS_CC) == FAILURE)
- {
- if(Z_OBJCE_PP(object_pp)->handle_function_call != NULL)
- {
- zend_overloaded_element overloaded_element;
- zend_property_reference property_reference;
- zend_function_state function_state;
- zend_function_state *original_function_state_ptr;
- int i;
-
- overloaded_element.element = *function_name;
- overloaded_element.type = OE_IS_METHOD;
-
- function_state.function = (zend_function *) emalloc(sizeof(zend_function));
- function_state.function->type = ZEND_OVERLOADED_FUNCTION;
- function_state.function->common.arg_types = NULL;
- function_state.function->overloaded_function.function_name = Z_STRVAL_P(function_name);
-
- property_reference.object = *object_pp;
- property_reference.type = BP_VAR_NA;
- property_reference.elements_list = (zend_llist *)emalloc(sizeof(zend_llist));
- zend_llist_init(property_reference.elements_list, sizeof(zend_overloaded_element), NULL, 0);
- zend_llist_add_element(property_reference.elements_list, &overloaded_element);
-
- //Build argument stack
- for(i = 0;i < param_count;i++)
- zend_ptr_stack_push(&EG(argument_stack), params[i]);
- zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *)param_count, NULL);
-
- original_function_state_ptr = EG(function_state_ptr);
- EG(function_state_ptr) = &function_state;
- Z_OBJCE_PP(object_pp)->handle_function_call(param_count, retval_ptr, *object_pp, 1 TSRMLS_CC, &property_reference);
- EG(function_state_ptr) = original_function_state_ptr;
-
- zend_llist_destroy(property_reference.elements_list);
- efree(property_reference.elements_list);
- efree(function_state.function);
-
- zend_ptr_stack_clear_multiple(TSRMLS_C);
- return SUCCESS;
- }
- }
- return FAILURE;
-} \ No newline at end of file
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
index 38f4e2c21c..c855921ef1 100644
--- a/ext/standard/formatted_print.c
+++ b/ext/standard/formatted_print.c
@@ -278,7 +278,8 @@ php_sprintf_appenddouble(char **buffer, int *pos,
int width, char padding,
int alignment, int precision,
int adjust, char fmt,
- int always_sign)
+ int always_sign
+ TSRMLS_DC)
{
char numbuf[NUM_BUF_SIZE];
char *cvt;
@@ -608,7 +609,8 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC)
Z_DVAL_PP(args[argnum]),
width, padding, alignment,
precision, adjusting,
- format[inpos], always_sign);
+ format[inpos], always_sign
+ TSRMLS_CC);
break;
case 'c':
diff --git a/main/config.w32.h.in b/main/config.w32.h.in
index f185a48b1e..a7a6948532 100644
--- a/main/config.w32.h.in
+++ b/main/config.w32.h.in
@@ -6,20 +6,18 @@
*/
/* Default PHP / PEAR directories */
-#define CONDENV(ev,def) (getenv(ev)!=NULL?getenv(ev):def)
-
#define CONFIGURATION_FILE_PATH "php.ini"
-#define PEAR_INSTALLDIR CONDENV("PEAR_INSTALLDIR", "c:\\php4\\pear")
-#define PHP_BINDIR CONDENV("PHP_BINDIR", "c:\\php4")
-#define PHP_CONFIG_FILE_PATH CONDENV("SystemRoot", "")
-#define PHP_CONFIG_FILE_SCAN_DIR CONDENV("PHP_CONFIG_FILE_SCAN_DIR", "")
-#define PHP_DATADIR CONDENV("PHP_DATADIR", "c:\\php4")
-#define PHP_EXTENSION_DIR CONDENV("PHP_EXTENSION_DIR", "c:\\php4")
-#define PHP_INCLUDE_PATH CONDENV("PHP_INCLUDE_PATH", ".;c:\\php4\\pear")
-#define PHP_LIBDIR CONDENV("PHP_LIBDIR", "c:\\php4")
-#define PHP_LOCALSTATEDIR CONDENV("PHP_LOCALSTATEDIR", "c:\\php4")
-#define PHP_PREFIX CONDENV("PHP_PREFIX", "c:\\php4")
-#define PHP_SYSCONFDIR CONDENV("PHP_SYSCONFDIR", "c:\\php4")
+#define PEAR_INSTALLDIR "c:\\php4\\pear"
+#define PHP_BINDIR "c:\\php4"
+#define PHP_CONFIG_FILE_PATH (getenv("SystemRoot"))?getenv("SystemRoot"):""
+#define PHP_CONFIG_FILE_SCAN_DIR ""
+#define PHP_DATADIR "c:\\php4"
+#define PHP_EXTENSION_DIR "c:\\php4"
+#define PHP_INCLUDE_PATH ".;c:\\php4\\pear"
+#define PHP_LIBDIR "c:\\php4"
+#define PHP_LOCALSTATEDIR "c:\\php4"
+#define PHP_PREFIX "c:\\php4"
+#define PHP_SYSCONFDIR "c:\\php4"
/* Enable / Disable BCMATH extension (default: enabled) */
#define WITH_BCMATH 1
@@ -170,4 +168,3 @@
/* Win32 supports strcoll */
#define HAVE_STRCOLL 1
-
diff --git a/main/php_realpath.c b/main/php_realpath.c
deleted file mode 100644
index 8c7cef5f86..0000000000
--- a/main/php_realpath.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sander Steffann (sander@steffann.nl) |
- +----------------------------------------------------------------------+
- */
-
-#include "php.h"
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-
-#ifndef MAXSYMLINKS
-#define MAXSYMLINKS 32
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
-#endif
-
-char *php_realpath(char *path, char resolved_path[]);
-
-#ifdef PHP_WIN32
-#define IS_SLASH(p) ((p) == '/' || (p) == '\\')
-#else
-#define IS_SLASH(p) ((p) == '/')
-#endif
-
-char *php_realpath(char *path, char resolved_path []) {
- char path_construction[MAXPATHLEN]; /* We build the result in here */
- char *writepos; /* Position to write next char */
-
- char path_copy[MAXPATHLEN]; /* A work-copy of the path */
- char *workpos; /* working position in *path */
-
-#if !defined(PHP_WIN32)
- char buf[MAXPATHLEN]; /* Buffer for readlink */
- int linklength; /* The result from readlink */
-#endif
- int linkcount = 0; /* Count symlinks to avoid loops */
-
- struct stat filestat; /* result from stat */
-
-#ifdef PHP_WIN32
- char *temppos; /* position while counting '.' */
- int dotcount; /* number of '.' */
- int t; /* counter */
-#endif
-
- /* Set the work-position to the beginning of the given path */
- strcpy(path_copy, path);
- workpos = path_copy;
-
-#ifdef PHP_WIN32
- /* Find out where we start - Windows version */
- if (IS_SLASH(*workpos)) {
- /* We start at the root of the current drive */
- /* Get the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- /* We only need the first three chars (for example "C:\") */
- path_construction[3] = 0;
- workpos++;
- } else if (workpos[1] == ':') {
- /* A drive-letter is specified, copy it */
- strncpy(path_construction, path, 2);
- strcat(path_construction, "\\");
- workpos++;
- workpos++;
- } else {
- /* Use the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- strcat(path_construction, "\\");
- }
-#else
- /* Find out where we start - Unix version */
- if (*workpos == '/') {
- /* We start at the root */
- strcpy(path_construction, "/");
- workpos++;
- } else {
- /* Use the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- strcat(path_construction, "/");
- }
-#endif
-
- /* Set the next-char-position */
- writepos = &path_construction[strlen(path_construction)];
-
- /* Go to the end, then stop */
- while(*workpos != 0) {
- /* Strip (back)slashes */
- while(IS_SLASH(*workpos)) workpos++;
-
-#ifdef PHP_WIN32
- /* reset dotcount */
- dotcount = 0;
-
- /* Look for .. */
- if ((workpos[0] == '.') && (workpos[1] != 0)) {
- /* Windows accepts \...\ as \..\..\, \....\ as \..\..\..\, etc */
- /* At least Win98 does */
-
- temppos = workpos;
- while(*temppos++ == '.') {
- dotcount++;
- if (!IS_SLASH(*temppos) && (*temppos != 0) && (*temppos != '.')) {
- /* This is not a /../ component, but a filename that starts with '.' */
- dotcount = 0;
- }
- }
-
- /* Go back dotcount-1 times */
- for (t=0 ; t<(dotcount-1) ; t++) {
- workpos++; /* move to next '.' */
-
- /* Can we still go back? */
- if ((writepos-3) <= path_construction) return NULL;
-
- /* Go back */
- writepos--; /* move to '\' */
- writepos--;
- while(!IS_SLASH(*writepos)) writepos--; /* skip until previous '\\' */
- }
- workpos++;
- }
-
- /* No special case */
- if (dotcount == 0) {
- /* Append */
- while(!IS_SLASH(*workpos) && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
-
- /* Just one '.', go to next element */
- if (dotcount == 1) {
- while(!IS_SLASH(*workpos) && (*workpos != 0)) {
- *workpos++;
- }
-
- /* Avoid double \ in the result */
- writepos--;
- }
-
- /* If it was a directory, append a slash */
- if (IS_SLASH(*workpos)) {
- *writepos++ = *workpos++;
- }
- *writepos = 0;
-#else /* defined(PHP_WIN32) */
- /* Look for .. */
- if ((workpos[0] == '.') && (workpos[1] != 0)) {
- if ((workpos[1] == '.') && ((workpos[2] == '/') || (workpos[2] == 0))) {
- /* One directory back */
- /* Set pointers to right position */
- workpos++; /* move to second '.' */
- workpos++; /* move to '/' */
-
- /* Only apply .. if not in root */
- if ((writepos-1) > path_construction) {
- writepos--; /* move to '/' */
- while(*--writepos != '/') ; /* skip until previous '/' */
- }
- } else {
- if (workpos[1] == '/') {
- /* Found a /./ skip it */
- workpos++; /* move to '/' */
-
- /* Avoid double / in the result */
- writepos--;
- } else {
- /* No special case, the name just started with a . */
- /* Append */
- while((*workpos != '/') && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
- }
- } else {
- /* No special case */
- /* Append */
- while((*workpos != '/') && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
-
-#if HAVE_SYMLINK
- /* We are going to use path_construction, so close it */
- *writepos = 0;
-
- /* Check the current location to see if it is a symlink */
- if((linklength = readlink(path_construction, buf, MAXPATHLEN)) != -1) {
- /* Check linkcount */
- if (linkcount > MAXSYMLINKS) return NULL;
-
- /* Count this symlink */
- linkcount++;
-
- /* Set end of buf */
- buf[linklength] = 0;
-
- /* Check for overflow */
- if ((strlen(workpos) + strlen(buf) + 1) >= MAXPATHLEN) return NULL;
-
- /* Remove the symlink-component wrom path_construction */
- writepos--; /* move to '/' */
- while(*--writepos != '/') ; /* skip until previous '/' */
- *++writepos = 0; /* end of string after '/' */
-
- /* If the symlink starts with a '/', empty path_construction */
- if (*buf == '/') {
- *path_construction = 0;
- writepos = path_construction;
- }
-
- /* Insert symlink into path_copy */
- strcat(buf, workpos);
- strcpy(path_copy, buf);
- workpos = path_copy;
- }
-#endif /* HAVE_SYMLINK */
-
- /* If it was a directory, append a slash */
- if (*workpos == '/') {
- *writepos++ = *workpos++;
- }
- *writepos = 0;
-#endif /* defined(PHP_WIN32) */
- }
-
- /* Check if the resolved path is a directory */
- if (V_STAT(path_construction, &filestat) != 0) {
- if (errno != ENOENT) return NULL;
- } else {
- if (S_ISDIR(filestat.st_mode)) {
- /* It's a directory, append a / if needed */
- if (*(writepos-1) != '/') {
- /* Check for overflow */
- if ((strlen(workpos) + 2) >= MAXPATHLEN) {
- return NULL;
- }
- *writepos++ = '/';
- *writepos = 0;
- }
- }
- }
-
- strcpy(resolved_path, path_construction);
- return resolved_path;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_version.h b/main/php_version.h
index 70294a012d..9875958a62 100644
--- a/main/php_version.h
+++ b/main/php_version.h
@@ -3,5 +3,5 @@
#define PHP_MAJOR_VERSION 4
#define PHP_MINOR_VERSION 3
#define PHP_RELEASE_VERSION 0
-#define PHP_EXTRA_VERSION "-dev"
-#define PHP_VERSION "4.3.0-dev"
+#define PHP_EXTRA_VERSION "-pre1"
+#define PHP_VERSION "4.3.0-pre1"
diff --git a/strtok_r.c b/strtok_r.c
deleted file mode 100644
index fea43bdead..0000000000
--- a/strtok_r.c
+++ /dev/null
@@ -1,113 +0,0 @@
-#include "php.h"
-
-#ifndef HAVE_STRTOK_R
-
-/*
- * Copyright (c) 1998 Softweyr LLC. All rights reserved.
- *
- * strtok_r, from Berkeley strtok
- * Oct 13, 1998 by Wes Peters <wes@softweyr.com>
- *
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notices, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notices, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- *
- * This product includes software developed by Softweyr LLC, the
- * University of California, Berkeley, and its contributors.
- *
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWEYR LLC, THE
- * REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stddef.h>
-#include <string.h>
-
-char *
-strtok_r(char *s, const char *delim, char **last)
-{
- char *spanp;
- int c, sc;
- char *tok;
-
- if (s == NULL && (s = *last) == NULL)
- {
- return NULL;
- }
-
- /*
- * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
- */
-cont:
- c = *s++;
- for (spanp = (char *)delim; (sc = *spanp++) != 0; )
- {
- if (c == sc)
- {
- goto cont;
- }
- }
-
- if (c == 0) /* no non-delimiter characters */
- {
- *last = NULL;
- return NULL;
- }
- tok = s - 1;
-
- /*
- * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
- * Note that delim must have one NUL; we stop if we see that, too.
- */
- for (;;)
- {
- c = *s++;
- spanp = (char *)delim;
- do
- {
- if ((sc = *spanp++) == c)
- {
- if (c == 0)
- {
- s = NULL;
- }
- else
- {
- char *w = s - 1;
- *w = '\0';
- }
- *last = s;
- return tok;
- }
- }
- while (sc != 0);
- }
- /* NOTREACHED */
-}
-
-#endif
diff --git a/tests/lang/034.phpt b/tests/lang/034.phpt
index a59d0357cf..dbdcce1ccf 100644
--- a/tests/lang/034.phpt
+++ b/tests/lang/034.phpt
@@ -4,7 +4,7 @@ Locale settings affecting float parsing
<?php # try to activate a german locale
$status = false;
foreach(array("de_DE", "de", "german", "ge") as $lang) {
- if($lang == setlocale(LC_ALL, $lang)) {
+ if($lang == setlocale(LC_NUMERIC, $lang)) {
$status = true;
continue;
}
@@ -17,7 +17,7 @@ if(!$status) print "skip";
<?php
# try to activate a german locale
foreach(array("de_DE", "de", "german", "ge") as $lang) {
- if($lang == setlocale(LC_ALL, $lang)) {
+ if($lang == setlocale(LC_NUMERIC, $lang)) {
continue;
}
}
@@ -26,4 +26,4 @@ echo (float)"3.14", "\n";
?>
--EXPECT--
-3.14
+3,14