1999-04-08 02:10:10 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Zend Engine |
|
|
|
|
+----------------------------------------------------------------------+
|
2017-01-05 01:23:42 +08:00
|
|
|
| Copyright (c) 1998-2017 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> |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
2001-12-11 17:17:38 +08:00
|
|
|
/* $Id$ */
|
1999-07-16 22:58:16 +08:00
|
|
|
|
2000-07-03 07:54:19 +08:00
|
|
|
#ifndef ZEND_H
|
|
|
|
#define ZEND_H
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2016-12-02 18:14:51 +08:00
|
|
|
#define ZEND_VERSION "3.1.0"
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2014-09-20 07:24:03 +08:00
|
|
|
#define ZEND_ENGINE_3
|
2001-12-30 02:07:08 +08:00
|
|
|
|
2014-09-18 08:58:04 +08:00
|
|
|
#define ZEND_MAX_RESERVED_RESOURCES 4
|
1999-08-28 03:17:19 +08:00
|
|
|
|
2014-09-18 08:58:04 +08:00
|
|
|
#include "zend_types.h"
|
2014-09-06 19:47:05 +08:00
|
|
|
#include "zend_errors.h"
|
|
|
|
#include "zend_alloc.h"
|
2014-09-18 08:58:04 +08:00
|
|
|
#include "zend_llist.h"
|
|
|
|
#include "zend_string.h"
|
2015-03-08 00:15:55 +08:00
|
|
|
#include "zend_hash.h"
|
2014-09-18 08:58:04 +08:00
|
|
|
#include "zend_ast.h"
|
|
|
|
#include "zend_gc.h"
|
|
|
|
#include "zend_variables.h"
|
|
|
|
#include "zend_iterators.h"
|
|
|
|
#include "zend_stream.h"
|
2015-10-07 17:35:43 +08:00
|
|
|
#include "zend_smart_str_public.h"
|
2016-06-20 19:58:42 +08:00
|
|
|
#include "zend_signal.h"
|
2001-04-29 04:13:25 +08:00
|
|
|
|
2016-06-20 20:50:41 +08:00
|
|
|
#define HANDLE_BLOCK_INTERRUPTIONS() ZEND_SIGNAL_BLOCK_INTERRUPTIONS()
|
|
|
|
#define HANDLE_UNBLOCK_INTERRUPTIONS() ZEND_SIGNAL_UNBLOCK_INTERRUPTIONS()
|
2009-03-18 09:08:12 +08:00
|
|
|
|
2014-12-14 21:07:59 +08:00
|
|
|
#define INTERNAL_FUNCTION_PARAMETERS zend_execute_data *execute_data, zval *return_value
|
|
|
|
#define INTERNAL_FUNCTION_PARAM_PASSTHRU execute_data, return_value
|
2014-03-28 06:11:22 +08:00
|
|
|
|
|
|
|
#define USED_RET() \
|
2014-10-03 23:32:46 +08:00
|
|
|
(!EX(prev_execute_data) || \
|
|
|
|
!ZEND_USER_CODE(EX(prev_execute_data)->func->common.type) || \
|
2016-02-05 22:23:23 +08:00
|
|
|
(EX(prev_execute_data)->opline->result_type != IS_UNUSED))
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2014-10-02 04:04:21 +08:00
|
|
|
#ifdef ZEND_ENABLE_STATIC_TSRMLS_CACHE
|
|
|
|
#define ZEND_TSRMG TSRMG_STATIC
|
2015-02-17 00:19:32 +08:00
|
|
|
#define ZEND_TSRMLS_CACHE_EXTERN() TSRMLS_CACHE_EXTERN()
|
|
|
|
#define ZEND_TSRMLS_CACHE_DEFINE() TSRMLS_CACHE_DEFINE()
|
|
|
|
#define ZEND_TSRMLS_CACHE_UPDATE() TSRMLS_CACHE_UPDATE()
|
2014-10-15 22:33:40 +08:00
|
|
|
#define ZEND_TSRMLS_CACHE TSRMLS_CACHE
|
2014-10-02 04:04:21 +08:00
|
|
|
#else
|
|
|
|
#define ZEND_TSRMG TSRMG
|
2015-02-17 00:19:32 +08:00
|
|
|
#define ZEND_TSRMLS_CACHE_EXTERN()
|
|
|
|
#define ZEND_TSRMLS_CACHE_DEFINE()
|
|
|
|
#define ZEND_TSRMLS_CACHE_UPDATE()
|
2014-10-15 22:33:40 +08:00
|
|
|
#define ZEND_TSRMLS_CACHE
|
2014-10-02 04:04:21 +08:00
|
|
|
#endif
|
|
|
|
|
2016-03-03 23:46:04 +08:00
|
|
|
ZEND_TSRMLS_CACHE_EXTERN()
|
2014-10-02 04:04:21 +08:00
|
|
|
|
2014-09-18 08:58:04 +08:00
|
|
|
#ifdef HAVE_NORETURN
|
2015-08-20 00:15:30 +08:00
|
|
|
# ifdef ZEND_NORETURN_ALIAS
|
2016-06-21 21:00:37 +08:00
|
|
|
ZEND_COLD void zend_error_noreturn(int type, const char *format, ...) ZEND_NORETURN ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
|
2015-02-06 18:42:22 +08:00
|
|
|
# else
|
2016-06-21 21:00:37 +08:00
|
|
|
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
|
2014-09-18 08:58:04 +08:00
|
|
|
# endif
|
2005-06-13 19:22:59 +08:00
|
|
|
#else
|
2014-09-18 08:58:04 +08:00
|
|
|
# define zend_error_noreturn zend_error
|
2005-06-13 19:22:59 +08:00
|
|
|
#endif
|
|
|
|
|
2005-02-23 19:15:51 +08:00
|
|
|
struct _zend_serialize_data;
|
|
|
|
struct _zend_unserialize_data;
|
|
|
|
|
|
|
|
typedef struct _zend_serialize_data zend_serialize_data;
|
|
|
|
typedef struct _zend_unserialize_data zend_unserialize_data;
|
|
|
|
|
2014-09-18 08:58:04 +08:00
|
|
|
typedef struct _zend_trait_method_reference {
|
2015-01-03 17:22:58 +08:00
|
|
|
zend_string *method_name;
|
Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
#
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
#
# Internals of the Traits Patch
# -----------------------------
#
# Open TODOs
# """"""""""
#
# - Reflection API
# - support for traits for internal classes
# - currently destroy_zend_class does not handle that case
#
# Introduced Structures
# """""""""""""""""""""
#
# Data structures to encode the composition information specified in the
# source:
# - zend_trait_method_reference
# - zend_trait_precedence
# - zend_trait_alias
#
# Changes
# """""""
#
# zend_class_entry
# - uses NULL terminated lists of pointers for
# - trait_aliases
# - trait_precedences
# - do you prefer an explicit counter?
# - the information is only necessary during class composition
# but might be interesting for reflection
# - did not want to blow up class further with not really necessary length counters
#
# added keywords
# - trait
# - insteadof
#
# Added opcodes
# ZEND_ADD_TRAIT
# - similar to ZEND_ADD_INTERFACE
# - adds the trait to the list of traits of a class, no actual composition done
# ZEND_BIND_TRAITS
# - emitted in zend_do_end_class_declaration
# - concludes the class definition and will initiate the trait composition
# when the class definition is encountered during runtime
#
# Added Flags
# ZEND_ACC_TRAIT = 0x120
# ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
# ZEND_FETCH_CLASS_TRAIT = 14
#
# zend_vm_execute.h
# - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
# ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
#
# zend_compile.c
# - refactored do_inherit_method_check
# split into do_inherit_method_check and do_inheritance_check_on_method
# - added helper functions use a '_' as prefix and are not mentioned in the
# headers
# - _copy_functions
# prepare hash-maps of functions which should be merged into a class
# here the aliases are handled
# - _merge_functions
# builds a hash-table of the methods which need to be added to a class
# does the conflict detection
# - reused php_runkit_function_copy_ctor
# - it is not identical with the original code anymore, needed to update it
# think I fixed some bugs, not sure whether all have been reported back to runkit
# - has to be renamed, left the name for the moment, to make its origin obvious
# - here might be optimization potential
# - not sure whether everything needs to be copied
# - copying the literals might be broken
# - added it since the literals array is freed by efree and gave problems
# with doubled frees
# - all immutable parts of the zend_op array should not be copied
# - am not sure which parts are immutable
# - and not sure how to avoid doubled frees on the same arrays on shutdown
# - _merge_functions_to_class
# does the final merging with the target class to handle inherited
# and overridden methods
# - small helper for NULL terminated lists
# zend_init_list, zend_add_to_list
#
# zend_language_parser.y
# - reused class definition for traits
# - there should be something with regard to properties
# - if they get explicitly defined, it might be worthwhile to
# check that there are no collisions with other traits in a composition
# (however, I would not introduce elaborate language features to control that
# but a notice for such conflicts might be nice to the developers)
2010-04-23 06:05:56 +08:00
|
|
|
zend_class_entry *ce;
|
2014-02-10 14:04:30 +08:00
|
|
|
zend_string *class_name;
|
2014-09-18 08:58:04 +08:00
|
|
|
} zend_trait_method_reference;
|
Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
#
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
#
# Internals of the Traits Patch
# -----------------------------
#
# Open TODOs
# """"""""""
#
# - Reflection API
# - support for traits for internal classes
# - currently destroy_zend_class does not handle that case
#
# Introduced Structures
# """""""""""""""""""""
#
# Data structures to encode the composition information specified in the
# source:
# - zend_trait_method_reference
# - zend_trait_precedence
# - zend_trait_alias
#
# Changes
# """""""
#
# zend_class_entry
# - uses NULL terminated lists of pointers for
# - trait_aliases
# - trait_precedences
# - do you prefer an explicit counter?
# - the information is only necessary during class composition
# but might be interesting for reflection
# - did not want to blow up class further with not really necessary length counters
#
# added keywords
# - trait
# - insteadof
#
# Added opcodes
# ZEND_ADD_TRAIT
# - similar to ZEND_ADD_INTERFACE
# - adds the trait to the list of traits of a class, no actual composition done
# ZEND_BIND_TRAITS
# - emitted in zend_do_end_class_declaration
# - concludes the class definition and will initiate the trait composition
# when the class definition is encountered during runtime
#
# Added Flags
# ZEND_ACC_TRAIT = 0x120
# ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
# ZEND_FETCH_CLASS_TRAIT = 14
#
# zend_vm_execute.h
# - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
# ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
#
# zend_compile.c
# - refactored do_inherit_method_check
# split into do_inherit_method_check and do_inheritance_check_on_method
# - added helper functions use a '_' as prefix and are not mentioned in the
# headers
# - _copy_functions
# prepare hash-maps of functions which should be merged into a class
# here the aliases are handled
# - _merge_functions
# builds a hash-table of the methods which need to be added to a class
# does the conflict detection
# - reused php_runkit_function_copy_ctor
# - it is not identical with the original code anymore, needed to update it
# think I fixed some bugs, not sure whether all have been reported back to runkit
# - has to be renamed, left the name for the moment, to make its origin obvious
# - here might be optimization potential
# - not sure whether everything needs to be copied
# - copying the literals might be broken
# - added it since the literals array is freed by efree and gave problems
# with doubled frees
# - all immutable parts of the zend_op array should not be copied
# - am not sure which parts are immutable
# - and not sure how to avoid doubled frees on the same arrays on shutdown
# - _merge_functions_to_class
# does the final merging with the target class to handle inherited
# and overridden methods
# - small helper for NULL terminated lists
# zend_init_list, zend_add_to_list
#
# zend_language_parser.y
# - reused class definition for traits
# - there should be something with regard to properties
# - if they get explicitly defined, it might be worthwhile to
# check that there are no collisions with other traits in a composition
# (however, I would not introduce elaborate language features to control that
# but a notice for such conflicts might be nice to the developers)
2010-04-23 06:05:56 +08:00
|
|
|
|
2014-09-18 08:58:04 +08:00
|
|
|
typedef struct _zend_trait_precedence {
|
2015-01-03 17:22:58 +08:00
|
|
|
zend_trait_method_reference *trait_method;
|
2014-02-10 14:04:30 +08:00
|
|
|
union {
|
|
|
|
zend_class_entry *ce;
|
|
|
|
zend_string *class_name;
|
|
|
|
} *exclude_from_classes;
|
2014-09-18 08:58:04 +08:00
|
|
|
} zend_trait_precedence;
|
Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
#
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
#
# Internals of the Traits Patch
# -----------------------------
#
# Open TODOs
# """"""""""
#
# - Reflection API
# - support for traits for internal classes
# - currently destroy_zend_class does not handle that case
#
# Introduced Structures
# """""""""""""""""""""
#
# Data structures to encode the composition information specified in the
# source:
# - zend_trait_method_reference
# - zend_trait_precedence
# - zend_trait_alias
#
# Changes
# """""""
#
# zend_class_entry
# - uses NULL terminated lists of pointers for
# - trait_aliases
# - trait_precedences
# - do you prefer an explicit counter?
# - the information is only necessary during class composition
# but might be interesting for reflection
# - did not want to blow up class further with not really necessary length counters
#
# added keywords
# - trait
# - insteadof
#
# Added opcodes
# ZEND_ADD_TRAIT
# - similar to ZEND_ADD_INTERFACE
# - adds the trait to the list of traits of a class, no actual composition done
# ZEND_BIND_TRAITS
# - emitted in zend_do_end_class_declaration
# - concludes the class definition and will initiate the trait composition
# when the class definition is encountered during runtime
#
# Added Flags
# ZEND_ACC_TRAIT = 0x120
# ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
# ZEND_FETCH_CLASS_TRAIT = 14
#
# zend_vm_execute.h
# - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
# ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
#
# zend_compile.c
# - refactored do_inherit_method_check
# split into do_inherit_method_check and do_inheritance_check_on_method
# - added helper functions use a '_' as prefix and are not mentioned in the
# headers
# - _copy_functions
# prepare hash-maps of functions which should be merged into a class
# here the aliases are handled
# - _merge_functions
# builds a hash-table of the methods which need to be added to a class
# does the conflict detection
# - reused php_runkit_function_copy_ctor
# - it is not identical with the original code anymore, needed to update it
# think I fixed some bugs, not sure whether all have been reported back to runkit
# - has to be renamed, left the name for the moment, to make its origin obvious
# - here might be optimization potential
# - not sure whether everything needs to be copied
# - copying the literals might be broken
# - added it since the literals array is freed by efree and gave problems
# with doubled frees
# - all immutable parts of the zend_op array should not be copied
# - am not sure which parts are immutable
# - and not sure how to avoid doubled frees on the same arrays on shutdown
# - _merge_functions_to_class
# does the final merging with the target class to handle inherited
# and overridden methods
# - small helper for NULL terminated lists
# zend_init_list, zend_add_to_list
#
# zend_language_parser.y
# - reused class definition for traits
# - there should be something with regard to properties
# - if they get explicitly defined, it might be worthwhile to
# check that there are no collisions with other traits in a composition
# (however, I would not introduce elaborate language features to control that
# but a notice for such conflicts might be nice to the developers)
2010-04-23 06:05:56 +08:00
|
|
|
|
2014-09-18 08:58:04 +08:00
|
|
|
typedef struct _zend_trait_alias {
|
Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
#
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
#
# Internals of the Traits Patch
# -----------------------------
#
# Open TODOs
# """"""""""
#
# - Reflection API
# - support for traits for internal classes
# - currently destroy_zend_class does not handle that case
#
# Introduced Structures
# """""""""""""""""""""
#
# Data structures to encode the composition information specified in the
# source:
# - zend_trait_method_reference
# - zend_trait_precedence
# - zend_trait_alias
#
# Changes
# """""""
#
# zend_class_entry
# - uses NULL terminated lists of pointers for
# - trait_aliases
# - trait_precedences
# - do you prefer an explicit counter?
# - the information is only necessary during class composition
# but might be interesting for reflection
# - did not want to blow up class further with not really necessary length counters
#
# added keywords
# - trait
# - insteadof
#
# Added opcodes
# ZEND_ADD_TRAIT
# - similar to ZEND_ADD_INTERFACE
# - adds the trait to the list of traits of a class, no actual composition done
# ZEND_BIND_TRAITS
# - emitted in zend_do_end_class_declaration
# - concludes the class definition and will initiate the trait composition
# when the class definition is encountered during runtime
#
# Added Flags
# ZEND_ACC_TRAIT = 0x120
# ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
# ZEND_FETCH_CLASS_TRAIT = 14
#
# zend_vm_execute.h
# - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
# ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
#
# zend_compile.c
# - refactored do_inherit_method_check
# split into do_inherit_method_check and do_inheritance_check_on_method
# - added helper functions use a '_' as prefix and are not mentioned in the
# headers
# - _copy_functions
# prepare hash-maps of functions which should be merged into a class
# here the aliases are handled
# - _merge_functions
# builds a hash-table of the methods which need to be added to a class
# does the conflict detection
# - reused php_runkit_function_copy_ctor
# - it is not identical with the original code anymore, needed to update it
# think I fixed some bugs, not sure whether all have been reported back to runkit
# - has to be renamed, left the name for the moment, to make its origin obvious
# - here might be optimization potential
# - not sure whether everything needs to be copied
# - copying the literals might be broken
# - added it since the literals array is freed by efree and gave problems
# with doubled frees
# - all immutable parts of the zend_op array should not be copied
# - am not sure which parts are immutable
# - and not sure how to avoid doubled frees on the same arrays on shutdown
# - _merge_functions_to_class
# does the final merging with the target class to handle inherited
# and overridden methods
# - small helper for NULL terminated lists
# zend_init_list, zend_add_to_list
#
# zend_language_parser.y
# - reused class definition for traits
# - there should be something with regard to properties
# - if they get explicitly defined, it might be worthwhile to
# check that there are no collisions with other traits in a composition
# (however, I would not introduce elaborate language features to control that
# but a notice for such conflicts might be nice to the developers)
2010-04-23 06:05:56 +08:00
|
|
|
zend_trait_method_reference *trait_method;
|
2015-01-03 17:22:58 +08:00
|
|
|
|
Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
#
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
#
# Internals of the Traits Patch
# -----------------------------
#
# Open TODOs
# """"""""""
#
# - Reflection API
# - support for traits for internal classes
# - currently destroy_zend_class does not handle that case
#
# Introduced Structures
# """""""""""""""""""""
#
# Data structures to encode the composition information specified in the
# source:
# - zend_trait_method_reference
# - zend_trait_precedence
# - zend_trait_alias
#
# Changes
# """""""
#
# zend_class_entry
# - uses NULL terminated lists of pointers for
# - trait_aliases
# - trait_precedences
# - do you prefer an explicit counter?
# - the information is only necessary during class composition
# but might be interesting for reflection
# - did not want to blow up class further with not really necessary length counters
#
# added keywords
# - trait
# - insteadof
#
# Added opcodes
# ZEND_ADD_TRAIT
# - similar to ZEND_ADD_INTERFACE
# - adds the trait to the list of traits of a class, no actual composition done
# ZEND_BIND_TRAITS
# - emitted in zend_do_end_class_declaration
# - concludes the class definition and will initiate the trait composition
# when the class definition is encountered during runtime
#
# Added Flags
# ZEND_ACC_TRAIT = 0x120
# ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
# ZEND_FETCH_CLASS_TRAIT = 14
#
# zend_vm_execute.h
# - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
# ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
#
# zend_compile.c
# - refactored do_inherit_method_check
# split into do_inherit_method_check and do_inheritance_check_on_method
# - added helper functions use a '_' as prefix and are not mentioned in the
# headers
# - _copy_functions
# prepare hash-maps of functions which should be merged into a class
# here the aliases are handled
# - _merge_functions
# builds a hash-table of the methods which need to be added to a class
# does the conflict detection
# - reused php_runkit_function_copy_ctor
# - it is not identical with the original code anymore, needed to update it
# think I fixed some bugs, not sure whether all have been reported back to runkit
# - has to be renamed, left the name for the moment, to make its origin obvious
# - here might be optimization potential
# - not sure whether everything needs to be copied
# - copying the literals might be broken
# - added it since the literals array is freed by efree and gave problems
# with doubled frees
# - all immutable parts of the zend_op array should not be copied
# - am not sure which parts are immutable
# - and not sure how to avoid doubled frees on the same arrays on shutdown
# - _merge_functions_to_class
# does the final merging with the target class to handle inherited
# and overridden methods
# - small helper for NULL terminated lists
# zend_init_list, zend_add_to_list
#
# zend_language_parser.y
# - reused class definition for traits
# - there should be something with regard to properties
# - if they get explicitly defined, it might be worthwhile to
# check that there are no collisions with other traits in a composition
# (however, I would not introduce elaborate language features to control that
# but a notice for such conflicts might be nice to the developers)
2010-04-23 06:05:56 +08:00
|
|
|
/**
|
|
|
|
* name for method to be added
|
|
|
|
*/
|
2014-02-10 14:04:30 +08:00
|
|
|
zend_string *alias;
|
2015-01-03 17:22:58 +08:00
|
|
|
|
Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
#
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
#
# Internals of the Traits Patch
# -----------------------------
#
# Open TODOs
# """"""""""
#
# - Reflection API
# - support for traits for internal classes
# - currently destroy_zend_class does not handle that case
#
# Introduced Structures
# """""""""""""""""""""
#
# Data structures to encode the composition information specified in the
# source:
# - zend_trait_method_reference
# - zend_trait_precedence
# - zend_trait_alias
#
# Changes
# """""""
#
# zend_class_entry
# - uses NULL terminated lists of pointers for
# - trait_aliases
# - trait_precedences
# - do you prefer an explicit counter?
# - the information is only necessary during class composition
# but might be interesting for reflection
# - did not want to blow up class further with not really necessary length counters
#
# added keywords
# - trait
# - insteadof
#
# Added opcodes
# ZEND_ADD_TRAIT
# - similar to ZEND_ADD_INTERFACE
# - adds the trait to the list of traits of a class, no actual composition done
# ZEND_BIND_TRAITS
# - emitted in zend_do_end_class_declaration
# - concludes the class definition and will initiate the trait composition
# when the class definition is encountered during runtime
#
# Added Flags
# ZEND_ACC_TRAIT = 0x120
# ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
# ZEND_FETCH_CLASS_TRAIT = 14
#
# zend_vm_execute.h
# - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
# ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
#
# zend_compile.c
# - refactored do_inherit_method_check
# split into do_inherit_method_check and do_inheritance_check_on_method
# - added helper functions use a '_' as prefix and are not mentioned in the
# headers
# - _copy_functions
# prepare hash-maps of functions which should be merged into a class
# here the aliases are handled
# - _merge_functions
# builds a hash-table of the methods which need to be added to a class
# does the conflict detection
# - reused php_runkit_function_copy_ctor
# - it is not identical with the original code anymore, needed to update it
# think I fixed some bugs, not sure whether all have been reported back to runkit
# - has to be renamed, left the name for the moment, to make its origin obvious
# - here might be optimization potential
# - not sure whether everything needs to be copied
# - copying the literals might be broken
# - added it since the literals array is freed by efree and gave problems
# with doubled frees
# - all immutable parts of the zend_op array should not be copied
# - am not sure which parts are immutable
# - and not sure how to avoid doubled frees on the same arrays on shutdown
# - _merge_functions_to_class
# does the final merging with the target class to handle inherited
# and overridden methods
# - small helper for NULL terminated lists
# zend_init_list, zend_add_to_list
#
# zend_language_parser.y
# - reused class definition for traits
# - there should be something with regard to properties
# - if they get explicitly defined, it might be worthwhile to
# check that there are no collisions with other traits in a composition
# (however, I would not introduce elaborate language features to control that
# but a notice for such conflicts might be nice to the developers)
2010-04-23 06:05:56 +08:00
|
|
|
/**
|
|
|
|
* modifiers to be set on trait method
|
|
|
|
*/
|
2014-08-26 01:28:33 +08:00
|
|
|
uint32_t modifiers;
|
2014-09-18 08:58:04 +08:00
|
|
|
} zend_trait_alias;
|
Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
#
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
#
# Internals of the Traits Patch
# -----------------------------
#
# Open TODOs
# """"""""""
#
# - Reflection API
# - support for traits for internal classes
# - currently destroy_zend_class does not handle that case
#
# Introduced Structures
# """""""""""""""""""""
#
# Data structures to encode the composition information specified in the
# source:
# - zend_trait_method_reference
# - zend_trait_precedence
# - zend_trait_alias
#
# Changes
# """""""
#
# zend_class_entry
# - uses NULL terminated lists of pointers for
# - trait_aliases
# - trait_precedences
# - do you prefer an explicit counter?
# - the information is only necessary during class composition
# but might be interesting for reflection
# - did not want to blow up class further with not really necessary length counters
#
# added keywords
# - trait
# - insteadof
#
# Added opcodes
# ZEND_ADD_TRAIT
# - similar to ZEND_ADD_INTERFACE
# - adds the trait to the list of traits of a class, no actual composition done
# ZEND_BIND_TRAITS
# - emitted in zend_do_end_class_declaration
# - concludes the class definition and will initiate the trait composition
# when the class definition is encountered during runtime
#
# Added Flags
# ZEND_ACC_TRAIT = 0x120
# ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
# ZEND_FETCH_CLASS_TRAIT = 14
#
# zend_vm_execute.h
# - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
# ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
#
# zend_compile.c
# - refactored do_inherit_method_check
# split into do_inherit_method_check and do_inheritance_check_on_method
# - added helper functions use a '_' as prefix and are not mentioned in the
# headers
# - _copy_functions
# prepare hash-maps of functions which should be merged into a class
# here the aliases are handled
# - _merge_functions
# builds a hash-table of the methods which need to be added to a class
# does the conflict detection
# - reused php_runkit_function_copy_ctor
# - it is not identical with the original code anymore, needed to update it
# think I fixed some bugs, not sure whether all have been reported back to runkit
# - has to be renamed, left the name for the moment, to make its origin obvious
# - here might be optimization potential
# - not sure whether everything needs to be copied
# - copying the literals might be broken
# - added it since the literals array is freed by efree and gave problems
# with doubled frees
# - all immutable parts of the zend_op array should not be copied
# - am not sure which parts are immutable
# - and not sure how to avoid doubled frees on the same arrays on shutdown
# - _merge_functions_to_class
# does the final merging with the target class to handle inherited
# and overridden methods
# - small helper for NULL terminated lists
# zend_init_list, zend_add_to_list
#
# zend_language_parser.y
# - reused class definition for traits
# - there should be something with regard to properties
# - if they get explicitly defined, it might be worthwhile to
# check that there are no collisions with other traits in a composition
# (however, I would not introduce elaborate language features to control that
# but a notice for such conflicts might be nice to the developers)
2010-04-23 06:05:56 +08:00
|
|
|
|
1999-04-08 02:10:10 +08:00
|
|
|
struct _zend_class_entry {
|
|
|
|
char type;
|
2014-02-10 14:04:30 +08:00
|
|
|
zend_string *name;
|
2006-05-10 07:53:23 +08:00
|
|
|
struct _zend_class_entry *parent;
|
2002-03-13 03:22:29 +08:00
|
|
|
int refcount;
|
2014-08-26 01:28:33 +08:00
|
|
|
uint32_t ce_flags;
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2014-08-28 02:45:27 +08:00
|
|
|
int default_properties_count;
|
|
|
|
int default_static_members_count;
|
2014-02-10 14:04:30 +08:00
|
|
|
zval *default_properties_table;
|
|
|
|
zval *default_static_members_table;
|
|
|
|
zval *static_members_table;
|
2014-08-28 02:45:27 +08:00
|
|
|
HashTable function_table;
|
|
|
|
HashTable properties_info;
|
2001-12-12 02:46:43 +08:00
|
|
|
HashTable constants_table;
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2001-11-03 19:59:14 +08:00
|
|
|
union _zend_function *constructor;
|
2001-12-27 22:35:09 +08:00
|
|
|
union _zend_function *destructor;
|
2001-12-27 03:54:20 +08:00
|
|
|
union _zend_function *clone;
|
2002-09-04 17:07:58 +08:00
|
|
|
union _zend_function *__get;
|
|
|
|
union _zend_function *__set;
|
2005-07-08 00:07:09 +08:00
|
|
|
union _zend_function *__unset;
|
|
|
|
union _zend_function *__isset;
|
2002-09-04 17:07:58 +08:00
|
|
|
union _zend_function *__call;
|
2007-09-29 16:52:40 +08:00
|
|
|
union _zend_function *__callstatic;
|
2006-05-10 07:53:23 +08:00
|
|
|
union _zend_function *__tostring;
|
2014-02-18 11:13:00 +08:00
|
|
|
union _zend_function *__debugInfo;
|
2005-03-08 06:23:14 +08:00
|
|
|
union _zend_function *serialize_func;
|
|
|
|
union _zend_function *unserialize_func;
|
2001-11-03 19:59:14 +08:00
|
|
|
|
2003-10-19 02:43:31 +08:00
|
|
|
zend_class_iterator_funcs iterator_funcs;
|
2003-10-18 01:19:44 +08:00
|
|
|
|
1999-04-08 02:10:10 +08:00
|
|
|
/* handlers */
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_object* (*create_object)(zend_class_entry *class_type);
|
|
|
|
zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object, int by_ref);
|
|
|
|
int (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type); /* a class implements this interface */
|
|
|
|
union _zend_function *(*get_static_method)(zend_class_entry *ce, zend_string* method);
|
2002-09-04 17:07:58 +08:00
|
|
|
|
2005-02-23 19:15:51 +08:00
|
|
|
/* serializer callbacks */
|
2014-12-14 06:06:14 +08:00
|
|
|
int (*serialize)(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data);
|
|
|
|
int (*unserialize)(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data);
|
2005-02-23 19:15:51 +08:00
|
|
|
|
2014-08-26 01:28:33 +08:00
|
|
|
uint32_t num_interfaces;
|
2014-08-28 02:45:27 +08:00
|
|
|
uint32_t num_traits;
|
|
|
|
zend_class_entry **interfaces;
|
2015-01-03 17:22:58 +08:00
|
|
|
|
Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
#
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
#
# Internals of the Traits Patch
# -----------------------------
#
# Open TODOs
# """"""""""
#
# - Reflection API
# - support for traits for internal classes
# - currently destroy_zend_class does not handle that case
#
# Introduced Structures
# """""""""""""""""""""
#
# Data structures to encode the composition information specified in the
# source:
# - zend_trait_method_reference
# - zend_trait_precedence
# - zend_trait_alias
#
# Changes
# """""""
#
# zend_class_entry
# - uses NULL terminated lists of pointers for
# - trait_aliases
# - trait_precedences
# - do you prefer an explicit counter?
# - the information is only necessary during class composition
# but might be interesting for reflection
# - did not want to blow up class further with not really necessary length counters
#
# added keywords
# - trait
# - insteadof
#
# Added opcodes
# ZEND_ADD_TRAIT
# - similar to ZEND_ADD_INTERFACE
# - adds the trait to the list of traits of a class, no actual composition done
# ZEND_BIND_TRAITS
# - emitted in zend_do_end_class_declaration
# - concludes the class definition and will initiate the trait composition
# when the class definition is encountered during runtime
#
# Added Flags
# ZEND_ACC_TRAIT = 0x120
# ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
# ZEND_FETCH_CLASS_TRAIT = 14
#
# zend_vm_execute.h
# - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
# ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
#
# zend_compile.c
# - refactored do_inherit_method_check
# split into do_inherit_method_check and do_inheritance_check_on_method
# - added helper functions use a '_' as prefix and are not mentioned in the
# headers
# - _copy_functions
# prepare hash-maps of functions which should be merged into a class
# here the aliases are handled
# - _merge_functions
# builds a hash-table of the methods which need to be added to a class
# does the conflict detection
# - reused php_runkit_function_copy_ctor
# - it is not identical with the original code anymore, needed to update it
# think I fixed some bugs, not sure whether all have been reported back to runkit
# - has to be renamed, left the name for the moment, to make its origin obvious
# - here might be optimization potential
# - not sure whether everything needs to be copied
# - copying the literals might be broken
# - added it since the literals array is freed by efree and gave problems
# with doubled frees
# - all immutable parts of the zend_op array should not be copied
# - am not sure which parts are immutable
# - and not sure how to avoid doubled frees on the same arrays on shutdown
# - _merge_functions_to_class
# does the final merging with the target class to handle inherited
# and overridden methods
# - small helper for NULL terminated lists
# zend_init_list, zend_add_to_list
#
# zend_language_parser.y
# - reused class definition for traits
# - there should be something with regard to properties
# - if they get explicitly defined, it might be worthwhile to
# check that there are no collisions with other traits in a composition
# (however, I would not introduce elaborate language features to control that
# but a notice for such conflicts might be nice to the developers)
2010-04-23 06:05:56 +08:00
|
|
|
zend_class_entry **traits;
|
|
|
|
zend_trait_alias **trait_aliases;
|
|
|
|
zend_trait_precedence **trait_precedences;
|
2003-03-05 19:14:44 +08:00
|
|
|
|
2010-09-15 15:38:52 +08:00
|
|
|
union {
|
|
|
|
struct {
|
2014-02-10 14:04:30 +08:00
|
|
|
zend_string *filename;
|
2014-08-26 01:28:33 +08:00
|
|
|
uint32_t line_start;
|
|
|
|
uint32_t line_end;
|
2014-02-10 14:04:30 +08:00
|
|
|
zend_string *doc_comment;
|
2010-09-15 15:38:52 +08:00
|
|
|
} user;
|
|
|
|
struct {
|
|
|
|
const struct _zend_function_entry *builtin_functions;
|
|
|
|
struct _zend_module_entry *module;
|
|
|
|
} internal;
|
|
|
|
} info;
|
1999-04-08 02:10:10 +08:00
|
|
|
};
|
|
|
|
|
1999-05-23 00:10:51 +08:00
|
|
|
typedef struct _zend_utility_functions {
|
2003-08-29 01:31:31 +08:00
|
|
|
void (*error_function)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
|
2014-08-26 01:24:55 +08:00
|
|
|
size_t (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
|
|
|
|
size_t (*write_function)(const char *str, size_t str_length);
|
2015-03-04 07:05:28 +08:00
|
|
|
FILE *(*fopen_function)(const char *filename, zend_string **opened_path);
|
2014-12-14 06:06:14 +08:00
|
|
|
void (*message_handler)(zend_long message, const void *data);
|
2014-09-02 00:57:33 +08:00
|
|
|
zval *(*get_configuration_directive)(zend_string *name);
|
2014-12-14 06:06:14 +08:00
|
|
|
void (*ticks_function)(int ticks);
|
|
|
|
void (*on_timeout)(int seconds);
|
|
|
|
int (*stream_open_function)(const char *filename, zend_file_handle *handle);
|
2014-08-26 01:24:55 +08:00
|
|
|
size_t (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap);
|
2014-05-10 00:21:49 +08:00
|
|
|
zend_string *(*vstrpprintf_function)(size_t max_len, const char *format, va_list ap);
|
2014-12-14 06:06:14 +08:00
|
|
|
char *(*getenv_function)(char *name, size_t name_len);
|
2015-03-04 07:05:28 +08:00
|
|
|
zend_string *(*resolve_path_function)(const char *filename, int filename_len);
|
1999-04-08 02:10:10 +08:00
|
|
|
} zend_utility_functions;
|
|
|
|
|
1999-05-23 00:10:51 +08:00
|
|
|
typedef struct _zend_utility_values {
|
1999-12-04 21:26:57 +08:00
|
|
|
char *import_use_extension;
|
|
|
|
uint import_use_extension_length;
|
2002-09-03 17:41:41 +08:00
|
|
|
zend_bool html_errors;
|
1999-04-08 02:10:10 +08:00
|
|
|
} zend_utility_values;
|
|
|
|
|
2014-10-22 15:25:53 +08:00
|
|
|
typedef int (*zend_write_func_t)(const char *str, size_t str_length);
|
2000-03-26 03:10:07 +08:00
|
|
|
|
2001-07-22 00:21:22 +08:00
|
|
|
#define zend_bailout() _zend_bailout(__FILE__, __LINE__)
|
2001-07-21 22:25:27 +08:00
|
|
|
|
|
|
|
#define zend_try \
|
|
|
|
{ \
|
2008-03-19 05:14:28 +08:00
|
|
|
JMP_BUF *__orig_bailout = EG(bailout); \
|
|
|
|
JMP_BUF __bailout; \
|
2001-07-21 22:25:27 +08:00
|
|
|
\
|
2006-09-14 18:32:45 +08:00
|
|
|
EG(bailout) = &__bailout; \
|
2008-03-19 05:14:28 +08:00
|
|
|
if (SETJMP(__bailout)==0) {
|
2001-07-21 22:25:27 +08:00
|
|
|
#define zend_catch \
|
2006-05-19 14:09:15 +08:00
|
|
|
} else { \
|
2006-09-14 18:32:45 +08:00
|
|
|
EG(bailout) = __orig_bailout;
|
2001-07-21 22:25:27 +08:00
|
|
|
#define zend_end_try() \
|
2006-05-19 14:09:15 +08:00
|
|
|
} \
|
2006-09-14 18:32:45 +08:00
|
|
|
EG(bailout) = __orig_bailout; \
|
2001-07-21 22:25:27 +08:00
|
|
|
}
|
2007-11-03 03:40:39 +08:00
|
|
|
#define zend_first_try EG(bailout)=NULL; zend_try
|
2001-07-21 22:25:27 +08:00
|
|
|
|
2004-02-19 06:44:40 +08:00
|
|
|
BEGIN_EXTERN_C()
|
2014-12-14 06:06:14 +08:00
|
|
|
int zend_startup(zend_utility_functions *utility_functions, char **extensions);
|
|
|
|
void zend_shutdown(void);
|
|
|
|
void zend_register_standard_ini_entries(void);
|
|
|
|
void zend_post_startup(void);
|
2014-09-18 08:58:04 +08:00
|
|
|
void zend_set_utility_values(zend_utility_values *utility_values);
|
|
|
|
|
2015-08-19 19:40:56 +08:00
|
|
|
ZEND_API ZEND_COLD void _zend_bailout(char *filename, uint lineno);
|
2014-09-18 08:58:04 +08:00
|
|
|
|
2001-07-21 22:25:27 +08:00
|
|
|
ZEND_API char *get_zend_version(void);
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy);
|
|
|
|
ZEND_API size_t zend_print_zval(zval *expr, int indent);
|
|
|
|
ZEND_API void zend_print_zval_r(zval *expr, int indent);
|
2015-10-07 17:35:43 +08:00
|
|
|
ZEND_API zend_string *zend_print_zval_r_to_str(zval *expr, int indent);
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_print_flat_zval_r(zval *expr);
|
2015-08-19 19:40:56 +08:00
|
|
|
ZEND_API ZEND_COLD void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
|
2001-07-21 22:25:27 +08:00
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_activate(void);
|
|
|
|
ZEND_API void zend_deactivate(void);
|
|
|
|
ZEND_API void zend_call_destructors(void);
|
|
|
|
ZEND_API void zend_activate_modules(void);
|
|
|
|
ZEND_API void zend_deactivate_modules(void);
|
|
|
|
ZEND_API void zend_post_deactivate_modules(void);
|
2000-06-03 09:49:49 +08:00
|
|
|
|
2001-01-15 18:52:06 +08:00
|
|
|
ZEND_API void free_estring(char **str_p);
|
2004-02-20 16:03:27 +08:00
|
|
|
END_EXTERN_C()
|
2003-02-11 00:11:24 +08:00
|
|
|
|
1999-04-08 02:10:10 +08:00
|
|
|
/* output support */
|
|
|
|
#define ZEND_WRITE(str, str_len) zend_write((str), (str_len))
|
2009-02-18 18:55:08 +08:00
|
|
|
#define ZEND_WRITE_EX(str, str_len) write_func((str), (str_len))
|
1999-04-08 02:10:10 +08:00
|
|
|
#define ZEND_PUTS(str) zend_write((str), strlen((str)))
|
2009-02-18 18:55:08 +08:00
|
|
|
#define ZEND_PUTS_EX(str) write_func((str), strlen((str)))
|
2013-11-30 06:54:17 +08:00
|
|
|
#define ZEND_PUTC(c) zend_write(&(c), 1)
|
1999-04-08 02:10:10 +08:00
|
|
|
|
1999-04-23 11:32:33 +08:00
|
|
|
BEGIN_EXTERN_C()
|
2014-08-26 01:24:55 +08:00
|
|
|
extern ZEND_API size_t (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
|
2000-03-26 03:10:07 +08:00
|
|
|
extern ZEND_API zend_write_func_t zend_write;
|
2015-03-04 07:05:28 +08:00
|
|
|
extern ZEND_API FILE *(*zend_fopen)(const char *filename, zend_string **opened_path);
|
2014-12-14 06:06:14 +08:00
|
|
|
extern ZEND_API void (*zend_ticks_function)(int ticks);
|
2016-06-23 20:01:23 +08:00
|
|
|
extern ZEND_API void (*zend_interrupt_function)(zend_execute_data *execute_data);
|
2003-08-29 01:31:31 +08:00
|
|
|
extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
|
2014-12-14 06:06:14 +08:00
|
|
|
extern ZEND_API void (*zend_on_timeout)(int seconds);
|
|
|
|
extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle);
|
2014-08-26 01:24:55 +08:00
|
|
|
extern size_t (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
|
|
|
|
extern zend_string *(*zend_vstrpprintf)(size_t max_len, const char *format, va_list ap);
|
2014-12-14 06:06:14 +08:00
|
|
|
extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len);
|
2015-03-04 07:05:28 +08:00
|
|
|
extern ZEND_API zend_string *(*zend_resolve_path)(const char *filename, int filename_len);
|
2000-04-19 23:08:06 +08:00
|
|
|
|
2015-08-19 19:40:56 +08:00
|
|
|
ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
|
2016-06-21 21:00:37 +08:00
|
|
|
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
|
|
|
|
ZEND_API ZEND_COLD void zend_type_error(const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2);
|
|
|
|
ZEND_API ZEND_COLD void zend_internal_type_error(zend_bool throw_exception, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
|
2016-08-31 03:09:26 +08:00
|
|
|
ZEND_API ZEND_COLD void zend_internal_argument_count_error(zend_bool throw_exception, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
|
2000-04-19 23:08:06 +08:00
|
|
|
|
2015-08-26 23:29:42 +08:00
|
|
|
ZEND_COLD void zenderror(const char *error);
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2002-03-13 03:41:02 +08:00
|
|
|
/* The following #define is used for code duality in PHP for Engine 1 & 2 */
|
2002-03-13 03:36:24 +08:00
|
|
|
#define ZEND_STANDARD_CLASS_DEF_PTR zend_standard_class_def
|
2002-03-12 18:08:47 +08:00
|
|
|
extern ZEND_API zend_class_entry *zend_standard_class_def;
|
2002-09-03 18:25:06 +08:00
|
|
|
extern ZEND_API zend_utility_values zend_uv;
|
1999-12-23 04:24:52 +08:00
|
|
|
extern ZEND_API zval zval_used_for_init;
|
1999-12-19 14:39:17 +08:00
|
|
|
|
2017-01-21 00:45:15 +08:00
|
|
|
/* If DTrace is available and enabled */
|
|
|
|
extern ZEND_API zend_bool zend_dtrace_enabled;
|
1999-12-04 21:26:57 +08:00
|
|
|
END_EXTERN_C()
|
1999-04-08 02:10:10 +08:00
|
|
|
|
|
|
|
#define ZEND_UV(name) (zend_uv.name)
|
|
|
|
|
2000-03-06 18:46:40 +08:00
|
|
|
BEGIN_EXTERN_C()
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_message_dispatcher(zend_long message, const void *data);
|
2000-03-06 18:46:40 +08:00
|
|
|
|
2014-09-02 00:57:33 +08:00
|
|
|
ZEND_API zval *zend_get_configuration_directive(zend_string *name);
|
2004-02-20 16:03:27 +08:00
|
|
|
END_EXTERN_C()
|
2000-03-06 03:50:10 +08:00
|
|
|
|
1999-04-08 02:10:10 +08:00
|
|
|
/* Messages for applications of Zend */
|
2000-06-13 00:07:15 +08:00
|
|
|
#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
|
2003-08-19 06:31:11 +08:00
|
|
|
#define ZMSG_MEMORY_LEAKS_GRAND_TOTAL 7L
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2008-03-09 05:54:03 +08:00
|
|
|
typedef enum {
|
|
|
|
EH_NORMAL = 0,
|
|
|
|
EH_SUPPRESS,
|
|
|
|
EH_THROW
|
|
|
|
} zend_error_handling_t;
|
|
|
|
|
2008-08-09 01:47:31 +08:00
|
|
|
typedef struct {
|
|
|
|
zend_error_handling_t handling;
|
|
|
|
zend_class_entry *exception;
|
2014-02-10 14:04:30 +08:00
|
|
|
zval user_handler;
|
2008-08-09 01:47:31 +08:00
|
|
|
} zend_error_handling;
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_save_error_handling(zend_error_handling *current);
|
|
|
|
ZEND_API void zend_replace_error_handling(zend_error_handling_t error_handling, zend_class_entry *exception_class, zend_error_handling *current);
|
|
|
|
ZEND_API void zend_restore_error_handling(zend_error_handling *saved);
|
2008-08-09 01:47:31 +08:00
|
|
|
|
2011-01-17 04:39:22 +08:00
|
|
|
#define DEBUG_BACKTRACE_PROVIDE_OBJECT (1<<0)
|
|
|
|
#define DEBUG_BACKTRACE_IGNORE_ARGS (1<<1)
|
|
|
|
|
2014-09-18 08:58:04 +08:00
|
|
|
#include "zend_object_handlers.h"
|
|
|
|
#include "zend_operators.h"
|
|
|
|
|
2000-07-03 07:54:19 +08:00
|
|
|
#endif /* ZEND_H */
|
1999-09-07 00:14:08 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
2003-02-01 09:49:15 +08:00
|
|
|
* indent-tabs-mode: t
|
1999-09-07 00:14:08 +08:00
|
|
|
* End:
|
|
|
|
*/
|