1999-04-08 02:10:10 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Zend Engine |
|
|
|
|
+----------------------------------------------------------------------+
|
2015-01-15 23:27:30 +08:00
|
|
|
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
1999-04-08 02:10:10 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2001-12-11 23:16:21 +08:00
|
|
|
| This source file is subject to version 2.00 of the Zend license, |
|
2015-01-03 17:22:58 +08:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
2003-06-11 04:04:29 +08:00
|
|
|
| available through the world-wide-web at the following url: |
|
2001-12-11 23:16:21 +08:00
|
|
|
| http://www.zend.com/license/2_00.txt. |
|
1999-07-16 22:58:16 +08:00
|
|
|
| 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. |
|
1999-04-08 02:10:10 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Authors: Andi Gutmans <andi@zend.com> |
|
|
|
|
| Zeev Suraski <zeev@zend.com> |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
2003-02-01 09:49:15 +08:00
|
|
|
/* $Id$ */
|
1999-07-16 22:58:16 +08:00
|
|
|
|
1999-04-08 02:10:10 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "zend.h"
|
|
|
|
#include "zend_alloc.h"
|
|
|
|
#include "zend_compile.h"
|
|
|
|
#include "zend_extensions.h"
|
|
|
|
#include "zend_API.h"
|
|
|
|
|
2004-09-24 05:43:32 +08:00
|
|
|
#include "zend_vm.h"
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
|
|
|
if (extension->op_array_ctor) {
|
2000-04-29 19:55:20 +08:00
|
|
|
extension->op_array_ctor(op_array);
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
|
|
|
if (extension->op_array_dtor) {
|
2000-04-29 19:55:20 +08:00
|
|
|
extension->op_array_dtor(op_array);
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-26 01:28:33 +08:00
|
|
|
static void op_array_alloc_ops(zend_op_array *op_array, uint32_t size)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2010-09-15 15:38:52 +08:00
|
|
|
op_array->opcodes = erealloc(op_array->opcodes, size * sizeof(zend_op));
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2000-04-29 09:30:17 +08:00
|
|
|
op_array->type = type;
|
2015-04-23 02:46:13 +08:00
|
|
|
op_array->arg_flags[0] = 0;
|
|
|
|
op_array->arg_flags[1] = 0;
|
|
|
|
op_array->arg_flags[2] = 0;
|
2001-07-15 22:08:58 +08:00
|
|
|
|
2014-08-26 01:28:33 +08:00
|
|
|
op_array->refcount = (uint32_t *) emalloc(sizeof(uint32_t));
|
1999-04-08 02:10:10 +08:00
|
|
|
*op_array->refcount = 1;
|
|
|
|
op_array->last = 0;
|
2014-12-02 21:47:26 +08:00
|
|
|
op_array->opcodes = NULL;
|
2010-09-15 15:38:52 +08:00
|
|
|
op_array_alloc_ops(op_array, initial_ops_size);
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2004-10-05 03:54:35 +08:00
|
|
|
op_array->last_var = 0;
|
|
|
|
op_array->vars = NULL;
|
|
|
|
|
1999-04-08 02:10:10 +08:00
|
|
|
op_array->T = 0;
|
|
|
|
|
|
|
|
op_array->function_name = NULL;
|
2014-12-14 06:06:14 +08:00
|
|
|
op_array->filename = zend_get_compiled_filename();
|
2004-02-20 14:59:37 +08:00
|
|
|
op_array->doc_comment = NULL;
|
1999-04-08 02:10:10 +08:00
|
|
|
|
ntroduce infrastructure for supplying information about arguments,
including:
- Whether or not to pass by ref (replaces the old arg_types, with arg_info)
- Argument name (for future use, maybe introspection)
- Class/Interface name (for type hints)
- If a class/interface name is available, whether to allow a null instance
Both user and builtin functions share the same data structures.
To declare a builtin function that expects its first arg to be an instance
of class 'Person', its second argument as a regular arg, and its third by
reference, use:
ZEND_BEGIN_ARG_INFO(my_func_arg_info, 0)
ZEND_ARG_OBJ_INFO(0, someone, Person, 1)
ZEND_ARG_PASS_INFO(0)
ZEND_ARG_PASS_INFO(1)
ZEND_END_ARG_INFO();
and use my_func_arg_info as the arg_info parameter to the ZEND_FE() family
of macros.
The first arg to each ZEND_ARG_*() macro is whether or not to pass by ref.
The boolean arg to ZEND_BEGIN_ARG_INFO() tells the engine whether to treat
the arguments for which there's no explicit information as pass by reference
or not.
The boolean argument to ZEND_ARG_OBJ_INFO() (4th arg) is whether or not to allownull values.
2003-08-04 01:40:44 +08:00
|
|
|
op_array->arg_info = NULL;
|
|
|
|
op_array->num_args = 0;
|
2004-02-25 17:25:37 +08:00
|
|
|
op_array->required_num_args = 0;
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2002-03-01 22:04:51 +08:00
|
|
|
op_array->scope = NULL;
|
2014-07-16 06:06:41 +08:00
|
|
|
op_array->prototype = NULL;
|
2002-03-01 22:04:51 +08:00
|
|
|
|
2015-07-10 08:31:52 +08:00
|
|
|
op_array->brk_cont_array = NULL;
|
2004-02-03 20:17:09 +08:00
|
|
|
op_array->try_catch_array = NULL;
|
2015-07-10 08:31:52 +08:00
|
|
|
op_array->last_brk_cont = 0;
|
1999-04-08 02:10:10 +08:00
|
|
|
|
|
|
|
op_array->static_variables = NULL;
|
2004-02-03 20:17:09 +08:00
|
|
|
op_array->last_try_catch = 0;
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2008-05-07 20:04:39 +08:00
|
|
|
op_array->this_var = -1;
|
2002-03-15 23:09:46 +08:00
|
|
|
|
2014-08-26 05:45:02 +08:00
|
|
|
op_array->fn_flags = 0;
|
2007-02-15 18:38:28 +08:00
|
|
|
|
2008-03-18 16:36:30 +08:00
|
|
|
op_array->early_binding = -1;
|
|
|
|
|
2010-04-20 18:57:45 +08:00
|
|
|
op_array->last_literal = 0;
|
|
|
|
op_array->literals = NULL;
|
|
|
|
|
2010-05-24 22:11:39 +08:00
|
|
|
op_array->run_time_cache = NULL;
|
2015-02-25 06:52:35 +08:00
|
|
|
op_array->cache_size = 0;
|
2010-05-24 22:11:39 +08:00
|
|
|
|
2007-11-19 05:29:55 +08:00
|
|
|
memset(op_array->reserved, 0, ZEND_MAX_RESERVED_RESOURCES * sizeof(void*));
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_ctor_handler, op_array);
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void destroy_zend_function(zend_function *function)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2014-09-23 16:35:42 +08:00
|
|
|
if (function->type == ZEND_USER_FUNCTION) {
|
2014-12-14 06:06:14 +08:00
|
|
|
destroy_op_array(&function->op_array);
|
2014-09-23 16:35:42 +08:00
|
|
|
} else {
|
|
|
|
ZEND_ASSERT(function->type == ZEND_INTERNAL_FUNCTION);
|
|
|
|
ZEND_ASSERT(function->common.function_name);
|
|
|
|
zend_string_release(function->common.function_name);
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-17 21:59:18 +08:00
|
|
|
ZEND_API void zend_function_dtor(zval *zv)
|
2004-06-06 16:37:12 +08:00
|
|
|
{
|
2014-02-17 21:59:18 +08:00
|
|
|
zend_function *function = Z_PTR_P(zv);
|
2004-06-06 16:37:12 +08:00
|
|
|
|
2014-09-23 16:35:42 +08:00
|
|
|
if (function->type == ZEND_USER_FUNCTION) {
|
|
|
|
ZEND_ASSERT(function->common.function_name);
|
2014-12-14 06:06:14 +08:00
|
|
|
destroy_op_array(&function->op_array);
|
2014-09-23 16:35:42 +08:00
|
|
|
/* op_arrays are allocated on arena, so we don't have to free them */
|
|
|
|
} else {
|
|
|
|
ZEND_ASSERT(function->type == ZEND_INTERNAL_FUNCTION);
|
|
|
|
ZEND_ASSERT(function->common.function_name);
|
|
|
|
zend_string_release(function->common.function_name);
|
|
|
|
if (!(function->common.fn_flags & ZEND_ACC_ARENA_ALLOCATED)) {
|
|
|
|
pefree(function, 1);
|
|
|
|
}
|
2014-06-18 06:47:01 +08:00
|
|
|
}
|
2004-06-06 16:37:12 +08:00
|
|
|
}
|
|
|
|
|
2014-04-21 17:55:25 +08:00
|
|
|
ZEND_API void zend_cleanup_op_array_data(zend_op_array *op_array)
|
2003-01-30 01:54:48 +08:00
|
|
|
{
|
2015-02-20 18:28:26 +08:00
|
|
|
if (op_array->static_variables &&
|
|
|
|
!(GC_FLAGS(op_array->static_variables) & IS_ARRAY_IMMUTABLE)) {
|
2003-01-30 01:54:48 +08:00
|
|
|
zend_hash_clean(op_array->static_variables);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_cleanup_user_class_data(zend_class_entry *ce)
|
2003-01-30 01:54:48 +08:00
|
|
|
{
|
2010-07-06 19:40:17 +08:00
|
|
|
/* Clean all parts that can contain run-time data */
|
|
|
|
/* Note that only run-time accessed data need to be cleaned up, pre-defined data can
|
|
|
|
not contain objects and thus are not probelmatic */
|
|
|
|
if (ce->ce_flags & ZEND_HAS_STATIC_IN_METHODS) {
|
2014-04-21 17:55:25 +08:00
|
|
|
zend_function *func;
|
|
|
|
|
|
|
|
ZEND_HASH_FOREACH_PTR(&ce->function_table, func) {
|
|
|
|
if (func->type == ZEND_USER_FUNCTION) {
|
|
|
|
zend_cleanup_op_array_data((zend_op_array *) func);
|
|
|
|
}
|
|
|
|
} ZEND_HASH_FOREACH_END();
|
2010-07-06 19:40:17 +08:00
|
|
|
}
|
|
|
|
if (ce->static_members_table) {
|
2015-01-13 08:32:51 +08:00
|
|
|
zval *static_members = ce->static_members_table;
|
2015-04-29 00:11:45 +08:00
|
|
|
zval *p = static_members;
|
|
|
|
zval *end = p + ce->default_static_members_count;
|
|
|
|
|
2010-07-06 19:40:17 +08:00
|
|
|
|
2015-01-23 22:10:05 +08:00
|
|
|
ce->default_static_members_count = 0;
|
|
|
|
ce->default_static_members_table = ce->static_members_table = NULL;
|
2015-04-29 00:11:45 +08:00
|
|
|
while (p != end) {
|
|
|
|
i_zval_ptr_dtor(p ZEND_FILE_LINE_CC);
|
|
|
|
p++;
|
2010-06-10 19:45:51 +08:00
|
|
|
}
|
2015-01-23 22:10:05 +08:00
|
|
|
efree(static_members);
|
2010-07-06 19:40:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce)
|
2010-07-06 19:40:17 +08:00
|
|
|
{
|
|
|
|
if (CE_STATIC_MEMBERS(ce)) {
|
2015-01-13 08:32:51 +08:00
|
|
|
zval *static_members = CE_STATIC_MEMBERS(ce);
|
2015-04-29 00:11:45 +08:00
|
|
|
zval *p = static_members;
|
|
|
|
zval *end = p + ce->default_static_members_count;
|
2015-01-03 17:22:58 +08:00
|
|
|
|
2005-12-01 19:48:17 +08:00
|
|
|
#ifdef ZTS
|
2010-07-06 23:52:39 +08:00
|
|
|
CG(static_members_table)[(zend_intptr_t)(ce->static_members_table)] = NULL;
|
2005-12-01 19:48:17 +08:00
|
|
|
#else
|
2010-07-06 19:40:17 +08:00
|
|
|
ce->static_members_table = NULL;
|
2005-12-01 19:48:17 +08:00
|
|
|
#endif
|
2015-06-11 12:53:56 +08:00
|
|
|
ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
|
2015-04-29 00:11:45 +08:00
|
|
|
while (p != end) {
|
|
|
|
i_zval_ptr_dtor(p ZEND_FILE_LINE_CC);
|
|
|
|
p++;
|
2015-01-13 08:32:51 +08:00
|
|
|
}
|
|
|
|
efree(static_members);
|
2003-01-30 01:54:48 +08:00
|
|
|
}
|
2010-07-06 19:40:17 +08:00
|
|
|
}
|
|
|
|
|
2010-05-03 00:32:25 +08:00
|
|
|
void _destroy_zend_class_traits_info(zend_class_entry *ce)
|
|
|
|
{
|
|
|
|
if (ce->num_traits > 0 && ce->traits) {
|
|
|
|
efree(ce->traits);
|
|
|
|
}
|
2015-01-03 17:22:58 +08:00
|
|
|
|
2010-05-03 00:32:25 +08:00
|
|
|
if (ce->trait_aliases) {
|
|
|
|
size_t i = 0;
|
|
|
|
while (ce->trait_aliases[i]) {
|
|
|
|
if (ce->trait_aliases[i]->trait_method) {
|
|
|
|
if (ce->trait_aliases[i]->trait_method->method_name) {
|
2014-08-26 01:24:55 +08:00
|
|
|
zend_string_release(ce->trait_aliases[i]->trait_method->method_name);
|
2010-05-03 00:32:25 +08:00
|
|
|
}
|
|
|
|
if (ce->trait_aliases[i]->trait_method->class_name) {
|
2014-08-26 01:24:55 +08:00
|
|
|
zend_string_release(ce->trait_aliases[i]->trait_method->class_name);
|
2010-05-03 00:32:25 +08:00
|
|
|
}
|
|
|
|
efree(ce->trait_aliases[i]->trait_method);
|
|
|
|
}
|
2015-01-03 17:22:58 +08:00
|
|
|
|
2010-05-03 00:32:25 +08:00
|
|
|
if (ce->trait_aliases[i]->alias) {
|
2014-08-26 01:24:55 +08:00
|
|
|
zend_string_release(ce->trait_aliases[i]->alias);
|
2010-05-03 00:32:25 +08:00
|
|
|
}
|
2015-01-03 17:22:58 +08:00
|
|
|
|
2010-05-03 00:32:25 +08:00
|
|
|
efree(ce->trait_aliases[i]);
|
|
|
|
i++;
|
|
|
|
}
|
2015-01-03 17:22:58 +08:00
|
|
|
|
2010-05-03 00:32:25 +08:00
|
|
|
efree(ce->trait_aliases);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ce->trait_precedences) {
|
|
|
|
size_t i = 0;
|
2015-01-03 17:22:58 +08:00
|
|
|
|
2010-05-03 00:32:25 +08:00
|
|
|
while (ce->trait_precedences[i]) {
|
2014-08-26 01:24:55 +08:00
|
|
|
zend_string_release(ce->trait_precedences[i]->trait_method->method_name);
|
|
|
|
zend_string_release(ce->trait_precedences[i]->trait_method->class_name);
|
2010-05-03 00:32:25 +08:00
|
|
|
efree(ce->trait_precedences[i]->trait_method);
|
|
|
|
|
|
|
|
if (ce->trait_precedences[i]->exclude_from_classes) {
|
2015-03-05 18:41:12 +08:00
|
|
|
size_t j = 0;
|
2015-03-05 18:16:39 +08:00
|
|
|
zend_trait_precedence *cur_precedence = ce->trait_precedences[i];
|
2015-03-05 18:41:12 +08:00
|
|
|
while (cur_precedence->exclude_from_classes[j].class_name) {
|
|
|
|
zend_string_release(cur_precedence->exclude_from_classes[j].class_name);
|
2015-03-05 18:16:39 +08:00
|
|
|
j++;
|
|
|
|
}
|
2010-05-03 00:32:25 +08:00
|
|
|
efree(ce->trait_precedences[i]->exclude_from_classes);
|
|
|
|
}
|
|
|
|
efree(ce->trait_precedences[i]);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
efree(ce->trait_precedences);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-17 21:59:18 +08:00
|
|
|
ZEND_API void destroy_zend_class(zval *zv)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2015-03-04 22:41:01 +08:00
|
|
|
zend_property_info *prop_info;
|
2014-02-17 21:59:18 +08:00
|
|
|
zend_class_entry *ce = Z_PTR_P(zv);
|
2015-01-03 17:22:58 +08:00
|
|
|
|
2002-03-13 03:22:29 +08:00
|
|
|
if (--ce->refcount > 0) {
|
2000-01-18 01:33:37 +08:00
|
|
|
return;
|
1999-04-18 23:11:52 +08:00
|
|
|
}
|
1999-04-08 02:10:10 +08:00
|
|
|
switch (ce->type) {
|
|
|
|
case ZEND_USER_CLASS:
|
2010-05-24 22:11:39 +08:00
|
|
|
if (ce->default_properties_table) {
|
2015-04-29 00:11:45 +08:00
|
|
|
zval *p = ce->default_properties_table;
|
|
|
|
zval *end = p + ce->default_properties_count;
|
2010-05-24 22:11:39 +08:00
|
|
|
|
2015-04-29 00:11:45 +08:00
|
|
|
while (p != end) {
|
|
|
|
i_zval_ptr_dtor(p ZEND_FILE_LINE_CC);
|
|
|
|
p++;
|
2010-05-24 22:11:39 +08:00
|
|
|
}
|
|
|
|
efree(ce->default_properties_table);
|
|
|
|
}
|
|
|
|
if (ce->default_static_members_table) {
|
2015-04-29 00:11:45 +08:00
|
|
|
zval *p = ce->default_static_members_table;
|
|
|
|
zval *end = p + ce->default_static_members_count;
|
2010-05-24 22:11:39 +08:00
|
|
|
|
2015-04-29 00:11:45 +08:00
|
|
|
while (p != end) {
|
|
|
|
i_zval_ptr_dtor(p ZEND_FILE_LINE_CC);
|
|
|
|
p++;
|
2010-05-24 22:11:39 +08:00
|
|
|
}
|
|
|
|
efree(ce->default_static_members_table);
|
|
|
|
}
|
2015-03-04 22:41:01 +08:00
|
|
|
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
|
|
|
|
if (prop_info->ce == ce || (prop_info->flags & ZEND_ACC_SHADOW)) {
|
|
|
|
zend_string_release(prop_info->name);
|
|
|
|
if (prop_info->doc_comment) {
|
|
|
|
zend_string_release(prop_info->doc_comment);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} ZEND_HASH_FOREACH_END();
|
2003-02-05 21:35:52 +08:00
|
|
|
zend_hash_destroy(&ce->properties_info);
|
2014-08-26 01:24:55 +08:00
|
|
|
zend_string_release(ce->name);
|
1999-04-08 02:10:10 +08:00
|
|
|
zend_hash_destroy(&ce->function_table);
|
2001-12-12 02:46:43 +08:00
|
|
|
zend_hash_destroy(&ce->constants_table);
|
2003-06-02 01:28:52 +08:00
|
|
|
if (ce->num_interfaces > 0 && ce->interfaces) {
|
2003-03-05 19:14:44 +08:00
|
|
|
efree(ce->interfaces);
|
|
|
|
}
|
2010-09-15 15:38:52 +08:00
|
|
|
if (ce->info.user.doc_comment) {
|
2014-08-26 01:24:55 +08:00
|
|
|
zend_string_release(ce->info.user.doc_comment);
|
2003-04-01 04:42:01 +08:00
|
|
|
}
|
2015-01-03 17:22:58 +08:00
|
|
|
|
2010-05-03 00:32:25 +08:00
|
|
|
_destroy_zend_class_traits_info(ce);
|
2015-01-03 17:22:58 +08:00
|
|
|
|
1999-04-08 02:10:10 +08:00
|
|
|
break;
|
|
|
|
case ZEND_INTERNAL_CLASS:
|
2010-05-24 22:11:39 +08:00
|
|
|
if (ce->default_properties_table) {
|
2015-04-29 00:11:45 +08:00
|
|
|
zval *p = ce->default_properties_table;
|
|
|
|
zval *end = p + ce->default_properties_count;
|
2010-05-24 22:11:39 +08:00
|
|
|
|
2015-04-29 00:11:45 +08:00
|
|
|
while (p != end) {
|
|
|
|
zval_internal_ptr_dtor(p);
|
|
|
|
p++;
|
2010-05-24 22:11:39 +08:00
|
|
|
}
|
|
|
|
free(ce->default_properties_table);
|
|
|
|
}
|
|
|
|
if (ce->default_static_members_table) {
|
2015-04-29 00:11:45 +08:00
|
|
|
zval *p = ce->default_static_members_table;
|
|
|
|
zval *end = p + ce->default_static_members_count;
|
2010-05-24 22:11:39 +08:00
|
|
|
|
2015-04-29 00:11:45 +08:00
|
|
|
while (p != end) {
|
|
|
|
zval_internal_ptr_dtor(p);
|
|
|
|
p++;
|
2010-05-24 22:11:39 +08:00
|
|
|
}
|
|
|
|
free(ce->default_static_members_table);
|
|
|
|
}
|
2003-02-05 21:35:52 +08:00
|
|
|
zend_hash_destroy(&ce->properties_info);
|
2014-08-26 01:24:55 +08:00
|
|
|
zend_string_release(ce->name);
|
1999-04-08 02:10:10 +08:00
|
|
|
zend_hash_destroy(&ce->function_table);
|
2001-12-12 02:46:43 +08:00
|
|
|
zend_hash_destroy(&ce->constants_table);
|
2003-04-19 02:40:53 +08:00
|
|
|
if (ce->num_interfaces > 0) {
|
|
|
|
free(ce->interfaces);
|
|
|
|
}
|
2002-03-12 18:08:47 +08:00
|
|
|
free(ce);
|
1999-04-08 02:10:10 +08:00
|
|
|
break;
|
2003-04-01 04:42:01 +08:00
|
|
|
}
|
2003-02-16 19:12:43 +08:00
|
|
|
}
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2014-02-17 21:59:18 +08:00
|
|
|
void zend_class_add_ref(zval *zv)
|
1999-04-26 22:10:42 +08:00
|
|
|
{
|
2014-02-17 21:59:18 +08:00
|
|
|
zend_class_entry *ce = Z_PTR_P(zv);
|
|
|
|
|
|
|
|
ce->refcount++;
|
1999-04-26 22:10:42 +08:00
|
|
|
}
|
|
|
|
|
2015-07-22 23:15:09 +08:00
|
|
|
ZEND_API zend_bool destroy_op_array(zend_op_array *op_array)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2014-04-17 19:40:45 +08:00
|
|
|
zval *literal = op_array->literals;
|
|
|
|
zval *end;
|
2014-08-26 01:28:33 +08:00
|
|
|
uint32_t i;
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2015-02-20 18:28:26 +08:00
|
|
|
if (op_array->static_variables &&
|
|
|
|
!(GC_FLAGS(op_array->static_variables) & IS_ARRAY_IMMUTABLE)) {
|
2015-07-24 23:17:09 +08:00
|
|
|
if (--GC_REFCOUNT(op_array->static_variables) == 0) {
|
2015-02-20 18:28:26 +08:00
|
|
|
zend_array_destroy(op_array->static_variables);
|
|
|
|
}
|
1999-12-24 03:23:36 +08:00
|
|
|
}
|
|
|
|
|
2014-06-18 06:47:01 +08:00
|
|
|
if (op_array->run_time_cache && !op_array->function_name) {
|
2010-05-24 22:11:39 +08:00
|
|
|
efree(op_array->run_time_cache);
|
2015-07-24 23:17:09 +08:00
|
|
|
op_array->run_time_cache = NULL;
|
2010-05-24 22:11:39 +08:00
|
|
|
}
|
|
|
|
|
2015-07-23 05:16:50 +08:00
|
|
|
if (!op_array->refcount) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (--(*op_array->refcount) > 0) {
|
2015-07-22 23:15:09 +08:00
|
|
|
return 0;
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
|
2014-08-28 00:49:56 +08:00
|
|
|
efree_size(op_array->refcount, sizeof(*(op_array->refcount)));
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2004-10-05 03:54:35 +08:00
|
|
|
if (op_array->vars) {
|
|
|
|
i = op_array->last_var;
|
|
|
|
while (i > 0) {
|
|
|
|
i--;
|
2014-08-26 01:24:55 +08:00
|
|
|
zend_string_release(op_array->vars[i]);
|
2004-10-05 03:54:35 +08:00
|
|
|
}
|
|
|
|
efree(op_array->vars);
|
|
|
|
}
|
|
|
|
|
2010-04-20 18:57:45 +08:00
|
|
|
if (literal) {
|
|
|
|
end = literal + op_array->last_literal;
|
|
|
|
while (literal < end) {
|
2014-09-03 21:16:32 +08:00
|
|
|
zval_ptr_dtor_nogc(literal);
|
2010-04-20 18:57:45 +08:00
|
|
|
literal++;
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
2010-04-20 18:57:45 +08:00
|
|
|
efree(op_array->literals);
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
efree(op_array->opcodes);
|
2004-07-29 23:23:47 +08:00
|
|
|
|
2012-12-25 14:23:08 +08:00
|
|
|
if (op_array->function_name) {
|
2014-08-26 01:24:55 +08:00
|
|
|
zend_string_release(op_array->function_name);
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
2004-02-20 14:59:37 +08:00
|
|
|
if (op_array->doc_comment) {
|
2014-08-26 01:24:55 +08:00
|
|
|
zend_string_release(op_array->doc_comment);
|
2004-02-20 14:59:37 +08:00
|
|
|
}
|
2015-07-10 08:31:52 +08:00
|
|
|
if (op_array->brk_cont_array) {
|
|
|
|
efree(op_array->brk_cont_array);
|
|
|
|
}
|
2004-02-03 20:17:09 +08:00
|
|
|
if (op_array->try_catch_array) {
|
|
|
|
efree(op_array->try_catch_array);
|
|
|
|
}
|
2010-09-15 15:38:52 +08:00
|
|
|
if (op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) {
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_dtor_handler, op_array);
|
2000-04-29 10:56:44 +08:00
|
|
|
}
|
ntroduce infrastructure for supplying information about arguments,
including:
- Whether or not to pass by ref (replaces the old arg_types, with arg_info)
- Argument name (for future use, maybe introspection)
- Class/Interface name (for type hints)
- If a class/interface name is available, whether to allow a null instance
Both user and builtin functions share the same data structures.
To declare a builtin function that expects its first arg to be an instance
of class 'Person', its second argument as a regular arg, and its third by
reference, use:
ZEND_BEGIN_ARG_INFO(my_func_arg_info, 0)
ZEND_ARG_OBJ_INFO(0, someone, Person, 1)
ZEND_ARG_PASS_INFO(0)
ZEND_ARG_PASS_INFO(1)
ZEND_END_ARG_INFO();
and use my_func_arg_info as the arg_info parameter to the ZEND_FE() family
of macros.
The first arg to each ZEND_ARG_*() macro is whether or not to pass by ref.
The boolean arg to ZEND_BEGIN_ARG_INFO() tells the engine whether to treat
the arguments for which there's no explicit information as pass by reference
or not.
The boolean argument to ZEND_ARG_OBJ_INFO() (4th arg) is whether or not to allownull values.
2003-08-04 01:40:44 +08:00
|
|
|
if (op_array->arg_info) {
|
2015-01-09 04:40:36 +08:00
|
|
|
int32_t num_args = op_array->num_args;
|
2015-01-28 11:56:19 +08:00
|
|
|
zend_arg_info *arg_info = op_array->arg_info;
|
|
|
|
int32_t i;
|
2014-12-22 21:44:39 +08:00
|
|
|
|
2015-01-28 11:56:19 +08:00
|
|
|
if (op_array->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
|
|
|
|
arg_info--;
|
|
|
|
num_args++;
|
|
|
|
}
|
2014-12-22 21:44:39 +08:00
|
|
|
if (op_array->fn_flags & ZEND_ACC_VARIADIC) {
|
|
|
|
num_args++;
|
|
|
|
}
|
2015-01-28 11:56:19 +08:00
|
|
|
for (i = 0 ; i < num_args; i++) {
|
|
|
|
if (arg_info[i].name) {
|
|
|
|
zend_string_release(arg_info[i].name);
|
|
|
|
}
|
|
|
|
if (arg_info[i].class_name) {
|
|
|
|
zend_string_release(arg_info[i].class_name);
|
2003-08-04 06:28:14 +08:00
|
|
|
}
|
ntroduce infrastructure for supplying information about arguments,
including:
- Whether or not to pass by ref (replaces the old arg_types, with arg_info)
- Argument name (for future use, maybe introspection)
- Class/Interface name (for type hints)
- If a class/interface name is available, whether to allow a null instance
Both user and builtin functions share the same data structures.
To declare a builtin function that expects its first arg to be an instance
of class 'Person', its second argument as a regular arg, and its third by
reference, use:
ZEND_BEGIN_ARG_INFO(my_func_arg_info, 0)
ZEND_ARG_OBJ_INFO(0, someone, Person, 1)
ZEND_ARG_PASS_INFO(0)
ZEND_ARG_PASS_INFO(1)
ZEND_END_ARG_INFO();
and use my_func_arg_info as the arg_info parameter to the ZEND_FE() family
of macros.
The first arg to each ZEND_ARG_*() macro is whether or not to pass by ref.
The boolean arg to ZEND_BEGIN_ARG_INFO() tells the engine whether to treat
the arguments for which there's no explicit information as pass by reference
or not.
The boolean argument to ZEND_ARG_OBJ_INFO() (4th arg) is whether or not to allownull values.
2003-08-04 01:40:44 +08:00
|
|
|
}
|
2015-01-28 11:56:19 +08:00
|
|
|
efree(arg_info);
|
ntroduce infrastructure for supplying information about arguments,
including:
- Whether or not to pass by ref (replaces the old arg_types, with arg_info)
- Argument name (for future use, maybe introspection)
- Class/Interface name (for type hints)
- If a class/interface name is available, whether to allow a null instance
Both user and builtin functions share the same data structures.
To declare a builtin function that expects its first arg to be an instance
of class 'Person', its second argument as a regular arg, and its third by
reference, use:
ZEND_BEGIN_ARG_INFO(my_func_arg_info, 0)
ZEND_ARG_OBJ_INFO(0, someone, Person, 1)
ZEND_ARG_PASS_INFO(0)
ZEND_ARG_PASS_INFO(1)
ZEND_END_ARG_INFO();
and use my_func_arg_info as the arg_info parameter to the ZEND_FE() family
of macros.
The first arg to each ZEND_ARG_*() macro is whether or not to pass by ref.
The boolean arg to ZEND_BEGIN_ARG_INFO() tells the engine whether to treat
the arguments for which there's no explicit information as pass by reference
or not.
The boolean argument to ZEND_ARG_OBJ_INFO() (4th arg) is whether or not to allownull values.
2003-08-04 01:40:44 +08:00
|
|
|
}
|
2015-07-22 23:15:09 +08:00
|
|
|
|
|
|
|
return 1;
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
void init_op(zend_op *op)
|
1999-09-20 23:44:30 +08:00
|
|
|
{
|
2004-02-04 23:51:07 +08:00
|
|
|
memset(op, 0, sizeof(zend_op));
|
1999-09-20 23:44:30 +08:00
|
|
|
op->lineno = CG(zend_lineno);
|
2000-11-12 01:41:28 +08:00
|
|
|
SET_UNUSED(op->result);
|
1999-09-20 23:44:30 +08:00
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_op *get_next_op(zend_op_array *op_array)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2014-08-26 01:28:33 +08:00
|
|
|
uint32_t next_op_num = op_array->last++;
|
1999-04-08 02:10:10 +08:00
|
|
|
zend_op *next_op;
|
|
|
|
|
2010-09-15 15:38:52 +08:00
|
|
|
if (next_op_num >= CG(context).opcodes_size) {
|
|
|
|
CG(context).opcodes_size *= 4;
|
|
|
|
op_array_alloc_ops(op_array, CG(context).opcodes_size);
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
2015-01-03 17:22:58 +08:00
|
|
|
|
1999-04-08 02:10:10 +08:00
|
|
|
next_op = &(op_array->opcodes[next_op_num]);
|
2015-01-03 17:22:58 +08:00
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
init_op(next_op);
|
1999-04-08 02:10:10 +08:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2015-07-10 08:31:52 +08:00
|
|
|
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];
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
static void zend_update_extended_info(zend_op_array *op_array)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
2000-12-30 23:32:12 +08:00
|
|
|
if (opline+1<end) {
|
|
|
|
opline->lineno = (opline+1)->lineno;
|
|
|
|
}
|
1999-04-08 02:10:10 +08:00
|
|
|
} else {
|
|
|
|
opline->opcode = ZEND_NOP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
opline++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
|
|
|
if (extension->op_array_handler) {
|
|
|
|
extension->op_array_handler(op_array);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
static void zend_check_finally_breakout(zend_op_array *op_array, uint32_t op_num, uint32_t dst_num)
|
2012-11-22 19:17:05 +08:00
|
|
|
{
|
2014-09-15 22:52:19 +08:00
|
|
|
int i;
|
2012-11-22 19:17:05 +08:00
|
|
|
|
|
|
|
for (i = 0; i < op_array->last_try_catch; i++) {
|
2013-12-13 00:15:50 +08:00
|
|
|
if ((op_num < op_array->try_catch_array[i].finally_op ||
|
|
|
|
op_num >= op_array->try_catch_array[i].finally_end)
|
|
|
|
&& (dst_num >= op_array->try_catch_array[i].finally_op &&
|
|
|
|
dst_num <= op_array->try_catch_array[i].finally_end)) {
|
|
|
|
CG(in_compilation) = 1;
|
|
|
|
CG(active_op_array) = op_array;
|
|
|
|
CG(zend_lineno) = op_array->opcodes[op_num].lineno;
|
2013-12-13 10:56:35 +08:00
|
|
|
zend_error_noreturn(E_COMPILE_ERROR, "jump into a finally block is disallowed");
|
2015-01-03 17:22:58 +08:00
|
|
|
} else if ((op_num >= op_array->try_catch_array[i].finally_op
|
2012-11-22 19:17:05 +08:00
|
|
|
&& op_num <= op_array->try_catch_array[i].finally_end)
|
2015-01-03 17:22:58 +08:00
|
|
|
&& (dst_num > op_array->try_catch_array[i].finally_end
|
2012-08-18 11:44:09 +08:00
|
|
|
|| dst_num < op_array->try_catch_array[i].finally_op)) {
|
|
|
|
CG(in_compilation) = 1;
|
|
|
|
CG(active_op_array) = op_array;
|
2012-11-22 19:17:05 +08:00
|
|
|
CG(zend_lineno) = op_array->opcodes[op_num].lineno;
|
2013-10-20 05:22:20 +08:00
|
|
|
zend_error_noreturn(E_COMPILE_ERROR, "jump out of a finally block is disallowed");
|
2012-08-18 11:44:09 +08:00
|
|
|
}
|
2015-01-03 17:22:58 +08:00
|
|
|
}
|
2012-08-18 11:44:09 +08:00
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
static void zend_adjust_fast_call(zend_op_array *op_array, uint32_t fast_call, uint32_t start, uint32_t end)
|
2014-07-19 17:19:01 +08:00
|
|
|
{
|
|
|
|
int i;
|
2014-08-26 01:28:33 +08:00
|
|
|
uint32_t op_num = 0;
|
2014-07-19 17:19:01 +08:00
|
|
|
|
|
|
|
for (i = 0; i < op_array->last_try_catch; i++) {
|
2015-01-03 17:22:58 +08:00
|
|
|
if (op_array->try_catch_array[i].finally_op > start
|
2014-07-19 17:19:01 +08:00
|
|
|
&& op_array->try_catch_array[i].finally_end < end) {
|
|
|
|
op_num = op_array->try_catch_array[i].finally_op;
|
|
|
|
start = op_array->try_catch_array[i].finally_end;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (op_num) {
|
|
|
|
/* Must be ZEND_FAST_CALL */
|
|
|
|
ZEND_ASSERT(op_array->opcodes[op_num - 2].opcode == ZEND_FAST_CALL);
|
|
|
|
op_array->opcodes[op_num - 2].extended_value = ZEND_FAST_CALL_FROM_FINALLY;
|
|
|
|
op_array->opcodes[op_num - 2].op2.opline_num = fast_call;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
static void zend_resolve_fast_call(zend_op_array *op_array, uint32_t fast_call, uint32_t op_num)
|
2014-07-19 17:19:01 +08:00
|
|
|
{
|
|
|
|
int i;
|
2014-08-26 01:28:33 +08:00
|
|
|
uint32_t finally_op_num = 0;
|
2014-07-19 17:19:01 +08:00
|
|
|
|
|
|
|
for (i = 0; i < op_array->last_try_catch; i++) {
|
|
|
|
if (op_num >= op_array->try_catch_array[i].finally_op
|
|
|
|
&& op_num < op_array->try_catch_array[i].finally_end) {
|
|
|
|
finally_op_num = op_array->try_catch_array[i].finally_op;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (finally_op_num) {
|
|
|
|
/* Must be ZEND_FAST_CALL */
|
|
|
|
ZEND_ASSERT(op_array->opcodes[finally_op_num - 2].opcode == ZEND_FAST_CALL);
|
|
|
|
if (op_array->opcodes[fast_call].extended_value == 0) {
|
|
|
|
op_array->opcodes[fast_call].extended_value = ZEND_FAST_CALL_FROM_FINALLY;
|
|
|
|
op_array->opcodes[fast_call].op2.opline_num = finally_op_num - 2;
|
|
|
|
}
|
2015-01-03 17:22:58 +08:00
|
|
|
}
|
2014-07-19 17:19:01 +08:00
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num, uint32_t dst_num)
|
2012-11-22 19:17:05 +08:00
|
|
|
{
|
2014-08-26 01:28:33 +08:00
|
|
|
uint32_t start_op;
|
2012-11-22 19:17:05 +08:00
|
|
|
zend_op *opline;
|
2014-08-26 01:28:33 +08:00
|
|
|
uint32_t i = op_array->last_try_catch;
|
2012-11-22 19:17:05 +08:00
|
|
|
|
2014-08-26 01:28:33 +08:00
|
|
|
if (dst_num != (uint32_t)-1) {
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_check_finally_breakout(op_array, op_num, dst_num);
|
2012-11-22 19:17:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* the backward order is mater */
|
|
|
|
while (i > 0) {
|
|
|
|
i--;
|
|
|
|
if (op_array->try_catch_array[i].finally_op &&
|
|
|
|
op_num >= op_array->try_catch_array[i].try_op &&
|
|
|
|
op_num < op_array->try_catch_array[i].finally_op - 1 &&
|
|
|
|
(dst_num < op_array->try_catch_array[i].try_op ||
|
|
|
|
dst_num > op_array->try_catch_array[i].finally_end)) {
|
|
|
|
/* we have a jump out of try block that needs executing finally */
|
2014-11-27 14:56:43 +08:00
|
|
|
uint32_t fast_call_var;
|
2015-01-03 17:22:58 +08:00
|
|
|
|
2014-11-27 14:56:43 +08:00
|
|
|
/* Must be ZEND_FAST_RET */
|
|
|
|
ZEND_ASSERT(op_array->opcodes[op_array->try_catch_array[i].finally_end].opcode == ZEND_FAST_RET);
|
|
|
|
fast_call_var = op_array->opcodes[op_array->try_catch_array[i].finally_end].op1.var;
|
2012-11-22 19:17:05 +08:00
|
|
|
|
2012-12-12 21:47:55 +08:00
|
|
|
/* generate a FAST_CALL to finally block */
|
2015-07-25 02:30:32 +08:00
|
|
|
start_op = get_next_op_number(op_array);
|
2012-11-30 17:39:23 +08:00
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
opline = get_next_op(op_array);
|
2012-11-22 19:17:05 +08:00
|
|
|
opline->opcode = ZEND_FAST_CALL;
|
2014-11-27 14:56:43 +08:00
|
|
|
opline->result_type = IS_TMP_VAR;
|
|
|
|
opline->result.var = fast_call_var;
|
2012-11-22 19:17:05 +08:00
|
|
|
SET_UNUSED(opline->op1);
|
|
|
|
SET_UNUSED(opline->op2);
|
2014-07-19 17:19:01 +08:00
|
|
|
zend_adjust_fast_call(op_array, start_op,
|
|
|
|
op_array->try_catch_array[i].finally_op,
|
2014-12-14 06:06:14 +08:00
|
|
|
op_array->try_catch_array[i].finally_end);
|
2015-07-22 00:06:19 +08:00
|
|
|
zend_resolve_fast_call(op_array, start_op, op_array->try_catch_array[i].finally_op - 2);
|
2014-07-19 17:19:01 +08:00
|
|
|
opline->op1.opline_num = op_array->try_catch_array[i].finally_op;
|
2012-11-22 19:17:05 +08:00
|
|
|
|
2012-12-12 21:47:55 +08:00
|
|
|
/* generate a sequence of FAST_CALL to upward finally block */
|
2012-11-22 19:17:05 +08:00
|
|
|
while (i > 0) {
|
|
|
|
i--;
|
|
|
|
if (op_array->try_catch_array[i].finally_op &&
|
2013-12-13 00:15:50 +08:00
|
|
|
op_num >= op_array->try_catch_array[i].try_op &&
|
|
|
|
op_num < op_array->try_catch_array[i].finally_op - 1 &&
|
|
|
|
(dst_num < op_array->try_catch_array[i].try_op ||
|
|
|
|
dst_num > op_array->try_catch_array[i].finally_end)) {
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
opline = get_next_op(op_array);
|
2012-11-22 19:17:05 +08:00
|
|
|
opline->opcode = ZEND_FAST_CALL;
|
2014-11-27 14:56:43 +08:00
|
|
|
opline->result_type = IS_TMP_VAR;
|
|
|
|
opline->result.var = fast_call_var;
|
2012-11-22 19:17:05 +08:00
|
|
|
SET_UNUSED(opline->op1);
|
|
|
|
SET_UNUSED(opline->op2);
|
|
|
|
opline->op1.opline_num = op_array->try_catch_array[i].finally_op;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Finish the sequence with original opcode */
|
2014-12-14 06:06:14 +08:00
|
|
|
opline = get_next_op(op_array);
|
2012-11-22 19:17:05 +08:00
|
|
|
*opline = op_array->opcodes[op_num];
|
|
|
|
|
|
|
|
/* Replace original opcode with jump to this sequence */
|
|
|
|
opline = op_array->opcodes + op_num;
|
|
|
|
opline->opcode = ZEND_JMP;
|
|
|
|
SET_UNUSED(opline->op1);
|
|
|
|
SET_UNUSED(opline->op2);
|
|
|
|
opline->op1.opline_num = start_op;
|
|
|
|
|
2013-12-13 00:15:50 +08:00
|
|
|
break;
|
2012-11-22 19:17:05 +08:00
|
|
|
}
|
2015-01-03 17:22:58 +08:00
|
|
|
}
|
2012-11-22 19:17:05 +08:00
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
static void zend_resolve_finally_ret(zend_op_array *op_array, uint32_t op_num)
|
2012-11-22 19:17:05 +08:00
|
|
|
{
|
|
|
|
int i;
|
2014-08-26 01:28:33 +08:00
|
|
|
uint32_t catch_op_num = 0, finally_op_num = 0;
|
2012-11-22 19:17:05 +08:00
|
|
|
|
|
|
|
for (i = 0; i < op_array->last_try_catch; i++) {
|
|
|
|
if (op_array->try_catch_array[i].try_op > op_num) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (op_num < op_array->try_catch_array[i].finally_op) {
|
|
|
|
finally_op_num = op_array->try_catch_array[i].finally_op;
|
|
|
|
}
|
|
|
|
if (op_num < op_array->try_catch_array[i].catch_op) {
|
|
|
|
catch_op_num = op_array->try_catch_array[i].catch_op;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (finally_op_num && (!catch_op_num || catch_op_num >= finally_op_num)) {
|
|
|
|
/* in case of unhandled exception return to upward finally block */
|
|
|
|
op_array->opcodes[op_num].extended_value = ZEND_FAST_RET_TO_FINALLY;
|
|
|
|
op_array->opcodes[op_num].op2.opline_num = finally_op_num;
|
|
|
|
} else if (catch_op_num) {
|
|
|
|
/* in case of unhandled exception return to upward catch block */
|
|
|
|
op_array->opcodes[op_num].extended_value = ZEND_FAST_RET_TO_CATCH;
|
|
|
|
op_array->opcodes[op_num].op2.opline_num = catch_op_num;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-23 04:17:40 +08:00
|
|
|
static uint32_t zend_get_brk_cont_target(const zend_op_array *op_array, const zend_op *opline) {
|
|
|
|
int nest_levels = opline->op2.num;
|
|
|
|
int array_offset = opline->op1.num;
|
|
|
|
zend_brk_cont_element *jmp_to;
|
|
|
|
do {
|
2015-07-10 08:31:52 +08:00
|
|
|
jmp_to = &op_array->brk_cont_array[array_offset];
|
2015-05-23 04:17:40 +08:00
|
|
|
if (nest_levels > 1) {
|
|
|
|
array_offset = jmp_to->parent;
|
|
|
|
}
|
|
|
|
} while (--nest_levels > 0);
|
|
|
|
|
|
|
|
return opline->opcode == ZEND_BRK ? jmp_to->brk : jmp_to->cont;
|
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
static void zend_resolve_finally_calls(zend_op_array *op_array)
|
2012-11-22 19:17:05 +08:00
|
|
|
{
|
2014-08-26 01:28:33 +08:00
|
|
|
uint32_t i, j;
|
2012-11-22 19:17:05 +08:00
|
|
|
zend_op *opline;
|
|
|
|
|
2014-07-19 12:53:34 +08:00
|
|
|
for (i = 0, j = op_array->last; i < j; i++) {
|
2012-11-22 19:17:05 +08:00
|
|
|
opline = op_array->opcodes + i;
|
|
|
|
switch (opline->opcode) {
|
|
|
|
case ZEND_RETURN:
|
|
|
|
case ZEND_RETURN_BY_REF:
|
2012-12-12 21:47:55 +08:00
|
|
|
case ZEND_GENERATOR_RETURN:
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_resolve_finally_call(op_array, i, (uint32_t)-1);
|
2012-11-22 19:17:05 +08:00
|
|
|
break;
|
|
|
|
case ZEND_BRK:
|
|
|
|
case ZEND_CONT:
|
2015-05-23 04:17:40 +08:00
|
|
|
zend_resolve_finally_call(op_array, i, zend_get_brk_cont_target(op_array, opline));
|
|
|
|
break;
|
2012-11-22 19:17:05 +08:00
|
|
|
case ZEND_GOTO:
|
2014-12-12 15:19:41 +08:00
|
|
|
if (Z_TYPE_P(CT_CONSTANT_EX(op_array, opline->op2.constant)) != IS_LONG) {
|
2015-07-10 09:44:21 +08:00
|
|
|
zend_resolve_goto_label(op_array, NULL, opline);
|
2012-11-22 19:17:05 +08:00
|
|
|
}
|
|
|
|
/* break omitted intentionally */
|
|
|
|
case ZEND_JMP:
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_resolve_finally_call(op_array, i, opline->op1.opline_num);
|
2012-11-22 19:17:05 +08:00
|
|
|
break;
|
2014-07-18 15:45:31 +08:00
|
|
|
case ZEND_FAST_CALL:
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_resolve_fast_call(op_array, i, i);
|
2014-07-18 15:45:31 +08:00
|
|
|
break;
|
2012-11-22 19:17:05 +08:00
|
|
|
case ZEND_FAST_RET:
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_resolve_finally_ret(op_array, i);
|
2012-11-22 19:17:05 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API int pass_two(zend_op_array *op_array)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2001-05-11 22:29:06 +08:00
|
|
|
zend_op *opline, *end;
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2014-06-30 19:43:45 +08:00
|
|
|
if (!ZEND_USER_CODE(op_array->type)) {
|
1999-04-08 02:10:10 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2014-08-28 02:45:27 +08:00
|
|
|
if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_resolve_finally_calls(op_array);
|
2012-11-22 19:17:05 +08:00
|
|
|
}
|
2008-03-18 16:36:30 +08:00
|
|
|
if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO) {
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_update_extended_info(op_array);
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
2008-03-18 16:36:30 +08:00
|
|
|
if (CG(compiler_options) & ZEND_COMPILE_HANDLE_OP_ARRAY) {
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array);
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
2001-05-11 22:29:06 +08:00
|
|
|
|
2014-08-26 05:45:02 +08:00
|
|
|
if (CG(context).vars_size != op_array->last_var) {
|
2014-02-10 14:04:30 +08:00
|
|
|
op_array->vars = (zend_string**) erealloc(op_array->vars, sizeof(zend_string*)*op_array->last_var);
|
2010-09-15 15:38:52 +08:00
|
|
|
CG(context).vars_size = op_array->last_var;
|
|
|
|
}
|
2014-08-26 05:45:02 +08:00
|
|
|
if (CG(context).opcodes_size != op_array->last) {
|
2006-04-10 20:26:53 +08:00
|
|
|
op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last);
|
2010-09-15 15:38:52 +08:00
|
|
|
CG(context).opcodes_size = op_array->last;
|
2006-04-10 20:26:53 +08:00
|
|
|
}
|
2014-08-26 05:45:02 +08:00
|
|
|
if (CG(context).literals_size != op_array->last_literal) {
|
2014-04-17 19:40:45 +08:00
|
|
|
op_array->literals = (zval*)erealloc(op_array->literals, sizeof(zval) * op_array->last_literal);
|
2010-09-15 15:38:52 +08:00
|
|
|
CG(context).literals_size = op_array->last_literal;
|
2010-04-20 18:57:45 +08:00
|
|
|
}
|
2001-05-11 22:29:06 +08:00
|
|
|
opline = op_array->opcodes;
|
|
|
|
end = opline + op_array->last;
|
|
|
|
while (opline < end) {
|
2002-10-25 02:24:55 +08:00
|
|
|
switch (opline->opcode) {
|
2015-04-27 17:24:39 +08:00
|
|
|
case ZEND_DECLARE_ANON_INHERITED_CLASS:
|
|
|
|
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1);
|
|
|
|
/* break omitted intentionally */
|
2014-02-19 05:12:05 +08:00
|
|
|
case ZEND_DECLARE_INHERITED_CLASS:
|
|
|
|
case ZEND_DECLARE_INHERITED_CLASS_DELAYED:
|
2014-11-28 16:11:33 +08:00
|
|
|
opline->extended_value = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->extended_value);
|
2014-02-19 05:12:05 +08:00
|
|
|
break;
|
2015-05-23 04:17:40 +08:00
|
|
|
case ZEND_BRK:
|
|
|
|
case ZEND_CONT:
|
|
|
|
{
|
|
|
|
uint32_t jmp_target = zend_get_brk_cont_target(op_array, opline);
|
|
|
|
opline->opcode = ZEND_JMP;
|
|
|
|
opline->op1.opline_num = jmp_target;
|
|
|
|
opline->op2.num = 0;
|
|
|
|
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1);
|
|
|
|
}
|
|
|
|
break;
|
2008-03-28 22:35:01 +08:00
|
|
|
case ZEND_GOTO:
|
2015-07-25 04:03:05 +08:00
|
|
|
if (Z_TYPE_P(CT_CONSTANT_EX(op_array, opline->op2.constant)) != IS_LONG) {
|
2015-07-10 09:44:21 +08:00
|
|
|
zend_resolve_goto_label(op_array, NULL, opline);
|
2008-03-28 22:35:01 +08:00
|
|
|
}
|
|
|
|
/* break omitted intentionally */
|
2002-10-25 02:24:55 +08:00
|
|
|
case ZEND_JMP:
|
2012-11-22 19:17:05 +08:00
|
|
|
case ZEND_FAST_CALL:
|
2015-04-27 17:24:39 +08:00
|
|
|
case ZEND_DECLARE_ANON_CLASS:
|
2014-12-12 15:19:41 +08:00
|
|
|
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1);
|
2002-10-25 02:24:55 +08:00
|
|
|
break;
|
2014-04-30 15:23:19 +08:00
|
|
|
case ZEND_JMPZNZ:
|
|
|
|
/* absolute index to relative offset */
|
2014-12-12 15:19:41 +08:00
|
|
|
opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, opline->extended_value);
|
2014-04-30 15:23:19 +08:00
|
|
|
/* break omitted intentionally */
|
2002-10-25 02:24:55 +08:00
|
|
|
case ZEND_JMPZ:
|
|
|
|
case ZEND_JMPNZ:
|
|
|
|
case ZEND_JMPZ_EX:
|
|
|
|
case ZEND_JMPNZ_EX:
|
2007-11-21 17:41:35 +08:00
|
|
|
case ZEND_JMP_SET:
|
2014-09-17 02:14:46 +08:00
|
|
|
case ZEND_COALESCE:
|
2014-06-11 15:39:42 +08:00
|
|
|
case ZEND_NEW:
|
2015-02-12 18:57:12 +08:00
|
|
|
case ZEND_FE_RESET_R:
|
|
|
|
case ZEND_FE_RESET_RW:
|
2015-03-02 17:25:40 +08:00
|
|
|
case ZEND_ASSERT_CHECK:
|
2014-12-12 15:19:41 +08:00
|
|
|
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op2);
|
2002-10-25 02:24:55 +08:00
|
|
|
break;
|
2015-05-13 17:55:42 +08:00
|
|
|
case ZEND_FE_FETCH_R:
|
|
|
|
case ZEND_FE_FETCH_RW:
|
|
|
|
opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, opline->extended_value);
|
|
|
|
break;
|
2015-01-09 04:40:36 +08:00
|
|
|
case ZEND_VERIFY_RETURN_TYPE:
|
|
|
|
if (op_array->fn_flags & ZEND_ACC_GENERATOR) {
|
2015-07-25 02:30:32 +08:00
|
|
|
if (opline->op1_type != IS_UNUSED) {
|
|
|
|
(opline + 1)->op1 = opline->op1;
|
|
|
|
(opline + 1)->op1_type = opline->op1_type;
|
|
|
|
}
|
2015-01-09 04:40:36 +08:00
|
|
|
MAKE_NOP(opline);
|
|
|
|
}
|
|
|
|
break;
|
2012-07-23 02:11:09 +08:00
|
|
|
case ZEND_RETURN:
|
|
|
|
case ZEND_RETURN_BY_REF:
|
|
|
|
if (op_array->fn_flags & ZEND_ACC_GENERATOR) {
|
2012-08-24 19:51:39 +08:00
|
|
|
opline->opcode = ZEND_GENERATOR_RETURN;
|
2012-07-23 02:11:09 +08:00
|
|
|
}
|
|
|
|
break;
|
2002-10-25 02:04:12 +08:00
|
|
|
}
|
2015-07-25 04:03:05 +08:00
|
|
|
if (opline->op1_type == IS_CONST) {
|
|
|
|
ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline->op1);
|
|
|
|
} else if (opline->op1_type & (IS_VAR|IS_TMP_VAR)) {
|
|
|
|
opline->op1.var = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->op1.var);
|
|
|
|
}
|
|
|
|
if (opline->op2_type == IS_CONST) {
|
|
|
|
ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline->op2);
|
|
|
|
} else if (opline->op2_type & (IS_VAR|IS_TMP_VAR)) {
|
|
|
|
opline->op2.var = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->op2.var);
|
|
|
|
}
|
|
|
|
if (opline->result_type & (IS_VAR|IS_TMP_VAR)) {
|
|
|
|
opline->result.var = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->result.var);
|
|
|
|
}
|
2004-09-24 05:43:32 +08:00
|
|
|
ZEND_VM_SET_OPCODE_HANDLER(opline);
|
1999-04-08 02:10:10 +08:00
|
|
|
opline++;
|
|
|
|
}
|
2010-04-20 18:57:45 +08:00
|
|
|
|
2010-09-15 15:38:52 +08:00
|
|
|
op_array->fn_flags |= ZEND_ACC_DONE_PASS_TWO;
|
2000-08-10 03:22:35 +08:00
|
|
|
return 0;
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
int pass_two_wrapper(zval *el)
|
2014-05-25 18:32:35 +08:00
|
|
|
{
|
2014-12-14 06:06:14 +08:00
|
|
|
return pass_two((zend_op_array *) Z_PTR_P(el));
|
2014-05-25 18:32:35 +08:00
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
int print_class(zend_class_entry *class_entry)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2015-06-30 18:59:27 +08:00
|
|
|
printf("Class %s:\n", ZSTR_VAL(class_entry->name));
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_hash_apply(&class_entry->function_table, pass_two_wrapper);
|
2015-06-30 18:59:27 +08:00
|
|
|
printf("End of class %s.\n\n", ZSTR_VAL(class_entry->name));
|
1999-04-08 02:10:10 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1999-05-30 21:28:56 +08:00
|
|
|
ZEND_API unary_op_type get_unary_op(int opcode)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2002-11-30 19:20:25 +08:00
|
|
|
switch (opcode) {
|
1999-04-08 02:10:10 +08:00
|
|
|
case ZEND_BW_NOT:
|
1999-06-04 19:44:02 +08:00
|
|
|
return (unary_op_type) bitwise_not_function;
|
1999-04-08 02:10:10 +08:00
|
|
|
case ZEND_BOOL_NOT:
|
1999-06-04 19:44:02 +08:00
|
|
|
return (unary_op_type) boolean_not_function;
|
1999-04-08 02:10:10 +08:00
|
|
|
default:
|
1999-05-30 21:28:56 +08:00
|
|
|
return (unary_op_type) NULL;
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-30 02:12:47 +08:00
|
|
|
ZEND_API binary_op_type get_binary_op(int opcode)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
|
|
|
switch (opcode) {
|
|
|
|
case ZEND_ADD:
|
1999-04-24 08:12:55 +08:00
|
|
|
case ZEND_ASSIGN_ADD:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) add_function;
|
1999-04-08 02:10:10 +08:00
|
|
|
case ZEND_SUB:
|
1999-04-24 08:12:55 +08:00
|
|
|
case ZEND_ASSIGN_SUB:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) sub_function;
|
1999-04-08 02:10:10 +08:00
|
|
|
case ZEND_MUL:
|
1999-04-24 08:12:55 +08:00
|
|
|
case ZEND_ASSIGN_MUL:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) mul_function;
|
2013-11-19 15:36:06 +08:00
|
|
|
case ZEND_POW:
|
|
|
|
return (binary_op_type) pow_function;
|
1999-04-08 02:10:10 +08:00
|
|
|
case ZEND_DIV:
|
1999-04-24 08:12:55 +08:00
|
|
|
case ZEND_ASSIGN_DIV:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) div_function;
|
1999-04-08 02:10:10 +08:00
|
|
|
case ZEND_MOD:
|
1999-04-24 08:12:55 +08:00
|
|
|
case ZEND_ASSIGN_MOD:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) mod_function;
|
1999-04-08 02:10:10 +08:00
|
|
|
case ZEND_SL:
|
1999-04-24 08:12:55 +08:00
|
|
|
case ZEND_ASSIGN_SL:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) shift_left_function;
|
1999-04-08 02:10:10 +08:00
|
|
|
case ZEND_SR:
|
1999-04-24 08:12:55 +08:00
|
|
|
case ZEND_ASSIGN_SR:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) shift_right_function;
|
2015-03-25 03:47:21 +08:00
|
|
|
case ZEND_FAST_CONCAT:
|
1999-04-08 02:10:10 +08:00
|
|
|
case ZEND_CONCAT:
|
1999-04-24 08:12:55 +08:00
|
|
|
case ZEND_ASSIGN_CONCAT:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) concat_function;
|
1999-10-19 21:33:17 +08:00
|
|
|
case ZEND_IS_IDENTICAL:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) is_identical_function;
|
2000-03-30 06:05:19 +08:00
|
|
|
case ZEND_IS_NOT_IDENTICAL:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) is_not_identical_function;
|
1999-04-24 08:12:55 +08:00
|
|
|
case ZEND_IS_EQUAL:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) is_equal_function;
|
1999-04-24 08:12:55 +08:00
|
|
|
case ZEND_IS_NOT_EQUAL:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) is_not_equal_function;
|
1999-04-08 02:10:10 +08:00
|
|
|
case ZEND_IS_SMALLER:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) is_smaller_function;
|
1999-04-24 08:12:55 +08:00
|
|
|
case ZEND_IS_SMALLER_OR_EQUAL:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) is_smaller_or_equal_function;
|
2015-01-19 15:12:39 +08:00
|
|
|
case ZEND_SPACESHIP:
|
|
|
|
return (binary_op_type) compare_function;
|
1999-04-08 02:10:10 +08:00
|
|
|
case ZEND_BW_OR:
|
1999-04-24 08:12:55 +08:00
|
|
|
case ZEND_ASSIGN_BW_OR:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) bitwise_or_function;
|
1999-04-08 02:10:10 +08:00
|
|
|
case ZEND_BW_AND:
|
1999-04-24 08:12:55 +08:00
|
|
|
case ZEND_ASSIGN_BW_AND:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) bitwise_and_function;
|
1999-04-08 02:10:10 +08:00
|
|
|
case ZEND_BW_XOR:
|
1999-04-24 08:12:55 +08:00
|
|
|
case ZEND_ASSIGN_BW_XOR:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) bitwise_xor_function;
|
|
|
|
case ZEND_BOOL_XOR:
|
|
|
|
return (binary_op_type) boolean_xor_function;
|
1999-04-08 02:10:10 +08:00
|
|
|
default:
|
2008-08-30 02:12:47 +08:00
|
|
|
return (binary_op_type) NULL;
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
}
|
2003-02-01 09:49:15 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*/
|