Merge branch 'master' into jsond

Conflicts:
	ext/json/JSON_parser.c
	ext/json/JSON_parser.h
	ext/json/config.m4
	ext/json/config.w32
	ext/json/json.c
	ext/json/php_json.h
This commit is contained in:
Jakub Zelenka 2014-12-27 19:42:04 +00:00
commit b68da91d52
1618 changed files with 33190 additions and 32817 deletions

11
NEWS
View file

@ -1,4 +1,4 @@
PHP NEWS
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 20??, PHP 7.0.0
@ -26,6 +26,13 @@ PHP NEWS
constructor). (dunglas at gmail dot com)
. Removed ZEND_ACC_FINAL_CLASS, promoting ZEND_ACC_FINAL as final class
modifier. (Guilherme Blanco)
. is_long() & is_integer() is now an alias of is_int(). (Kalle)
. Implemented FR #55467 (phpinfo: PHP Variables with $ and single quotes). (Kalle)
. Fixed bug #55415 (php_info produces invalid anchor names). (Kalle, Johannes)
. Added ?? operator. (Andrea)
. Added \u{xxxxx} Unicode Codepoint Escape Syntax. (Andrea)
. Fixed oversight where define() did not support arrays yet const syntax did. (Andrea, Dmitry)
. Use "integer" and "float" instead of "long" and "double" in ZPP, type hint and conversion error messages. (Andrea)
- Date:
. Fixed day_of_week function as it could sometimes return negative values
@ -65,7 +72,7 @@ PHP NEWS
statements option). (peter dot wolanin at acquia dot com)
- Reflection
. Fixed inheritance chain of Reflector interface (Tjerk)
. Fixed inheritance chain of Reflector interface. (Tjerk)
- Session:
. Fixed bug #67694 (Regression in session_regenerate_id()). (Tjerk)

View file

@ -22,6 +22,10 @@
typedef struct _tsrm_tls_entry tsrm_tls_entry;
#if defined(TSRM_WIN32)
/* TSRMLS_CACHE_DEFINE; is already done in Zend, this is being always compiled statically. */
#endif
struct _tsrm_tls_entry {
void **storage;
int count;
@ -177,7 +181,7 @@ TSRM_API void tsrm_shutdown(void)
for (j=0; j<p->count; j++) {
if (p->storage[j]) {
if (resource_types_table && !resource_types_table[j].done && resource_types_table[j].dtor) {
resource_types_table[j].dtor(p->storage[j], &p->storage);
resource_types_table[j].dtor(p->storage[j]);
}
free(p->storage[j]);
}
@ -252,7 +256,7 @@ TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate
for (j=p->count; j<id_count; j++) {
p->storage[j] = (void *) malloc(resource_types_table[j].size);
if (resource_types_table[j].ctor) {
resource_types_table[j].ctor(p->storage[j], &p->storage);
resource_types_table[j].ctor(p->storage[j]);
}
}
p->count = id_count;
@ -282,7 +286,7 @@ static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_
tsrm_tls_set(*thread_resources_ptr);
if (tsrm_new_thread_begin_handler) {
tsrm_new_thread_begin_handler(thread_id, &((*thread_resources_ptr)->storage));
tsrm_new_thread_begin_handler(thread_id);
}
for (i=0; i<id_count; i++) {
if (resource_types_table[i].done) {
@ -291,13 +295,13 @@ static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_
{
(*thread_resources_ptr)->storage[i] = (void *) malloc(resource_types_table[i].size);
if (resource_types_table[i].ctor) {
resource_types_table[i].ctor((*thread_resources_ptr)->storage[i], &(*thread_resources_ptr)->storage);
resource_types_table[i].ctor((*thread_resources_ptr)->storage[i]);
}
}
}
if (tsrm_new_thread_end_handler) {
tsrm_new_thread_end_handler(thread_id, &((*thread_resources_ptr)->storage));
tsrm_new_thread_end_handler(thread_id);
}
tsrm_mutex_unlock(tsmm_mutex);
@ -390,7 +394,7 @@ void tsrm_free_interpreter_context(void *context)
for (i=0; i<thread_resources->count; i++) {
if (resource_types_table[i].dtor) {
resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
resource_types_table[i].dtor(thread_resources->storage[i]);
}
}
for (i=0; i<thread_resources->count; i++) {
@ -455,7 +459,7 @@ void ts_free_thread(void)
if (thread_resources->thread_id == thread_id) {
for (i=0; i<thread_resources->count; i++) {
if (resource_types_table[i].dtor) {
resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
resource_types_table[i].dtor(thread_resources->storage[i]);
}
}
for (i=0; i<thread_resources->count; i++) {
@ -497,7 +501,7 @@ void ts_free_worker_threads(void)
if (thread_resources->thread_id != thread_id) {
for (i=0; i<thread_resources->count; i++) {
if (resource_types_table[i].dtor) {
resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
resource_types_table[i].dtor(thread_resources->storage[i]);
}
}
for (i=0; i<thread_resources->count; i++) {
@ -543,7 +547,7 @@ void ts_free_id(ts_rsrc_id id)
while (p) {
if (p->count > j && p->storage[j]) {
if (resource_types_table && resource_types_table[j].dtor) {
resource_types_table[j].dtor(p->storage[j], &p->storage);
resource_types_table[j].dtor(p->storage[j]);
}
free(p->storage[j]);
p->storage[j] = NULL;
@ -791,4 +795,9 @@ void tsrm_error_set(int level, char *debug_filename)
#endif
}
TSRM_API void *tsrm_get_ls_cache(void)
{
return tsrm_tls_get();
}
#endif /* ZTS */

View file

@ -94,8 +94,8 @@ typedef struct {
#include <signal.h>
#endif
typedef void (*ts_allocate_ctor)(void *, void ***);
typedef void (*ts_allocate_dtor)(void *, void ***);
typedef void (*ts_allocate_ctor)(void *);
typedef void (*ts_allocate_dtor)(void *);
#define THREAD_HASH_OF(thr,ts) (unsigned long)thr%(unsigned long)ts
@ -129,8 +129,8 @@ TSRM_API void ts_free_id(ts_rsrc_id id);
#define TSRM_ERROR_LEVEL_CORE 2
#define TSRM_ERROR_LEVEL_INFO 3
typedef void (*tsrm_thread_begin_func_t)(THREAD_T thread_id, void ***tsrm_ls);
typedef void (*tsrm_thread_end_func_t)(THREAD_T thread_id, void ***tsrm_ls);
typedef void (*tsrm_thread_begin_func_t)(THREAD_T thread_id);
typedef void (*tsrm_thread_end_func_t)(THREAD_T thread_id);
TSRM_API int tsrm_error(int level, const char *format, ...);
@ -155,17 +155,33 @@ TSRM_API void *tsrm_new_interpreter_context(void);
TSRM_API void *tsrm_set_interpreter_context(void *new_ctx);
TSRM_API void tsrm_free_interpreter_context(void *context);
TSRM_API void *tsrm_get_ls_cache(void);
#ifdef TSRM_WIN32
# define TSRM_TLS __declspec(thread)
#else
# define TSRM_TLS __thread
#endif
#define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1)
#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1)
#define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, NULL)
#define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx
#define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_ls
#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
#define TSRMLS_D void ***tsrm_ls
#define TSRMLS_DC , TSRMLS_D
#define TSRMLS_C tsrm_ls
#define TSRMLS_CC , TSRMLS_C
#define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_get_ls_cache()
#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_get_ls_cache()))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
#define TSRMG_STATIC(id, type, element) (((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
#define TSRMLS_CACHE_EXTERN extern TSRM_TLS void *TSRMLS_CACHE
#define TSRMLS_CACHE_DEFINE TSRM_TLS void *TSRMLS_CACHE = NULL
#define TSRMLS_CACHE_UPDATE if (!TSRMLS_CACHE) TSRMLS_CACHE = tsrm_get_ls_cache()
#define TSRMLS_CACHE _tsrm_ls_cache
/* BC only */
#define TSRMLS_D void
#define TSRMLS_DC
#define TSRMLS_C
#define TSRMLS_CC
#define TSRMLS_FETCH()
#ifdef __cplusplus
}
@ -176,6 +192,14 @@ TSRM_API void tsrm_free_interpreter_context(void *context);
#define TSRMLS_FETCH()
#define TSRMLS_FETCH_FROM_CTX(ctx)
#define TSRMLS_SET_CTX(ctx)
#define TSRMG_STATIC(id, type, element)
#define TSRMLS_CACHE_EXTERN
#define TSRMLS_CACHE_DEFINE
#define TSRMLS_CACHE_UPDATE
#define TSRMLS_CACHE
/* BC only */
#define TSRMLS_D void
#define TSRMLS_DC
#define TSRMLS_C

View file

@ -2,4 +2,5 @@
// $Id$
ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_win32.c");
ADD_FLAG("CFLAGS_BD_TSRM", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");

View file

@ -40,8 +40,11 @@ static ts_rsrc_id win32_globals_id;
static tsrm_win32_globals win32_globals;
#endif
static void tsrm_win32_ctor(tsrm_win32_globals *globals TSRMLS_DC)
static void tsrm_win32_ctor(tsrm_win32_globals *globals)
{
#ifdef ZTS
TSRMLS_CACHE_UPDATE;
#endif
globals->process = NULL;
globals->shm = NULL;
globals->process_size = 0;
@ -59,7 +62,7 @@ static void tsrm_win32_ctor(tsrm_win32_globals *globals TSRMLS_DC)
globals->impersonation_token_sid = NULL;
}
static void tsrm_win32_dtor(tsrm_win32_globals *globals TSRMLS_DC)
static void tsrm_win32_dtor(tsrm_win32_globals *globals)
{
shm_pair *ptr;
@ -92,18 +95,18 @@ TSRM_API void tsrm_win32_startup(void)
#ifdef ZTS
ts_allocate_id(&win32_globals_id, sizeof(tsrm_win32_globals), (ts_allocate_ctor)tsrm_win32_ctor, (ts_allocate_ctor)tsrm_win32_dtor);
#else
tsrm_win32_ctor(&win32_globals TSRMLS_CC);
tsrm_win32_ctor(&win32_globals);
#endif
}
TSRM_API void tsrm_win32_shutdown(void)
{
#ifndef ZTS
tsrm_win32_dtor(&win32_globals TSRMLS_CC);
tsrm_win32_dtor(&win32_globals);
#endif
}
char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC)
char * tsrm_win32_get_path_sid_key(const char *pathname)
{
PSID pSid = TWG(impersonation_token_sid);
TCHAR *ptcSid = NULL;
@ -191,7 +194,7 @@ Finished:
return NULL;
}
TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
TSRM_API int tsrm_win32_access(const char *pathname, int mode)
{
time_t t;
HANDLE thread_token = NULL;
@ -214,7 +217,7 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
} else {
if(!IS_ABSOLUTE_PATH(pathname, strlen(pathname)+1)) {
real_path = (char *)malloc(MAX_PATH);
if(tsrm_realpath(pathname, real_path TSRMLS_CC) == NULL) {
if(tsrm_realpath(pathname, real_path) == NULL) {
goto Finished;
}
pathname = real_path;
@ -278,14 +281,14 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
if (CWDG(realpath_cache_size_limit)) {
t = time(0);
bucket = realpath_cache_lookup(pathname, (int)strlen(pathname), t TSRMLS_CC);
bucket = realpath_cache_lookup(pathname, (int)strlen(pathname), t);
if(bucket == NULL && real_path == NULL) {
/* We used the pathname directly. Call tsrm_realpath */
/* so that entry is created in realpath cache */
real_path = (char *)malloc(MAX_PATH);
if(tsrm_realpath(pathname, real_path TSRMLS_CC) != NULL) {
if(tsrm_realpath(pathname, real_path) != NULL) {
pathname = real_path;
bucket = realpath_cache_lookup(pathname, (int)strlen(pathname), t TSRMLS_CC);
bucket = realpath_cache_lookup(pathname, (int)strlen(pathname), t);
}
}
}
@ -380,7 +383,7 @@ Finished:
}
static process_pair *process_get(FILE *stream TSRMLS_DC)
static process_pair *process_get(FILE *stream)
{
process_pair *ptr;
process_pair *newptr;
@ -410,7 +413,6 @@ static shm_pair *shm_get(int key, void *addr)
{
shm_pair *ptr;
shm_pair *newptr;
TSRMLS_FETCH();
for (ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) {
if (!ptr->descriptor) {
@ -448,12 +450,11 @@ static HANDLE dupHandle(HANDLE fh, BOOL inherit) {
TSRM_API FILE *popen(const char *command, const char *type)
{
TSRMLS_FETCH();
return popen_ex(command, type, NULL, NULL TSRMLS_CC);
return popen_ex(command, type, NULL, NULL);
}
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env TSRMLS_DC)
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env)
{
FILE *stream = NULL;
int fno, type_len, read, mode;
@ -550,7 +551,7 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
}
CloseHandle(process.hThread);
proc = process_get(NULL TSRMLS_CC);
proc = process_get(NULL);
if (read) {
fno = _open_osfhandle((tsrm_intptr_t)in, _O_RDONLY | mode);
@ -570,9 +571,8 @@ TSRM_API int pclose(FILE *stream)
{
DWORD termstat = 0;
process_pair *process;
TSRMLS_FETCH();
if ((process = process_get(stream TSRMLS_CC)) == NULL) {
if ((process = process_get(stream)) == NULL) {
return 0;
}

View file

@ -71,7 +71,8 @@ typedef struct {
} tsrm_win32_globals;
#ifdef ZTS
# define TWG(v) TSRMG(win32_globals_id, tsrm_win32_globals *, v)
# define TWG(v) TSRMG_STATIC(win32_globals_id, tsrm_win32_globals *, v)
TSRMLS_CACHE_EXTERN;
#else
# define TWG(v) (win32_globals.v)
#endif
@ -93,15 +94,15 @@ typedef struct {
#define SHM_RND FILE_MAP_WRITE
#define SHM_REMAP FILE_MAP_COPY
char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC);
char * tsrm_win32_get_path_sid_key(const char *pathname );
TSRM_API void tsrm_win32_startup(void);
TSRM_API void tsrm_win32_shutdown(void);
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env TSRMLS_DC);
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env);
TSRM_API FILE *popen(const char *command, const char *type);
TSRM_API int pclose(FILE *stream);
TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC);
TSRM_API int tsrm_win32_access(const char *pathname, int mode);
TSRM_API int win32_utime(const char *filename, struct utimbuf *buf);
TSRM_API int shmget(int key, int size, int flags);

View file

@ -22,8 +22,6 @@ PHP X.Y UPGRADE NOTES
========================================
- Core
. Added null coalesce operator (??).
(RFC: https://wiki.php.net/rfc/isset_ternary)
. list() now always supports ArrayAccess and never supports strings.
Previously both were accepted in some situations and not in others.
(RFC: https://wiki.php.net/rfc/fix_list_behavior_inconsistency)
@ -36,6 +34,23 @@ PHP X.Y UPGRADE NOTES
around.
. Removed ASP (<%) and script (<script language=php>) tags.
(RFC: https://wiki.php.net/rfc/remove_alternative_php_tags)
. call_user_method() and call_user_method_array() no longer exists.
. PHP 7 doesn't keep original values of arguments passed to user functions,
so func_get_arg() and func_get_args() will return current value of argument
instead of the actually passed. The following code is going to be affected:
function foo($x) { $x = 2; return func_get_arg(0);} var_dump(foo(1));
It will now produce 2, not 1.
. Function parameters with duplicate name are not allowed anymore. Definitions
like “function foo($x,$x) {}” will lead to compile time error.
. Indirect variable, property and method references are now interpreted with
left-to-right semantics. See details in:
https://wiki.php.net/rfc/uniform_variable_syntax#semantic_differences_in_existing_syntax
. The global keyword now only accepts simple variables. See details in:
https://wiki.php.net/rfc/uniform_variable_syntax#global_keyword_takes_only_simple_variables
. The addition of Unicode Codepoint Escape Syntax for double-quoted strings
and heredocs means that \u{ followed by an invalid sequence will now error.
However, \u without a following { is unaffected, so "\u202e" won't error and
will work the same as before.
- DBA
. dba_delete() now returns false if the key was not found for the inifile
@ -51,8 +66,13 @@ PHP X.Y UPGRADE NOTES
========================================
- Core
. Support for strings with length >= 2^31 bytes in 64 bit builds
. Closure::call() method added
. Added null coalesce operator (??).
(RFC: https://wiki.php.net/rfc/isset_ternary)
. Support for strings with length >= 2^31 bytes in 64 bit builds.
. Closure::call() method added.
. Added \u{xxxxxx} Unicode Codepoint Escape Syntax for double-quoted strings
and heredocs.
. define() now supports arrays as constant values, fixing an oversight where define() did not support arrays yet const syntax did.
- Standard
. intdiv() function for integer division added.
@ -76,19 +96,19 @@ PHP X.Y UPGRADE NOTES
- parse_ini_file():
- parse_ini_string():
Added scanner mode INI_SCANNER_TYPED to yield typed .ini values.
. Added scanner mode INI_SCANNER_TYPED to yield typed .ini values.
- unserialize():
Added second parameter for unserialize function
(RFC: https://wiki.php.net/rfc/secure_unserialize) allowing to specify
acceptable classes:
unserialize($foo, ["allowed_classes" => ["MyClass", "MyClass2"]);
. Added second parameter for unserialize function
(RFC: https://wiki.php.net/rfc/secure_unserialize) allowing to specify
acceptable classes:
unserialize($foo, ["allowed_classes" => ["MyClass", "MyClass2"]);
========================================
6. New Functions
========================================
- GMP
Added gmp_random_seed()
. Added gmp_random_seed()
========================================
7. New Classes and Interfaces
@ -125,8 +145,8 @@ PHP X.Y UPGRADE NOTES
========================================
- Core
. Support for native 64 bit integers in 64 bit builds
. Support for large files in 64 bit builds
. Support for native 64 bit integers in 64 bit builds.
. Support for large files in 64 bit builds.
========================================
13. Other Changes
@ -136,7 +156,5 @@ PHP X.Y UPGRADE NOTES
. Instead of being undefined and platform-dependent, NaN and Infinity will
always be zero when casted to integer.
. Calling a method on a non-object no longer raises a fatal error; see
also: https://wiki.php.net/rfc/catchable-call-to-member-of-non-object
- Standard
. call_user_method() and call_user_method_array() no longer exists.
also: https://wiki.php.net/rfc/catchable-call-to-member-of-non-object.
. Error messages for zend_parse_parameters, type hints and conversions now always say "integer" and "float" instead of "long" and "double".

View file

@ -14,6 +14,7 @@ PHP 7.0 INTERNALS UPGRADE NOTES
m. Other portable macros info
n. ZEND_ENGINE_2 removal
o. Updated final class modifier
p. TSRM changes
2. Build system changes
a. Unix build system changes
@ -128,6 +129,47 @@ PHP 7.0 INTERNALS UPGRADE NOTES
o. Removed ZEND_ACC_FINAL_CLASS in favour of ZEND_ACC_FINAL, turning final class
modifier now a different class entry flag. Update your extensions.
p. TSRM changes
The TSRM layer undergone significant changes. It is not necessary anymore to
pass the tsrm_ls pointer explicitly. The TSRMLS_* macros should not be used
in any new developments.
The recommended way accessing globals in TS builds is by implementing it
to use a local thread unique pointer to the corresponding data pool. These
are the new macros that serve to achieve this goal:
- ZEND_TSRMG - based on TSRMG and if static pointer for data pool access is
implemented, will use it
- ZEND_TSRMLS_CACHE_EXTERN - to be used in a header shared across multiple
C/C++ files
- ZEND_TSRMLS_CACHE_DEFINE - to be used in the main extension C/C++ file
- ZEND_TSRMLS_CACHE_UPDATE - to be integrated at the top of the globals
ctor or RINIT function
- ZEND_ENABLE_STATIC_TSRMLS_CACHE - to be used in the config.[m4|w32] for
enabling the globals access per thread unique pointer
- TSRMLS_CACHE - expands to the variable name which links to the thread
unique data pool
Note that usually it will work without implementing the globals access per
a thread unique pointer, however it might cause a slowdown. The reason is
that the access model to the extension/SAPI own globals as well as the
access to the core globals is determined in the compilation phase depending
on whether ZEND_ENABLE_STATIC_TSRMLS_CACHE macro is defined.
Due to the current compiler evolution state, the TSRMLS_CACHE pointer
(when implemented) has to be present and updated in every binary unit which
is not compiled statically into PHP. So any DLL, DSO, EXE, etc. has to take
care about defining and updating it's TSRMLS cache. An update should happen
before any globals was accessed.
Porting an extension or SAPI is usually as easy as removing all the TSRMLS_*
ocurrences and integrating the macros mentioned above. However if tsrm_ls
is used explicitly, its usage can considered obsolete in most cases.
Additionally, if an extension triggers its own threads, TSRMLS_CACHE shouldn't
be passed to that threads directly.
========================
2. Build system changes
========================

View file

@ -20,6 +20,7 @@ libZend_la_SOURCES=\
zend_strtod.c zend_closures.c zend_float.c zend_string.c zend_signal.c \
zend_generators.c zend_virtual_cwd.c zend_ast.c
libZend_la_CFLAGS = -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1
libZend_la_LDFLAGS =
libZend_la_LIBADD = @ZEND_EXTRA_LIBS@

View file

@ -41,11 +41,9 @@ bool(true)
Notice: Constant test const already defined in %s on line %d
bool(false)
bool(true)
Warning: Constants may only evaluate to scalar values in %s on line %d
bool(false)
Warning: Constants may only evaluate to scalar values in %s on line %d
Warning: Constants may only evaluate to scalar values or arrays in %s on line %d
bool(false)
int(1)
int(2)

View file

@ -26,5 +26,5 @@ object(Foo)#1 (1) {
Notice: Object of class Foo could not be converted to int in %sbug33999.php on line 9
int(1)
Notice: Object of class Foo could not be converted to double in %sbug33999.php on line 12
Notice: Object of class Foo could not be converted to float in %sbug33999.php on line 12
float(1)

View file

@ -21,7 +21,7 @@ var_dump(Baz);
--EXPECTF--
string(3) "Foo"
Warning: Constants may only evaluate to scalar values in %sbug37811.php on line %d
Warning: Constants may only evaluate to scalar values or arrays in %sbug37811.php on line %d
Notice: Use of undefined constant Baz - assumed 'Baz' in %sbug37811.php on line %d
string(3) "Baz"

View file

@ -15,5 +15,6 @@ eval("class $a {}");
if ($a instanceof $a); // Segmentation fault
new $a; // Segmentation fault
echo "ok\n";
?>
--EXPECT--
ok

20
Zend/tests/bug67111.phpt Normal file
View file

@ -0,0 +1,20 @@
--TEST--
Bug #67111: Memory leak when using "continue 2" inside two foreach loops
--FILE--
<?php
$array1 = [1, 2, 3];
$array2 = [1, 2, 3];
foreach ($array1 as $x) {
foreach ($array2 as $y) {
echo "$x.$y\n";
continue 2;
}
}
?>
--EXPECT--
1.1
2.1
3.1

View file

@ -52,6 +52,6 @@ float(1)
float(0)
float(%d)
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
float(1)
Done

View file

@ -118,13 +118,13 @@ float(2.5) != NULL
float(2.5) == bool(true)
float(2.5) != bool(false)
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
!= object(stdClass)#1 (0) {}
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
!= object(stdClass)#2 (0) {}
float(2.5)
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
!= object(test)#3 (0) {}
float(2.5) != array(0) {}
float(2.5) != int(-2147483648)
@ -260,7 +260,7 @@ object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
== int(1)
object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
!= float(2.5)
object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -285,7 +285,7 @@ object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
== int(1)
object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
!= float(2.5)
object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -310,7 +310,7 @@ object(test)#3 (0) {}
Notice: Object of class test could not be converted to int in %s on line %d
== int(1)
object(test)#3 (0) {}
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
!= float(2.5)
object(test)#3 (0) {}
Notice: Object of class test could not be converted to int in %s on line %d

View file

@ -118,13 +118,13 @@ float(2.5) != NULL
float(2.5) == bool(true)
float(2.5) != bool(false)
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
!= object(stdClass)#%d (0) {}
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
!= object(stdClass)#%d (0) {}
float(2.5)
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
!= object(test)#%d (0) {}
float(2.5) != array(0) {}
float(2.5) != int(-9223372036854775808)
@ -260,7 +260,7 @@ object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
== int(1)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
!= float(2.5)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -285,7 +285,7 @@ object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
== int(1)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
!= float(2.5)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -310,7 +310,7 @@ object(test)#%d (0) {}
Notice: Object of class test could not be converted to int in %s on line %d
== int(1)
object(test)#%d (0) {}
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
!= float(2.5)
object(test)#%d (0) {}
Notice: Object of class test could not be converted to int in %s on line %d

View file

@ -118,13 +118,13 @@ float(2.5) > NULL
float(2.5) <= bool(true)
float(2.5) > bool(false)
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
> object(stdClass)#1 (0) {}
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
> object(stdClass)#2 (0) {}
float(2.5)
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
> object(test)#3 (0) {}
float(2.5) <= array(0) {}
float(2.5) > int(-2147483648)
@ -260,7 +260,7 @@ object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
<= int(1)
object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
<= float(2.5)
object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -285,7 +285,7 @@ object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
<= int(1)
object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
<= float(2.5)
object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -310,7 +310,7 @@ object(test)#3 (0) {}
Notice: Object of class test could not be converted to int in %s on line %d
<= int(1)
object(test)#3 (0) {}
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
<= float(2.5)
object(test)#3 (0) {}
Notice: Object of class test could not be converted to int in %s on line %d

View file

@ -118,13 +118,13 @@ float(2.5) > NULL
float(2.5) <= bool(true)
float(2.5) > bool(false)
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
> object(stdClass)#%d (0) {}
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
> object(stdClass)#%d (0) {}
float(2.5)
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
> object(test)#%d (0) {}
float(2.5) <= array(0) {}
float(2.5) > int(-9223372036854775808)
@ -260,7 +260,7 @@ object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
<= int(1)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
<= float(2.5)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -285,7 +285,7 @@ object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
<= int(1)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
<= float(2.5)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -310,7 +310,7 @@ object(test)#%d (0) {}
Notice: Object of class test could not be converted to int in %s on line %d
<= int(1)
object(test)#%d (0) {}
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
<= float(2.5)
object(test)#%d (0) {}
Notice: Object of class test could not be converted to int in %s on line %d

View file

@ -118,13 +118,13 @@ float(2.5) >= NULL
float(2.5) >= bool(true)
float(2.5) >= bool(false)
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
>= object(stdClass)#1 (0) {}
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
>= object(stdClass)#2 (0) {}
float(2.5)
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
>= object(test)#3 (0) {}
float(2.5) < array(0) {}
float(2.5) >= int(-2147483648)
@ -260,7 +260,7 @@ object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
>= int(1)
object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
< float(2.5)
object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -285,7 +285,7 @@ object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
>= int(1)
object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
< float(2.5)
object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -310,7 +310,7 @@ object(test)#3 (0) {}
Notice: Object of class test could not be converted to int in %s on line %d
>= int(1)
object(test)#3 (0) {}
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
< float(2.5)
object(test)#3 (0) {}
Notice: Object of class test could not be converted to int in %s on line %d

View file

@ -118,13 +118,13 @@ float(2.5) >= NULL
float(2.5) >= bool(true)
float(2.5) >= bool(false)
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
>= object(stdClass)#%d (0) {}
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
>= object(stdClass)#%d (0) {}
float(2.5)
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
>= object(test)#%d (0) {}
float(2.5) < array(0) {}
float(2.5) >= int(-9223372036854775808)
@ -260,7 +260,7 @@ object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
>= int(1)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
< float(2.5)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -285,7 +285,7 @@ object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
>= int(1)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
< float(2.5)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -310,7 +310,7 @@ object(test)#%d (0) {}
Notice: Object of class test could not be converted to int in %s on line %d
>= int(1)
object(test)#%d (0) {}
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
< float(2.5)
object(test)#%d (0) {}
Notice: Object of class test could not be converted to int in %s on line %d

View file

@ -118,13 +118,13 @@ float(2.5) >= NULL
float(2.5) >= bool(true)
float(2.5) >= bool(false)
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
>= object(stdClass)#1 (0) {}
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
>= object(stdClass)#2 (0) {}
float(2.5)
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
>= object(test)#3 (0) {}
float(2.5) < array(0) {}
float(2.5) >= int(-2147483648)
@ -260,7 +260,7 @@ object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
>= int(1)
object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
< float(2.5)
object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -285,7 +285,7 @@ object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
>= int(1)
object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
< float(2.5)
object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -310,7 +310,7 @@ object(test)#3 (0) {}
Notice: Object of class test could not be converted to int in %s on line %d
>= int(1)
object(test)#3 (0) {}
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
< float(2.5)
object(test)#3 (0) {}
Notice: Object of class test could not be converted to int in %s on line %d

View file

@ -118,13 +118,13 @@ float(2.5) >= NULL
float(2.5) >= bool(true)
float(2.5) >= bool(false)
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
>= object(stdClass)#%d (0) {}
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
>= object(stdClass)#%d (0) {}
float(2.5)
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
>= object(test)#%d (0) {}
float(2.5) < array(0) {}
float(2.5) >= int(-9223372036854775808)
@ -260,7 +260,7 @@ object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
>= int(1)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
< float(2.5)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -285,7 +285,7 @@ object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
>= int(1)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
< float(2.5)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -310,7 +310,7 @@ object(test)#%d (0) {}
Notice: Object of class test could not be converted to int in %s on line %d
>= int(1)
object(test)#%d (0) {}
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
< float(2.5)
object(test)#%d (0) {}
Notice: Object of class test could not be converted to int in %s on line %d

View file

@ -118,13 +118,13 @@ float(2.5) > NULL
float(2.5) <= bool(true)
float(2.5) > bool(false)
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
> object(stdClass)#1 (0) {}
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
> object(stdClass)#2 (0) {}
float(2.5)
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
> object(test)#3 (0) {}
float(2.5) <= array(0) {}
float(2.5) > int(-2147483648)
@ -260,7 +260,7 @@ object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
<= int(1)
object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
<= float(2.5)
object(stdClass)#1 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -285,7 +285,7 @@ object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
<= int(1)
object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
<= float(2.5)
object(stdClass)#2 (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -310,7 +310,7 @@ object(test)#3 (0) {}
Notice: Object of class test could not be converted to int in %s on line %d
<= int(1)
object(test)#3 (0) {}
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
<= float(2.5)
object(test)#3 (0) {}
Notice: Object of class test could not be converted to int in %s on line %d

View file

@ -118,13 +118,13 @@ float(2.5) > NULL
float(2.5) <= bool(true)
float(2.5) > bool(false)
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
> object(stdClass)#%d (0) {}
float(2.5)
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
> object(stdClass)#%d (0) {}
float(2.5)
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
> object(test)#%d (0) {}
float(2.5) <= array(0) {}
float(2.5) > int(-9223372036854775808)
@ -260,7 +260,7 @@ object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
<= int(1)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
<= float(2.5)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -285,7 +285,7 @@ object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
<= int(1)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to double in %s on line %d
Notice: Object of class stdClass could not be converted to float in %s on line %d
<= float(2.5)
object(stdClass)#%d (0) {}
Notice: Object of class stdClass could not be converted to int in %s on line %d
@ -310,7 +310,7 @@ object(test)#%d (0) {}
Notice: Object of class test could not be converted to int in %s on line %d
<= int(1)
object(test)#%d (0) {}
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
<= float(2.5)
object(test)#%d (0) {}
Notice: Object of class test could not be converted to int in %s on line %d

View file

@ -0,0 +1,99 @@
--TEST--
Constant arrays
--FILE--
<?php
define('FOOBAR', [1, 2, 3, ['foo' => 'bar']]);
const FOO_BAR = [1, 2, 3, ['foo' => 'bar']];
$x = FOOBAR;
$x[0] = 7;
var_dump($x, FOOBAR);
$x = FOO_BAR;
$x[0] = 7;
var_dump($x, FOO_BAR);
// ensure references are removed
$x = 7;
$y = [&$x];
define('QUX', $y);
$y[0] = 3;
var_dump($x, $y, QUX);
// ensure objects not allowed in arrays
var_dump(define('ELEPHPANT', [new StdClass]));
// ensure recursion doesn't crash
$recursive = [];
$recursive[0] = &$recursive;
var_dump(define('RECURSION', $recursive));
--EXPECTF--
array(4) {
[0]=>
int(7)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
array(1) {
["foo"]=>
string(3) "bar"
}
}
array(4) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
array(1) {
["foo"]=>
string(3) "bar"
}
}
array(4) {
[0]=>
int(7)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
array(1) {
["foo"]=>
string(3) "bar"
}
}
array(4) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
array(1) {
["foo"]=>
string(3) "bar"
}
}
int(3)
array(1) {
[0]=>
int(3)
}
array(1) {
[0]=>
int(7)
}
Warning: Constants may only evaluate to scalar values or arrays in %s on line %d
bool(false)
Warning: Constants cannot be recursive arrays in %s on line %d
bool(false)

View file

@ -11,7 +11,7 @@ var_dump(foo);
?>
--EXPECTF--
Warning: Constants may only evaluate to scalar values in %s on line %d
Warning: Constants may only evaluate to scalar values or arrays in %s on line %d
Notice: Use of undefined constant foo - assumed 'foo' in %s on line %d
string(%d) "foo"

View file

@ -49,10 +49,10 @@ bool(true)
Notice: Object of class Bar could not be converted to int in %s on line %d
bool(false)
Notice: Object of class Bar could not be converted to double in %s on line %d
Notice: Object of class Bar could not be converted to float in %s on line %d
bool(true)
Notice: Object of class Bar could not be converted to double in %s on line %d
Notice: Object of class Bar could not be converted to float in %s on line %d
bool(false)
Notice: Object of class Bar could not be converted to int in %s on line %d

View file

@ -52,6 +52,6 @@ float(1)
float(0)
float(%d)
Notice: Object of class test could not be converted to double in %s on line %d
Notice: Object of class test could not be converted to float in %s on line %d
float(1)
Done

View file

@ -48,20 +48,20 @@
ZEND_API zend_class_entry *zend_standard_class_def = NULL;
ZEND_API size_t (*zend_printf)(const char *format, ...);
ZEND_API zend_write_func_t zend_write;
ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC);
ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path);
ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle);
ZEND_API void (*zend_block_interruptions)(void);
ZEND_API void (*zend_unblock_interruptions)(void);
ZEND_API void (*zend_ticks_function)(int ticks TSRMLS_DC);
ZEND_API void (*zend_ticks_function)(int ticks);
ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
size_t (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
zend_string *(*zend_vstrpprintf)(size_t max_len, const char *format, va_list ap);
ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
ZEND_API char *(*zend_getenv)(char *name, size_t name_len);
ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len);
void (*zend_on_timeout)(int seconds TSRMLS_DC);
void (*zend_on_timeout)(int seconds);
static void (*zend_message_dispatcher_p)(zend_long message, const void *data TSRMLS_DC);
static void (*zend_message_dispatcher_p)(zend_long message, const void *data);
static zval *(*zend_get_configuration_directive_p)(zend_string *name);
static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
@ -77,10 +77,10 @@ static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
static ZEND_INI_MH(OnUpdateGCEnabled) /* {{{ */
{
OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
if (GC_G(gc_enabled)) {
gc_init(TSRMLS_C);
gc_init();
}
return SUCCESS;
@ -92,10 +92,10 @@ static ZEND_INI_MH(OnUpdateScriptEncoding) /* {{{ */
if (!CG(multibyte)) {
return FAILURE;
}
if (!zend_multibyte_get_functions(TSRMLS_C)) {
if (!zend_multibyte_get_functions()) {
return SUCCESS;
}
return zend_multibyte_set_script_encoding_by_string(new_value->val, new_value->len TSRMLS_CC);
return zend_multibyte_set_script_encoding_by_string(new_value->val, new_value->len);
}
/* }}} */
@ -120,6 +120,7 @@ static HashTable *global_class_table = NULL;
static HashTable *global_constants_table = NULL;
static HashTable *global_auto_globals_table = NULL;
static HashTable *global_persistent_list = NULL;
ZEND_TSRMLS_CACHE_DEFINE;
#endif
ZEND_API zend_utility_values zend_uv;
@ -130,7 +131,7 @@ static uint zend_version_info_length;
#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2014 Zend Technologies\n"
#define PRINT_ZVAL_INDENT 4
static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, zend_bool is_object TSRMLS_DC) /* {{{ */
static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, zend_bool is_object) /* {{{ */
{
zval *tmp;
zend_string *string_key;
@ -178,7 +179,7 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
ZEND_PUTS_EX(key);
}
ZEND_PUTS_EX("] => ");
zend_print_zval_r_ex(write_func, tmp, indent+PRINT_ZVAL_INDENT TSRMLS_CC);
zend_print_zval_r_ex(write_func, tmp, indent+PRINT_ZVAL_INDENT);
ZEND_PUTS_EX("\n");
} ZEND_HASH_FOREACH_END();
indent -= PRINT_ZVAL_INDENT;
@ -189,7 +190,7 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
}
/* }}} */
static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */
static void print_flat_hash(HashTable *ht) /* {{{ */
{
zval *tmp;
zend_string *string_key;
@ -207,29 +208,29 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */
zend_printf(ZEND_ULONG_FMT, num_key);
}
ZEND_PUTS("] => ");
zend_print_flat_zval_r(tmp TSRMLS_CC);
zend_print_flat_zval_r(tmp);
} ZEND_HASH_FOREACH_END();
}
/* }}} */
ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy TSRMLS_DC) /* {{{ */
ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy) /* {{{ */
{
if (Z_TYPE_P(expr) == IS_STRING) {
return 0;
} else {
ZVAL_STR(expr_copy, _zval_get_string_func(expr TSRMLS_CC));
ZVAL_STR(expr_copy, _zval_get_string_func(expr));
return 1;
}
}
/* }}} */
ZEND_API size_t zend_print_zval(zval *expr, int indent TSRMLS_DC) /* {{{ */
ZEND_API size_t zend_print_zval(zval *expr, int indent) /* {{{ */
{
return zend_print_zval_ex(zend_write, expr, indent TSRMLS_CC);
return zend_print_zval_ex(zend_write, expr, indent);
}
/* }}} */
ZEND_API size_t zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC) /* {{{ */
ZEND_API size_t zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent) /* {{{ */
{
zend_string *str = zval_get_string(expr);
size_t len = str->len;
@ -243,7 +244,7 @@ ZEND_API size_t zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int
}
/* }}} */
ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */
ZEND_API void zend_print_flat_zval_r(zval *expr) /* {{{ */
{
switch (Z_TYPE_P(expr)) {
case IS_ARRAY:
@ -254,7 +255,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */
Z_ARRVAL_P(expr)->u.v.nApplyCount--;
return;
}
print_flat_hash(Z_ARRVAL_P(expr) TSRMLS_CC);
print_flat_hash(Z_ARRVAL_P(expr));
ZEND_PUTS(")");
if (ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(expr))) {
Z_ARRVAL_P(expr)->u.v.nApplyCount--;
@ -263,7 +264,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */
case IS_OBJECT:
{
HashTable *properties = NULL;
zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr) TSRMLS_CC);
zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr));
zend_printf("%s Object (", class_name->val);
zend_string_release(class_name);
@ -276,26 +277,26 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */
properties->u.v.nApplyCount--;
return;
}
print_flat_hash(properties TSRMLS_CC);
print_flat_hash(properties);
properties->u.v.nApplyCount--;
}
ZEND_PUTS(")");
break;
}
default:
zend_print_variable(expr TSRMLS_CC);
zend_print_variable(expr);
break;
}
}
/* }}} */
ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC) /* {{{ */
ZEND_API void zend_print_zval_r(zval *expr, int indent) /* {{{ */
{
zend_print_zval_r_ex(zend_write, expr, indent TSRMLS_CC);
zend_print_zval_r_ex(zend_write, expr, indent);
}
/* }}} */
ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC) /* {{{ */
ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent) /* {{{ */
{
ZVAL_DEREF(expr);
switch (Z_TYPE_P(expr)) {
@ -307,7 +308,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
Z_ARRVAL_P(expr)->u.v.nApplyCount--;
return;
}
print_hash(write_func, Z_ARRVAL_P(expr), indent, 0 TSRMLS_CC);
print_hash(write_func, Z_ARRVAL_P(expr), indent, 0);
if (ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(expr))) {
Z_ARRVAL_P(expr)->u.v.nApplyCount--;
}
@ -317,7 +318,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
HashTable *properties;
int is_temp;
zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr) TSRMLS_CC);
zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr));
ZEND_PUTS_EX(class_name->val);
zend_string_release(class_name);
@ -330,7 +331,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
properties->u.v.nApplyCount--;
return;
}
print_hash(write_func, properties, indent, 1 TSRMLS_CC);
print_hash(write_func, properties, indent, 1);
properties->u.v.nApplyCount--;
if (is_temp) {
zend_hash_destroy(properties);
@ -339,13 +340,13 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
break;
}
default:
zend_print_zval_ex(write_func, expr, indent TSRMLS_CC);
zend_print_zval_ex(write_func, expr, indent);
break;
}
}
/* }}} */
static FILE *zend_fopen_wrapper(const char *filename, char **opened_path TSRMLS_DC) /* {{{ */
static FILE *zend_fopen_wrapper(const char *filename, char **opened_path) /* {{{ */
{
if (opened_path) {
*opened_path = estrdup(filename);
@ -362,7 +363,7 @@ static uint32_t compiler_options_default = ZEND_COMPILE_DEFAULT;
# define compiler_options_default ZEND_COMPILE_DEFAULT
#endif
static void zend_set_default_compile_time_values(TSRMLS_D) /* {{{ */
static void zend_set_default_compile_time_values(void) /* {{{ */
{
/* default compile-time values */
CG(short_tags) = short_tags_default;
@ -370,7 +371,7 @@ static void zend_set_default_compile_time_values(TSRMLS_D) /* {{{ */
}
/* }}} */
static void zend_init_exception_op(TSRMLS_D) /* {{{ */
static void zend_init_exception_op(void) /* {{{ */
{
memset(EG(exception_op), 0, sizeof(EG(exception_op)));
EG(exception_op)[0].opcode = ZEND_HANDLE_EXCEPTION;
@ -400,7 +401,7 @@ static void function_copy_ctor(zval *zv)
function_add_ref(Z_FUNC_P(zv));
}
static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS_DC) /* {{{ */
static void compiler_globals_ctor(zend_compiler_globals *compiler_globals) /* {{{ */
{
compiler_globals->compiled_filename = NULL;
@ -412,7 +413,7 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS
zend_hash_init_ex(compiler_globals->class_table, 64, NULL, ZEND_CLASS_DTOR, 1, 0);
zend_hash_copy(compiler_globals->class_table, global_class_table, zend_class_add_ref);
zend_set_default_compile_time_values(TSRMLS_C);
zend_set_default_compile_time_values();
compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable));
zend_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, 0);
@ -427,14 +428,14 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS
compiler_globals->script_encoding_list = NULL;
#ifdef ZTS
zend_interned_empty_string_init(&compiler_globals->empty_string TSRMLS_CC);
zend_interned_empty_string_init(&compiler_globals->empty_string);
memset(compiler_globals->one_char_string, 0, sizeof(compiler_globals->one_char_string));
#endif
}
/* }}} */
static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS_DC) /* {{{ */
static void compiler_globals_dtor(zend_compiler_globals *compiler_globals) /* {{{ */
{
if (compiler_globals->function_table != GLOBAL_FUNCTION_TABLE) {
zend_hash_destroy(compiler_globals->function_table);
@ -457,17 +458,18 @@ static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS
compiler_globals->last_static_member = 0;
#ifdef ZTS
zend_interned_empty_string_free(&compiler_globals->empty_string TSRMLS_CC);
zend_interned_empty_string_free(&compiler_globals->empty_string);
#endif
}
/* }}} */
static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS_DC) /* {{{ */
static void executor_globals_ctor(zend_executor_globals *executor_globals) /* {{{ */
{
zend_startup_constants(TSRMLS_C);
ZEND_TSRMLS_CACHE_UPDATE;
zend_startup_constants();
zend_copy_constants(EG(zend_constants), GLOBAL_CONSTANTS_TABLE);
zend_init_rsrc_plist(TSRMLS_C);
zend_init_exception_op(TSRMLS_C);
zend_init_rsrc_plist();
zend_init_exception_op();
EG(lambda_count) = 0;
ZVAL_UNDEF(&EG(user_error_handler));
ZVAL_UNDEF(&EG(user_exception_handler));
@ -483,11 +485,15 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS
}
/* }}} */
static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC) /* {{{ */
static void executor_globals_dtor(zend_executor_globals *executor_globals) /* {{{ */
{
zend_ini_shutdown(TSRMLS_C);
#ifdef ZTS
zend_ini_dtor(executor_globals->ini_directives);
#else
zend_ini_shutdown();
#endif
if (&executor_globals->persistent_list != global_persistent_list) {
zend_destroy_rsrc_list(&executor_globals->persistent_list TSRMLS_CC);
zend_destroy_rsrc_list(&executor_globals->persistent_list);
}
if (executor_globals->zend_constants != GLOBAL_CONSTANTS_TABLE) {
zend_hash_destroy(executor_globals->zend_constants);
@ -496,10 +502,10 @@ static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS
}
/* }}} */
static void zend_new_thread_end_handler(THREAD_T thread_id TSRMLS_DC) /* {{{ */
static void zend_new_thread_end_handler(THREAD_T thread_id) /* {{{ */
{
if (zend_copy_ini_directives(TSRMLS_C) == SUCCESS) {
zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC);
if (zend_copy_ini_directives() == SUCCESS) {
zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP);
}
}
/* }}} */
@ -510,13 +516,13 @@ static void zend_new_thread_end_handler(THREAD_T thread_id TSRMLS_DC) /* {{{ */
#include <floatingpoint.h>
#endif
static void ini_scanner_globals_ctor(zend_ini_scanner_globals *scanner_globals_p TSRMLS_DC) /* {{{ */
static void ini_scanner_globals_ctor(zend_ini_scanner_globals *scanner_globals_p) /* {{{ */
{
memset(scanner_globals_p, 0, sizeof(*scanner_globals_p));
}
/* }}} */
static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p TSRMLS_DC) /* {{{ */
static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p) /* {{{ */
{
memset(scanner_globals_p, 0, sizeof(*scanner_globals_p));
}
@ -539,7 +545,7 @@ static void auto_global_dtor(zval *zv) /* {{{ */
}
/* }}} */
static zend_bool php_auto_globals_create_globals(zend_string *name TSRMLS_DC) /* {{{ */
static zend_bool php_auto_globals_create_globals(zend_string *name) /* {{{ */
{
zval globals;
@ -550,19 +556,20 @@ static zend_bool php_auto_globals_create_globals(zend_string *name TSRMLS_DC) /*
}
/* }}} */
int zend_startup(zend_utility_functions *utility_functions, char **extensions TSRMLS_DC) /* {{{ */
int zend_startup(zend_utility_functions *utility_functions, char **extensions) /* {{{ */
{
#ifdef ZTS
zend_compiler_globals *compiler_globals;
zend_executor_globals *executor_globals;
extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
extern ZEND_API ts_rsrc_id language_scanner_globals_id;
ZEND_TSRMLS_CACHE_UPDATE;
#else
extern zend_ini_scanner_globals ini_scanner_globals;
extern zend_php_scanner_globals language_scanner_globals;
#endif
start_memory_manager(TSRMLS_C);
start_memory_manager();
virtual_cwd_startup(); /* Could use shutdown to free the main cwd but it would just slow it down for CGI */
@ -636,7 +643,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions TS
compiler_globals = ts_resource(compiler_globals_id);
executor_globals = ts_resource(executor_globals_id);
compiler_globals_dtor(compiler_globals TSRMLS_CC);
compiler_globals_dtor(compiler_globals);
compiler_globals->in_compilation = 0;
compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
@ -648,24 +655,24 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions TS
zend_hash_destroy(executor_globals->zend_constants);
*executor_globals->zend_constants = *GLOBAL_CONSTANTS_TABLE;
#else
ini_scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC);
php_scanner_globals_ctor(&language_scanner_globals TSRMLS_CC);
zend_set_default_compile_time_values(TSRMLS_C);
ini_scanner_globals_ctor(&ini_scanner_globals);
php_scanner_globals_ctor(&language_scanner_globals);
zend_set_default_compile_time_values();
ZVAL_UNDEF(&EG(user_error_handler));
ZVAL_UNDEF(&EG(user_exception_handler));
#endif
zend_interned_strings_init(TSRMLS_C);
zend_startup_builtin_functions(TSRMLS_C);
zend_register_standard_constants(TSRMLS_C);
zend_register_auto_global(zend_string_init("GLOBALS", sizeof("GLOBALS") - 1, 1), 1, php_auto_globals_create_globals TSRMLS_CC);
zend_interned_strings_init();
zend_startup_builtin_functions();
zend_register_standard_constants();
zend_register_auto_global(zend_string_init("GLOBALS", sizeof("GLOBALS") - 1, 1), 1, php_auto_globals_create_globals);
#ifndef ZTS
zend_init_rsrc_plist(TSRMLS_C);
zend_init_exception_op(TSRMLS_C);
zend_init_rsrc_plist();
zend_init_exception_op();
#endif
zend_ini_startup(TSRMLS_C);
zend_ini_startup();
#ifdef ZTS
tsrm_set_new_thread_end_handler(zend_new_thread_end_handler);
@ -675,7 +682,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions TS
}
/* }}} */
void zend_register_standard_ini_entries(TSRMLS_D) /* {{{ */
void zend_register_standard_ini_entries(void) /* {{{ */
{
int module_number = 0;
@ -686,7 +693,7 @@ void zend_register_standard_ini_entries(TSRMLS_D) /* {{{ */
/* Unlink the global (r/o) copies of the class, function and constant tables,
* and use a fresh r/w copy for the startup thread
*/
void zend_post_startup(TSRMLS_D) /* {{{ */
void zend_post_startup(void) /* {{{ */
{
#ifdef ZTS
zend_encoding **script_encoding_list;
@ -701,34 +708,34 @@ void zend_post_startup(TSRMLS_D) /* {{{ */
short_tags_default = CG(short_tags);
compiler_options_default = CG(compiler_options);
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
zend_destroy_rsrc_list(&EG(persistent_list));
free(compiler_globals->function_table);
free(compiler_globals->class_table);
if ((script_encoding_list = (zend_encoding **)compiler_globals->script_encoding_list)) {
compiler_globals_ctor(compiler_globals, tsrm_ls);
compiler_globals_ctor(compiler_globals);
compiler_globals->script_encoding_list = (const zend_encoding **)script_encoding_list;
} else {
compiler_globals_ctor(compiler_globals, tsrm_ls);
compiler_globals_ctor(compiler_globals);
}
free(EG(zend_constants));
virtual_cwd_deactivate(TSRMLS_C);
virtual_cwd_deactivate();
executor_globals_ctor(executor_globals, tsrm_ls);
executor_globals_ctor(executor_globals);
global_persistent_list = &EG(persistent_list);
zend_copy_ini_directives(TSRMLS_C);
zend_copy_ini_directives();
#else
virtual_cwd_deactivate(TSRMLS_C);
virtual_cwd_deactivate();
#endif
}
/* }}} */
void zend_shutdown(TSRMLS_D) /* {{{ */
void zend_shutdown(void) /* {{{ */
{
#ifdef ZEND_SIGNALS
zend_signal_shutdown(TSRMLS_C);
zend_signal_shutdown();
#endif
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
zend_destroy_rsrc_list(&EG(persistent_list));
if (EG(active))
{
/*
@ -745,18 +752,18 @@ void zend_shutdown(TSRMLS_D) /* {{{ */
} ZEND_HASH_FOREACH_END();
ZEND_HASH_REVERSE_FOREACH_PTR(GLOBAL_CLASS_TABLE, ce) {
if (ce->type == ZEND_USER_CLASS) {
zend_cleanup_user_class_data(ce TSRMLS_CC);
zend_cleanup_user_class_data(ce);
} else {
break;
}
} ZEND_HASH_FOREACH_END();
zend_cleanup_internal_classes(TSRMLS_C);
zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) clean_non_persistent_function_full TSRMLS_CC);
zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) clean_non_persistent_class_full TSRMLS_CC);
zend_cleanup_internal_classes();
zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) clean_non_persistent_function_full);
zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) clean_non_persistent_class_full);
}
zend_destroy_modules();
virtual_cwd_deactivate(TSRMLS_C);
virtual_cwd_deactivate();
virtual_cwd_shutdown();
zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
@ -765,7 +772,7 @@ void zend_shutdown(TSRMLS_D) /* {{{ */
zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE);
free(GLOBAL_AUTO_GLOBALS_TABLE);
zend_shutdown_extensions(TSRMLS_C);
zend_shutdown_extensions();
free(zend_version_info);
free(GLOBAL_FUNCTION_TABLE);
@ -783,7 +790,7 @@ void zend_shutdown(TSRMLS_D) /* {{{ */
#endif
zend_destroy_rsrc_list_dtors();
zend_interned_strings_dtor(TSRMLS_C);
zend_interned_strings_dtor();
}
/* }}} */
@ -804,7 +811,6 @@ void zenderror(const char *error) /* {{{ */
BEGIN_EXTERN_C()
ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */
{
TSRMLS_FETCH();
if (!EG(bailout)) {
zend_output_debug_string(1, "%s(%d) : Bailed out without a bailout address!", filename, lineno);
@ -847,47 +853,47 @@ ZEND_API char *get_zend_version(void) /* {{{ */
}
/* }}} */
ZEND_API void zend_activate(TSRMLS_D) /* {{{ */
ZEND_API void zend_activate(void) /* {{{ */
{
#ifdef ZTS
virtual_cwd_activate(TSRMLS_C);
virtual_cwd_activate();
#endif
gc_reset(TSRMLS_C);
init_compiler(TSRMLS_C);
init_executor(TSRMLS_C);
startup_scanner(TSRMLS_C);
gc_reset();
init_compiler();
init_executor();
startup_scanner();
}
/* }}} */
void zend_call_destructors(TSRMLS_D) /* {{{ */
void zend_call_destructors(void) /* {{{ */
{
zend_try {
shutdown_destructors(TSRMLS_C);
shutdown_destructors();
} zend_end_try();
}
/* }}} */
ZEND_API void zend_deactivate(TSRMLS_D) /* {{{ */
ZEND_API void zend_deactivate(void) /* {{{ */
{
/* we're no longer executing anything */
EG(current_execute_data) = NULL;
zend_try {
shutdown_scanner(TSRMLS_C);
shutdown_scanner();
} zend_end_try();
/* shutdown_executor() takes care of its own bailout handling */
shutdown_executor(TSRMLS_C);
shutdown_executor();
zend_try {
shutdown_compiler(TSRMLS_C);
shutdown_compiler();
} zend_end_try();
zend_destroy_rsrc_list(&EG(regular_list) TSRMLS_CC);
zend_destroy_rsrc_list(&EG(regular_list));
#if ZEND_DEBUG
if (GC_G(gc_enabled) && !CG(unclean_shutdown)) {
gc_collect_cycles(TSRMLS_C);
gc_collect_cycles();
}
#endif
@ -906,16 +912,16 @@ ZEND_API void zend_deactivate(TSRMLS_D) /* {{{ */
#endif
zend_try {
zend_ini_deactivate(TSRMLS_C);
zend_ini_deactivate();
} zend_end_try();
}
/* }}} */
BEGIN_EXTERN_C()
ZEND_API void zend_message_dispatcher(zend_long message, const void *data TSRMLS_DC) /* {{{ */
ZEND_API void zend_message_dispatcher(zend_long message, const void *data) /* {{{ */
{
if (zend_message_dispatcher_p) {
zend_message_dispatcher_p(message, data TSRMLS_CC);
zend_message_dispatcher_p(message, data);
}
}
/* }}} */
@ -971,7 +977,6 @@ static void zend_error_va_list(int type, const char *format, va_list args)
zend_stack delayed_oplines_stack;
zend_stack context_stack;
zend_array *symbol_table;
TSRMLS_FETCH();
/* Report about uncaught exception in case of fatal errors */
if (EG(exception)) {
@ -994,7 +999,7 @@ static void zend_error_va_list(int type, const char *format, va_list args)
EG(opline_before_exception)) {
opline = EG(opline_before_exception);
}
zend_exception_error(EG(exception), E_WARNING TSRMLS_CC);
zend_exception_error(EG(exception), E_WARNING);
EG(exception) = NULL;
if (opline) {
ex->opline = opline;
@ -1025,16 +1030,16 @@ static void zend_error_va_list(int type, const char *format, va_list args)
case E_USER_NOTICE:
case E_USER_DEPRECATED:
case E_RECOVERABLE_ERROR:
if (zend_is_compiling(TSRMLS_C)) {
error_filename = zend_get_compiled_filename(TSRMLS_C)->val;
error_lineno = zend_get_compiled_lineno(TSRMLS_C);
} else if (zend_is_executing(TSRMLS_C)) {
error_filename = zend_get_executed_filename(TSRMLS_C);
if (zend_is_compiling()) {
error_filename = zend_get_compiled_filename()->val;
error_lineno = zend_get_compiled_lineno();
} else if (zend_is_executing()) {
error_filename = zend_get_executed_filename();
if (error_filename[0] == '[') { /* [no active file] */
error_filename = NULL;
error_lineno = 0;
} else {
error_lineno = zend_get_executed_lineno(TSRMLS_C);
error_lineno = zend_get_executed_lineno();
}
} else {
error_filename = NULL;
@ -1111,7 +1116,7 @@ static void zend_error_va_list(int type, const char *format, va_list args)
ZVAL_LONG(&params[3], error_lineno);
symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
symbol_table = zend_rebuild_symbol_table();
/* during shutdown the symbol table table can be still null */
if (!symbol_table) {
@ -1140,7 +1145,7 @@ static void zend_error_va_list(int type, const char *format, va_list args)
}
ZVAL_UNDEF(&retval);
if (call_user_function_ex(CG(function_table), NULL, &orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) {
if (call_user_function_ex(CG(function_table), NULL, &orig_user_error_handler, &retval, 5, params, 1, NULL) == SUCCESS) {
if (Z_TYPE(retval) != IS_UNDEF) {
if (Z_TYPE(retval) == IS_FALSE) {
zend_error_cb(type, error_filename, error_lineno, format, args);
@ -1240,7 +1245,7 @@ ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *form
}
/* }}} */
ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval *retval, int file_count, ...) /* {{{ */
ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...) /* {{{ */
{
va_list files;
int i;
@ -1254,14 +1259,14 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval *retval, int file_cou
continue;
}
op_array = zend_compile_file(file_handle, type TSRMLS_CC);
op_array = zend_compile_file(file_handle, type);
if (file_handle->opened_path) {
zend_hash_str_add_empty_element(&EG(included_files), file_handle->opened_path, strlen(file_handle->opened_path));
}
zend_destroy_file_handle(file_handle TSRMLS_CC);
zend_destroy_file_handle(file_handle);
if (op_array) {
zend_execute(op_array, retval TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
zend_execute(op_array, retval);
zend_exception_restore();
if (EG(exception)) {
if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
zval orig_user_exception_handler;
@ -1272,7 +1277,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval *retval, int file_cou
ZVAL_OBJ(&params[0], old_exception);
ZVAL_COPY_VALUE(&orig_user_exception_handler, &EG(user_exception_handler));
ZVAL_UNDEF(&retval2);
if (call_user_function_ex(CG(function_table), NULL, &orig_user_exception_handler, &retval2, 1, params, 1, NULL TSRMLS_CC) == SUCCESS) {
if (call_user_function_ex(CG(function_table), NULL, &orig_user_exception_handler, &retval2, 1, params, 1, NULL) == SUCCESS) {
zval_ptr_dtor(&retval2);
if (EG(exception)) {
OBJ_RELEASE(EG(exception));
@ -1281,13 +1286,13 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval *retval, int file_cou
OBJ_RELEASE(old_exception);
} else {
EG(exception) = old_exception;
zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
zend_exception_error(EG(exception), E_ERROR);
}
} else {
zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
zend_exception_error(EG(exception), E_ERROR);
}
}
destroy_op_array(op_array TSRMLS_CC);
destroy_op_array(op_array);
efree_size(op_array, sizeof(zend_op_array));
} else if (type==ZEND_REQUIRE) {
va_end(files);
@ -1302,18 +1307,18 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval *retval, int file_cou
#define COMPILED_STRING_DESCRIPTION_FORMAT "%s(%d) : %s"
ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC) /* {{{ */
ZEND_API char *zend_make_compiled_string_description(const char *name) /* {{{ */
{
const char *cur_filename;
int cur_lineno;
char *compiled_string_description;
if (zend_is_compiling(TSRMLS_C)) {
cur_filename = zend_get_compiled_filename(TSRMLS_C)->val;
cur_lineno = zend_get_compiled_lineno(TSRMLS_C);
} else if (zend_is_executing(TSRMLS_C)) {
cur_filename = zend_get_executed_filename(TSRMLS_C);
cur_lineno = zend_get_executed_lineno(TSRMLS_C);
if (zend_is_compiling()) {
cur_filename = zend_get_compiled_filename()->val;
cur_lineno = zend_get_compiled_lineno();
} else if (zend_is_executing()) {
cur_filename = zend_get_executed_filename();
cur_lineno = zend_get_executed_lineno();
} else {
cur_filename = "Unknown";
cur_lineno = 0;

View file

@ -52,14 +52,30 @@
# define HANDLE_UNBLOCK_INTERRUPTIONS() ZEND_SIGNAL_UNBLOCK_INTERRUPTIONS()
#endif
#define INTERNAL_FUNCTION_PARAMETERS zend_execute_data *execute_data, zval *return_value TSRMLS_DC
#define INTERNAL_FUNCTION_PARAM_PASSTHRU execute_data, return_value TSRMLS_CC
#define INTERNAL_FUNCTION_PARAMETERS zend_execute_data *execute_data, zval *return_value
#define INTERNAL_FUNCTION_PARAM_PASSTHRU execute_data, return_value
#define USED_RET() \
(!EX(prev_execute_data) || \
!ZEND_USER_CODE(EX(prev_execute_data)->func->common.type) || \
!(EX(prev_execute_data)->opline->result_type & EXT_TYPE_UNUSED))
#ifdef ZEND_ENABLE_STATIC_TSRMLS_CACHE
#define ZEND_TSRMG TSRMG_STATIC
#define ZEND_TSRMLS_CACHE_EXTERN TSRMLS_CACHE_EXTERN
#define ZEND_TSRMLS_CACHE_DEFINE TSRMLS_CACHE_DEFINE
#define ZEND_TSRMLS_CACHE_UPDATE TSRMLS_CACHE_UPDATE
#define ZEND_TSRMLS_CACHE TSRMLS_CACHE
#else
#define ZEND_TSRMG TSRMG
#define ZEND_TSRMLS_CACHE_EXTERN
#define ZEND_TSRMLS_CACHE_DEFINE
#define ZEND_TSRMLS_CACHE_UPDATE
#define ZEND_TSRMLS_CACHE
#endif
ZEND_TSRMLS_CACHE_EXTERN;
#ifdef HAVE_NORETURN
# if defined(ZEND_WIN32)
ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...);
@ -142,14 +158,14 @@ struct _zend_class_entry {
zend_class_iterator_funcs iterator_funcs;
/* handlers */
zend_object* (*create_object)(zend_class_entry *class_type TSRMLS_DC);
zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
int (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type TSRMLS_DC); /* a class implements this interface */
union _zend_function *(*get_static_method)(zend_class_entry *ce, zend_string* method TSRMLS_DC);
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);
/* serializer callbacks */
int (*serialize)(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC);
int (*unserialize)(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data TSRMLS_DC);
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);
uint32_t num_interfaces;
uint32_t num_traits;
@ -177,18 +193,18 @@ typedef struct _zend_utility_functions {
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);
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);
FILE *(*fopen_function)(const char *filename, char **opened_path TSRMLS_DC);
void (*message_handler)(zend_long message, const void *data TSRMLS_DC);
FILE *(*fopen_function)(const char *filename, char **opened_path);
void (*message_handler)(zend_long message, const void *data);
void (*block_interruptions)(void);
void (*unblock_interruptions)(void);
zval *(*get_configuration_directive)(zend_string *name);
void (*ticks_function)(int ticks TSRMLS_DC);
void (*on_timeout)(int seconds TSRMLS_DC);
int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
void (*ticks_function)(int ticks);
void (*on_timeout)(int seconds);
int (*stream_open_function)(const char *filename, zend_file_handle *handle);
size_t (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap);
zend_string *(*vstrpprintf_function)(size_t max_len, const char *format, va_list ap);
char *(*getenv_function)(char *name, size_t name_len TSRMLS_DC);
char *(*resolve_path_function)(const char *filename, int filename_len TSRMLS_DC);
char *(*getenv_function)(char *name, size_t name_len);
char *(*resolve_path_function)(const char *filename, int filename_len);
} zend_utility_functions;
typedef struct _zend_utility_values {
@ -218,29 +234,29 @@ typedef int (*zend_write_func_t)(const char *str, size_t str_length);
#define zend_first_try EG(bailout)=NULL; zend_try
BEGIN_EXTERN_C()
int zend_startup(zend_utility_functions *utility_functions, char **extensions TSRMLS_DC);
void zend_shutdown(TSRMLS_D);
void zend_register_standard_ini_entries(TSRMLS_D);
void zend_post_startup(TSRMLS_D);
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);
void zend_set_utility_values(zend_utility_values *utility_values);
ZEND_API void _zend_bailout(char *filename, uint lineno);
ZEND_API char *get_zend_version(void);
ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy TSRMLS_DC);
ZEND_API size_t zend_print_zval(zval *expr, int indent TSRMLS_DC);
ZEND_API size_t zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC);
ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC);
ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC);
ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC);
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 size_t zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent);
ZEND_API void zend_print_zval_r(zval *expr, int indent);
ZEND_API void zend_print_flat_zval_r(zval *expr);
ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent);
ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
ZEND_API void zend_activate(TSRMLS_D);
ZEND_API void zend_deactivate(TSRMLS_D);
ZEND_API void zend_call_destructors(TSRMLS_D);
ZEND_API void zend_activate_modules(TSRMLS_D);
ZEND_API void zend_deactivate_modules(TSRMLS_D);
ZEND_API void zend_post_deactivate_modules(TSRMLS_D);
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);
ZEND_API void free_estring(char **str_p);
ZEND_API void free_string_zval(zval *zv);
@ -256,17 +272,17 @@ END_EXTERN_C()
BEGIN_EXTERN_C()
extern ZEND_API size_t (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
extern ZEND_API zend_write_func_t zend_write;
extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC);
extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path);
extern ZEND_API void (*zend_block_interruptions)(void);
extern ZEND_API void (*zend_unblock_interruptions)(void);
extern ZEND_API void (*zend_ticks_function)(int ticks TSRMLS_DC);
extern ZEND_API void (*zend_ticks_function)(int ticks);
extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
extern ZEND_API void (*zend_on_timeout)(int seconds TSRMLS_DC);
extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
extern ZEND_API void (*zend_on_timeout)(int seconds);
extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle);
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);
extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
extern ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len);
extern ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len);
ZEND_API void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
@ -283,7 +299,7 @@ END_EXTERN_C()
#define ZEND_UV(name) (zend_uv.name)
BEGIN_EXTERN_C()
ZEND_API void zend_message_dispatcher(zend_long message, const void *data TSRMLS_DC);
ZEND_API void zend_message_dispatcher(zend_long message, const void *data);
ZEND_API zval *zend_get_configuration_directive(zend_string *name);
END_EXTERN_C()
@ -309,9 +325,9 @@ typedef struct {
zval user_handler;
} zend_error_handling;
ZEND_API void zend_save_error_handling(zend_error_handling *current TSRMLS_DC);
ZEND_API void zend_replace_error_handling(zend_error_handling_t error_handling, zend_class_entry *exception_class, zend_error_handling *current TSRMLS_DC);
ZEND_API void zend_restore_error_handling(zend_error_handling *saved TSRMLS_DC);
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);
#define DEBUG_BACKTRACE_PROVIDE_OBJECT (1<<0)
#define DEBUG_BACKTRACE_IGNORE_ARGS (1<<1)

File diff suppressed because it is too large Load diff

View file

@ -129,8 +129,8 @@ typedef struct _zend_fcall_info_cache {
#define ZEND_MODULE_DEACTIVATE_D(module) int ZEND_MODULE_DEACTIVATE_N(module)(SHUTDOWN_FUNC_ARGS)
#define ZEND_MODULE_POST_ZEND_DEACTIVATE_D(module) int ZEND_MODULE_POST_ZEND_DEACTIVATE_N(module)(void)
#define ZEND_MODULE_INFO_D(module) void ZEND_MODULE_INFO_N(module)(ZEND_MODULE_INFO_FUNC_ARGS)
#define ZEND_MODULE_GLOBALS_CTOR_D(module) void ZEND_MODULE_GLOBALS_CTOR_N(module)(zend_##module##_globals *module##_globals TSRMLS_DC)
#define ZEND_MODULE_GLOBALS_DTOR_D(module) void ZEND_MODULE_GLOBALS_DTOR_N(module)(zend_##module##_globals *module##_globals TSRMLS_DC)
#define ZEND_MODULE_GLOBALS_CTOR_D(module) void ZEND_MODULE_GLOBALS_CTOR_N(module)(zend_##module##_globals *module##_globals)
#define ZEND_MODULE_GLOBALS_DTOR_D(module) void ZEND_MODULE_GLOBALS_DTOR_N(module)(zend_##module##_globals *module##_globals)
#define ZEND_GET_MODULE(name) \
BEGIN_EXTERN_C()\
@ -172,7 +172,7 @@ typedef struct _zend_fcall_info_cache {
{ \
zend_string *cl_name; \
cl_name = zend_string_init(class_name, class_name_len, 1); \
class_container.name = zend_new_interned_string(cl_name TSRMLS_CC); \
class_container.name = zend_new_interned_string(cl_name); \
INIT_CLASS_ENTRY_INIT_METHODS(class_container, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \
}
@ -234,59 +234,59 @@ ZEND_API int zend_next_free_module(void);
BEGIN_EXTERN_C()
ZEND_API int zend_get_parameters(int ht, int param_count, ...);
ZEND_API ZEND_ATTRIBUTE_DEPRECATED int zend_get_parameters_ex(int param_count, ...);
ZEND_API int _zend_get_parameters_array_ex(int param_count, zval *argument_array TSRMLS_DC);
ZEND_API int _zend_get_parameters_array_ex(int param_count, zval *argument_array);
/* internal function to efficiently copy parameters when executing __call() */
ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array TSRMLS_DC);
ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array);
#define zend_get_parameters_array(ht, param_count, argument_array) \
_zend_get_parameters_array_ex(param_count, argument_array TSRMLS_CC)
_zend_get_parameters_array_ex(param_count, argument_array)
#define zend_get_parameters_array_ex(param_count, argument_array) \
_zend_get_parameters_array_ex(param_count, argument_array TSRMLS_CC)
_zend_get_parameters_array_ex(param_count, argument_array)
#define zend_parse_parameters_none() \
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")
zend_parse_parameters(ZEND_NUM_ARGS(), "")
/* Parameter parsing API -- andrei */
#define ZEND_PARSE_PARAMS_QUIET (1<<1)
ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, const char *type_spec, ...);
ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, const char *type_spec, ...);
ZEND_API int zend_parse_parameters(int num_args, const char *type_spec, ...);
ZEND_API int zend_parse_parameters_ex(int flags, int num_args, const char *type_spec, ...);
ZEND_API char *zend_zval_type_name(const zval *arg);
ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr, const char *type_spec, ...);
ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, zval *this_ptr, const char *type_spec, ...);
ZEND_API int zend_parse_method_parameters(int num_args, zval *this_ptr, const char *type_spec, ...);
ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args, zval *this_ptr, const char *type_spec, ...);
ZEND_API int zend_parse_parameter(int flags, int arg_num TSRMLS_DC, zval *arg, const char *spec, ...);
ZEND_API int zend_parse_parameter(int flags, int arg_num, zval *arg, const char *spec, ...);
/* End of parameter parsing API -- andrei */
ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC);
ZEND_API void zend_unregister_functions(const zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
ZEND_API int zend_startup_module(zend_module_entry *module_entry TSRMLS_DC);
ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module_entry TSRMLS_DC);
ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC);
ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC);
ZEND_API int zend_startup_modules(TSRMLS_D);
ZEND_API void zend_collect_module_handlers(TSRMLS_D);
ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type);
ZEND_API void zend_unregister_functions(const zend_function_entry *functions, int count, HashTable *function_table);
ZEND_API int zend_startup_module(zend_module_entry *module_entry);
ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module_entry);
ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module);
ZEND_API int zend_startup_module_ex(zend_module_entry *module);
ZEND_API int zend_startup_modules(void);
ZEND_API void zend_collect_module_handlers(void);
ZEND_API void zend_destroy_modules(void);
ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce, const zend_function *fptr, int error_type TSRMLS_DC);
ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce, const zend_function *fptr, int error_type);
ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry TSRMLS_DC);
ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce TSRMLS_DC);
ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry TSRMLS_DC);
ZEND_API void zend_class_implements(zend_class_entry *class_entry TSRMLS_DC, int num_interfaces, ...);
ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry);
ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce);
ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry);
ZEND_API void zend_class_implements(zend_class_entry *class_entry, int num_interfaces, ...);
ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce TSRMLS_DC);
ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce);
#define zend_register_class_alias(name, ce) \
zend_register_class_alias_ex(name, sizeof(name)-1, ce TSRMLS_CC)
zend_register_class_alias_ex(name, sizeof(name)-1, ce)
#define zend_register_ns_class_alias(ns, name, ce) \
zend_register_class_alias_ex(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, ce TSRMLS_CC)
zend_register_class_alias_ex(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, ce)
ZEND_API int zend_disable_function(char *function_name, size_t function_name_length TSRMLS_DC);
ZEND_API int zend_disable_class(char *class_name, size_t class_name_length TSRMLS_DC);
ZEND_API int zend_disable_function(char *function_name, size_t function_name_length);
ZEND_API int zend_disable_class(char *class_name, size_t class_name_length);
ZEND_API void zend_wrong_param_count(TSRMLS_D);
ZEND_API void zend_wrong_param_count(void);
#define IS_CALLABLE_CHECK_SYNTAX_ONLY (1<<0)
#define IS_CALLABLE_CHECK_NO_ACCESS (1<<1)
@ -295,49 +295,49 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D);
#define IS_CALLABLE_STRICT (IS_CALLABLE_CHECK_IS_STATIC)
ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint check_flags, zend_string **callable_name, zend_fcall_info_cache *fcc, char **error TSRMLS_DC);
ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, zend_string **callable_name TSRMLS_DC);
ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_name TSRMLS_DC);
ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint check_flags, zend_string **callable_name, zend_fcall_info_cache *fcc, char **error);
ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, zend_string **callable_name);
ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_name);
ZEND_API const char *zend_get_module_version(const char *module_name);
ZEND_API int zend_get_module_started(const char *module_name);
ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment TSRMLS_DC);
ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, size_t name_length, zval *property, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, size_t name_length, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, size_t name_length, double value, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_len, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment);
ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, size_t name_length, zval *property, int access_type);
ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, size_t name_length, int access_type);
ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type);
ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type);
ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, size_t name_length, double value, int access_type);
ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value, int access_type);
ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_len, int access_type);
ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length TSRMLS_DC);
ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_bool value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, size_t name_length, double value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_length TSRMLS_DC);
ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value TSRMLS_DC);
ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value);
ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length);
ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value);
ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_bool value);
ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, size_t name_length, double value);
ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_length);
ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value);
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC);
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zval *value TSRMLS_DC);
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, size_t name_length TSRMLS_DC);
ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_long value TSRMLS_DC);
ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_long value TSRMLS_DC);
ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, size_t name_length, double value TSRMLS_DC);
ZEND_API void zend_update_property_str(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_string *value TSRMLS_DC);
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, size_t name_length, const char *value TSRMLS_DC);
ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, size_t name_length, const char *value, size_t value_length TSRMLS_DC);
ZEND_API void zend_update_class_constants(zend_class_entry *class_type);
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zval *value);
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, size_t name_length);
ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_long value);
ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_long value);
ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, size_t name_length, double value);
ZEND_API void zend_update_property_str(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_string *value);
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, size_t name_length, const char *value);
ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, size_t name_length, const char *value, size_t value_length);
ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value TSRMLS_DC);
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length TSRMLS_DC);
ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, size_t name_length, zend_long value TSRMLS_DC);
ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, size_t name_length, zend_long value TSRMLS_DC);
ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, size_t name_length, double value TSRMLS_DC);
ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value TSRMLS_DC);
ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_length TSRMLS_DC);
ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value);
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length);
ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, size_t name_length, zend_long value);
ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, size_t name_length, zend_long value);
ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, size_t name_length, double value);
ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value);
ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_length);
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_bool silent TSRMLS_DC);
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_bool silent);
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t name_length, zend_bool silent TSRMLS_DC);
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t name_length, zend_bool silent);
ZEND_API char *zend_get_type_by_const(int type);
@ -348,8 +348,8 @@ ZEND_API char *zend_get_type_by_const(int type);
#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret)
#define ARG_COUNT(dummy) EX_NUM_ARGS()
#define ZEND_NUM_ARGS() EX_NUM_ARGS()
#define ZEND_WRONG_PARAM_COUNT() { zend_wrong_param_count(TSRMLS_C); return; }
#define ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret) { zend_wrong_param_count(TSRMLS_C); return ret; }
#define ZEND_WRONG_PARAM_COUNT() { zend_wrong_param_count(); return; }
#define ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret) { zend_wrong_param_count(); return ret; }
#ifndef ZEND_WIN32
#define DLEXPORT
@ -357,18 +357,18 @@ ZEND_API char *zend_get_type_by_const(int type);
#define array_init(arg) _array_init((arg), 0 ZEND_FILE_LINE_CC)
#define array_init_size(arg, size) _array_init((arg), (size) ZEND_FILE_LINE_CC)
#define object_init(arg) _object_init((arg) ZEND_FILE_LINE_CC TSRMLS_CC)
#define object_init_ex(arg, ce) _object_init_ex((arg), (ce) ZEND_FILE_LINE_CC TSRMLS_CC)
#define object_and_properties_init(arg, ce, properties) _object_and_properties_init((arg), (ce), (properties) ZEND_FILE_LINE_CC TSRMLS_CC)
#define object_init(arg) _object_init((arg) ZEND_FILE_LINE_CC)
#define object_init_ex(arg, ce) _object_init_ex((arg), (ce) ZEND_FILE_LINE_CC)
#define object_and_properties_init(arg, ce, properties) _object_and_properties_init((arg), (ce), (properties) ZEND_FILE_LINE_CC)
ZEND_API int _array_init(zval *arg, uint size ZEND_FILE_LINE_DC);
ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC);
ZEND_API int _object_init_ex(zval *arg, zend_class_entry *ce ZEND_FILE_LINE_DC TSRMLS_DC);
ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC);
ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC);
ZEND_API int _object_init_ex(zval *arg, zend_class_entry *ce ZEND_FILE_LINE_DC);
ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties ZEND_FILE_LINE_DC);
ZEND_API void object_properties_init(zend_object *object, zend_class_entry *class_type);
ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properties TSRMLS_DC);
ZEND_API void object_properties_load(zend_object *object, HashTable *properties TSRMLS_DC);
ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properties);
ZEND_API void object_properties_load(zend_object *object, HashTable *properties);
ZEND_API void zend_merge_properties(zval *obj, HashTable *properties TSRMLS_DC);
ZEND_API void zend_merge_properties(zval *obj, HashTable *properties);
/* no longer supported */
ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS));
@ -431,31 +431,31 @@ ZEND_API zval *add_get_index_str(zval *arg, zend_ulong index, zend_string *str);
ZEND_API zval *add_get_index_string(zval *arg, zend_ulong idx, const char *str);
ZEND_API zval *add_get_index_stringl(zval *arg, zend_ulong idx, const char *str, size_t length);
ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value TSRMLS_DC);
ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value);
ZEND_API int add_property_long_ex(zval *arg, const char *key, size_t key_len, zend_long l TSRMLS_DC);
ZEND_API int add_property_null_ex(zval *arg, const char *key, size_t key_len TSRMLS_DC);
ZEND_API int add_property_bool_ex(zval *arg, const char *key, size_t key_len, zend_long b TSRMLS_DC);
ZEND_API int add_property_resource_ex(zval *arg, const char *key, size_t key_len, zend_resource *r TSRMLS_DC);
ZEND_API int add_property_double_ex(zval *arg, const char *key, size_t key_len, double d TSRMLS_DC);
ZEND_API int add_property_str_ex(zval *arg, const char *key, size_t key_len, zend_string *str TSRMLS_DC);
ZEND_API int add_property_string_ex(zval *arg, const char *key, size_t key_len, const char *str TSRMLS_DC);
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, size_t key_len, const char *str, size_t length TSRMLS_DC);
ZEND_API int add_property_zval_ex(zval *arg, const char *key, size_t key_len, zval *value TSRMLS_DC);
ZEND_API int add_property_long_ex(zval *arg, const char *key, size_t key_len, zend_long l);
ZEND_API int add_property_null_ex(zval *arg, const char *key, size_t key_len);
ZEND_API int add_property_bool_ex(zval *arg, const char *key, size_t key_len, zend_long b);
ZEND_API int add_property_resource_ex(zval *arg, const char *key, size_t key_len, zend_resource *r);
ZEND_API int add_property_double_ex(zval *arg, const char *key, size_t key_len, double d);
ZEND_API int add_property_str_ex(zval *arg, const char *key, size_t key_len, zend_string *str);
ZEND_API int add_property_string_ex(zval *arg, const char *key, size_t key_len, const char *str);
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, size_t key_len, const char *str, size_t length);
ZEND_API int add_property_zval_ex(zval *arg, const char *key, size_t key_len, zval *value);
#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key), __n TSRMLS_CC)
#define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) TSRMLS_CC)
#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key), __b TSRMLS_CC)
#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key), __r TSRMLS_CC)
#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key), __d TSRMLS_CC)
#define add_property_str(__arg, __key, __str) add_property_str_ex(__arg, __key, strlen(__key), __str TSRMLS_CC)
#define add_property_string(__arg, __key, __str) add_property_string_ex(__arg, __key, strlen(__key), __str TSRMLS_CC)
#define add_property_stringl(__arg, __key, __str, __length) add_property_stringl_ex(__arg, __key, strlen(__key), __str, __length TSRMLS_CC)
#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key), __value TSRMLS_CC)
#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key), __n)
#define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key))
#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key), __b)
#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key), __r)
#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key), __d)
#define add_property_str(__arg, __key, __str) add_property_str_ex(__arg, __key, strlen(__key), __str)
#define add_property_string(__arg, __key, __str) add_property_string_ex(__arg, __key, strlen(__key), __str)
#define add_property_stringl(__arg, __key, __str, __length) add_property_stringl_ex(__arg, __key, strlen(__key), __str, __length)
#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key), __value)
ZEND_API int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[] TSRMLS_DC);
ZEND_API int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], int no_separation, zend_array *symbol_table TSRMLS_DC);
ZEND_API int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[]);
ZEND_API int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], int no_separation, zend_array *symbol_table);
ZEND_API extern const zend_fcall_info empty_fcall_info;
ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache;
@ -470,7 +470,7 @@ ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache;
* The callable_name argument may be NULL.
* Set check_flags to IS_CALLABLE_STRICT for every new usage!
*/
ZEND_API int zend_fcall_info_init(zval *callable, uint check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error TSRMLS_DC);
ZEND_API int zend_fcall_info_init(zval *callable, uint check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error);
/** Clear arguments connected with zend_fcall_info *fci
* If free_mem is not zero then the params array gets free'd as well
@ -489,43 +489,43 @@ ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, int param_count
/** Set or clear the arguments in the zend_call_info struct taking care of
* refcount. If args is NULL and arguments are set then those are cleared.
*/
ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC);
ZEND_API int zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args TSRMLS_DC);
ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args);
ZEND_API int zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args);
/** Set arguments in the zend_fcall_info struct taking care of refcount.
* If argc is 0 the arguments which are set will be cleared, else pass
* a variable amount of zval** arguments.
*/
ZEND_API int zend_fcall_info_argp(zend_fcall_info *fci TSRMLS_DC, int argc, zval *argv);
ZEND_API int zend_fcall_info_argp(zend_fcall_info *fci, int argc, zval *argv);
/** Set arguments in the zend_fcall_info struct taking care of refcount.
* If argc is 0 the arguments which are set will be cleared, else pass
* a variable amount of zval** arguments.
*/
ZEND_API int zend_fcall_info_argv(zend_fcall_info *fci TSRMLS_DC, int argc, va_list *argv);
ZEND_API int zend_fcall_info_argv(zend_fcall_info *fci, int argc, va_list *argv);
/** Set arguments in the zend_fcall_info struct taking care of refcount.
* If argc is 0 the arguments which are set will be cleared, else pass
* a variable amount of zval** arguments.
*/
ZEND_API int zend_fcall_info_argn(zend_fcall_info *fci TSRMLS_DC, int argc, ...);
ZEND_API int zend_fcall_info_argn(zend_fcall_info *fci, int argc, ...);
/** Call a function using information created by zend_fcall_info_init()/args().
* If args is given then those replace the argument info in fci is temporarily.
*/
ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval, zval *args TSRMLS_DC);
ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval, zval *args);
ZEND_API int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC);
ZEND_API int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache);
ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_length, zend_bool is_ref, int num_symbol_tables, ...);
ZEND_API int zend_delete_global_variable(zend_string *name TSRMLS_DC);
ZEND_API int zend_delete_global_variable(zend_string *name);
ZEND_API zend_array *zend_rebuild_symbol_table(TSRMLS_D);
ZEND_API zend_array *zend_rebuild_symbol_table(void);
ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data);
ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data);
ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS_DC);
ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, int force TSRMLS_DC);
ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force);
ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, int force);
ZEND_API zend_string *zend_find_alias_name(zend_class_entry *ce, zend_string *name);
ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_function *f);
@ -645,7 +645,7 @@ END_EXTERN_C()
#define RETURN_ZVAL_FAST(z) { RETVAL_ZVAL_FAST(z); return; }
#define HASH_OF(p) (Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p) TSRMLS_CC) : NULL)))
#define HASH_OF(p) (Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p)) : NULL)))
#define ZVAL_IS_NULL(z) (Z_TYPE_P(z) == IS_NULL)
/* For compatibility */
@ -654,8 +654,8 @@ END_EXTERN_C()
#define ZEND_RINIT ZEND_MODULE_ACTIVATE_N
#define ZEND_RSHUTDOWN ZEND_MODULE_DEACTIVATE_N
#define ZEND_MINFO ZEND_MODULE_INFO_N
#define ZEND_GINIT(module) ((void (*)(void* TSRMLS_DC))(ZEND_MODULE_GLOBALS_CTOR_N(module)))
#define ZEND_GSHUTDOWN(module) ((void (*)(void* TSRMLS_DC))(ZEND_MODULE_GLOBALS_DTOR_N(module)))
#define ZEND_GINIT(module) ((void (*)(void*))(ZEND_MODULE_GLOBALS_CTOR_N(module)))
#define ZEND_GSHUTDOWN(module) ((void (*)(void*))(ZEND_MODULE_GLOBALS_DTOR_N(module)))
#define ZEND_MINIT_FUNCTION ZEND_MODULE_STARTUP_D
#define ZEND_MSHUTDOWN_FUNCTION ZEND_MODULE_SHUTDOWN_D
@ -676,7 +676,7 @@ END_EXTERN_C()
#ifdef FAST_ZPP
#define Z_EXPECTED_TYPES(_) \
_(Z_EXPECTED_LONG, "long") \
_(Z_EXPECTED_LONG, "integer") \
_(Z_EXPECTED_BOOL, "boolean") \
_(Z_EXPECTED_STRING, "string") \
_(Z_EXPECTED_ARRAY, "array") \
@ -684,7 +684,7 @@ END_EXTERN_C()
_(Z_EXPECTED_RESOURCE, "resource") \
_(Z_EXPECTED_PATH, "a valid path") \
_(Z_EXPECTED_OBJECT, "object") \
_(Z_EXPECTED_DOUBLE, "double")
_(Z_EXPECTED_DOUBLE, "float")
#define Z_EXPECTED_TYPE_ENUM(id, str) id,
#define Z_EXPECTED_TYPE_STR(id, str) str,
@ -694,12 +694,12 @@ typedef enum _zend_expected_type {
Z_EXPECTED_LAST
} zend_expected_type;
ZEND_API int parse_arg_object_to_str(zval *arg, zend_string **str, int type TSRMLS_DC);
ZEND_API void zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args TSRMLS_DC);
ZEND_API void zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg TSRMLS_DC);
ZEND_API void zend_wrong_paramer_class_error(int num, char *name, zval *arg TSRMLS_DC);
ZEND_API void zend_wrong_callback_error(int severity, int num, char *error TSRMLS_DC);
ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int check_null TSRMLS_DC);
ZEND_API int parse_arg_object_to_str(zval *arg, zend_string **str, int type);
ZEND_API void zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args);
ZEND_API void zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg);
ZEND_API void zend_wrong_paramer_class_error(int num, char *name, zval *arg);
ZEND_API void zend_wrong_callback_error(int severity, int num, char *error);
ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int check_null);
#define ZPP_ERROR_OK 0
#define ZPP_ERROR_FAILURE 1
@ -733,7 +733,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
(UNEXPECTED(_num_args > _max_num_args) && \
EXPECTED(_max_num_args >= 0))) { \
if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \
zend_wrong_paramers_count_error(_num_args, _min_num_args, _max_num_args TSRMLS_CC); \
zend_wrong_paramers_count_error(_num_args, _min_num_args, _max_num_args); \
} \
error_code = ZPP_ERROR_FAILURE; \
break; \
@ -749,11 +749,11 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
if (UNEXPECTED(error_code != ZPP_ERROR_OK)) { \
if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \
if (error_code == ZPP_ERROR_WRONG_CALLBACK) { \
zend_wrong_callback_error(E_WARNING, _i, _error TSRMLS_CC); \
zend_wrong_callback_error(E_WARNING, _i, _error); \
} else if (error_code == ZPP_ERROR_WRONG_CLASS) { \
zend_wrong_paramer_class_error(_i, _error, _arg TSRMLS_CC); \
zend_wrong_paramer_class_error(_i, _error, _arg); \
} else if (error_code == ZPP_ERROR_WRONG_ARG) { \
zend_wrong_paramer_type_error(_i, _expected_type, _arg TSRMLS_CC); \
zend_wrong_paramer_type_error(_i, _expected_type, _arg); \
} \
} \
failure; \
@ -806,7 +806,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
/* old "b" */
#define Z_PARAM_BOOL_EX(dest, is_null, check_null, separate) \
Z_PARAM_PROLOGUE(separate); \
if (UNEXPECTED(!_z_param_bool(_arg, &dest, &is_null, check_null TSRMLS_CC))) { \
if (UNEXPECTED(!_z_param_bool(_arg, &dest, &is_null, check_null))) { \
_expected_type = Z_EXPECTED_BOOL; \
error_code = ZPP_ERROR_WRONG_ARG; \
break; \
@ -818,7 +818,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
/* old "C" */
#define Z_PARAM_CLASS_EX(dest, check_null, separate) \
Z_PARAM_PROLOGUE(separate); \
if (UNEXPECTED(!_z_param_class(_arg, &dest, _i, check_null TSRMLS_CC))) { \
if (UNEXPECTED(!_z_param_class(_arg, &dest, _i, check_null))) { \
error_code = ZPP_ERROR_FAILURE; \
break; \
}
@ -841,7 +841,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
/* old "f" */
#define Z_PARAM_FUNC_EX(dest_fci, dest_fcc, check_null, separate) \
Z_PARAM_PROLOGUE(separate); \
if (UNEXPECTED(!_z_param_func(_arg, &dest_fci, &dest_fcc, check_null, &_error TSRMLS_CC))) { \
if (UNEXPECTED(!_z_param_func(_arg, &dest_fci, &dest_fcc, check_null, &_error))) { \
if (!_error) { \
_expected_type = Z_EXPECTED_FUNC; \
error_code = ZPP_ERROR_WRONG_ARG; \
@ -851,7 +851,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
break; \
} \
} else if (UNEXPECTED(_error != NULL)) { \
zend_wrong_callback_error(E_STRICT, _i, _error TSRMLS_CC); \
zend_wrong_callback_error(E_STRICT, _i, _error); \
}
#define Z_PARAM_FUNC(dest_fci, dest_fcc) \
@ -860,7 +860,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
/* old "h" */
#define Z_PARAM_ARRAY_HT_EX(dest, check_null, separate) \
Z_PARAM_PROLOGUE(separate); \
if (UNEXPECTED(!_z_param_array_ht(_arg, &dest, check_null, 0 TSRMLS_CC))) { \
if (UNEXPECTED(!_z_param_array_ht(_arg, &dest, check_null, 0))) { \
_expected_type = Z_EXPECTED_ARRAY; \
error_code = ZPP_ERROR_WRONG_ARG; \
break; \
@ -872,7 +872,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
/* old "H" */
#define Z_PARAM_ARRAY_OR_OBJECT_HT_EX(dest, check_null, separate) \
Z_PARAM_PROLOGUE(separate); \
if (UNEXPECTED(!_z_param_array_ht(_arg, &dest, check_null, 1 TSRMLS_CC))) { \
if (UNEXPECTED(!_z_param_array_ht(_arg, &dest, check_null, 1))) { \
_expected_type = Z_EXPECTED_ARRAY; \
error_code = ZPP_ERROR_WRONG_ARG; \
break; \
@ -908,7 +908,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
/* old "o" */
#define Z_PARAM_OBJECT_EX(dest, check_null, separate) \
Z_PARAM_PROLOGUE(separate); \
if (UNEXPECTED(!_z_param_object(_arg, &dest, NULL, check_null TSRMLS_CC))) { \
if (UNEXPECTED(!_z_param_object(_arg, &dest, NULL, check_null))) { \
_expected_type = Z_EXPECTED_OBJECT; \
error_code = ZPP_ERROR_WRONG_ARG; \
break; \
@ -920,7 +920,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
/* old "O" */
#define Z_PARAM_OBJECT_OF_CLASS_EX(dest, _ce, check_null, separate) \
Z_PARAM_PROLOGUE(separate); \
if (UNEXPECTED(!_z_param_object(_arg, &dest, _ce, check_null TSRMLS_CC))) { \
if (UNEXPECTED(!_z_param_object(_arg, &dest, _ce, check_null))) { \
if (_ce) { \
_error = (_ce)->name->val; \
error_code = ZPP_ERROR_WRONG_CLASS; \
@ -938,7 +938,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
/* old "p" */
#define Z_PARAM_PATH_EX(dest, dest_len, check_null, separate) \
Z_PARAM_PROLOGUE(separate); \
if (UNEXPECTED(!_z_param_path(_arg, &dest, &dest_len, check_null TSRMLS_CC))) { \
if (UNEXPECTED(!_z_param_path(_arg, &dest, &dest_len, check_null))) { \
_expected_type = Z_EXPECTED_PATH; \
error_code = ZPP_ERROR_WRONG_ARG; \
break; \
@ -950,7 +950,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
/* old "P" */
#define Z_PARAM_PATH_STR_EX(dest, check_null, separate) \
Z_PARAM_PROLOGUE(separate); \
if (UNEXPECTED(!_z_param_path_str(_arg, &dest, check_null TSRMLS_CC))) { \
if (UNEXPECTED(!_z_param_path_str(_arg, &dest, check_null))) { \
_expected_type = Z_EXPECTED_PATH; \
error_code = ZPP_ERROR_WRONG_ARG; \
break; \
@ -974,7 +974,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
/* old "s" */
#define Z_PARAM_STRING_EX(dest, dest_len, check_null, separate) \
Z_PARAM_PROLOGUE(separate); \
if (UNEXPECTED(!_z_param_string(_arg, &dest, &dest_len, check_null TSRMLS_CC))) { \
if (UNEXPECTED(!_z_param_string(_arg, &dest, &dest_len, check_null))) { \
_expected_type = Z_EXPECTED_STRING; \
error_code = ZPP_ERROR_WRONG_ARG; \
break; \
@ -986,7 +986,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
/* old "S" */
#define Z_PARAM_STR_EX(dest, check_null, separate) \
Z_PARAM_PROLOGUE(separate); \
if (UNEXPECTED(!_z_param_str(_arg, &dest, check_null TSRMLS_CC))) { \
if (UNEXPECTED(!_z_param_str(_arg, &dest, check_null))) { \
_expected_type = Z_EXPECTED_STRING; \
error_code = ZPP_ERROR_WRONG_ARG; \
break; \
@ -1036,7 +1036,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
/* Private part of new parameter parsing API */
static zend_always_inline int _z_param_bool(zval *arg, zend_bool *dest, zend_bool *is_null, int check_null TSRMLS_DC)
static zend_always_inline int _z_param_bool(zval *arg, zend_bool *dest, zend_bool *is_null, int check_null)
{
if (check_null) {
*is_null = 0;
@ -1049,7 +1049,7 @@ static zend_always_inline int _z_param_bool(zval *arg, zend_bool *dest, zend_boo
}
*dest = 0;
} else if (EXPECTED(Z_TYPE_P(arg) <= IS_STRING)) {
*dest = zend_is_true(arg TSRMLS_CC);
*dest = zend_is_true(arg);
} else {
return 0;
}
@ -1145,7 +1145,7 @@ static zend_always_inline int _z_param_double(zval *arg, double *dest, zend_bool
return 1;
}
static zend_always_inline int _z_param_str(zval *arg, zend_string **dest, int check_null TSRMLS_DC)
static zend_always_inline int _z_param_str(zval *arg, zend_string **dest, int check_null)
{
if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
*dest = Z_STR_P(arg);
@ -1161,17 +1161,17 @@ static zend_always_inline int _z_param_str(zval *arg, zend_string **dest, int ch
*dest = Z_STR_P(arg);
}
} else if (UNEXPECTED(Z_TYPE_P(arg) != IS_OBJECT) ||
UNEXPECTED(parse_arg_object_to_str(arg, dest, IS_STRING TSRMLS_CC) != SUCCESS)) {
UNEXPECTED(parse_arg_object_to_str(arg, dest, IS_STRING) != SUCCESS)) {
return 0;
}
return 1;
}
static zend_always_inline int _z_param_string(zval *arg, char **dest, size_t *dest_len, int check_null TSRMLS_DC)
static zend_always_inline int _z_param_string(zval *arg, char **dest, size_t *dest_len, int check_null)
{
zend_string *str;
if (!_z_param_str(arg, &str, check_null TSRMLS_CC)) {
if (!_z_param_str(arg, &str, check_null)) {
return 0;
}
if (check_null && UNEXPECTED(!str)) {
@ -1184,9 +1184,9 @@ static zend_always_inline int _z_param_string(zval *arg, char **dest, size_t *de
return 1;
}
static zend_always_inline int _z_param_path_str(zval *arg, zend_string **dest, int check_null TSRMLS_DC)
static zend_always_inline int _z_param_path_str(zval *arg, zend_string **dest, int check_null)
{
if (!_z_param_str(arg, dest, check_null TSRMLS_CC) ||
if (!_z_param_str(arg, dest, check_null) ||
(check_null && UNEXPECTED(!(*dest)->val[0])) ||
UNEXPECTED(CHECK_NULL_PATH((*dest)->val, (*dest)->len))) {
return 0;
@ -1194,11 +1194,11 @@ static zend_always_inline int _z_param_path_str(zval *arg, zend_string **dest, i
return 1;
}
static zend_always_inline int _z_param_path(zval *arg, char **dest, size_t *dest_len, int check_null TSRMLS_DC)
static zend_always_inline int _z_param_path(zval *arg, char **dest, size_t *dest_len, int check_null)
{
zend_string *str;
if (!_z_param_path_str(arg, &str, check_null TSRMLS_CC)) {
if (!_z_param_path_str(arg, &str, check_null)) {
return 0;
}
if (check_null && UNEXPECTED(!str)) {
@ -1224,12 +1224,12 @@ static zend_always_inline int _z_param_array(zval *arg, zval **dest, int check_n
return 1;
}
static zend_always_inline int _z_param_array_ht(zval *arg, HashTable **dest, int check_null, int or_object TSRMLS_DC)
static zend_always_inline int _z_param_array_ht(zval *arg, HashTable **dest, int check_null, int or_object)
{
if (EXPECTED(Z_TYPE_P(arg) == IS_ARRAY)) {
*dest = Z_ARRVAL_P(arg);
} else if (or_object && EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) {
*dest = Z_OBJ_HT_P(arg)->get_properties(arg TSRMLS_CC);
*dest = Z_OBJ_HT_P(arg)->get_properties(arg);
} else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
*dest = NULL;
} else {
@ -1238,10 +1238,10 @@ static zend_always_inline int _z_param_array_ht(zval *arg, HashTable **dest, int
return 1;
}
static zend_always_inline int _z_param_object(zval *arg, zval **dest, zend_class_entry *ce, int check_null TSRMLS_DC)
static zend_always_inline int _z_param_object(zval *arg, zval **dest, zend_class_entry *ce, int check_null)
{
if (EXPECTED(Z_TYPE_P(arg) == IS_OBJECT) &&
(!ce || EXPECTED(instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC) != 0))) {
(!ce || EXPECTED(instanceof_function(Z_OBJCE_P(arg), ce) != 0))) {
*dest = arg;
} else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
*dest = NULL;
@ -1263,13 +1263,13 @@ static zend_always_inline int _z_param_resource(zval *arg, zval **dest, int chec
return 1;
}
static zend_always_inline int _z_param_func(zval *arg, zend_fcall_info *dest_fci, zend_fcall_info_cache *dest_fcc, int check_null, char **error TSRMLS_DC)
static zend_always_inline int _z_param_func(zval *arg, zend_fcall_info *dest_fci, zend_fcall_info_cache *dest_fcc, int check_null, char **error)
{
if (check_null && UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
dest_fci->size = 0;
dest_fcc->initialized = 0;
*error = NULL;
} else if (UNEXPECTED(zend_fcall_info_init(arg, 0, dest_fci, dest_fcc, NULL, error TSRMLS_CC) != SUCCESS)) {
} else if (UNEXPECTED(zend_fcall_info_init(arg, 0, dest_fci, dest_fcc, NULL, error) != SUCCESS)) {
return 0;
}
return 1;

View file

@ -368,7 +368,6 @@ static ZEND_NORETURN void zend_mm_safe_error(zend_mm_heap *heap,
#endif
size_t size)
{
TSRMLS_FETCH();
heap->overflow = 1;
zend_try {
@ -1836,7 +1835,7 @@ static zend_long zend_mm_find_leaks(zend_mm_heap *heap, zend_mm_chunk *p, int i,
return count;
}
static void zend_mm_check_leaks(zend_mm_heap *heap TSRMLS_DC)
static void zend_mm_check_leaks(zend_mm_heap *heap)
{
zend_mm_huge_list *list;
zend_mm_chunk *p;
@ -1859,12 +1858,12 @@ static void zend_mm_check_leaks(zend_mm_heap *heap TSRMLS_DC)
leak.lineno = list->dbg.lineno;
leak.orig_lineno = list->dbg.orig_lineno;
zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL TSRMLS_CC);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, &leak TSRMLS_CC);
zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, &leak);
//??? repeated = zend_mm_find_leaks_huge(segment, p);
total += 1 + repeated;
if (repeated) {
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated TSRMLS_CC);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated);
}
list = list->next;
@ -1892,8 +1891,8 @@ static void zend_mm_check_leaks(zend_mm_heap *heap TSRMLS_DC)
leak.lineno = dbg->lineno;
leak.orig_lineno = dbg->orig_lineno;
zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL TSRMLS_CC);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, &leak TSRMLS_CC);
zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, &leak);
dbg->size = 0;
dbg->filename = NULL;
@ -1903,7 +1902,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap TSRMLS_DC)
zend_mm_find_leaks(heap, p, i + bin_pages[bin_num], &leak);
total += 1 + repeated;
if (repeated) {
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated TSRMLS_CC);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated);
}
}
dbg = (zend_mm_debug_info*)((char*)dbg + bin_data_size[bin_num]);
@ -1921,15 +1920,15 @@ static void zend_mm_check_leaks(zend_mm_heap *heap TSRMLS_DC)
leak.lineno = dbg->lineno;
leak.orig_lineno = dbg->orig_lineno;
zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL TSRMLS_CC);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, &leak TSRMLS_CC);
zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, &leak);
zend_mm_bitset_reset_range(p->free_map, i, pages_count);
repeated = zend_mm_find_leaks(heap, p, i + pages_count, &leak);
total += 1 + repeated;
if (repeated) {
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated TSRMLS_CC);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated);
}
i += pages_count;
}
@ -1940,12 +1939,12 @@ static void zend_mm_check_leaks(zend_mm_heap *heap TSRMLS_DC)
p = p->next;
} while (p != heap->main_chunk);
if (total) {
zend_message_dispatcher(ZMSG_MEMORY_LEAKS_GRAND_TOTAL, &total TSRMLS_CC);
zend_message_dispatcher(ZMSG_MEMORY_LEAKS_GRAND_TOTAL, &total);
}
}
#endif
void zend_mm_shutdown(zend_mm_heap *heap, int full, int silent TSRMLS_DC)
void zend_mm_shutdown(zend_mm_heap *heap, int full, int silent)
{
zend_mm_chunk *p;
zend_mm_huge_list *list;
@ -1958,7 +1957,7 @@ void zend_mm_shutdown(zend_mm_heap *heap, int full, int silent TSRMLS_DC)
#if ZEND_DEBUG
if (!silent) {
zend_mm_check_leaks(heap TSRMLS_CC);
zend_mm_check_leaks(heap);
}
#endif
@ -2080,13 +2079,13 @@ typedef struct _zend_alloc_globals {
#ifdef ZTS
static int alloc_globals_id;
# define AG(v) TSRMG(alloc_globals_id, zend_alloc_globals *, v)
# define AG(v) ZEND_TSRMG(alloc_globals_id, zend_alloc_globals *, v)
#else
# define AG(v) (alloc_globals.v)
static zend_alloc_globals alloc_globals;
#endif
ZEND_API int is_zend_mm(TSRMLS_D)
ZEND_API int is_zend_mm(void)
{
#if ZEND_MM_CUSTOM
return !AG(mm_heap)->use_custom_heap;
@ -2117,7 +2116,6 @@ ZEND_API int is_zend_mm(TSRMLS_D)
# define _ZEND_BIN_ALLOCATOR(_num, _size, _elements, _pages, x, y) \
ZEND_API void* ZEND_FASTCALL _emalloc_ ## _size(void) { \
TSRMLS_FETCH(); \
ZEND_MM_CUSTOM_ALLOCATOR(_size); \
return zend_mm_alloc_small(AG(mm_heap), _size, _num ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); \
}
@ -2126,7 +2124,6 @@ ZEND_MM_BINS_INFO(_ZEND_BIN_ALLOCATOR, x, y)
ZEND_API void* ZEND_FASTCALL _emalloc_large(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
TSRMLS_FETCH();
ZEND_MM_CUSTOM_ALLOCATOR(size);
return zend_mm_alloc_large(AG(mm_heap), size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
@ -2134,7 +2131,6 @@ ZEND_API void* ZEND_FASTCALL _emalloc_large(size_t size ZEND_FILE_LINE_DC ZEND_F
ZEND_API void* ZEND_FASTCALL _emalloc_huge(size_t size)
{
TSRMLS_FETCH();
ZEND_MM_CUSTOM_ALLOCATOR(size);
return zend_mm_alloc_huge(AG(mm_heap), size);
@ -2143,7 +2139,6 @@ ZEND_API void* ZEND_FASTCALL _emalloc_huge(size_t size)
#if ZEND_DEBUG
# define _ZEND_BIN_FREE(_num, _size, _elements, _pages, x, y) \
ZEND_API void ZEND_FASTCALL _efree_ ## _size(void *ptr) { \
TSRMLS_FETCH(); \
ZEND_MM_CUSTOM_DEALLOCATOR(ptr); \
{ \
size_t page_offset = ZEND_MM_ALIGNED_OFFSET(ptr, ZEND_MM_CHUNK_SIZE); \
@ -2158,7 +2153,6 @@ ZEND_API void* ZEND_FASTCALL _emalloc_huge(size_t size)
#else
# define _ZEND_BIN_FREE(_num, _size, _elements, _pages, x, y) \
ZEND_API void ZEND_FASTCALL _efree_ ## _size(void *ptr) { \
TSRMLS_FETCH(); \
ZEND_MM_CUSTOM_DEALLOCATOR(ptr); \
{ \
zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); \
@ -2172,7 +2166,6 @@ ZEND_MM_BINS_INFO(_ZEND_BIN_FREE, x, y)
ZEND_API void ZEND_FASTCALL _efree_large(void *ptr, size_t size)
{
TSRMLS_FETCH();
ZEND_MM_CUSTOM_DEALLOCATOR(ptr);
{
@ -2190,7 +2183,6 @@ ZEND_API void ZEND_FASTCALL _efree_large(void *ptr, size_t size)
ZEND_API void ZEND_FASTCALL _efree_huge(void *ptr, size_t size)
{
TSRMLS_FETCH();
ZEND_MM_CUSTOM_DEALLOCATOR(ptr);
// TODO: use size???
@ -2200,7 +2192,6 @@ ZEND_API void ZEND_FASTCALL _efree_huge(void *ptr, size_t size)
ZEND_API void* ZEND_FASTCALL _emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
TSRMLS_FETCH();
#if ZEND_MM_CUSTOM
if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
@ -2212,7 +2203,6 @@ ZEND_API void* ZEND_FASTCALL _emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LI
ZEND_API void ZEND_FASTCALL _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
TSRMLS_FETCH();
#if ZEND_MM_CUSTOM
if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
@ -2225,7 +2215,6 @@ ZEND_API void ZEND_FASTCALL _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_OR
ZEND_API void* ZEND_FASTCALL _erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
TSRMLS_FETCH();
if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
return AG(mm_heap)->_realloc(ptr, size);
@ -2233,7 +2222,7 @@ ZEND_API void* ZEND_FASTCALL _erealloc(void *ptr, size_t size, int allow_failure
return zend_mm_realloc_heap(AG(mm_heap), ptr, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
ZEND_API size_t ZEND_FASTCALL _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
ZEND_API size_t ZEND_FASTCALL _zend_mem_block_size(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
return 0;
@ -2279,7 +2268,6 @@ ZEND_API void* ZEND_FASTCALL _ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_D
{
void *p;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
HANDLE_BLOCK_INTERRUPTIONS();
@ -2298,7 +2286,6 @@ ZEND_API char* ZEND_FASTCALL _estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_
size_t length;
char *p;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
HANDLE_BLOCK_INTERRUPTIONS();
@ -2318,7 +2305,6 @@ ZEND_API char* ZEND_FASTCALL _estrndup(const char *s, size_t length ZEND_FILE_LI
{
char *p;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
HANDLE_BLOCK_INTERRUPTIONS();
@ -2339,7 +2325,6 @@ ZEND_API char* ZEND_FASTCALL zend_strndup(const char *s, size_t length)
{
char *p;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
HANDLE_BLOCK_INTERRUPTIONS();
@ -2358,7 +2343,7 @@ ZEND_API char* ZEND_FASTCALL zend_strndup(const char *s, size_t length)
}
ZEND_API int zend_set_memory_limit(size_t memory_limit TSRMLS_DC)
ZEND_API int zend_set_memory_limit(size_t memory_limit)
{
#if ZEND_MM_LIMIT
AG(mm_heap)->limit = (memory_limit >= ZEND_MM_CHUNK_SIZE) ? memory_limit : ZEND_MM_CHUNK_SIZE;
@ -2366,7 +2351,7 @@ ZEND_API int zend_set_memory_limit(size_t memory_limit TSRMLS_DC)
return SUCCESS;
}
ZEND_API size_t zend_memory_usage(int real_usage TSRMLS_DC)
ZEND_API size_t zend_memory_usage(int real_usage)
{
#if ZEND_MM_STAT
if (real_usage) {
@ -2379,7 +2364,7 @@ ZEND_API size_t zend_memory_usage(int real_usage TSRMLS_DC)
return 0;
}
ZEND_API size_t zend_memory_peak_usage(int real_usage TSRMLS_DC)
ZEND_API size_t zend_memory_peak_usage(int real_usage)
{
#if ZEND_MM_STAT
if (real_usage) {
@ -2391,12 +2376,12 @@ ZEND_API size_t zend_memory_peak_usage(int real_usage TSRMLS_DC)
return 0;
}
ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC)
ZEND_API void shutdown_memory_manager(int silent, int full_shutdown)
{
zend_mm_shutdown(AG(mm_heap), full_shutdown, silent TSRMLS_CC);
zend_mm_shutdown(AG(mm_heap), full_shutdown, silent);
}
static void alloc_globals_ctor(zend_alloc_globals *alloc_globals TSRMLS_DC)
static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
{
#if ZEND_MM_CUSTOM
char *tmp = getenv("USE_ZEND_ALLOC");
@ -2411,17 +2396,18 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals TSRMLS_DC)
return;
}
#endif
ZEND_TSRMLS_CACHE_UPDATE;
alloc_globals->mm_heap = zend_mm_init();
}
#ifdef ZTS
static void alloc_globals_dtor(zend_alloc_globals *alloc_globals TSRMLS_DC)
static void alloc_globals_dtor(zend_alloc_globals *alloc_globals)
{
shutdown_memory_manager(1, 1 TSRMLS_CC);
zend_mm_shutdown(alloc_globals->mm_heap, 1, 1);
}
#endif
ZEND_API void start_memory_manager(TSRMLS_D)
ZEND_API void start_memory_manager(void)
{
#ifdef ZTS
ts_allocate_id(&alloc_globals_id, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, (ts_allocate_dtor) alloc_globals_dtor);
@ -2437,7 +2423,7 @@ ZEND_API void start_memory_manager(TSRMLS_D)
#endif
}
ZEND_API zend_mm_heap *zend_mm_set_heap(zend_mm_heap *new_heap TSRMLS_DC)
ZEND_API zend_mm_heap *zend_mm_set_heap(zend_mm_heap *new_heap)
{
zend_mm_heap *old_heap;

View file

@ -64,7 +64,7 @@ ZEND_API void* ZEND_FASTCALL _safe_erealloc(void *ptr, size_t nmemb, size_t siz
ZEND_API void* ZEND_FASTCALL _safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset);
ZEND_API char* ZEND_FASTCALL _estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
ZEND_API char* ZEND_FASTCALL _estrndup(const char *s, size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
ZEND_API size_t ZEND_FASTCALL _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
ZEND_API size_t ZEND_FASTCALL _zend_mem_block_size(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
#include "zend_alloc_sizes.h"
@ -150,7 +150,7 @@ ZEND_API void ZEND_FASTCALL _efree_huge(void *, size_t size);
#define erealloc_recoverable(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
#define estrdup(s) _estrdup((s) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
#define estrndup(s, length) _estrndup((s), (length) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
#define zend_mem_block_size(ptr) _zend_mem_block_size((ptr) TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
#define zend_mem_block_size(ptr) _zend_mem_block_size((ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
/* Relay wrapper macros */
#define emalloc_rel(size) _emalloc((size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
@ -162,7 +162,7 @@ ZEND_API void ZEND_FASTCALL _efree_huge(void *, size_t size);
#define safe_erealloc_rel(ptr, nmemb, size, offset) _safe_erealloc((ptr), (nmemb), (size), (offset) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
#define estrdup_rel(s) _estrdup((s) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
#define estrndup_rel(s, length) _estrndup((s), (length) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
#define zend_mem_block_size_rel(ptr) _zend_mem_block_size((ptr) TSRMLS_CC ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
#define zend_mem_block_size_rel(ptr) _zend_mem_block_size((ptr) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
zend_always_inline static void * __zend_malloc(size_t len)
{
@ -211,14 +211,14 @@ zend_always_inline static void * __zend_realloc(void *p, size_t len)
#define perealloc_recoverable_rel(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc_recoverable_rel((ptr), (size)))
#define pestrdup_rel(s, persistent) ((persistent)?strdup(s):estrdup_rel(s))
ZEND_API int zend_set_memory_limit(size_t memory_limit TSRMLS_DC);
ZEND_API int zend_set_memory_limit(size_t memory_limit);
ZEND_API void start_memory_manager(TSRMLS_D);
ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC);
ZEND_API int is_zend_mm(TSRMLS_D);
ZEND_API void start_memory_manager(void);
ZEND_API void shutdown_memory_manager(int silent, int full_shutdown);
ZEND_API int is_zend_mm(void);
ZEND_API size_t zend_memory_usage(int real_usage TSRMLS_DC);
ZEND_API size_t zend_memory_peak_usage(int real_usage TSRMLS_DC);
ZEND_API size_t zend_memory_usage(int real_usage);
ZEND_API size_t zend_memory_peak_usage(int real_usage);
/* fast cache for HashTables */
#define ALLOC_HASHTABLE(ht) \
@ -237,7 +237,7 @@ ZEND_API size_t zend_memory_peak_usage(int real_usage TSRMLS_DC);
typedef struct _zend_mm_heap zend_mm_heap;
ZEND_API zend_mm_heap *zend_mm_startup(void);
ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent TSRMLS_DC);
ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent);
ZEND_API void* ZEND_FASTCALL _zend_mm_alloc(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
ZEND_API void ZEND_FASTCALL _zend_mm_free(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
ZEND_API void* ZEND_FASTCALL _zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
@ -253,7 +253,7 @@ ZEND_API size_t ZEND_FASTCALL _zend_mm_block_size(zend_mm_heap *heap, void *p ZE
#define zend_mm_realloc_rel(heap, p, size) _zend_mm_realloc((heap), (p), (size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
#define zend_mm_block_size_rel(heap, p) _zend_mm_block_size((heap), (p) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
ZEND_API zend_mm_heap *zend_mm_set_heap(zend_mm_heap *new_heap TSRMLS_DC);
ZEND_API zend_mm_heap *zend_mm_set_heap(zend_mm_heap *new_heap);
ZEND_API void zend_mm_set_custom_handlers(zend_mm_heap *heap,
void* (*_malloc)(size_t),

View file

@ -23,12 +23,12 @@
#include "zend_API.h"
#include "zend_operators.h"
static inline void *zend_ast_alloc(size_t size TSRMLS_DC) {
static inline void *zend_ast_alloc(size_t size) {
return zend_arena_alloc(&CG(ast_arena), size);
}
static inline void *zend_ast_realloc(void *old, size_t old_size, size_t new_size TSRMLS_DC) {
void *new = zend_ast_alloc(new_size TSRMLS_CC);
static inline void *zend_ast_realloc(void *old, size_t old_size, size_t new_size) {
void *new = zend_ast_alloc(new_size);
memcpy(new, old, old_size);
return new;
}
@ -43,9 +43,8 @@ static inline size_t zend_ast_list_size(uint32_t children) {
ZEND_API zend_ast *zend_ast_create_znode(znode *node) {
zend_ast_znode *ast;
TSRMLS_FETCH();
ast = zend_ast_alloc(sizeof(zend_ast_znode) TSRMLS_CC);
ast = zend_ast_alloc(sizeof(zend_ast_znode));
ast->kind = ZEND_AST_ZNODE;
ast->attr = 0;
ast->lineno = CG(zend_lineno);
@ -55,9 +54,8 @@ ZEND_API zend_ast *zend_ast_create_znode(znode *node) {
ZEND_API zend_ast *zend_ast_create_zval_ex(zval *zv, zend_ast_attr attr) {
zend_ast_zval *ast;
TSRMLS_FETCH();
ast = zend_ast_alloc(sizeof(zend_ast_zval) TSRMLS_CC);
ast = zend_ast_alloc(sizeof(zend_ast_zval));
ast->kind = ZEND_AST_ZVAL;
ast->attr = attr;
ZVAL_COPY_VALUE(&ast->val, zv);
@ -70,9 +68,8 @@ ZEND_API zend_ast *zend_ast_create_decl(
zend_string *name, zend_ast *child0, zend_ast *child1, zend_ast *child2
) {
zend_ast_decl *ast;
TSRMLS_FETCH();
ast = zend_ast_alloc(sizeof(zend_ast_decl) TSRMLS_CC);
ast = zend_ast_alloc(sizeof(zend_ast_decl));
ast->kind = kind;
ast->attr = 0;
ast->start_lineno = start_lineno;
@ -91,9 +88,8 @@ ZEND_API zend_ast *zend_ast_create_decl(
static zend_ast *zend_ast_create_from_va_list(zend_ast_kind kind, zend_ast_attr attr, va_list va) {
uint32_t i, children = kind >> ZEND_AST_NUM_CHILDREN_SHIFT;
zend_ast *ast;
TSRMLS_FETCH();
ast = zend_ast_alloc(zend_ast_size(children) TSRMLS_CC);
ast = zend_ast_alloc(zend_ast_size(children));
ast->kind = kind;
ast->attr = attr;
ast->lineno = (uint32_t) -1;
@ -140,9 +136,8 @@ ZEND_API zend_ast *zend_ast_create(zend_ast_kind kind, ...) {
ZEND_API zend_ast *zend_ast_create_list(uint32_t init_children, zend_ast_kind kind, ...) {
zend_ast *ast;
zend_ast_list *list;
TSRMLS_FETCH();
ast = zend_ast_alloc(zend_ast_list_size(4) TSRMLS_CC);
ast = zend_ast_alloc(zend_ast_list_size(4));
list = (zend_ast_list *) ast;
list->kind = kind;
list->attr = 0;
@ -169,15 +164,14 @@ static inline zend_bool is_power_of_two(uint32_t n) {
ZEND_API zend_ast *zend_ast_list_add(zend_ast *ast, zend_ast *op) {
zend_ast_list *list = zend_ast_get_list(ast);
if (list->children >= 4 && is_power_of_two(list->children)) {
TSRMLS_FETCH();
list = zend_ast_realloc(list,
zend_ast_list_size(list->children), zend_ast_list_size(list->children * 2) TSRMLS_CC);
list = zend_ast_realloc(list,
zend_ast_list_size(list->children), zend_ast_list_size(list->children * 2));
}
list->child[list->children++] = op;
return (zend_ast *) list;
}
static void zend_ast_add_array_element(zval *result, zval *offset, zval *expr TSRMLS_DC)
static void zend_ast_add_array_element(zval *result, zval *offset, zval *expr)
{
switch (Z_TYPE_P(offset)) {
case IS_UNDEF:
@ -208,7 +202,7 @@ static void zend_ast_add_array_element(zval *result, zval *offset, zval *expr TS
}
}
ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope TSRMLS_DC)
ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope)
{
zval op1, op2;
@ -216,9 +210,9 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
case ZEND_AST_BINARY_OP:
{
binary_op_type op = get_binary_op(ast->attr);
zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
zend_ast_evaluate(&op2, ast->child[1], scope TSRMLS_CC);
op(result, &op1, &op2 TSRMLS_CC);
zend_ast_evaluate(&op1, ast->child[0], scope);
zend_ast_evaluate(&op2, ast->child[1], scope);
op(result, &op1, &op2);
zval_dtor(&op1);
zval_dtor(&op2);
break;
@ -229,9 +223,9 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
/* op1 > op2 is the same as op2 < op1 */
binary_op_type op = ast->kind == ZEND_AST_GREATER
? is_smaller_function : is_smaller_or_equal_function;
zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
zend_ast_evaluate(&op2, ast->child[1], scope TSRMLS_CC);
op(result, &op2, &op1 TSRMLS_CC);
zend_ast_evaluate(&op1, ast->child[0], scope);
zend_ast_evaluate(&op2, ast->child[1], scope);
op(result, &op2, &op1);
zval_dtor(&op1);
zval_dtor(&op2);
break;
@ -239,8 +233,8 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
case ZEND_AST_UNARY_OP:
{
unary_op_type op = get_unary_op(ast->attr);
zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
op(result, &op1 TSRMLS_CC);
zend_ast_evaluate(&op1, ast->child[0], scope);
op(result, &op1);
zval_dtor(&op1);
break;
}
@ -250,22 +244,22 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
if (scope) {
/* class constants may be updated in-place */
if (Z_OPT_CONSTANT_P(zv)) {
zval_update_constant_ex(zv, 1, scope TSRMLS_CC);
zval_update_constant_ex(zv, 1, scope);
}
ZVAL_DUP(result, zv);
} else {
ZVAL_DUP(result, zv);
if (Z_OPT_CONSTANT_P(result)) {
zval_update_constant_ex(result, 1, scope TSRMLS_CC);
zval_update_constant_ex(result, 1, scope);
}
}
break;
}
case ZEND_AST_AND:
zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
if (zend_is_true(&op1 TSRMLS_CC)) {
zend_ast_evaluate(&op2, ast->child[1], scope TSRMLS_CC);
ZVAL_BOOL(result, zend_is_true(&op2 TSRMLS_CC));
zend_ast_evaluate(&op1, ast->child[0], scope);
if (zend_is_true(&op1)) {
zend_ast_evaluate(&op2, ast->child[1], scope);
ZVAL_BOOL(result, zend_is_true(&op2));
zval_dtor(&op2);
} else {
ZVAL_BOOL(result, 0);
@ -273,40 +267,40 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
zval_dtor(&op1);
break;
case ZEND_AST_OR:
zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
if (zend_is_true(&op1 TSRMLS_CC)) {
zend_ast_evaluate(&op1, ast->child[0], scope);
if (zend_is_true(&op1)) {
ZVAL_BOOL(result, 1);
} else {
zend_ast_evaluate(&op2, ast->child[1], scope TSRMLS_CC);
ZVAL_BOOL(result, zend_is_true(&op2 TSRMLS_CC));
zend_ast_evaluate(&op2, ast->child[1], scope);
ZVAL_BOOL(result, zend_is_true(&op2));
zval_dtor(&op2);
}
zval_dtor(&op1);
break;
case ZEND_AST_CONDITIONAL:
zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
if (zend_is_true(&op1 TSRMLS_CC)) {
zend_ast_evaluate(&op1, ast->child[0], scope);
if (zend_is_true(&op1)) {
if (!ast->child[1]) {
*result = op1;
} else {
zend_ast_evaluate(result, ast->child[1], scope TSRMLS_CC);
zend_ast_evaluate(result, ast->child[1], scope);
zval_dtor(&op1);
}
} else {
zend_ast_evaluate(result, ast->child[2], scope TSRMLS_CC);
zend_ast_evaluate(result, ast->child[2], scope);
zval_dtor(&op1);
}
break;
case ZEND_AST_UNARY_PLUS:
ZVAL_LONG(&op1, 0);
zend_ast_evaluate(&op2, ast->child[0], scope TSRMLS_CC);
add_function(result, &op1, &op2 TSRMLS_CC);
zend_ast_evaluate(&op2, ast->child[0], scope);
add_function(result, &op1, &op2);
zval_dtor(&op2);
break;
case ZEND_AST_UNARY_MINUS:
ZVAL_LONG(&op1, 0);
zend_ast_evaluate(&op2, ast->child[0], scope TSRMLS_CC);
sub_function(result, &op1, &op2 TSRMLS_CC);
zend_ast_evaluate(&op2, ast->child[0], scope);
sub_function(result, &op1, &op2);
zval_dtor(&op2);
break;
case ZEND_AST_ARRAY:
@ -317,21 +311,21 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
for (i = 0; i < list->children; i++) {
zend_ast *elem = list->child[i];
if (elem->child[1]) {
zend_ast_evaluate(&op1, elem->child[1], scope TSRMLS_CC);
zend_ast_evaluate(&op1, elem->child[1], scope);
} else {
ZVAL_UNDEF(&op1);
}
zend_ast_evaluate(&op2, elem->child[0], scope TSRMLS_CC);
zend_ast_add_array_element(result, &op1, &op2 TSRMLS_CC);
zend_ast_evaluate(&op2, elem->child[0], scope);
zend_ast_add_array_element(result, &op1, &op2);
}
}
break;
case ZEND_AST_DIM:
zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
zend_ast_evaluate(&op2, ast->child[1], scope TSRMLS_CC);
zend_ast_evaluate(&op1, ast->child[0], scope);
zend_ast_evaluate(&op2, ast->child[1], scope);
{
zval tmp;
zend_fetch_dimension_by_zval(&tmp, &op1, &op2 TSRMLS_CC);
zend_fetch_dimension_by_zval(&tmp, &op1, &op2);
ZVAL_ZVAL(result, &tmp, 1, 1);
}
zval_dtor(&op1);
@ -429,17 +423,17 @@ ZEND_API void zend_ast_destroy_and_free(zend_ast *ast) {
zend_ast_destroy_ex(ast, 1);
}
ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn TSRMLS_DC) {
ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn) {
if (zend_ast_is_list(ast)) {
zend_ast_list *list = zend_ast_get_list(ast);
uint32_t i;
for (i = 0; i < list->children; ++i) {
fn(&list->child[i] TSRMLS_CC);
fn(&list->child[i]);
}
} else {
uint32_t i, children = zend_ast_get_num_children(ast);
for (i = 0; i < children; ++i) {
fn(&ast->child[i] TSRMLS_CC);
fn(&ast->child[i]);
}
}
}

View file

@ -199,14 +199,14 @@ ZEND_API zend_ast *zend_ast_create_decl(
ZEND_API zend_ast *zend_ast_create_list(uint32_t init_children, zend_ast_kind kind, ...);
ZEND_API zend_ast *zend_ast_list_add(zend_ast *list, zend_ast *op);
ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope TSRMLS_DC);
ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope);
ZEND_API zend_ast *zend_ast_copy(zend_ast *ast);
ZEND_API void zend_ast_destroy(zend_ast *ast);
ZEND_API void zend_ast_destroy_and_free(zend_ast *ast);
typedef void (*zend_ast_apply_func)(zend_ast **ast_ptr TSRMLS_DC);
ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn TSRMLS_DC);
typedef void (*zend_ast_apply_func)(zend_ast **ast_ptr);
ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn);
static zend_always_inline zend_bool zend_ast_is_list(zend_ast *ast) {
return (ast->kind >> ZEND_AST_IS_LIST_SHIFT) & 1;

View file

@ -321,9 +321,9 @@ ZEND_MINIT_FUNCTION(core) { /* {{{ */
zend_class_entry class_entry;
INIT_CLASS_ENTRY(class_entry, "stdClass", NULL);
zend_standard_class_def = zend_register_internal_class(&class_entry TSRMLS_CC);
zend_standard_class_def = zend_register_internal_class(&class_entry);
zend_register_default_classes(TSRMLS_C);
zend_register_default_classes();
return SUCCESS;
}
@ -343,11 +343,11 @@ zend_module_entry zend_builtin_module = { /* {{{ */
};
/* }}} */
int zend_startup_builtin_functions(TSRMLS_D) /* {{{ */
int zend_startup_builtin_functions(void) /* {{{ */
{
zend_builtin_module.module_number = 0;
zend_builtin_module.type = MODULE_PERSISTENT;
return (EG(current_module) = zend_register_module_ex(&zend_builtin_module TSRMLS_CC)) == NULL ? FAILURE : SUCCESS;
return (EG(current_module) = zend_register_module_ex(&zend_builtin_module)) == NULL ? FAILURE : SUCCESS;
}
/* }}} */
@ -364,7 +364,7 @@ ZEND_FUNCTION(zend_version)
Returns number of freed zvals */
ZEND_FUNCTION(gc_collect_cycles)
{
RETURN_LONG(gc_collect_cycles(TSRMLS_C));
RETURN_LONG(gc_collect_cycles());
}
/* }}} */
@ -420,7 +420,7 @@ ZEND_FUNCTION(func_get_arg)
zend_long requested_offset;
zend_execute_data *ex;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &requested_offset) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &requested_offset) == FAILURE) {
return;
}
@ -526,7 +526,7 @@ ZEND_FUNCTION(strlen)
zend_string *s;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &s) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &s) == FAILURE) {
return;
}
#else
@ -545,7 +545,7 @@ ZEND_FUNCTION(strcmp)
{
zend_string *s1, *s2;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &s1, &s2) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &s1, &s2) == FAILURE) {
return;
}
@ -560,7 +560,7 @@ ZEND_FUNCTION(strncmp)
zend_string *s1, *s2;
zend_long len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl", &s1, &s2, &len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SSl", &s1, &s2, &len) == FAILURE) {
return;
}
@ -579,7 +579,7 @@ ZEND_FUNCTION(strcasecmp)
{
zend_string *s1, *s2;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &s1, &s2) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &s1, &s2) == FAILURE) {
return;
}
@ -594,7 +594,7 @@ ZEND_FUNCTION(strncasecmp)
zend_string *s1, *s2;
zend_long len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl", &s1, &s2, &len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SSl", &s1, &s2, &len) == FAILURE) {
return;
}
@ -616,7 +616,7 @@ ZEND_FUNCTION(each)
HashTable *target_hash;
zend_string *key;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/", &array) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/", &array) == FAILURE) {
return;
}
@ -673,7 +673,7 @@ ZEND_FUNCTION(error_reporting)
zend_string *err;
int old_error_reporting;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &err) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &err) == FAILURE) {
return;
}
@ -688,6 +688,71 @@ ZEND_FUNCTION(error_reporting)
}
/* }}} */
static int validate_constant_array(HashTable *ht) /* {{{ */
{
int ret = 1;
zval *val;
ht->u.v.nApplyCount++;
ZEND_HASH_FOREACH_VAL_IND(ht, val) {
ZVAL_DEREF(val);
if (Z_REFCOUNTED_P(val)) {
if (Z_TYPE_P(val) == IS_ARRAY) {
if (!Z_IMMUTABLE_P(val)) {
if (Z_ARRVAL_P(val)->u.v.nApplyCount > 0) {
zend_error(E_WARNING, "Constants cannot be recursive arrays");
ret = 0;
break;
} else if (!validate_constant_array(Z_ARRVAL_P(val))) {
ret = 0;
break;
}
}
} else if (Z_TYPE_P(val) != IS_STRING && Z_TYPE_P(val) != IS_RESOURCE) {
zend_error(E_WARNING, "Constants may only evaluate to scalar values or arrays");
ret = 0;
break;
}
}
} ZEND_HASH_FOREACH_END();
ht->u.v.nApplyCount--;
return ret;
}
/* }}} */
static void copy_constant_array(zval *dst, zval *src) /* {{{ */
{
zend_string *key;
zend_ulong idx;
zval *new_val, *val;
array_init_size(dst, zend_hash_num_elements(Z_ARRVAL_P(src)));
ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(src), idx, key, val) {
/* constant arrays can't contain references */
if (Z_ISREF_P(val)) {
if (Z_REFCOUNT_P(val) == 1) {
ZVAL_UNREF(val);
} else {
Z_DELREF_P(val);
val = Z_REFVAL_P(val);
}
}
if (key) {
new_val = zend_hash_add_new(Z_ARRVAL_P(dst), key, val);
} else {
new_val = zend_hash_index_add_new(Z_ARRVAL_P(dst), idx, val);
}
if (Z_TYPE_P(val) == IS_ARRAY) {
if (!Z_IMMUTABLE_P(val)) {
copy_constant_array(new_val, val);
}
} else if (Z_REFCOUNTED_P(val)) {
Z_ADDREF_P(val);
}
} ZEND_HASH_FOREACH_END();
}
/* }}} */
/* {{{ proto bool define(string constant_name, mixed value, boolean case_insensitive=false)
Define a new constant */
ZEND_FUNCTION(define)
@ -699,7 +764,7 @@ ZEND_FUNCTION(define)
zend_constant c;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|b", &name, &val, &non_cs) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|b", &name, &val, &non_cs) == FAILURE) {
return;
}
#else
@ -733,15 +798,25 @@ repeat:
case IS_RESOURCE:
case IS_NULL:
break;
case IS_ARRAY:
if (!Z_IMMUTABLE_P(val)) {
if (!validate_constant_array(Z_ARRVAL_P(val))) {
RETURN_FALSE;
} else {
copy_constant_array(&c.value, val);
goto register_constant;
}
}
break;
case IS_OBJECT:
if (Z_TYPE(val_free) == IS_UNDEF) {
if (Z_OBJ_HT_P(val)->get) {
zval rv;
val = Z_OBJ_HT_P(val)->get(val, &rv TSRMLS_CC);
val = Z_OBJ_HT_P(val)->get(val, &rv);
ZVAL_COPY_VALUE(&val_free, val);
goto repeat;
} else if (Z_OBJ_HT_P(val)->cast_object) {
if (Z_OBJ_HT_P(val)->cast_object(val, &val_free, IS_STRING TSRMLS_CC) == SUCCESS) {
if (Z_OBJ_HT_P(val)->cast_object(val, &val_free, IS_STRING) == SUCCESS) {
val = &val_free;
break;
}
@ -749,17 +824,18 @@ repeat:
}
/* no break */
default:
zend_error(E_WARNING,"Constants may only evaluate to scalar values");
zend_error(E_WARNING, "Constants may only evaluate to scalar values or arrays");
zval_ptr_dtor(&val_free);
RETURN_FALSE;
}
ZVAL_DUP(&c.value, val);
zval_ptr_dtor(&val_free);
register_constant:
c.flags = case_sensitive; /* non persistent */
c.name = zend_string_copy(name);
c.module_number = PHP_USER_CONSTANT;
if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) {
if (zend_register_constant(&c) == SUCCESS) {
RETURN_TRUE;
} else {
RETURN_FALSE;
@ -775,7 +851,7 @@ ZEND_FUNCTION(defined)
zend_string *name;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
return;
}
#else
@ -784,7 +860,7 @@ ZEND_FUNCTION(defined)
ZEND_PARSE_PARAMETERS_END();
#endif
if (zend_get_constant_ex(name, NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC)) {
if (zend_get_constant_ex(name, NULL, ZEND_FETCH_CLASS_SILENT)) {
RETURN_TRUE;
} else {
RETURN_FALSE;
@ -798,7 +874,7 @@ ZEND_FUNCTION(get_class)
{
zval *obj = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|o!", &obj) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|o!", &obj) == FAILURE) {
RETURN_FALSE;
}
@ -839,7 +915,7 @@ ZEND_FUNCTION(get_parent_class)
zval *arg;
zend_class_entry *ce = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &arg) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &arg) == FAILURE) {
return;
}
@ -855,7 +931,7 @@ ZEND_FUNCTION(get_parent_class)
if (Z_TYPE_P(arg) == IS_OBJECT) {
ce = Z_OBJ_P(arg)->ce;
} else if (Z_TYPE_P(arg) == IS_STRING) {
ce = zend_lookup_class(Z_STR_P(arg) TSRMLS_CC);
ce = zend_lookup_class(Z_STR_P(arg));
}
if (ce && ce->parent) {
@ -876,7 +952,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) /*
zend_bool retval;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS|b", &obj, &class_name, &allow_string) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zS|b", &obj, &class_name, &allow_string) == FAILURE) {
return;
}
#else
@ -895,7 +971,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) /*
*/
if (allow_string && Z_TYPE_P(obj) == IS_STRING) {
instance_ce = zend_lookup_class(Z_STR_P(obj) TSRMLS_CC);
instance_ce = zend_lookup_class(Z_STR_P(obj));
if (!instance_ce) {
RETURN_FALSE;
}
@ -905,14 +981,14 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) /*
RETURN_FALSE;
}
ce = zend_lookup_class_ex(class_name, NULL, 0 TSRMLS_CC);
ce = zend_lookup_class_ex(class_name, NULL, 0);
if (!ce) {
retval = 0;
} else {
if (only_subclass && instance_ce == ce) {
retval = 0;
} else {
retval = instanceof_function(instance_ce, ce TSRMLS_CC);
retval = instanceof_function(instance_ce, ce);
}
}
@ -937,7 +1013,7 @@ ZEND_FUNCTION(is_a)
/* }}} */
/* {{{ add_class_vars */
static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value TSRMLS_DC)
static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value)
{
zend_property_info *prop_info;
zval *prop, prop_copy;
@ -973,7 +1049,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
/* this is necessary to make it able to work with default array
* properties, returned to user */
if (Z_OPT_CONSTANT_P(prop)) {
zval_update_constant(prop, 0 TSRMLS_CC);
zval_update_constant(prop, 0);
}
zend_hash_add_new(Z_ARRVAL_P(return_value), key, prop);
@ -988,18 +1064,18 @@ ZEND_FUNCTION(get_class_vars)
zend_string *class_name;
zend_class_entry *ce;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &class_name) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &class_name) == FAILURE) {
return;
}
ce = zend_lookup_class(class_name TSRMLS_CC);
ce = zend_lookup_class(class_name);
if (!ce) {
RETURN_FALSE;
} else {
array_init(return_value);
zend_update_class_constants(ce TSRMLS_CC);
add_class_vars(ce, 0, return_value TSRMLS_CC);
add_class_vars(ce, 1, return_value TSRMLS_CC);
zend_update_class_constants(ce);
add_class_vars(ce, 0, return_value);
add_class_vars(ce, 1, return_value);
}
}
/* }}} */
@ -1015,7 +1091,7 @@ ZEND_FUNCTION(get_object_vars)
zend_object *zobj;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &obj) == FAILURE) {
return;
}
#else
@ -1028,7 +1104,7 @@ ZEND_FUNCTION(get_object_vars)
RETURN_FALSE;
}
properties = Z_OBJ_HT_P(obj)->get_properties(obj TSRMLS_CC);
properties = Z_OBJ_HT_P(obj)->get_properties(obj);
if (properties == NULL) {
RETURN_FALSE;
@ -1040,7 +1116,7 @@ ZEND_FUNCTION(get_object_vars)
ZEND_HASH_FOREACH_STR_KEY_VAL_IND(properties, key, value) {
if (key) {
if (zend_check_property_access(zobj, key TSRMLS_CC) == SUCCESS) {
if (zend_check_property_access(zobj, key) == SUCCESS) {
/* Not separating references */
if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
if (key->val[0] == 0) {
@ -1076,14 +1152,14 @@ ZEND_FUNCTION(get_class_methods)
zend_function *mptr;
zend_string *key;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &klass) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &klass) == FAILURE) {
return;
}
if (Z_TYPE_P(klass) == IS_OBJECT) {
ce = Z_OBJCE_P(klass);
} else if (Z_TYPE_P(klass) == IS_STRING) {
ce = zend_lookup_class(Z_STR_P(klass) TSRMLS_CC);
ce = zend_lookup_class(Z_STR_P(klass));
}
if (!ce) {
@ -1136,7 +1212,7 @@ ZEND_FUNCTION(method_exists)
zend_class_entry * ce;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &klass, &method_name) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zS", &klass, &method_name) == FAILURE) {
return;
}
#else
@ -1148,7 +1224,7 @@ ZEND_FUNCTION(method_exists)
if (Z_TYPE_P(klass) == IS_OBJECT) {
ce = Z_OBJCE_P(klass);
} else if (Z_TYPE_P(klass) == IS_STRING) {
if ((ce = zend_lookup_class(Z_STR_P(klass) TSRMLS_CC)) == NULL) {
if ((ce = zend_lookup_class(Z_STR_P(klass))) == NULL) {
RETURN_FALSE;
}
} else {
@ -1165,7 +1241,7 @@ ZEND_FUNCTION(method_exists)
if (Z_TYPE_P(klass) == IS_OBJECT
&& Z_OBJ_HT_P(klass)->get_method != NULL
&& (func = Z_OBJ_HT_P(klass)->get_method(&Z_OBJ_P(klass), method_name, NULL TSRMLS_CC)) != NULL
&& (func = Z_OBJ_HT_P(klass)->get_method(&Z_OBJ_P(klass), method_name, NULL)) != NULL
) {
if (func->type == ZEND_INTERNAL_FUNCTION
&& (func->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0
@ -1198,7 +1274,7 @@ ZEND_FUNCTION(property_exists)
zend_property_info *property_info;
zval property_z;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &object, &property) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zS", &object, &property) == FAILURE) {
return;
}
@ -1207,7 +1283,7 @@ ZEND_FUNCTION(property_exists)
}
if (Z_TYPE_P(object) == IS_STRING) {
ce = zend_lookup_class(Z_STR_P(object) TSRMLS_CC);
ce = zend_lookup_class(Z_STR_P(object));
if (!ce) {
RETURN_FALSE;
}
@ -1227,7 +1303,7 @@ ZEND_FUNCTION(property_exists)
if (Z_TYPE_P(object) == IS_OBJECT &&
Z_OBJ_HANDLER_P(object, has_property) &&
Z_OBJ_HANDLER_P(object, has_property)(object, &property_z, 2, NULL TSRMLS_CC)) {
Z_OBJ_HANDLER_P(object, has_property)(object, &property_z, 2, NULL)) {
RETURN_TRUE;
}
RETURN_FALSE;
@ -1244,7 +1320,7 @@ ZEND_FUNCTION(class_exists)
zend_bool autoload = 1;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &class_name, &autoload) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|b", &class_name, &autoload) == FAILURE) {
return;
}
#else
@ -1269,7 +1345,7 @@ ZEND_FUNCTION(class_exists)
RETURN_BOOL(ce && !((ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT)) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS));
}
ce = zend_lookup_class(class_name TSRMLS_CC);
ce = zend_lookup_class(class_name);
if (ce) {
RETURN_BOOL((ce->ce_flags & (ZEND_ACC_INTERFACE | (ZEND_ACC_TRAIT - ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) == 0);
} else {
@ -1287,7 +1363,7 @@ ZEND_FUNCTION(interface_exists)
zend_bool autoload = 1;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &iface_name, &autoload) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|b", &iface_name, &autoload) == FAILURE) {
return;
}
#else
@ -1312,7 +1388,7 @@ ZEND_FUNCTION(interface_exists)
RETURN_BOOL(ce && ce->ce_flags & ZEND_ACC_INTERFACE);
}
ce = zend_lookup_class(iface_name TSRMLS_CC);
ce = zend_lookup_class(iface_name);
if (ce) {
RETURN_BOOL((ce->ce_flags & ZEND_ACC_INTERFACE) > 0);
} else {
@ -1330,7 +1406,7 @@ ZEND_FUNCTION(trait_exists)
zend_bool autoload = 1;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &trait_name, &autoload) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|b", &trait_name, &autoload) == FAILURE) {
return;
}
#else
@ -1355,7 +1431,7 @@ ZEND_FUNCTION(trait_exists)
RETURN_BOOL(ce && ((ce->ce_flags & ZEND_ACC_TRAIT) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS));
}
ce = zend_lookup_class(trait_name TSRMLS_CC);
ce = zend_lookup_class(trait_name);
if (ce) {
RETURN_BOOL((ce->ce_flags & ZEND_ACC_TRAIT) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
} else {
@ -1374,7 +1450,7 @@ ZEND_FUNCTION(function_exists)
zend_string *lcname;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
return;
}
#else
@ -1414,15 +1490,15 @@ ZEND_FUNCTION(class_alias)
size_t alias_name_len;
zend_bool autoload = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ss|b", &class_name, &alias_name, &alias_name_len, &autoload) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ss|b", &class_name, &alias_name, &alias_name_len, &autoload) == FAILURE) {
return;
}
ce = zend_lookup_class_ex(class_name, NULL, autoload TSRMLS_CC);
ce = zend_lookup_class_ex(class_name, NULL, autoload);
if (ce) {
if (ce->type == ZEND_USER_CLASS) {
if (zend_register_class_alias_ex(alias_name, alias_name_len, ce TSRMLS_CC) == SUCCESS) {
if (zend_register_class_alias_ex(alias_name, alias_name_len, ce) == SUCCESS) {
RETURN_TRUE;
} else {
zend_error(E_WARNING, "Cannot redeclare class %s", alias_name);
@ -1446,7 +1522,7 @@ ZEND_FUNCTION(leak)
{
zend_long leakbytes=3;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &leakbytes) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &leakbytes) == FAILURE) {
return;
}
@ -1460,7 +1536,7 @@ ZEND_FUNCTION(leak_variable)
zval *zv;
zend_bool leak_data = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &zv, &leak_data) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &zv, &leak_data) == FAILURE) {
return;
}
@ -1515,7 +1591,7 @@ ZEND_FUNCTION(trigger_error)
char *message;
size_t message_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &message, &message_len, &error_type) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &message, &message_len, &error_type) == FAILURE) {
return;
}
@ -1544,14 +1620,14 @@ ZEND_FUNCTION(set_error_handler)
zend_string *error_handler_name = NULL;
zend_long error_type = E_ALL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &error_handler, &error_type) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &error_handler, &error_type) == FAILURE) {
return;
}
if (Z_TYPE_P(error_handler) != IS_NULL) { /* NULL == unset */
if (!zend_is_callable(error_handler, 0, &error_handler_name TSRMLS_CC)) {
if (!zend_is_callable(error_handler, 0, &error_handler_name)) {
zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
get_active_function_name(TSRMLS_C), error_handler_name?error_handler_name->val:"unknown");
get_active_function_name(), error_handler_name?error_handler_name->val:"unknown");
zend_string_release(error_handler_name);
return;
}
@ -1608,14 +1684,14 @@ ZEND_FUNCTION(set_exception_handler)
zval *exception_handler;
zend_string *exception_handler_name = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &exception_handler) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &exception_handler) == FAILURE) {
return;
}
if (Z_TYPE_P(exception_handler) != IS_NULL) { /* NULL == unset */
if (!zend_is_callable(exception_handler, 0, &exception_handler_name TSRMLS_CC)) {
if (!zend_is_callable(exception_handler, 0, &exception_handler_name)) {
zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name->val:"unknown");
get_active_function_name(), exception_handler_name?exception_handler_name->val:"unknown");
zend_string_release(exception_handler_name);
return;
}
@ -1655,7 +1731,7 @@ ZEND_FUNCTION(restore_exception_handler)
}
/* }}} */
static int copy_class_or_interface_name(zval *el TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
static int copy_class_or_interface_name(zval *el, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
{
zend_class_entry *ce = (zend_class_entry *)Z_PTR_P(el);
zval *array = va_arg(args, zval *);
@ -1689,7 +1765,7 @@ ZEND_FUNCTION(get_declared_traits)
}
array_init(return_value);
zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, copy_class_or_interface_name, 3, return_value, mask, comply);
zend_hash_apply_with_arguments(EG(class_table), copy_class_or_interface_name, 3, return_value, mask, comply);
}
/* }}} */
@ -1705,7 +1781,7 @@ ZEND_FUNCTION(get_declared_classes)
}
array_init(return_value);
zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, copy_class_or_interface_name, 3, return_value, mask, comply);
zend_hash_apply_with_arguments(EG(class_table), copy_class_or_interface_name, 3, return_value, mask, comply);
}
/* }}} */
@ -1721,11 +1797,11 @@ ZEND_FUNCTION(get_declared_interfaces)
}
array_init(return_value);
zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, copy_class_or_interface_name, 3, return_value, mask, comply);
zend_hash_apply_with_arguments(EG(class_table), copy_class_or_interface_name, 3, return_value, mask, comply);
}
/* }}} */
static int copy_function_name(zval *zv TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
static int copy_function_name(zval *zv, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
{
zend_function *func = Z_PTR_P(zv);
zval *internal_ar = va_arg(args, zval *),
@ -1759,7 +1835,7 @@ ZEND_FUNCTION(get_defined_functions)
array_init(&user);
array_init(return_value);
zend_hash_apply_with_arguments(EG(function_table) TSRMLS_CC, copy_function_name, 2, &internal, &user);
zend_hash_apply_with_arguments(EG(function_table), copy_function_name, 2, &internal, &user);
zend_hash_str_add_new(Z_ARRVAL_P(return_value), "internal", sizeof("internal")-1, &internal);
zend_hash_str_add_new(Z_ARRVAL_P(return_value), "user", sizeof("user")-1, &user);
@ -1770,7 +1846,7 @@ ZEND_FUNCTION(get_defined_functions)
Returns an associative array of names and values of all currently defined variable names (variables in the current scope) */
ZEND_FUNCTION(get_defined_vars)
{
zend_array *symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
zend_array *symbol_table = zend_rebuild_symbol_table();
ZVAL_NEW_ARR(return_value);
zend_array_dup(Z_ARRVAL_P(return_value), &symbol_table->ht);
@ -1788,7 +1864,7 @@ ZEND_FUNCTION(create_function)
int retval;
char *eval_name;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &function_args, &function_args_len, &function_code, &function_code_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &function_args, &function_args_len, &function_code, &function_code_len) == FAILURE) {
return;
}
@ -1813,8 +1889,8 @@ ZEND_FUNCTION(create_function)
eval_code[eval_code_length++] = '}';
eval_code[eval_code_length] = '\0';
eval_name = zend_make_compiled_string_description("runtime-created function" TSRMLS_CC);
retval = zend_eval_stringl(eval_code, eval_code_length, NULL, eval_name TSRMLS_CC);
eval_name = zend_make_compiled_string_description("runtime-created function");
retval = zend_eval_stringl(eval_code, eval_code_length, NULL, eval_name);
efree(eval_code);
efree(eval_name);
@ -1871,11 +1947,11 @@ ZEND_FUNCTION(get_resource_type)
const char *resource_type;
zval *z_resource_type;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_resource_type) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_resource_type) == FAILURE) {
return;
}
resource_type = zend_rsrc_list_get_rsrc_type(Z_RES_P(z_resource_type) TSRMLS_CC);
resource_type = zend_rsrc_list_get_rsrc_type(Z_RES_P(z_resource_type));
if (resource_type) {
RETURN_STRING(resource_type);
} else {
@ -1893,7 +1969,7 @@ ZEND_FUNCTION(get_resources)
zend_ulong index;
zval *val;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &type) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &type) == FAILURE) {
return;
}
@ -1932,7 +2008,7 @@ ZEND_FUNCTION(get_resources)
}
/* }}} */
static int add_extension_info(zval *item, void *arg TSRMLS_DC) /* {{{ */
static int add_extension_info(zval *item, void *arg) /* {{{ */
{
zval *name_array = (zval *)arg;
zend_module_entry *module = (zend_module_entry*)Z_PTR_P(item);
@ -1941,7 +2017,7 @@ static int add_extension_info(zval *item, void *arg TSRMLS_DC) /* {{{ */
}
/* }}} */
static int add_zendext_info(zend_extension *ext, void *arg TSRMLS_DC) /* {{{ */
static int add_zendext_info(zend_extension *ext, void *arg) /* {{{ */
{
zval *name_array = (zval *)arg;
add_next_index_string(name_array, ext->name);
@ -1949,7 +2025,7 @@ static int add_zendext_info(zend_extension *ext, void *arg TSRMLS_DC) /* {{{ */
}
/* }}} */
static int add_constant_info(zval *item, void *arg TSRMLS_DC) /* {{{ */
static int add_constant_info(zval *item, void *arg) /* {{{ */
{
zval *name_array = (zval *)arg;
zend_constant *constant = (zend_constant*)Z_PTR_P(item);
@ -1972,16 +2048,16 @@ ZEND_FUNCTION(get_loaded_extensions)
{
zend_bool zendext = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &zendext) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &zendext) == FAILURE) {
return;
}
array_init(return_value);
if (zendext) {
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t)add_zendext_info, return_value TSRMLS_CC);
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t)add_zendext_info, return_value);
} else {
zend_hash_apply_with_argument(&module_registry, add_extension_info, return_value TSRMLS_CC);
zend_hash_apply_with_argument(&module_registry, add_extension_info, return_value);
}
}
/* }}} */
@ -1992,7 +2068,7 @@ ZEND_FUNCTION(get_defined_constants)
{
zend_bool categorize = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &categorize) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &categorize) == FAILURE) {
return;
}
@ -2043,12 +2119,12 @@ ZEND_FUNCTION(get_defined_constants)
efree(module_names);
efree(modules);
} else {
zend_hash_apply_with_argument(EG(zend_constants), add_constant_info, return_value TSRMLS_CC);
zend_hash_apply_with_argument(EG(zend_constants), add_constant_info, return_value);
}
}
/* }}} */
static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array TSRMLS_DC) /* {{{ */
static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array) /* {{{ */
{
uint32_t num_args = ZEND_CALL_NUM_ARGS(call);
@ -2084,7 +2160,7 @@ static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array TS
}
/* }}} */
void debug_print_backtrace_args(zval *arg_array TSRMLS_DC) /* {{{ */
void debug_print_backtrace_args(zval *arg_array) /* {{{ */
{
zval *tmp;
int i = 0;
@ -2093,7 +2169,7 @@ void debug_print_backtrace_args(zval *arg_array TSRMLS_DC) /* {{{ */
if (i++) {
ZEND_PUTS(", ");
}
zend_print_flat_zval_r(tmp TSRMLS_CC);
zend_print_flat_zval_r(tmp);
} ZEND_HASH_FOREACH_END();
}
/* }}} */
@ -2115,7 +2191,7 @@ ZEND_FUNCTION(debug_print_backtrace)
zend_long options = 0;
zend_long limit = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &options, &limit) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &options, &limit) == FAILURE) {
return;
}
@ -2199,7 +2275,7 @@ ZEND_FUNCTION(debug_print_backtrace)
}
if (func->type != ZEND_EVAL_CODE) {
if ((options & DEBUG_BACKTRACE_IGNORE_ARGS) == 0) {
debug_backtrace_get_args(call, &arg_array TSRMLS_CC);
debug_backtrace_get_args(call, &arg_array);
}
}
} else {
@ -2249,7 +2325,7 @@ ZEND_FUNCTION(debug_print_backtrace)
}
zend_printf("%s(", function_name);
if (Z_TYPE(arg_array) != IS_UNDEF) {
debug_print_backtrace_args(&arg_array TSRMLS_CC);
debug_print_backtrace_args(&arg_array);
zval_ptr_dtor(&arg_array);
}
if (filename) {
@ -2285,7 +2361,7 @@ ZEND_FUNCTION(debug_print_backtrace)
/* }}} */
ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit TSRMLS_DC) /* {{{ */
ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit) /* {{{ */
{
zend_execute_data *call, *ptr, *skip;
zend_object *object;
@ -2427,7 +2503,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
func->type != ZEND_EVAL_CODE) {
zval args;
debug_backtrace_get_args(call, &args TSRMLS_CC);
debug_backtrace_get_args(call, &args);
add_assoc_zval_ex(&stack_frame, "args", sizeof("args")-1, &args);
}
} else {
@ -2497,11 +2573,11 @@ ZEND_FUNCTION(debug_backtrace)
zend_long options = DEBUG_BACKTRACE_PROVIDE_OBJECT;
zend_long limit = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &options, &limit) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &options, &limit) == FAILURE) {
return;
}
zend_fetch_debug_backtrace(return_value, 1, options, limit TSRMLS_CC);
zend_fetch_debug_backtrace(return_value, 1, options, limit);
}
/* }}} */
@ -2513,7 +2589,7 @@ ZEND_FUNCTION(extension_loaded)
size_t extension_name_len;
zend_string *lcname;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &extension_name, &extension_name_len) == FAILURE) {
return;
}
@ -2539,7 +2615,7 @@ ZEND_FUNCTION(get_extension_funcs)
zend_module_entry *module;
zend_function *zif;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &extension_name, &extension_name_len) == FAILURE) {
return;
}
if (strncasecmp(extension_name, "zend", sizeof("zend"))) {

View file

@ -22,10 +22,10 @@
#ifndef ZEND_BUILTIN_FUNCTIONS_H
#define ZEND_BUILTIN_FUNCTIONS_H
int zend_startup_builtin_functions(TSRMLS_D);
int zend_startup_builtin_functions(void);
BEGIN_EXTERN_C()
ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit TSRMLS_DC);
ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit);
END_EXTERN_C()
#endif /* ZEND_BUILTIN_FUNCTIONS_H */

View file

@ -55,7 +55,7 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */
efree(arguments);
zend_error(E_RECOVERABLE_ERROR, "Cannot get arguments for calling closure");
RETVAL_FALSE;
} else if (call_user_function_ex(CG(function_table), NULL, getThis(), return_value, ZEND_NUM_ARGS(), arguments, 1, NULL TSRMLS_CC) == FAILURE) {
} else if (call_user_function_ex(CG(function_table), NULL, getThis(), return_value, ZEND_NUM_ARGS(), arguments, 1, NULL) == FAILURE) {
RETVAL_FALSE;
}
efree(arguments);
@ -78,7 +78,7 @@ ZEND_METHOD(Closure, call)
int my_param_count = 0;
zend_function my_function;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o*", &newthis, &my_params, &my_param_count) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o*", &newthis, &my_params, &my_param_count) == FAILURE) {
return;
}
@ -93,14 +93,14 @@ ZEND_METHOD(Closure, call)
if (closure->func.type == ZEND_INTERNAL_FUNCTION) {
/* verify that we aren't binding internal function to a wrong object */
if ((closure->func.common.fn_flags & ZEND_ACC_STATIC) == 0 &&
!instanceof_function(Z_OBJCE_P(newthis), closure->func.common.scope TSRMLS_CC)) {
!instanceof_function(Z_OBJCE_P(newthis), closure->func.common.scope)) {
zend_error(E_WARNING, "Cannot bind function %s::%s to object of class %s", closure->func.common.scope->name->val, closure->func.common.function_name->val, Z_OBJCE_P(newthis)->name->val);
return;
}
}
/* This should never happen as closures will always be callable */
if (zend_fcall_info_init(zclosure, 0, &fci, &fci_cache, NULL, NULL TSRMLS_CC) != SUCCESS) {
if (zend_fcall_info_init(zclosure, 0, &fci, &fci_cache, NULL, NULL) != SUCCESS) {
ZEND_ASSERT(0);
}
@ -115,7 +115,7 @@ ZEND_METHOD(Closure, call)
my_function.common.scope = Z_OBJCE_P(newthis);
fci_cache.function_handler = &my_function;
if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(closure_result) != IS_UNDEF) {
if (zend_call_function(&fci, &fci_cache) == SUCCESS && Z_TYPE(closure_result) != IS_UNDEF) {
ZVAL_COPY_VALUE(return_value, &closure_result);
}
}
@ -129,7 +129,7 @@ ZEND_METHOD(Closure, bind)
zend_closure *closure;
zend_class_entry *ce;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oo!|z", &zclosure, zend_ce_closure, &newthis, &scope_arg) == FAILURE) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oo!|z", &zclosure, zend_ce_closure, &newthis, &scope_arg) == FAILURE) {
RETURN_NULL();
}
@ -148,7 +148,7 @@ ZEND_METHOD(Closure, bind)
zend_string *class_name = zval_get_string(scope_arg);
if (zend_string_equals_literal(class_name, "static")) {
ce = closure->func.common.scope;
} else if ((ce = zend_lookup_class_ex(class_name, NULL, 1 TSRMLS_CC)) == NULL) {
} else if ((ce = zend_lookup_class_ex(class_name, NULL, 1)) == NULL) {
zend_error(E_WARNING, "Class '%s' not found", class_name->val);
zend_string_release(class_name);
RETURN_NULL();
@ -159,24 +159,24 @@ ZEND_METHOD(Closure, bind)
ce = closure->func.common.scope;
}
zend_create_closure(return_value, &closure->func, ce, newthis TSRMLS_CC);
zend_create_closure(return_value, &closure->func, ce, newthis);
}
/* }}} */
static zend_function *zend_closure_get_constructor(zend_object *object TSRMLS_DC) /* {{{ */
static zend_function *zend_closure_get_constructor(zend_object *object) /* {{{ */
{
zend_error(E_RECOVERABLE_ERROR, "Instantiation of 'Closure' is not allowed");
return NULL;
}
/* }}} */
static int zend_closure_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
static int zend_closure_compare_objects(zval *o1, zval *o2) /* {{{ */
{
return (Z_OBJ_P(o1) != Z_OBJ_P(o2));
}
/* }}} */
ZEND_API zend_function *zend_get_closure_invoke_method(zend_object *object TSRMLS_DC) /* {{{ */
ZEND_API zend_function *zend_get_closure_invoke_method(zend_object *object) /* {{{ */
{
zend_closure *closure = (zend_closure *)object;
zend_function *invoke = (zend_function*)emalloc(sizeof(zend_function));
@ -193,21 +193,21 @@ ZEND_API zend_function *zend_get_closure_invoke_method(zend_object *object TSRML
}
/* }}} */
ZEND_API const zend_function *zend_get_closure_method_def(zval *obj TSRMLS_DC) /* {{{ */
ZEND_API const zend_function *zend_get_closure_method_def(zval *obj) /* {{{ */
{
zend_closure *closure = (zend_closure *)Z_OBJ_P(obj);
return &closure->func;
}
/* }}} */
ZEND_API zval* zend_get_closure_this_ptr(zval *obj TSRMLS_DC) /* {{{ */
ZEND_API zval* zend_get_closure_this_ptr(zval *obj) /* {{{ */
{
zend_closure *closure = (zend_closure *)Z_OBJ_P(obj);
return &closure->this_ptr;
}
/* }}} */
static zend_function *zend_closure_get_method(zend_object **object, zend_string *method, const zval *key TSRMLS_DC) /* {{{ */
static zend_function *zend_closure_get_method(zend_object **object, zend_string *method, const zval *key) /* {{{ */
{
zend_string *lc_name;
@ -215,34 +215,34 @@ static zend_function *zend_closure_get_method(zend_object **object, zend_string
zend_str_tolower_copy(lc_name->val, method->val, method->len);
if (zend_string_equals_literal(method, ZEND_INVOKE_FUNC_NAME)) {
zend_string_free(lc_name);
return zend_get_closure_invoke_method(*object TSRMLS_CC);
return zend_get_closure_invoke_method(*object);
}
zend_string_free(lc_name);
return std_object_handlers.get_method(object, method, key TSRMLS_CC);
return std_object_handlers.get_method(object, method, key);
}
/* }}} */
static zval *zend_closure_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv TSRMLS_DC) /* {{{ */
static zval *zend_closure_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
return &EG(uninitialized_zval);
}
/* }}} */
static void zend_closure_write_property(zval *object, zval *member, zval *value, void **cache_slot TSRMLS_DC) /* {{{ */
static void zend_closure_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
}
/* }}} */
static zval *zend_closure_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot TSRMLS_DC) /* {{{ */
static zval *zend_closure_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
return NULL;
}
/* }}} */
static int zend_closure_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot TSRMLS_DC) /* {{{ */
static int zend_closure_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
{
if (has_set_exists != 2) {
ZEND_CLOSURE_PROPERTY_ERROR();
@ -251,17 +251,17 @@ static int zend_closure_has_property(zval *object, zval *member, int has_set_exi
}
/* }}} */
static void zend_closure_unset_property(zval *object, zval *member, void **cache_slot TSRMLS_DC) /* {{{ */
static void zend_closure_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
}
/* }}} */
static void zend_closure_free_storage(zend_object *object TSRMLS_DC) /* {{{ */
static void zend_closure_free_storage(zend_object *object) /* {{{ */
{
zend_closure *closure = (zend_closure *)object;
zend_object_std_dtor(&closure->std TSRMLS_CC);
zend_object_std_dtor(&closure->std);
if (closure->func.type == ZEND_USER_FUNCTION) {
zend_execute_data *ex = EG(current_execute_data);
@ -271,7 +271,7 @@ static void zend_closure_free_storage(zend_object *object TSRMLS_DC) /* {{{ */
}
ex = ex->prev_execute_data;
}
destroy_op_array(&closure->func.op_array TSRMLS_CC);
destroy_op_array(&closure->func.op_array);
}
if (closure->debug_info != NULL) {
@ -285,31 +285,31 @@ static void zend_closure_free_storage(zend_object *object TSRMLS_DC) /* {{{ */
}
/* }}} */
static zend_object *zend_closure_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
static zend_object *zend_closure_new(zend_class_entry *class_type) /* {{{ */
{
zend_closure *closure;
closure = emalloc(sizeof(zend_closure));
memset(closure, 0, sizeof(zend_closure));
zend_object_std_init(&closure->std, class_type TSRMLS_CC);
zend_object_std_init(&closure->std, class_type);
closure->std.handlers = &closure_handlers;
return (zend_object*)closure;
}
/* }}} */
static zend_object *zend_closure_clone(zval *zobject TSRMLS_DC) /* {{{ */
static zend_object *zend_closure_clone(zval *zobject) /* {{{ */
{
zend_closure *closure = (zend_closure *)Z_OBJ_P(zobject);
zval result;
zend_create_closure(&result, &closure->func, closure->func.common.scope, &closure->this_ptr TSRMLS_CC);
zend_create_closure(&result, &closure->func, closure->func.common.scope, &closure->this_ptr);
return Z_OBJ(result);
}
/* }}} */
int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr TSRMLS_DC) /* {{{ */
int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr) /* {{{ */
{
zend_closure *closure;
@ -335,7 +335,7 @@ int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function
}
/* }}} */
static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{ */
{
zend_closure *closure = (zend_closure *)Z_OBJ_P(object);
zval val;
@ -390,7 +390,7 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_
}
/* }}} */
static HashTable *zend_closure_get_gc(zval *obj, zval **table, int *n TSRMLS_DC) /* {{{ */
static HashTable *zend_closure_get_gc(zval *obj, zval **table, int *n) /* {{{ */
{
zend_closure *closure = (zend_closure *)Z_OBJ_P(obj);
@ -439,12 +439,12 @@ static const zend_function_entry closure_functions[] = {
ZEND_FE_END
};
void zend_register_closure_ce(TSRMLS_D) /* {{{ */
void zend_register_closure_ce(void) /* {{{ */
{
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "Closure", closure_functions);
zend_ce_closure = zend_register_internal_class(&ce TSRMLS_CC);
zend_ce_closure = zend_register_internal_class(&ce);
zend_ce_closure->ce_flags |= ZEND_ACC_FINAL;
zend_ce_closure->create_object = zend_closure_new;
zend_ce_closure->serialize = zend_class_serialize_deny;
@ -468,7 +468,7 @@ void zend_register_closure_ce(TSRMLS_D) /* {{{ */
}
/* }}} */
ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_entry *scope, zval *this_ptr TSRMLS_DC) /* {{{ */
ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_entry *scope, zval *this_ptr) /* {{{ */
{
zend_closure *closure;
@ -491,19 +491,19 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
ALLOC_HASHTABLE(closure->func.op_array.static_variables);
zend_hash_init(closure->func.op_array.static_variables, zend_hash_num_elements(static_variables), NULL, ZVAL_PTR_DTOR, 0);
zend_hash_apply_with_arguments(static_variables TSRMLS_CC, zval_copy_static_var, 1, closure->func.op_array.static_variables);
zend_hash_apply_with_arguments(static_variables, zval_copy_static_var, 1, closure->func.op_array.static_variables);
}
closure->func.op_array.run_time_cache = NULL;
(*closure->func.op_array.refcount)++;
} else {
/* verify that we aren't binding internal function to a wrong scope */
if(func->common.scope != NULL) {
if(scope && !instanceof_function(scope, func->common.scope TSRMLS_CC)) {
if(scope && !instanceof_function(scope, func->common.scope)) {
zend_error(E_WARNING, "Cannot bind function %s::%s to scope class %s", func->common.scope->name->val, func->common.function_name->val, scope->name->val);
scope = NULL;
}
if(scope && this_ptr && (func->common.fn_flags & ZEND_ACC_STATIC) == 0 &&
!instanceof_function(Z_OBJCE_P(this_ptr), closure->func.common.scope TSRMLS_CC)) {
!instanceof_function(Z_OBJCE_P(this_ptr), closure->func.common.scope)) {
zend_error(E_WARNING, "Cannot bind function %s::%s to object of class %s", func->common.scope->name->val, func->common.function_name->val, Z_OBJCE_P(this_ptr)->name->val);
scope = NULL;
this_ptr = NULL;

View file

@ -24,14 +24,14 @@
BEGIN_EXTERN_C()
void zend_register_closure_ce(TSRMLS_D);
void zend_register_closure_ce(void);
extern ZEND_API zend_class_entry *zend_ce_closure;
ZEND_API void zend_create_closure(zval *res, zend_function *op_array, zend_class_entry *scope, zval *this_ptr TSRMLS_DC);
ZEND_API zend_function *zend_get_closure_invoke_method(zend_object *obj TSRMLS_DC);
ZEND_API const zend_function *zend_get_closure_method_def(zval *obj TSRMLS_DC);
ZEND_API zval* zend_get_closure_this_ptr(zval *obj TSRMLS_DC);
ZEND_API void zend_create_closure(zval *res, zend_function *op_array, zend_class_entry *scope, zval *this_ptr);
ZEND_API zend_function *zend_get_closure_invoke_method(zend_object *obj);
ZEND_API const zend_function *zend_get_closure_method_def(zval *obj);
ZEND_API zval* zend_get_closure_this_ptr(zval *obj);
END_EXTERN_C()

File diff suppressed because it is too large Load diff

View file

@ -113,15 +113,15 @@ typedef union _zend_parser_stack_elem {
zend_ulong num;
} zend_parser_stack_elem;
void zend_compile_top_stmt(zend_ast *ast TSRMLS_DC);
void zend_compile_stmt(zend_ast *ast TSRMLS_DC);
void zend_compile_expr(znode *node, zend_ast *ast TSRMLS_DC);
void zend_compile_var(znode *node, zend_ast *ast, uint32_t type TSRMLS_DC);
void zend_eval_const_expr(zend_ast **ast_ptr TSRMLS_DC);
void zend_const_expr_to_zval(zval *result, zend_ast *ast TSRMLS_DC);
void zend_compile_top_stmt(zend_ast *ast);
void zend_compile_stmt(zend_ast *ast);
void zend_compile_expr(znode *node, zend_ast *ast);
void zend_compile_var(znode *node, zend_ast *ast, uint32_t type);
void zend_eval_const_expr(zend_ast **ast_ptr);
void zend_const_expr_to_zval(zval *result, zend_ast *ast);
#define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data TSRMLS_DC
#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data TSRMLS_CC
#define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data
#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data
typedef int (*user_opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
typedef int (ZEND_FASTCALL *opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
@ -433,7 +433,7 @@ struct _zend_execute_data {
(call)->This.u2.num_args
#define ZEND_CALL_FRAME_SLOT \
((ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval)) - 1) / ZEND_MM_ALIGNED_SIZE(sizeof(zval)))
((int)((ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval)) - 1) / ZEND_MM_ALIGNED_SIZE(sizeof(zval))))
#define ZEND_CALL_VAR(call, n) \
((zval*)(((char*)(call)) + ((int)(n))))
@ -597,65 +597,65 @@ struct _zend_execute_data {
BEGIN_EXTERN_C()
void init_compiler(TSRMLS_D);
void shutdown_compiler(TSRMLS_D);
void zend_init_compiler_data_structures(TSRMLS_D);
void zend_init_compiler_context(TSRMLS_D);
void init_compiler(void);
void shutdown_compiler(void);
void zend_init_compiler_data_structures(void);
void zend_init_compiler_context(void);
extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
extern ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename TSRMLS_DC);
extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type);
extern ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename);
ZEND_API int lex_scan(zval *zendlval TSRMLS_DC);
void startup_scanner(TSRMLS_D);
void shutdown_scanner(TSRMLS_D);
ZEND_API int lex_scan(zval *zendlval);
void startup_scanner(void);
void shutdown_scanner(void);
ZEND_API zend_string *zend_set_compiled_filename(zend_string *new_compiled_filename TSRMLS_DC);
ZEND_API void zend_restore_compiled_filename(zend_string *original_compiled_filename TSRMLS_DC);
ZEND_API zend_string *zend_get_compiled_filename(TSRMLS_D);
ZEND_API int zend_get_compiled_lineno(TSRMLS_D);
ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D);
ZEND_API zend_string *zend_set_compiled_filename(zend_string *new_compiled_filename);
ZEND_API void zend_restore_compiled_filename(zend_string *original_compiled_filename);
ZEND_API zend_string *zend_get_compiled_filename(void);
ZEND_API int zend_get_compiled_lineno(void);
ZEND_API size_t zend_get_scanned_file_offset(void);
ZEND_API zend_string *zend_get_compiled_variable_name(const zend_op_array *op_array, uint32_t var);
#ifdef ZTS
const char *zend_get_zendtext(TSRMLS_D);
int zend_get_zendleng(TSRMLS_D);
const char *zend_get_zendtext(void);
int zend_get_zendleng(void);
#endif
typedef int (*unary_op_type)(zval *, zval * TSRMLS_DC);
typedef int (*binary_op_type)(zval *, zval *, zval * TSRMLS_DC);
typedef int (*unary_op_type)(zval *, zval *);
typedef int (*binary_op_type)(zval *, zval *, zval *);
ZEND_API unary_op_type get_unary_op(int opcode);
ZEND_API binary_op_type get_binary_op(int opcode);
void zend_stop_lexing(TSRMLS_D);
void zend_emit_final_return(zval *zv TSRMLS_DC);
void zend_stop_lexing(void);
void zend_emit_final_return(zval *zv);
zend_ast *zend_ast_append_str(zend_ast *left, zend_ast *right);
uint32_t zend_add_member_modifier(uint32_t flags, uint32_t new_flag);
zend_ast *zend_ast_append_doc_comment(zend_ast *list TSRMLS_DC);
void zend_handle_encoding_declaration(zend_ast *ast TSRMLS_DC);
zend_ast *zend_ast_append_doc_comment(zend_ast *list);
void zend_handle_encoding_declaration(zend_ast *ast);
/* parser-driven code generators */
void zend_do_free(znode *op1 TSRMLS_DC);
void zend_do_free(znode *op1);
ZEND_API int do_bind_function(const zend_op_array *op_array, const zend_op *opline, HashTable *function_table, zend_bool compile_time TSRMLS_DC);
ZEND_API zend_class_entry *do_bind_class(const zend_op_array *op_array, const zend_op *opline, HashTable *class_table, zend_bool compile_time TSRMLS_DC);
ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array, const zend_op *opline, HashTable *class_table, zend_class_entry *parent_ce, zend_bool compile_time TSRMLS_DC);
ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS_DC);
ZEND_API int do_bind_function(const zend_op_array *op_array, const zend_op *opline, HashTable *function_table, zend_bool compile_time);
ZEND_API zend_class_entry *do_bind_class(const zend_op_array *op_array, const zend_op *opline, HashTable *class_table, zend_bool compile_time);
ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array, const zend_op *opline, HashTable *class_table, zend_class_entry *parent_ce, zend_bool compile_time);
ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array);
/* Functions for a null terminated pointer list, used for traits parsing and compilation */
void zend_init_list(void *result, void *item TSRMLS_DC);
void zend_add_to_list(void *result, void *item TSRMLS_DC);
void zend_init_list(void *result, void *item);
void zend_add_to_list(void *result, void *item);
void zend_do_extended_info(TSRMLS_D);
void zend_do_extended_fcall_begin(TSRMLS_D);
void zend_do_extended_fcall_end(TSRMLS_D);
void zend_do_extended_info(void);
void zend_do_extended_fcall_begin(void);
void zend_do_extended_fcall_end(void);
void zend_verify_namespace(TSRMLS_D);
void zend_do_end_compilation(TSRMLS_D);
void zend_verify_namespace(void);
void zend_do_end_compilation(void);
void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 TSRMLS_DC);
void zend_release_labels(int temporary TSRMLS_DC);
void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2);
void zend_release_labels(int temporary);
ZEND_API void function_add_ref(zend_function *function);
@ -663,22 +663,22 @@ ZEND_API void function_add_ref(zend_function *function);
/* helper functions in zend_language_scanner.l */
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC);
ZEND_API zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC);
ZEND_API zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC);
ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval *retval, int file_count, ...);
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC);
ZEND_API void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC);
ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC);
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC);
ZEND_API void zend_cleanup_user_class_data(zend_class_entry *ce TSRMLS_DC);
ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce TSRMLS_DC);
ZEND_API void zend_cleanup_internal_classes(TSRMLS_D);
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type);
ZEND_API zend_op_array *compile_string(zval *source_string, char *filename);
ZEND_API zend_op_array *compile_filename(int type, zval *filename);
ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...);
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle);
ZEND_API void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size);
ZEND_API void destroy_op_array(zend_op_array *op_array);
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle);
ZEND_API void zend_cleanup_user_class_data(zend_class_entry *ce);
ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce);
ZEND_API void zend_cleanup_internal_classes(void);
ZEND_API void zend_cleanup_op_array_data(zend_op_array *op_array);
ZEND_API int clean_non_persistent_function_full(zval *zv TSRMLS_DC);
ZEND_API int clean_non_persistent_class_full(zval *zv TSRMLS_DC);
ZEND_API int clean_non_persistent_function_full(zval *zv);
ZEND_API int clean_non_persistent_class_full(zval *zv);
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
ZEND_API void destroy_zend_function(zend_function *function);
ZEND_API void zend_function_dtor(zval *zv);
ZEND_API void destroy_zend_class(zval *zv);
void zend_class_add_ref(zval *zv);
@ -691,19 +691,19 @@ ZEND_API int zend_unmangle_property_name_ex(const zend_string *name, const char
#define ZEND_FUNCTION_DTOR zend_function_dtor
#define ZEND_CLASS_DTOR destroy_zend_class
zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC);
void init_op(zend_op *op TSRMLS_DC);
zend_op *get_next_op(zend_op_array *op_array);
void init_op(zend_op *op);
int get_next_op_number(zend_op_array *op_array);
int print_class(zend_class_entry *class_entry TSRMLS_DC);
int print_class(zend_class_entry *class_entry);
void print_op_array(zend_op_array *op_array, int optimizations);
ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC);
ZEND_API int pass_two(zend_op_array *op_array);
zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
ZEND_API zend_bool zend_is_compiling(TSRMLS_D);
ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC);
ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC);
ZEND_API zend_bool zend_is_compiling(void);
ZEND_API char *zend_make_compiled_string_description(const char *name);
ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers);
uint32_t zend_get_class_fetch_type(zend_string *name);
typedef zend_bool (*zend_auto_global_callback)(zend_string *name TSRMLS_DC);
typedef zend_bool (*zend_auto_global_callback)(zend_string *name);
typedef struct _zend_auto_global {
zend_string *name;
zend_auto_global_callback auto_global_callback;
@ -711,14 +711,14 @@ typedef struct _zend_auto_global {
zend_bool armed;
} zend_auto_global;
ZEND_API int zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC);
ZEND_API void zend_activate_auto_globals(TSRMLS_D);
ZEND_API zend_bool zend_is_auto_global(zend_string *name TSRMLS_DC);
ZEND_API int zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback);
ZEND_API void zend_activate_auto_globals(void);
ZEND_API zend_bool zend_is_auto_global(zend_string *name);
ZEND_API size_t zend_dirname(char *path, size_t len);
int zendlex(zend_parser_stack_elem *elem TSRMLS_DC);
int zendlex(zend_parser_stack_elem *elem);
int zend_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC);
int zend_add_literal(zend_op_array *op_array, zval *zv);
/* BEGIN: OPCODES */

View file

@ -68,21 +68,21 @@ void zend_copy_constants(HashTable *target, HashTable *source)
}
static int clean_non_persistent_constant(zval *zv TSRMLS_DC)
static int clean_non_persistent_constant(zval *zv)
{
zend_constant *c = Z_PTR_P(zv);
return (c->flags & CONST_PERSISTENT) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE;
}
static int clean_non_persistent_constant_full(zval *zv TSRMLS_DC)
static int clean_non_persistent_constant_full(zval *zv)
{
zend_constant *c = Z_PTR_P(zv);
return (c->flags & CONST_PERSISTENT) ? 0 : 1;
}
static int clean_module_constant(zval *el, void *arg TSRMLS_DC)
static int clean_module_constant(zval *el, void *arg)
{
zend_constant *c = (zend_constant *)Z_PTR_P(el);
int module_number = *(int *)arg;
@ -95,13 +95,13 @@ static int clean_module_constant(zval *el, void *arg TSRMLS_DC)
}
void clean_module_constants(int module_number TSRMLS_DC)
void clean_module_constants(int module_number)
{
zend_hash_apply_with_argument(EG(zend_constants), clean_module_constant, (void *) &module_number TSRMLS_CC);
zend_hash_apply_with_argument(EG(zend_constants), clean_module_constant, (void *) &module_number);
}
int zend_startup_constants(TSRMLS_D)
int zend_startup_constants(void)
{
EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable));
@ -111,7 +111,7 @@ int zend_startup_constants(TSRMLS_D)
void zend_register_standard_constants(TSRMLS_D)
void zend_register_standard_constants(void)
{
REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_RECOVERABLE_ERROR", E_RECOVERABLE_ERROR, CONST_PERSISTENT | CONST_CS);
@ -144,7 +144,7 @@ void zend_register_standard_constants(TSRMLS_D)
}
int zend_shutdown_constants(TSRMLS_D)
int zend_shutdown_constants(void)
{
zend_hash_destroy(EG(zend_constants));
free(EG(zend_constants));
@ -152,16 +152,16 @@ int zend_shutdown_constants(TSRMLS_D)
}
void clean_non_persistent_constants(TSRMLS_D)
void clean_non_persistent_constants(void)
{
if (EG(full_tables_cleanup)) {
zend_hash_apply(EG(zend_constants), clean_non_persistent_constant_full TSRMLS_CC);
zend_hash_apply(EG(zend_constants), clean_non_persistent_constant_full);
} else {
zend_hash_reverse_apply(EG(zend_constants), clean_non_persistent_constant TSRMLS_CC);
zend_hash_reverse_apply(EG(zend_constants), clean_non_persistent_constant);
}
}
ZEND_API void zend_register_null_constant(const char *name, size_t name_len, int flags, int module_number TSRMLS_DC)
ZEND_API void zend_register_null_constant(const char *name, size_t name_len, int flags, int module_number)
{
zend_constant c;
@ -169,10 +169,10 @@ ZEND_API void zend_register_null_constant(const char *name, size_t name_len, int
c.flags = flags;
c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
zend_register_constant(&c);
}
ZEND_API void zend_register_bool_constant(const char *name, size_t name_len, zend_bool bval, int flags, int module_number TSRMLS_DC)
ZEND_API void zend_register_bool_constant(const char *name, size_t name_len, zend_bool bval, int flags, int module_number)
{
zend_constant c;
@ -180,10 +180,10 @@ ZEND_API void zend_register_bool_constant(const char *name, size_t name_len, zen
c.flags = flags;
c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
zend_register_constant(&c);
}
ZEND_API void zend_register_long_constant(const char *name, size_t name_len, zend_long lval, int flags, int module_number TSRMLS_DC)
ZEND_API void zend_register_long_constant(const char *name, size_t name_len, zend_long lval, int flags, int module_number)
{
zend_constant c;
@ -191,11 +191,11 @@ ZEND_API void zend_register_long_constant(const char *name, size_t name_len, zen
c.flags = flags;
c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
zend_register_constant(&c);
}
ZEND_API void zend_register_double_constant(const char *name, size_t name_len, double dval, int flags, int module_number TSRMLS_DC)
ZEND_API void zend_register_double_constant(const char *name, size_t name_len, double dval, int flags, int module_number)
{
zend_constant c;
@ -203,11 +203,11 @@ ZEND_API void zend_register_double_constant(const char *name, size_t name_len, d
c.flags = flags;
c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
zend_register_constant(&c);
}
ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, char *strval, size_t strlen, int flags, int module_number TSRMLS_DC)
ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, char *strval, size_t strlen, int flags, int module_number)
{
zend_constant c;
@ -215,16 +215,16 @@ ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len,
c.flags = flags;
c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
zend_register_constant(&c);
}
ZEND_API void zend_register_string_constant(const char *name, size_t name_len, char *strval, int flags, int module_number TSRMLS_DC)
ZEND_API void zend_register_string_constant(const char *name, size_t name_len, char *strval, int flags, int module_number)
{
zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number TSRMLS_CC);
zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number);
}
static zend_constant *zend_get_special_constant(const char *name, size_t name_len TSRMLS_DC)
static zend_constant *zend_get_special_constant(const char *name, size_t name_len)
{
zend_constant *c;
static char haltoff[] = "__COMPILER_HALT_OFFSET__";
@ -267,7 +267,7 @@ static zend_constant *zend_get_special_constant(const char *name, size_t name_le
zend_string *haltname;
size_t clen;
cfilename = zend_get_executed_filename(TSRMLS_C);
cfilename = zend_get_executed_filename();
clen = strlen(cfilename);
/* check for __COMPILER_HALT_OFFSET__ */
haltname = zend_mangle_property_name(haltoff,
@ -281,7 +281,7 @@ static zend_constant *zend_get_special_constant(const char *name, size_t name_le
}
ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len TSRMLS_DC)
ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len)
{
zend_constant *c;
ALLOCA_FLAG(use_heap)
@ -294,7 +294,7 @@ ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len TSRMLS_DC
c = NULL;
}
} else {
c = zend_get_special_constant(name, name_len TSRMLS_CC);
c = zend_get_special_constant(name, name_len);
}
free_alloca(lcname, use_heap);
}
@ -302,7 +302,7 @@ ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len TSRMLS_DC
return c ? &c->value : NULL;
}
ZEND_API zval *zend_get_constant(zend_string *name TSRMLS_DC)
ZEND_API zval *zend_get_constant(zend_string *name)
{
zend_constant *c;
ALLOCA_FLAG(use_heap)
@ -315,7 +315,7 @@ ZEND_API zval *zend_get_constant(zend_string *name TSRMLS_DC)
c = NULL;
}
} else {
c = zend_get_special_constant(name->val, name->len TSRMLS_CC);
c = zend_get_special_constant(name->val, name->len);
}
free_alloca(lcname, use_heap);
}
@ -323,7 +323,7 @@ ZEND_API zval *zend_get_constant(zend_string *name TSRMLS_DC)
return c ? &c->value : NULL;
}
ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, zend_ulong flags TSRMLS_DC)
ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, zend_ulong flags)
{
zend_constant *c;
const char *colon;
@ -383,7 +383,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
zend_error(E_ERROR, "Cannot access static:: when no class scope is active");
}
} else {
ce = zend_fetch_class(class_name, flags TSRMLS_CC);
ce = zend_fetch_class(class_name, flags);
}
free_alloca(lcname, use_heap);
if (ce) {
@ -399,7 +399,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
zend_string_release(class_name);
zend_string_free(constant_name);
if (ret_constant && Z_CONSTANT_P(ret_constant)) {
zval_update_constant_ex(ret_constant, 1, ce TSRMLS_CC);
zval_update_constant_ex(ret_constant, 1, ce);
}
return ret_constant;
}
@ -437,19 +437,19 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
}
/* name requires runtime resolution, need to check non-namespaced name */
if ((flags & IS_CONSTANT_UNQUALIFIED) != 0) {
return zend_get_constant_str(constant_name, const_name_len TSRMLS_CC);
return zend_get_constant_str(constant_name, const_name_len);
}
return NULL;
}
if (cname) {
return zend_get_constant(cname TSRMLS_CC);
return zend_get_constant(cname);
} else {
return zend_get_constant_str(name, name_len TSRMLS_CC);
return zend_get_constant_str(name, name_len);
}
}
zend_constant *zend_quick_get_constant(const zval *key, zend_ulong flags TSRMLS_DC)
zend_constant *zend_quick_get_constant(const zval *key, zend_ulong flags)
{
zend_constant *c;
@ -465,12 +465,12 @@ zend_constant *zend_quick_get_constant(const zval *key, zend_ulong flags TSRMLS_
(c->flags & CONST_CS) != 0) {
key--;
c = zend_get_special_constant(Z_STRVAL_P(key), Z_STRLEN_P(key) TSRMLS_CC);
c = zend_get_special_constant(Z_STRVAL_P(key), Z_STRLEN_P(key));
}
}
} else {
key--;
c = zend_get_special_constant(Z_STRVAL_P(key), Z_STRLEN_P(key) TSRMLS_CC);
c = zend_get_special_constant(Z_STRVAL_P(key), Z_STRLEN_P(key));
}
}
}
@ -490,7 +490,7 @@ static void* zend_hash_add_constant(HashTable *ht, zend_string *key, zend_consta
return ret;
}
ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
ZEND_API int zend_register_constant(zend_constant *c)
{
zend_string *lowercase_name = NULL;
zend_string *name;
@ -503,14 +503,14 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
if (!(c->flags & CONST_CS)) {
lowercase_name = zend_string_alloc(c->name->len, c->flags & CONST_PERSISTENT);
zend_str_tolower_copy(lowercase_name->val, c->name->val, c->name->len);
lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
lowercase_name = zend_new_interned_string(lowercase_name);
name = lowercase_name;
} else {
char *slash = strrchr(c->name->val, '\\');
if (slash) {
lowercase_name = zend_string_init(c->name->val, c->name->len, c->flags & CONST_PERSISTENT);
zend_str_tolower(lowercase_name->val, slash - c->name->val);
lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
lowercase_name = zend_new_interned_string(lowercase_name);
name = lowercase_name;
} else {
name = c->name;

View file

@ -37,46 +37,46 @@ typedef struct _zend_constant {
int module_number;
} zend_constant;
#define REGISTER_NULL_CONSTANT(name, flags) zend_register_null_constant((name), sizeof(name)-1, (flags), module_number TSRMLS_CC)
#define REGISTER_BOOL_CONSTANT(name, bval, flags) zend_register_bool_constant((name), sizeof(name)-1, (bval), (flags), module_number TSRMLS_CC)
#define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number TSRMLS_CC)
#define REGISTER_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name)-1, (dval), (flags), module_number TSRMLS_CC)
#define REGISTER_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name)-1, (str), (flags), module_number TSRMLS_CC)
#define REGISTER_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name)-1, (str), (len), (flags), module_number TSRMLS_CC)
#define REGISTER_NULL_CONSTANT(name, flags) zend_register_null_constant((name), sizeof(name)-1, (flags), module_number)
#define REGISTER_BOOL_CONSTANT(name, bval, flags) zend_register_bool_constant((name), sizeof(name)-1, (bval), (flags), module_number)
#define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number)
#define REGISTER_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name)-1, (dval), (flags), module_number)
#define REGISTER_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name)-1, (str), (flags), module_number)
#define REGISTER_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name)-1, (str), (len), (flags), module_number)
#define REGISTER_NS_NULL_CONSTANT(ns, name, flags) zend_register_null_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (flags), module_number TSRMLS_CC)
#define REGISTER_NS_BOOL_CONSTANT(ns, name, bval, flags) zend_register_bool_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (bval), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_DOUBLE_CONSTANT(ns, name, dval, flags) zend_register_double_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (dval), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_STRING_CONSTANT(ns, name, str, flags) zend_register_string_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (str), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_STRINGL_CONSTANT(ns, name, str, len, flags) zend_register_stringl_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (str), (len), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_NULL_CONSTANT(ns, name, flags) zend_register_null_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (flags), module_number)
#define REGISTER_NS_BOOL_CONSTANT(ns, name, bval, flags) zend_register_bool_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (bval), (flags), module_number)
#define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
#define REGISTER_NS_DOUBLE_CONSTANT(ns, name, dval, flags) zend_register_double_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (dval), (flags), module_number)
#define REGISTER_NS_STRING_CONSTANT(ns, name, str, flags) zend_register_string_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (str), (flags), module_number)
#define REGISTER_NS_STRINGL_CONSTANT(ns, name, str, len, flags) zend_register_stringl_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (str), (len), (flags), module_number)
#define REGISTER_MAIN_NULL_CONSTANT(name, flags) zend_register_null_constant((name), sizeof(name)-1, (flags), 0 TSRMLS_CC)
#define REGISTER_MAIN_BOOL_CONSTANT(name, bval, flags) zend_register_bool_constant((name), sizeof(name)-1, (bval), (flags), 0 TSRMLS_CC)
#define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), 0 TSRMLS_CC)
#define REGISTER_MAIN_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name)-1, (dval), (flags), 0 TSRMLS_CC)
#define REGISTER_MAIN_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name)-1, (str), (flags), 0 TSRMLS_CC)
#define REGISTER_MAIN_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name)-1, (str), (len), (flags), 0 TSRMLS_CC)
#define REGISTER_MAIN_NULL_CONSTANT(name, flags) zend_register_null_constant((name), sizeof(name)-1, (flags), 0)
#define REGISTER_MAIN_BOOL_CONSTANT(name, bval, flags) zend_register_bool_constant((name), sizeof(name)-1, (bval), (flags), 0)
#define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), 0)
#define REGISTER_MAIN_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name)-1, (dval), (flags), 0)
#define REGISTER_MAIN_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name)-1, (str), (flags), 0)
#define REGISTER_MAIN_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name)-1, (str), (len), (flags), 0)
BEGIN_EXTERN_C()
void clean_module_constants(int module_number TSRMLS_DC);
void clean_module_constants(int module_number);
void free_zend_constant(zval *zv);
int zend_startup_constants(TSRMLS_D);
int zend_shutdown_constants(TSRMLS_D);
void zend_register_standard_constants(TSRMLS_D);
void clean_non_persistent_constants(TSRMLS_D);
ZEND_API zval *zend_get_constant(zend_string *name TSRMLS_DC);
ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len TSRMLS_DC);
ZEND_API zval *zend_get_constant_ex(zend_string *name, zend_class_entry *scope, zend_ulong flags TSRMLS_DC);
ZEND_API void zend_register_bool_constant(const char *name, size_t name_len, zend_bool bval, int flags, int module_number TSRMLS_DC);
ZEND_API void zend_register_null_constant(const char *name, size_t name_len, int flags, int module_number TSRMLS_DC);
ZEND_API void zend_register_long_constant(const char *name, size_t name_len, zend_long lval, int flags, int module_number TSRMLS_DC);
ZEND_API void zend_register_double_constant(const char *name, size_t name_len, double dval, int flags, int module_number TSRMLS_DC);
ZEND_API void zend_register_string_constant(const char *name, size_t name_len, char *strval, int flags, int module_number TSRMLS_DC);
ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, char *strval, size_t strlen, int flags, int module_number TSRMLS_DC);
ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC);
int zend_startup_constants(void);
int zend_shutdown_constants(void);
void zend_register_standard_constants(void);
void clean_non_persistent_constants(void);
ZEND_API zval *zend_get_constant(zend_string *name);
ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len);
ZEND_API zval *zend_get_constant_ex(zend_string *name, zend_class_entry *scope, zend_ulong flags);
ZEND_API void zend_register_bool_constant(const char *name, size_t name_len, zend_bool bval, int flags, int module_number);
ZEND_API void zend_register_null_constant(const char *name, size_t name_len, int flags, int module_number);
ZEND_API void zend_register_long_constant(const char *name, size_t name_len, zend_long lval, int flags, int module_number);
ZEND_API void zend_register_double_constant(const char *name, size_t name_len, double dval, int flags, int module_number);
ZEND_API void zend_register_string_constant(const char *name, size_t name_len, char *strval, int flags, int module_number);
ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, char *strval, size_t strlen, int flags, int module_number);
ZEND_API int zend_register_constant(zend_constant *c);
void zend_copy_constants(HashTable *target, HashTable *sourc);
zend_constant *zend_quick_get_constant(const zval *key, zend_ulong flags TSRMLS_DC);
zend_constant *zend_quick_get_constant(const zval *key, zend_ulong flags);
END_EXTERN_C()
#define ZEND_CONSTANT_DTOR free_zend_constant

View file

@ -28,13 +28,13 @@
#include "zend_generators.h"
ZEND_API void zend_register_default_classes(TSRMLS_D)
ZEND_API void zend_register_default_classes(void)
{
zend_register_interfaces(TSRMLS_C);
zend_register_default_exception(TSRMLS_C);
zend_register_iterator_wrapper(TSRMLS_C);
zend_register_closure_ce(TSRMLS_C);
zend_register_generator_ce(TSRMLS_C);
zend_register_interfaces();
zend_register_default_exception();
zend_register_iterator_wrapper();
zend_register_closure_ce();
zend_register_generator_ce();
}
/*

View file

@ -24,7 +24,7 @@
#ifdef HAVE_DTRACE
/* PHP DTrace probes {{{ */
static inline const char *dtrace_get_executed_filename(TSRMLS_D)
static inline const char *dtrace_get_executed_filename(void)
{
zend_execute_data *ex = EG(current_execute_data);
@ -34,22 +34,22 @@ static inline const char *dtrace_get_executed_filename(TSRMLS_D)
if (ex) {
return ex->func->op_array.filename->val;
} else {
return zend_get_executed_filename(TSRMLS_C);
return zend_get_executed_filename();
}
}
ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int type)
{
zend_op_array *res;
DTRACE_COMPILE_FILE_ENTRY(file_handle->opened_path, (char *)file_handle->filename);
res = compile_file(file_handle, type TSRMLS_CC);
res = compile_file(file_handle, type);
DTRACE_COMPILE_FILE_RETURN(file_handle->opened_path, (char *)file_handle->filename);
return res;
}
/* We wrap the execute function to have fire the execute-entry/return and function-entry/return probes */
ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data)
{
int lineno;
const char *scope, *filename, *funcname, *classname;
@ -58,13 +58,13 @@ ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
/* we need filename and lineno for both execute and function probes */
if (DTRACE_EXECUTE_ENTRY_ENABLED() || DTRACE_EXECUTE_RETURN_ENABLED()
|| DTRACE_FUNCTION_ENTRY_ENABLED() || DTRACE_FUNCTION_RETURN_ENABLED()) {
filename = dtrace_get_executed_filename(TSRMLS_C);
lineno = zend_get_executed_lineno(TSRMLS_C);
filename = dtrace_get_executed_filename();
lineno = zend_get_executed_lineno();
}
if (DTRACE_FUNCTION_ENTRY_ENABLED() || DTRACE_FUNCTION_RETURN_ENABLED()) {
classname = get_active_class_name(&scope TSRMLS_CC);
funcname = get_active_function_name(TSRMLS_C);
classname = get_active_class_name(&scope);
funcname = get_active_function_name();
}
if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
@ -75,7 +75,7 @@ ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
DTRACE_FUNCTION_ENTRY((char *)funcname, (char *)filename, lineno, (char *)classname, (char *)scope);
}
execute_ex(execute_data TSRMLS_CC);
execute_ex(execute_data);
if (DTRACE_FUNCTION_RETURN_ENABLED() && funcname != NULL) {
DTRACE_FUNCTION_RETURN((char *)funcname, (char *)filename, lineno, (char *)classname, (char *)scope);
@ -86,20 +86,20 @@ ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
}
}
ZEND_API void dtrace_execute_internal(zend_execute_data *execute_data, zval *return_value TSRMLS_DC)
ZEND_API void dtrace_execute_internal(zend_execute_data *execute_data, zval *return_value)
{
int lineno;
const char *filename;
if (DTRACE_EXECUTE_ENTRY_ENABLED() || DTRACE_EXECUTE_RETURN_ENABLED()) {
filename = dtrace_get_executed_filename(TSRMLS_C);
lineno = zend_get_executed_lineno(TSRMLS_C);
filename = dtrace_get_executed_filename();
lineno = zend_get_executed_lineno();
}
if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
DTRACE_EXECUTE_ENTRY((char *)filename, lineno);
}
execute_internal(execute_data, return_value TSRMLS_CC);
execute_internal(execute_data, return_value);
if (DTRACE_EXECUTE_RETURN_ENABLED()) {
DTRACE_EXECUTE_RETURN((char *)filename, lineno);

View file

@ -30,13 +30,13 @@ extern "C" {
#endif
#ifdef HAVE_DTRACE
ZEND_API zend_op_array *(*zend_dtrace_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
ZEND_API void (*zend_dtrace_execute)(zend_op_array *op_array TSRMLS_DC);
ZEND_API void (*zend_dtrace_execute_internal)(zend_execute_data *execute_data, zval *return_value TSRMLS_DC);
ZEND_API zend_op_array *(*zend_dtrace_compile_file)(zend_file_handle *file_handle, int type);
ZEND_API void (*zend_dtrace_execute)(zend_op_array *op_array);
ZEND_API void (*zend_dtrace_execute_internal)(zend_execute_data *execute_data, zval *return_value);
ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC);
ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data TSRMLS_DC);
ZEND_API void dtrace_execute_internal(zend_execute_data *execute_data, zval *return_value TSRMLS_DC);
ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int type);
ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data);
ZEND_API void dtrace_execute_internal(zend_execute_data *execute_data, zval *return_value);
#include <zend_dtrace_gen.h>
#endif /* HAVE_DTRACE */

View file

@ -33,9 +33,9 @@
static zend_class_entry *default_exception_ce;
static zend_class_entry *error_exception_ce;
static zend_object_handlers default_exception_handlers;
ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
ZEND_API void (*zend_throw_exception_hook)(zval *ex);
void zend_exception_set_previous(zend_object *exception, zend_object *add_previous TSRMLS_DC)
void zend_exception_set_previous(zend_object *exception, zend_object *add_previous)
{
zval tmp, *previous, zv, *pzv;
@ -43,16 +43,16 @@ void zend_exception_set_previous(zend_object *exception, zend_object *add_previo
return;
}
ZVAL_OBJ(&tmp, add_previous);
if (!instanceof_function(Z_OBJCE(tmp), default_exception_ce TSRMLS_CC)) {
if (!instanceof_function(Z_OBJCE(tmp), default_exception_ce)) {
zend_error(E_ERROR, "Cannot set non exception as previous exception");
return;
}
ZVAL_OBJ(&zv, exception);
pzv = &zv;
do {
previous = zend_read_property(default_exception_ce, pzv, "previous", sizeof("previous")-1, 1 TSRMLS_CC);
previous = zend_read_property(default_exception_ce, pzv, "previous", sizeof("previous")-1, 1);
if (Z_TYPE_P(previous) == IS_NULL) {
zend_update_property(default_exception_ce, pzv, "previous", sizeof("previous")-1, &tmp TSRMLS_CC);
zend_update_property(default_exception_ce, pzv, "previous", sizeof("previous")-1, &tmp);
GC_REFCOUNT(add_previous)--;
return;
}
@ -60,10 +60,10 @@ void zend_exception_set_previous(zend_object *exception, zend_object *add_previo
} while (pzv && Z_OBJ_P(pzv) != add_previous);
}
void zend_exception_save(TSRMLS_D) /* {{{ */
void zend_exception_save(void) /* {{{ */
{
if (EG(prev_exception)) {
zend_exception_set_previous(EG(exception), EG(prev_exception) TSRMLS_CC);
zend_exception_set_previous(EG(exception), EG(prev_exception));
}
if (EG(exception)) {
EG(prev_exception) = EG(exception);
@ -72,11 +72,11 @@ void zend_exception_save(TSRMLS_D) /* {{{ */
}
/* }}} */
void zend_exception_restore(TSRMLS_D) /* {{{ */
void zend_exception_restore(void) /* {{{ */
{
if (EG(prev_exception)) {
if (EG(exception)) {
zend_exception_set_previous(EG(exception), EG(prev_exception) TSRMLS_CC);
zend_exception_set_previous(EG(exception), EG(prev_exception));
} else {
EG(exception) = EG(prev_exception);
}
@ -85,7 +85,7 @@ void zend_exception_restore(TSRMLS_D) /* {{{ */
}
/* }}} */
ZEND_API void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
ZEND_API void zend_throw_exception_internal(zval *exception) /* {{{ */
{
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_THROWN_ENABLED()) {
@ -99,7 +99,7 @@ ZEND_API void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
if (exception != NULL) {
zend_object *previous = EG(exception);
zend_exception_set_previous(Z_OBJ_P(exception), EG(exception) TSRMLS_CC);
zend_exception_set_previous(Z_OBJ_P(exception), EG(exception));
EG(exception) = Z_OBJ_P(exception);
if (previous) {
return;
@ -107,13 +107,13 @@ ZEND_API void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
}
if (!EG(current_execute_data)) {
if(EG(exception)) {
zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
zend_exception_error(EG(exception), E_ERROR);
}
zend_error(E_ERROR, "Exception thrown without a stack frame");
}
if (zend_throw_exception_hook) {
zend_throw_exception_hook(exception TSRMLS_CC);
zend_throw_exception_hook(exception);
}
if (!EG(current_execute_data)->func ||
@ -127,7 +127,7 @@ ZEND_API void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
}
/* }}} */
ZEND_API void zend_clear_exception(TSRMLS_D) /* {{{ */
ZEND_API void zend_clear_exception(void) /* {{{ */
{
if (EG(prev_exception)) {
@ -146,37 +146,37 @@ ZEND_API void zend_clear_exception(TSRMLS_D) /* {{{ */
}
/* }}} */
static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces TSRMLS_DC) /* {{{ */
static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces) /* {{{ */
{
zval obj;
zend_object *object;
zval trace;
Z_OBJ(obj) = object = zend_objects_new(class_type TSRMLS_CC);
Z_OBJ(obj) = object = zend_objects_new(class_type);
Z_OBJ_HT(obj) = &default_exception_handlers;
object_properties_init(object, class_type);
zend_fetch_debug_backtrace(&trace, skip_top_traces, 0, 0 TSRMLS_CC);
zend_fetch_debug_backtrace(&trace, skip_top_traces, 0, 0);
Z_SET_REFCOUNT(trace, 0);
zend_update_property_string(default_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
zend_update_property_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, &trace TSRMLS_CC);
zend_update_property_string(default_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename());
zend_update_property_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno());
zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, &trace);
return object;
}
/* }}} */
static zend_object *zend_default_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
static zend_object *zend_default_exception_new(zend_class_entry *class_type) /* {{{ */
{
return zend_default_exception_new_ex(class_type, 0 TSRMLS_CC);
return zend_default_exception_new_ex(class_type, 0);
}
/* }}} */
static zend_object *zend_error_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
static zend_object *zend_error_exception_new(zend_class_entry *class_type) /* {{{ */
{
return zend_default_exception_new_ex(class_type, 2 TSRMLS_CC);
return zend_default_exception_new_ex(class_type, 2);
}
/* }}} */
@ -185,7 +185,7 @@ static zend_object *zend_error_exception_new(zend_class_entry *class_type TSRMLS
ZEND_METHOD(exception, __clone)
{
/* Should never be executable */
zend_throw_exception(NULL, "Cannot clone object using __clone()", 0 TSRMLS_CC);
zend_throw_exception(NULL, "Cannot clone object using __clone()", 0);
}
/* }}} */
@ -198,22 +198,22 @@ ZEND_METHOD(exception, __construct)
zval *object, *previous = NULL;
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|SlO!", &message, &code, &previous, default_exception_ce) == FAILURE) {
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc, "|SlO!", &message, &code, &previous, default_exception_ce) == FAILURE) {
zend_error(E_ERROR, "Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])");
}
object = getThis();
if (message) {
zend_update_property_str(default_exception_ce, object, "message", sizeof("message")-1, message TSRMLS_CC);
zend_update_property_str(default_exception_ce, object, "message", sizeof("message")-1, message);
}
if (code) {
zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code);
}
if (previous) {
zend_update_property(default_exception_ce, object, "previous", sizeof("previous")-1, previous TSRMLS_CC);
zend_update_property(default_exception_ce, object, "previous", sizeof("previous")-1, previous);
}
}
/* }}} */
@ -228,32 +228,32 @@ ZEND_METHOD(error_exception, __construct)
int argc = ZEND_NUM_ARGS();
size_t message_len, filename_len;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|sllslO!", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno, &previous, default_exception_ce) == FAILURE) {
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc, "|sllslO!", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno, &previous, default_exception_ce) == FAILURE) {
zend_error(E_ERROR, "Wrong parameters for ErrorException([string $exception [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Exception $previous = NULL]]]]]])");
}
object = getThis();
if (message) {
zend_update_property_string(default_exception_ce, object, "message", sizeof("message")-1, message TSRMLS_CC);
zend_update_property_string(default_exception_ce, object, "message", sizeof("message")-1, message);
}
if (code) {
zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code);
}
if (previous) {
zend_update_property(default_exception_ce, object, "previous", sizeof("previous")-1, previous TSRMLS_CC);
zend_update_property(default_exception_ce, object, "previous", sizeof("previous")-1, previous);
}
zend_update_property_long(default_exception_ce, object, "severity", sizeof("severity")-1, severity TSRMLS_CC);
zend_update_property_long(default_exception_ce, object, "severity", sizeof("severity")-1, severity);
if (argc >= 4) {
zend_update_property_string(default_exception_ce, object, "file", sizeof("file")-1, filename TSRMLS_CC);
zend_update_property_string(default_exception_ce, object, "file", sizeof("file")-1, filename);
if (argc < 5) {
lineno = 0; /* invalidate lineno */
}
zend_update_property_long(default_exception_ce, object, "line", sizeof("line")-1, lineno TSRMLS_CC);
zend_update_property_long(default_exception_ce, object, "line", sizeof("line")-1, lineno);
}
}
/* }}} */
@ -264,9 +264,9 @@ ZEND_METHOD(error_exception, __construct)
}
#define GET_PROPERTY(object, name) \
zend_read_property(default_exception_ce, (object), name, sizeof(name) - 1, 0 TSRMLS_CC)
zend_read_property(default_exception_ce, (object), name, sizeof(name) - 1, 0)
#define GET_PROPERTY_SILENT(object, name) \
zend_read_property(default_exception_ce, (object), name, sizeof(name) - 1, 1 TSRMLS_CC)
zend_read_property(default_exception_ce, (object), name, sizeof(name) - 1, 1)
/* {{{ proto string Exception::getFile()
Get the file in which the exception occurred */
@ -398,7 +398,7 @@ static void smart_str_append_escaped(smart_str *str, const char *s, size_t l) {
}
}
static void _build_trace_args(zval *arg, smart_str *str TSRMLS_DC) /* {{{ */
static void _build_trace_args(zval *arg, smart_str *str) /* {{{ */
{
/* the trivial way would be to do
* convert_to_string_ex(arg);
@ -456,7 +456,7 @@ static void _build_trace_args(zval *arg, smart_str *str TSRMLS_DC) /* {{{ */
}
/* }}} */
static void _build_trace_string(smart_str *str, HashTable *ht, uint32_t num TSRMLS_DC) /* {{{ */
static void _build_trace_string(smart_str *str, HashTable *ht, uint32_t num) /* {{{ */
{
zval *file, *tmp;
@ -501,7 +501,7 @@ static void _build_trace_string(smart_str *str, HashTable *ht, uint32_t num TSRM
zval *arg;
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(tmp), arg) {
_build_trace_args(arg, str TSRMLS_CC);
_build_trace_args(arg, str);
} ZEND_HASH_FOREACH_END();
if (last_len != str->s->len) {
@ -526,14 +526,14 @@ ZEND_METHOD(exception, getTraceAsString)
DEFAULT_0_PARAMS;
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1);
ZEND_HASH_FOREACH_NUM_KEY_VAL(Z_ARRVAL_P(trace), index, frame) {
if (Z_TYPE_P(frame) != IS_ARRAY) {
zend_error(E_WARNING, "Expected array for frame %pu", index);
continue;
}
_build_trace_string(&str, Z_ARRVAL_P(frame), num++ TSRMLS_CC);
_build_trace_string(&str, Z_ARRVAL_P(frame), num++);
} ZEND_HASH_FOREACH_END();
smart_str_appendc(&str, '#');
@ -610,7 +610,7 @@ ZEND_METHOD(exception, __toString)
fci.params = NULL;
fci.no_separation = 1;
zend_call_function(&fci, NULL TSRMLS_CC);
zend_call_function(&fci, NULL);
if (Z_TYPE(trace) != IS_STRING) {
zval_ptr_dtor(&trace);
@ -642,7 +642,7 @@ ZEND_METHOD(exception, __toString)
/* We store the result in the private property string so we can access
* the result in uncaught exception handlers without memleaks. */
zend_update_property_str(default_exception_ce, getThis(), "string", sizeof("string")-1, str TSRMLS_CC);
zend_update_property_str(default_exception_ce, getThis(), "string", sizeof("string")-1, str);
RETURN_STR(str);
}
@ -694,49 +694,49 @@ static const zend_function_entry error_exception_functions[] = {
};
/* }}} */
void zend_register_default_exception(TSRMLS_D) /* {{{ */
void zend_register_default_exception(void) /* {{{ */
{
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "Exception", default_exception_functions);
default_exception_ce = zend_register_internal_class(&ce TSRMLS_CC);
default_exception_ce = zend_register_internal_class(&ce);
default_exception_ce->create_object = zend_default_exception_new;
memcpy(&default_exception_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
default_exception_handlers.clone_obj = NULL;
zend_declare_property_string(default_exception_ce, "message", sizeof("message")-1, "", ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_string(default_exception_ce, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_long(default_exception_ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(default_exception_ce, "file", sizeof("file")-1, ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(default_exception_ce, "line", sizeof("line")-1, ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(default_exception_ce, "trace", sizeof("trace")-1, ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(default_exception_ce, "previous", sizeof("previous")-1, ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_string(default_exception_ce, "message", sizeof("message")-1, "", ZEND_ACC_PROTECTED);
zend_declare_property_string(default_exception_ce, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE);
zend_declare_property_long(default_exception_ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED);
zend_declare_property_null(default_exception_ce, "file", sizeof("file")-1, ZEND_ACC_PROTECTED);
zend_declare_property_null(default_exception_ce, "line", sizeof("line")-1, ZEND_ACC_PROTECTED);
zend_declare_property_null(default_exception_ce, "trace", sizeof("trace")-1, ZEND_ACC_PRIVATE);
zend_declare_property_null(default_exception_ce, "previous", sizeof("previous")-1, ZEND_ACC_PRIVATE);
INIT_CLASS_ENTRY(ce, "ErrorException", error_exception_functions);
error_exception_ce = zend_register_internal_class_ex(&ce, default_exception_ce TSRMLS_CC);
error_exception_ce = zend_register_internal_class_ex(&ce, default_exception_ce);
error_exception_ce->create_object = zend_error_exception_new;
zend_declare_property_long(error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_long(error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED);
}
/* }}} */
ZEND_API zend_class_entry *zend_exception_get_default(TSRMLS_D) /* {{{ */
ZEND_API zend_class_entry *zend_exception_get_default(void) /* {{{ */
{
return default_exception_ce;
}
/* }}} */
ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) /* {{{ */
ZEND_API zend_class_entry *zend_get_error_exception(void) /* {{{ */
{
return error_exception_ce;
}
/* }}} */
ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code TSRMLS_DC) /* {{{ */
ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code) /* {{{ */
{
zval ex;
if (exception_ce) {
if (!instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) {
if (!instanceof_function(exception_ce, default_exception_ce)) {
zend_error(E_NOTICE, "Exceptions must be derived from the Exception base class");
exception_ce = default_exception_ce;
}
@ -747,18 +747,18 @@ ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const
if (message) {
zend_update_property_string(default_exception_ce, &ex, "message", sizeof("message")-1, message TSRMLS_CC);
zend_update_property_string(default_exception_ce, &ex, "message", sizeof("message")-1, message);
}
if (code) {
zend_update_property_long(default_exception_ce, &ex, "code", sizeof("code")-1, code TSRMLS_CC);
zend_update_property_long(default_exception_ce, &ex, "code", sizeof("code")-1, code);
}
zend_throw_exception_internal(&ex TSRMLS_CC);
zend_throw_exception_internal(&ex);
return Z_OBJ(ex);
}
/* }}} */
ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code TSRMLS_DC, const char *format, ...) /* {{{ */
ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format, ...) /* {{{ */
{
va_list arg;
char *message;
@ -767,18 +767,18 @@ ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, ze
va_start(arg, format);
zend_vspprintf(&message, 0, format, arg);
va_end(arg);
obj = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
obj = zend_throw_exception(exception_ce, message, code);
efree(message);
return obj;
}
/* }}} */
ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_long code, int severity TSRMLS_DC) /* {{{ */
ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_long code, int severity) /* {{{ */
{
zval ex;
zend_object *obj = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
zend_object *obj = zend_throw_exception(exception_ce, message, code);
ZVAL_OBJ(&ex, obj);
zend_update_property_long(default_exception_ce, &ex, "severity", sizeof("severity")-1, severity TSRMLS_CC);
zend_update_property_long(default_exception_ce, &ex, "severity", sizeof("severity")-1, severity);
return obj;
}
/* }}} */
@ -794,14 +794,14 @@ static void zend_error_va(int type, const char *file, uint lineno, const char *f
/* }}} */
/* This function doesn't return if it uses E_ERROR */
ZEND_API void zend_exception_error(zend_object *ex, int severity TSRMLS_DC) /* {{{ */
ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */
{
zval exception;
zend_class_entry *ce_exception;
ZVAL_OBJ(&exception, ex);
ce_exception = Z_OBJCE(exception);
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
if (instanceof_function(ce_exception, default_exception_ce)) {
zval tmp;
zend_string *str, *file = NULL;
zend_long line = 0;
@ -813,7 +813,7 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity TSRMLS_DC) /* {
if (Z_TYPE(tmp) != IS_STRING) {
zend_error(E_WARNING, "%s::__toString() must return a string", ce_exception->name->val);
} else {
zend_update_property_string(default_exception_ce, &exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name->val : Z_STRVAL(tmp) TSRMLS_CC);
zend_update_property_string(default_exception_ce, &exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name->val : Z_STRVAL(tmp));
}
}
zval_ptr_dtor(&tmp);
@ -823,7 +823,7 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity TSRMLS_DC) /* {
ZVAL_OBJ(&zv, EG(exception));
/* do the best we can to inform about the inner exception */
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
if (instanceof_function(ce_exception, default_exception_ce)) {
file = zval_get_string(GET_PROPERTY_SILENT(&zv, "file"));
line = zval_get_long(GET_PROPERTY_SILENT(&zv, "line"));
}
@ -852,7 +852,7 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity TSRMLS_DC) /* {
}
/* }}} */
ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC) /* {{{ */
ZEND_API void zend_throw_exception_object(zval *exception) /* {{{ */
{
zend_class_entry *exception_ce;
@ -862,10 +862,10 @@ ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC) /* {{{ */
exception_ce = Z_OBJCE_P(exception);
if (!exception_ce || !instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) {
if (!exception_ce || !instanceof_function(exception_ce, default_exception_ce)) {
zend_error(E_ERROR, "Exceptions must be valid objects derived from the Exception base class");
}
zend_throw_exception_internal(exception TSRMLS_CC);
zend_throw_exception_internal(exception);
}
/* }}} */

View file

@ -26,31 +26,31 @@
BEGIN_EXTERN_C()
ZEND_API void zend_exception_set_previous(zend_object *exception, zend_object *add_previous TSRMLS_DC);
ZEND_API void zend_exception_save(TSRMLS_D);
ZEND_API void zend_exception_restore(TSRMLS_D);
ZEND_API void zend_exception_set_previous(zend_object *exception, zend_object *add_previous);
ZEND_API void zend_exception_save(void);
ZEND_API void zend_exception_restore(void);
ZEND_API void zend_throw_exception_internal(zval *exception TSRMLS_DC);
ZEND_API void zend_throw_exception_internal(zval *exception);
void zend_register_default_exception(TSRMLS_D);
void zend_register_default_exception(void);
ZEND_API zend_class_entry *zend_exception_get_default(TSRMLS_D);
ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D);
ZEND_API void zend_register_default_classes(TSRMLS_D);
ZEND_API zend_class_entry *zend_exception_get_default(void);
ZEND_API zend_class_entry *zend_get_error_exception(void);
ZEND_API void zend_register_default_classes(void);
/* exception_ce NULL or zend_exception_get_default() or a derived class
* message NULL or the message of the exception */
ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code TSRMLS_DC);
ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code TSRMLS_DC, const char *format, ...);
ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC);
ZEND_API void zend_clear_exception(TSRMLS_D);
ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code);
ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format, ...);
ZEND_API void zend_throw_exception_object(zval *exception);
ZEND_API void zend_clear_exception(void);
ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_long code, int severity TSRMLS_DC);
ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_long code, int severity);
extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
extern ZEND_API void (*zend_throw_exception_hook)(zval *ex);
/* show an exception using zend_error(severity,...), severity should be E_ERROR */
ZEND_API void zend_exception_error(zend_object *exception, int severity TSRMLS_DC);
ZEND_API void zend_exception_error(zend_object *exception, int severity);
/* do not export, in php it's available thru spprintf directly */
size_t zend_spprintf(char **message, size_t max_len, const char *format, ...);

View file

@ -51,17 +51,17 @@
typedef int (*incdec_t)(zval *);
#define get_zval_ptr(op_type, node, ex, should_free, type) _get_zval_ptr(op_type, node, ex, should_free, type TSRMLS_CC)
#define get_zval_ptr_deref(op_type, node, ex, should_free, type) _get_zval_ptr_deref(op_type, node, ex, should_free, type TSRMLS_CC)
#define get_zval_ptr_ptr(op_type, node, ex, should_free, type) _get_zval_ptr_ptr(op_type, node, ex, should_free, type TSRMLS_CC)
#define get_zval_ptr_ptr_undef(op_type, node, ex, should_free, type) _get_zval_ptr_ptr(op_type, node, ex, should_free, type TSRMLS_CC)
#define get_obj_zval_ptr(op_type, node, ex, should_free, type) _get_obj_zval_ptr(op_type, node, ex, should_free, type TSRMLS_CC)
#define get_obj_zval_ptr_ptr(op_type, node, ex, should_free, type) _get_obj_zval_ptr_ptr(op_type, node, ex, should_free, type TSRMLS_CC)
#define get_zval_ptr(op_type, node, ex, should_free, type) _get_zval_ptr(op_type, node, ex, should_free, type)
#define get_zval_ptr_deref(op_type, node, ex, should_free, type) _get_zval_ptr_deref(op_type, node, ex, should_free, type)
#define get_zval_ptr_ptr(op_type, node, ex, should_free, type) _get_zval_ptr_ptr(op_type, node, ex, should_free, type)
#define get_zval_ptr_ptr_undef(op_type, node, ex, should_free, type) _get_zval_ptr_ptr(op_type, node, ex, should_free, type)
#define get_obj_zval_ptr(op_type, node, ex, should_free, type) _get_obj_zval_ptr(op_type, node, ex, should_free, type)
#define get_obj_zval_ptr_ptr(op_type, node, ex, should_free, type) _get_obj_zval_ptr_ptr(op_type, node, ex, should_free, type)
/* Prototypes */
static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
static void zend_extension_fcall_begin_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
static void zend_extension_fcall_end_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array);
static void zend_extension_fcall_begin_handler(const zend_extension *extension, zend_op_array *op_array);
static void zend_extension_fcall_end_handler(const zend_extension *extension, zend_op_array *op_array);
#define RETURN_VALUE_USED(opline) (!((opline)->result_type & EXT_TYPE_UNUSED))
@ -83,7 +83,7 @@ static const zend_internal_function zend_pass_function = {
};
#undef zval_ptr_dtor
#define zval_ptr_dtor(zv) i_zval_ptr_dtor(zv ZEND_FILE_LINE_CC TSRMLS_CC)
#define zval_ptr_dtor(zv) i_zval_ptr_dtor(zv ZEND_FILE_LINE_CC)
#define PZVAL_LOCK(z) if (Z_REFCOUNTED_P(z)) Z_ADDREF_P((z))
#define SELECTIVE_PZVAL_LOCK(pzv, opline) if (RETURN_VALUE_USED(opline)) { PZVAL_LOCK(pzv); }
@ -142,7 +142,7 @@ static zend_always_inline zend_vm_stack zend_vm_stack_new_page(size_t size, zend
return page;
}
ZEND_API void zend_vm_stack_init(TSRMLS_D)
ZEND_API void zend_vm_stack_init(void)
{
EG(vm_stack) = zend_vm_stack_new_page(ZEND_VM_STACK_PAGE_SIZE, NULL);
EG(vm_stack)->top++;
@ -150,7 +150,7 @@ ZEND_API void zend_vm_stack_init(TSRMLS_D)
EG(vm_stack_end) = EG(vm_stack)->end;
}
ZEND_API void zend_vm_stack_destroy(TSRMLS_D)
ZEND_API void zend_vm_stack_destroy(void)
{
zend_vm_stack stack = EG(vm_stack);
@ -161,7 +161,7 @@ ZEND_API void zend_vm_stack_destroy(TSRMLS_D)
}
}
ZEND_API void* zend_vm_stack_extend(size_t size TSRMLS_DC)
ZEND_API void* zend_vm_stack_extend(size_t size)
{
zend_vm_stack stack;
void *ptr;
@ -210,7 +210,7 @@ static zend_always_inline zval *_get_zval_ptr_var_deref(uint32_t var, const zend
return ret;
}
static zend_never_inline zval *_get_zval_cv_lookup(zval *ptr, uint32_t var, int type, const zend_execute_data *execute_data TSRMLS_DC)
static zend_never_inline zval *_get_zval_cv_lookup(zval *ptr, uint32_t var, int type, const zend_execute_data *execute_data)
{
zend_string *cv;
@ -234,7 +234,7 @@ static zend_never_inline zval *_get_zval_cv_lookup(zval *ptr, uint32_t var, int
return ptr;
}
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_R(zval *ptr, uint32_t var, const zend_execute_data *execute_data TSRMLS_DC)
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_R(zval *ptr, uint32_t var, const zend_execute_data *execute_data)
{
zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
@ -242,7 +242,7 @@ static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_R(zval *ptr, uint32_t
return &EG(uninitialized_zval);
}
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_UNSET(zval *ptr, uint32_t var, const zend_execute_data *execute_data TSRMLS_DC)
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_UNSET(zval *ptr, uint32_t var, const zend_execute_data *execute_data)
{
zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
@ -250,7 +250,7 @@ static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_UNSET(zval *ptr, uint
return &EG(uninitialized_zval);
}
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_RW(zval *ptr, uint32_t var, const zend_execute_data *execute_data TSRMLS_DC)
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_RW(zval *ptr, uint32_t var, const zend_execute_data *execute_data)
{
zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
@ -259,83 +259,83 @@ static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_RW(zval *ptr, uint32_
return ptr;
}
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_W(zval *ptr, uint32_t var, const zend_execute_data *execute_data TSRMLS_DC)
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_W(zval *ptr, uint32_t var, const zend_execute_data *execute_data)
{
ZVAL_NULL(ptr);
return ptr;
}
static zend_always_inline zval *_get_zval_ptr_cv(const zend_execute_data *execute_data, uint32_t var, int type TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr_cv(const zend_execute_data *execute_data, uint32_t var, int type)
{
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup(ret, var, type, execute_data TSRMLS_CC);
return _get_zval_cv_lookup(ret, var, type, execute_data);
}
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_deref(const zend_execute_data *execute_data, uint32_t var, int type TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr_cv_deref(const zend_execute_data *execute_data, uint32_t var, int type)
{
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup(ret, var, type, execute_data TSRMLS_CC);
return _get_zval_cv_lookup(ret, var, type, execute_data);
}
ZVAL_DEREF(ret);
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_R(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_R(const zend_execute_data *execute_data, uint32_t var)
{
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_R(ret, var, execute_data TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_R(ret, var, execute_data);
}
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_R(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_R(const zend_execute_data *execute_data, uint32_t var)
{
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_R(ret, var, execute_data TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_R(ret, var, execute_data);
}
ZVAL_DEREF(ret);
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_UNSET(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_UNSET(const zend_execute_data *execute_data, uint32_t var)
{
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_UNSET(ret, var, execute_data TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_UNSET(ret, var, execute_data);
}
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_UNSET(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_UNSET(const zend_execute_data *execute_data, uint32_t var)
{
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_UNSET(ret, var, execute_data TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_UNSET(ret, var, execute_data);
}
ZVAL_DEREF(ret);
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_IS(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_IS(const zend_execute_data *execute_data, uint32_t var)
{
zval *ret = EX_VAR(var);
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_IS(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_IS(const zend_execute_data *execute_data, uint32_t var)
{
zval *ret = EX_VAR(var);
@ -343,54 +343,54 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_IS(const zend_exec
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_RW(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_RW(const zend_execute_data *execute_data, uint32_t var)
{
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_RW(ret, var, execute_data TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_RW(ret, var, execute_data);
}
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_RW(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_RW(const zend_execute_data *execute_data, uint32_t var)
{
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_RW(ret, var, execute_data TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_RW(ret, var, execute_data);
}
ZVAL_DEREF(ret);
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(const zend_execute_data *execute_data, uint32_t var)
{
zval *ret = EX_VAR(var);
if (Z_TYPE_P(ret) == IS_UNDEF) {
return _get_zval_cv_lookup_BP_VAR_W(ret, var, execute_data TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_W(ret, var, execute_data);
}
return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_undef_BP_VAR_W(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr_cv_undef_BP_VAR_W(const zend_execute_data *execute_data, uint32_t var)
{
return EX_VAR(var);
}
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_W(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_W(const zend_execute_data *execute_data, uint32_t var)
{
zval *ret = EX_VAR(var);
if (Z_TYPE_P(ret) == IS_UNDEF) {
return _get_zval_cv_lookup_BP_VAR_W(ret, var, execute_data TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_W(ret, var, execute_data);
}
ZVAL_DEREF(ret);
return ret;
}
static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, const zend_execute_data *execute_data, zend_free_op *should_free, int type)
{
if (op_type & (IS_TMP_VAR|IS_VAR)) {
if (op_type == IS_TMP_VAR) {
@ -405,12 +405,12 @@ static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, const
return EX_CONSTANT(node);
} else {
ZEND_ASSERT(op_type == IS_CV);
return _get_zval_ptr_cv(execute_data, node.var, type TSRMLS_CC);
return _get_zval_ptr_cv(execute_data, node.var, type);
}
}
}
static zend_always_inline zval *_get_zval_ptr_deref(int op_type, znode_op node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
static zend_always_inline zval *_get_zval_ptr_deref(int op_type, znode_op node, const zend_execute_data *execute_data, zend_free_op *should_free, int type)
{
if (op_type & (IS_TMP_VAR|IS_VAR)) {
if (op_type == IS_TMP_VAR) {
@ -425,7 +425,7 @@ static zend_always_inline zval *_get_zval_ptr_deref(int op_type, znode_op node,
return EX_CONSTANT(node);
} else {
ZEND_ASSERT(op_type == IS_CV);
return _get_zval_ptr_cv_deref(execute_data, node.var, type TSRMLS_CC);
return _get_zval_ptr_cv_deref(execute_data, node.var, type);
}
}
}
@ -447,11 +447,11 @@ static zend_always_inline zval *_get_zval_ptr_ptr_var(uint32_t var, const zend_e
return ret;
}
static inline zval *_get_zval_ptr_ptr(int op_type, znode_op node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
static inline zval *_get_zval_ptr_ptr(int op_type, znode_op node, const zend_execute_data *execute_data, zend_free_op *should_free, int type)
{
if (op_type == IS_CV) {
*should_free = NULL;
return _get_zval_ptr_cv(execute_data, node.var, type TSRMLS_CC);
return _get_zval_ptr_cv(execute_data, node.var, type);
} else /* if (op_type == IS_VAR) */ {
ZEND_ASSERT(op_type == IS_VAR);
return _get_zval_ptr_ptr_var(node.var, execute_data, should_free);
@ -468,7 +468,7 @@ static zend_always_inline zval *_get_obj_zval_ptr_unused(zend_execute_data *exec
}
}
static inline zval *_get_obj_zval_ptr(int op_type, znode_op op, zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
static inline zval *_get_obj_zval_ptr(int op_type, znode_op op, zend_execute_data *execute_data, zend_free_op *should_free, int type)
{
if (op_type == IS_UNUSED) {
if (EXPECTED(Z_OBJ(EX(This)) != NULL)) {
@ -481,7 +481,7 @@ static inline zval *_get_obj_zval_ptr(int op_type, znode_op op, zend_execute_dat
return get_zval_ptr(op_type, op, execute_data, should_free, type);
}
static inline zval *_get_obj_zval_ptr_ptr(int op_type, znode_op node, zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
static inline zval *_get_obj_zval_ptr_ptr(int op_type, znode_op node, zend_execute_data *execute_data, zend_free_op *should_free, int type)
{
if (op_type == IS_UNUSED) {
if (EXPECTED(Z_OBJ(EX(This)) != NULL)) {
@ -494,7 +494,7 @@ static inline zval *_get_obj_zval_ptr_ptr(int op_type, znode_op node, zend_execu
return get_zval_ptr_ptr(op_type, node, execute_data, should_free, type);
}
static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr TSRMLS_DC)
static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr)
{
if (EXPECTED(variable_ptr != value_ptr)) {
zend_reference *ref;
@ -510,7 +510,7 @@ static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *v
}
/* this should modify object only if it's empty */
static inline int make_real_object(zval **object_ptr TSRMLS_DC)
static inline int make_real_object(zval **object_ptr)
{
zval *object = *object_ptr;
@ -529,13 +529,13 @@ static inline int make_real_object(zval **object_ptr TSRMLS_DC)
return 1;
}
ZEND_API char * zend_verify_internal_arg_class_kind(const zend_internal_arg_info *cur_arg_info, char **class_name, zend_class_entry **pce TSRMLS_DC)
ZEND_API char * zend_verify_internal_arg_class_kind(const zend_internal_arg_info *cur_arg_info, char **class_name, zend_class_entry **pce)
{
zend_string *key;
ALLOCA_FLAG(use_heap);
STR_ALLOCA_INIT(key, cur_arg_info->class_name, strlen(cur_arg_info->class_name), use_heap);
*pce = zend_fetch_class(key, (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD) TSRMLS_CC);
*pce = zend_fetch_class(key, (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
STR_ALLOCA_FREE(key, use_heap);
*class_name = (*pce) ? (*pce)->name->val : (char*)cur_arg_info->class_name;
@ -546,9 +546,9 @@ ZEND_API char * zend_verify_internal_arg_class_kind(const zend_internal_arg_info
}
}
ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, char **class_name, zend_class_entry **pce TSRMLS_DC)
ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, char **class_name, zend_class_entry **pce)
{
*pce = zend_fetch_class(cur_arg_info->class_name, (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD) TSRMLS_CC);
*pce = zend_fetch_class(cur_arg_info->class_name, (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
*class_name = (*pce) ? (*pce)->name->val : cur_arg_info->class_name->val;
if (*pce && (*pce)->ce_flags & ZEND_ACC_INTERFACE) {
@ -558,7 +558,7 @@ ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ch
}
}
ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg TSRMLS_DC)
ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg)
{
zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data;
const char *fname = zf->common.function_name->val;
@ -594,13 +594,13 @@ ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, uin
}
}
static int is_null_constant(zval *default_value TSRMLS_DC)
static int is_null_constant(zval *default_value)
{
if (Z_CONSTANT_P(default_value)) {
zval constant;
ZVAL_COPY_VALUE(&constant, default_value);
zval_update_constant(&constant, 0 TSRMLS_CC);
zval_update_constant(&constant, 0);
if (Z_TYPE(constant) == IS_NULL) {
return 1;
}
@ -609,7 +609,7 @@ static int is_null_constant(zval *default_value TSRMLS_DC)
return 0;
}
static void zend_verify_internal_arg_type(zend_function *zf, uint32_t arg_num, zval *arg TSRMLS_DC)
static void zend_verify_internal_arg_type(zend_function *zf, uint32_t arg_num, zval *arg)
{
zend_internal_arg_info *cur_arg_info;
char *need_msg;
@ -632,23 +632,23 @@ static void zend_verify_internal_arg_type(zend_function *zf, uint32_t arg_num, z
ZVAL_DEREF(arg);
if (Z_TYPE_P(arg) == IS_OBJECT) {
need_msg = zend_verify_internal_arg_class_kind((zend_internal_arg_info*)cur_arg_info, &class_name, &ce TSRMLS_CC);
if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name->val, arg TSRMLS_CC);
need_msg = zend_verify_internal_arg_class_kind((zend_internal_arg_info*)cur_arg_info, &class_name, &ce);
if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce)) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name->val, arg);
}
} else if (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null) {
need_msg = zend_verify_internal_arg_class_kind((zend_internal_arg_info*)cur_arg_info, &class_name, &ce TSRMLS_CC);
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "", arg TSRMLS_CC);
need_msg = zend_verify_internal_arg_class_kind((zend_internal_arg_info*)cur_arg_info, &class_name, &ce);
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "", arg);
}
} else if (cur_arg_info->type_hint) {
if (cur_arg_info->type_hint == IS_ARRAY) {
ZVAL_DEREF(arg);
if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "", arg TSRMLS_CC);
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "", arg);
}
} else if (cur_arg_info->type_hint == IS_CALLABLE) {
if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "", arg TSRMLS_CC);
if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "", arg);
}
#if ZEND_DEBUG
} else {
@ -658,7 +658,7 @@ static void zend_verify_internal_arg_type(zend_function *zf, uint32_t arg_num, z
}
}
static void zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, zval *default_value TSRMLS_DC)
static void zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, zval *default_value)
{
zend_arg_info *cur_arg_info;
char *need_msg;
@ -681,23 +681,23 @@ static void zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg,
ZVAL_DEREF(arg);
if (Z_TYPE_P(arg) == IS_OBJECT) {
need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce TSRMLS_CC);
if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name->val, arg TSRMLS_CC);
need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce);
if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce)) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name->val, arg);
}
} else if (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC)))) {
need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce TSRMLS_CC);
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "", arg TSRMLS_CC);
} else if (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value)))) {
need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce);
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "", arg);
}
} else if (cur_arg_info->type_hint) {
if (cur_arg_info->type_hint == IS_ARRAY) {
ZVAL_DEREF(arg);
if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC))))) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "", arg TSRMLS_CC);
if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value))))) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "", arg);
}
} else if (cur_arg_info->type_hint == IS_CALLABLE) {
if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC))))) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "", arg TSRMLS_CC);
if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL) && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value))))) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "", arg);
}
#if ZEND_DEBUG
} else {
@ -707,7 +707,7 @@ static void zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg,
}
}
static inline int zend_verify_missing_arg_type(zend_function *zf, uint32_t arg_num TSRMLS_DC)
static inline int zend_verify_missing_arg_type(zend_function *zf, uint32_t arg_num)
{
zend_arg_info *cur_arg_info;
char *need_msg;
@ -728,14 +728,14 @@ static inline int zend_verify_missing_arg_type(zend_function *zf, uint32_t arg_n
if (cur_arg_info->class_name) {
char *class_name;
need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce TSRMLS_CC);
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "none", "", NULL TSRMLS_CC);
need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce);
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "none", "", NULL);
return 0;
} else if (cur_arg_info->type_hint) {
if (cur_arg_info->type_hint == IS_ARRAY) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "", NULL TSRMLS_CC);
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "", NULL);
} else if (cur_arg_info->type_hint == IS_CALLABLE) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "", NULL TSRMLS_CC);
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "", NULL);
#if ZEND_DEBUG
} else {
zend_error(E_ERROR, "Unknown typehint");
@ -746,10 +746,10 @@ static inline int zend_verify_missing_arg_type(zend_function *zf, uint32_t arg_n
return 1;
}
static void zend_verify_missing_arg(zend_execute_data *execute_data, uint32_t arg_num TSRMLS_DC)
static void zend_verify_missing_arg(zend_execute_data *execute_data, uint32_t arg_num)
{
if (EXPECTED(!(EX(func)->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) ||
zend_verify_missing_arg_type(EX(func), arg_num TSRMLS_CC)) {
zend_verify_missing_arg_type(EX(func), arg_num)) {
const char *class_name = EX(func)->common.scope ? EX(func)->common.scope->name->val : "";
const char *space = EX(func)->common.scope ? "::" : "";
const char *func_name = EX(func)->common.function_name ? EX(func)->common.function_name->val : "main";
@ -763,7 +763,7 @@ static void zend_verify_missing_arg(zend_execute_data *execute_data, uint32_t ar
}
}
static zend_always_inline void zend_assign_to_object(zval *retval, zval *object, uint32_t object_op_type, zval *property_name, uint32_t property_op_type, int value_type, znode_op value_op, const zend_execute_data *execute_data, void **cache_slot TSRMLS_DC)
static zend_always_inline void zend_assign_to_object(zval *retval, zval *object, uint32_t object_op_type, zval *property_name, uint32_t property_op_type, int value_type, znode_op value_op, const zend_execute_data *execute_data, void **cache_slot)
{
zend_free_op free_value;
zval *value = get_zval_ptr_deref(value_type, value_op, execute_data, &free_value, BP_VAR_R);
@ -824,7 +824,7 @@ static zend_always_inline void zend_assign_to_object(zval *retval, zval *object,
property = OBJ_PROP(zobj, prop_info->offset);
if (Z_TYPE_P(property) != IS_UNDEF) {
fast_assign:
value = zend_assign_to_variable(property, value, value_type TSRMLS_CC);
value = zend_assign_to_variable(property, value, value_type);
if (retval && !EG(exception)) {
ZVAL_COPY(retval, value);
}
@ -889,7 +889,7 @@ fast_assign:
Z_ADDREF_P(value);
}
Z_OBJ_HT_P(object)->write_property(object, property_name, value, cache_slot TSRMLS_CC);
Z_OBJ_HT_P(object)->write_property(object, property_name, value, cache_slot);
if (retval && !EG(exception)) {
ZVAL_COPY(retval, value);
@ -900,7 +900,7 @@ fast_assign:
}
}
static zend_always_inline void zend_assign_to_object_dim(zval *retval, zval *object, zval *property_name, int value_type, znode_op value_op, const zend_execute_data *execute_data TSRMLS_DC)
static zend_always_inline void zend_assign_to_object_dim(zval *retval, zval *object, zval *property_name, int value_type, znode_op value_op, const zend_execute_data *execute_data)
{
zend_free_op free_value;
zval *value = get_zval_ptr_deref(value_type, value_op, execute_data, &free_value, BP_VAR_R);
@ -923,7 +923,7 @@ static zend_always_inline void zend_assign_to_object_dim(zval *retval, zval *obj
Z_ADDREF_P(value);
}
Z_OBJ_HT_P(object)->write_dimension(object, property_name, value TSRMLS_CC);
Z_OBJ_HT_P(object)->write_dimension(object, property_name, value);
if (retval && !EG(exception)) {
ZVAL_COPY(retval, value);
@ -934,27 +934,27 @@ static zend_always_inline void zend_assign_to_object_dim(zval *retval, zval *obj
}
}
static void zend_binary_assign_op_obj_dim(zval *object, zval *property, zval *value, zval *retval, int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC) TSRMLS_DC)
static void zend_binary_assign_op_obj_dim(zval *object, zval *property, zval *value, zval *retval, int (*binary_op)(zval *result, zval *op1, zval *op2))
{
zval *z;
zval rv;
if (Z_OBJ_HT_P(object)->read_dimension &&
(z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R, &rv TSRMLS_CC)) != NULL) {
(z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R, &rv)) != NULL) {
if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) {
zval rv;
zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
zval *value = Z_OBJ_HT_P(z)->get(z, &rv);
if (Z_REFCOUNT_P(z) == 0) {
zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
zend_objects_store_del(Z_OBJ_P(z));
}
ZVAL_COPY_VALUE(z, value);
}
ZVAL_DEREF(z);
SEPARATE_ZVAL_NOREF(z);
binary_op(z, z, value TSRMLS_CC);
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
binary_op(z, z, value);
Z_OBJ_HT_P(object)->write_dimension(object, property, z);
if (retval) {
ZVAL_COPY(retval, z);
}
@ -967,7 +967,7 @@ static void zend_binary_assign_op_obj_dim(zval *object, zval *property, zval *va
}
}
static void zend_assign_to_string_offset(zval *str, zend_long offset, zval *value, zval *result TSRMLS_DC)
static void zend_assign_to_string_offset(zval *str, zend_long offset, zval *value, zval *result)
{
zend_string *old_str;
@ -1018,7 +1018,7 @@ static void zend_assign_to_string_offset(zval *str, zend_long offset, zval *valu
}
/* Utility Functions for Extensions */
static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array)
{
if (extension->statement_handler) {
extension->statement_handler(op_array);
@ -1026,7 +1026,7 @@ static void zend_extension_statement_handler(const zend_extension *extension, ze
}
static void zend_extension_fcall_begin_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
static void zend_extension_fcall_begin_handler(const zend_extension *extension, zend_op_array *op_array)
{
if (extension->fcall_begin_handler) {
extension->fcall_begin_handler(op_array);
@ -1034,7 +1034,7 @@ static void zend_extension_fcall_begin_handler(const zend_extension *extension,
}
static void zend_extension_fcall_end_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
static void zend_extension_fcall_end_handler(const zend_extension *extension, zend_op_array *op_array)
{
if (extension->fcall_end_handler) {
extension->fcall_end_handler(op_array);
@ -1042,7 +1042,7 @@ static void zend_extension_fcall_end_handler(const zend_extension *extension, ze
}
static zend_always_inline HashTable *zend_get_target_symbol_table(zend_execute_data *execute_data, int fetch_type TSRMLS_DC)
static zend_always_inline HashTable *zend_get_target_symbol_table(zend_execute_data *execute_data, int fetch_type)
{
HashTable *ht;
@ -1055,14 +1055,14 @@ static zend_always_inline HashTable *zend_get_target_symbol_table(zend_execute_d
} else {
ZEND_ASSERT(fetch_type == ZEND_FETCH_LOCAL);
if (!EX(symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
zend_rebuild_symbol_table();
}
ht = &EX(symbol_table)->ht;
}
return ht;
}
static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht, const zval *dim, int dim_type, int type TSRMLS_DC)
static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht, const zval *dim, int dim_type, int type)
{
zval *retval;
zend_string *offset_key;
@ -1168,7 +1168,7 @@ str_index:
return retval;
}
static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type TSRMLS_DC)
static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type)
{
zend_long offset;
@ -1209,9 +1209,9 @@ try_again:
return offset;
}
static zend_always_inline zend_long zend_fetch_string_offset(zval *container, zval *dim, int type TSRMLS_DC)
static zend_always_inline zend_long zend_fetch_string_offset(zval *container, zval *dim, int type)
{
zend_long offset = zend_check_string_offset(dim, type TSRMLS_CC);
zend_long offset = zend_check_string_offset(dim, type);
if (Z_REFCOUNTED_P(container)) {
if (Z_REFCOUNT_P(container) > 1) {
@ -1223,7 +1223,7 @@ static zend_always_inline zend_long zend_fetch_string_offset(zval *container, zv
return offset;
}
static zend_always_inline void zend_fetch_dimension_address(zval *result, zval *container, zval *dim, int dim_type, int type TSRMLS_DC)
static zend_always_inline void zend_fetch_dimension_address(zval *result, zval *container, zval *dim, int dim_type, int type)
{
zval *retval;
@ -1238,7 +1238,7 @@ fetch_from_array:
retval = &EG(error_zval);
}
} else {
retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type TSRMLS_CC);
retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type);
}
ZVAL_INDIRECT(result, retval);
} else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) {
@ -1250,14 +1250,14 @@ convert_to_array:
goto fetch_from_array;
}
zend_check_string_offset(dim, type TSRMLS_CC);
zend_check_string_offset(dim, type);
ZVAL_INDIRECT(result, NULL); /* wrong string offset */
} else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (!Z_OBJ_HT_P(container)->read_dimension) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
} else {
retval = Z_OBJ_HT_P(container)->read_dimension(container, dim, type, result TSRMLS_CC);
retval = Z_OBJ_HT_P(container)->read_dimension(container, dim, type, result);
if (UNEXPECTED(retval == &EG(uninitialized_zval))) {
zend_class_entry *ce = Z_OBJCE_P(container);
@ -1312,28 +1312,28 @@ convert_to_array:
}
}
static zend_never_inline void zend_fetch_dimension_address_W(zval *result, zval *container_ptr, zval *dim, int dim_type TSRMLS_DC)
static zend_never_inline void zend_fetch_dimension_address_W(zval *result, zval *container_ptr, zval *dim, int dim_type)
{
zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_W TSRMLS_CC);
zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_W);
}
static zend_never_inline void zend_fetch_dimension_address_RW(zval *result, zval *container_ptr, zval *dim, int dim_type TSRMLS_DC)
static zend_never_inline void zend_fetch_dimension_address_RW(zval *result, zval *container_ptr, zval *dim, int dim_type)
{
zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_RW TSRMLS_CC);
zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_RW);
}
static zend_never_inline void zend_fetch_dimension_address_UNSET(zval *result, zval *container_ptr, zval *dim, int dim_type TSRMLS_DC)
static zend_never_inline void zend_fetch_dimension_address_UNSET(zval *result, zval *container_ptr, zval *dim, int dim_type)
{
zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_UNSET TSRMLS_CC);
zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_UNSET);
}
static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type TSRMLS_DC)
static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type)
{
zval *retval;
try_again:
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type TSRMLS_CC);
retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type);
ZVAL_COPY(result, retval);
} else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_long offset;
@ -1389,7 +1389,7 @@ try_string_offset:
if (!Z_OBJ_HT_P(container)->read_dimension) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
} else {
retval = Z_OBJ_HT_P(container)->read_dimension(container, dim, type, result TSRMLS_CC);
retval = Z_OBJ_HT_P(container)->read_dimension(container, dim, type, result);
ZEND_ASSERT(result != NULL);
if (retval) {
@ -1408,22 +1408,22 @@ try_string_offset:
}
}
static zend_never_inline void zend_fetch_dimension_address_read_R(zval *result, zval *container, zval *dim, int dim_type TSRMLS_DC)
static zend_never_inline void zend_fetch_dimension_address_read_R(zval *result, zval *container, zval *dim, int dim_type)
{
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R TSRMLS_CC);
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R);
}
static zend_never_inline void zend_fetch_dimension_address_read_IS(zval *result, zval *container, zval *dim, int dim_type TSRMLS_DC)
static zend_never_inline void zend_fetch_dimension_address_read_IS(zval *result, zval *container, zval *dim, int dim_type)
{
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS TSRMLS_CC);
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS);
}
ZEND_API void zend_fetch_dimension_by_zval(zval *result, zval *container, zval *dim TSRMLS_DC)
ZEND_API void zend_fetch_dimension_by_zval(zval *result, zval *container, zval *dim)
{
zend_fetch_dimension_address_read_R(result, container, dim, IS_TMP_VAR TSRMLS_CC);
zend_fetch_dimension_address_read_R(result, container, dim, IS_TMP_VAR);
}
static zend_always_inline void zend_fetch_property_address(zval *result, zval *container, uint32_t container_op_type, zval *prop_ptr, uint32_t prop_op_type, void **cache_slot, int type TSRMLS_DC)
static zend_always_inline void zend_fetch_property_address(zval *result, zval *container, uint32_t container_op_type, zval *prop_ptr, uint32_t prop_op_type, void **cache_slot, int type)
{
if (container_op_type != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
do {
@ -1473,10 +1473,10 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
}
}
if (EXPECTED(Z_OBJ_HT_P(container)->get_property_ptr_ptr)) {
zval *ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, cache_slot TSRMLS_CC);
zval *ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, cache_slot);
if (NULL == ptr) {
if (Z_OBJ_HT_P(container)->read_property &&
(ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, cache_slot, result TSRMLS_CC)) != NULL) {
(ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, cache_slot, result)) != NULL) {
if (ptr != result) {
ZVAL_INDIRECT(result, ptr);
}
@ -1487,7 +1487,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
ZVAL_INDIRECT(result, ptr);
}
} else if (EXPECTED(Z_OBJ_HT_P(container)->read_property)) {
zval *ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, cache_slot, result TSRMLS_CC);
zval *ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, cache_slot, result);
if (ptr != result) {
ZVAL_INDIRECT(result, ptr);
}
@ -1497,7 +1497,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
}
}
static inline zend_brk_cont_element* zend_brk_cont(int nest_levels, int array_offset, const zend_op_array *op_array, const zend_execute_data *execute_data TSRMLS_DC)
static inline zend_brk_cont_element* zend_brk_cont(int nest_levels, int array_offset, const zend_op_array *op_array, const zend_execute_data *execute_data)
{
int original_nest_levels = nest_levels;
zend_brk_cont_element *jmp_to;
@ -1524,12 +1524,12 @@ static inline zend_brk_cont_element* zend_brk_cont(int nest_levels, int array_of
#if ZEND_INTENSIVE_DEBUGGING
#define CHECK_SYMBOL_TABLES() \
zend_hash_apply(&EG(symbol_table), zend_check_symbol TSRMLS_CC); \
zend_hash_apply(&EG(symbol_table), zend_check_symbol); \
if (&EG(symbol_table)!=EX(symbol_table)) { \
zend_hash_apply(EX(symbol_table), zend_check_symbol TSRMLS_CC); \
zend_hash_apply(EX(symbol_table), zend_check_symbol); \
}
static int zend_check_symbol(zval *pz TSRMLS_DC)
static int zend_check_symbol(zval *pz)
{
if (Z_TYPE_P(pz) == IS_INDIRECT) {
pz = Z_INDIRECT_P(pz);
@ -1541,10 +1541,10 @@ static int zend_check_symbol(zval *pz TSRMLS_DC)
fflush(stderr);
#endif
} else if (Z_TYPE_P(pz) == IS_ARRAY) {
zend_hash_apply(Z_ARRVAL_P(pz), zend_check_symbol TSRMLS_CC);
zend_hash_apply(Z_ARRVAL_P(pz), zend_check_symbol);
} else if (Z_TYPE_P(pz) == IS_OBJECT) {
/* OBJ-TBI - doesn't support new object model! */
zend_hash_apply(Z_OBJPROP_P(pz), zend_check_symbol TSRMLS_CC);
zend_hash_apply(Z_OBJPROP_P(pz), zend_check_symbol);
}
return 0;
@ -1557,26 +1557,26 @@ static int zend_check_symbol(zval *pz TSRMLS_DC)
ZEND_API opcode_handler_t *zend_opcode_handlers;
ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_value TSRMLS_DC)
ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_value)
{
execute_data->func->internal_function.handler(execute_data, return_value TSRMLS_CC);
execute_data->func->internal_function.handler(execute_data, return_value);
}
ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table TSRMLS_DC) /* {{{ */
ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table) /* {{{ */
{
if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) {
zend_array_destroy(&symbol_table->ht TSRMLS_CC);
zend_array_destroy(&symbol_table->ht);
efree_size(symbol_table, sizeof(zend_array));
} else {
/* clean before putting into the cache, since clean
could call dtors, which could use cached hash */
zend_symtable_clean(&symbol_table->ht TSRMLS_CC);
zend_symtable_clean(&symbol_table->ht);
*(++EG(symtable_cache_ptr)) = symbol_table;
}
}
/* }}} */
static zend_always_inline void i_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC) /* {{{ */
static zend_always_inline void i_free_compiled_variables(zend_execute_data *execute_data) /* {{{ */
{
if (EXPECTED(EX(func)->op_array.last_var > 0)) {
zval *cv = EX_VAR_NUM(0);
@ -1589,9 +1589,9 @@ static zend_always_inline void i_free_compiled_variables(zend_execute_data *exec
}
/* }}} */
void zend_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC) /* {{{ */
void zend_free_compiled_variables(zend_execute_data *execute_data) /* {{{ */
{
i_free_compiled_variables(execute_data TSRMLS_CC);
i_free_compiled_variables(execute_data);
}
/* }}} */
@ -1615,7 +1615,7 @@ void zend_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC) /*
* +----------------------------------------+
*/
static zend_always_inline void i_init_func_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value TSRMLS_DC) /* {{{ */
static zend_always_inline void i_init_func_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value) /* {{{ */
{
uint32_t first_extra_arg, num_args;
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
@ -1681,7 +1681,7 @@ static zend_always_inline void i_init_func_execute_data(zend_execute_data *execu
}
/* }}} */
static zend_always_inline void i_init_code_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value TSRMLS_DC) /* {{{ */
static zend_always_inline void i_init_code_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value) /* {{{ */
{
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
@ -1706,7 +1706,7 @@ static zend_always_inline void i_init_code_execute_data(zend_execute_data *execu
}
/* }}} */
static zend_always_inline void i_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value TSRMLS_DC) /* {{{ */
static zend_always_inline void i_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value) /* {{{ */
{
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
@ -1781,7 +1781,7 @@ static zend_always_inline void i_init_execute_data(zend_execute_data *execute_da
}
/* }}} */
ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data *call, zend_op_array *op_array, zval *return_value TSRMLS_DC) /* {{{ */
ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data *call, zend_op_array *op_array, zval *return_value) /* {{{ */
{
/*
* Normally the execute_data is allocated on the VM stack (because it does
@ -1810,7 +1810,7 @@ ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data
num_args,
call->called_scope,
Z_OBJ(call->This),
NULL TSRMLS_CC);
NULL);
EX_NUM_ARGS() = num_args;
/* copy arguments */
@ -1826,33 +1826,33 @@ ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data
EX(symbol_table) = NULL;
i_init_func_execute_data(execute_data, op_array, return_value TSRMLS_CC);
i_init_func_execute_data(execute_data, op_array, return_value);
return execute_data;
}
/* }}} */
ZEND_API void zend_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value TSRMLS_DC) /* {{{ */
ZEND_API void zend_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value) /* {{{ */
{
EX(prev_execute_data) = EG(current_execute_data);
i_init_execute_data(execute_data, op_array, return_value TSRMLS_CC);
i_init_execute_data(execute_data, op_array, return_value);
}
/* }}} */
static zend_always_inline zend_bool zend_is_by_ref_func_arg_fetch(const zend_op *opline, zend_execute_data *call TSRMLS_DC) /* {{{ */
static zend_always_inline zend_bool zend_is_by_ref_func_arg_fetch(const zend_op *opline, zend_execute_data *call) /* {{{ */
{
uint32_t arg_num = opline->extended_value & ZEND_FETCH_ARG_MASK;
return ARG_SHOULD_BE_SENT_BY_REF(call->func, arg_num);
}
/* }}} */
static zend_execute_data *zend_vm_stack_copy_call_frame(zend_execute_data *call, uint32_t passed_args, uint32_t additional_args TSRMLS_DC) /* {{{ */
static zend_execute_data *zend_vm_stack_copy_call_frame(zend_execute_data *call, uint32_t passed_args, uint32_t additional_args) /* {{{ */
{
zend_execute_data *new_call;
int used_stack = (EG(vm_stack_top) - (zval*)call) + additional_args;
/* copy call frame into new stack segment */
new_call = zend_vm_stack_extend(used_stack * sizeof(zval) TSRMLS_CC);
new_call = zend_vm_stack_extend(used_stack * sizeof(zval));
*new_call = *call;
if (passed_args) {
zval *src = ZEND_CALL_ARG(call, 1);
@ -1880,12 +1880,12 @@ static zend_execute_data *zend_vm_stack_copy_call_frame(zend_execute_data *call,
}
/* }}} */
static zend_always_inline void zend_vm_stack_extend_call_frame(zend_execute_data **call, uint32_t passed_args, uint32_t additional_args TSRMLS_DC) /* {{{ */
static zend_always_inline void zend_vm_stack_extend_call_frame(zend_execute_data **call, uint32_t passed_args, uint32_t additional_args) /* {{{ */
{
if (EXPECTED(EG(vm_stack_end) - EG(vm_stack_top) > additional_args)) {
EG(vm_stack_top) += additional_args;
} else {
*call = zend_vm_stack_copy_call_frame(*call, passed_args, additional_args TSRMLS_CC);
*call = zend_vm_stack_copy_call_frame(*call, passed_args, additional_args);
}
}
/* }}} */
@ -1941,7 +1941,7 @@ ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode)
return zend_user_opcode_handlers[opcode];
}
ZEND_API zval *zend_get_zval_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC) {
ZEND_API zval *zend_get_zval_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type) {
return get_zval_ptr(op_type, *node, execute_data, should_free, type);
}

View file

@ -29,29 +29,29 @@
BEGIN_EXTERN_C()
struct _zend_fcall_info;
ZEND_API extern void (*zend_execute_ex)(zend_execute_data *execute_data TSRMLS_DC);
ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data, zval *return_value TSRMLS_DC);
ZEND_API extern void (*zend_execute_ex)(zend_execute_data *execute_data);
ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data, zval *return_value);
void init_executor(TSRMLS_D);
void shutdown_executor(TSRMLS_D);
void shutdown_destructors(TSRMLS_D);
ZEND_API void zend_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value TSRMLS_DC);
ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data *call, zend_op_array *op_array, zval *return_value TSRMLS_DC);
ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value TSRMLS_DC);
ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC);
ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_value TSRMLS_DC);
ZEND_API zend_class_entry *zend_lookup_class(zend_string *name TSRMLS_DC);
ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *key, int use_autoload TSRMLS_DC);
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char *string_name TSRMLS_DC);
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
void init_executor(void);
void shutdown_executor(void);
void shutdown_destructors(void);
ZEND_API void zend_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value);
ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data *call, zend_op_array *op_array, zval *return_value);
ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value);
ZEND_API void execute_ex(zend_execute_data *execute_data);
ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_value);
ZEND_API zend_class_entry *zend_lookup_class(zend_string *name);
ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *key, int use_autoload);
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name);
ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char *string_name);
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions);
ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, char *string_name, int handle_exceptions);
ZEND_API char * zend_verify_internal_arg_class_kind(const zend_internal_arg_info *cur_arg_info, char **class_name, zend_class_entry **pce TSRMLS_DC);
ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, char **class_name, zend_class_entry **pce TSRMLS_DC);
ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg TSRMLS_DC);
ZEND_API char * zend_verify_internal_arg_class_kind(const zend_internal_arg_info *cur_arg_info, char **class_name, zend_class_entry **pce);
ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, char **class_name, zend_class_entry **pce);
ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg);
static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, zend_uchar value_type TSRMLS_DC)
static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, zend_uchar value_type)
{
do {
if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) {
@ -65,7 +65,7 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval
}
if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value TSRMLS_CC);
Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value);
return variable_ptr;
}
if ((value_type & (IS_VAR|IS_CV)) && variable_ptr == value) {
@ -90,7 +90,7 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval
/* optimized version of GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr) */
if ((Z_COLLECTABLE_P(variable_ptr)) &&
UNEXPECTED(!GC_INFO(garbage))) {
gc_possible_root(garbage TSRMLS_CC);
gc_possible_root(garbage);
}
}
}
@ -110,10 +110,10 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval
return variable_ptr;
}
ZEND_API int zval_update_constant(zval *pp, zend_bool inline_change TSRMLS_DC);
ZEND_API int zval_update_constant_inline_change(zval *pp, zend_class_entry *scope TSRMLS_DC);
ZEND_API int zval_update_constant_no_inline_change(zval *pp, zend_class_entry *scope TSRMLS_DC);
ZEND_API int zval_update_constant_ex(zval *pp, zend_bool inline_change, zend_class_entry *scope TSRMLS_DC);
ZEND_API int zval_update_constant(zval *pp, zend_bool inline_change);
ZEND_API int zval_update_constant_inline_change(zval *pp, zend_class_entry *scope);
ZEND_API int zval_update_constant_no_inline_change(zval *pp, zend_class_entry *scope);
ZEND_API int zval_update_constant_ex(zval *pp, zend_bool inline_change, zend_class_entry *scope);
/* dedicated Zend executor functions - do not use! */
struct _zend_vm_stack {
@ -128,29 +128,29 @@ struct _zend_vm_stack {
#define ZEND_VM_STACK_ELEMETS(stack) \
(((zval*)(stack)) + ZEND_VM_STACK_HEADER_SLOTS)
ZEND_API void zend_vm_stack_init(TSRMLS_D);
ZEND_API void zend_vm_stack_destroy(TSRMLS_D);
ZEND_API void* zend_vm_stack_extend(size_t size TSRMLS_DC);
ZEND_API void zend_vm_stack_init(void);
ZEND_API void zend_vm_stack_destroy(void);
ZEND_API void* zend_vm_stack_extend(size_t size);
static zend_always_inline zval* zend_vm_stack_alloc(size_t size TSRMLS_DC)
static zend_always_inline zval* zend_vm_stack_alloc(size_t size)
{
char *top = (char*)EG(vm_stack_top);
if (UNEXPECTED(size > (size_t)(((char*)EG(vm_stack_end)) - top))) {
return (zval*)zend_vm_stack_extend(size TSRMLS_CC);
return (zval*)zend_vm_stack_extend(size);
}
EG(vm_stack_top) = (zval*)(top + size);
return (zval*)top;
}
static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame_ex(uint32_t call_info, zend_function *func, uint32_t used_stack, zend_class_entry *called_scope, zend_object *object, zend_execute_data *prev TSRMLS_DC)
static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame_ex(uint32_t used_stack, uint32_t call_info, zend_function *func, uint32_t num_args, zend_class_entry *called_scope, zend_object *object, zend_execute_data *prev)
{
zend_execute_data *call = (zend_execute_data*)zend_vm_stack_alloc(used_stack TSRMLS_CC);
zend_execute_data *call = (zend_execute_data*)zend_vm_stack_alloc(used_stack);
call->func = func;
Z_OBJ(call->This) = object;
ZEND_SET_CALL_INFO(call, call_info);
ZEND_CALL_NUM_ARGS(call) = 0;
ZEND_CALL_NUM_ARGS(call) = num_args;
call->called_scope = called_scope;
call->prev_execute_data = prev;
return call;
@ -166,15 +166,15 @@ static zend_always_inline uint32_t zend_vm_calc_used_stack(uint32_t num_args, ze
return used_stack * sizeof(zval);
}
static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame(uint32_t call_info, zend_function *func, uint32_t num_args, zend_class_entry *called_scope, zend_object *object, zend_execute_data *prev TSRMLS_DC)
static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame(uint32_t call_info, zend_function *func, uint32_t num_args, zend_class_entry *called_scope, zend_object *object, zend_execute_data *prev)
{
uint32_t used_stack = zend_vm_calc_used_stack(num_args, func);
return zend_vm_stack_push_call_frame_ex(call_info,
func, used_stack, called_scope, object, prev TSRMLS_CC);
return zend_vm_stack_push_call_frame_ex(used_stack, call_info,
func, num_args, called_scope, object, prev);
}
static zend_always_inline void zend_vm_stack_free_extra_args(zend_execute_data *call TSRMLS_DC)
static zend_always_inline void zend_vm_stack_free_extra_args(zend_execute_data *call)
{
uint32_t first_extra_arg = call->func->op_array.num_args - ((call->func->common.fn_flags & ZEND_ACC_VARIADIC) != 0);
@ -188,11 +188,11 @@ static zend_always_inline void zend_vm_stack_free_extra_args(zend_execute_data *
}
}
static zend_always_inline void zend_vm_stack_free_args(zend_execute_data *call TSRMLS_DC)
static zend_always_inline void zend_vm_stack_free_args(zend_execute_data *call)
{
uint32_t num_args = ZEND_CALL_NUM_ARGS(call);
if (num_args > 0) {
if (EXPECTED(num_args > 0)) {
zval *end = ZEND_CALL_ARG(call, 1);
zval *p = end + num_args;
@ -203,7 +203,7 @@ static zend_always_inline void zend_vm_stack_free_args(zend_execute_data *call T
}
}
static zend_always_inline void zend_vm_stack_free_call_frame(zend_execute_data *call TSRMLS_DC)
static zend_always_inline void zend_vm_stack_free_call_frame(zend_execute_data *call)
{
zend_vm_stack p = EG(vm_stack);
if (UNEXPECTED(ZEND_VM_STACK_ELEMETS(p) == (zval*)call)) {
@ -219,20 +219,20 @@ static zend_always_inline void zend_vm_stack_free_call_frame(zend_execute_data *
}
/* services */
ZEND_API const char *get_active_class_name(const char **space TSRMLS_DC);
ZEND_API const char *get_active_function_name(TSRMLS_D);
ZEND_API const char *zend_get_executed_filename(TSRMLS_D);
ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
ZEND_API zend_bool zend_is_executing(TSRMLS_D);
ZEND_API const char *get_active_class_name(const char **space);
ZEND_API const char *get_active_function_name(void);
ZEND_API const char *zend_get_executed_filename(void);
ZEND_API uint zend_get_executed_lineno(void);
ZEND_API zend_bool zend_is_executing(void);
ZEND_API void zend_set_timeout(zend_long seconds, int reset_signals);
ZEND_API void zend_unset_timeout(TSRMLS_D);
ZEND_API void zend_unset_timeout(void);
ZEND_API void zend_timeout(int dummy);
ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type TSRMLS_DC);
ZEND_API zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zval *key, int fetch_type TSRMLS_DC);
void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC);
ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type);
ZEND_API zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zval *key, int fetch_type);
void zend_verify_abstract_class(zend_class_entry *ce);
ZEND_API void zend_fetch_dimension_by_zval(zval *result, zval *container, zval *dim TSRMLS_DC);
ZEND_API void zend_fetch_dimension_by_zval(zval *result, zval *container, zval *dim);
ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute_data_ptr, uint32_t var);
@ -250,12 +250,12 @@ ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode);
/* former zend_execute_locks.h */
typedef zval* zend_free_op;
ZEND_API zval *zend_get_zval_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC);
ZEND_API zval *zend_get_zval_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type);
ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS);
ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table TSRMLS_DC);
void zend_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC);
ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table);
void zend_free_compiled_variables(zend_execute_data *execute_data);
#define CACHED_PTR(num) \
EX_RUN_TIME_CACHE()[(num)]

View file

@ -38,8 +38,8 @@
#include <sys/time.h>
#endif
ZEND_API void (*zend_execute_ex)(zend_execute_data *execute_data TSRMLS_DC);
ZEND_API void (*zend_execute_internal)(zend_execute_data *execute_data, zval *return_value TSRMLS_DC);
ZEND_API void (*zend_execute_ex)(zend_execute_data *execute_data);
ZEND_API void (*zend_execute_internal)(zend_execute_data *execute_data, zval *return_value);
/* true globals */
ZEND_API const zend_fcall_info empty_fcall_info = { 0, NULL, {{0}, {{0}}, {0}}, NULL, NULL, NULL, NULL, 0, 0 };
@ -64,14 +64,13 @@ static void zend_handle_sigsegv(int dummy) /* {{{ */
signal(SIGSEGV, SIG_DFL);
}
{
TSRMLS_FETCH();
fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %s() at %s:%d\n\n",
active_opline->opcode,
active_opline-EG(active_op_array)->opcodes,
get_active_function_name(TSRMLS_C),
zend_get_executed_filename(TSRMLS_C),
zend_get_executed_lineno(TSRMLS_C));
get_active_function_name(),
zend_get_executed_filename(),
zend_get_executed_lineno());
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
fflush(stderr);
@ -84,7 +83,7 @@ static void zend_handle_sigsegv(int dummy) /* {{{ */
/* }}} */
#endif
static void zend_extension_activator(zend_extension *extension TSRMLS_DC) /* {{{ */
static void zend_extension_activator(zend_extension *extension) /* {{{ */
{
if (extension->activate) {
extension->activate();
@ -92,7 +91,7 @@ static void zend_extension_activator(zend_extension *extension TSRMLS_DC) /* {{{
}
/* }}} */
static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC) /* {{{ */
static void zend_extension_deactivator(zend_extension *extension) /* {{{ */
{
if (extension->deactivate) {
extension->deactivate();
@ -100,37 +99,37 @@ static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC) /* {
}
/* }}} */
static int clean_non_persistent_function(zval *zv TSRMLS_DC) /* {{{ */
static int clean_non_persistent_function(zval *zv) /* {{{ */
{
zend_function *function = Z_PTR_P(zv);
return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE;
}
/* }}} */
ZEND_API int clean_non_persistent_function_full(zval *zv TSRMLS_DC) /* {{{ */
ZEND_API int clean_non_persistent_function_full(zval *zv) /* {{{ */
{
zend_function *function = Z_PTR_P(zv);
return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
}
/* }}} */
static int clean_non_persistent_class(zval *zv TSRMLS_DC) /* {{{ */
static int clean_non_persistent_class(zval *zv) /* {{{ */
{
zend_class_entry *ce = Z_PTR_P(zv);
return (ce->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE;
}
/* }}} */
ZEND_API int clean_non_persistent_class_full(zval *zv TSRMLS_DC) /* {{{ */
ZEND_API int clean_non_persistent_class_full(zval *zv) /* {{{ */
{
zend_class_entry *ce = Z_PTR_P(zv);
return (ce->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
}
/* }}} */
void init_executor(TSRMLS_D) /* {{{ */
void init_executor(void) /* {{{ */
{
zend_init_fpu(TSRMLS_C);
zend_init_fpu();
ZVAL_NULL(&EG(uninitialized_zval));
/* trick to make uninitialized_zval never be modified, passed by ref, etc. */
@ -151,14 +150,14 @@ void init_executor(TSRMLS_D) /* {{{ */
EG(autoload_func) = NULL;
EG(error_handling) = EH_NORMAL;
zend_vm_stack_init(TSRMLS_C);
zend_vm_stack_init();
zend_hash_init(&EG(symbol_table).ht, 64, NULL, ZVAL_PTR_DTOR, 0);
GC_REFCOUNT(&EG(symbol_table)) = 1;
GC_TYPE_INFO(&EG(symbol_table)) = IS_ARRAY;
EG(valid_symbol_table) = 1;
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator TSRMLS_CC);
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator);
zend_hash_init(&EG(included_files), 8, NULL, NULL, 0);
@ -188,7 +187,7 @@ void init_executor(TSRMLS_D) /* {{{ */
}
/* }}} */
static int zval_call_destructor(zval *zv TSRMLS_DC) /* {{{ */
static int zval_call_destructor(zval *zv) /* {{{ */
{
if (Z_TYPE_P(zv) == IS_INDIRECT) {
zv = Z_INDIRECT_P(zv);
@ -203,16 +202,15 @@ static int zval_call_destructor(zval *zv TSRMLS_DC) /* {{{ */
static void zend_unclean_zval_ptr_dtor(zval *zv) /* {{{ */
{
TSRMLS_FETCH();
if (Z_TYPE_P(zv) == IS_INDIRECT) {
zv = Z_INDIRECT_P(zv);
}
i_zval_ptr_dtor(zv ZEND_FILE_LINE_CC TSRMLS_CC);
i_zval_ptr_dtor(zv ZEND_FILE_LINE_CC);
}
/* }}} */
void shutdown_destructors(TSRMLS_D) /* {{{ */
void shutdown_destructors(void) /* {{{ */
{
if (CG(unclean_shutdown)) {
EG(symbol_table).ht.pDestructor = zend_unclean_zval_ptr_dtor;
@ -221,17 +219,17 @@ void shutdown_destructors(TSRMLS_D) /* {{{ */
uint32_t symbols;
do {
symbols = zend_hash_num_elements(&EG(symbol_table).ht);
zend_hash_reverse_apply(&EG(symbol_table).ht, (apply_func_t) zval_call_destructor TSRMLS_CC);
zend_hash_reverse_apply(&EG(symbol_table).ht, (apply_func_t) zval_call_destructor);
} while (symbols != zend_hash_num_elements(&EG(symbol_table).ht));
zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC);
zend_objects_store_call_destructors(&EG(objects_store));
} zend_catch {
/* if we couldn't destruct cleanly, mark all objects as destructed anyway */
zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC);
zend_objects_store_mark_destructed(&EG(objects_store));
} zend_end_try();
}
/* }}} */
void shutdown_executor(TSRMLS_D) /* {{{ */
void shutdown_executor(void) /* {{{ */
{
zend_function *func;
zend_class_entry *ce;
@ -243,7 +241,7 @@ void shutdown_executor(TSRMLS_D) /* {{{ */
Object 3 holds reference to object 2.
Now when 1 and 2 are destroyed, 3 can still access 2 in its destructor, with
very problematic results */
/* zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC); */
/* zend_objects_store_call_destructors(&EG(objects_store)); */
/* Moved after symbol table cleaners, because some of the cleaners can call
destructors, which would use EG(symtable_cache_ptr) and thus leave leaks */
@ -253,7 +251,7 @@ void shutdown_executor(TSRMLS_D) /* {{{ */
EG(symtable_cache_ptr)--;
}
*/
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_deactivator TSRMLS_CC);
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_deactivator);
if (CG(unclean_shutdown)) {
EG(symbol_table).ht.pDestructor = zend_unclean_zval_ptr_dtor;
@ -301,9 +299,9 @@ void shutdown_executor(TSRMLS_D) /* {{{ */
} ZEND_HASH_FOREACH_END();
ZEND_HASH_REVERSE_FOREACH_PTR(EG(class_table), ce) {
if (ce->type == ZEND_USER_CLASS) {
zend_cleanup_user_class_data(ce TSRMLS_CC);
zend_cleanup_user_class_data(ce);
} else {
zend_cleanup_internal_class_data(ce TSRMLS_CC);
zend_cleanup_internal_class_data(ce);
}
} ZEND_HASH_FOREACH_END();
} else {
@ -317,9 +315,9 @@ void shutdown_executor(TSRMLS_D) /* {{{ */
if (ce->type != ZEND_USER_CLASS) {
break;
}
zend_cleanup_user_class_data(ce TSRMLS_CC);
zend_cleanup_user_class_data(ce);
} ZEND_HASH_FOREACH_END();
zend_cleanup_internal_classes(TSRMLS_C);
zend_cleanup_internal_classes();
}
} zend_end_try();
@ -328,21 +326,21 @@ void shutdown_executor(TSRMLS_D) /* {{{ */
} zend_end_try();
zend_try {
zend_close_rsrc_list(&EG(regular_list) TSRMLS_CC);
zend_close_rsrc_list(&EG(regular_list));
} zend_end_try();
zend_try {
zend_objects_store_free_object_storage(&EG(objects_store) TSRMLS_CC);
zend_objects_store_free_object_storage(&EG(objects_store));
zend_vm_stack_destroy(TSRMLS_C);
zend_vm_stack_destroy();
/* Destroy all op arrays */
if (EG(full_tables_cleanup)) {
zend_hash_reverse_apply(EG(function_table), clean_non_persistent_function_full TSRMLS_CC);
zend_hash_reverse_apply(EG(class_table), clean_non_persistent_class_full TSRMLS_CC);
zend_hash_reverse_apply(EG(function_table), clean_non_persistent_function_full);
zend_hash_reverse_apply(EG(class_table), clean_non_persistent_class_full);
} else {
zend_hash_reverse_apply(EG(function_table), clean_non_persistent_function TSRMLS_CC);
zend_hash_reverse_apply(EG(class_table), clean_non_persistent_class TSRMLS_CC);
zend_hash_reverse_apply(EG(function_table), clean_non_persistent_function);
zend_hash_reverse_apply(EG(class_table), clean_non_persistent_class);
}
while (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
@ -353,7 +351,7 @@ void shutdown_executor(TSRMLS_D) /* {{{ */
} zend_end_try();
zend_try {
clean_non_persistent_constants(TSRMLS_C);
clean_non_persistent_constants();
} zend_end_try();
zend_try {
@ -373,18 +371,18 @@ void shutdown_executor(TSRMLS_D) /* {{{ */
}
} zend_end_try();
zend_shutdown_fpu(TSRMLS_C);
zend_shutdown_fpu();
EG(active) = 0;
}
/* }}} */
/* return class name and "::" or "". */
ZEND_API const char *get_active_class_name(const char **space TSRMLS_DC) /* {{{ */
ZEND_API const char *get_active_class_name(const char **space) /* {{{ */
{
zend_function *func;
if (!zend_is_executing(TSRMLS_C)) {
if (!zend_is_executing()) {
if (space) {
*space = "";
}
@ -412,11 +410,11 @@ ZEND_API const char *get_active_class_name(const char **space TSRMLS_DC) /* {{{
}
/* }}} */
ZEND_API const char *get_active_function_name(TSRMLS_D) /* {{{ */
ZEND_API const char *get_active_function_name(void) /* {{{ */
{
zend_function *func;
if (!zend_is_executing(TSRMLS_C)) {
if (!zend_is_executing()) {
return NULL;
}
func = EG(current_execute_data)->func;
@ -440,7 +438,7 @@ ZEND_API const char *get_active_function_name(TSRMLS_D) /* {{{ */
}
/* }}} */
ZEND_API const char *zend_get_executed_filename(TSRMLS_D) /* {{{ */
ZEND_API const char *zend_get_executed_filename(void) /* {{{ */
{
zend_execute_data *ex = EG(current_execute_data);
@ -455,7 +453,7 @@ ZEND_API const char *zend_get_executed_filename(TSRMLS_D) /* {{{ */
}
/* }}} */
ZEND_API uint zend_get_executed_lineno(TSRMLS_D) /* {{{ */
ZEND_API uint zend_get_executed_lineno(void) /* {{{ */
{
zend_execute_data *ex = EG(current_execute_data);
@ -474,7 +472,7 @@ ZEND_API uint zend_get_executed_lineno(TSRMLS_D) /* {{{ */
}
/* }}} */
ZEND_API zend_bool zend_is_executing(TSRMLS_D) /* {{{ */
ZEND_API zend_bool zend_is_executing(void) /* {{{ */
{
return EG(current_execute_data) != 0;
}
@ -482,8 +480,7 @@ ZEND_API zend_bool zend_is_executing(TSRMLS_D) /* {{{ */
ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC) /* {{{ */
{
TSRMLS_FETCH();
i_zval_ptr_dtor(zval_ptr ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
i_zval_ptr_dtor(zval_ptr ZEND_FILE_LINE_RELAY_CC);
}
/* }}} */
@ -502,7 +499,7 @@ ZEND_API void _zval_internal_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC) /* {{{ *
#define IS_CONSTANT_VISITED(p) (Z_TYPE_P(p) & IS_VISITED_CONSTANT)
#define MARK_CONSTANT_VISITED(p) Z_TYPE_INFO_P(p) |= IS_VISITED_CONSTANT
ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_class_entry *scope TSRMLS_DC) /* {{{ */
ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_class_entry *scope) /* {{{ */
{
zval *const_value;
char *colon;
@ -515,7 +512,7 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
SEPARATE_ZVAL_NOREF(p);
MARK_CONSTANT_VISITED(p);
refcount = Z_REFCOUNTED_P(p) ? Z_REFCOUNT_P(p) : 1;
const_value = zend_get_constant_ex(Z_STR_P(p), scope, Z_CONST_FLAGS_P(p) TSRMLS_CC);
const_value = zend_get_constant_ex(Z_STR_P(p), scope, Z_CONST_FLAGS_P(p));
if (!const_value) {
char *actual = Z_STRVAL_P(p);
@ -582,7 +579,7 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
}
ZVAL_COPY_VALUE(p, const_value);
if (Z_OPT_CONSTANT_P(p)) {
zval_update_constant_ex(p, 1, NULL TSRMLS_CC);
zval_update_constant_ex(p, 1, NULL);
}
zval_opt_copy_ctor(p);
}
@ -592,7 +589,7 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
zval tmp;
SEPARATE_ZVAL_NOREF(p);
zend_ast_evaluate(&tmp, Z_ASTVAL_P(p), scope TSRMLS_CC);
zend_ast_evaluate(&tmp, Z_ASTVAL_P(p), scope);
if (inline_change) {
zend_ast_destroy_and_free(Z_ASTVAL_P(p));
efree_size(Z_AST_P(p), sizeof(zend_ast_ref));
@ -603,31 +600,31 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
}
/* }}} */
ZEND_API int zval_update_constant_inline_change(zval *pp, zend_class_entry *scope TSRMLS_DC) /* {{{ */
ZEND_API int zval_update_constant_inline_change(zval *pp, zend_class_entry *scope) /* {{{ */
{
return zval_update_constant_ex(pp, 1, scope TSRMLS_CC);
return zval_update_constant_ex(pp, 1, scope);
}
/* }}} */
ZEND_API int zval_update_constant_no_inline_change(zval *pp, zend_class_entry *scope TSRMLS_DC) /* {{{ */
ZEND_API int zval_update_constant_no_inline_change(zval *pp, zend_class_entry *scope) /* {{{ */
{
return zval_update_constant_ex(pp, 0, scope TSRMLS_CC);
return zval_update_constant_ex(pp, 0, scope);
}
/* }}} */
ZEND_API int zval_update_constant(zval *pp, zend_bool inline_change TSRMLS_DC) /* {{{ */
ZEND_API int zval_update_constant(zval *pp, zend_bool inline_change) /* {{{ */
{
return zval_update_constant_ex(pp, inline_change, NULL TSRMLS_CC);
return zval_update_constant_ex(pp, inline_change, NULL);
}
/* }}} */
int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[] TSRMLS_DC) /* {{{ */
int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[]) /* {{{ */
{
return call_user_function_ex(function_table, object, function_name, retval_ptr, param_count, params, 1, NULL TSRMLS_CC);
return call_user_function_ex(function_table, object, function_name, retval_ptr, param_count, params, 1, NULL);
}
/* }}} */
int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], int no_separation, zend_array *symbol_table TSRMLS_DC) /* {{{ */
int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], int no_separation, zend_array *symbol_table) /* {{{ */
{
zend_fcall_info fci;
@ -641,11 +638,11 @@ int call_user_function_ex(HashTable *function_table, zval *object, zval *functio
fci.no_separation = (zend_bool) no_separation;
fci.symbol_table = symbol_table;
return zend_call_function(&fci, NULL TSRMLS_CC);
return zend_call_function(&fci, NULL);
}
/* }}} */
int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC) /* {{{ */
int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /* {{{ */
{
uint32_t i;
zend_class_entry *calling_scope = NULL;
@ -703,7 +700,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
fci_cache = &fci_cache_local;
}
if (!zend_is_callable_ex(&fci->function_name, fci->object, IS_CALLABLE_CHECK_SILENT, &callable_name, fci_cache, &error TSRMLS_CC)) {
if (!zend_is_callable_ex(&fci->function_name, fci->object, IS_CALLABLE_CHECK_SILENT, &callable_name, fci_cache, &error)) {
if (error) {
zend_error(E_WARNING, "Invalid callback %s, %s", callable_name->val, error);
efree(error);
@ -728,7 +725,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
func = fci_cache->function_handler;
call = zend_vm_stack_push_call_frame(ZEND_CALL_TOP_FUNCTION,
func, fci->param_count, fci_cache->called_scope, fci_cache->object, NULL TSRMLS_CC);
func, fci->param_count, fci_cache->called_scope, fci_cache->object, NULL);
calling_scope = fci_cache->calling_scope;
fci->object = fci_cache->object;
if (fci->object &&
@ -779,9 +776,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
if (i) {
/* hack to clean up the stack */
ZEND_CALL_NUM_ARGS(call) = i;
zend_vm_stack_free_args(call TSRMLS_CC);
zend_vm_stack_free_args(call);
}
zend_vm_stack_free_call_frame(call TSRMLS_CC);
zend_vm_stack_free_call_frame(call);
zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given",
i+1,
@ -818,7 +815,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
ZVAL_COPY(param, &fci->params[i]);
}
}
ZEND_CALL_NUM_ARGS(call) = fci->param_count;
EG(scope) = calling_scope;
if (func->common.fn_flags & ZEND_ACC_STATIC) {
@ -835,10 +831,10 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
EG(scope) = func->common.scope;
call->symbol_table = fci->symbol_table;
if (EXPECTED((func->op_array.fn_flags & ZEND_ACC_GENERATOR) == 0)) {
zend_init_execute_data(call, &func->op_array, fci->retval TSRMLS_CC);
zend_execute_ex(call TSRMLS_CC);
zend_init_execute_data(call, &func->op_array, fci->retval);
zend_execute_ex(call);
} else {
zend_generator_create_zval(call, &func->op_array, fci->retval TSRMLS_CC);
zend_generator_create_zval(call, &func->op_array, fci->retval);
}
} else if (func->type == ZEND_INTERNAL_FUNCTION) {
int call_via_handler = (func->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0;
@ -851,13 +847,13 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
EG(current_execute_data) = call;
if (EXPECTED(zend_execute_internal == NULL)) {
/* saves one function call if zend_execute_internal is not used */
func->internal_function.handler(call, fci->retval TSRMLS_CC);
func->internal_function.handler(call, fci->retval);
} else {
zend_execute_internal(call, fci->retval TSRMLS_CC);
zend_execute_internal(call, fci->retval);
}
EG(current_execute_data) = call->prev_execute_data;
zend_vm_stack_free_args(call TSRMLS_CC);
zend_vm_stack_free_call_frame(call TSRMLS_CC);
zend_vm_stack_free_args(call);
zend_vm_stack_free_call_frame(call);
/* We shouldn't fix bad extensions here,
because it can break proper ones (Bug #34045)
@ -881,14 +877,14 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
if (fci->object) {
call->prev_execute_data = EG(current_execute_data);
EG(current_execute_data) = call;
fci->object->handlers->call_method(func->common.function_name, fci->object, call, fci->retval TSRMLS_CC);
fci->object->handlers->call_method(func->common.function_name, fci->object, call, fci->retval);
EG(current_execute_data) = call->prev_execute_data;
} else {
zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object");
}
zend_vm_stack_free_args(call TSRMLS_CC);
zend_vm_stack_free_call_frame(call TSRMLS_CC);
zend_vm_stack_free_args(call);
zend_vm_stack_free_call_frame(call);
if (func->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
zend_string_release(func->common.function_name);
@ -911,13 +907,13 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
}
if (EG(exception)) {
zend_throw_exception_internal(NULL TSRMLS_CC);
zend_throw_exception_internal(NULL);
}
return SUCCESS;
}
/* }}} */
ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *key, int use_autoload TSRMLS_DC) /* {{{ */
ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *key, int use_autoload) /* {{{ */
{
zend_class_entry *ce = NULL;
zval args[1];
@ -954,7 +950,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
/* The compiler is not-reentrant. Make sure we __autoload() only during run-time
* (doesn't impact functionality of __autoload()
*/
if (!use_autoload || zend_is_compiling(TSRMLS_C)) {
if (!use_autoload || zend_is_compiling()) {
if (!key) {
zend_string_free(lc_name);
}
@ -1018,9 +1014,9 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
fcall_cache.called_scope = NULL;
fcall_cache.object = NULL;
zend_exception_save(TSRMLS_C);
retval = zend_call_function(&fcall_info, &fcall_cache TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
zend_exception_save();
retval = zend_call_function(&fcall_info, &fcall_cache);
zend_exception_restore();
zval_ptr_dtor(&args[0]);
zval_dtor(&fcall_info.function_name);
@ -1039,13 +1035,13 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
}
/* }}} */
ZEND_API zend_class_entry *zend_lookup_class(zend_string *name TSRMLS_DC) /* {{{ */
ZEND_API zend_class_entry *zend_lookup_class(zend_string *name) /* {{{ */
{
return zend_lookup_class_ex(name, NULL, 1 TSRMLS_CC);
return zend_lookup_class_ex(name, NULL, 1);
}
/* }}} */
ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char *string_name TSRMLS_DC) /* {{{ */
ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char *string_name) /* {{{ */
{
zval pv;
zend_op_array *new_op_array;
@ -1066,7 +1062,7 @@ ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char
original_compiler_options = CG(compiler_options);
CG(compiler_options) = ZEND_COMPILE_DEFAULT_FOR_EVAL;
new_op_array = zend_compile_string(&pv, string_name TSRMLS_CC);
new_op_array = zend_compile_string(&pv, string_name);
CG(compiler_options) = original_compiler_options;
if (new_op_array) {
@ -1076,9 +1072,9 @@ ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char
zend_try {
ZVAL_UNDEF(&local_retval);
zend_execute(new_op_array, &local_retval TSRMLS_CC);
zend_execute(new_op_array, &local_retval);
} zend_catch {
destroy_op_array(new_op_array TSRMLS_CC);
destroy_op_array(new_op_array);
efree_size(new_op_array, sizeof(zend_op_array));
zend_bailout();
} zend_end_try();
@ -1096,7 +1092,7 @@ ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char
}
EG(no_extensions)=0;
destroy_op_array(new_op_array TSRMLS_CC);
destroy_op_array(new_op_array);
efree_size(new_op_array, sizeof(zend_op_array));
retval = SUCCESS;
} else {
@ -1107,34 +1103,33 @@ ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char
}
/* }}} */
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC) /* {{{ */
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name) /* {{{ */
{
return zend_eval_stringl(str, strlen(str), retval_ptr, string_name TSRMLS_CC);
return zend_eval_stringl(str, strlen(str), retval_ptr, string_name);
}
/* }}} */
ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) /* {{{ */
ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, char *string_name, int handle_exceptions) /* {{{ */
{
int result;
result = zend_eval_stringl(str, str_len, retval_ptr, string_name TSRMLS_CC);
result = zend_eval_stringl(str, str_len, retval_ptr, string_name);
if (handle_exceptions && EG(exception)) {
zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
zend_exception_error(EG(exception), E_ERROR);
result = FAILURE;
}
return result;
}
/* }}} */
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) /* {{{ */
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions) /* {{{ */
{
return zend_eval_stringl_ex(str, strlen(str), retval_ptr, string_name, handle_exceptions TSRMLS_CC);
return zend_eval_stringl_ex(str, strlen(str), retval_ptr, string_name, handle_exceptions);
}
/* }}} */
ZEND_API void zend_timeout(int dummy) /* {{{ */
{
TSRMLS_FETCH();
if (zend_on_timeout) {
#ifdef ZEND_SIGNALS
@ -1146,7 +1141,7 @@ ZEND_API void zend_timeout(int dummy) /* {{{ */
*/
SIGG(running) = 0;
#endif
zend_on_timeout(EG(timeout_seconds) TSRMLS_CC);
zend_on_timeout(EG(timeout_seconds));
}
zend_error(E_ERROR, "Maximum execution time of %pd second%s exceeded", EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s");
@ -1176,7 +1171,6 @@ VOID CALLBACK tq_timer_cb(PVOID arg, BOOLEAN timed_out)
void zend_set_timeout(zend_long seconds, int reset_signals) /* {{{ */
{
TSRMLS_FETCH();
EG(timeout_seconds) = seconds;
@ -1228,7 +1222,7 @@ void zend_set_timeout(zend_long seconds, int reset_signals) /* {{{ */
if (reset_signals) {
# ifdef ZEND_SIGNALS
zend_signal(signo, zend_timeout TSRMLS_CC);
zend_signal(signo, zend_timeout);
# else
sigset_t sigset;
@ -1244,7 +1238,7 @@ void zend_set_timeout(zend_long seconds, int reset_signals) /* {{{ */
}
/* }}} */
void zend_unset_timeout(TSRMLS_D) /* {{{ */
void zend_unset_timeout(void) /* {{{ */
{
#ifdef ZEND_WIN32
if (NULL != tq_timer) {
@ -1275,7 +1269,7 @@ void zend_unset_timeout(TSRMLS_D) /* {{{ */
}
/* }}} */
zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type TSRMLS_DC) /* {{{ */
zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type) /* {{{ */
{
zend_class_entry *ce;
int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
@ -1312,7 +1306,7 @@ check_fetch_type:
break;
}
if ((ce = zend_lookup_class_ex(class_name, NULL, use_autoload TSRMLS_CC)) == NULL) {
if ((ce = zend_lookup_class_ex(class_name, NULL, use_autoload)) == NULL) {
if (use_autoload) {
if (!silent && !EG(exception)) {
if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) {
@ -1330,12 +1324,12 @@ check_fetch_type:
}
/* }}} */
zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zval *key, int fetch_type TSRMLS_DC) /* {{{ */
zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zval *key, int fetch_type) /* {{{ */
{
zend_class_entry *ce;
int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
if ((ce = zend_lookup_class_ex(class_name, key, use_autoload TSRMLS_CC)) == NULL) {
if ((ce = zend_lookup_class_ex(class_name, key, use_autoload)) == NULL) {
if (use_autoload) {
if ((fetch_type & ZEND_FETCH_CLASS_SILENT) == 0 && !EG(exception)) {
if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_INTERFACE) {
@ -1367,7 +1361,7 @@ typedef struct _zend_abstract_info {
int ctor;
} zend_abstract_info;
static void zend_verify_abstract_class_function(zend_function *fn, zend_abstract_info *ai TSRMLS_DC) /* {{{ */
static void zend_verify_abstract_class_function(zend_function *fn, zend_abstract_info *ai) /* {{{ */
{
if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
if (ai->cnt < MAX_ABSTRACT_INFO_CNT) {
@ -1387,7 +1381,7 @@ static void zend_verify_abstract_class_function(zend_function *fn, zend_abstract
}
/* }}} */
void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC) /* {{{ */
void zend_verify_abstract_class(zend_class_entry *ce) /* {{{ */
{
zend_function *func;
zend_abstract_info ai;
@ -1396,7 +1390,7 @@ void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC) /* {{{ */
memset(&ai, 0, sizeof(ai));
ZEND_HASH_FOREACH_PTR(&ce->function_table, func) {
zend_verify_abstract_class_function(func, &ai TSRMLS_CC);
zend_verify_abstract_class_function(func, &ai);
} ZEND_HASH_FOREACH_END();
if (ai.cnt) {
@ -1412,13 +1406,13 @@ void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC) /* {{{ */
}
/* }}} */
ZEND_API int zend_delete_global_variable(zend_string *name TSRMLS_DC) /* {{{ */
ZEND_API int zend_delete_global_variable(zend_string *name) /* {{{ */
{
return zend_hash_del_ind(&EG(symbol_table).ht, name);
}
/* }}} */
ZEND_API zend_array *zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */
ZEND_API zend_array *zend_rebuild_symbol_table(void) /* {{{ */
{
int i;
zend_execute_data *ex;
@ -1471,17 +1465,14 @@ ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data) /* {{{ *
if (zv) {
if (Z_TYPE_P(zv) == IS_INDIRECT) {
zval *val = Z_INDIRECT_P(zv);
if (Z_TYPE_P(val) == IS_UNDEF) {
ZVAL_UNDEF(EX_VAR_NUM(i));
} else {
ZVAL_COPY_VALUE(EX_VAR_NUM(i), val);
}
ZVAL_COPY_VALUE(EX_VAR_NUM(i), val);
} else {
ZVAL_COPY_VALUE(EX_VAR_NUM(i), zv);
}
} else {
ZVAL_UNDEF(EX_VAR_NUM(i));
zv = zend_hash_update(ht, op_array->vars[i], EX_VAR_NUM(i));
zv = zend_hash_add_new(ht, op_array->vars[i], EX_VAR_NUM(i));
}
ZVAL_INDIRECT(zv, EX_VAR_NUM(i));
}
@ -1506,7 +1497,7 @@ ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data) /* {{{ *
}
/* }}} */
ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS_DC) /* {{{ */
ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force) /* {{{ */
{
zend_execute_data *execute_data = EG(current_execute_data);
@ -1529,7 +1520,7 @@ ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS
}
}
if (force) {
zend_array *symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
zend_array *symbol_table = zend_rebuild_symbol_table();
if (symbol_table) {
return zend_hash_update(&symbol_table->ht, name, value) ? SUCCESS : FAILURE;;
}
@ -1542,7 +1533,7 @@ ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS
}
/* }}} */
ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, int force TSRMLS_DC) /* {{{ */
ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, int force) /* {{{ */
{
zend_execute_data *execute_data = EG(current_execute_data);
@ -1567,7 +1558,7 @@ ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, i
}
if (force) {
zend_array *symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
zend_array *symbol_table = zend_rebuild_symbol_table();
if (symbol_table) {
return zend_hash_str_update(&symbol_table->ht, name, len, value) ? SUCCESS : FAILURE;;
}

View file

@ -24,7 +24,7 @@
ZEND_API zend_llist zend_extensions;
static int last_resource_number;
int zend_load_extension(const char *path TSRMLS_DC)
int zend_load_extension(const char *path)
{
#if ZEND_EXTENSIONS_SUPPORT
DL_HANDLE handle;
@ -115,7 +115,7 @@ int zend_load_extension(const char *path TSRMLS_DC)
return FAILURE;
}
return zend_register_extension(new_extension, handle TSRMLS_CC);
return zend_register_extension(new_extension, handle);
#else
fprintf(stderr, "Extensions are not supported on this platform.\n");
/* See http://support.microsoft.com/kb/190351 */
@ -127,7 +127,7 @@ int zend_load_extension(const char *path TSRMLS_DC)
}
int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle TSRMLS_DC)
int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle)
{
#if ZEND_EXTENSIONS_SUPPORT
zend_extension extension;
@ -135,7 +135,7 @@ int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle TSRM
extension = *new_extension;
extension.handle = handle;
zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension TSRMLS_CC);
zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension);
zend_llist_add_element(&zend_extensions, &extension);
@ -146,7 +146,7 @@ int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle TSRM
}
static void zend_extension_shutdown(zend_extension *extension TSRMLS_DC)
static void zend_extension_shutdown(zend_extension *extension)
{
#if ZEND_EXTENSIONS_SUPPORT
if (extension->shutdown) {
@ -185,9 +185,9 @@ int zend_startup_extensions()
}
void zend_shutdown_extensions(TSRMLS_D)
void zend_shutdown_extensions(void)
{
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_shutdown TSRMLS_CC);
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_shutdown);
zend_llist_destroy(&zend_extensions);
}
@ -202,7 +202,7 @@ void zend_extension_dtor(zend_extension *extension)
}
static void zend_extension_message_dispatcher(const zend_extension *extension, int num_args, va_list args TSRMLS_DC)
static void zend_extension_message_dispatcher(const zend_extension *extension, int num_args, va_list args)
{
int message;
void *arg;
@ -216,9 +216,9 @@ static void zend_extension_message_dispatcher(const zend_extension *extension, i
}
ZEND_API void zend_extension_dispatch_message(int message, void *arg TSRMLS_DC)
ZEND_API void zend_extension_dispatch_message(int message, void *arg)
{
zend_llist_apply_with_arguments(&zend_extensions, (llist_apply_with_args_func_t) zend_extension_message_dispatcher TSRMLS_CC, 2, message, arg);
zend_llist_apply_with_arguments(&zend_extensions, (llist_apply_with_args_func_t) zend_extension_message_dispatcher, 2, message, arg);
}

View file

@ -94,7 +94,7 @@ struct _zend_extension {
BEGIN_EXTERN_C()
ZEND_API int zend_get_resource_handle(zend_extension *extension);
ZEND_API void zend_extension_dispatch_message(int message, void *arg TSRMLS_DC);
ZEND_API void zend_extension_dispatch_message(int message, void *arg);
END_EXTERN_C()
#define ZEND_EXTMSG_NEW_EXTENSION 1
@ -114,11 +114,11 @@ void zend_extension_dtor(zend_extension *extension);
ZEND_API void zend_append_version_info(const zend_extension *extension);
int zend_startup_extensions_mechanism(void);
int zend_startup_extensions(void);
void zend_shutdown_extensions(TSRMLS_D);
void zend_shutdown_extensions(void);
BEGIN_EXTERN_C()
ZEND_API int zend_load_extension(const char *path TSRMLS_DC);
ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle TSRMLS_DC);
ZEND_API int zend_load_extension(const char *path);
ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle);
ZEND_API zend_extension *zend_get_extension(const char *extension_name);
END_EXTERN_C()

View file

@ -22,7 +22,7 @@
#include "zend_compile.h"
#include "zend_float.h"
ZEND_API void zend_init_fpu(TSRMLS_D) /* {{{ */
ZEND_API void zend_init_fpu(void) /* {{{ */
{
#if XPFPA_HAVE_CW
XPFPA_DECLARE
@ -38,7 +38,7 @@ ZEND_API void zend_init_fpu(TSRMLS_D) /* {{{ */
}
/* }}} */
ZEND_API void zend_shutdown_fpu(TSRMLS_D) /* {{{ */
ZEND_API void zend_shutdown_fpu(void) /* {{{ */
{
#if XPFPA_HAVE_CW
if (EG(saved_fpu_cw_ptr)) {
@ -49,7 +49,7 @@ ZEND_API void zend_shutdown_fpu(TSRMLS_D) /* {{{ */
}
/* }}} */
ZEND_API void zend_ensure_fpu_mode(TSRMLS_D) /* {{{ */
ZEND_API void zend_ensure_fpu_mode(void) /* {{{ */
{
XPFPA_DECLARE

View file

@ -26,9 +26,9 @@ BEGIN_EXTERN_C()
/*
Define functions for FP initialization and de-initialization.
*/
extern ZEND_API void zend_init_fpu(TSRMLS_D);
extern ZEND_API void zend_shutdown_fpu(TSRMLS_D);
extern ZEND_API void zend_ensure_fpu_mode(TSRMLS_D);
extern ZEND_API void zend_init_fpu(void);
extern ZEND_API void zend_shutdown_fpu(void);
extern ZEND_API void zend_ensure_fpu_mode(void);
END_EXTERN_C()

View file

@ -32,9 +32,9 @@ ZEND_API zend_gc_globals gc_globals;
#endif
#define GC_REMOVE_FROM_ROOTS(current) \
gc_remove_from_roots((current) TSRMLS_CC)
gc_remove_from_roots((current))
static zend_always_inline void gc_remove_from_roots(gc_root_buffer *root TSRMLS_DC)
static zend_always_inline void gc_remove_from_roots(gc_root_buffer *root)
{
root->next->prev = root->prev;
root->prev->next = root->next;
@ -43,7 +43,7 @@ static zend_always_inline void gc_remove_from_roots(gc_root_buffer *root TSRMLS_
GC_BENCH_DEC(root_buf_length);
}
static void root_buffer_dtor(zend_gc_globals *gc_globals TSRMLS_DC)
static void root_buffer_dtor(zend_gc_globals *gc_globals)
{
if (gc_globals->buf) {
free(gc_globals->buf);
@ -51,7 +51,7 @@ static void root_buffer_dtor(zend_gc_globals *gc_globals TSRMLS_DC)
}
}
static void gc_globals_ctor_ex(zend_gc_globals *gc_globals TSRMLS_DC)
static void gc_globals_ctor_ex(zend_gc_globals *gc_globals)
{
gc_globals->gc_enabled = 0;
gc_globals->gc_active = 0;
@ -79,7 +79,7 @@ static void gc_globals_ctor_ex(zend_gc_globals *gc_globals TSRMLS_DC)
#endif
}
ZEND_API void gc_globals_ctor(TSRMLS_D)
ZEND_API void gc_globals_ctor(void)
{
#ifdef ZTS
ts_allocate_id(&gc_globals_id, sizeof(zend_gc_globals), (ts_allocate_ctor) gc_globals_ctor_ex, (ts_allocate_dtor) root_buffer_dtor);
@ -88,14 +88,14 @@ ZEND_API void gc_globals_ctor(TSRMLS_D)
#endif
}
ZEND_API void gc_globals_dtor(TSRMLS_D)
ZEND_API void gc_globals_dtor(void)
{
#ifndef ZTS
root_buffer_dtor(&gc_globals TSRMLS_DC);
root_buffer_dtor(&gc_globals);
#endif
}
ZEND_API void gc_reset(TSRMLS_D)
ZEND_API void gc_reset(void)
{
GC_G(gc_runs) = 0;
GC_G(collected) = 0;
@ -126,16 +126,16 @@ ZEND_API void gc_reset(TSRMLS_D)
}
}
ZEND_API void gc_init(TSRMLS_D)
ZEND_API void gc_init(void)
{
if (GC_G(buf) == NULL && GC_G(gc_enabled)) {
GC_G(buf) = (gc_root_buffer*) malloc(sizeof(gc_root_buffer) * GC_ROOT_BUFFER_MAX_ENTRIES);
GC_G(last_unused) = &GC_G(buf)[GC_ROOT_BUFFER_MAX_ENTRIES];
gc_reset(TSRMLS_C);
gc_reset();
}
}
ZEND_API void gc_possible_root(zend_refcounted *ref TSRMLS_DC)
ZEND_API void gc_possible_root(zend_refcounted *ref)
{
GC_BENCH_INC(zval_possible_root);
@ -156,7 +156,7 @@ ZEND_API void gc_possible_root(zend_refcounted *ref TSRMLS_DC)
return;
}
GC_REFCOUNT(ref)++;
gc_collect_cycles(TSRMLS_C);
gc_collect_cycles();
GC_REFCOUNT(ref)--;
newRoot = GC_G(unused);
if (!newRoot) {
@ -182,7 +182,7 @@ ZEND_API void gc_possible_root(zend_refcounted *ref TSRMLS_DC)
}
}
ZEND_API void gc_remove_from_buffer(zend_refcounted *ref TSRMLS_DC)
ZEND_API void gc_remove_from_buffer(zend_refcounted *ref)
{
gc_root_buffer *root;
@ -197,7 +197,7 @@ ZEND_API void gc_remove_from_buffer(zend_refcounted *ref TSRMLS_DC)
}
}
static void gc_scan_black(zend_refcounted *ref TSRMLS_DC)
static void gc_scan_black(zend_refcounted *ref)
{
HashTable *ht;
uint idx;
@ -219,7 +219,7 @@ tail_call:
HashTable *props;
ZVAL_OBJ(&tmp, obj);
props = get_gc(&tmp, &table, &n TSRMLS_CC);
props = get_gc(&tmp, &table, &n);
while (n > 0 && !Z_REFCOUNTED(table[n-1])) n--;
for (i = 0; i < n; i++) {
if (Z_REFCOUNTED(table[i])) {
@ -231,7 +231,7 @@ tail_call:
if (!props && i == n - 1) {
goto tail_call;
} else {
gc_scan_black(ref TSRMLS_CC);
gc_scan_black(ref);
}
}
}
@ -273,13 +273,13 @@ tail_call:
if (idx == ht->nNumUsed-1) {
goto tail_call;
} else {
gc_scan_black(ref TSRMLS_CC);
gc_scan_black(ref);
}
}
}
}
static void gc_mark_grey(zend_refcounted *ref TSRMLS_DC)
static void gc_mark_grey(zend_refcounted *ref)
{
HashTable *ht;
uint idx;
@ -303,7 +303,7 @@ tail_call:
HashTable *props;
ZVAL_OBJ(&tmp, obj);
props = get_gc(&tmp, &table, &n TSRMLS_CC);
props = get_gc(&tmp, &table, &n);
while (n > 0 && !Z_REFCOUNTED(table[n-1])) n--;
for (i = 0; i < n; i++) {
@ -315,7 +315,7 @@ tail_call:
if (!props && i == n - 1) {
goto tail_call;
} else {
gc_mark_grey(ref TSRMLS_CC);
gc_mark_grey(ref);
}
}
}
@ -355,25 +355,25 @@ tail_call:
if (idx == ht->nNumUsed-1) {
goto tail_call;
} else {
gc_mark_grey(ref TSRMLS_CC);
gc_mark_grey(ref);
}
}
}
}
static void gc_mark_roots(TSRMLS_D)
static void gc_mark_roots(void)
{
gc_root_buffer *current = GC_G(roots).next;
while (current != &GC_G(roots)) {
if (GC_GET_COLOR(GC_INFO(current->ref)) == GC_PURPLE) {
gc_mark_grey(current->ref TSRMLS_CC);
gc_mark_grey(current->ref);
}
current = current->next;
}
}
static void gc_scan(zend_refcounted *ref TSRMLS_DC)
static void gc_scan(zend_refcounted *ref)
{
HashTable *ht;
uint idx;
@ -383,7 +383,7 @@ tail_call:
if (GC_GET_COLOR(GC_INFO(ref)) == GC_GREY) {
ht = NULL;
if (GC_REFCOUNT(ref) > 0) {
gc_scan_black(ref TSRMLS_CC);
gc_scan_black(ref);
} else {
GC_SET_COLOR(GC_INFO(ref), GC_WHITE);
if (GC_TYPE(ref) == IS_OBJECT && EG(objects_store).object_buckets) {
@ -398,7 +398,7 @@ tail_call:
HashTable *props;
ZVAL_OBJ(&tmp, obj);
props = get_gc(&tmp, &table, &n TSRMLS_CC);
props = get_gc(&tmp, &table, &n);
while (n > 0 && !Z_REFCOUNTED(table[n-1])) n--;
for (i = 0; i < n; i++) {
if (Z_REFCOUNTED(table[i])) {
@ -406,7 +406,7 @@ tail_call:
if (!props && i == n - 1) {
goto tail_call;
} else {
gc_scan(ref TSRMLS_CC);
gc_scan(ref);
}
}
}
@ -441,23 +441,23 @@ tail_call:
if (idx == ht->nNumUsed-1) {
goto tail_call;
} else {
gc_scan(ref TSRMLS_CC);
gc_scan(ref);
}
}
}
}
static void gc_scan_roots(TSRMLS_D)
static void gc_scan_roots(void)
{
gc_root_buffer *current = GC_G(roots).next;
while (current != &GC_G(roots)) {
gc_scan(current->ref TSRMLS_CC);
gc_scan(current->ref);
current = current->next;
}
}
static int gc_collect_white(zend_refcounted *ref TSRMLS_DC)
static int gc_collect_white(zend_refcounted *ref)
{
int count = 0;
HashTable *ht;
@ -513,7 +513,7 @@ tail_call:
HashTable *props;
ZVAL_OBJ(&tmp, obj);
props = get_gc(&tmp, &table, &n TSRMLS_CC);
props = get_gc(&tmp, &table, &n);
while (n > 0 && !Z_REFCOUNTED(table[n-1])) {
/* count non-refcounted for compatibility ??? */
if (Z_TYPE(table[n-1]) != IS_UNDEF) {
@ -530,7 +530,7 @@ tail_call:
if (!props && i == n - 1) {
goto tail_call;
} else {
count += gc_collect_white(ref TSRMLS_CC);
count += gc_collect_white(ref);
}
/* count non-refcounted for compatibility ??? */
} else if (Z_TYPE(table[i]) != IS_UNDEF) {
@ -576,14 +576,14 @@ tail_call:
if (idx == ht->nNumUsed-1) {
goto tail_call;
} else {
count += gc_collect_white(ref TSRMLS_CC);
count += gc_collect_white(ref);
}
}
}
return count;
}
static int gc_collect_roots(TSRMLS_D)
static int gc_collect_roots(void)
{
int count = 0;
gc_root_buffer *current = GC_G(roots).next;
@ -601,7 +601,7 @@ static int gc_collect_roots(TSRMLS_D)
while (current != &GC_G(roots)) {
if (GC_GET_COLOR(GC_INFO(current->ref)) == GC_WHITE) {
GC_REFCOUNT(current->ref)++;
count += gc_collect_white(current->ref TSRMLS_CC);
count += gc_collect_white(current->ref);
}
current = current->next;
}
@ -613,7 +613,7 @@ static int gc_collect_roots(TSRMLS_D)
GC_SET_BLACK(GC_INFO(current->ref));
current = current->next;
}
gc_reset(TSRMLS_C);
gc_reset();
return 0;
}
@ -639,7 +639,7 @@ static int gc_collect_roots(TSRMLS_D)
return count;
}
static void gc_remove_nested_data_from_buffer(zend_refcounted *ref TSRMLS_DC)
static void gc_remove_nested_data_from_buffer(zend_refcounted *ref)
{
HashTable *ht = NULL;
uint idx;
@ -661,7 +661,7 @@ tail_call:
HashTable *props;
ZVAL_OBJ(&tmp, obj);
props = get_gc(&tmp, &table, &n TSRMLS_CC);
props = get_gc(&tmp, &table, &n);
while (n > 0 && !Z_REFCOUNTED(table[n-1])) n--;
for (i = 0; i < n; i++) {
@ -670,7 +670,7 @@ tail_call:
if (!props && i == n - 1) {
goto tail_call;
} else {
gc_remove_nested_data_from_buffer(ref TSRMLS_CC);
gc_remove_nested_data_from_buffer(ref);
}
}
}
@ -700,13 +700,13 @@ tail_call:
if (idx == ht->nNumUsed-1) {
goto tail_call;
} else {
gc_remove_nested_data_from_buffer(ref TSRMLS_CC);
gc_remove_nested_data_from_buffer(ref);
}
}
}
}
ZEND_API int gc_collect_cycles(TSRMLS_D)
ZEND_API int gc_collect_cycles(void)
{
int count = 0;
@ -720,9 +720,9 @@ ZEND_API int gc_collect_cycles(TSRMLS_D)
}
GC_G(gc_runs)++;
GC_G(gc_active) = 1;
gc_mark_roots(TSRMLS_C);
gc_scan_roots(TSRMLS_C);
count = gc_collect_roots(TSRMLS_C);
gc_mark_roots();
gc_scan_roots();
count = gc_collect_roots();
GC_G(gc_active) = 0;
if (GC_G(to_free).next == &GC_G(to_free)) {
@ -764,7 +764,7 @@ ZEND_API int gc_collect_cycles(TSRMLS_D)
GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED;
if (obj->handlers->dtor_obj) {
GC_REFCOUNT(obj)++;
obj->handlers->dtor_obj(obj TSRMLS_CC);
obj->handlers->dtor_obj(obj);
GC_REFCOUNT(obj)--;
}
}
@ -777,7 +777,7 @@ ZEND_API int gc_collect_cycles(TSRMLS_D)
while (current != &to_free) {
GC_G(next_to_free) = current->next;
if (GC_REFCOUNT(current->ref) > current->refcount) {
gc_remove_nested_data_from_buffer(current->ref TSRMLS_CC);
gc_remove_nested_data_from_buffer(current->ref);
}
current = GC_G(next_to_free);
}
@ -797,7 +797,7 @@ ZEND_API int gc_collect_cycles(TSRMLS_D)
GC_FLAGS(obj) |= IS_OBJ_FREE_CALLED;
if (obj->handlers->free_obj) {
GC_REFCOUNT(obj)++;
obj->handlers->free_obj(obj TSRMLS_CC);
obj->handlers->free_obj(obj);
GC_REFCOUNT(obj)--;
}
}
@ -821,7 +821,7 @@ ZEND_API int gc_collect_cycles(TSRMLS_D)
if (EG(objects_store).object_buckets &&
IS_OBJ_VALID(EG(objects_store).object_buckets[obj->handle])) {
zend_objects_store_free(obj TSRMLS_CC);
zend_objects_store_free(obj);
}
} else {
GC_REMOVE_FROM_BUFFER(p);

View file

@ -112,37 +112,37 @@ typedef struct _zend_gc_globals {
BEGIN_EXTERN_C()
ZEND_API extern int gc_globals_id;
END_EXTERN_C()
#define GC_G(v) TSRMG(gc_globals_id, zend_gc_globals *, v)
#define GC_G(v) ZEND_TSRMG(gc_globals_id, zend_gc_globals *, v)
#else
#define GC_G(v) (gc_globals.v)
extern ZEND_API zend_gc_globals gc_globals;
#endif
BEGIN_EXTERN_C()
ZEND_API int gc_collect_cycles(TSRMLS_D);
ZEND_API void gc_possible_root(zend_refcounted *ref TSRMLS_DC);
ZEND_API void gc_remove_from_buffer(zend_refcounted *ref TSRMLS_DC);
ZEND_API void gc_globals_ctor(TSRMLS_D);
ZEND_API void gc_globals_dtor(TSRMLS_D);
ZEND_API void gc_init(TSRMLS_D);
ZEND_API void gc_reset(TSRMLS_D);
ZEND_API int gc_collect_cycles(void);
ZEND_API void gc_possible_root(zend_refcounted *ref);
ZEND_API void gc_remove_from_buffer(zend_refcounted *ref);
ZEND_API void gc_globals_ctor(void);
ZEND_API void gc_globals_dtor(void);
ZEND_API void gc_init(void);
ZEND_API void gc_reset(void);
END_EXTERN_C()
#define GC_ZVAL_CHECK_POSSIBLE_ROOT(z) \
gc_check_possible_root((z) TSRMLS_CC)
gc_check_possible_root((z))
#define GC_REMOVE_FROM_BUFFER(p) do { \
zend_refcounted *_p = (zend_refcounted*)(p); \
if (GC_ADDRESS(GC_INFO(_p))) { \
gc_remove_from_buffer(_p TSRMLS_CC); \
gc_remove_from_buffer(_p); \
} \
} while (0)
static zend_always_inline void gc_check_possible_root(zval *z TSRMLS_DC)
static zend_always_inline void gc_check_possible_root(zval *z)
{
ZVAL_DEREF(z);
if (Z_COLLECTABLE_P(z) && UNEXPECTED(!Z_GC_INFO_P(z))) {
gc_possible_root(Z_COUNTED_P(z) TSRMLS_CC);
gc_possible_root(Z_COUNTED_P(z));
}
}

View file

@ -27,9 +27,9 @@
ZEND_API zend_class_entry *zend_ce_generator;
static zend_object_handlers zend_generator_handlers;
static zend_object *zend_generator_create(zend_class_entry *class_type TSRMLS_DC);
static zend_object *zend_generator_create(zend_class_entry *class_type);
static void zend_generator_cleanup_unfinished_execution(zend_generator *generator TSRMLS_DC) /* {{{ */
static void zend_generator_cleanup_unfinished_execution(zend_generator *generator) /* {{{ */
{
zend_execute_data *execute_data = generator->execute_data;
zend_op_array *op_array = &execute_data->func->op_array;
@ -76,7 +76,7 @@ static void zend_generator_cleanup_unfinished_execution(zend_generator *generato
}
/* }}} */
ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished_execution TSRMLS_DC) /* {{{ */
ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished_execution) /* {{{ */
{
if (Z_TYPE(generator->value) != IS_UNDEF) {
zval_ptr_dtor(&generator->value);
@ -93,9 +93,9 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
zend_op_array *op_array = &execute_data->func->op_array;
if (!execute_data->symbol_table) {
zend_free_compiled_variables(execute_data TSRMLS_CC);
zend_free_compiled_variables(execute_data);
} else {
zend_clean_and_cache_symbol_table(execute_data->symbol_table TSRMLS_CC);
zend_clean_and_cache_symbol_table(execute_data->symbol_table);
}
if (Z_OBJ(execute_data->This)) {
@ -109,17 +109,17 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
return;
}
zend_vm_stack_free_extra_args(generator->execute_data TSRMLS_CC);
zend_vm_stack_free_extra_args(generator->execute_data);
/* Some cleanups are only necessary if the generator was closued
* before it could finish execution (reach a return statement). */
if (!finished_execution) {
zend_generator_cleanup_unfinished_execution(generator TSRMLS_CC);
zend_generator_cleanup_unfinished_execution(generator);
}
/* Free a clone of closure */
if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
destroy_op_array(op_array TSRMLS_CC);
destroy_op_array(op_array);
efree_size(op_array, sizeof(zend_op_array));
}
@ -129,7 +129,7 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
}
/* }}} */
static void zend_generator_dtor_storage(zend_object *object TSRMLS_DC) /* {{{ */
static void zend_generator_dtor_storage(zend_object *object) /* {{{ */
{
zend_generator *generator = (zend_generator*) object;
zend_execute_data *ex = generator->execute_data;
@ -169,26 +169,26 @@ static void zend_generator_dtor_storage(zend_object *object TSRMLS_DC) /* {{{ */
fast_call->u2.lineno = (uint32_t)-1;
ex->opline = &ex->func->op_array.opcodes[finally_op_num];
generator->flags |= ZEND_GENERATOR_FORCED_CLOSE;
zend_generator_resume(generator TSRMLS_CC);
zend_generator_resume(generator);
}
}
/* }}} */
static void zend_generator_free_storage(zend_object *object TSRMLS_DC) /* {{{ */
static void zend_generator_free_storage(zend_object *object) /* {{{ */
{
zend_generator *generator = (zend_generator*) object;
zend_generator_close(generator, 0 TSRMLS_CC);
zend_generator_close(generator, 0);
zend_object_std_dtor(&generator->std TSRMLS_CC);
zend_object_std_dtor(&generator->std);
if (generator->iterator) {
zend_iterator_dtor(generator->iterator TSRMLS_CC);
zend_iterator_dtor(generator->iterator);
}
}
/* }}} */
static zend_object *zend_generator_create(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
static zend_object *zend_generator_create(zend_class_entry *class_type) /* {{{ */
{
zend_generator *generator;
@ -198,14 +198,14 @@ static zend_object *zend_generator_create(zend_class_entry *class_type TSRMLS_DC
/* The key will be incremented on first use, so it'll start at 0 */
generator->largest_used_integer_key = -1;
zend_object_std_init(&generator->std, class_type TSRMLS_CC);
zend_object_std_init(&generator->std, class_type);
generator->std.handlers = &zend_generator_handlers;
return (zend_object*)generator;
}
/* }}} */
static int copy_closure_static_var(zval *var TSRMLS_DC, int num_args, va_list args, zend_hash_key *key) /* {{{ */
static int copy_closure_static_var(zval *var, int num_args, va_list args, zend_hash_key *key) /* {{{ */
{
HashTable *target = va_arg(args, HashTable *);
@ -217,7 +217,7 @@ static int copy_closure_static_var(zval *var TSRMLS_DC, int num_args, va_list ar
/* }}} */
/* Requires globals EG(scope), EG(This) and EG(current_execute_data). */
ZEND_API void zend_generator_create_zval(zend_execute_data *call, zend_op_array *op_array, zval *return_value TSRMLS_DC) /* {{{ */
ZEND_API void zend_generator_create_zval(zend_execute_data *call, zend_op_array *op_array, zval *return_value) /* {{{ */
{
zend_generator *generator;
zend_execute_data *current_execute_data;
@ -240,7 +240,7 @@ ZEND_API void zend_generator_create_zval(zend_execute_data *call, zend_op_array
NULL, ZVAL_PTR_DTOR, 0
);
zend_hash_apply_with_arguments(
op_array->static_variables TSRMLS_CC,
op_array->static_variables,
copy_closure_static_var, 1,
op_array_copy->static_variables
);
@ -252,7 +252,7 @@ ZEND_API void zend_generator_create_zval(zend_execute_data *call, zend_op_array
/* Create new execution context. We have to back up and restore
* EG(current_execute_data) here. */
current_execute_data = EG(current_execute_data);
execute_data = zend_create_generator_execute_data(call, op_array, return_value TSRMLS_CC);
execute_data = zend_create_generator_execute_data(call, op_array, return_value);
EG(current_execute_data) = current_execute_data;
object_init_ex(return_value, zend_ce_generator);
@ -276,7 +276,7 @@ ZEND_API void zend_generator_create_zval(zend_execute_data *call, zend_op_array
}
/* }}} */
static zend_function *zend_generator_get_constructor(zend_object *object TSRMLS_DC) /* {{{ */
static zend_function *zend_generator_get_constructor(zend_object *object) /* {{{ */
{
zend_error(E_RECOVERABLE_ERROR, "The \"Generator\" class is reserved for internal use and cannot be manually instantiated");
@ -284,7 +284,7 @@ static zend_function *zend_generator_get_constructor(zend_object *object TSRMLS_
}
/* }}} */
ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */
ZEND_API void zend_generator_resume(zend_generator *generator) /* {{{ */
{
/* The generator is already closed, thus can't resume */
if (!generator->execute_data) {
@ -320,7 +320,7 @@ ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{
/* Resume execution */
generator->flags |= ZEND_GENERATOR_CURRENTLY_RUNNING;
zend_execute_ex(generator->execute_data TSRMLS_CC);
zend_execute_ex(generator->execute_data);
generator->flags &= ~ZEND_GENERATOR_CURRENTLY_RUNNING;
/* Unlink generator call_frame from the caller */
@ -338,27 +338,27 @@ ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{
/* If an exception was thrown in the generator we have to internally
* rethrow it in the parent scope. */
if (UNEXPECTED(EG(exception) != NULL)) {
zend_throw_exception_internal(NULL TSRMLS_CC);
zend_throw_exception_internal(NULL);
}
}
}
/* }}} */
static void zend_generator_ensure_initialized(zend_generator *generator TSRMLS_DC) /* {{{ */
static void zend_generator_ensure_initialized(zend_generator *generator) /* {{{ */
{
if (generator->execute_data && Z_TYPE(generator->value) == IS_UNDEF) {
zend_generator_resume(generator TSRMLS_CC);
zend_generator_resume(generator);
generator->flags |= ZEND_GENERATOR_AT_FIRST_YIELD;
}
}
/* }}} */
static void zend_generator_rewind(zend_generator *generator TSRMLS_DC) /* {{{ */
static void zend_generator_rewind(zend_generator *generator) /* {{{ */
{
zend_generator_ensure_initialized(generator TSRMLS_CC);
zend_generator_ensure_initialized(generator);
if (!(generator->flags & ZEND_GENERATOR_AT_FIRST_YIELD)) {
zend_throw_exception(NULL, "Cannot rewind a generator that was already run", 0 TSRMLS_CC);
zend_throw_exception(NULL, "Cannot rewind a generator that was already run", 0);
}
}
/* }}} */
@ -375,7 +375,7 @@ ZEND_METHOD(Generator, rewind)
generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_rewind(generator TSRMLS_CC);
zend_generator_rewind(generator);
}
/* }}} */
@ -391,7 +391,7 @@ ZEND_METHOD(Generator, valid)
generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_ensure_initialized(generator TSRMLS_CC);
zend_generator_ensure_initialized(generator);
RETURN_BOOL(Z_TYPE(generator->value) != IS_UNDEF);
}
@ -409,7 +409,7 @@ ZEND_METHOD(Generator, current)
generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_ensure_initialized(generator TSRMLS_CC);
zend_generator_ensure_initialized(generator);
if (Z_TYPE(generator->value) != IS_UNDEF) {
RETURN_ZVAL_FAST(&generator->value);
@ -429,7 +429,7 @@ ZEND_METHOD(Generator, key)
generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_ensure_initialized(generator TSRMLS_CC);
zend_generator_ensure_initialized(generator);
if (Z_TYPE(generator->key) != IS_UNDEF) {
RETURN_ZVAL_FAST(&generator->key);
@ -449,9 +449,9 @@ ZEND_METHOD(Generator, next)
generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_ensure_initialized(generator TSRMLS_CC);
zend_generator_ensure_initialized(generator);
zend_generator_resume(generator TSRMLS_CC);
zend_generator_resume(generator);
}
/* }}} */
@ -462,13 +462,13 @@ ZEND_METHOD(Generator, send)
zval *value;
zend_generator *generator;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &value) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &value) == FAILURE) {
return;
}
generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_ensure_initialized(generator TSRMLS_CC);
zend_generator_ensure_initialized(generator);
/* The generator is already closed, thus can't send anything */
if (!generator->execute_data) {
@ -481,7 +481,7 @@ ZEND_METHOD(Generator, send)
ZVAL_COPY(generator->send_target, value);
}
zend_generator_resume(generator TSRMLS_CC);
zend_generator_resume(generator);
if (Z_TYPE(generator->value) != IS_UNDEF) {
RETURN_ZVAL_FAST(&generator->value);
@ -496,7 +496,7 @@ ZEND_METHOD(Generator, throw)
zval *exception, exception_copy;
zend_generator *generator;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &exception) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &exception) == FAILURE) {
return;
}
@ -504,18 +504,18 @@ ZEND_METHOD(Generator, throw)
generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_ensure_initialized(generator TSRMLS_CC);
zend_generator_ensure_initialized(generator);
if (generator->execute_data) {
/* Throw the exception in the context of the generator */
zend_execute_data *current_execute_data = EG(current_execute_data);
EG(current_execute_data) = generator->execute_data;
zend_throw_exception_object(&exception_copy TSRMLS_CC);
zend_throw_exception_object(&exception_copy);
EG(current_execute_data) = current_execute_data;
zend_generator_resume(generator TSRMLS_CC);
zend_generator_resume(generator);
if (Z_TYPE(generator->value) != IS_UNDEF) {
RETURN_ZVAL_FAST(&generator->value);
@ -523,7 +523,7 @@ ZEND_METHOD(Generator, throw)
} else {
/* If the generator is already closed throw the exception in the
* current context */
zend_throw_exception_object(&exception_copy TSRMLS_CC);
zend_throw_exception_object(&exception_copy);
}
}
/* }}} */
@ -540,46 +540,46 @@ ZEND_METHOD(Generator, __wakeup)
return;
}
zend_throw_exception(NULL, "Unserialization of 'Generator' is not allowed", 0 TSRMLS_CC);
zend_throw_exception(NULL, "Unserialization of 'Generator' is not allowed", 0);
}
/* }}} */
/* get_iterator implementation */
static void zend_generator_iterator_dtor(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */
static void zend_generator_iterator_dtor(zend_object_iterator *iterator) /* {{{ */
{
zend_generator *generator = (zend_generator*)Z_OBJ(iterator->data);
generator->iterator = NULL;
zval_ptr_dtor(&iterator->data);
zend_iterator_dtor(iterator TSRMLS_CC);
zend_iterator_dtor(iterator);
}
/* }}} */
static int zend_generator_iterator_valid(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */
static int zend_generator_iterator_valid(zend_object_iterator *iterator) /* {{{ */
{
zend_generator *generator = (zend_generator*)Z_OBJ(iterator->data);
zend_generator_ensure_initialized(generator TSRMLS_CC);
zend_generator_ensure_initialized(generator);
return Z_TYPE(generator->value) != IS_UNDEF ? SUCCESS : FAILURE;
}
/* }}} */
static zval *zend_generator_iterator_get_data(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */
static zval *zend_generator_iterator_get_data(zend_object_iterator *iterator) /* {{{ */
{
zend_generator *generator = (zend_generator*)Z_OBJ(iterator->data);
zend_generator_ensure_initialized(generator TSRMLS_CC);
zend_generator_ensure_initialized(generator);
return &generator->value;
}
/* }}} */
static void zend_generator_iterator_get_key(zend_object_iterator *iterator, zval *key TSRMLS_DC) /* {{{ */
static void zend_generator_iterator_get_key(zend_object_iterator *iterator, zval *key) /* {{{ */
{
zend_generator *generator = (zend_generator*)Z_OBJ(iterator->data);
zend_generator_ensure_initialized(generator TSRMLS_CC);
zend_generator_ensure_initialized(generator);
if (Z_TYPE(generator->key) != IS_UNDEF) {
ZVAL_ZVAL(key, &generator->key, 1, 0);
@ -589,21 +589,21 @@ static void zend_generator_iterator_get_key(zend_object_iterator *iterator, zval
}
/* }}} */
static void zend_generator_iterator_move_forward(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */
static void zend_generator_iterator_move_forward(zend_object_iterator *iterator) /* {{{ */
{
zend_generator *generator = (zend_generator*)Z_OBJ(iterator->data);
zend_generator_ensure_initialized(generator TSRMLS_CC);
zend_generator_ensure_initialized(generator);
zend_generator_resume(generator TSRMLS_CC);
zend_generator_resume(generator);
}
/* }}} */
static void zend_generator_iterator_rewind(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */
static void zend_generator_iterator_rewind(zend_object_iterator *iterator) /* {{{ */
{
zend_generator *generator = (zend_generator*)Z_OBJ(iterator->data);
zend_generator_rewind(generator TSRMLS_CC);
zend_generator_rewind(generator);
}
/* }}} */
@ -616,24 +616,24 @@ static zend_object_iterator_funcs zend_generator_iterator_functions = {
zend_generator_iterator_rewind
};
zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) /* {{{ */
zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *object, int by_ref) /* {{{ */
{
zend_object_iterator *iterator;
zend_generator *generator = (zend_generator*)Z_OBJ_P(object);
if (!generator->execute_data) {
zend_throw_exception(NULL, "Cannot traverse an already closed generator", 0 TSRMLS_CC);
zend_throw_exception(NULL, "Cannot traverse an already closed generator", 0);
return NULL;
}
if (by_ref && !(generator->execute_data->func->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
zend_throw_exception(NULL, "You can only iterate a generator by-reference if it declared that it yields by-reference", 0 TSRMLS_CC);
zend_throw_exception(NULL, "You can only iterate a generator by-reference if it declared that it yields by-reference", 0);
return NULL;
}
iterator = generator->iterator = emalloc(sizeof(zend_object_iterator));
zend_iterator_init(iterator TSRMLS_CC);
zend_iterator_init(iterator);
iterator->funcs = &zend_generator_iterator_functions;
ZVAL_COPY(&iterator->data, object);
@ -665,19 +665,19 @@ static const zend_function_entry generator_functions[] = {
ZEND_FE_END
};
void zend_register_generator_ce(TSRMLS_D) /* {{{ */
void zend_register_generator_ce(void) /* {{{ */
{
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "Generator", generator_functions);
zend_ce_generator = zend_register_internal_class(&ce TSRMLS_CC);
zend_ce_generator = zend_register_internal_class(&ce);
zend_ce_generator->ce_flags |= ZEND_ACC_FINAL;
zend_ce_generator->create_object = zend_generator_create;
zend_ce_generator->serialize = zend_class_serialize_deny;
zend_ce_generator->unserialize = zend_class_unserialize_deny;
/* get_iterator has to be assigned *after* implementing the inferface */
zend_class_implements(zend_ce_generator TSRMLS_CC, 1, zend_ce_iterator);
zend_class_implements(zend_ce_generator, 1, zend_ce_iterator);
zend_ce_generator->get_iterator = zend_generator_get_iterator;
zend_ce_generator->iterator_funcs.funcs = &zend_generator_iterator_functions;

View file

@ -53,10 +53,10 @@ static const zend_uchar ZEND_GENERATOR_CURRENTLY_RUNNING = 0x1;
static const zend_uchar ZEND_GENERATOR_FORCED_CLOSE = 0x2;
static const zend_uchar ZEND_GENERATOR_AT_FIRST_YIELD = 0x4;
void zend_register_generator_ce(TSRMLS_D);
ZEND_API void zend_generator_create_zval(zend_execute_data *call, zend_op_array *op_array, zval *return_value TSRMLS_DC);
ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished_execution TSRMLS_DC);
ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC);
void zend_register_generator_ce(void);
ZEND_API void zend_generator_create_zval(zend_execute_data *call, zend_op_array *op_array, zval *return_value);
ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished_execution);
ZEND_API void zend_generator_resume(zend_generator *generator);
END_EXTERN_C()

View file

@ -31,18 +31,17 @@ BEGIN_EXTERN_C()
/* Compiler */
#ifdef ZTS
# define CG(v) TSRMG(compiler_globals_id, zend_compiler_globals *, v)
int zendparse(void *compiler_globals);
# define CG(v) ZEND_TSRMG(compiler_globals_id, zend_compiler_globals *, v)
#else
# define CG(v) (compiler_globals.v)
extern ZEND_API struct _zend_compiler_globals compiler_globals;
int zendparse(void);
#endif
int zendparse(void);
/* Executor */
#ifdef ZTS
# define EG(v) TSRMG(executor_globals_id, zend_executor_globals *, v)
# define EG(v) ZEND_TSRMG(executor_globals_id, zend_executor_globals *, v)
#else
# define EG(v) (executor_globals.v)
extern ZEND_API zend_executor_globals executor_globals;
@ -50,7 +49,7 @@ extern ZEND_API zend_executor_globals executor_globals;
/* Language Scanner */
#ifdef ZTS
# define LANG_SCNG(v) TSRMG(language_scanner_globals_id, zend_php_scanner_globals *, v)
# define LANG_SCNG(v) ZEND_TSRMG(language_scanner_globals_id, zend_php_scanner_globals *, v)
extern ZEND_API ts_rsrc_id language_scanner_globals_id;
#else
# define LANG_SCNG(v) (language_scanner_globals.v)
@ -60,7 +59,7 @@ extern ZEND_API zend_php_scanner_globals language_scanner_globals;
/* INI Scanner */
#ifdef ZTS
# define INI_SCNG(v) TSRMG(ini_scanner_globals_id, zend_ini_scanner_globals *, v)
# define INI_SCNG(v) ZEND_TSRMG(ini_scanner_globals_id, zend_ini_scanner_globals *, v)
extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
#else
# define INI_SCNG(v) (ini_scanner_globals.v)

View file

@ -265,7 +265,6 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s
uint32_t idx;
Bucket *p;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
IS_CONSISTENT(ht);
@ -419,7 +418,6 @@ static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht,
uint32_t idx;
Bucket *p;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
IS_CONSISTENT(ht);
@ -451,8 +449,8 @@ static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht,
}
} else if (EXPECTED(h < ht->nTableSize)) {
p = ht->arData + h;
} else if (h < ht->nTableSize * 2 &&
ht->nTableSize - ht->nNumOfElements < ht->nTableSize / 2) {
} else if ((h >> 1) < ht->nTableSize &&
(ht->nTableSize >> 1) < ht->nNumOfElements) {
zend_hash_packed_grow(ht);
p = ht->arData + h;
} else {
@ -568,7 +566,6 @@ ZEND_API zval *_zend_hash_next_index_insert_new(HashTable *ht, zval *pData ZEND_
static void zend_hash_do_resize(HashTable *ht)
{
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
IS_CONSISTENT(ht);
@ -689,7 +686,6 @@ ZEND_API int zend_hash_del(HashTable *ht, zend_string *key)
Bucket *p;
Bucket *prev = NULL;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
IS_CONSISTENT(ht);
@ -728,7 +724,6 @@ ZEND_API int zend_hash_del_ind(HashTable *ht, zend_string *key)
Bucket *p;
Bucket *prev = NULL;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
IS_CONSISTENT(ht);
@ -780,7 +775,6 @@ ZEND_API int zend_hash_str_del(HashTable *ht, const char *str, size_t len)
Bucket *p;
Bucket *prev = NULL;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
IS_CONSISTENT(ht);
@ -831,7 +825,6 @@ ZEND_API int zend_hash_str_del_ind(HashTable *ht, const char *str, size_t len)
Bucket *p;
Bucket *prev = NULL;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
IS_CONSISTENT(ht);
@ -864,7 +857,6 @@ ZEND_API int zend_hash_index_del(HashTable *ht, zend_ulong h)
Bucket *p;
Bucket *prev = NULL;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
IS_CONSISTENT(ht);
@ -945,7 +937,7 @@ ZEND_API void zend_hash_destroy(HashTable *ht)
pefree(ht->arData, ht->u.flags & HASH_FLAG_PERSISTENT);
}
ZEND_API void zend_array_destroy(HashTable *ht TSRMLS_DC)
ZEND_API void zend_array_destroy(HashTable *ht)
{
Bucket *p, *end;
@ -966,13 +958,13 @@ ZEND_API void zend_array_destroy(HashTable *ht TSRMLS_DC)
if (ht->u.flags & HASH_FLAG_PACKED) {
do {
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC TSRMLS_CC);
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC);
}
} while (++p != end);
} else {
do {
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC TSRMLS_CC);
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC);
if (EXPECTED(p->key)) {
zend_string_release(p->key);
}
@ -1036,7 +1028,7 @@ ZEND_API void zend_hash_clean(HashTable *ht)
}
}
ZEND_API void zend_symtable_clean(HashTable *ht TSRMLS_DC)
ZEND_API void zend_symtable_clean(HashTable *ht)
{
Bucket *p, *end;
@ -1047,7 +1039,7 @@ ZEND_API void zend_symtable_clean(HashTable *ht TSRMLS_DC)
end = p + ht->nNumUsed;
do {
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC TSRMLS_CC);
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC);
if (EXPECTED(p->key)) {
zend_string_release(p->key);
}
@ -1073,7 +1065,6 @@ ZEND_API void zend_symtable_clean(HashTable *ht TSRMLS_DC)
static void zend_hash_apply_deleter(HashTable *ht, uint32_t idx, Bucket *p)
{
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
HANDLE_BLOCK_INTERRUPTIONS();
@ -1132,7 +1123,7 @@ ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht)
* ZEND_HASH_APPLY_REMOVE - delete the element, combineable with the former
*/
ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func)
{
uint32_t idx;
Bucket *p;
@ -1145,7 +1136,7 @@ ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
p = ht->arData + idx;
if (Z_TYPE(p->val) == IS_UNDEF) continue;
result = apply_func(&p->val TSRMLS_CC);
result = apply_func(&p->val);
if (result & ZEND_HASH_APPLY_REMOVE) {
zend_hash_apply_deleter(ht, idx, p);
@ -1158,7 +1149,7 @@ ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
}
ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC)
ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument)
{
uint32_t idx;
Bucket *p;
@ -1171,7 +1162,7 @@ ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t appl
p = ht->arData + idx;
if (Z_TYPE(p->val) == IS_UNDEF) continue;
result = apply_func(&p->val, argument TSRMLS_CC);
result = apply_func(&p->val, argument);
if (result & ZEND_HASH_APPLY_REMOVE) {
zend_hash_apply_deleter(ht, idx, p);
@ -1184,7 +1175,7 @@ ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t appl
}
ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func_args_t apply_func, int num_args, ...)
ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t apply_func, int num_args, ...)
{
uint32_t idx;
Bucket *p;
@ -1203,7 +1194,7 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func
hash_key.h = p->h;
hash_key.key = p->key;
result = apply_func(&p->val TSRMLS_CC, num_args, args, &hash_key);
result = apply_func(&p->val, num_args, args, &hash_key);
if (result & ZEND_HASH_APPLY_REMOVE) {
zend_hash_apply_deleter(ht, idx, p);
@ -1219,7 +1210,7 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func
}
ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func)
{
uint32_t idx;
Bucket *p;
@ -1234,7 +1225,7 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR
p = ht->arData + idx;
if (Z_TYPE(p->val) == IS_UNDEF) continue;
result = apply_func(&p->val TSRMLS_CC);
result = apply_func(&p->val);
if (result & ZEND_HASH_APPLY_REMOVE) {
zend_hash_apply_deleter(ht, idx, p);
@ -1750,7 +1741,7 @@ ZEND_API zval *zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos)
}
ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
compare_func_t compar, zend_bool renumber TSRMLS_DC)
compare_func_t compar, zend_bool renumber)
{
Bucket *p;
uint32_t i, j;
@ -1774,7 +1765,7 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
}
}
(*sort_func)((void *) ht->arData, i, sizeof(Bucket), compar TSRMLS_CC);
(*sort_func)((void *) ht->arData, i, sizeof(Bucket), compar);
HANDLE_BLOCK_INTERRUPTIONS();
ht->nNumUsed = i;
@ -1812,7 +1803,7 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
}
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC)
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered)
{
uint32_t idx1, idx2;
Bucket *p1, *p2 = NULL;
@ -1901,7 +1892,7 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
} else if (Z_TYPE_P(pData2) == IS_UNDEF) {
return 1;
} else {
result = compar(pData1, pData2 TSRMLS_CC);
result = compar(pData1, pData2);
}
if (result != 0) {
HASH_UNPROTECT_RECURSION(ht1);
@ -1919,7 +1910,7 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
}
ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint32_t flag TSRMLS_DC)
ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint32_t flag)
{
uint32_t idx;
Bucket *p, *res;
@ -1944,11 +1935,11 @@ ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint
if (Z_TYPE(p->val) == IS_UNDEF) continue;
if (flag) {
if (compar(res, p TSRMLS_CC) < 0) { /* max */
if (compar(res, p) < 0) { /* max */
res = p;
}
} else {
if (compar(res, p TSRMLS_CC) > 0) { /* min */
if (compar(res, p) > 0) { /* min */
res = p;
}
}

View file

@ -122,15 +122,15 @@ ZEND_API zval *zend_hash_str_add_empty_element(HashTable *ht, const char *key, s
#define ZEND_HASH_APPLY_REMOVE 1<<0
#define ZEND_HASH_APPLY_STOP 1<<1
typedef int (*apply_func_t)(zval *pDest TSRMLS_DC);
typedef int (*apply_func_arg_t)(zval *pDest, void *argument TSRMLS_DC);
typedef int (*apply_func_args_t)(zval *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key);
typedef int (*apply_func_t)(zval *pDest);
typedef int (*apply_func_arg_t)(zval *pDest, void *argument);
typedef int (*apply_func_args_t)(zval *pDest, int num_args, va_list args, zend_hash_key *hash_key);
ZEND_API void zend_hash_graceful_destroy(HashTable *ht);
ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht);
ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC);
ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void * TSRMLS_DC);
ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func_args_t apply_func, int, ...);
ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func);
ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *);
ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t apply_func, int, ...);
/* This function should be used with special care (in other words,
* it should usually not be used). When used with the ZEND_HASH_APPLY_STOP
@ -138,7 +138,7 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func
* Also, it does not provide the same kind of reentrancy protection that
* the standard apply functions do.
*/
ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC);
ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func);
/* Deletes */
@ -200,9 +200,9 @@ typedef struct _HashPointer {
ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor);
ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, zend_bool overwrite ZEND_FILE_LINE_DC);
ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, merge_checker_func_t pMergeSource, void *pParam);
ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, zend_bool renumber TSRMLS_DC);
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC);
ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint32_t flag TSRMLS_DC);
ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, zend_bool renumber);
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered);
ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint32_t flag);
#define zend_hash_merge(target, source, pCopyConstructor, overwrite) \
_zend_hash_merge(target, source, pCopyConstructor, overwrite ZEND_FILE_LINE_CC)
@ -216,8 +216,8 @@ ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint
ZEND_API int zend_hash_rehash(HashTable *ht);
ZEND_API void zend_array_dup(HashTable *target, HashTable *source);
ZEND_API void zend_array_destroy(HashTable *ht TSRMLS_DC);
ZEND_API void zend_symtable_clean(HashTable *ht TSRMLS_DC);
ZEND_API void zend_array_destroy(HashTable *ht);
ZEND_API void zend_symtable_clean(HashTable *ht);
#if ZEND_DEBUG
/* debug */

View file

@ -54,14 +54,14 @@ ZEND_API void zend_html_putc(char c)
}
ZEND_API void zend_html_puts(const char *s, size_t len TSRMLS_DC)
ZEND_API void zend_html_puts(const char *s, size_t len)
{
const unsigned char *ptr = (const unsigned char*)s, *end = ptr + len;
unsigned char *filtered = NULL;
size_t filtered_len;
if (LANG_SCNG(output_filter)) {
LANG_SCNG(output_filter)(&filtered, &filtered_len, ptr, len TSRMLS_CC);
LANG_SCNG(output_filter)(&filtered, &filtered_len, ptr, len);
ptr = filtered;
end = filtered + filtered_len;
}
@ -82,7 +82,7 @@ ZEND_API void zend_html_puts(const char *s, size_t len TSRMLS_DC)
}
ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC)
ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini)
{
zval token;
int token_type;
@ -93,7 +93,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
zend_printf("<span style=\"color: %s\">\n", last_color);
/* highlight stuff coming back from zendlex() */
ZVAL_UNDEF(&token);
while ((token_type=lex_scan(&token TSRMLS_CC))) {
while ((token_type=lex_scan(&token))) {
switch (token_type) {
case T_INLINE_HTML:
next_color = syntax_highlighter_ini->highlight_html;
@ -121,7 +121,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
next_color = syntax_highlighter_ini->highlight_string;
break;
case T_WHITESPACE:
zend_html_puts((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC); /* no color needed */
zend_html_puts((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng)); /* no color needed */
ZVAL_UNDEF(&token);
continue;
break;
@ -144,7 +144,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
}
}
zend_html_puts((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC);
zend_html_puts((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
if (Z_TYPE(token) == IS_STRING) {
switch (token_type) {
@ -170,14 +170,14 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
zend_printf("</code>");
}
ZEND_API void zend_strip(TSRMLS_D)
ZEND_API void zend_strip(void)
{
zval token;
int token_type;
int prev_space = 0;
ZVAL_UNDEF(&token);
while ((token_type=lex_scan(&token TSRMLS_CC))) {
while ((token_type=lex_scan(&token))) {
switch (token_type) {
case T_WHITESPACE:
if (!prev_space) {
@ -193,7 +193,7 @@ ZEND_API void zend_strip(TSRMLS_D)
case T_END_HEREDOC:
zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
/* read the following character, either newline or ; */
if (lex_scan(&token TSRMLS_CC) != T_WHITESPACE) {
if (lex_scan(&token) != T_WHITESPACE) {
zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
}
zend_write("\n", sizeof("\n") - 1);

View file

@ -39,12 +39,12 @@ typedef struct _zend_syntax_highlighter_ini {
BEGIN_EXTERN_C()
ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC);
ZEND_API void zend_strip(TSRMLS_D);
ZEND_API int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC);
ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC);
ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini);
ZEND_API void zend_strip(void);
ZEND_API int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini);
ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name);
ZEND_API void zend_html_putc(char c);
ZEND_API void zend_html_puts(const char *s, size_t len TSRMLS_DC);
ZEND_API void zend_html_puts(const char *s, size_t len);
END_EXTERN_C()
extern zend_syntax_highlighter_ini syntax_highlighter_ini;

View file

@ -47,7 +47,7 @@ static void handle_whitespace(unsigned int *emit_whitespace)
}
ZEND_API void zend_indent(TSRMLS_D)
ZEND_API void zend_indent(void)
{
zval token;
int token_type;
@ -60,7 +60,7 @@ ZEND_API void zend_indent(TSRMLS_D)
/* highlight stuff coming back from zendlex() */
ZVAL_UNDEF(&token);
while ((token_type=lex_scan(&token TSRMLS_CC))) {
while ((token_type=lex_scan(&token))) {
switch (token_type) {
case T_INLINE_HTML:
zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));

View file

@ -23,7 +23,7 @@
#define ZEND_INDENT_H
BEGIN_EXTERN_C()
ZEND_API void zend_indent(TSRMLS_D);
ZEND_API void zend_indent(void);
END_EXTERN_C()
#endif /* ZEND_INDENT_H */

View file

@ -29,7 +29,7 @@ static void ptr_dtor(zval *zv) /* {{{ */
}
/* }}} */
static zend_property_info *zend_duplicate_property_info(zend_property_info *property_info TSRMLS_DC) /* {{{ */
static zend_property_info *zend_duplicate_property_info(zend_property_info *property_info) /* {{{ */
{
zend_property_info* new_property_info;
@ -52,7 +52,7 @@ static zend_property_info *zend_duplicate_property_info_internal(zend_property_i
}
/* }}} */
static void do_inherit_parent_constructor(zend_class_entry *ce TSRMLS_DC) /* {{{ */
static void do_inherit_parent_constructor(zend_class_entry *ce) /* {{{ */
{
zend_function *function, *new_function;
@ -187,7 +187,7 @@ char *zend_visibility_string(uint32_t fn_flags) /* {{{ */
}
/* }}} */
static zend_function *do_inherit_method(zend_function *old_function, zend_class_entry *ce TSRMLS_DC) /* {{{ */
static zend_function *do_inherit_method(zend_function *old_function, zend_class_entry *ce) /* {{{ */
{
zend_function *new_function;
@ -213,7 +213,7 @@ static zend_function *do_inherit_method(zend_function *old_function, zend_class_
}
/* }}} */
static zend_bool zend_do_perform_implementation_check(const zend_function *fe, const zend_function *proto TSRMLS_DC) /* {{{ */
static zend_bool zend_do_perform_implementation_check(const zend_function *fe, const zend_function *proto) /* {{{ */
{
uint32_t i, num_args;
@ -331,8 +331,8 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
strcasecmp(colon+1, proto_class_name->val) != 0) {
zend_class_entry *fe_ce, *proto_ce;
fe_ce = zend_lookup_class(fe_class_name TSRMLS_CC);
proto_ce = zend_lookup_class(proto_class_name TSRMLS_CC);
fe_ce = zend_lookup_class(fe_class_name);
proto_ce = zend_lookup_class(proto_class_name);
/* Check for class alias */
if (!fe_ce || !proto_ce ||
@ -363,7 +363,7 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
}
/* }}} */
static zend_string *zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{{ */
static zend_string *zend_get_function_declaration(zend_function *fptr) /* {{{ */
{
smart_str str = {0};
@ -500,7 +500,7 @@ static zend_string *zend_get_function_declaration(zend_function *fptr TSRMLS_DC)
}
/* }}} */
static void do_inheritance_check_on_method(zend_function *child, zend_function *parent TSRMLS_DC) /* {{{ */
static void do_inheritance_check_on_method(zend_function *child, zend_function *parent) /* {{{ */
{
uint32_t child_flags;
uint32_t parent_flags = parent->common.fn_flags;
@ -559,12 +559,12 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
}
if (child->common.prototype && (child->common.prototype->common.fn_flags & ZEND_ACC_ABSTRACT)) {
if (!zend_do_perform_implementation_check(child, child->common.prototype TSRMLS_CC)) {
zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, zend_get_function_declaration(child->common.prototype TSRMLS_CC)->val);
if (!zend_do_perform_implementation_check(child, child->common.prototype)) {
zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, zend_get_function_declaration(child->common.prototype)->val);
}
} else if (EG(error_reporting) & E_STRICT || Z_TYPE(EG(user_error_handler)) != IS_UNDEF) { /* Check E_STRICT (or custom error handler) before the check so that we save some time */
if (!zend_do_perform_implementation_check(child, parent TSRMLS_CC)) {
zend_string *method_prototype = zend_get_function_declaration(parent TSRMLS_CC);
if (!zend_do_perform_implementation_check(child, parent)) {
zend_string *method_prototype = zend_get_function_declaration(parent);
zend_error(E_STRICT, "Declaration of %s::%s() should be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, method_prototype->val);
zend_string_free(method_prototype);
}
@ -576,7 +576,6 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f
{
uint32_t parent_flags = parent->common.fn_flags;
zend_function *child;
TSRMLS_FETCH();
if ((child = zend_hash_find_ptr(child_function_table, key)) == NULL) {
if (parent_flags & (ZEND_ACC_ABSTRACT)) {
@ -585,13 +584,13 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f
return 1; /* method doesn't exist in child, copy from parent */
}
do_inheritance_check_on_method(child, parent TSRMLS_CC);
do_inheritance_check_on_method(child, parent);
return 0;
}
/* }}} */
static zend_bool do_inherit_property_access_check(zend_property_info *parent_info, zend_string *key, zend_class_entry *ce TSRMLS_DC) /* {{{ */
static zend_bool do_inherit_property_access_check(zend_property_info *parent_info, zend_string *key, zend_class_entry *ce) /* {{{ */
{
zend_property_info *child_info;
zend_class_entry *parent_ce = ce->parent;
@ -603,7 +602,7 @@ static zend_bool do_inherit_property_access_check(zend_property_info *parent_inf
if(ce->type & ZEND_INTERNAL_CLASS) {
child_info = zend_duplicate_property_info_internal(parent_info);
} else {
child_info = zend_duplicate_property_info(parent_info TSRMLS_CC);
child_info = zend_duplicate_property_info(parent_info);
}
zend_hash_update_ptr(&ce->properties_info, key, child_info);
child_info->flags &= ~ZEND_ACC_PRIVATE; /* it's not private anymore */
@ -642,9 +641,9 @@ static zend_bool do_inherit_property_access_check(zend_property_info *parent_inf
}
/* }}} */
static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC) /* {{{ */
static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry *iface) /* {{{ */
{
if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && iface->interface_gets_implemented && iface->interface_gets_implemented(iface, ce TSRMLS_CC) == FAILURE) {
if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && iface->interface_gets_implemented && iface->interface_gets_implemented(iface, ce) == FAILURE) {
zend_error(E_CORE_ERROR, "Class %s could not implement interface %s", ce->name->val, iface->name->val);
}
if (ce == iface) {
@ -653,7 +652,7 @@ static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry
}
/* }}} */
ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface TSRMLS_DC) /* {{{ */
ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface) /* {{{ */
{
/* expects interface to be contained in ce's interface list already */
uint32_t i, ce_num, if_num = iface->num_interfaces;
@ -685,7 +684,7 @@ ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_
/* and now call the implementing handlers */
while (ce_num < ce->num_interfaces) {
do_implement_interface(ce, ce->interfaces[ce_num++] TSRMLS_CC);
do_implement_interface(ce, ce->interfaces[ce_num++]);
}
}
/* }}} */
@ -698,7 +697,7 @@ ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_
zval_add_ref
#endif
static void do_inherit_class_constant(zend_string *name, zval *zv, zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC) /* {{{ */
static void do_inherit_class_constant(zend_string *name, zval *zv, zend_class_entry *ce, zend_class_entry *parent_ce) /* {{{ */
{
if (!Z_ISREF_P(zv)) {
if (parent_ce->type == ZEND_INTERNAL_CLASS) {
@ -716,7 +715,7 @@ static void do_inherit_class_constant(zend_string *name, zval *zv, zend_class_en
}
/* }}} */
ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC) /* {{{ */
ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce) /* {{{ */
{
zend_property_info *property_info;
zend_function *func;
@ -741,7 +740,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
}
/* Inherit interfaces */
zend_do_inherit_interfaces(ce, parent_ce TSRMLS_CC);
zend_do_inherit_interfaces(ce, parent_ce);
/* Inherit properties */
if (parent_ce->default_properties_count) {
@ -774,7 +773,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
if (parent_ce->type != ce->type) {
/* User class extends internal class */
zend_update_class_constants(parent_ce TSRMLS_CC);
zend_update_class_constants(parent_ce );
if (parent_ce->default_static_members_count) {
int i = ce->default_static_members_count + parent_ce->default_static_members_count;
@ -831,34 +830,34 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
} ZEND_HASH_FOREACH_END();
ZEND_HASH_FOREACH_STR_KEY_PTR(&parent_ce->properties_info, key, property_info) {
if (do_inherit_property_access_check(property_info, key, ce TSRMLS_CC)) {
if (do_inherit_property_access_check(property_info, key, ce)) {
if (ce->type & ZEND_INTERNAL_CLASS) {
property_info = zend_duplicate_property_info_internal(property_info);
} else {
property_info = zend_duplicate_property_info(property_info TSRMLS_CC);
property_info = zend_duplicate_property_info(property_info);
}
zend_hash_add_new_ptr(&ce->properties_info, key, property_info);
}
} ZEND_HASH_FOREACH_END();
ZEND_HASH_FOREACH_STR_KEY_VAL(&parent_ce->constants_table, key, zv) {
do_inherit_class_constant(key, zv, ce, parent_ce TSRMLS_CC);
do_inherit_class_constant(key, zv, ce, parent_ce);
} ZEND_HASH_FOREACH_END();
ZEND_HASH_FOREACH_STR_KEY_PTR(&parent_ce->function_table, key, func) {
if (do_inherit_method_check(&ce->function_table, func, key, ce)) {
zend_function *new_func = do_inherit_method(func, ce TSRMLS_CC);
zend_function *new_func = do_inherit_method(func, ce);
zend_hash_add_new_ptr(&ce->function_table, key, new_func);
}
} ZEND_HASH_FOREACH_END();
do_inherit_parent_constructor(ce TSRMLS_CC);
do_inherit_parent_constructor(ce);
if (ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS && ce->type == ZEND_INTERNAL_CLASS) {
ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
} else if (!(ce->ce_flags & (ZEND_ACC_IMPLEMENT_INTERFACES|ZEND_ACC_IMPLEMENT_TRAITS))) {
/* The verification will be done in runtime by ZEND_VERIFY_ABSTRACT_CLASS */
zend_verify_abstract_class(ce TSRMLS_CC);
zend_verify_abstract_class(ce);
}
ce->ce_flags |= parent_ce->ce_flags & ZEND_HAS_STATIC_IN_METHODS;
}
@ -880,7 +879,7 @@ static zend_bool do_inherit_constant_check(HashTable *child_constants_table, zva
}
/* }}} */
static void do_inherit_iface_constant(zend_string *name, zval *zv, zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC) /* {{{ */
static void do_inherit_iface_constant(zend_string *name, zval *zv, zend_class_entry *ce, zend_class_entry *iface) /* {{{ */
{
if (do_inherit_constant_check(&ce->constants_table, zv, name, iface)) {
ZVAL_MAKE_REF(zv);
@ -893,7 +892,7 @@ static void do_inherit_iface_constant(zend_string *name, zval *zv, zend_class_en
}
/* }}} */
ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC) /* {{{ */
ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface) /* {{{ */
{
uint32_t i, ignore = 0;
uint32_t current_iface_num = ce->num_interfaces;
@ -930,23 +929,23 @@ ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry
ce->interfaces[ce->num_interfaces++] = iface;
ZEND_HASH_FOREACH_STR_KEY_VAL(&iface->constants_table, key, zv) {
do_inherit_iface_constant(key, zv, ce, iface TSRMLS_CC);
do_inherit_iface_constant(key, zv, ce, iface);
} ZEND_HASH_FOREACH_END();
ZEND_HASH_FOREACH_STR_KEY_PTR(&iface->function_table, key, func) {
if (do_inherit_method_check(&ce->function_table, func, key, ce)) {
zend_function *new_func = do_inherit_method(func, ce TSRMLS_CC);
zend_function *new_func = do_inherit_method(func, ce);
zend_hash_add_new_ptr(&ce->function_table, key, new_func);
}
} ZEND_HASH_FOREACH_END();
do_implement_interface(ce, iface TSRMLS_CC);
zend_do_inherit_interfaces(ce, iface TSRMLS_CC);
do_implement_interface(ce, iface);
zend_do_inherit_interfaces(ce, iface);
}
}
/* }}} */
ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *trait TSRMLS_DC) /* {{{ */
ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *trait) /* {{{ */
{
uint32_t i, ignore = 0;
uint32_t current_trait_num = ce->num_traits;
@ -975,19 +974,19 @@ ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *tr
}
/* }}} */
static zend_bool zend_traits_method_compatibility_check(zend_function *fn, zend_function *other_fn TSRMLS_DC) /* {{{ */
static zend_bool zend_traits_method_compatibility_check(zend_function *fn, zend_function *other_fn) /* {{{ */
{
uint32_t fn_flags = fn->common.scope->ce_flags;
uint32_t other_flags = other_fn->common.scope->ce_flags;
return zend_do_perform_implementation_check(fn, other_fn TSRMLS_CC)
&& ((other_fn->common.scope->ce_flags & ZEND_ACC_INTERFACE) || zend_do_perform_implementation_check(other_fn, fn TSRMLS_CC))
return zend_do_perform_implementation_check(fn, other_fn)
&& ((other_fn->common.scope->ce_flags & ZEND_ACC_INTERFACE) || zend_do_perform_implementation_check(other_fn, fn))
&& ((fn_flags & (ZEND_ACC_FINAL|ZEND_ACC_STATIC)) ==
(other_flags & (ZEND_ACC_FINAL|ZEND_ACC_STATIC))); /* equal final and static qualifier */
}
/* }}} */
static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zend_function* fe TSRMLS_DC) /* {{{ */
static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zend_function* fe) /* {{{ */
{
if (!strncmp(mname->val, ZEND_CLONE_FUNC_NAME, mname->len)) {
ce->clone = fe; fe->common.fn_flags |= ZEND_ACC_CLONE;
@ -1017,7 +1016,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen
} else if (ce->name->len == mname->len) {
zend_string *lowercase_name = zend_string_alloc(ce->name->len, 0);
zend_str_tolower_copy(lowercase_name->val, ce->name->val, ce->name->len);
lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
lowercase_name = zend_new_interned_string(lowercase_name);
if (!memcmp(mname->val, lowercase_name->val, mname->len)) {
if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) {
zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name->val);
@ -1030,7 +1029,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen
}
/* }}} */
static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_string *key, zend_function *fn, HashTable **overriden TSRMLS_DC) /* {{{ */
static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_string *key, zend_function *fn, HashTable **overriden) /* {{{ */
{
zend_function *existing_fn = NULL;
zend_function *new_fn;
@ -1043,17 +1042,17 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
if ((existing_fn = zend_hash_find_ptr(*overriden, key)) != NULL) {
if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
/* Make sure the trait method is compatible with previosly declared abstract method */
if (!zend_traits_method_compatibility_check(fn, existing_fn TSRMLS_CC)) {
if (!zend_traits_method_compatibility_check(fn, existing_fn)) {
zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
zend_get_function_declaration(fn TSRMLS_CC)->val,
zend_get_function_declaration(existing_fn TSRMLS_CC)->val);
zend_get_function_declaration(fn)->val,
zend_get_function_declaration(existing_fn)->val);
}
} else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
/* Make sure the abstract declaration is compatible with previous declaration */
if (!zend_traits_method_compatibility_check(existing_fn, fn TSRMLS_CC)) {
if (!zend_traits_method_compatibility_check(existing_fn, fn)) {
zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
zend_get_function_declaration(fn TSRMLS_CC)->val,
zend_get_function_declaration(existing_fn TSRMLS_CC)->val);
zend_get_function_declaration(fn)->val,
zend_get_function_declaration(existing_fn)->val);
}
return;
}
@ -1066,17 +1065,17 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
return;
} else if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
/* Make sure the trait method is compatible with previosly declared abstract method */
if (!zend_traits_method_compatibility_check(fn, existing_fn TSRMLS_CC)) {
if (!zend_traits_method_compatibility_check(fn, existing_fn)) {
zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
zend_get_function_declaration(fn TSRMLS_CC)->val,
zend_get_function_declaration(existing_fn TSRMLS_CC)->val);
zend_get_function_declaration(fn)->val,
zend_get_function_declaration(existing_fn)->val);
}
} else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
/* Make sure the abstract declaration is compatible with previous declaration */
if (!zend_traits_method_compatibility_check(existing_fn, fn TSRMLS_CC)) {
if (!zend_traits_method_compatibility_check(existing_fn, fn)) {
zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
zend_get_function_declaration(fn TSRMLS_CC)->val,
zend_get_function_declaration(existing_fn TSRMLS_CC)->val);
zend_get_function_declaration(fn)->val,
zend_get_function_declaration(existing_fn)->val);
}
return;
} else if ((existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
@ -1093,7 +1092,7 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
} else {
/* inherited members are overridden by members inserted by traits */
/* check whether the trait method fulfills the inheritance requirements */
do_inheritance_check_on_method(fn, existing_fn TSRMLS_CC);
do_inheritance_check_on_method(fn, existing_fn);
}
}
@ -1101,7 +1100,7 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
new_fn = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
memcpy(new_fn, fn, sizeof(zend_op_array));
fn = zend_hash_update_ptr(&ce->function_table, key, new_fn);
zend_add_magic_methods(ce, key, fn TSRMLS_CC);
zend_add_magic_methods(ce, key, fn);
}
/* }}} */
@ -1121,7 +1120,7 @@ static void zend_fixup_trait_method(zend_function *fn, zend_class_entry *ce) /*
}
/* }}} */
static int zend_traits_copy_functions(zend_string *fnname, zend_function *fn, zend_class_entry *ce, HashTable **overriden, HashTable *exclude_table TSRMLS_DC) /* {{{ */
static int zend_traits_copy_functions(zend_string *fnname, zend_function *fn, zend_class_entry *ce, HashTable **overriden, HashTable *exclude_table) /* {{{ */
{
zend_trait_alias *alias, **alias_ptr;
zend_string *lcname;
@ -1146,7 +1145,7 @@ static int zend_traits_copy_functions(zend_string *fnname, zend_function *fn, ze
lcname = zend_string_alloc(alias->alias->len, 0);
zend_str_tolower_copy(lcname->val, alias->alias->val, alias->alias->len);
zend_add_trait_method(ce, alias->alias->val, lcname, &fn_copy, overriden TSRMLS_CC);
zend_add_trait_method(ce, alias->alias->val, lcname, &fn_copy, overriden);
zend_string_release(lcname);
/* Record the trait from which this alias was resolved. */
@ -1186,14 +1185,14 @@ static int zend_traits_copy_functions(zend_string *fnname, zend_function *fn, ze
}
}
zend_add_trait_method(ce, fn->common.function_name->val, fnname, &fn_copy, overriden TSRMLS_CC);
zend_add_trait_method(ce, fn->common.function_name->val, fnname, &fn_copy, overriden);
}
return ZEND_HASH_APPLY_KEEP;
}
/* }}} */
static void zend_check_trait_usage(zend_class_entry *ce, zend_class_entry *trait TSRMLS_DC) /* {{{ */
static void zend_check_trait_usage(zend_class_entry *ce, zend_class_entry *trait) /* {{{ */
{
uint32_t i;
@ -1210,7 +1209,7 @@ static void zend_check_trait_usage(zend_class_entry *ce, zend_class_entry *trait
}
/* }}} */
static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* {{{ */
static void zend_traits_init_trait_structures(zend_class_entry *ce) /* {{{ */
{
size_t i, j = 0;
zend_trait_precedence *cur_precedence;
@ -1226,10 +1225,10 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
if (cur_precedence->exclude_from_classes) {
cur_method_ref = cur_precedence->trait_method;
if (!(cur_precedence->trait_method->ce = zend_fetch_class(cur_method_ref->class_name,
ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD))) {
zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name->val);
}
zend_check_trait_usage(ce, cur_precedence->trait_method->ce TSRMLS_CC);
zend_check_trait_usage(ce, cur_precedence->trait_method->ce);
/** Ensure that the preferred method is actually available. */
lcname = zend_string_alloc(cur_method_ref->method_name->len, 0);
@ -1256,10 +1255,10 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
while (cur_precedence->exclude_from_classes[j].class_name) {
zend_string* class_name = cur_precedence->exclude_from_classes[j].class_name;
if (!(cur_precedence->exclude_from_classes[j].ce = zend_fetch_class(class_name, ZEND_FETCH_CLASS_TRAIT |ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
if (!(cur_precedence->exclude_from_classes[j].ce = zend_fetch_class(class_name, ZEND_FETCH_CLASS_TRAIT |ZEND_FETCH_CLASS_NO_AUTOLOAD))) {
zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", class_name->val);
}
zend_check_trait_usage(ce, cur_precedence->exclude_from_classes[j].ce TSRMLS_CC);
zend_check_trait_usage(ce, cur_precedence->exclude_from_classes[j].ce);
/* make sure that the trait method is not from a class mentioned in
exclude_from_classes, for consistency */
@ -1286,10 +1285,10 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
/** For all aliases with an explicit class name, resolve the class now. */
if (ce->trait_aliases[i]->trait_method->class_name) {
cur_method_ref = ce->trait_aliases[i]->trait_method;
if (!(cur_method_ref->ce = zend_fetch_class(cur_method_ref->class_name, ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
if (!(cur_method_ref->ce = zend_fetch_class(cur_method_ref->class_name, ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD))) {
zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name->val);
}
zend_check_trait_usage(ce, cur_method_ref->ce TSRMLS_CC);
zend_check_trait_usage(ce, cur_method_ref->ce);
/** And, ensure that the referenced method is resolvable, too. */
lcname = zend_string_alloc(cur_method_ref->method_name->len, 0);
@ -1341,7 +1340,7 @@ static void zend_traits_compile_exclude_table(HashTable* exclude_table, zend_tra
}
/* }}} */
static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{ */
static void zend_do_traits_method_binding(zend_class_entry *ce) /* {{{ */
{
uint32_t i;
HashTable *overriden = NULL;
@ -1359,13 +1358,13 @@ static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{
/* copies functions, applies defined aliasing, and excludes unused trait methods */
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->traits[i]->function_table, key, fn) {
zend_traits_copy_functions(key, fn, ce, &overriden, &exclude_table TSRMLS_CC);
zend_traits_copy_functions(key, fn, ce, &overriden, &exclude_table);
} ZEND_HASH_FOREACH_END();
zend_hash_destroy(&exclude_table);
} else {
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->traits[i]->function_table, key, fn) {
zend_traits_copy_functions(key, fn, ce, &overriden, NULL TSRMLS_CC);
zend_traits_copy_functions(key, fn, ce, &overriden, NULL);
} ZEND_HASH_FOREACH_END();
}
}
@ -1397,7 +1396,7 @@ static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t curr
}
/* }}} */
static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {{{ */
static void zend_do_traits_property_binding(zend_class_entry *ce) /* {{{ */
{
size_t i;
zend_property_info *property_info;
@ -1445,12 +1444,12 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
if (flags & ZEND_ACC_STATIC) {
not_compatible = (FAILURE == compare_function(&compare_result,
&ce->default_static_members_table[coliding_prop->offset],
&ce->traits[i]->default_static_members_table[property_info->offset] TSRMLS_CC))
&ce->traits[i]->default_static_members_table[property_info->offset]))
|| (Z_LVAL(compare_result) != 0);
} else {
not_compatible = (FAILURE == compare_function(&compare_result,
&ce->default_properties_table[OBJ_PROP_TO_NUM(coliding_prop->offset)],
&ce->traits[i]->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)] TSRMLS_CC))
&ce->traits[i]->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)]))
|| (Z_LVAL(compare_result) != 0);
}
} else {
@ -1489,14 +1488,14 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
doc_comment = property_info->doc_comment ? zend_string_copy(property_info->doc_comment) : NULL;
zend_declare_property_ex(ce, prop_name,
prop_value, flags,
doc_comment TSRMLS_CC);
doc_comment);
zend_string_release(prop_name);
} ZEND_HASH_FOREACH_END();
}
}
/* }}} */
static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce TSRMLS_DC) /* {{{ */
static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce) /* {{{ */
{
int i = 0;
zend_trait_alias* cur_alias;
@ -1549,7 +1548,7 @@ static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce
}
/* }}} */
ZEND_API void zend_do_bind_traits(zend_class_entry *ce TSRMLS_DC) /* {{{ */
ZEND_API void zend_do_bind_traits(zend_class_entry *ce) /* {{{ */
{
if (ce->num_traits <= 0) {
@ -1557,19 +1556,19 @@ ZEND_API void zend_do_bind_traits(zend_class_entry *ce TSRMLS_DC) /* {{{ */
}
/* complete initialization of trait strutures in ce */
zend_traits_init_trait_structures(ce TSRMLS_CC);
zend_traits_init_trait_structures(ce);
/* first care about all methods to be flattened into the class */
zend_do_traits_method_binding(ce TSRMLS_CC);
zend_do_traits_method_binding(ce);
/* Aliases which have not been applied indicate typos/bugs. */
zend_do_check_for_inconsistent_traits_aliasing(ce TSRMLS_CC);
zend_do_check_for_inconsistent_traits_aliasing(ce);
/* then flatten the properties into it, to, mostly to notfiy developer about problems */
zend_do_traits_property_binding(ce TSRMLS_CC);
zend_do_traits_property_binding(ce);
/* verify that all abstract methods from traits have been implemented */
zend_verify_abstract_class(ce TSRMLS_CC);
zend_verify_abstract_class(ce);
/* now everything should be fine and an added ZEND_ACC_IMPLICIT_ABSTRACT_CLASS should be removed */
if (ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS) {

View file

@ -24,14 +24,14 @@
BEGIN_EXTERN_C()
ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface TSRMLS_DC);
ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC);
ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface);
ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface);
ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *trait TSRMLS_DC);
ZEND_API void zend_do_bind_traits(zend_class_entry *ce TSRMLS_DC);
ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *trait);
ZEND_API void zend_do_bind_traits(zend_class_entry *ce);
ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC);
void zend_do_early_binding(TSRMLS_D);
ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce);
void zend_do_early_binding(void);
END_EXTERN_C()

View file

@ -34,7 +34,7 @@ static HashTable *registered_zend_ini_directives;
/*
* hash_apply functions
*/
static int zend_remove_ini_entries(zval *el, void *arg TSRMLS_DC) /* {{{ */
static int zend_remove_ini_entries(zval *el, void *arg) /* {{{ */
{
zend_ini_entry *ini_entry = (zend_ini_entry *)Z_PTR_P(el);
int module_number = *(int *)arg;
@ -46,7 +46,7 @@ static int zend_remove_ini_entries(zval *el, void *arg TSRMLS_DC) /* {{{ */
}
/* }}} */
static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS_DC) /* {{{ */
static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage) /* {{{ */
{
int result = FAILURE;
@ -56,7 +56,7 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS
/* even if on_modify bails out, we have to continue on with restoring,
since there can be allocated variables that would be freed on MM shutdown
and would lead to memory corruption later ini entry is modified again */
result = ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC);
result = ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage);
} zend_end_try();
}
if (stage == ZEND_INI_STAGE_RUNTIME && result == FAILURE) {
@ -76,10 +76,10 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS
}
/* }}} */
static int zend_restore_ini_entry_wrapper(zval *el TSRMLS_DC) /* {{{ */
static int zend_restore_ini_entry_wrapper(zval *el) /* {{{ */
{
zend_ini_entry *ini_entry = (zend_ini_entry *)Z_PTR_P(el);
zend_restore_ini_entry_cb(ini_entry, ZEND_INI_STAGE_DEACTIVATE TSRMLS_CC);
zend_restore_ini_entry_cb(ini_entry, ZEND_INI_STAGE_DEACTIVATE);
return 1;
}
/* }}} */
@ -102,7 +102,7 @@ static void free_ini_entry(zval *zv) /* {{{ */
/*
* Startup / shutdown
*/
ZEND_API int zend_ini_startup(TSRMLS_D) /* {{{ */
ZEND_API int zend_ini_startup(void) /* {{{ */
{
registered_zend_ini_directives = (HashTable *) malloc(sizeof(HashTable));
@ -114,15 +114,21 @@ ZEND_API int zend_ini_startup(TSRMLS_D) /* {{{ */
}
/* }}} */
ZEND_API int zend_ini_shutdown(TSRMLS_D) /* {{{ */
ZEND_API int zend_ini_shutdown(void) /* {{{ */
{
zend_hash_destroy(EG(ini_directives));
free(EG(ini_directives));
zend_ini_dtor(EG(ini_directives));
return SUCCESS;
}
/* }}} */
ZEND_API int zend_ini_global_shutdown(TSRMLS_D) /* {{{ */
ZEND_API void zend_ini_dtor(HashTable *ini_directives) /* {{{ */
{
zend_hash_destroy(ini_directives);
free(ini_directives);
}
/* }}} */
ZEND_API int zend_ini_global_shutdown(void) /* {{{ */
{
zend_hash_destroy(registered_zend_ini_directives);
free(registered_zend_ini_directives);
@ -130,10 +136,10 @@ ZEND_API int zend_ini_global_shutdown(TSRMLS_D) /* {{{ */
}
/* }}} */
ZEND_API int zend_ini_deactivate(TSRMLS_D) /* {{{ */
ZEND_API int zend_ini_deactivate(void) /* {{{ */
{
if (EG(modified_ini_directives)) {
zend_hash_apply(EG(modified_ini_directives), zend_restore_ini_entry_wrapper TSRMLS_CC);
zend_hash_apply(EG(modified_ini_directives), zend_restore_ini_entry_wrapper);
zend_hash_destroy(EG(modified_ini_directives));
FREE_HASHTABLE(EG(modified_ini_directives));
EG(modified_ini_directives) = NULL;
@ -162,7 +168,7 @@ static void copy_ini_entry(zval *zv) /* {{{ */
}
/* }}} */
ZEND_API int zend_copy_ini_directives(TSRMLS_D) /* {{{ */
ZEND_API int zend_copy_ini_directives(void) /* {{{ */
{
EG(modified_ini_directives) = NULL;
EG(error_reporting_ini_entry) = NULL;
@ -174,7 +180,7 @@ ZEND_API int zend_copy_ini_directives(TSRMLS_D) /* {{{ */
/* }}} */
#endif
static int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */
static int ini_key_compare(const void *a, const void *b) /* {{{ */
{
const Bucket *f;
const Bucket *s;
@ -194,16 +200,16 @@ static int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */
}
/* }}} */
ZEND_API void zend_ini_sort_entries(TSRMLS_D) /* {{{ */
ZEND_API void zend_ini_sort_entries(void) /* {{{ */
{
zend_hash_sort(EG(ini_directives), zend_qsort, ini_key_compare, 0 TSRMLS_CC);
zend_hash_sort(EG(ini_directives), zend_qsort, ini_key_compare, 0);
}
/* }}} */
/*
* Registration / unregistration
*/
ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number TSRMLS_DC) /* {{{ */
ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number) /* {{{ */
{
zend_ini_entry *p;
zval *default_value;
@ -243,11 +249,11 @@ ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int
if (p->name) {
zend_string_release(p->name);
}
zend_unregister_ini_entries(module_number TSRMLS_CC);
zend_unregister_ini_entries(module_number);
return FAILURE;
}
if (((default_value = zend_get_configuration_directive(p->name)) != NULL) &&
(!p->on_modify || p->on_modify(p, Z_STR_P(default_value), p->mh_arg1, p->mh_arg2, p->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC) == SUCCESS)) {
(!p->on_modify || p->on_modify(p, Z_STR_P(default_value), p->mh_arg1, p->mh_arg2, p->mh_arg3, ZEND_INI_STAGE_STARTUP) == SUCCESS)) {
p->value = zend_string_copy(Z_STR_P(default_value));
} else {
@ -255,7 +261,7 @@ ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int
zend_string_init(ini_entry->value, ini_entry->value_length, 1) : NULL;
if (p->on_modify) {
p->on_modify(p, p->value, p->mh_arg1, p->mh_arg2, p->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
p->on_modify(p, p->value, p->mh_arg1, p->mh_arg2, p->mh_arg3, ZEND_INI_STAGE_STARTUP);
}
}
ini_entry++;
@ -264,37 +270,36 @@ ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int
}
/* }}} */
ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC) /* {{{ */
ZEND_API void zend_unregister_ini_entries(int module_number) /* {{{ */
{
zend_hash_apply_with_argument(registered_zend_ini_directives, zend_remove_ini_entries, (void *) &module_number TSRMLS_CC);
zend_hash_apply_with_argument(registered_zend_ini_directives, zend_remove_ini_entries, (void *) &module_number);
}
/* }}} */
#ifdef ZTS
static int zend_ini_refresh_cache(zval *el, void *arg TSRMLS_DC) /* {{{ */
static int zend_ini_refresh_cache(zval *el, void *arg) /* {{{ */
{
zend_ini_entry *p = (zend_ini_entry *)Z_PTR_P(el);
int stage = (int)(zend_intptr_t)arg;
if (p->on_modify) {
p->on_modify(p, p->value, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage TSRMLS_CC);
p->on_modify(p, p->value, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage);
}
return 0;
}
/* }}} */
ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) /* {{{ */
ZEND_API void zend_ini_refresh_caches(int stage) /* {{{ */
{
zend_hash_apply_with_argument(EG(ini_directives), zend_ini_refresh_cache, (void *)(zend_intptr_t) stage TSRMLS_CC);
zend_hash_apply_with_argument(EG(ini_directives), zend_ini_refresh_cache, (void *)(zend_intptr_t) stage);
}
/* }}} */
#endif
ZEND_API int zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage) /* {{{ */
{
TSRMLS_FETCH();
return zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0 TSRMLS_CC);
return zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0);
}
/* }}} */
@ -302,28 +307,27 @@ ZEND_API int zend_alter_ini_entry_chars(zend_string *name, const char *value, si
{
int ret;
zend_string *new_value;
TSRMLS_FETCH();
new_value = zend_string_init(value, value_length, stage != ZEND_INI_STAGE_RUNTIME);
ret = zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0 TSRMLS_CC);
ret = zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0);
zend_string_release(new_value);
return ret;
}
/* }}} */
ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */
ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change) /* {{{ */
{
int ret;
zend_string *new_value;
new_value = zend_string_init(value, value_length, stage != ZEND_INI_STAGE_RUNTIME);
ret = zend_alter_ini_entry_ex(name, new_value, modify_type, stage, force_change TSRMLS_CC);
ret = zend_alter_ini_entry_ex(name, new_value, modify_type, stage, force_change);
zend_string_release(new_value);
return ret;
}
/* }}} */
ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */
ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, int force_change) /* {{{ */
{
zend_ini_entry *ini_entry;
zend_string *duplicate;
@ -361,7 +365,7 @@ ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value,
duplicate = zend_string_copy(new_value);
if (!ini_entry->on_modify
|| ini_entry->on_modify(ini_entry, duplicate, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC) == SUCCESS) {
|| ini_entry->on_modify(ini_entry, duplicate, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage) == SUCCESS) {
if (modified && ini_entry->orig_value != ini_entry->value) { /* we already changed the value, free the changed value */
zend_string_release(ini_entry->value);
}
@ -378,7 +382,6 @@ ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value,
ZEND_API int zend_restore_ini_entry(zend_string *name, int stage) /* {{{ */
{
zend_ini_entry *ini_entry;
TSRMLS_FETCH();
if ((ini_entry = zend_hash_find_ptr(EG(ini_directives), name)) == NULL ||
(stage == ZEND_INI_STAGE_RUNTIME && (ini_entry->modifiable & ZEND_INI_USER) == 0)) {
@ -386,7 +389,7 @@ ZEND_API int zend_restore_ini_entry(zend_string *name, int stage) /* {{{ */
}
if (EG(modified_ini_directives)) {
if (zend_restore_ini_entry_cb(ini_entry, stage TSRMLS_CC) == 0) {
if (zend_restore_ini_entry_cb(ini_entry, stage) == 0) {
zend_hash_del(EG(modified_ini_directives), name);
} else {
return FAILURE;
@ -418,7 +421,6 @@ ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*di
ZEND_API zend_long zend_ini_long(char *name, uint name_length, int orig) /* {{{ */
{
zend_ini_entry *ini_entry;
TSRMLS_FETCH();
ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
if (ini_entry) {
@ -436,7 +438,6 @@ ZEND_API zend_long zend_ini_long(char *name, uint name_length, int orig) /* {{{
ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ */
{
zend_ini_entry *ini_entry;
TSRMLS_FETCH();
ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
if (ini_entry) {
@ -454,7 +455,6 @@ ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ *
ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_bool *exists) /* {{{ */
{
zend_ini_entry *ini_entry;
TSRMLS_FETCH();
ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
if (ini_entry) {

View file

@ -27,7 +27,7 @@
#define ZEND_INI_ALL (ZEND_INI_USER|ZEND_INI_PERDIR|ZEND_INI_SYSTEM)
#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, zend_string *new_value, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC)
#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, zend_string *new_value, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage)
#define ZEND_INI_DISP(name) void name(zend_ini_entry *ini_entry, int type)
typedef struct _zend_ini_entry_def {
@ -61,22 +61,23 @@ struct _zend_ini_entry {
};
BEGIN_EXTERN_C()
ZEND_API int zend_ini_startup(TSRMLS_D);
ZEND_API int zend_ini_shutdown(TSRMLS_D);
ZEND_API int zend_ini_global_shutdown(TSRMLS_D);
ZEND_API int zend_ini_deactivate(TSRMLS_D);
ZEND_API int zend_ini_startup(void);
ZEND_API int zend_ini_shutdown(void);
ZEND_API int zend_ini_global_shutdown(void);
ZEND_API int zend_ini_deactivate(void);
ZEND_API void zend_ini_dtor(HashTable *ini_directives);
ZEND_API int zend_copy_ini_directives(TSRMLS_D);
ZEND_API int zend_copy_ini_directives(void);
ZEND_API void zend_ini_sort_entries(TSRMLS_D);
ZEND_API void zend_ini_sort_entries(void);
ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number TSRMLS_DC);
ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC);
ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC);
ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number);
ZEND_API void zend_unregister_ini_entries(int module_number);
ZEND_API void zend_ini_refresh_caches(int stage);
ZEND_API int zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage);
ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, int force_change TSRMLS_DC);
ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, int force_change);
ZEND_API int zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage);
ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change TSRMLS_DC);
ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change);
ZEND_API int zend_restore_ini_entry(zend_string *name, int stage);
ZEND_API void display_ini_entries(zend_module_entry *module);
@ -145,8 +146,8 @@ END_EXTERN_C()
#define INI_ORIG_STR(name) zend_ini_string((name), sizeof(name)-1, 1)
#define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name))
#define REGISTER_INI_ENTRIES() zend_register_ini_entries(ini_entries, module_number TSRMLS_CC)
#define UNREGISTER_INI_ENTRIES() zend_unregister_ini_entries(module_number TSRMLS_CC)
#define REGISTER_INI_ENTRIES() zend_register_ini_entries(ini_entries, module_number)
#define UNREGISTER_INI_ENTRIES() zend_unregister_ini_entries(module_number)
#define DISPLAY_INI_ENTRIES() display_ini_entries(zend_module)
#define REGISTER_INI_DISPLAYER(name, displayer) zend_ini_register_displayer((name), sizeof(name)-1, displayer)
@ -173,10 +174,10 @@ END_EXTERN_C()
#define ZEND_INI_STAGE_HTACCESS (1<<5)
/* INI parsing engine */
typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg TSRMLS_DC);
typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg);
BEGIN_EXTERN_C()
ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg TSRMLS_DC);
ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg TSRMLS_DC);
ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg);
ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg);
END_EXTERN_C()
/* INI entries */

View file

@ -36,13 +36,7 @@
#define YYERROR_VERBOSE
#define YYSTYPE zval
#ifdef ZTS
#define YYPARSE_PARAM tsrm_ls
#define YYLEX_PARAM tsrm_ls
int ini_parse(void *arg);
#else
int ini_parse(void);
#endif
#define ZEND_INI_PARSER_CB (CG(ini_parser_param))->ini_parser_cb
#define ZEND_INI_PARSER_ARG (CG(ini_parser_param))->arg
@ -119,17 +113,17 @@ static void zend_ini_add_string(zval *result, zval *op1, zval *op2)
/* {{{ zend_ini_get_constant()
*/
static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC)
static void zend_ini_get_constant(zval *result, zval *name)
{
zval *c, tmp;
/* If name contains ':' it is not a constant. Bug #26893. */
if (!memchr(Z_STRVAL_P(name), ':', Z_STRLEN_P(name))
&& (c = zend_get_constant(Z_STR_P(name) TSRMLS_CC)) != 0) {
&& (c = zend_get_constant(Z_STR_P(name))) != 0) {
if (Z_TYPE_P(c) != IS_STRING) {
ZVAL_COPY_VALUE(&tmp, c);
if (Z_OPT_CONSTANT(tmp)) {
zval_update_constant_ex(&tmp, 1, NULL TSRMLS_CC);
zval_update_constant_ex(&tmp, 1, NULL);
}
zval_opt_copy_ctor(&tmp);
convert_to_string(&tmp);
@ -148,7 +142,7 @@ static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC)
/* {{{ zend_ini_get_var()
*/
static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC)
static void zend_ini_get_var(zval *result, zval *name)
{
zval *curval;
char *envvar;
@ -157,7 +151,7 @@ static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC)
if ((curval = zend_get_configuration_directive(Z_STR_P(name))) != NULL) {
ZVAL_PSTRINGL(result, Z_STRVAL_P(curval), Z_STRLEN_P(curval));
/* ..or if not found, try ENV */
} else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name) TSRMLS_CC)) != NULL ||
} else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name))) != NULL ||
(envvar = getenv(Z_STRVAL_P(name))) != NULL) {
ZVAL_PSTRING(result, envvar);
} else {
@ -173,14 +167,13 @@ static void ini_error(const char *msg)
char *error_buf;
int error_buf_len;
char *currently_parsed_filename;
TSRMLS_FETCH();
currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C);
currently_parsed_filename = zend_ini_scanner_get_filename();
if (currently_parsed_filename) {
error_buf_len = 128 + (int)strlen(msg) + (int)strlen(currently_parsed_filename); /* should be more than enough */
error_buf = (char *) emalloc(error_buf_len);
sprintf(error_buf, "%s in %s on line %d\n", msg, currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C));
sprintf(error_buf, "%s in %s on line %d\n", msg, currently_parsed_filename, zend_ini_scanner_get_lineno());
} else {
error_buf = estrdup("Invalid configuration directive\n");
}
@ -199,7 +192,7 @@ static void ini_error(const char *msg)
/* {{{ zend_parse_ini_file()
*/
ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg TSRMLS_DC)
ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg)
{
int retval;
zend_ini_parser_param ini_parser_param;
@ -208,15 +201,15 @@ ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_erro
ini_parser_param.arg = arg;
CG(ini_parser_param) = &ini_parser_param;
if (zend_ini_open_file_for_scanning(fh, scanner_mode TSRMLS_CC) == FAILURE) {
if (zend_ini_open_file_for_scanning(fh, scanner_mode) == FAILURE) {
return FAILURE;
}
CG(ini_parser_unbuffered_errors) = unbuffered_errors;
retval = ini_parse(TSRMLS_C);
zend_file_handle_dtor(fh TSRMLS_CC);
retval = ini_parse();
zend_file_handle_dtor(fh);
shutdown_ini_scanner(TSRMLS_C);
shutdown_ini_scanner();
if (retval == 0) {
return SUCCESS;
@ -228,7 +221,7 @@ ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_erro
/* {{{ zend_parse_ini_string()
*/
ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg TSRMLS_DC)
ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg)
{
int retval;
zend_ini_parser_param ini_parser_param;
@ -237,14 +230,14 @@ ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int s
ini_parser_param.arg = arg;
CG(ini_parser_param) = &ini_parser_param;
if (zend_ini_prepare_string_for_scanning(str, scanner_mode TSRMLS_CC) == FAILURE) {
if (zend_ini_prepare_string_for_scanning(str, scanner_mode) == FAILURE) {
return FAILURE;
}
CG(ini_parser_unbuffered_errors) = unbuffered_errors;
retval = ini_parse(TSRMLS_C);
retval = ini_parse();
shutdown_ini_scanner(TSRMLS_C);
shutdown_ini_scanner();
if (retval == 0) {
return SUCCESS;
@ -290,14 +283,14 @@ statement:
#if DEBUG_CFG_PARSER
printf("SECTION: [%s]\n", Z_STRVAL($2));
#endif
ZEND_INI_PARSER_CB(&$2, NULL, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG TSRMLS_CC);
ZEND_INI_PARSER_CB(&$2, NULL, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG);
zend_string_release(Z_STR($2));
}
| TC_LABEL '=' string_or_value {
#if DEBUG_CFG_PARSER
printf("NORMAL: '%s' = '%s'\n", Z_STRVAL($1), Z_STRVAL($3));
#endif
ZEND_INI_PARSER_CB(&$1, &$3, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC);
ZEND_INI_PARSER_CB(&$1, &$3, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG);
zend_string_release(Z_STR($1));
zval_ptr_dtor(&$3);
}
@ -305,12 +298,12 @@ statement:
#if DEBUG_CFG_PARSER
printf("OFFSET: '%s'[%s] = '%s'\n", Z_STRVAL($1), Z_STRVAL($2), Z_STRVAL($5));
#endif
ZEND_INI_PARSER_CB(&$1, &$5, &$2, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC);
ZEND_INI_PARSER_CB(&$1, &$5, &$2, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG);
zend_string_release(Z_STR($1));
zend_string_release(Z_STR($2));
zval_ptr_dtor(&$5);
}
| TC_LABEL { ZEND_INI_PARSER_CB(&$1, NULL, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); zend_string_release(Z_STR($1)); }
| TC_LABEL { ZEND_INI_PARSER_CB(&$1, NULL, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); zend_string_release(Z_STR($1)); }
| END_OF_LINE
;
@ -367,7 +360,7 @@ expr:
;
cfg_var_ref:
TC_DOLLAR_CURLY TC_VARNAME '}' { zend_ini_get_var(&$$, &$2 TSRMLS_CC); zend_string_free(Z_STR($2)); }
TC_DOLLAR_CURLY TC_VARNAME '}' { zend_ini_get_var(&$$, &$2); zend_string_free(Z_STR($2)); }
;
constant_literal:
@ -379,7 +372,7 @@ constant_literal:
;
constant_string:
TC_CONSTANT { zend_ini_get_constant(&$$, &$1 TSRMLS_CC); }
TC_CONSTANT { zend_ini_get_constant(&$$, &$1); }
| TC_RAW { $$ = $1; /*printf("TC_RAW: '%s'\n", Z_STRVAL($1));*/ }
| TC_NUMBER { $$ = $1; /*printf("TC_NUMBER: '%s'\n", Z_STRVAL($1));*/ }
| TC_STRING { $$ = $1; /*printf("TC_STRING: '%s'\n", Z_STRVAL($1));*/ }

View file

@ -189,7 +189,7 @@ static void zend_ini_copy_typed_value(zval *retval, const int type, const char *
}
}
static void _yy_push_state(int new_state TSRMLS_DC)
static void _yy_push_state(int new_state)
{
zend_stack_push(&SCNG(state_stack), (void *) &YYGETCONDITION());
YYSETCONDITION(new_state);
@ -197,14 +197,14 @@ static void _yy_push_state(int new_state TSRMLS_DC)
#define yy_push_state(state_and_tsrm) _yy_push_state(yyc##state_and_tsrm)
static void yy_pop_state(TSRMLS_D)
static void yy_pop_state(void)
{
int *stack_state = zend_stack_top(&SCNG(state_stack));
YYSETCONDITION(*stack_state);
zend_stack_del_top(&SCNG(state_stack));
}
static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
static void yy_scan_buffer(char *str, unsigned int len)
{
YYCURSOR = (YYCTYPE*)str;
SCNG(yy_start) = YYCURSOR;
@ -215,7 +215,7 @@ static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
/* {{{ init_ini_scanner()
*/
static int init_ini_scanner(int scanner_mode, zend_file_handle *fh TSRMLS_DC)
static int init_ini_scanner(int scanner_mode, zend_file_handle *fh)
{
/* Sanity check */
if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW && scanner_mode != ZEND_INI_SCANNER_TYPED) {
@ -242,7 +242,7 @@ static int init_ini_scanner(int scanner_mode, zend_file_handle *fh TSRMLS_DC)
/* {{{ shutdown_ini_scanner()
*/
void shutdown_ini_scanner(TSRMLS_D)
void shutdown_ini_scanner(void)
{
zend_stack_destroy(&SCNG(state_stack));
if (ini_filename) {
@ -253,7 +253,7 @@ void shutdown_ini_scanner(TSRMLS_D)
/* {{{ zend_ini_scanner_get_lineno()
*/
int zend_ini_scanner_get_lineno(TSRMLS_D)
int zend_ini_scanner_get_lineno(void)
{
return SCNG(lineno);
}
@ -261,7 +261,7 @@ int zend_ini_scanner_get_lineno(TSRMLS_D)
/* {{{ zend_ini_scanner_get_filename()
*/
char *zend_ini_scanner_get_filename(TSRMLS_D)
char *zend_ini_scanner_get_filename(void)
{
return ini_filename ? ini_filename : "Unknown";
}
@ -269,21 +269,21 @@ char *zend_ini_scanner_get_filename(TSRMLS_D)
/* {{{ zend_ini_open_file_for_scanning()
*/
int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRMLS_DC)
int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode)
{
char *buf;
size_t size;
if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE) {
if (zend_stream_fixup(fh, &buf, &size) == FAILURE) {
return FAILURE;
}
if (init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE) {
zend_file_handle_dtor(fh TSRMLS_CC);
if (init_ini_scanner(scanner_mode, fh) == FAILURE) {
zend_file_handle_dtor(fh);
return FAILURE;
}
yy_scan_buffer(buf, (unsigned int)size TSRMLS_CC);
yy_scan_buffer(buf, (unsigned int)size);
return SUCCESS;
}
@ -291,15 +291,15 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRML
/* {{{ zend_ini_prepare_string_for_scanning()
*/
int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode)
{
int len = (int)strlen(str);
if (init_ini_scanner(scanner_mode, NULL TSRMLS_CC) == FAILURE) {
if (init_ini_scanner(scanner_mode, NULL) == FAILURE) {
return FAILURE;
}
yy_scan_buffer(str, len TSRMLS_CC);
yy_scan_buffer(str, len);
return SUCCESS;
}
@ -307,7 +307,7 @@ int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
/* {{{ zend_ini_escape_string()
*/
static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC)
static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type)
{
register char *s, *t;
char *end;
@ -354,7 +354,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty
}
/* }}} */
int ini_lex(zval *ini_lval TSRMLS_DC)
int ini_lex(zval *ini_lval)
{
restart:
SCNG(yy_text) = YYCURSOR;
@ -614,9 +614,9 @@ yy17:
#line 487 "Zend/zend_ini_scanner.l"
{ /* Start option value */
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
yy_push_state(ST_RAW TSRMLS_CC);
yy_push_state(ST_RAW);
} else {
yy_push_state(ST_VALUE TSRMLS_CC);
yy_push_state(ST_VALUE);
}
return '=';
}
@ -680,9 +680,9 @@ yy23:
{ /* Section start */
/* Enter section data lookup state */
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
yy_push_state(ST_SECTION_RAW TSRMLS_CC);
yy_push_state(ST_SECTION_RAW);
} else {
yy_push_state(ST_SECTION_VALUE TSRMLS_CC);
yy_push_state(ST_SECTION_VALUE);
}
return TC_SECTION;
}
@ -725,7 +725,7 @@ yy28:
EAT_TRAILING_WHITESPACE_EX('[');
/* Enter offset lookup state */
yy_push_state(ST_OFFSET TSRMLS_CC);
yy_push_state(ST_OFFSET);
RETURN_TOKEN(TC_OFFSET, yytext, yyleng);
}
@ -1114,7 +1114,7 @@ yy70:
yyleng = YYCURSOR - SCNG(yy_text);
#line 639 "Zend/zend_ini_scanner.l"
{ /* #Comment */
zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno));
zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(), SCNG(lineno));
BEGIN(INITIAL);
SCNG(lineno)++;
return END_OF_LINE;
@ -1292,7 +1292,7 @@ yy81:
yyleng = YYCURSOR - SCNG(yy_text);
zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC);
zend_ini_escape_string(ini_lval, yytext, yyleng, '"');
return TC_QUOTED_STRING;
}
#line 1299 "Zend/zend_ini_scanner.c"
@ -1306,7 +1306,7 @@ yy83:
yyleng = YYCURSOR - SCNG(yy_text);
#line 578 "Zend/zend_ini_scanner.l"
{ /* Double quoted '"' string ends */
yy_pop_state(TSRMLS_C);
yy_pop_state();
return '"';
}
#line 1313 "Zend/zend_ini_scanner.c"
@ -1320,7 +1320,7 @@ yy84:
yyleng = YYCURSOR - SCNG(yy_text);
#line 445 "Zend/zend_ini_scanner.l"
{ /* Variable start */
yy_push_state(ST_VARNAME TSRMLS_CC);
yy_push_state(ST_VARNAME);
return TC_DOLLAR_CURLY;
}
#line 1327 "Zend/zend_ini_scanner.c"
@ -1457,7 +1457,7 @@ yy97:
yyleng = YYCURSOR - SCNG(yy_text);
#line 573 "Zend/zend_ini_scanner.l"
{ /* Double quoted '"' string start */
yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC);
yy_push_state(ST_DOUBLE_QUOTES);
return '"';
}
#line 1464 "Zend/zend_ini_scanner.c"
@ -1879,7 +1879,7 @@ yy134:
yyleng = YYCURSOR - SCNG(yy_text);
#line 445 "Zend/zend_ini_scanner.l"
{ /* Variable start */
yy_push_state(ST_VARNAME TSRMLS_CC);
yy_push_state(ST_VARNAME);
return TC_DOLLAR_CURLY;
}
#line 1886 "Zend/zend_ini_scanner.c"
@ -2382,7 +2382,7 @@ yy183:
yyleng = YYCURSOR - SCNG(yy_text);
#line 573 "Zend/zend_ini_scanner.l"
{ /* Double quoted '"' string start */
yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC);
yy_push_state(ST_DOUBLE_QUOTES);
return '"';
}
#line 2389 "Zend/zend_ini_scanner.c"
@ -2829,7 +2829,7 @@ yy224:
yyleng = YYCURSOR - SCNG(yy_text);
#line 445 "Zend/zend_ini_scanner.l"
{ /* Variable start */
yy_push_state(ST_VARNAME TSRMLS_CC);
yy_push_state(ST_VARNAME);
return TC_DOLLAR_CURLY;
}
#line 2836 "Zend/zend_ini_scanner.c"
@ -3084,7 +3084,7 @@ yy243:
yyleng = YYCURSOR - SCNG(yy_text);
#line 573 "Zend/zend_ini_scanner.l"
{ /* Double quoted '"' string start */
yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC);
yy_push_state(ST_DOUBLE_QUOTES);
return '"';
}
#line 3091 "Zend/zend_ini_scanner.c"
@ -4641,7 +4641,7 @@ yy309:
yyleng = YYCURSOR - SCNG(yy_text);
#line 445 "Zend/zend_ini_scanner.l"
{ /* Variable start */
yy_push_state(ST_VARNAME TSRMLS_CC);
yy_push_state(ST_VARNAME);
return TC_DOLLAR_CURLY;
}
#line 4648 "Zend/zend_ini_scanner.c"
@ -4803,7 +4803,7 @@ yy324:
yyleng = YYCURSOR - SCNG(yy_text);
#line 460 "Zend/zend_ini_scanner.l"
{ /* Variable end */
yy_pop_state(TSRMLS_C);
yy_pop_state();
return '}';
}
#line 4810 "Zend/zend_ini_scanner.c"

View file

@ -28,12 +28,12 @@
#define ZEND_INI_SCANNER_TYPED 2 /* Typed mode. */
BEGIN_EXTERN_C()
int zend_ini_scanner_get_lineno(TSRMLS_D);
char *zend_ini_scanner_get_filename(TSRMLS_D);
int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRMLS_DC);
int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC);
int ini_lex(zval *ini_lval TSRMLS_DC);
void shutdown_ini_scanner(TSRMLS_D);
int zend_ini_scanner_get_lineno(void);
char *zend_ini_scanner_get_filename(void);
int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode);
int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode);
int ini_lex(zval *ini_lval);
void shutdown_ini_scanner(void);
END_EXTERN_C()
#endif /* _ZEND_INI_SCANNER_H */

View file

@ -187,7 +187,7 @@ static void zend_ini_copy_typed_value(zval *retval, const int type, const char *
}
}
static void _yy_push_state(int new_state TSRMLS_DC)
static void _yy_push_state(int new_state)
{
zend_stack_push(&SCNG(state_stack), (void *) &YYGETCONDITION());
YYSETCONDITION(new_state);
@ -195,14 +195,14 @@ static void _yy_push_state(int new_state TSRMLS_DC)
#define yy_push_state(state_and_tsrm) _yy_push_state(yyc##state_and_tsrm)
static void yy_pop_state(TSRMLS_D)
static void yy_pop_state(void)
{
int *stack_state = zend_stack_top(&SCNG(state_stack));
YYSETCONDITION(*stack_state);
zend_stack_del_top(&SCNG(state_stack));
}
static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
static void yy_scan_buffer(char *str, unsigned int len)
{
YYCURSOR = (YYCTYPE*)str;
SCNG(yy_start) = YYCURSOR;
@ -213,7 +213,7 @@ static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
/* {{{ init_ini_scanner()
*/
static int init_ini_scanner(int scanner_mode, zend_file_handle *fh TSRMLS_DC)
static int init_ini_scanner(int scanner_mode, zend_file_handle *fh)
{
/* Sanity check */
if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW && scanner_mode != ZEND_INI_SCANNER_TYPED) {
@ -240,7 +240,7 @@ static int init_ini_scanner(int scanner_mode, zend_file_handle *fh TSRMLS_DC)
/* {{{ shutdown_ini_scanner()
*/
void shutdown_ini_scanner(TSRMLS_D)
void shutdown_ini_scanner(void)
{
zend_stack_destroy(&SCNG(state_stack));
if (ini_filename) {
@ -251,7 +251,7 @@ void shutdown_ini_scanner(TSRMLS_D)
/* {{{ zend_ini_scanner_get_lineno()
*/
int zend_ini_scanner_get_lineno(TSRMLS_D)
int zend_ini_scanner_get_lineno(void)
{
return SCNG(lineno);
}
@ -259,7 +259,7 @@ int zend_ini_scanner_get_lineno(TSRMLS_D)
/* {{{ zend_ini_scanner_get_filename()
*/
char *zend_ini_scanner_get_filename(TSRMLS_D)
char *zend_ini_scanner_get_filename(void)
{
return ini_filename ? ini_filename : "Unknown";
}
@ -267,21 +267,21 @@ char *zend_ini_scanner_get_filename(TSRMLS_D)
/* {{{ zend_ini_open_file_for_scanning()
*/
int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRMLS_DC)
int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode)
{
char *buf;
size_t size;
if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE) {
if (zend_stream_fixup(fh, &buf, &size) == FAILURE) {
return FAILURE;
}
if (init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE) {
zend_file_handle_dtor(fh TSRMLS_CC);
if (init_ini_scanner(scanner_mode, fh) == FAILURE) {
zend_file_handle_dtor(fh);
return FAILURE;
}
yy_scan_buffer(buf, (unsigned int)size TSRMLS_CC);
yy_scan_buffer(buf, (unsigned int)size);
return SUCCESS;
}
@ -289,15 +289,15 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRML
/* {{{ zend_ini_prepare_string_for_scanning()
*/
int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode)
{
int len = (int)strlen(str);
if (init_ini_scanner(scanner_mode, NULL TSRMLS_CC) == FAILURE) {
if (init_ini_scanner(scanner_mode, NULL) == FAILURE) {
return FAILURE;
}
yy_scan_buffer(str, len TSRMLS_CC);
yy_scan_buffer(str, len);
return SUCCESS;
}
@ -305,7 +305,7 @@ int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
/* {{{ zend_ini_escape_string()
*/
static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC)
static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type)
{
register char *s, *t;
char *end;
@ -352,7 +352,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty
}
/* }}} */
int ini_lex(zval *ini_lval TSRMLS_DC)
int ini_lex(zval *ini_lval)
{
restart:
SCNG(yy_text) = YYCURSOR;
@ -402,9 +402,9 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
<INITIAL>"[" { /* Section start */
/* Enter section data lookup state */
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
yy_push_state(ST_SECTION_RAW TSRMLS_CC);
yy_push_state(ST_SECTION_RAW);
} else {
yy_push_state(ST_SECTION_VALUE TSRMLS_CC);
yy_push_state(ST_SECTION_VALUE);
}
return TC_SECTION;
}
@ -432,7 +432,7 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
EAT_TRAILING_WHITESPACE_EX('[');
/* Enter offset lookup state */
yy_push_state(ST_OFFSET TSRMLS_CC);
yy_push_state(ST_OFFSET);
RETURN_TOKEN(TC_OFFSET, yytext, yyleng);
}
@ -443,7 +443,7 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
}
<ST_DOUBLE_QUOTES,ST_SECTION_VALUE,ST_VALUE,ST_OFFSET>{DOLLAR_CURLY} { /* Variable start */
yy_push_state(ST_VARNAME TSRMLS_CC);
yy_push_state(ST_VARNAME);
return TC_DOLLAR_CURLY;
}
@ -458,7 +458,7 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
}
<ST_VARNAME>"}" { /* Variable end */
yy_pop_state(TSRMLS_C);
yy_pop_state();
return '}';
}
@ -486,9 +486,9 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
<INITIAL>{TABS_AND_SPACES}*[=]{TABS_AND_SPACES}* { /* Start option value */
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
yy_push_state(ST_RAW TSRMLS_CC);
yy_push_state(ST_RAW);
} else {
yy_push_state(ST_VALUE TSRMLS_CC);
yy_push_state(ST_VALUE);
}
return '=';
}
@ -571,12 +571,12 @@ end_raw_value_chars:
}
<ST_SECTION_VALUE,ST_VALUE,ST_OFFSET>{TABS_AND_SPACES}*["] { /* Double quoted '"' string start */
yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC);
yy_push_state(ST_DOUBLE_QUOTES);
return '"';
}
<ST_DOUBLE_QUOTES>["]{TABS_AND_SPACES}* { /* Double quoted '"' string ends */
yy_pop_state(TSRMLS_C);
yy_pop_state();
return '"';
}
@ -612,7 +612,7 @@ end_raw_value_chars:
yyleng = YYCURSOR - SCNG(yy_text);
zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC);
zend_ini_escape_string(ini_lval, yytext, yyleng, '"');
return TC_QUOTED_STRING;
}
@ -637,7 +637,7 @@ end_raw_value_chars:
}
<INITIAL>{TABS_AND_SPACES}*[#][^\r\n]*{NEWLINE} { /* #Comment */
zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno));
zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(), SCNG(lineno));
BEGIN(INITIAL);
SCNG(lineno)++;
return END_OF_LINE;

View file

@ -31,7 +31,7 @@ ZEND_API zend_class_entry *zend_ce_serializable;
/* {{{ zend_call_method
Only returns the returned zval if retval_ptr != NULL */
ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC)
ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval_ptr, int param_count, zval* arg1, zval* arg2)
{
int result;
zend_fcall_info fci;
@ -61,7 +61,7 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
/* no interest in caching and no information already present that is
* needed later inside zend_call_function. */
fci.function_table = !object ? EG(function_table) : NULL;
result = zend_call_function(&fci, NULL TSRMLS_CC);
result = zend_call_function(&fci, NULL);
zval_ptr_dtor(&fci.function_name);
} else {
zend_fcall_info_cache fcic;
@ -92,13 +92,13 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
} else if (obj_ce &&
!(EG(current_execute_data) &&
EG(current_execute_data)->called_scope &&
instanceof_function(EG(current_execute_data)->called_scope, obj_ce TSRMLS_CC))) {
instanceof_function(EG(current_execute_data)->called_scope, obj_ce))) {
fcic.called_scope = obj_ce;
} else {
fcic.called_scope = EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL;
}
fcic.object = object ? Z_OBJ_P(object) : NULL;
result = zend_call_function(&fci, &fcic TSRMLS_CC);
result = zend_call_function(&fci, &fcic);
zval_ptr_dtor(&fci.function_name);
}
if (result == FAILURE) {
@ -128,14 +128,14 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
/* iterator interface, c-level functions used by engine */
/* {{{ zend_user_it_new_iterator */
ZEND_API void zend_user_it_new_iterator(zend_class_entry *ce, zval *object, zval *retval TSRMLS_DC)
ZEND_API void zend_user_it_new_iterator(zend_class_entry *ce, zval *object, zval *retval)
{
zend_call_method_with_0_params(object, ce, &ce->iterator_funcs.zf_new_iterator, "getiterator", retval);
}
/* }}} */
/* {{{ zend_user_it_invalidate_current */
ZEND_API void zend_user_it_invalidate_current(zend_object_iterator *_iter TSRMLS_DC)
ZEND_API void zend_user_it_invalidate_current(zend_object_iterator *_iter)
{
zend_user_iterator *iter = (zend_user_iterator*)_iter;
@ -147,18 +147,18 @@ ZEND_API void zend_user_it_invalidate_current(zend_object_iterator *_iter TSRMLS
/* }}} */
/* {{{ zend_user_it_dtor */
static void zend_user_it_dtor(zend_object_iterator *_iter TSRMLS_DC)
static void zend_user_it_dtor(zend_object_iterator *_iter)
{
zend_user_iterator *iter = (zend_user_iterator*)_iter;
zval *object = &iter->it.data;
zend_user_it_invalidate_current(_iter TSRMLS_CC);
zend_user_it_invalidate_current(_iter);
zval_ptr_dtor(object);
}
/* }}} */
/* {{{ zend_user_it_valid */
ZEND_API int zend_user_it_valid(zend_object_iterator *_iter TSRMLS_DC)
ZEND_API int zend_user_it_valid(zend_object_iterator *_iter)
{
if (_iter) {
zend_user_iterator *iter = (zend_user_iterator*)_iter;
@ -168,7 +168,7 @@ ZEND_API int zend_user_it_valid(zend_object_iterator *_iter TSRMLS_DC)
zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs.zf_valid, "valid", &more);
if (Z_TYPE(more) != IS_UNDEF) {
result = i_zend_is_true(&more TSRMLS_CC);
result = i_zend_is_true(&more);
zval_ptr_dtor(&more);
return result ? SUCCESS : FAILURE;
}
@ -178,7 +178,7 @@ ZEND_API int zend_user_it_valid(zend_object_iterator *_iter TSRMLS_DC)
/* }}} */
/* {{{ zend_user_it_get_current_data */
ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter TSRMLS_DC)
ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter)
{
zend_user_iterator *iter = (zend_user_iterator*)_iter;
zval *object = &iter->it.data;
@ -192,7 +192,7 @@ ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter TSRMLS_
/* {{{ zend_user_it_get_current_key_default */
#if 0
static int zend_user_it_get_current_key_default(zend_object_iterator *_iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
static int zend_user_it_get_current_key_default(zend_object_iterator *_iter, char **str_key, uint *str_key_len, ulong *int_key)
{
*int_key = _iter->index;
return HASH_KEY_IS_LONG;
@ -201,7 +201,7 @@ static int zend_user_it_get_current_key_default(zend_object_iterator *_iter, cha
/* }}} */
/* {{{ zend_user_it_get_current_key */
ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *key TSRMLS_DC)
ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *key)
{
zend_user_iterator *iter = (zend_user_iterator*)_iter;
zval *object = &iter->it.data;
@ -222,23 +222,23 @@ ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *ke
/* }}} */
/* {{{ zend_user_it_move_forward */
ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter TSRMLS_DC)
ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter)
{
zend_user_iterator *iter = (zend_user_iterator*)_iter;
zval *object = &iter->it.data;
zend_user_it_invalidate_current(_iter TSRMLS_CC);
zend_user_it_invalidate_current(_iter);
zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs.zf_next, "next", NULL);
}
/* }}} */
/* {{{ zend_user_it_rewind */
ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter TSRMLS_DC)
ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter)
{
zend_user_iterator *iter = (zend_user_iterator*)_iter;
zval *object = &iter->it.data;
zend_user_it_invalidate_current(_iter TSRMLS_CC);
zend_user_it_invalidate_current(_iter);
zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs.zf_rewind, "rewind", NULL);
}
/* }}} */
@ -254,7 +254,7 @@ zend_object_iterator_funcs zend_interface_iterator_funcs_iterator = {
};
/* {{{ zend_user_it_get_iterator */
static zend_object_iterator *zend_user_it_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC)
static zend_object_iterator *zend_user_it_get_iterator(zend_class_entry *ce, zval *object, int by_ref)
{
zend_user_iterator *iterator;
@ -264,7 +264,7 @@ static zend_object_iterator *zend_user_it_get_iterator(zend_class_entry *ce, zva
iterator = emalloc(sizeof(zend_user_iterator));
zend_iterator_init((zend_object_iterator*)iterator TSRMLS_CC);
zend_iterator_init((zend_object_iterator*)iterator);
ZVAL_COPY(&iterator->it.data, object);
iterator->it.funcs = ce->iterator_funcs.funcs;
@ -275,31 +275,31 @@ static zend_object_iterator *zend_user_it_get_iterator(zend_class_entry *ce, zva
/* }}} */
/* {{{ zend_user_it_get_new_iterator */
ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC)
ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce, zval *object, int by_ref)
{
zval iterator;
zend_object_iterator *new_iterator;
zend_class_entry *ce_it;
zend_user_it_new_iterator(ce, object, &iterator TSRMLS_CC);
zend_user_it_new_iterator(ce, object, &iterator);
ce_it = (Z_TYPE(iterator) == IS_OBJECT) ? Z_OBJCE(iterator) : NULL;
if (!ce_it || !ce_it->get_iterator || (ce_it->get_iterator == zend_user_it_get_new_iterator && Z_OBJ(iterator) == Z_OBJ_P(object))) {
if (!EG(exception)) {
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce ? ce->name->val : Z_OBJCE_P(object)->name->val);
zend_throw_exception_ex(NULL, 0, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce ? ce->name->val : Z_OBJCE_P(object)->name->val);
}
zval_ptr_dtor(&iterator);
return NULL;
}
new_iterator = ce_it->get_iterator(ce_it, &iterator, by_ref TSRMLS_CC);
new_iterator = ce_it->get_iterator(ce_it, &iterator, by_ref);
zval_ptr_dtor(&iterator);
return new_iterator;
}
/* }}} */
/* {{{ zend_implement_traversable */
static int zend_implement_traversable(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC)
static int zend_implement_traversable(zend_class_entry *interface, zend_class_entry *class_type)
{
/* check that class_type is traversable at c-level or implements at least one of 'aggregate' and 'Iterator' */
uint32_t i;
@ -322,7 +322,7 @@ static int zend_implement_traversable(zend_class_entry *interface, zend_class_en
/* }}} */
/* {{{ zend_implement_aggregate */
static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC)
static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entry *class_type)
{
uint32_t i;
int t = -1;
@ -359,7 +359,7 @@ static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entr
/* }}} */
/* {{{ zend_implement_iterator */
static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC)
static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry *class_type)
{
if (class_type->get_iterator && class_type->get_iterator != zend_user_it_get_iterator) {
if (class_type->type == ZEND_INTERNAL_CLASS) {
@ -390,7 +390,7 @@ static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry
/* }}} */
/* {{{ zend_implement_arrayaccess */
static int zend_implement_arrayaccess(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC)
static int zend_implement_arrayaccess(zend_class_entry *interface, zend_class_entry *class_type)
{
#if 0
/* get ht from ce */
@ -406,7 +406,7 @@ static int zend_implement_arrayaccess(zend_class_entry *interface, zend_class_en
/* }}}*/
/* {{{ zend_user_serialize */
ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC)
ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data)
{
zend_class_entry * ce = Z_OBJCE_P(object);
zval retval;
@ -436,14 +436,14 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *b
}
if (result == FAILURE && !EG(exception)) {
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "%s::serialize() must return a string or NULL", ce->name->val);
zend_throw_exception_ex(NULL, 0, "%s::serialize() must return a string or NULL", ce->name->val);
}
return result;
}
/* }}} */
/* {{{ zend_user_unserialize */
ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data TSRMLS_DC)
ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data)
{
zval zdata;
@ -463,27 +463,27 @@ ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const uns
}
/* }}} */
ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */
ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Serialization of '%s' is not allowed", ce->name->val);
zend_throw_exception_ex(NULL, 0, "Serialization of '%s' is not allowed", ce->name->val);
return FAILURE;
}
/* }}} */
ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */
ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data) /* {{{ */
{
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Unserialization of '%s' is not allowed", ce->name->val);
zend_throw_exception_ex(NULL, 0, "Unserialization of '%s' is not allowed", ce->name->val);
return FAILURE;
}
/* }}} */
/* {{{ zend_implement_serializable */
static int zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC)
static int zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type)
{
if (class_type->parent
&& (class_type->parent->serialize || class_type->parent->unserialize)
&& !instanceof_function_ex(class_type->parent, zend_ce_serializable, 1 TSRMLS_CC)) {
&& !instanceof_function_ex(class_type->parent, zend_ce_serializable, 1)) {
return FAILURE;
}
if (!class_type->serialize) {
@ -549,15 +549,15 @@ const zend_function_entry zend_funcs_serializable[] = {
{\
zend_class_entry ce;\
INIT_CLASS_ENTRY(ce, # class_name_str, zend_funcs_ ## class_name) \
zend_ce_ ## class_name = zend_register_internal_interface(&ce TSRMLS_CC);\
zend_ce_ ## class_name = zend_register_internal_interface(&ce);\
zend_ce_ ## class_name->interface_gets_implemented = zend_implement_ ## class_name;\
}
#define REGISTER_ITERATOR_IMPLEMENT(class_name, interface_name) \
zend_class_implements(zend_ce_ ## class_name TSRMLS_CC, 1, zend_ce_ ## interface_name)
zend_class_implements(zend_ce_ ## class_name, 1, zend_ce_ ## interface_name)
/* {{{ zend_register_interfaces */
ZEND_API void zend_register_interfaces(TSRMLS_D)
ZEND_API void zend_register_interfaces(void)
{
REGISTER_ITERATOR_INTERFACE(traversable, Traversable);

View file

@ -38,34 +38,34 @@ typedef struct _zend_user_iterator {
zval value;
} zend_user_iterator;
ZEND_API zval* zend_call_method(zval *object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval, int param_count, zval* arg1, zval* arg2 TSRMLS_DC);
ZEND_API zval* zend_call_method(zval *object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval, int param_count, zval* arg1, zval* arg2);
#define zend_call_method_with_0_params(obj, obj_ce, fn_proxy, function_name, retval) \
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL TSRMLS_CC)
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL)
#define zend_call_method_with_1_params(obj, obj_ce, fn_proxy, function_name, retval, arg1) \
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 1, arg1, NULL TSRMLS_CC)
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 1, arg1, NULL)
#define zend_call_method_with_2_params(obj, obj_ce, fn_proxy, function_name, retval, arg1, arg2) \
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 2, arg1, arg2 TSRMLS_CC)
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 2, arg1, arg2)
ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter TSRMLS_DC);
ZEND_API int zend_user_it_valid(zend_object_iterator *_iter TSRMLS_DC);
ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *key TSRMLS_DC);
ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter TSRMLS_DC);
ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter TSRMLS_DC);
ZEND_API void zend_user_it_invalidate_current(zend_object_iterator *_iter TSRMLS_DC);
ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter);
ZEND_API int zend_user_it_valid(zend_object_iterator *_iter);
ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *key);
ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter);
ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter);
ZEND_API void zend_user_it_invalidate_current(zend_object_iterator *_iter);
ZEND_API void zend_user_it_new_iterator(zend_class_entry *ce, zval *object, zval *iterator TSRMLS_DC);
ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
ZEND_API void zend_user_it_new_iterator(zend_class_entry *ce, zval *object, zval *iterator);
ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce, zval *object, int by_ref);
ZEND_API void zend_register_interfaces(TSRMLS_D);
ZEND_API void zend_register_interfaces(void);
ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC);
ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data TSRMLS_DC);
ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data);
ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data);
ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC);
ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data TSRMLS_DC);
ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data);
ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data);
END_EXTERN_C()

View file

@ -24,8 +24,8 @@
static zend_class_entry zend_iterator_class_entry;
static void iter_wrapper_free(zend_object *object TSRMLS_DC);
static void iter_wrapper_dtor(zend_object *object TSRMLS_DC);
static void iter_wrapper_free(zend_object *object);
static void iter_wrapper_dtor(zend_object *object);
static zend_object_handlers iterator_object_handlers = {
0,
@ -58,37 +58,37 @@ static zend_object_handlers iterator_object_handlers = {
NULL /* compare */
};
ZEND_API void zend_register_iterator_wrapper(TSRMLS_D)
ZEND_API void zend_register_iterator_wrapper(void)
{
INIT_CLASS_ENTRY(zend_iterator_class_entry, "__iterator_wrapper", NULL);
}
static void iter_wrapper_free(zend_object *object TSRMLS_DC)
static void iter_wrapper_free(zend_object *object)
{
zend_object_iterator *iter = (zend_object_iterator*)object;
iter->funcs->dtor(iter TSRMLS_CC);
iter->funcs->dtor(iter);
}
static void iter_wrapper_dtor(zend_object *object TSRMLS_DC)
static void iter_wrapper_dtor(zend_object *object)
{
}
ZEND_API void zend_iterator_init(zend_object_iterator *iter TSRMLS_DC)
ZEND_API void zend_iterator_init(zend_object_iterator *iter)
{
zend_object_std_init(&iter->std, &zend_iterator_class_entry TSRMLS_CC);
zend_object_std_init(&iter->std, &zend_iterator_class_entry);
iter->std.handlers = &iterator_object_handlers;
}
ZEND_API void zend_iterator_dtor(zend_object_iterator *iter TSRMLS_DC)
ZEND_API void zend_iterator_dtor(zend_object_iterator *iter)
{
if (--GC_REFCOUNT(iter) > 0) {
return;
}
zend_objects_store_del(&iter->std TSRMLS_CC);
zend_objects_store_del(&iter->std);
}
ZEND_API zend_object_iterator* zend_iterator_unwrap(zval *array_ptr TSRMLS_DC)
ZEND_API zend_object_iterator* zend_iterator_unwrap(zval *array_ptr)
{
if (Z_TYPE_P(array_ptr) &&
Z_OBJ_HT_P(array_ptr) == &iterator_object_handlers) {

View file

@ -30,28 +30,28 @@ typedef struct _zend_object_iterator zend_object_iterator;
typedef struct _zend_object_iterator_funcs {
/* release all resources associated with this iterator instance */
void (*dtor)(zend_object_iterator *iter TSRMLS_DC);
void (*dtor)(zend_object_iterator *iter);
/* check for end of iteration (FAILURE or SUCCESS if data is valid) */
int (*valid)(zend_object_iterator *iter TSRMLS_DC);
int (*valid)(zend_object_iterator *iter);
/* fetch the item data for the current element */
zval *(*get_current_data)(zend_object_iterator *iter TSRMLS_DC);
zval *(*get_current_data)(zend_object_iterator *iter);
/* fetch the key for the current element (optional, may be NULL). The key
* should be written into the provided zval* using the ZVAL_* macros. If
* this handler is not provided auto-incrementing integer keys will be
* used. */
void (*get_current_key)(zend_object_iterator *iter, zval *key TSRMLS_DC);
void (*get_current_key)(zend_object_iterator *iter, zval *key);
/* step forwards to next element */
void (*move_forward)(zend_object_iterator *iter TSRMLS_DC);
void (*move_forward)(zend_object_iterator *iter);
/* rewind to start of data (optional, may be NULL) */
void (*rewind)(zend_object_iterator *iter TSRMLS_DC);
void (*rewind)(zend_object_iterator *iter);
/* invalidate current value/key (optional, may be NULL) */
void (*invalidate_current)(zend_object_iterator *iter TSRMLS_DC);
void (*invalidate_current)(zend_object_iterator *iter);
} zend_object_iterator_funcs;
struct _zend_object_iterator {
@ -73,13 +73,13 @@ typedef struct _zend_class_iterator_funcs {
BEGIN_EXTERN_C()
/* given a zval, returns stuff that can be used to iterate it. */
ZEND_API zend_object_iterator* zend_iterator_unwrap(zval *array_ptr TSRMLS_DC);
ZEND_API zend_object_iterator* zend_iterator_unwrap(zval *array_ptr);
/* given an iterator, wrap it up as a zval for use by the engine opcodes */
ZEND_API void zend_iterator_init(zend_object_iterator *iter TSRMLS_DC);
ZEND_API void zend_iterator_dtor(zend_object_iterator *iter TSRMLS_DC);
ZEND_API void zend_iterator_init(zend_object_iterator *iter);
ZEND_API void zend_iterator_dtor(zend_object_iterator *iter);
ZEND_API void zend_register_iterator_wrapper(TSRMLS_D);
ZEND_API void zend_register_iterator_wrapper(void);
END_EXTERN_C()
/*

View file

@ -54,10 +54,6 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%expect 2
%code requires {
#ifdef ZTS
# define YYPARSE_PARAM tsrm_ls
# define YYLEX_PARAM tsrm_ls
#endif
}
%destructor { zend_ast_destroy($$); } <ast>
@ -287,8 +283,8 @@ top_statement:
| class_declaration_statement { $$ = $1; }
| T_HALT_COMPILER '(' ')' ';'
{ $$ = zend_ast_create(ZEND_AST_HALT_COMPILER,
zend_ast_create_zval_from_long(zend_get_scanned_file_offset(TSRMLS_C)));
zend_stop_lexing(TSRMLS_C); }
zend_ast_create_zval_from_long(zend_get_scanned_file_offset()));
zend_stop_lexing(); }
| T_NAMESPACE namespace_name ';'
{ $$ = zend_ast_create(ZEND_AST_NAMESPACE, $2, NULL);
RESET_DOC_COMMENT(); }
@ -372,7 +368,7 @@ statement:
foreach_statement
{ $$ = zend_ast_create(ZEND_AST_FOREACH, $3, $7, $5, $9); }
| T_DECLARE '(' const_list ')'
{ zend_handle_encoding_declaration($3 TSRMLS_CC); }
{ zend_handle_encoding_declaration($3); }
declare_statement
{ $$ = zend_ast_create(ZEND_AST_DECLARE, $3, $6); }
| ';' /* empty statement */ { $$ = NULL; }
@ -610,7 +606,7 @@ class_statement_list:
class_statement:
variable_modifiers property_list ';'
{ $$ = zend_ast_append_doc_comment($2 TSRMLS_CC); $$->attr = $1; }
{ $$ = zend_ast_append_doc_comment($2); $$->attr = $1; }
| T_CONST class_const_list ';'
{ $$ = $2; RESET_DOC_COMMENT(); }
| T_USE name_list trait_adaptations
@ -1175,8 +1171,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
return yystrlen(yystr);
}
{
TSRMLS_FETCH();
if (CG(parse_error) == 0) {
if (CG(parse_error) == 0) {
char buffer[120];
const unsigned char *end, *str, *tok1 = NULL, *tok2 = NULL;
unsigned int len = 0, toklen = 0, yystr_len;

File diff suppressed because it is too large Load diff

View file

@ -58,11 +58,11 @@ typedef struct _zend_heredoc_label {
BEGIN_EXTERN_C()
int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2);
ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC);
ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC);
ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_DC);
ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding TSRMLS_DC);
ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding TSRMLS_DC);
ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state);
ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state);
ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename);
ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding);
ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding);
END_EXTERN_C()

View file

@ -123,34 +123,34 @@ do { \
BEGIN_EXTERN_C()
static size_t encoding_filter_script_to_internal(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length TSRMLS_DC)
static size_t encoding_filter_script_to_internal(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length)
{
const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding(TSRMLS_C);
const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding();
ZEND_ASSERT(internal_encoding);
return zend_multibyte_encoding_converter(to, to_length, from, from_length, internal_encoding, LANG_SCNG(script_encoding) TSRMLS_CC);
return zend_multibyte_encoding_converter(to, to_length, from, from_length, internal_encoding, LANG_SCNG(script_encoding));
}
static size_t encoding_filter_script_to_intermediate(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length TSRMLS_DC)
static size_t encoding_filter_script_to_intermediate(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length)
{
return zend_multibyte_encoding_converter(to, to_length, from, from_length, zend_multibyte_encoding_utf8, LANG_SCNG(script_encoding) TSRMLS_CC);
return zend_multibyte_encoding_converter(to, to_length, from, from_length, zend_multibyte_encoding_utf8, LANG_SCNG(script_encoding));
}
static size_t encoding_filter_intermediate_to_script(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length TSRMLS_DC)
static size_t encoding_filter_intermediate_to_script(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length)
{
return zend_multibyte_encoding_converter(to, to_length, from, from_length,
LANG_SCNG(script_encoding), zend_multibyte_encoding_utf8 TSRMLS_CC);
LANG_SCNG(script_encoding), zend_multibyte_encoding_utf8);
}
static size_t encoding_filter_intermediate_to_internal(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length TSRMLS_DC)
static size_t encoding_filter_intermediate_to_internal(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length)
{
const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding(TSRMLS_C);
const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding();
ZEND_ASSERT(internal_encoding);
return zend_multibyte_encoding_converter(to, to_length, from, from_length,
internal_encoding, zend_multibyte_encoding_utf8 TSRMLS_CC);
internal_encoding, zend_multibyte_encoding_utf8);
}
static void _yy_push_state(int new_state TSRMLS_DC)
static void _yy_push_state(int new_state)
{
zend_stack_push(&SCNG(state_stack), (void *) &YYGETCONDITION());
YYSETCONDITION(new_state);
@ -158,14 +158,14 @@ static void _yy_push_state(int new_state TSRMLS_DC)
#define yy_push_state(state_and_tsrm) _yy_push_state(yyc##state_and_tsrm)
static void yy_pop_state(TSRMLS_D)
static void yy_pop_state(void)
{
int *stack_state = zend_stack_top(&SCNG(state_stack));
YYSETCONDITION(*stack_state);
zend_stack_del_top(&SCNG(state_stack));
}
static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
static void yy_scan_buffer(char *str, unsigned int len)
{
YYCURSOR = (YYCTYPE*)str;
YYLIMIT = YYCURSOR + len;
@ -174,7 +174,7 @@ static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
}
}
void startup_scanner(TSRMLS_D)
void startup_scanner(void)
{
CG(parse_error) = 0;
CG(doc_comment) = NULL;
@ -186,7 +186,7 @@ static void heredoc_label_dtor(zend_heredoc_label *heredoc_label) {
efree(heredoc_label->label);
}
void shutdown_scanner(TSRMLS_D)
void shutdown_scanner(void)
{
CG(parse_error) = 0;
RESET_DOC_COMMENT();
@ -195,7 +195,7 @@ void shutdown_scanner(TSRMLS_D)
zend_ptr_stack_destroy(&SCNG(heredoc_label_stack));
}
ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state)
{
lex_state->yy_leng = SCNG(yy_leng);
lex_state->yy_start = SCNG(yy_start);
@ -212,7 +212,7 @@ ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
lex_state->in = SCNG(yy_in);
lex_state->yy_state = YYSTATE;
lex_state->filename = zend_get_compiled_filename(TSRMLS_C);
lex_state->filename = zend_get_compiled_filename();
lex_state->lineno = CG(zend_lineno);
lex_state->script_org = SCNG(script_org);
@ -224,7 +224,7 @@ ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
lex_state->script_encoding = SCNG(script_encoding);
}
ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state)
{
SCNG(yy_leng) = lex_state->yy_leng;
SCNG(yy_start) = lex_state->yy_start;
@ -243,7 +243,7 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
SCNG(yy_in) = lex_state->in;
YYSETCONDITION(lex_state->yy_state);
CG(zend_lineno) = lex_state->lineno;
zend_restore_compiled_filename(lex_state->filename TSRMLS_CC);
zend_restore_compiled_filename(lex_state->filename);
if (SCNG(script_filtered)) {
efree(SCNG(script_filtered));
@ -260,7 +260,7 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
RESET_DOC_COMMENT();
}
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC)
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle)
{
zend_llist_del_element(&CG(open_files), file_handle, (int (*)(void *, void *)) zend_compare_file_handles);
/* zend_file_handle_dtor() operates on the copy, so we have to NULLify the original here */
@ -276,7 +276,7 @@ ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC)
#define BOM_UTF16_LE "\xff\xfe"
#define BOM_UTF8 "\xef\xbb\xbf"
static const zend_encoding *zend_multibyte_detect_utf_encoding(const unsigned char *script, size_t script_size TSRMLS_DC)
static const zend_encoding *zend_multibyte_detect_utf_encoding(const unsigned char *script, size_t script_size)
{
const unsigned char *p;
int wchar_size = 2;
@ -324,7 +324,7 @@ static const zend_encoding *zend_multibyte_detect_utf_encoding(const unsigned ch
return NULL;
}
static const zend_encoding* zend_multibyte_detect_unicode(TSRMLS_D)
static const zend_encoding* zend_multibyte_detect_unicode(void)
{
const zend_encoding *script_encoding = NULL;
int bom_size;
@ -401,19 +401,19 @@ static const zend_encoding* zend_multibyte_detect_unicode(TSRMLS_D)
}
}
/* make best effort if BOM is missing */
return zend_multibyte_detect_utf_encoding(LANG_SCNG(script_org), LANG_SCNG(script_org_size) TSRMLS_CC);
return zend_multibyte_detect_utf_encoding(LANG_SCNG(script_org), LANG_SCNG(script_org_size));
}
return NULL;
}
static const zend_encoding* zend_multibyte_find_script_encoding(TSRMLS_D)
static const zend_encoding* zend_multibyte_find_script_encoding(void)
{
const zend_encoding *script_encoding;
if (CG(detect_unicode)) {
/* check out bom(byte order mark) and see if containing wchars */
script_encoding = zend_multibyte_detect_unicode(TSRMLS_C);
script_encoding = zend_multibyte_detect_unicode();
if (script_encoding != NULL) {
/* bom or wchar detection is prior to 'script_encoding' option */
return script_encoding;
@ -427,16 +427,16 @@ static const zend_encoding* zend_multibyte_find_script_encoding(TSRMLS_D)
/* if multiple encodings specified, detect automagically */
if (CG(script_encoding_list_size) > 1) {
return zend_multibyte_encoding_detector(LANG_SCNG(script_org), LANG_SCNG(script_org_size), CG(script_encoding_list), CG(script_encoding_list_size) TSRMLS_CC);
return zend_multibyte_encoding_detector(LANG_SCNG(script_org), LANG_SCNG(script_org_size), CG(script_encoding_list), CG(script_encoding_list_size));
}
return CG(script_encoding_list)[0];
}
ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding TSRMLS_DC)
ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding)
{
const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding(TSRMLS_C);
const zend_encoding *script_encoding = onetime_encoding ? onetime_encoding: zend_multibyte_find_script_encoding(TSRMLS_C);
const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding();
const zend_encoding *script_encoding = onetime_encoding ? onetime_encoding: zend_multibyte_find_script_encoding();
if (!script_encoding) {
return FAILURE;
@ -474,7 +474,7 @@ ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding TSR
return 0;
}
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle)
{
const char *file_path = NULL;
char *buf;
@ -488,7 +488,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
}
}
if (zend_stream_fixup(file_handle, &buf, &size TSRMLS_CC) == FAILURE) {
if (zend_stream_fixup(file_handle, &buf, &size) == FAILURE) {
return FAILURE;
}
@ -510,10 +510,10 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
SCNG(script_org_size) = size;
SCNG(script_filtered) = NULL;
zend_multibyte_set_filter(NULL TSRMLS_CC);
zend_multibyte_set_filter(NULL);
if (SCNG(input_filter)) {
if ((size_t)-1 == SCNG(input_filter)(&SCNG(script_filtered), &SCNG(script_filtered_size), SCNG(script_org), SCNG(script_org_size) TSRMLS_CC)) {
if ((size_t)-1 == SCNG(input_filter)(&SCNG(script_filtered), &SCNG(script_filtered_size), SCNG(script_org), SCNG(script_org_size))) {
zend_error_noreturn(E_COMPILE_ERROR, "Could not convert the script from the detected "
"encoding \"%s\" to a compatible encoding", zend_multibyte_get_encoding_name(LANG_SCNG(script_encoding)));
}
@ -522,7 +522,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
}
}
SCNG(yy_start) = (unsigned char *)buf - offset;
yy_scan_buffer(buf, (unsigned int)size TSRMLS_CC);
yy_scan_buffer(buf, (unsigned int)size);
} else {
zend_error_noreturn(E_COMPILE_ERROR, "zend_stream_mmap() failed");
}
@ -536,7 +536,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
}
compiled_filename = zend_string_init(file_path, strlen(file_path), 0);
zend_set_compiled_filename(compiled_filename TSRMLS_CC);
zend_set_compiled_filename(compiled_filename);
zend_string_release(compiled_filename);
if (CG(start_lineno)) {
@ -553,7 +553,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
END_EXTERN_C()
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type)
{
zend_lex_state original_lex_state;
zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array));
@ -565,51 +565,51 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR
ZVAL_LONG(&retval_zv, 1);
zend_save_lexical_state(&original_lex_state TSRMLS_CC);
zend_save_lexical_state(&original_lex_state);
if (open_file_for_scanning(file_handle TSRMLS_CC)==FAILURE) {
if (open_file_for_scanning(file_handle)==FAILURE) {
if (type==ZEND_REQUIRE) {
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC);
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
zend_bailout();
} else {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC);
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
}
compilation_successful=0;
} else {
init_op_array(op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
init_op_array(op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE);
CG(in_compilation) = 1;
CG(active_op_array) = op_array;
zend_stack_push(&CG(context_stack), (void *) &CG(context));
zend_init_compiler_context(TSRMLS_C);
zend_init_compiler_context();
CG(ast_arena) = zend_arena_create(1024 * 32);
compiler_result = zendparse(TSRMLS_C);
compiler_result = zendparse();
if (compiler_result != 0) { /* parser error */
zend_bailout();
}
zend_compile_top_stmt(CG(ast) TSRMLS_CC);
zend_compile_top_stmt(CG(ast));
zend_ast_destroy(CG(ast));
zend_arena_destroy(CG(ast_arena));
zend_do_end_compilation(TSRMLS_C);
zend_emit_final_return(&retval_zv TSRMLS_CC);
zend_do_end_compilation();
zend_emit_final_return(&retval_zv);
CG(in_compilation) = original_in_compilation;
compilation_successful=1;
}
CG(active_op_array) = original_active_op_array;
if (compilation_successful) {
pass_two(op_array TSRMLS_CC);
zend_release_labels(0 TSRMLS_CC);
pass_two(op_array);
zend_release_labels(0);
} else {
efree_size(op_array, sizeof(zend_op_array));
op_array = NULL;
}
zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
zend_restore_lexical_state(&original_lex_state);
return op_array;
}
zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC)
zend_op_array *compile_filename(int type, zval *filename)
{
zend_file_handle file_handle;
zval tmp;
@ -628,7 +628,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC)
file_handle.opened_path = NULL;
file_handle.handle.fp = NULL;
retval = zend_compile_file(&file_handle, type TSRMLS_CC);
retval = zend_compile_file(&file_handle, type);
if (retval && file_handle.handle.stream.handle) {
if (!file_handle.opened_path) {
file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRLEN_P(filename));
@ -640,7 +640,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC)
efree(opened_path);
}
}
zend_destroy_file_handle(&file_handle TSRMLS_CC);
zend_destroy_file_handle(&file_handle);
if (filename==&tmp) {
zval_dtor(&tmp);
@ -648,7 +648,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC)
return retval;
}
ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_DC)
ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename)
{
char *buf;
size_t size, old_len;
@ -671,10 +671,10 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
SCNG(script_org_size) = size;
SCNG(script_filtered) = NULL;
zend_multibyte_set_filter(zend_multibyte_get_internal_encoding(TSRMLS_C) TSRMLS_CC);
zend_multibyte_set_filter(zend_multibyte_get_internal_encoding());
if (SCNG(input_filter)) {
if ((size_t)-1 == SCNG(input_filter)(&SCNG(script_filtered), &SCNG(script_filtered_size), SCNG(script_org), SCNG(script_org_size) TSRMLS_CC)) {
if ((size_t)-1 == SCNG(input_filter)(&SCNG(script_filtered), &SCNG(script_filtered_size), SCNG(script_org), SCNG(script_org_size))) {
zend_error_noreturn(E_COMPILE_ERROR, "Could not convert the script from the detected "
"encoding \"%s\" to a compatible encoding", zend_multibyte_get_encoding_name(LANG_SCNG(script_encoding)));
}
@ -683,10 +683,10 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
}
}
yy_scan_buffer(buf, (unsigned int)size TSRMLS_CC);
yy_scan_buffer(buf, (unsigned int)size);
new_compiled_filename = zend_string_init(filename, strlen(filename), 0);
zend_set_compiled_filename(new_compiled_filename TSRMLS_CC);
zend_set_compiled_filename(new_compiled_filename);
zend_string_release(new_compiled_filename);
CG(zend_lineno) = 1;
CG(increment_lineno) = 0;
@ -695,14 +695,14 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
}
ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D)
ZEND_API size_t zend_get_scanned_file_offset(void)
{
size_t offset = SCNG(yy_cursor) - SCNG(yy_start);
if (SCNG(input_filter)) {
size_t original_offset = offset, length = 0;
do {
unsigned char *p = NULL;
if ((size_t)-1 == SCNG(input_filter)(&p, &length, SCNG(script_org), offset TSRMLS_CC)) {
if ((size_t)-1 == SCNG(input_filter)(&p, &length, SCNG(script_org), offset)) {
return (size_t)-1;
}
efree(p);
@ -717,7 +717,7 @@ ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D)
}
zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
zend_op_array *compile_string(zval *source_string, char *filename)
{
zend_lex_state original_lex_state;
zend_op_array *op_array = NULL;
@ -733,25 +733,25 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
source_string = &tmp;
CG(in_compilation) = 1;
zend_save_lexical_state(&original_lex_state TSRMLS_CC);
if (zend_prepare_string_for_scanning(source_string, filename TSRMLS_CC) == SUCCESS) {
zend_save_lexical_state(&original_lex_state);
if (zend_prepare_string_for_scanning(source_string, filename) == SUCCESS) {
CG(ast) = NULL;
CG(ast_arena) = zend_arena_create(1024 * 32);
BEGIN(ST_IN_SCRIPTING);
if (!zendparse(TSRMLS_C)) {
if (!zendparse()) {
zend_op_array *original_active_op_array = CG(active_op_array);
op_array = emalloc(sizeof(zend_op_array));
init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE);
CG(active_op_array) = op_array;
zend_stack_push(&CG(context_stack), (void *) &CG(context));
zend_init_compiler_context(TSRMLS_C);
zend_compile_top_stmt(CG(ast) TSRMLS_CC);
zend_do_end_compilation(TSRMLS_C);
zend_emit_final_return(NULL TSRMLS_CC);
pass_two(op_array TSRMLS_CC);
zend_release_labels(0 TSRMLS_CC);
zend_init_compiler_context();
zend_compile_top_stmt(CG(ast));
zend_do_end_compilation();
zend_emit_final_return(NULL);
pass_two(op_array);
zend_release_labels(0);
CG(active_op_array) = original_active_op_array;
}
@ -760,7 +760,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
zend_arena_destroy(CG(ast_arena));
}
zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
zend_restore_lexical_state(&original_lex_state);
zval_dtor(&tmp);
CG(in_compilation) = original_in_compilation;
return op_array;
@ -768,7 +768,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
BEGIN_EXTERN_C()
int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC)
int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini)
{
zend_lex_state original_lex_state;
zend_file_handle file_handle;
@ -777,46 +777,46 @@ int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlight
file_handle.filename = filename;
file_handle.free_filename = 0;
file_handle.opened_path = NULL;
zend_save_lexical_state(&original_lex_state TSRMLS_CC);
if (open_file_for_scanning(&file_handle TSRMLS_CC)==FAILURE) {
zend_message_dispatcher(ZMSG_FAILED_HIGHLIGHT_FOPEN, filename TSRMLS_CC);
zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
zend_save_lexical_state(&original_lex_state);
if (open_file_for_scanning(&file_handle)==FAILURE) {
zend_message_dispatcher(ZMSG_FAILED_HIGHLIGHT_FOPEN, filename);
zend_restore_lexical_state(&original_lex_state);
return FAILURE;
}
zend_highlight(syntax_highlighter_ini TSRMLS_CC);
zend_highlight(syntax_highlighter_ini);
if (SCNG(script_filtered)) {
efree(SCNG(script_filtered));
SCNG(script_filtered) = NULL;
}
zend_destroy_file_handle(&file_handle TSRMLS_CC);
zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
zend_destroy_file_handle(&file_handle);
zend_restore_lexical_state(&original_lex_state);
return SUCCESS;
}
int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC)
int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name)
{
zend_lex_state original_lex_state;
zval tmp = *str;
str = &tmp;
zval_copy_ctor(str);
zend_save_lexical_state(&original_lex_state TSRMLS_CC);
if (zend_prepare_string_for_scanning(str, str_name TSRMLS_CC)==FAILURE) {
zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
zend_save_lexical_state(&original_lex_state);
if (zend_prepare_string_for_scanning(str, str_name)==FAILURE) {
zend_restore_lexical_state(&original_lex_state);
return FAILURE;
}
BEGIN(INITIAL);
zend_highlight(syntax_highlighter_ini TSRMLS_CC);
zend_highlight(syntax_highlighter_ini);
if (SCNG(script_filtered)) {
efree(SCNG(script_filtered));
SCNG(script_filtered) = NULL;
}
zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
zend_restore_lexical_state(&original_lex_state);
zval_dtor(str);
return SUCCESS;
}
ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding TSRMLS_DC)
ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding)
{
size_t length;
unsigned char *new_yy_start;
@ -831,7 +831,7 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter
length = SCNG(script_org_size);
new_yy_start = SCNG(script_org);
} else {
if ((size_t)-1 == SCNG(input_filter)(&new_yy_start, &length, SCNG(script_org), SCNG(script_org_size) TSRMLS_CC)) {
if ((size_t)-1 == SCNG(input_filter)(&new_yy_start, &length, SCNG(script_org), SCNG(script_org_size))) {
zend_error_noreturn(E_COMPILE_ERROR, "Could not convert the script from the detected "
"encoding \"%s\" to a compatible encoding", zend_multibyte_get_encoding_name(LANG_SCNG(script_encoding)));
}
@ -856,14 +856,14 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter
if (SCNG(output_filter)) { \
size_t sz = 0; \
char *s = NULL; \
SCNG(output_filter)((unsigned char **)&s, &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); \
SCNG(output_filter)((unsigned char **)&s, &sz, (unsigned char *)yytext, (size_t)yyleng); \
ZVAL_STRINGL(zendlval, s, sz); \
efree(s); \
} else { \
ZVAL_STRINGL(zendlval, yytext, yyleng); \
}
static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type TSRMLS_DC)
static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type)
{
register char *s, *t;
char *end;
@ -941,6 +941,85 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
*t++ = *s;
}
break;
/* UTF-8 codepoint escape, format: /\\u\{\x+\}/ */
case 'u':
{
/* cache where we started so we can parse after validating */
char *start = s + 1;
size_t len = 0;
zend_bool valid = 1;
unsigned long codepoint;
size_t byte_len = 0;
if (*start != '{') {
/* we silently let this pass to avoid breaking code
* with JSON in string literals (e.g. "\"\u202e\""
*/
*t++ = '\\';
*t++ = 'u';
break;
} else {
/* on the other hand, invalid \u{blah} errors */
s++;
len++;
s++;
while (*s != '}') {
if (!ZEND_IS_HEX(*s)) {
valid = 0;
break;
} else {
len++;
}
s++;
}
if (*s == '}') {
valid = 1;
len++;
}
}
/* \u{} is invalid */
if (len <= 2) {
valid = 0;
}
if (!valid) {
zend_error(E_COMPILE_ERROR, "Invalid UTF-8 codepoint escape sequence");
}
errno = 0;
codepoint = strtoul(start + 1, NULL, 16);
/* per RFC 3629, UTF-8 can only represent 21 bits */
if (codepoint > 0x10FFFF || errno) {
zend_error_noreturn(E_COMPILE_ERROR, "Invalid UTF-8 codepoint escape sequence: Codepoint too large");
}
/* based on https://en.wikipedia.org/wiki/UTF-8#Sample_code */
if (codepoint < 0x80) {
byte_len = 1;
*t++ = codepoint;
} else if (codepoint <= 0x7FF) {
byte_len = 2;
*t++ = (codepoint >> 6) + 0xC0;
*t++ = (codepoint & 0x3F) + 0x80;
} else if (codepoint <= 0xFFFF) {
byte_len = 3;
*t++ = (codepoint >> 12) + 0xE0;
*t++ = ((codepoint >> 6) & 0x3F) + 0x80;
*t++ = (codepoint & 0x3F) + 0x80;
} else if (codepoint <= 0x10FFFF) {
byte_len = 4;
*t++ = (codepoint >> 18) + 0xF0;
*t++ = ((codepoint >> 12) & 0x3F) + 0x80;
*t++ = ((codepoint >> 6) & 0x3F) + 0x80;
*t++ = (codepoint & 0x3F) + 0x80;
}
Z_STRLEN_P(zendlval) -= 2; /* \u */
Z_STRLEN_P(zendlval) -= (len - byte_len);
}
break;
default:
/* check for an octal */
if (ZEND_IS_OCT(*s)) {
@ -978,7 +1057,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
unsigned char *str;
// TODO: avoid realocation ???
s = Z_STRVAL_P(zendlval);
SCNG(output_filter)(&str, &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC);
SCNG(output_filter)(&str, &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval));
zval_ptr_dtor(zendlval);
ZVAL_STRINGL(zendlval, (char *) str, sz);
efree(str);
@ -986,7 +1065,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
}
int lex_scan(zval *zendlval TSRMLS_DC)
int lex_scan(zval *zendlval)
{
restart:
SCNG(yy_text) = YYCURSOR;
@ -1165,7 +1244,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_IN_SCRIPTING>"->" {
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
yy_push_state(ST_LOOKING_FOR_PROPERTY);
return T_OBJECT_OPERATOR;
}
@ -1179,14 +1258,14 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_LOOKING_FOR_PROPERTY>{LABEL} {
yy_pop_state(TSRMLS_C);
yy_pop_state();
zend_copy_value(zendlval, yytext, yyleng);
return T_STRING;
}
<ST_LOOKING_FOR_PROPERTY>{ANY_CHAR} {
yyless(0);
yy_pop_state(TSRMLS_C);
yy_pop_state();
goto restart;
}
@ -1456,13 +1535,13 @@ NEWLINE ("\r"|"\n"|"\r\n")
<ST_IN_SCRIPTING>"{" {
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yy_push_state(ST_IN_SCRIPTING);
return '{';
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"${" {
yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC);
yy_push_state(ST_LOOKING_FOR_VARNAME);
return T_DOLLAR_OPEN_CURLY_BRACES;
}
@ -1470,7 +1549,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
<ST_IN_SCRIPTING>"}" {
RESET_DOC_COMMENT();
if (!zend_stack_is_empty(&SCNG(state_stack))) {
yy_pop_state(TSRMLS_C);
yy_pop_state();
}
return '}';
}
@ -1479,16 +1558,16 @@ NEWLINE ("\r"|"\n"|"\r\n")
<ST_LOOKING_FOR_VARNAME>{LABEL}[[}] {
yyless(yyleng - 1);
zend_copy_value(zendlval, yytext, yyleng);
yy_pop_state(TSRMLS_C);
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yy_pop_state();
yy_push_state(ST_IN_SCRIPTING);
return T_STRING_VARNAME;
}
<ST_LOOKING_FOR_VARNAME>{ANY_CHAR} {
yyless(0);
yy_pop_state(TSRMLS_C);
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yy_pop_state();
yy_push_state(ST_IN_SCRIPTING);
goto restart;
}
@ -1662,7 +1741,7 @@ inline_char_handler:
char *s = NULL;
size_t sz = 0;
// TODO: avoid reallocation ???
readsize = SCNG(output_filter)((unsigned char **)&s, &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC);
readsize = SCNG(output_filter)((unsigned char **)&s, &sz, (unsigned char *)yytext, (size_t)yyleng);
ZVAL_STRINGL(zendlval, s, sz);
efree(s);
if (readsize < yyleng) {
@ -1681,7 +1760,7 @@ inline_char_handler:
*/
<ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE>"$"{LABEL}"->"[a-zA-Z_\x7f-\xff] {
yyless(yyleng - 3);
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
yy_push_state(ST_LOOKING_FOR_PROPERTY);
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
return T_VARIABLE;
}
@ -1690,7 +1769,7 @@ inline_char_handler:
*/
<ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE>"$"{LABEL}"[" {
yyless(yyleng - 1);
yy_push_state(ST_VAR_OFFSET TSRMLS_CC);
yy_push_state(ST_VAR_OFFSET);
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
return T_VARIABLE;
}
@ -1701,7 +1780,7 @@ inline_char_handler:
}
<ST_VAR_OFFSET>"]" {
yy_pop_state(TSRMLS_C);
yy_pop_state();
return ']';
}
@ -1713,7 +1792,7 @@ inline_char_handler:
<ST_VAR_OFFSET>[ \n\r\t\\'#] {
/* Invalid rule to return a more explicit parse error with proper line number */
yyless(0);
yy_pop_state(TSRMLS_C);
yy_pop_state();
ZVAL_NULL(zendlval);
return T_ENCAPSED_AND_WHITESPACE;
}
@ -1854,7 +1933,7 @@ inline_char_handler:
char *str = NULL;
s = Z_STRVAL_P(zendlval);
// TODO: avoid reallocation ???
SCNG(output_filter)((unsigned char **)&str, &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC);
SCNG(output_filter)((unsigned char **)&str, &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval));
ZVAL_STRINGL(zendlval, str, sz);
efree(s);
}
@ -1869,7 +1948,7 @@ inline_char_handler:
switch (*YYCURSOR++) {
case '"':
yyleng = YYCURSOR - SCNG(yy_text);
zend_scan_escape_string(zendlval, yytext+bprefix+1, yyleng-bprefix-2, '"' TSRMLS_CC);
zend_scan_escape_string(zendlval, yytext+bprefix+1, yyleng-bprefix-2, '"');
return T_CONSTANT_ENCAPSED_STRING;
case '$':
if (IS_LABEL_START(*YYCURSOR) || *YYCURSOR == '{') {
@ -1974,7 +2053,7 @@ inline_char_handler:
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"{$" {
Z_LVAL_P(zendlval) = (zend_long) '{';
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yy_push_state(ST_IN_SCRIPTING);
yyless(1);
return T_CURLY_OPEN;
}
@ -2036,7 +2115,7 @@ inline_char_handler:
double_quotes_scan_done:
yyleng = YYCURSOR - SCNG(yy_text);
zend_scan_escape_string(zendlval, yytext, yyleng, '"' TSRMLS_CC);
zend_scan_escape_string(zendlval, yytext, yyleng, '"');
return T_ENCAPSED_AND_WHITESPACE;
}
@ -2078,7 +2157,7 @@ double_quotes_scan_done:
yyleng = YYCURSOR - SCNG(yy_text);
zend_scan_escape_string(zendlval, yytext, yyleng, '`' TSRMLS_CC);
zend_scan_escape_string(zendlval, yytext, yyleng, '`');
return T_ENCAPSED_AND_WHITESPACE;
}
@ -2152,7 +2231,7 @@ double_quotes_scan_done:
heredoc_scan_done:
yyleng = YYCURSOR - SCNG(yy_text);
zend_scan_escape_string(zendlval, yytext, yyleng - newline, 0 TSRMLS_CC);
zend_scan_escape_string(zendlval, yytext, yyleng - newline, 0);
return T_ENCAPSED_AND_WHITESPACE;
}

View file

@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 */
/* Generated by re2c 0.13.7.5 */
#line 3 "Zend/zend_language_scanner_defs.h"
enum YYCONDTYPE {

View file

@ -31,7 +31,7 @@ ZEND_API int le_index_ptr;
/* true global */
static HashTable list_destructors;
ZEND_API zval *zend_list_insert(void *ptr, int type TSRMLS_DC)
ZEND_API zval *zend_list_insert(void *ptr, int type)
{
int index;
zval zv;
@ -44,7 +44,7 @@ ZEND_API zval *zend_list_insert(void *ptr, int type TSRMLS_DC)
return zend_hash_index_add_new(&EG(regular_list), index, &zv);
}
ZEND_API int _zend_list_delete(zend_resource *res TSRMLS_DC)
ZEND_API int _zend_list_delete(zend_resource *res)
{
if (--GC_REFCOUNT(res) <= 0) {
return zend_hash_index_del(&EG(regular_list), res->handle);
@ -53,7 +53,7 @@ ZEND_API int _zend_list_delete(zend_resource *res TSRMLS_DC)
}
}
ZEND_API int _zend_list_free(zend_resource *res TSRMLS_DC)
ZEND_API int _zend_list_free(zend_resource *res)
{
if (GC_REFCOUNT(res) <= 0) {
return zend_hash_index_del(&EG(regular_list), res->handle);
@ -62,14 +62,14 @@ ZEND_API int _zend_list_free(zend_resource *res TSRMLS_DC)
}
}
static void zend_resource_dtor(zend_resource *res TSRMLS_DC)
static void zend_resource_dtor(zend_resource *res)
{
zend_rsrc_list_dtors_entry *ld;
ld = zend_hash_index_find_ptr(&list_destructors, res->type);
if (ld) {
if (ld->list_dtor_ex) {
ld->list_dtor_ex(res TSRMLS_CC);
ld->list_dtor_ex(res);
}
} else {
zend_error(E_WARNING,"Unknown list entry type (%d)", res->type);
@ -79,21 +79,21 @@ static void zend_resource_dtor(zend_resource *res TSRMLS_DC)
}
ZEND_API int _zend_list_close(zend_resource *res TSRMLS_DC)
ZEND_API int _zend_list_close(zend_resource *res)
{
if (GC_REFCOUNT(res) <= 0) {
return zend_list_delete(res);
} else if (res->type >= 0) {
zend_resource_dtor(res TSRMLS_CC);
zend_resource_dtor(res);
}
return SUCCESS;
}
ZEND_API zend_resource* zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC)
ZEND_API zend_resource* zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type)
{
zval *zv;
zv = zend_list_insert(rsrc_pointer, rsrc_type TSRMLS_CC);
zv = zend_list_insert(rsrc_pointer, rsrc_type);
if (rsrc_result) {
ZVAL_COPY_VALUE(rsrc_result, zv);
@ -103,7 +103,7 @@ ZEND_API zend_resource* zend_register_resource(zval *rsrc_result, void *rsrc_poi
}
}
ZEND_API void *zend_fetch_resource(zval *passed_id TSRMLS_DC, int default_id, const char *resource_type_name, int *found_resource_type, int num_resource_types, ...)
ZEND_API void *zend_fetch_resource(zval *passed_id, int default_id, const char *resource_type_name, int *found_resource_type, int num_resource_types, ...)
{
int actual_resource_type;
// void *resource;
@ -116,14 +116,14 @@ ZEND_API void *zend_fetch_resource(zval *passed_id TSRMLS_DC, int default_id, co
if (default_id==-1) { /* use id */
if (!passed_id) {
if (resource_type_name) {
class_name = get_active_class_name(&space TSRMLS_CC);
zend_error(E_WARNING, "%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(TSRMLS_C), resource_type_name);
class_name = get_active_class_name(&space);
zend_error(E_WARNING, "%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
} else if (Z_TYPE_P(passed_id) != IS_RESOURCE) {
if (resource_type_name) {
class_name = get_active_class_name(&space TSRMLS_CC);
zend_error(E_WARNING, "%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(TSRMLS_C), resource_type_name);
class_name = get_active_class_name(&space);
zend_error(E_WARNING, "%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
}
@ -131,8 +131,8 @@ ZEND_API void *zend_fetch_resource(zval *passed_id TSRMLS_DC, int default_id, co
passed_id = zend_hash_index_find(&EG(regular_list), default_id);
if (!passed_id) {
if (resource_type_name) {
class_name = get_active_class_name(&space TSRMLS_CC);
zend_error(E_WARNING, "%s%s%s(): %d is not a valid %s resource", class_name, space, get_active_function_name(TSRMLS_C), default_id, resource_type_name);
class_name = get_active_class_name(&space);
zend_error(E_WARNING, "%s%s%s(): %d is not a valid %s resource", class_name, space, get_active_function_name(), default_id, resource_type_name);
}
return NULL;
}
@ -153,8 +153,8 @@ ZEND_API void *zend_fetch_resource(zval *passed_id TSRMLS_DC, int default_id, co
va_end(resource_types);
if (resource_type_name) {
class_name = get_active_class_name(&space TSRMLS_CC);
zend_error(E_WARNING, "%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(TSRMLS_C), resource_type_name);
class_name = get_active_class_name(&space);
zend_error(E_WARNING, "%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
@ -165,9 +165,8 @@ void list_entry_destructor(zval *zv)
zend_resource *res = Z_RES_P(zv);
if (res->type >= 0) {
TSRMLS_FETCH();
zend_resource_dtor(res TSRMLS_CC);
zend_resource_dtor(res);
}
efree_size(res, sizeof(zend_resource));
}
@ -178,12 +177,11 @@ void plist_entry_destructor(zval *zv)
if (res->type >= 0) {
zend_rsrc_list_dtors_entry *ld;
TSRMLS_FETCH();
ld = zend_hash_index_find_ptr(&list_destructors, res->type);
if (ld) {
if (ld->plist_dtor_ex) {
ld->plist_dtor_ex(res TSRMLS_CC);
ld->plist_dtor_ex(res);
}
} else {
zend_error(E_WARNING,"Unknown list entry type (%d)", res->type);
@ -192,43 +190,43 @@ void plist_entry_destructor(zval *zv)
free(res);
}
int zend_init_rsrc_list(TSRMLS_D)
int zend_init_rsrc_list(void)
{
zend_hash_init(&EG(regular_list), 8, NULL, list_entry_destructor, 0);
return SUCCESS;
}
int zend_init_rsrc_plist(TSRMLS_D)
int zend_init_rsrc_plist(void)
{
zend_hash_init_ex(&EG(persistent_list), 8, NULL, plist_entry_destructor, 1, 0);
return SUCCESS;
}
static int zend_close_rsrc(zval *zv TSRMLS_DC)
static int zend_close_rsrc(zval *zv)
{
zend_resource *res = Z_PTR_P(zv);
if (res->type >= 0) {
zend_resource_dtor(res TSRMLS_CC);
zend_resource_dtor(res);
}
return ZEND_HASH_APPLY_KEEP;
}
void zend_close_rsrc_list(HashTable *ht TSRMLS_DC)
void zend_close_rsrc_list(HashTable *ht)
{
zend_hash_reverse_apply(ht, zend_close_rsrc TSRMLS_CC);
zend_hash_reverse_apply(ht, zend_close_rsrc);
}
void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC)
void zend_destroy_rsrc_list(HashTable *ht)
{
zend_hash_graceful_reverse_destroy(ht);
}
static int clean_module_resource(zval *zv, void *arg TSRMLS_DC)
static int clean_module_resource(zval *zv, void *arg)
{
int resource_id = *(int *)arg;
if (Z_RES_TYPE_P(zv) == resource_id) {
@ -239,12 +237,12 @@ static int clean_module_resource(zval *zv, void *arg TSRMLS_DC)
}
static int zend_clean_module_rsrc_dtors_cb(zval *zv, void *arg TSRMLS_DC)
static int zend_clean_module_rsrc_dtors_cb(zval *zv, void *arg)
{
zend_rsrc_list_dtors_entry *ld = (zend_rsrc_list_dtors_entry *)Z_PTR_P(zv);
int module_number = *(int *)arg;
if (ld->module_number == module_number) {
zend_hash_apply_with_argument(&EG(persistent_list), clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC);
zend_hash_apply_with_argument(&EG(persistent_list), clean_module_resource, (void *) &(ld->resource_id));
return 1;
} else {
return 0;
@ -252,9 +250,9 @@ static int zend_clean_module_rsrc_dtors_cb(zval *zv, void *arg TSRMLS_DC)
}
void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC)
void zend_clean_module_rsrc_dtors(int module_number)
{
zend_hash_apply_with_argument(&list_destructors, zend_clean_module_rsrc_dtors_cb, (void *) &module_number TSRMLS_CC);
zend_hash_apply_with_argument(&list_destructors, zend_clean_module_rsrc_dtors_cb, (void *) &module_number);
}
@ -309,7 +307,7 @@ void zend_destroy_rsrc_list_dtors(void)
}
const char *zend_rsrc_list_get_rsrc_type(zend_resource *res TSRMLS_DC)
const char *zend_rsrc_list_get_rsrc_type(zend_resource *res)
{
zend_rsrc_list_dtors_entry *lde;

View file

@ -27,8 +27,8 @@
BEGIN_EXTERN_C()
typedef void (*rsrc_dtor_func_t)(zend_resource *res TSRMLS_DC);
#define ZEND_RSRC_DTOR_FUNC(name) void name(zend_resource *res TSRMLS_DC)
typedef void (*rsrc_dtor_func_t)(zend_resource *res);
#define ZEND_RSRC_DTOR_FUNC(name) void name(zend_resource *res)
typedef struct _zend_rsrc_list_dtors_entry {
rsrc_dtor_func_t list_dtor_ex;
@ -46,27 +46,27 @@ ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_fu
void list_entry_destructor(zval *ptr);
void plist_entry_destructor(zval *ptr);
void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC);
int zend_init_rsrc_list(TSRMLS_D);
int zend_init_rsrc_plist(TSRMLS_D);
void zend_close_rsrc_list(HashTable *ht TSRMLS_DC);
void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC);
void zend_clean_module_rsrc_dtors(int module_number);
int zend_init_rsrc_list(void);
int zend_init_rsrc_plist(void);
void zend_close_rsrc_list(HashTable *ht);
void zend_destroy_rsrc_list(HashTable *ht);
int zend_init_rsrc_list_dtors(void);
void zend_destroy_rsrc_list_dtors(void);
ZEND_API zval *zend_list_insert(void *ptr, int type TSRMLS_DC);
ZEND_API int _zend_list_free(zend_resource *res TSRMLS_DC);
ZEND_API int _zend_list_delete(zend_resource *res TSRMLS_DC);
ZEND_API int _zend_list_close(zend_resource *res TSRMLS_DC);
ZEND_API zval *zend_list_insert(void *ptr, int type);
ZEND_API int _zend_list_free(zend_resource *res);
ZEND_API int _zend_list_delete(zend_resource *res);
ZEND_API int _zend_list_close(zend_resource *res);
#define zend_list_free(res) _zend_list_free(res TSRMLS_CC)
#define zend_list_delete(res) _zend_list_delete(res TSRMLS_CC)
#define zend_list_close(res) _zend_list_close(res TSRMLS_CC)
#define zend_list_free(res) _zend_list_free(res)
#define zend_list_delete(res) _zend_list_delete(res)
#define zend_list_close(res) _zend_list_close(res)
ZEND_API zend_resource *zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
ZEND_API void *zend_fetch_resource(zval *passed_id TSRMLS_DC, int default_id, const char *resource_type_name, int *found_resource_type, int num_resource_types, ...);
ZEND_API zend_resource *zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type);
ZEND_API void *zend_fetch_resource(zval *passed_id, int default_id, const char *resource_type_name, int *found_resource_type, int num_resource_types, ...);
ZEND_API const char *zend_rsrc_list_get_rsrc_type(zend_resource *res TSRMLS_DC);
ZEND_API const char *zend_rsrc_list_get_rsrc_type(zend_resource *res);
ZEND_API int zend_fetch_list_dtor_id(const char *type_name);
extern ZEND_API int le_index_ptr; /* list entry type for index pointers */
@ -77,21 +77,21 @@ extern ZEND_API int le_index_ptr; /* list entry type for index pointers */
}
#define ZEND_FETCH_RESOURCE(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type) \
rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 1, resource_type); \
rsrc = (rsrc_type) zend_fetch_resource(passed_id, default_id, resource_type_name, NULL, 1, resource_type); \
ZEND_VERIFY_RESOURCE(rsrc);
#define ZEND_FETCH_RESOURCE_NO_RETURN(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type) \
(rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 1, resource_type))
(rsrc = (rsrc_type) zend_fetch_resource(passed_id, default_id, resource_type_name, NULL, 1, resource_type))
#define ZEND_FETCH_RESOURCE2(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type1, resource_type2) \
rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 2, resource_type1, resource_type2); \
rsrc = (rsrc_type) zend_fetch_resource(passed_id, default_id, resource_type_name, NULL, 2, resource_type1, resource_type2); \
ZEND_VERIFY_RESOURCE(rsrc);
#define ZEND_FETCH_RESOURCE2_NO_RETURN(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type1, resource_type2) \
(rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 2, resource_type1, resource_type2))
(rsrc = (rsrc_type) zend_fetch_resource(passed_id, default_id, resource_type_name, NULL, 2, resource_type1, resource_type2))
#define ZEND_REGISTER_RESOURCE(rsrc_result, rsrc_pointer, rsrc_type) \
zend_register_resource(rsrc_result, rsrc_pointer, rsrc_type TSRMLS_CC);
zend_register_resource(rsrc_result, rsrc_pointer, rsrc_type);
#define ZEND_GET_RESOURCE_TYPE_ID(le_id, le_type_name) \
if (le_id == 0) { \

View file

@ -177,16 +177,16 @@ ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data))
}
ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC)
ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func)
{
zend_llist_element *element;
for (element=l->head; element; element=element->next) {
func(element->data TSRMLS_CC);
func(element->data);
}
}
ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC)
ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func)
{
size_t i;
@ -205,7 +205,7 @@ ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRM
*ptr++ = element;
}
zend_qsort(elements, l->count, sizeof(zend_llist_element *), (compare_func_t) comp_func TSRMLS_CC);
zend_qsort(elements, l->count, sizeof(zend_llist_element *), (compare_func_t) comp_func);
l->head = elements[0];
elements[0]->prev = NULL;
@ -220,24 +220,24 @@ ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRM
}
ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC)
ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg)
{
zend_llist_element *element;
for (element=l->head; element; element=element->next) {
func(element->data, arg TSRMLS_CC);
func(element->data, arg);
}
}
ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...)
ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func, int num_args, ...)
{
zend_llist_element *element;
va_list args;
va_start(args, num_args);
for (element=l->head; element; element=element->next) {
func(element->data, num_args, args TSRMLS_CC);
func(element->data, num_args, args);
}
va_end(args);
}

View file

@ -29,10 +29,10 @@ typedef struct _zend_llist_element {
} zend_llist_element;
typedef void (*llist_dtor_func_t)(void *);
typedef int (*llist_compare_func_t)(const zend_llist_element **, const zend_llist_element ** TSRMLS_DC);
typedef void (*llist_apply_with_args_func_t)(void *data, int num_args, va_list args TSRMLS_DC);
typedef void (*llist_apply_with_arg_func_t)(void *data, void *arg TSRMLS_DC);
typedef void (*llist_apply_func_t)(void * TSRMLS_DC);
typedef int (*llist_compare_func_t)(const zend_llist_element **, const zend_llist_element **);
typedef void (*llist_apply_with_args_func_t)(void *data, int num_args, va_list args);
typedef void (*llist_apply_with_arg_func_t)(void *data, void *arg);
typedef void (*llist_apply_func_t)(void *);
typedef struct _zend_llist {
zend_llist_element *head;
@ -55,12 +55,12 @@ ZEND_API void zend_llist_destroy(zend_llist *l);
ZEND_API void zend_llist_clean(zend_llist *l);
ZEND_API void zend_llist_remove_tail(zend_llist *l);
ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src);
ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC);
ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func);
ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data));
ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC);
ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...);
ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg);
ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func, int num_args, ...);
ZEND_API size_t zend_llist_count(zend_llist *l);
ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC);
ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func);
/* traversal */
ZEND_API void *zend_llist_get_first_ex(zend_llist *l, zend_llist_position *pos);

View file

@ -26,14 +26,14 @@
#include "zend_compile.h"
#include "zend_build.h"
#define INIT_FUNC_ARGS int type, int module_number TSRMLS_DC
#define INIT_FUNC_ARGS_PASSTHRU type, module_number TSRMLS_CC
#define SHUTDOWN_FUNC_ARGS int type, int module_number TSRMLS_DC
#define SHUTDOWN_FUNC_ARGS_PASSTHRU type, module_number TSRMLS_CC
#define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module TSRMLS_DC
#define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module TSRMLS_CC
#define INIT_FUNC_ARGS int type, int module_number
#define INIT_FUNC_ARGS_PASSTHRU type, module_number
#define SHUTDOWN_FUNC_ARGS int type, int module_number
#define SHUTDOWN_FUNC_ARGS_PASSTHRU type, module_number
#define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module
#define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module
#define ZEND_MODULE_API_NO 20140815
#define ZEND_MODULE_API_NO 20141001
#ifdef ZTS
#define USING_ZTS 1
#else
@ -91,8 +91,8 @@ struct _zend_module_entry {
#else
void* globals_ptr;
#endif
void (*globals_ctor)(void *global TSRMLS_DC);
void (*globals_dtor)(void *global TSRMLS_DC);
void (*globals_ctor)(void *global);
void (*globals_dtor)(void *global);
int (*post_deactivate_func)(void);
int module_started;
unsigned char type;
@ -125,8 +125,8 @@ struct _zend_module_dep {
extern ZEND_API HashTable module_registry;
void module_destructor(zend_module_entry *module);
int module_registry_request_startup(zend_module_entry *module TSRMLS_DC);
int module_registry_unload_temp(const zend_module_entry *module TSRMLS_DC);
int module_registry_request_startup(zend_module_entry *module);
int module_registry_unload_temp(const zend_module_entry *module);
#endif

View file

@ -25,7 +25,7 @@
#include "zend_multibyte.h"
#include "zend_ini.h"
static const zend_encoding *dummy_encoding_fetcher(const char *encoding_name TSRMLS_DC)
static const zend_encoding *dummy_encoding_fetcher(const char *encoding_name)
{
return NULL;
}
@ -40,29 +40,29 @@ static int dummy_encoding_lexer_compatibility_checker(const zend_encoding *encod
return 0;
}
static const zend_encoding *dummy_encoding_detector(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size TSRMLS_DC)
static const zend_encoding *dummy_encoding_detector(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size)
{
return NULL;
}
static size_t dummy_encoding_converter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from TSRMLS_DC)
static size_t dummy_encoding_converter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from)
{
return (size_t)-1;
}
static int dummy_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent TSRMLS_DC)
static int dummy_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent)
{
*return_list = pemalloc(0, persistent);
*return_size = 0;
return SUCCESS;
}
static const zend_encoding *dummy_internal_encoding_getter(TSRMLS_D)
static const zend_encoding *dummy_internal_encoding_getter(void)
{
return NULL;
}
static int dummy_internal_encoding_setter(const zend_encoding *encoding TSRMLS_DC)
static int dummy_internal_encoding_setter(const zend_encoding *encoding)
{
return FAILURE;
}
@ -85,25 +85,25 @@ ZEND_API const zend_encoding *zend_multibyte_encoding_utf16be = (const zend_enco
ZEND_API const zend_encoding *zend_multibyte_encoding_utf16le = (const zend_encoding*)"UTF-32LE";
ZEND_API const zend_encoding *zend_multibyte_encoding_utf8 = (const zend_encoding*)"UTF-8";
ZEND_API int zend_multibyte_set_functions(const zend_multibyte_functions *functions TSRMLS_DC)
ZEND_API int zend_multibyte_set_functions(const zend_multibyte_functions *functions)
{
zend_multibyte_encoding_utf32be = functions->encoding_fetcher("UTF-32BE" TSRMLS_CC);
zend_multibyte_encoding_utf32be = functions->encoding_fetcher("UTF-32BE");
if (!zend_multibyte_encoding_utf32be) {
return FAILURE;
}
zend_multibyte_encoding_utf32le = functions->encoding_fetcher("UTF-32LE" TSRMLS_CC);
zend_multibyte_encoding_utf32le = functions->encoding_fetcher("UTF-32LE");
if (!zend_multibyte_encoding_utf32le) {
return FAILURE;
}
zend_multibyte_encoding_utf16be = functions->encoding_fetcher("UTF-16BE" TSRMLS_CC);
zend_multibyte_encoding_utf16be = functions->encoding_fetcher("UTF-16BE");
if (!zend_multibyte_encoding_utf16be) {
return FAILURE;
}
zend_multibyte_encoding_utf16le = functions->encoding_fetcher("UTF-16LE" TSRMLS_CC);
zend_multibyte_encoding_utf16le = functions->encoding_fetcher("UTF-16LE");
if (!zend_multibyte_encoding_utf16le) {
return FAILURE;
}
zend_multibyte_encoding_utf8 = functions->encoding_fetcher("UTF-8" TSRMLS_CC);
zend_multibyte_encoding_utf8 = functions->encoding_fetcher("UTF-8");
if (!zend_multibyte_encoding_utf8) {
return FAILURE;
}
@ -115,19 +115,19 @@ ZEND_API int zend_multibyte_set_functions(const zend_multibyte_functions *functi
*/
{
const char *value = zend_ini_string("zend.script_encoding", sizeof("zend.script_encoding") - 1, 0);
zend_multibyte_set_script_encoding_by_string(value, strlen(value) TSRMLS_CC);
zend_multibyte_set_script_encoding_by_string(value, strlen(value));
}
return SUCCESS;
}
ZEND_API const zend_multibyte_functions *zend_multibyte_get_functions(TSRMLS_D)
ZEND_API const zend_multibyte_functions *zend_multibyte_get_functions(void)
{
return multibyte_functions.provider_name ? &multibyte_functions: NULL;
}
ZEND_API const zend_encoding *zend_multibyte_fetch_encoding(const char *name TSRMLS_DC)
ZEND_API const zend_encoding *zend_multibyte_fetch_encoding(const char *name)
{
return multibyte_functions.encoding_fetcher(name TSRMLS_CC);
return multibyte_functions.encoding_fetcher(name);
}
ZEND_API const char *zend_multibyte_get_encoding_name(const zend_encoding *encoding)
@ -140,32 +140,32 @@ ZEND_API int zend_multibyte_check_lexer_compatibility(const zend_encoding *encod
return multibyte_functions.lexer_compatibility_checker(encoding);
}
ZEND_API const zend_encoding *zend_multibyte_encoding_detector(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size TSRMLS_DC)
ZEND_API const zend_encoding *zend_multibyte_encoding_detector(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size)
{
return multibyte_functions.encoding_detector(string, length, list, list_size TSRMLS_CC);
return multibyte_functions.encoding_detector(string, length, list, list_size);
}
ZEND_API size_t zend_multibyte_encoding_converter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from TSRMLS_DC)
ZEND_API size_t zend_multibyte_encoding_converter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from)
{
return multibyte_functions.encoding_converter(to, to_length, from, from_length, encoding_to, encoding_from TSRMLS_CC);
return multibyte_functions.encoding_converter(to, to_length, from, from_length, encoding_to, encoding_from);
}
ZEND_API int zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent TSRMLS_DC)
ZEND_API int zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent)
{
return multibyte_functions.encoding_list_parser(encoding_list, encoding_list_len, return_list, return_size, persistent TSRMLS_CC);
return multibyte_functions.encoding_list_parser(encoding_list, encoding_list_len, return_list, return_size, persistent);
}
ZEND_API const zend_encoding *zend_multibyte_get_internal_encoding(TSRMLS_D)
ZEND_API const zend_encoding *zend_multibyte_get_internal_encoding(void)
{
return multibyte_functions.internal_encoding_getter(TSRMLS_C);
return multibyte_functions.internal_encoding_getter();
}
ZEND_API const zend_encoding *zend_multibyte_get_script_encoding(TSRMLS_D)
ZEND_API const zend_encoding *zend_multibyte_get_script_encoding(void)
{
return LANG_SCNG(script_encoding);
}
ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_list, size_t encoding_list_size TSRMLS_DC)
ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_list, size_t encoding_list_size)
{
if (CG(script_encoding_list)) {
free((char*)CG(script_encoding_list));
@ -175,22 +175,22 @@ ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_l
return SUCCESS;
}
ZEND_API int zend_multibyte_set_internal_encoding(const zend_encoding *encoding TSRMLS_DC)
ZEND_API int zend_multibyte_set_internal_encoding(const zend_encoding *encoding)
{
return multibyte_functions.internal_encoding_setter(encoding TSRMLS_CC);
return multibyte_functions.internal_encoding_setter(encoding);
}
ZEND_API int zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length TSRMLS_DC)
ZEND_API int zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length)
{
const zend_encoding **list = 0;
size_t size = 0;
if (!new_value) {
zend_multibyte_set_script_encoding(NULL, 0 TSRMLS_CC);
zend_multibyte_set_script_encoding(NULL, 0);
return SUCCESS;
}
if (FAILURE == zend_multibyte_parse_encoding_list(new_value, new_value_length, &list, &size, 1 TSRMLS_CC)) {
if (FAILURE == zend_multibyte_parse_encoding_list(new_value, new_value_length, &list, &size, 1)) {
return FAILURE;
}
@ -199,7 +199,7 @@ ZEND_API int zend_multibyte_set_script_encoding_by_string(const char *new_value,
return FAILURE;
}
if (FAILURE == zend_multibyte_set_script_encoding(list, size TSRMLS_CC)) {
if (FAILURE == zend_multibyte_set_script_encoding(list, size)) {
return FAILURE;
}

View file

@ -24,16 +24,16 @@
typedef struct _zend_encoding zend_encoding;
typedef size_t (*zend_encoding_filter)(unsigned char **str, size_t *str_length, const unsigned char *buf, size_t length TSRMLS_DC);
typedef size_t (*zend_encoding_filter)(unsigned char **str, size_t *str_length, const unsigned char *buf, size_t length);
typedef const zend_encoding* (*zend_encoding_fetcher)(const char *encoding_name TSRMLS_DC);
typedef const zend_encoding* (*zend_encoding_fetcher)(const char *encoding_name);
typedef const char* (*zend_encoding_name_getter)(const zend_encoding *encoding);
typedef int (*zend_encoding_lexer_compatibility_checker)(const zend_encoding *encoding);
typedef const zend_encoding *(*zend_encoding_detector)(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size TSRMLS_DC);
typedef size_t (*zend_encoding_converter)(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from TSRMLS_DC);
typedef int (*zend_encoding_list_parser)(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent TSRMLS_DC);
typedef const zend_encoding *(*zend_encoding_internal_encoding_getter)(TSRMLS_D);
typedef int (*zend_encoding_internal_encoding_setter)(const zend_encoding *encoding TSRMLS_DC);
typedef const zend_encoding *(*zend_encoding_detector)(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size);
typedef size_t (*zend_encoding_converter)(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from);
typedef int (*zend_encoding_list_parser)(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent);
typedef const zend_encoding *(*zend_encoding_internal_encoding_getter)(void);
typedef int (*zend_encoding_internal_encoding_setter)(const zend_encoding *encoding);
typedef struct _zend_multibyte_functions {
const char *provider_name;
@ -59,21 +59,21 @@ ZEND_API extern const zend_encoding *zend_multibyte_encoding_utf16le;
ZEND_API extern const zend_encoding *zend_multibyte_encoding_utf8;
/* multibyte utility functions */
ZEND_API int zend_multibyte_set_functions(const zend_multibyte_functions *functions TSRMLS_DC);
ZEND_API const zend_multibyte_functions *zend_multibyte_get_functions(TSRMLS_D);
ZEND_API int zend_multibyte_set_functions(const zend_multibyte_functions *functions);
ZEND_API const zend_multibyte_functions *zend_multibyte_get_functions(void);
ZEND_API const zend_encoding *zend_multibyte_fetch_encoding(const char *name TSRMLS_DC);
ZEND_API const zend_encoding *zend_multibyte_fetch_encoding(const char *name);
ZEND_API const char *zend_multibyte_get_encoding_name(const zend_encoding *encoding);
ZEND_API int zend_multibyte_check_lexer_compatibility(const zend_encoding *encoding);
ZEND_API const zend_encoding *zend_multibyte_encoding_detector(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size TSRMLS_DC);
ZEND_API size_t zend_multibyte_encoding_converter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from TSRMLS_DC);
ZEND_API int zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent TSRMLS_DC);
ZEND_API const zend_encoding *zend_multibyte_encoding_detector(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size);
ZEND_API size_t zend_multibyte_encoding_converter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from);
ZEND_API int zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent);
ZEND_API const zend_encoding *zend_multibyte_get_internal_encoding(TSRMLS_D);
ZEND_API const zend_encoding *zend_multibyte_get_script_encoding(TSRMLS_D);
ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_list, size_t encoding_list_size TSRMLS_DC);
ZEND_API int zend_multibyte_set_internal_encoding(const zend_encoding *encoding TSRMLS_DC);
ZEND_API int zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length TSRMLS_DC);
ZEND_API const zend_encoding *zend_multibyte_get_internal_encoding(void);
ZEND_API const zend_encoding *zend_multibyte_get_script_encoding(void);
ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_list, size_t encoding_list_size);
ZEND_API int zend_multibyte_set_internal_encoding(const zend_encoding *encoding);
ZEND_API int zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length);
END_EXTERN_C()

View file

@ -224,6 +224,30 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si
return res;
}
#elif defined(__GNUC__) && defined(__powerpc64__)
static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow)
{
size_t res;
unsigned long m_overflow;
__asm__ ("mulld %0,%2,%3\n\t"
"mulhdu %1,%2,%3\n\t"
"addc %0,%0,%4\n\t"
"addze %1,%1\n"
: "=&r"(res), "=&r"(m_overflow)
: "r"(nmemb),
"r"(size),
"r"(offset));
if (UNEXPECTED(m_overflow)) {
*overflow = 1;
return 0;
}
*overflow = 0;
return res;
}
#elif SIZEOF_SIZE_T == 4
static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow)

View file

@ -106,7 +106,7 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */
}
/* }}} */
ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC) /* {{{ */
ZEND_API HashTable *zend_std_get_properties(zval *object) /* {{{ */
{
zend_object *zobj;
zobj = Z_OBJ_P(object);
@ -117,12 +117,12 @@ ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC) /* {{{ */
}
/* }}} */
ZEND_API HashTable *zend_std_get_gc(zval *object, zval **table, int *n TSRMLS_DC) /* {{{ */
ZEND_API HashTable *zend_std_get_gc(zval *object, zval **table, int *n) /* {{{ */
{
if (Z_OBJ_HANDLER_P(object, get_properties) != zend_std_get_properties) {
*table = NULL;
*n = 0;
return Z_OBJ_HANDLER_P(object, get_properties)(object TSRMLS_CC);
return Z_OBJ_HANDLER_P(object, get_properties)(object);
} else {
zend_object *zobj = Z_OBJ_P(object);
@ -133,7 +133,7 @@ ZEND_API HashTable *zend_std_get_gc(zval *object, zval **table, int *n TSRMLS_DC
}
/* }}} */
ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
zval retval;
@ -142,7 +142,7 @@ ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC
if (!ce->__debugInfo) {
*is_temp = 0;
return Z_OBJ_HANDLER_P(object, get_properties)
? Z_OBJ_HANDLER_P(object, get_properties)(object TSRMLS_CC)
? Z_OBJ_HANDLER_P(object, get_properties)(object)
: NULL;
}
@ -177,7 +177,7 @@ ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC
}
/* }}} */
static void zend_std_call_getter(zval *object, zval *member, zval *retval TSRMLS_DC) /* {{{ */
static void zend_std_call_getter(zval *object, zval *member, zval *retval) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
@ -194,7 +194,7 @@ static void zend_std_call_getter(zval *object, zval *member, zval *retval TSRMLS
}
/* }}} */
static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_DC) /* {{{ */
static int zend_std_call_setter(zval *object, zval *member, zval *value) /* {{{ */
{
zval retval;
int result;
@ -215,7 +215,7 @@ static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_D
zval_ptr_dtor(value);
if (Z_TYPE(retval) != IS_UNDEF) {
result = i_zend_is_true(&retval TSRMLS_CC) ? SUCCESS : FAILURE;
result = i_zend_is_true(&retval) ? SUCCESS : FAILURE;
zval_ptr_dtor(&retval);
return result;
} else {
@ -224,7 +224,7 @@ static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_D
}
/* }}} */
static void zend_std_call_unsetter(zval *object, zval *member TSRMLS_DC) /* {{{ */
static void zend_std_call_unsetter(zval *object, zval *member) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
@ -240,7 +240,7 @@ static void zend_std_call_unsetter(zval *object, zval *member TSRMLS_DC) /* {{{
}
/* }}} */
static void zend_std_call_issetter(zval *object, zval *member, zval *retval TSRMLS_DC) /* {{{ */
static void zend_std_call_issetter(zval *object, zval *member, zval *retval) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
@ -258,7 +258,7 @@ static void zend_std_call_issetter(zval *object, zval *member, zval *retval TSRM
}
/* }}} */
static zend_always_inline int zend_verify_property_access(zend_property_info *property_info, zend_class_entry *ce TSRMLS_DC) /* {{{ */
static zend_always_inline int zend_verify_property_access(zend_property_info *property_info, zend_class_entry *ce) /* {{{ */
{
switch (property_info->flags & ZEND_ACC_PPP_MASK) {
case ZEND_ACC_PUBLIC:
@ -286,7 +286,7 @@ static zend_always_inline zend_bool is_derived_class(zend_class_entry *child_cla
}
/* }}} */
static zend_always_inline zend_property_info *zend_get_property_info_quick(zend_class_entry *ce, zend_string *member, int silent, int allow_static, void **cache_slot TSRMLS_DC) /* {{{ */
static zend_always_inline zend_property_info *zend_get_property_info_quick(zend_class_entry *ce, zend_string *member, int silent, int allow_static, void **cache_slot) /* {{{ */
{
zval *zv;
zend_property_info *property_info = NULL;
@ -319,7 +319,7 @@ static zend_always_inline zend_property_info *zend_get_property_info_quick(zend_
/* if it's a shadow - go to access it's private */
property_info = NULL;
} else {
if (EXPECTED(zend_verify_property_access(property_info, ce TSRMLS_CC) != 0)) {
if (EXPECTED(zend_verify_property_access(property_info, ce) != 0)) {
if (UNEXPECTED(!(flags & ZEND_ACC_CHANGED))
|| UNEXPECTED((flags & ZEND_ACC_PRIVATE))) {
if (UNEXPECTED((flags & ZEND_ACC_STATIC) != 0)) {
@ -370,13 +370,13 @@ exit:
}
/* }}} */
ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent TSRMLS_DC) /* {{{ */
ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent) /* {{{ */
{
return zend_get_property_info_quick(ce, member, silent, 1, NULL TSRMLS_CC);
return zend_get_property_info_quick(ce, member, silent, 1, NULL);
}
/* }}} */
ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name TSRMLS_DC) /* {{{ */
ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name) /* {{{ */
{
zend_property_info *property_info;
const char *class_name = NULL;
@ -390,7 +390,7 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_inf
} else {
member = zend_string_copy(prop_info_name);
}
property_info = zend_get_property_info_quick(zobj->ce, member, 1, 1, NULL TSRMLS_CC);
property_info = zend_get_property_info_quick(zobj->ce, member, 1, 1, NULL);
zend_string_release(member);
if (property_info == NULL) {
/* undefined public property */
@ -411,7 +411,7 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_inf
return FAILURE;
}
}
return zend_verify_property_access(property_info, zobj->ce TSRMLS_CC) ? SUCCESS : FAILURE;
return zend_verify_property_access(property_info, zobj->ce) ? SUCCESS : FAILURE;
}
/* }}} */
@ -432,7 +432,7 @@ static zend_long *zend_get_property_guard(zend_object *zobj, zend_string *member
}
/* }}} */
zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv TSRMLS_DC) /* {{{ */
zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
zend_object *zobj;
zval tmp_member;
@ -453,7 +453,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
#endif
/* make zend_get_property_info silent if we have getter - we may want to use it */
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (type == BP_VAR_IS) || (zobj->ce->__get != NULL), 0, cache_slot TSRMLS_CC);
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (type == BP_VAR_IS) || (zobj->ce->__get != NULL), 0, cache_slot);
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
if (EXPECTED(property_info != NULL)) {
@ -476,7 +476,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
/* have getter - try with it! */
ZVAL_COPY(&tmp_object, object);
*guard |= IN_GET; /* prevent circular getting */
zend_std_call_getter(&tmp_object, member, rv TSRMLS_CC);
zend_std_call_getter(&tmp_object, member, rv);
*guard &= ~IN_GET;
if (Z_TYPE_P(rv) != IS_UNDEF) {
@ -518,7 +518,7 @@ exit:
}
/* }}} */
ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, void **cache_slot TSRMLS_DC) /* {{{ */
ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
{
zend_object *zobj;
zval tmp_member;
@ -534,7 +534,7 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, v
cache_slot = NULL;
}
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__set != NULL), 0, cache_slot TSRMLS_CC);
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__set != NULL), 0, cache_slot);
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
if (EXPECTED(property_info != NULL)) {
@ -545,7 +545,7 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, v
} else if (EXPECTED(zobj->properties != NULL)) {
if ((variable_ptr = zend_hash_find(zobj->properties, Z_STR_P(member))) != NULL) {
found:
zend_assign_to_variable(variable_ptr, value, (IS_VAR|IS_TMP_VAR) TSRMLS_CC);
zend_assign_to_variable(variable_ptr, value, (IS_VAR|IS_TMP_VAR));
goto exit;
}
}
@ -560,7 +560,7 @@ found:
ZVAL_COPY(&tmp_object, object);
(*guard) |= IN_SET; /* prevent circular setting */
if (zend_std_call_setter(&tmp_object, member, value TSRMLS_CC) != SUCCESS) {
if (zend_std_call_setter(&tmp_object, member, value) != SUCCESS) {
/* for now, just ignore it - __set should take care of warnings, etc. */
}
(*guard) &= ~IN_SET;
@ -608,12 +608,12 @@ exit:
}
/* }}} */
zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv TSRMLS_DC) /* {{{ */
zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
zval tmp;
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC) != 0)) {
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
if(offset == NULL) {
/* [] construct */
ZVAL_UNDEF(&tmp);
@ -639,12 +639,12 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv TSR
}
/* }}} */
static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC) /* {{{ */
static void zend_std_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
zval tmp;
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC) != 0)) {
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
if (!offset) {
ZVAL_NULL(&tmp);
offset = &tmp;
@ -659,22 +659,22 @@ static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSR
}
/* }}} */
static int zend_std_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC) /* {{{ */
static int zend_std_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
zval retval;
int result;
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC) != 0)) {
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(object, ce, NULL, "offsetexists", &retval, offset);
if (EXPECTED(Z_TYPE(retval) != IS_UNDEF)) {
result = i_zend_is_true(&retval TSRMLS_CC);
result = i_zend_is_true(&retval);
zval_ptr_dtor(&retval);
if (check_empty && result && EXPECTED(!EG(exception))) {
zend_call_method_with_1_params(object, ce, NULL, "offsetget", &retval, offset);
if (EXPECTED(Z_TYPE(retval) != IS_UNDEF)) {
result = i_zend_is_true(&retval TSRMLS_CC);
result = i_zend_is_true(&retval);
zval_ptr_dtor(&retval);
}
}
@ -690,7 +690,7 @@ static int zend_std_has_dimension(zval *object, zval *offset, int check_empty TS
}
/* }}} */
static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot TSRMLS_DC) /* {{{ */
static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
{
zend_object *zobj;
zend_string *name;
@ -708,7 +708,7 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type,
fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), name->val);
#endif
property_info = zend_get_property_info_quick(zobj->ce, name, (zobj->ce->__get != NULL), 0, cache_slot TSRMLS_CC);
property_info = zend_get_property_info_quick(zobj->ce, name, (zobj->ce->__get != NULL), 0, cache_slot);
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
if (EXPECTED(property_info != NULL)) {
@ -753,7 +753,7 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type,
}
/* }}} */
static void zend_std_unset_property(zval *object, zval *member, void **cache_slot TSRMLS_DC) /* {{{ */
static void zend_std_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
{
zend_object *zobj;
zval tmp_member;
@ -768,7 +768,7 @@ static void zend_std_unset_property(zval *object, zval *member, void **cache_slo
cache_slot = NULL;
}
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__unset != NULL), 0, cache_slot TSRMLS_CC);
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__unset != NULL), 0, cache_slot);
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
if (EXPECTED(property_info != NULL)) {
@ -794,7 +794,7 @@ static void zend_std_unset_property(zval *object, zval *member, void **cache_slo
/* have unseter - try with it! */
ZVAL_COPY(&tmp_object, object);
(*guard) |= IN_UNSET; /* prevent circular unsetting */
zend_std_call_unsetter(&tmp_object, member TSRMLS_CC);
zend_std_call_unsetter(&tmp_object, member);
(*guard) &= ~IN_UNSET;
zval_ptr_dtor(&tmp_object);
} else {
@ -815,11 +815,11 @@ exit:
}
/* }}} */
static void zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC) /* {{{ */
static void zend_std_unset_dimension(zval *object, zval *offset) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) {
if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1)) {
SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(object, ce, NULL, "offsetunset", NULL, offset);
zval_ptr_dtor(offset);
@ -838,7 +838,7 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
array_init_size(&method_args, ZEND_NUM_ARGS());
if (UNEXPECTED(zend_copy_parameters_array(ZEND_NUM_ARGS(), &method_args TSRMLS_CC) == FAILURE)) {
if (UNEXPECTED(zend_copy_parameters_array(ZEND_NUM_ARGS(), &method_args) == FAILURE)) {
zval_dtor(&method_args);
zend_error_noreturn(E_ERROR, "Cannot get arguments for __call");
RETURN_FALSE;
@ -871,7 +871,7 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
* Returns the function address that should be called, or NULL
* if no such function exists.
*/
static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, zend_string *function_name TSRMLS_DC) /* {{{ */
static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, zend_string *function_name) /* {{{ */
{
zval *func;
@ -910,9 +910,9 @@ static inline zend_function *zend_check_private_int(zend_function *fbc, zend_cla
}
/* }}} */
ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, zend_string *function_name TSRMLS_DC) /* {{{ */
ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, zend_string *function_name) /* {{{ */
{
return zend_check_private_int(fbc, ce, function_name TSRMLS_CC) != NULL;
return zend_check_private_int(fbc, ce, function_name) != NULL;
}
/* }}} */
@ -967,7 +967,7 @@ static inline union _zend_function *zend_get_user_call_function(zend_class_entry
}
/* }}} */
static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *method_name, const zval *key TSRMLS_DC) /* {{{ */
static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *method_name, const zval *key) /* {{{ */
{
zend_object *zobj = *obj_ptr;
zval *func;
@ -1001,7 +1001,7 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str
/* Ensure that if we're calling a private function, we're allowed to do so.
* If we're not and __call() handler exists, invoke it, otherwise error out.
*/
updated_fbc = zend_check_private_int(fbc, zobj->ce, lc_method_name TSRMLS_CC);
updated_fbc = zend_check_private_int(fbc, zobj->ce, lc_method_name);
if (EXPECTED(updated_fbc != NULL)) {
fbc = updated_fbc;
} else {
@ -1056,7 +1056,7 @@ ZEND_API void zend_std_callstatic_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{
array_init_size(&method_args, ZEND_NUM_ARGS());
if (UNEXPECTED(zend_copy_parameters_array(ZEND_NUM_ARGS(), &method_args TSRMLS_CC) == FAILURE)) {
if (UNEXPECTED(zend_copy_parameters_array(ZEND_NUM_ARGS(), &method_args) == FAILURE)) {
zval_dtor(&method_args);
zend_error_noreturn(E_ERROR, "Cannot get arguments for " ZEND_CALLSTATIC_FUNC_NAME);
RETURN_FALSE;
@ -1108,7 +1108,7 @@ static inline union _zend_function *zend_get_user_callstatic_function(zend_class
/* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */
ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_string *function_name, const zval *key TSRMLS_DC) /* {{{ */
ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_string *function_name, const zval *key) /* {{{ */
{
zend_function *fbc = NULL;
char *lc_class_name;
@ -1142,7 +1142,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
}
if (ce->__call &&
Z_OBJ(EG(current_execute_data)->This) &&
instanceof_function(Z_OBJCE(EG(current_execute_data)->This), ce TSRMLS_CC)) {
instanceof_function(Z_OBJCE(EG(current_execute_data)->This), ce)) {
return zend_get_user_call_function(ce, function_name);
} else if (ce->__callstatic) {
return zend_get_user_callstatic_function(ce, function_name);
@ -1166,7 +1166,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
updated_fbc = zend_check_private_int(fbc, EG(scope), lc_function_name TSRMLS_CC);
updated_fbc = zend_check_private_int(fbc, EG(scope), lc_function_name);
if (EXPECTED(updated_fbc != NULL)) {
fbc = updated_fbc;
} else {
@ -1196,7 +1196,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
}
/* }}} */
ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent, void **cache_slot TSRMLS_DC) /* {{{ */
ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent, void **cache_slot) /* {{{ */
{
zend_property_info *property_info;
@ -1210,7 +1210,7 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p
return NULL;
}
if (UNEXPECTED(!zend_verify_property_access(property_info, ce TSRMLS_CC))) {
if (UNEXPECTED(!zend_verify_property_access(property_info, ce))) {
if (!silent) {
zend_error_noreturn(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ce->name->val, property_name->val);
}
@ -1224,7 +1224,7 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p
return NULL;
}
zend_update_class_constants(ce TSRMLS_CC);
zend_update_class_constants(ce);
if (EXPECTED(cache_slot != NULL)) {
CACHE_POLYMORPHIC_PTR_EX(cache_slot, ce, property_info);
@ -1243,14 +1243,14 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p
}
/* }}} */
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name, void **cache_slot TSRMLS_DC) /* {{{ */
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name, void **cache_slot) /* {{{ */
{
zend_error_noreturn(E_ERROR, "Attempt to unset static property %s::$%s", ce->name->val, property_name->val);
return 0;
}
/* }}} */
ZEND_API union _zend_function *zend_std_get_constructor(zend_object *zobj TSRMLS_DC) /* {{{ */
ZEND_API union _zend_function *zend_std_get_constructor(zend_object *zobj) /* {{{ */
{
zend_function *constructor = zobj->ce->constructor;
@ -1286,9 +1286,9 @@ ZEND_API union _zend_function *zend_std_get_constructor(zend_object *zobj TSRMLS
}
/* }}} */
int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC);
int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2);
static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
static int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */
{
zend_object *zobj1, *zobj2;
@ -1310,7 +1310,7 @@ static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
zval *p1 = &zobj1->properties_table[i];
zval *p2 = &zobj2->properties_table[i];
if (compare_function(&result, p1, p2 TSRMLS_CC)==FAILURE) {
if (compare_function(&result, p1, p2)==FAILURE) {
Z_OBJ_UNPROTECT_RECURSION(o1);
Z_OBJ_UNPROTECT_RECURSION(o2);
return 1;
@ -1343,12 +1343,12 @@ static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
if (!zobj2->properties) {
rebuild_object_properties(zobj2);
}
return zend_compare_symbol_tables_i(zobj1->properties, zobj2->properties TSRMLS_CC);
return zend_compare_symbol_tables_i(zobj1->properties, zobj2->properties);
}
}
/* }}} */
static int zend_std_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot TSRMLS_DC) /* {{{ */
static int zend_std_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
{
zend_object *zobj;
int result;
@ -1365,7 +1365,7 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists,
cache_slot = NULL;
}
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), 1, 0, cache_slot TSRMLS_CC);
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), 1, 0, cache_slot);
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
if (EXPECTED(property_info != NULL)) {
@ -1382,7 +1382,7 @@ found:
result = (Z_TYPE_P(value) != IS_NULL);
break;
default:
result = zend_is_true(value TSRMLS_CC);
result = zend_is_true(value);
break;
case 2:
result = 1;
@ -1403,17 +1403,17 @@ found:
/* have issetter - try with it! */
ZVAL_COPY(&tmp_object, object);
(*guard) |= IN_ISSET; /* prevent circular getting */
zend_std_call_issetter(&tmp_object, member, &rv TSRMLS_CC);
zend_std_call_issetter(&tmp_object, member, &rv);
if (Z_TYPE(rv) != IS_UNDEF) {
result = zend_is_true(&rv TSRMLS_CC);
result = zend_is_true(&rv);
zval_ptr_dtor(&rv);
if (has_set_exists && result) {
if (EXPECTED(!EG(exception)) && zobj->ce->__get && !((*guard) & IN_GET)) {
(*guard) |= IN_GET;
zend_std_call_getter(&tmp_object, member, &rv TSRMLS_CC);
zend_std_call_getter(&tmp_object, member, &rv);
(*guard) &= ~IN_GET;
if (Z_TYPE(rv) != IS_UNDEF) {
result = i_zend_is_true(&rv TSRMLS_CC);
result = i_zend_is_true(&rv);
zval_ptr_dtor(&rv);
} else {
result = 0;
@ -1436,13 +1436,13 @@ exit:
}
/* }}} */
zend_string *zend_std_object_get_class_name(const zend_object *zobj TSRMLS_DC) /* {{{ */
zend_string *zend_std_object_get_class_name(const zend_object *zobj) /* {{{ */
{
return zend_string_copy(zobj->ce->name);
}
/* }}} */
ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type TSRMLS_DC) /* {{{ */
ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type) /* {{{ */
{
zval retval;
zend_class_entry *ce;
@ -1488,7 +1488,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
return SUCCESS;
case IS_DOUBLE:
ce = Z_OBJCE_P(readobj);
zend_error(E_NOTICE, "Object of class %s could not be converted to double", ce->name->val);
zend_error(E_NOTICE, "Object of class %s could not be converted to float", ce->name->val);
if (readobj == writeobj) {
zval_dtor(readobj);
}
@ -1502,7 +1502,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
}
/* }}} */
int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr TSRMLS_DC) /* {{{ */
int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr) /* {{{ */
{
zval *func;
zend_class_entry *ce;

View file

@ -33,10 +33,10 @@ struct _zend_property_info;
symbol table, its reference count should be 0.
*/
/* Used to fetch property from the object, read-only */
typedef zval *(*zend_object_read_property_t)(zval *object, zval *member, int type, void **cache_slot, zval *rv TSRMLS_DC);
typedef zval *(*zend_object_read_property_t)(zval *object, zval *member, int type, void **cache_slot, zval *rv);
/* Used to fetch dimension from the object, read-only */
typedef zval *(*zend_object_read_dimension_t)(zval *object, zval *offset, int type, zval *rv TSRMLS_DC);
typedef zval *(*zend_object_read_dimension_t)(zval *object, zval *offset, int type, zval *rv);
/* The following rule applies to write_property() and write_dimension() implementations:
@ -45,23 +45,23 @@ typedef zval *(*zend_object_read_dimension_t)(zval *object, zval *offset, int ty
any changes. You should NOT modify the reference count of the value passed to you.
*/
/* Used to set property of the object */
typedef void (*zend_object_write_property_t)(zval *object, zval *member, zval *value, void **cache_slot TSRMLS_DC);
typedef void (*zend_object_write_property_t)(zval *object, zval *member, zval *value, void **cache_slot);
/* Used to set dimension of the object */
typedef void (*zend_object_write_dimension_t)(zval *object, zval *offset, zval *value TSRMLS_DC);
typedef void (*zend_object_write_dimension_t)(zval *object, zval *offset, zval *value);
/* Used to create pointer to the property of the object, for future direct r/w access */
typedef zval *(*zend_object_get_property_ptr_ptr_t)(zval *object, zval *member, int type, void **cache_slot TSRMLS_DC);
typedef zval *(*zend_object_get_property_ptr_ptr_t)(zval *object, zval *member, int type, void **cache_slot);
/* Used to set object value. Can be used to override assignments and scalar
write ops (like ++, +=) on the object */
typedef void (*zend_object_set_t)(zval *object, zval *value TSRMLS_DC);
typedef void (*zend_object_set_t)(zval *object, zval *value);
/* Used to get object value. Can be used when converting object value to
* one of the basic types and when using scalar ops (like ++, +=) on the object
*/
typedef zval* (*zend_object_get_t)(zval *object, zval *rv TSRMLS_DC);
typedef zval* (*zend_object_get_t)(zval *object, zval *rv);
/* Used to check if a property of the object exists */
/* param has_set_exists:
@ -69,55 +69,55 @@ typedef zval* (*zend_object_get_t)(zval *object, zval *rv TSRMLS_DC);
* 1 (set) whether property exists and is true
* 2 (exists) whether property exists
*/
typedef int (*zend_object_has_property_t)(zval *object, zval *member, int has_set_exists, void **cache_slot TSRMLS_DC);
typedef int (*zend_object_has_property_t)(zval *object, zval *member, int has_set_exists, void **cache_slot);
/* Used to check if a dimension of the object exists */
typedef int (*zend_object_has_dimension_t)(zval *object, zval *member, int check_empty TSRMLS_DC);
typedef int (*zend_object_has_dimension_t)(zval *object, zval *member, int check_empty);
/* Used to remove a property of the object */
typedef void (*zend_object_unset_property_t)(zval *object, zval *member, void **cache_slot TSRMLS_DC);
typedef void (*zend_object_unset_property_t)(zval *object, zval *member, void **cache_slot);
/* Used to remove a dimension of the object */
typedef void (*zend_object_unset_dimension_t)(zval *object, zval *offset TSRMLS_DC);
typedef void (*zend_object_unset_dimension_t)(zval *object, zval *offset);
/* Used to get hash of the properties of the object, as hash of zval's */
typedef HashTable *(*zend_object_get_properties_t)(zval *object TSRMLS_DC);
typedef HashTable *(*zend_object_get_properties_t)(zval *object);
typedef HashTable *(*zend_object_get_debug_info_t)(zval *object, int *is_temp TSRMLS_DC);
typedef HashTable *(*zend_object_get_debug_info_t)(zval *object, int *is_temp);
/* Used to call methods */
/* args on stack! */
/* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback for this.
*/
typedef int (*zend_object_call_method_t)(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS);
typedef union _zend_function *(*zend_object_get_method_t)(zend_object **object, zend_string *method, const zval *key TSRMLS_DC);
typedef union _zend_function *(*zend_object_get_constructor_t)(zend_object *object TSRMLS_DC);
typedef union _zend_function *(*zend_object_get_method_t)(zend_object **object, zend_string *method, const zval *key);
typedef union _zend_function *(*zend_object_get_constructor_t)(zend_object *object);
/* Object maintenance/destruction */
typedef void (*zend_object_dtor_obj_t)(zend_object *object TSRMLS_DC);
typedef void (*zend_object_free_obj_t)(zend_object *object TSRMLS_DC);
typedef zend_object* (*zend_object_clone_obj_t)(zval *object TSRMLS_DC);
typedef void (*zend_object_dtor_obj_t)(zend_object *object);
typedef void (*zend_object_free_obj_t)(zend_object *object);
typedef zend_object* (*zend_object_clone_obj_t)(zval *object);
/* Get class name for display in var_dump and other debugging functions.
* Must be defined and must return a non-NULL value. */
typedef zend_string *(*zend_object_get_class_name_t)(const zend_object *object TSRMLS_DC);
typedef zend_string *(*zend_object_get_class_name_t)(const zend_object *object);
typedef int (*zend_object_compare_t)(zval *object1, zval *object2 TSRMLS_DC);
typedef int (*zend_object_compare_zvals_t)(zval *resul, zval *op1, zval *op2 TSRMLS_DC);
typedef int (*zend_object_compare_t)(zval *object1, zval *object2);
typedef int (*zend_object_compare_zvals_t)(zval *resul, zval *op1, zval *op2);
/* Cast an object to some other type
*/
typedef int (*zend_object_cast_t)(zval *readobj, zval *retval, int type TSRMLS_DC);
typedef int (*zend_object_cast_t)(zval *readobj, zval *retval, int type);
/* updates *count to hold the number of elements present and returns SUCCESS.
* Returns FAILURE if the object does not have any sense of overloaded dimensions */
typedef int (*zend_object_count_elements_t)(zval *object, zend_long *count TSRMLS_DC);
typedef int (*zend_object_count_elements_t)(zval *object, zend_long *count);
typedef int (*zend_object_get_closure_t)(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zend_object **obj_ptr TSRMLS_DC);
typedef int (*zend_object_get_closure_t)(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zend_object **obj_ptr);
typedef HashTable *(*zend_object_get_gc_t)(zval *object, zval **table, int *n TSRMLS_DC);
typedef HashTable *(*zend_object_get_gc_t)(zval *object, zval **table, int *n);
typedef int (*zend_object_do_operation_t)(zend_uchar opcode, zval *result, zval *op1, zval *op2 TSRMLS_DC);
typedef int (*zend_object_do_operation_t)(zend_uchar opcode, zval *result, zval *op1, zval *op2);
struct _zend_object_handlers {
/* offset of real object header (usually zero) */
@ -159,22 +159,22 @@ extern ZEND_API zend_object_handlers std_object_handlers;
((fbc)->common.prototype ? (fbc)->common.prototype->common.scope : (fbc)->common.scope)
BEGIN_EXTERN_C()
ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_string *function_name_strval, const zval *key TSRMLS_DC);
ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent, void **cache_slot TSRMLS_DC);
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name, void **cache_slot TSRMLS_DC);
ZEND_API union _zend_function *zend_std_get_constructor(zend_object *object TSRMLS_DC);
ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent TSRMLS_DC);
ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC);
ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC);
ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type TSRMLS_DC);
ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, void **cache_slot TSRMLS_DC);
ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_string *function_name_strval, const zval *key);
ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent, void **cache_slot);
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name, void **cache_slot);
ZEND_API union _zend_function *zend_std_get_constructor(zend_object *object);
ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent);
ZEND_API HashTable *zend_std_get_properties(zval *object);
ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp);
ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type);
ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, void **cache_slot);
ZEND_API void rebuild_object_properties(zend_object *zobj);
ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, zend_string *function_name TSRMLS_DC);
ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, zend_string *function_name);
ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope);
ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name TSRMLS_DC);
ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name);
ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS);
END_EXTERN_C()

View file

@ -26,14 +26,14 @@
#include "zend_interfaces.h"
#include "zend_exceptions.h"
ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC)
ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce)
{
GC_REFCOUNT(object) = 1;
GC_TYPE_INFO(object) = IS_OBJECT;
object->ce = ce;
object->properties = NULL;
object->guards = NULL;
zend_objects_store_put(object TSRMLS_CC);
zend_objects_store_put(object);
if (EXPECTED(ce->default_properties_count != 0)) {
zval *p = object->properties_table;
zval *end = p + ce->default_properties_count;
@ -45,7 +45,7 @@ ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSR
}
}
ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC)
ZEND_API void zend_object_std_dtor(zend_object *object)
{
int i, count;
@ -54,16 +54,16 @@ ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC)
FREE_HASHTABLE(object->guards);
}
if (object->properties) {
zend_array_destroy(object->properties TSRMLS_CC);
zend_array_destroy(object->properties);
FREE_HASHTABLE(object->properties);
}
count = object->ce->default_properties_count;
for (i = 0; i < count; i++) {
i_zval_ptr_dtor(&object->properties_table[i] ZEND_FILE_LINE_CC TSRMLS_CC);
i_zval_ptr_dtor(&object->properties_table[i] ZEND_FILE_LINE_CC);
}
}
ZEND_API void zend_objects_destroy_object(zend_object *object TSRMLS_DC)
ZEND_API void zend_objects_destroy_object(zend_object *object)
{
zend_function *destructor = object ? object->ce->destructor : NULL;
@ -120,7 +120,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object TSRMLS_DC)
zend_call_method_with_0_params(&obj, object->ce, &destructor, ZEND_DESTRUCTOR_FUNC_NAME, NULL);
if (old_exception) {
if (EG(exception)) {
zend_exception_set_previous(EG(exception), old_exception TSRMLS_CC);
zend_exception_set_previous(EG(exception), old_exception);
} else {
EG(exception) = old_exception;
}
@ -129,16 +129,16 @@ ZEND_API void zend_objects_destroy_object(zend_object *object TSRMLS_DC)
}
}
ZEND_API zend_object *zend_objects_new(zend_class_entry *ce TSRMLS_DC)
ZEND_API zend_object *zend_objects_new(zend_class_entry *ce)
{
zend_object *object = emalloc(sizeof(zend_object) + sizeof(zval) * (ce->default_properties_count - 1));
zend_object_std_init(object, ce TSRMLS_CC);
zend_object_std_init(object, ce);
object->handlers = &std_object_handlers;
return object;
}
ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object *old_object TSRMLS_DC)
ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object *old_object)
{
int i;
@ -167,9 +167,9 @@ ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object *o
zval_add_ref(&new_prop);
}
if (key) {
zend_hash_update(new_object->properties, key, &new_prop);
zend_hash_add_new(new_object->properties, key, &new_prop);
} else {
zend_hash_index_update(new_object->properties, num_key, &new_prop);
zend_hash_index_add_new(new_object->properties, num_key, &new_prop);
}
} ZEND_HASH_FOREACH_END();
}
@ -184,7 +184,7 @@ ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object *o
}
}
ZEND_API zend_object *zend_objects_clone_obj(zval *zobject TSRMLS_DC)
ZEND_API zend_object *zend_objects_clone_obj(zval *zobject)
{
zend_object *old_object;
zend_object *new_object;
@ -192,9 +192,9 @@ ZEND_API zend_object *zend_objects_clone_obj(zval *zobject TSRMLS_DC)
/* assume that create isn't overwritten, so when clone depends on the
* overwritten one then it must itself be overwritten */
old_object = Z_OBJ_P(zobject);
new_object = zend_objects_new(old_object->ce TSRMLS_CC);
new_object = zend_objects_new(old_object->ce);
zend_objects_clone_members(new_object, old_object TSRMLS_CC);
zend_objects_clone_members(new_object, old_object);
return new_object;
}

View file

@ -25,12 +25,12 @@
#include "zend.h"
BEGIN_EXTERN_C()
ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC);
ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC);
ZEND_API zend_object *zend_objects_new(zend_class_entry *ce TSRMLS_DC);
ZEND_API void zend_objects_destroy_object(zend_object *object TSRMLS_DC);
ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object *old_object TSRMLS_DC);
ZEND_API zend_object *zend_objects_clone_obj(zval *object TSRMLS_DC);
ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce);
ZEND_API void zend_object_std_dtor(zend_object *object);
ZEND_API zend_object *zend_objects_new(zend_class_entry *ce);
ZEND_API void zend_objects_destroy_object(zend_object *object);
ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object *old_object);
ZEND_API zend_object *zend_objects_clone_obj(zval *object);
END_EXTERN_C()
#endif /* ZEND_OBJECTS_H */

View file

@ -40,7 +40,7 @@ ZEND_API void zend_objects_store_destroy(zend_objects_store *objects)
objects->object_buckets = NULL;
}
ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC)
ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects)
{
uint32_t i;
@ -51,14 +51,14 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
if (!(GC_FLAGS(obj) & IS_OBJ_DESTRUCTOR_CALLED)) {
GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED;
GC_REFCOUNT(obj)++;
obj->handlers->dtor_obj(obj TSRMLS_CC);
obj->handlers->dtor_obj(obj);
GC_REFCOUNT(obj)--;
}
}
}
}
ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSRMLS_DC)
ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects)
{
uint32_t i;
@ -74,7 +74,7 @@ ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSR
}
}
ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects TSRMLS_DC)
ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects)
{
uint32_t i;
@ -87,7 +87,7 @@ ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects
GC_FLAGS(obj) |= IS_OBJ_FREE_CALLED;
if (obj->handlers->free_obj) {
GC_REFCOUNT(obj)++;
obj->handlers->free_obj(obj TSRMLS_CC);
obj->handlers->free_obj(obj);
GC_REFCOUNT(obj)--;
}
}
@ -110,7 +110,7 @@ ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects
/* Store objects API */
ZEND_API void zend_objects_store_put(zend_object *object TSRMLS_DC)
ZEND_API void zend_objects_store_put(zend_object *object)
{
int handle;
@ -132,7 +132,7 @@ ZEND_API void zend_objects_store_put(zend_object *object TSRMLS_DC)
SET_OBJ_BUCKET_NUMBER(EG(objects_store).object_buckets[handle], EG(objects_store).free_list_head); \
EG(objects_store).free_list_head = handle;
ZEND_API void zend_objects_store_free(zend_object *object TSRMLS_DC) /* {{{ */
ZEND_API void zend_objects_store_free(zend_object *object) /* {{{ */
{
uint32_t handle = object->handle;
void *ptr = ((char*)object) - object->handlers->offset;
@ -143,7 +143,7 @@ ZEND_API void zend_objects_store_free(zend_object *object TSRMLS_DC) /* {{{ */
}
/* }}} */
ZEND_API void zend_objects_store_del(zend_object *object TSRMLS_DC) /* {{{ */
ZEND_API void zend_objects_store_del(zend_object *object) /* {{{ */
{
/* Make sure we hold a reference count during the destructor call
otherwise, when the destructor ends the storage might be freed
@ -160,7 +160,7 @@ ZEND_API void zend_objects_store_del(zend_object *object TSRMLS_DC) /* {{{ */
if (object->handlers->dtor_obj) {
GC_REFCOUNT(object)++;
zend_try {
object->handlers->dtor_obj(object TSRMLS_CC);
object->handlers->dtor_obj(object);
} zend_catch {
failure = 1;
} zend_end_try();
@ -178,7 +178,7 @@ ZEND_API void zend_objects_store_del(zend_object *object TSRMLS_DC) /* {{{ */
if (object->handlers->free_obj) {
zend_try {
GC_REFCOUNT(object)++;
object->handlers->free_obj(object TSRMLS_CC);
object->handlers->free_obj(object);
GC_REFCOUNT(object)--;
} zend_catch {
failure = 1;
@ -208,13 +208,13 @@ ZEND_API void zend_objects_store_del(zend_object *object TSRMLS_DC) /* {{{ */
* from the constructor function. You MUST NOT use this function for any other
* weird games, or call it at any other time after the object is constructed.
* */
ZEND_API void zend_object_store_set_object(zval *zobject, zend_object *object TSRMLS_DC)
ZEND_API void zend_object_store_set_object(zval *zobject, zend_object *object)
{
EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(zobject)] = object;
}
/* Called when the ctor was terminated by an exception */
ZEND_API void zend_object_store_ctor_failed(zend_object *obj TSRMLS_DC)
ZEND_API void zend_object_store_ctor_failed(zend_object *obj)
{
GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED;
}

View file

@ -37,7 +37,7 @@
} while (0)
#define OBJ_RELEASE(obj) zend_object_release(obj TSRMLS_CC)
#define OBJ_RELEASE(obj) zend_object_release(obj)
typedef struct _zend_objects_store {
zend_object **object_buckets;
@ -49,34 +49,34 @@ typedef struct _zend_objects_store {
/* Global store handling functions */
BEGIN_EXTERN_C()
ZEND_API void zend_objects_store_init(zend_objects_store *objects, uint32_t init_size);
ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC);
ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSRMLS_DC);
ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects);
ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects);
ZEND_API void zend_objects_store_destroy(zend_objects_store *objects);
/* Store API functions */
ZEND_API void zend_objects_store_put(zend_object *object TSRMLS_DC);
ZEND_API void zend_objects_store_del(zend_object *object TSRMLS_DC);
ZEND_API void zend_objects_store_free(zend_object *object TSRMLS_DC);
ZEND_API void zend_objects_store_put(zend_object *object);
ZEND_API void zend_objects_store_del(zend_object *object);
ZEND_API void zend_objects_store_free(zend_object *object);
/* See comment in zend_objects_API.c before you use this */
ZEND_API void zend_object_store_set_object(zval *zobject, zend_object *object TSRMLS_DC);
ZEND_API void zend_object_store_ctor_failed(zend_object *object TSRMLS_DC);
ZEND_API void zend_object_store_set_object(zval *zobject, zend_object *object);
ZEND_API void zend_object_store_ctor_failed(zend_object *object);
ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects TSRMLS_DC);
ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects);
#define ZEND_OBJECTS_STORE_HANDLERS 0, zend_object_std_dtor, zend_objects_destroy_object, zend_objects_clone_obj
ZEND_API zend_object *zend_object_create_proxy(zval *object, zval *member TSRMLS_DC);
ZEND_API zend_object *zend_object_create_proxy(zval *object, zval *member);
ZEND_API zend_object_handlers *zend_get_std_object_handlers(void);
END_EXTERN_C()
static zend_always_inline void zend_object_release(zend_object *obj TSRMLS_DC)
static zend_always_inline void zend_object_release(zend_object *obj)
{
if (--GC_REFCOUNT(obj) == 0) {
zend_objects_store_del(obj TSRMLS_CC);
zend_objects_store_del(obj);
} else if (UNEXPECTED(!GC_INFO(obj))) {
gc_possible_root(&obj->gc TSRMLS_CC);
gc_possible_root(&obj->gc);
}
}

View file

@ -29,14 +29,14 @@
#include "zend_vm.h"
static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array)
{
if (extension->op_array_ctor) {
extension->op_array_ctor(op_array);
}
}
static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array)
{
if (extension->op_array_dtor) {
extension->op_array_dtor(op_array);
@ -48,7 +48,7 @@ static void op_array_alloc_ops(zend_op_array *op_array, uint32_t size)
op_array->opcodes = erealloc(op_array->opcodes, size * sizeof(zend_op));
}
void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC)
void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size)
{
op_array->type = type;
@ -64,7 +64,7 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
op_array->T = 0;
op_array->function_name = NULL;
op_array->filename = zend_get_compiled_filename(TSRMLS_C);
op_array->filename = zend_get_compiled_filename();
op_array->doc_comment = NULL;
op_array->arg_info = NULL;
@ -95,13 +95,13 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
memset(op_array->reserved, 0, ZEND_MAX_RESERVED_RESOURCES * sizeof(void*));
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_ctor_handler, op_array TSRMLS_CC);
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_ctor_handler, op_array);
}
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC)
ZEND_API void destroy_zend_function(zend_function *function)
{
if (function->type == ZEND_USER_FUNCTION) {
destroy_op_array(&function->op_array TSRMLS_CC);
destroy_op_array(&function->op_array);
} else {
ZEND_ASSERT(function->type == ZEND_INTERNAL_FUNCTION);
ZEND_ASSERT(function->common.function_name);
@ -112,11 +112,10 @@ ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC)
ZEND_API void zend_function_dtor(zval *zv)
{
zend_function *function = Z_PTR_P(zv);
TSRMLS_FETCH();
if (function->type == ZEND_USER_FUNCTION) {
ZEND_ASSERT(function->common.function_name);
destroy_op_array(&function->op_array TSRMLS_CC);
destroy_op_array(&function->op_array);
/* op_arrays are allocated on arena, so we don't have to free them */
//??? efree_size(function, sizeof(zend_op_array));
} else {
@ -136,7 +135,7 @@ ZEND_API void zend_cleanup_op_array_data(zend_op_array *op_array)
}
}
ZEND_API void zend_cleanup_user_class_data(zend_class_entry *ce TSRMLS_DC)
ZEND_API void zend_cleanup_user_class_data(zend_class_entry *ce)
{
/* 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
@ -166,7 +165,7 @@ ZEND_API void zend_cleanup_user_class_data(zend_class_entry *ce TSRMLS_DC)
}
}
ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce TSRMLS_DC)
ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce)
{
if (CE_STATIC_MEMBERS(ce)) {
int i;
@ -313,7 +312,7 @@ void zend_class_add_ref(zval *zv)
ce->refcount++;
}
ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
ZEND_API void destroy_op_array(zend_op_array *op_array)
{
zval *literal = op_array->literals;
zval *end;
@ -366,7 +365,7 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
efree(op_array->try_catch_array);
}
if (op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) {
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_dtor_handler, op_array TSRMLS_CC);
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_dtor_handler, op_array);
}
if (op_array->arg_info) {
for (i=0; i<op_array->num_args; i++) {
@ -379,14 +378,14 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
}
}
void init_op(zend_op *op TSRMLS_DC)
void init_op(zend_op *op)
{
memset(op, 0, sizeof(zend_op));
op->lineno = CG(zend_lineno);
SET_UNUSED(op->result);
}
zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC)
zend_op *get_next_op(zend_op_array *op_array)
{
uint32_t next_op_num = op_array->last++;
zend_op *next_op;
@ -398,7 +397,7 @@ zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC)
next_op = &(op_array->opcodes[next_op_num]);
init_op(next_op TSRMLS_CC);
init_op(next_op);
return next_op;
}
@ -415,7 +414,7 @@ zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array)
return &op_array->brk_cont_array[op_array->last_brk_cont-1];
}
static void zend_update_extended_info(zend_op_array *op_array TSRMLS_DC)
static void zend_update_extended_info(zend_op_array *op_array)
{
zend_op *opline = op_array->opcodes, *end=opline+op_array->last;
@ -438,14 +437,14 @@ static void zend_update_extended_info(zend_op_array *op_array TSRMLS_DC)
}
}
static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array)
{
if (extension->op_array_handler) {
extension->op_array_handler(op_array);
}
}
static void zend_check_finally_breakout(zend_op_array *op_array, uint32_t op_num, uint32_t dst_num TSRMLS_DC)
static void zend_check_finally_breakout(zend_op_array *op_array, uint32_t op_num, uint32_t dst_num)
{
int i;
@ -470,7 +469,7 @@ static void zend_check_finally_breakout(zend_op_array *op_array, uint32_t op_num
}
}
static void zend_adjust_fast_call(zend_op_array *op_array, uint32_t fast_call, uint32_t start, uint32_t end TSRMLS_DC)
static void zend_adjust_fast_call(zend_op_array *op_array, uint32_t fast_call, uint32_t start, uint32_t end)
{
int i;
uint32_t op_num = 0;
@ -491,7 +490,7 @@ static void zend_adjust_fast_call(zend_op_array *op_array, uint32_t fast_call, u
}
}
static void zend_resolve_fast_call(zend_op_array *op_array, uint32_t fast_call, uint32_t op_num TSRMLS_DC)
static void zend_resolve_fast_call(zend_op_array *op_array, uint32_t fast_call, uint32_t op_num)
{
int i;
uint32_t finally_op_num = 0;
@ -513,14 +512,14 @@ static void zend_resolve_fast_call(zend_op_array *op_array, uint32_t fast_call,
}
}
static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num, uint32_t dst_num TSRMLS_DC)
static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num, uint32_t dst_num)
{
uint32_t start_op;
zend_op *opline;
uint32_t i = op_array->last_try_catch;
if (dst_num != (uint32_t)-1) {
zend_check_finally_breakout(op_array, op_num, dst_num TSRMLS_CC);
zend_check_finally_breakout(op_array, op_num, dst_num);
}
/* the backward order is mater */
@ -541,7 +540,7 @@ static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num,
/* generate a FAST_CALL to finally block */
start_op = get_next_op_number(op_array);
opline = get_next_op(op_array TSRMLS_CC);
opline = get_next_op(op_array);
opline->opcode = ZEND_FAST_CALL;
opline->result_type = IS_TMP_VAR;
opline->result.var = fast_call_var;
@ -549,21 +548,21 @@ static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num,
SET_UNUSED(opline->op2);
zend_adjust_fast_call(op_array, start_op,
op_array->try_catch_array[i].finally_op,
op_array->try_catch_array[i].finally_end TSRMLS_CC);
op_array->try_catch_array[i].finally_end);
if (op_array->try_catch_array[i].catch_op) {
opline->extended_value = ZEND_FAST_CALL_FROM_CATCH;
opline->op2.opline_num = op_array->try_catch_array[i].catch_op;
opline->op1.opline_num = get_next_op_number(op_array);
/* generate a FAST_CALL to hole CALL_FROM_FINALLY */
opline = get_next_op(op_array TSRMLS_CC);
opline = get_next_op(op_array);
opline->opcode = ZEND_FAST_CALL;
opline->result_type = IS_TMP_VAR;
opline->result.var = fast_call_var;
SET_UNUSED(opline->op1);
SET_UNUSED(opline->op2);
zend_resolve_fast_call(op_array, start_op + 1, op_array->try_catch_array[i].finally_op - 2 TSRMLS_CC);
zend_resolve_fast_call(op_array, start_op + 1, op_array->try_catch_array[i].finally_op - 2);
} else {
zend_resolve_fast_call(op_array, start_op, op_array->try_catch_array[i].finally_op - 2 TSRMLS_CC);
zend_resolve_fast_call(op_array, start_op, op_array->try_catch_array[i].finally_op - 2);
}
opline->op1.opline_num = op_array->try_catch_array[i].finally_op;
@ -576,7 +575,7 @@ static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num,
(dst_num < op_array->try_catch_array[i].try_op ||
dst_num > op_array->try_catch_array[i].finally_end)) {
opline = get_next_op(op_array TSRMLS_CC);
opline = get_next_op(op_array);
opline->opcode = ZEND_FAST_CALL;
opline->result_type = IS_TMP_VAR;
opline->result.var = fast_call_var;
@ -587,7 +586,7 @@ static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num,
}
/* Finish the sequence with original opcode */
opline = get_next_op(op_array TSRMLS_CC);
opline = get_next_op(op_array);
*opline = op_array->opcodes[op_num];
/* Replace original opcode with jump to this sequence */
@ -602,7 +601,7 @@ static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num,
}
}
static void zend_resolve_finally_ret(zend_op_array *op_array, uint32_t op_num TSRMLS_DC)
static void zend_resolve_finally_ret(zend_op_array *op_array, uint32_t op_num)
{
int i;
uint32_t catch_op_num = 0, finally_op_num = 0;
@ -630,7 +629,7 @@ static void zend_resolve_finally_ret(zend_op_array *op_array, uint32_t op_num TS
}
}
static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
static void zend_resolve_finally_calls(zend_op_array *op_array)
{
uint32_t i, j;
zend_op *opline;
@ -641,7 +640,7 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
case ZEND_RETURN:
case ZEND_RETURN_BY_REF:
case ZEND_GENERATOR_RETURN:
zend_resolve_finally_call(op_array, i, (uint32_t)-1 TSRMLS_CC);
zend_resolve_finally_call(op_array, i, (uint32_t)-1);
break;
case ZEND_BRK:
case ZEND_CONT:
@ -657,7 +656,7 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
array_offset = jmp_to->parent;
}
} while (--nest_levels > 0);
zend_resolve_finally_call(op_array, i, opline->opcode == ZEND_BRK ? jmp_to->brk : jmp_to->cont TSRMLS_CC);
zend_resolve_finally_call(op_array, i, opline->opcode == ZEND_BRK ? jmp_to->brk : jmp_to->cont);
break;
}
}
@ -666,18 +665,18 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
uint32_t num = opline->op2.constant;
ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline->op2);
zend_resolve_goto_label(op_array, opline, 1 TSRMLS_CC);
zend_resolve_goto_label(op_array, opline, 1);
opline->op2.constant = num;
}
/* break omitted intentionally */
case ZEND_JMP:
zend_resolve_finally_call(op_array, i, opline->op1.opline_num TSRMLS_CC);
zend_resolve_finally_call(op_array, i, opline->op1.opline_num);
break;
case ZEND_FAST_CALL:
zend_resolve_fast_call(op_array, i, i TSRMLS_CC);
zend_resolve_fast_call(op_array, i, i);
break;
case ZEND_FAST_RET:
zend_resolve_finally_ret(op_array, i TSRMLS_CC);
zend_resolve_finally_ret(op_array, i);
break;
default:
break;
@ -685,7 +684,7 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
}
}
ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
ZEND_API int pass_two(zend_op_array *op_array)
{
zend_op *opline, *end;
@ -693,13 +692,13 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
return 0;
}
if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
zend_resolve_finally_calls(op_array TSRMLS_CC);
zend_resolve_finally_calls(op_array);
}
if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO) {
zend_update_extended_info(op_array TSRMLS_CC);
zend_update_extended_info(op_array);
}
if (CG(compiler_options) & ZEND_COMPILE_HANDLE_OP_ARRAY) {
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array TSRMLS_CC);
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array);
}
if (CG(context).vars_size != op_array->last_var) {
@ -737,7 +736,7 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
break;
case ZEND_GOTO:
if (Z_TYPE_P(RT_CONSTANT(op_array, opline->op2)) != IS_LONG) {
zend_resolve_goto_label(op_array, opline, 1 TSRMLS_CC);
zend_resolve_goto_label(op_array, opline, 1);
}
/* break omitted intentionally */
case ZEND_JMP:
@ -779,15 +778,15 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
return 0;
}
int pass_two_wrapper(zval *el TSRMLS_DC)
int pass_two_wrapper(zval *el)
{
return pass_two((zend_op_array *) Z_PTR_P(el) TSRMLS_CC);
return pass_two((zend_op_array *) Z_PTR_P(el));
}
int print_class(zend_class_entry *class_entry TSRMLS_DC)
int print_class(zend_class_entry *class_entry)
{
printf("Class %s:\n", class_entry->name->val);
zend_hash_apply(&class_entry->function_table, pass_two_wrapper TSRMLS_CC);
zend_hash_apply(&class_entry->function_table, pass_two_wrapper);
printf("End of class %s.\n\n", class_entry->name->val);
return 0;
}

Some files were not shown because too many files have changed in this diff Show more