mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Merge branch 'master' into jsond
Conflicts: ext/json/JSON_parser.c ext/json/json.c
This commit is contained in:
commit
3159d518d0
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -49,7 +49,6 @@ UPGRADING.INTERNALS merge=NEWS
|
||||
/ext/spl/tests/SplArray_fromArray.phpt -crlf
|
||||
/ext/standard/tests/dir/scandir_variation3.phpt -crlf
|
||||
/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt -crlf
|
||||
/ext/standard/tests/general_functions/set_magic_quotes_runtime_error.phpt -crlf
|
||||
/ext/standard/tests/strings/bug26817.phpt -crlf
|
||||
/ext/standard/tests/strings/bug26973.phpt -crlf
|
||||
/ext/standard/tests/strings/bug27457.phpt -crlf
|
||||
|
@ -136,7 +136,7 @@ STATUS: Working
|
||||
COMMENT: DBM abstraction for db2, db3, db4, dbm, ndbm, gdbm, ini
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: interbase
|
||||
PRIMARY MAINTAINER: Ard Biesheuvel <ard@ard.nu>, Jouni Ahto <jouni.ahto@exdec.fi>
|
||||
PRIMARY MAINTAINER: Ard Biesheuvel <ard@ard.nu>
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2014 The PHP Group. All rights reserved.
|
||||
Copyright (c) 1999 - 2015 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
18
NEWS
18
NEWS
@ -34,13 +34,19 @@
|
||||
. 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)
|
||||
. Implemented FR #55428 (E_RECOVERABLE_ERROR when output buffering in output buffering handler). (Kalle)
|
||||
. Removed scoped calls of non-static methods from an incompatible $this
|
||||
context. (Nikita)
|
||||
. Removed support for #-style comments in ini files. (Nikita)
|
||||
. Invalid octal literals in source code now produce compile errors, fixes PHPSadness #31. (Andrea)
|
||||
|
||||
- Date:
|
||||
. Fixed day_of_week function as it could sometimes return negative values
|
||||
internally. (Derick)
|
||||
. Removed $is_dst parameter from mktime() and gmmktime(). (Nikita)
|
||||
|
||||
- DBA:
|
||||
. Fixed bug #62490 (dba_delete returns true on missing item (inifile)). (Mike)
|
||||
. Fixed bug #68711 (useless comparisons). (bugreports at internot dot info)
|
||||
|
||||
- DOM:
|
||||
. Made DOMNode::textContent writeable. (Tjerk)
|
||||
@ -65,10 +71,15 @@
|
||||
. Fixed possible read after end of buffer and use after free. (Dmitry)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug (try block removed while combined with xdebug). (Laruence)
|
||||
. Fixed bug with try blocks being removed when extended_info opcode
|
||||
generation is turned on. (Laruence)
|
||||
. Fixed bug #68644 (strlen incorrect : mbstring + func_overload=2 +UTF-8
|
||||
+ Opcache). (Laruence)
|
||||
|
||||
- OpenSSL:
|
||||
. Fix bug #61285, #68329, #68046, #41631: encrypted streams don't observe
|
||||
socket timeouts (Brad Broerman)
|
||||
|
||||
- pcntl:
|
||||
. Fixed bug #60509 (pcntl_signal doesn't decrease ref-count of old handler
|
||||
when setting SIG_DFL). (Julien)
|
||||
@ -103,10 +114,15 @@
|
||||
. Fix user session handlers (See rfc:session.user.return-value). (Sara)
|
||||
. Added intdiv() function. (Andrea)
|
||||
. Improved precision of log() function for base 2 and 10. (Marc Bennewitz)
|
||||
. Remove string category support in setlocale(). (Nikita)
|
||||
. Remove set_magic_quotes_runtime() and its alias magic_quotes_runtime().
|
||||
(Nikita)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #68532 (convert.base64-encode omits padding bytes).
|
||||
(blaesius at krumedia dot de)
|
||||
. Removed set_socket_blocking() in favor of its alias stream_set_blocking().
|
||||
(Nikita)
|
||||
|
||||
- XSL:
|
||||
. Fixed bug #64776 (The XSLT extension is not thread safe). (Mike)
|
||||
|
@ -164,11 +164,11 @@ PHP_FUNCTION(module_name_drawtext)
|
||||
char *text = NULL;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
int image_id = -1;
|
||||
int text_len;
|
||||
size_t text_len;
|
||||
int font_id = -1;
|
||||
long x;
|
||||
long y;
|
||||
long color;
|
||||
zend_long x;
|
||||
zend_long y;
|
||||
zend_long color;
|
||||
zval *image = NULL;
|
||||
zval *font = NULL;
|
||||
|
||||
|
@ -196,11 +196,11 @@ last commit id to web/php.git, then, mirrors will now sync
|
||||
Getting the stable release announced
|
||||
------------------------------------
|
||||
|
||||
1. Run the bumpRelease script for phpweb on your local checkout
|
||||
1. Update phpweb/include/releases.inc with the old release info
|
||||
(updates the download archives)
|
||||
|
||||
a. ``php bin/bumpRelease 5`` to create the release file (releases/x_y_z.php)
|
||||
The release announcement file should list in detail security fixes and
|
||||
changes in behavior (whether due to a bug fix or not).
|
||||
a. You can run ``php bin/bumpRelease 5`` if you are making a release for the
|
||||
highest branch, otherwise you have to do this manually, see point 1.b
|
||||
|
||||
b. In case multiple PHP minor versions are in active development you have
|
||||
to manually copy the old information to include/releases.inc
|
||||
@ -220,8 +220,9 @@ Getting the stable release announced
|
||||
|
||||
f. if the windows builds aren't ready yet prefix the "windows" key with a dot (".windows")
|
||||
|
||||
3. Update phpweb/include/releases.php with the old release info
|
||||
(updates the download archives)
|
||||
3. Create the release file (releases/x_y_z.php)
|
||||
Usually we use the same content as for point 6, but included in php template
|
||||
instead of the release xml.
|
||||
|
||||
4. Update php-qa/include/release-qa.php and add the next version as an QARELEASE
|
||||
(prepare for next RC)
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
| Copyright (c) 1997-2015 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
| Copyright (c) 1997-2015 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
| Copyright (c) 1997-2015 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
| Copyright (c) 1997-2015 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
31
UPGRADING
31
UPGRADING
@ -54,7 +54,20 @@ PHP X.Y UPGRADE NOTES
|
||||
. zend_function.common.num_args don't include the variadic argument anymore.
|
||||
. ob_start() no longer issues an E_ERROR, but instead an E_RECOVERABLE_ERROR in case an
|
||||
output buffer is created in an output buffer handler.
|
||||
. Add zend_memnstr_ex, which is based on string matching sunday algo.
|
||||
. Removed support for scoped calls to non-static methods from an incompatible
|
||||
$this context. See details in https://wiki.php.net/rfc/incompat_ctx.
|
||||
. Removed support for #-style comments in ini files. Use ;-style comments
|
||||
instead.
|
||||
. Added zend_memnstr_ex, which is based on string matching sunday algo.
|
||||
. Added zend_memnrstr, zend_memnrstr_ex.
|
||||
. Added hybrid sorting algo zend_sort for better performance.
|
||||
. Added stable sorting algo zend_insert_sort.
|
||||
. Invalid octal literals in source code now produce compile errors, fixing
|
||||
PHPSadness #31. Previously, the invalid digits (and any following valid
|
||||
digits) were simply ignored, such that 0781 became 7.
|
||||
|
||||
- Date:
|
||||
. Removed $is_dst parameter from mktime() and gmmktime().
|
||||
|
||||
- DBA
|
||||
. dba_delete() now returns false if the key was not found for the inifile
|
||||
@ -65,6 +78,14 @@ PHP X.Y UPGRADE NOTES
|
||||
. gmp_setbit() and gmp_clrbit() now return FALSE for negative indices, making
|
||||
them consistent with other GMP functions.
|
||||
|
||||
- Standard:
|
||||
. Removed string category support in setlocale(). Use the LC_* constants
|
||||
instead.
|
||||
. Removed set_magic_quotes_runtime() and its alias magic_quotes_runtime().
|
||||
|
||||
- Stream:
|
||||
. Removed set_socket_blocking() in favor of its alias stream_set_blocking().
|
||||
|
||||
========================================
|
||||
2. New Features
|
||||
========================================
|
||||
@ -78,9 +99,6 @@ PHP X.Y UPGRADE NOTES
|
||||
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.
|
||||
|
||||
========================================
|
||||
3. Changes in SAPI modules
|
||||
========================================
|
||||
@ -112,7 +130,10 @@ PHP X.Y UPGRADE NOTES
|
||||
6. New Functions
|
||||
========================================
|
||||
- GMP
|
||||
. Added gmp_random_seed()
|
||||
. Added gmp_random_seed().
|
||||
|
||||
- Standard
|
||||
. Added intdiv() function for integer division.
|
||||
|
||||
========================================
|
||||
7. New Classes and Interfaces
|
||||
|
@ -15,6 +15,7 @@ PHP 7.0 INTERNALS UPGRADE NOTES
|
||||
n. ZEND_ENGINE_2 removal
|
||||
o. Updated final class modifier
|
||||
p. TSRM changes
|
||||
q. gc_collect_cycles() is now hookable
|
||||
|
||||
2. Build system changes
|
||||
a. Unix build system changes
|
||||
@ -169,6 +170,12 @@ PHP 7.0 INTERNALS UPGRADE NOTES
|
||||
Additionally, if an extension triggers its own threads, TSRMLS_CACHE shouldn't
|
||||
be passed to that threads directly.
|
||||
|
||||
q. gc_collect_cycles() is now a function pointer, and can be replaced in the
|
||||
same manner as zend_execute_ex() if needed (for example, to include the
|
||||
time spent in the garbage collector in a profiler). The default
|
||||
implementation has been renamed to zend_gc_collect_cycles(), and is
|
||||
exported with ZEND_API.
|
||||
|
||||
|
||||
========================
|
||||
2. Build system changes
|
||||
|
@ -13,7 +13,7 @@ libZend_la_SOURCES=\
|
||||
zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
|
||||
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
|
||||
zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
|
||||
zend_ini.c zend_qsort.c zend_objects.c zend_object_handlers.c \
|
||||
zend_ini.c zend_sort.c zend_objects.c zend_object_handlers.c \
|
||||
zend_objects_API.c zend_ts_hash.c zend_stream.c \
|
||||
zend_default_classes.c \
|
||||
zend_iterators.c zend_interfaces.c zend_exceptions.c \
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Bug #63055 (Segfault in zend_gc with SF2 testsuite)
|
||||
--INI--
|
||||
zend.enable_gc=1
|
||||
--FILE--
|
||||
<?php
|
||||
/* the default gc root size is 10,000 */
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Bug #64896 (Segfault with gc_collect_cycles using unserialize on certain objects)
|
||||
--INI--
|
||||
zend.enable_gc=1
|
||||
--FILE--
|
||||
<?php
|
||||
$bar = NULL;
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Constant arrays
|
||||
--INI--
|
||||
zend.enable_gc=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -85,7 +87,7 @@ array(4) {
|
||||
int(3)
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(3)
|
||||
&int(3)
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
|
@ -2,19 +2,17 @@
|
||||
Testing declare statement with several type values
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!ini_get("zend.multibyte")) {
|
||||
die("skip Requires zend.multibyte=1");
|
||||
}
|
||||
if (!extension_loaded("mbstring")) {
|
||||
die("skip Requires ext/mbstring");
|
||||
}
|
||||
?>
|
||||
--INI--
|
||||
zend.multibyte=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
declare(encoding = 1);
|
||||
declare(encoding = 1123131232131312321);
|
||||
declare(encoding = NULL);
|
||||
declare(encoding = 'utf-8');
|
||||
declare(encoding = M_PI);
|
||||
|
||||
@ -26,6 +24,4 @@ Warning: Unsupported encoding [%d] in %sdeclare_002.php on line 3
|
||||
|
||||
Warning: Unsupported encoding [%f] in %sdeclare_002.php on line 4
|
||||
|
||||
Warning: Unsupported encoding [] in %sdeclare_002.php on line 5
|
||||
|
||||
Fatal error: Cannot use constants as encoding in %sdeclare_002.php on line 7
|
||||
Fatal error: Encoding must be a literal in %sdeclare_002.php on line 6
|
||||
|
@ -1,17 +1,12 @@
|
||||
--TEST--
|
||||
Testing declare statement with several type values
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!ini_get("zend.multibyte")) {
|
||||
die("skip Requires zend.multibyte=1");
|
||||
}
|
||||
?>
|
||||
--INI--
|
||||
zend.multibyte=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
declare(encoding = 1);
|
||||
declare(encoding = 1123131232131312321);
|
||||
declare(encoding = NULL);
|
||||
declare(encoding = M_PI);
|
||||
|
||||
print 'DONE';
|
||||
@ -22,6 +17,4 @@ Warning: Unsupported encoding [%d] in %sdeclare_004.php on line 3
|
||||
|
||||
Warning: Unsupported encoding [%f] in %sdeclare_004.php on line 4
|
||||
|
||||
Warning: Unsupported encoding [] in %sdeclare_004.php on line 5
|
||||
|
||||
Fatal error: Cannot use constants as encoding in %sdeclare_004.php on line 6
|
||||
Fatal error: Encoding must be a literal in %sdeclare_004.php on line 5
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Testing each() with recursion
|
||||
--INI--
|
||||
zend.enable_gc=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Creating recursive array on foreach using same variable
|
||||
--INI--
|
||||
zend.enable_gc=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
9
Zend/tests/function_redecl.phpt
Normal file
9
Zend/tests/function_redecl.phpt
Normal file
@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
Function redeclaration must produce a simple fatal
|
||||
--FILE--
|
||||
<?php
|
||||
function f() {}
|
||||
function f() {}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot redeclare f() (previously declared in %s:%d) in %s on line %d
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
GC 032: Crash in GC because of invalid reference counting
|
||||
--INI--
|
||||
zend.enable_gc=1
|
||||
--FILE--
|
||||
<?php
|
||||
$a = array();
|
||||
|
@ -23,21 +23,16 @@ int(4096)
|
||||
string(43) "Call to a member function compare() on null"
|
||||
int(4096)
|
||||
string(43) "Call to a member function compare() on null"
|
||||
int(4096)
|
||||
string(43) "Call to a member function compare() on null"
|
||||
int(4096)
|
||||
string(43) "Call to a member function compare() on null"
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(-1)
|
||||
int(1)
|
||||
[1]=>
|
||||
int(3)
|
||||
int(4)
|
||||
[2]=>
|
||||
int(2)
|
||||
[3]=>
|
||||
int(4)
|
||||
int(3)
|
||||
[4]=>
|
||||
int(1)
|
||||
int(-1)
|
||||
}
|
||||
Alive
|
||||
|
||||
|
@ -10,9 +10,9 @@ precision=14
|
||||
$doubles = array(
|
||||
076545676543223,
|
||||
032325463734,
|
||||
077777797777777,
|
||||
07777777777777977777777777,
|
||||
03333333333333382222222222222,
|
||||
0777777,
|
||||
07777777777777,
|
||||
033333333333333,
|
||||
);
|
||||
|
||||
foreach ($doubles as $d) {
|
||||
|
8
Zend/tests/self_class_const_outside_class.phpt
Normal file
8
Zend/tests/self_class_const_outside_class.phpt
Normal file
@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
Accessing self::FOO outside a class
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(self::FOO);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot access self:: when no class scope is active in %s on line %d
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Dereferencing expression parentheses
|
||||
--INI--
|
||||
zend.enable_gc=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -128,7 +128,7 @@ ZEND_API zend_utility_values zend_uv;
|
||||
/* version information */
|
||||
static char *zend_version_info;
|
||||
static uint zend_version_info_length;
|
||||
#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2014 Zend Technologies\n"
|
||||
#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2015 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) /* {{{ */
|
||||
@ -616,6 +616,9 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) /
|
||||
zend_compile_string = compile_string;
|
||||
zend_throw_exception_hook = NULL;
|
||||
|
||||
/* Set up the default garbage collection implementation. */
|
||||
gc_collect_cycles = zend_gc_collect_cycles;
|
||||
|
||||
zend_init_opcodes_handlers();
|
||||
|
||||
/* set up version */
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -194,47 +194,6 @@ ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int parse_arg_object_to_string(zval *arg, char **p, size_t *pl, int type) /* {{{ */
|
||||
{
|
||||
if (Z_OBJ_HANDLER_P(arg, cast_object)) {
|
||||
zval obj;
|
||||
if (Z_OBJ_HANDLER_P(arg, cast_object)(arg, &obj, type) == SUCCESS) {
|
||||
zval_ptr_dtor(arg);
|
||||
ZVAL_COPY_VALUE(arg, &obj);
|
||||
*pl = Z_STRLEN_P(arg);
|
||||
*p = Z_STRVAL_P(arg);
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
/* Standard PHP objects */
|
||||
if (Z_OBJ_HT_P(arg) == &std_object_handlers || !Z_OBJ_HANDLER_P(arg, cast_object)) {
|
||||
SEPARATE_ZVAL_NOREF(arg);
|
||||
if (zend_std_cast_object_tostring(arg, arg, type) == SUCCESS) {
|
||||
*pl = Z_STRLEN_P(arg);
|
||||
*p = Z_STRVAL_P(arg);
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
if (!Z_OBJ_HANDLER_P(arg, cast_object) && Z_OBJ_HANDLER_P(arg, get)) {
|
||||
zval rv;
|
||||
zval *z = Z_OBJ_HANDLER_P(arg, get)(arg, &rv);
|
||||
Z_ADDREF_P(z);
|
||||
if(Z_TYPE_P(z) != IS_OBJECT) {
|
||||
zval_dtor(arg);
|
||||
ZVAL_NULL(arg);
|
||||
if (!zend_make_printable_zval(z, arg)) {
|
||||
ZVAL_ZVAL(arg, z, 1, 1);
|
||||
}
|
||||
*pl = Z_STRLEN_P(arg);
|
||||
*p = Z_STRVAL_P(arg);
|
||||
return SUCCESS;
|
||||
}
|
||||
zval_ptr_dtor(z);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int parse_arg_object_to_str(zval *arg, zend_string **str, int type) /* {{{ */
|
||||
{
|
||||
if (Z_OBJ_HANDLER_P(arg, cast_object)) {
|
||||
@ -1715,7 +1674,7 @@ static int zend_startup_module_zval(zval *zv) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void zend_sort_modules(void *base, size_t count, size_t siz, compare_func_t compare) /* {{{ */
|
||||
static void zend_sort_modules(void *base, size_t count, size_t siz, compare_func_t compare, swap_func_t swp) /* {{{ */
|
||||
{
|
||||
Bucket *b1 = base;
|
||||
Bucket *b2;
|
||||
@ -1821,7 +1780,7 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */
|
||||
|
||||
ZEND_API int zend_startup_modules(void) /* {{{ */
|
||||
{
|
||||
zend_hash_sort(&module_registry, zend_sort_modules, NULL, 0);
|
||||
zend_hash_sort_ex(&module_registry, zend_sort_modules, NULL, 0);
|
||||
zend_hash_apply(&module_registry, zend_startup_module_zval);
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -3714,7 +3673,7 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *na
|
||||
zend_string *key = zend_string_init(name, name_length, 0);
|
||||
|
||||
EG(scope) = scope;
|
||||
property = zend_std_get_static_property(scope, key, 0, NULL);
|
||||
property = zend_std_get_static_property(scope, key, 0);
|
||||
EG(scope) = old_scope;
|
||||
zend_string_free(key);
|
||||
if (!property) {
|
||||
@ -3802,11 +3761,10 @@ ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
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_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_bool silent, zval *rv) /* {{{ */
|
||||
{
|
||||
zval property, *value;
|
||||
zend_class_entry *old_scope = EG(scope);
|
||||
zval rv;
|
||||
|
||||
EG(scope) = scope;
|
||||
|
||||
@ -3815,7 +3773,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c
|
||||
}
|
||||
|
||||
ZVAL_STRINGL(&property, name, name_length);
|
||||
value = Z_OBJ_HT_P(object)->read_property(object, &property, silent?BP_VAR_IS:BP_VAR_R, NULL, &rv);
|
||||
value = Z_OBJ_HT_P(object)->read_property(object, &property, silent?BP_VAR_IS:BP_VAR_R, NULL, rv);
|
||||
zval_ptr_dtor(&property);
|
||||
|
||||
EG(scope) = old_scope;
|
||||
@ -3830,7 +3788,7 @@ ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *na
|
||||
zend_string *key = zend_string_init(name, name_length, 0);
|
||||
|
||||
EG(scope) = scope;
|
||||
property = zend_std_get_static_property(scope, key, silent, NULL);
|
||||
property = zend_std_get_static_property(scope, key, silent);
|
||||
EG(scope) = old_scope;
|
||||
zend_string_free(key);
|
||||
|
||||
@ -3954,30 +3912,6 @@ ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_functi
|
||||
ZEND_API void zend_ctor_make_null(zend_execute_data *execute_data) /* {{{ */
|
||||
{
|
||||
if (EX(return_value)) {
|
||||
/*
|
||||
if (Z_TYPE_P(EX(return_value)) == IS_OBJECT) {
|
||||
zend_object *object = Z_OBJ_P(EX(return_value));
|
||||
zend_execute_data *ex = EX(prev_execute_data);
|
||||
|
||||
while (ex && Z_OBJ(ex->This) == object) {
|
||||
if (ex->func) {
|
||||
if (ZEND_USER_CODE(ex->func->type)) {
|
||||
if (ex->func->op_array.this_var != -1) {
|
||||
zval *this_var = ZEND_CALL_VAR(ex, ex->func->op_array.this_var);
|
||||
if (this_var != EX(return_value)) {
|
||||
zval_ptr_dtor(this_var);
|
||||
ZVAL_NULL(this_var);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Z_OBJ(ex->This) = NULL;
|
||||
ZVAL_NULL(&ex->This);
|
||||
ex = ex->prev_execute_data;
|
||||
}
|
||||
}
|
||||
*/
|
||||
zval_ptr_dtor(EX(return_value));
|
||||
Z_OBJ_P(EX(return_value)) = NULL;
|
||||
ZVAL_NULL(EX(return_value));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -335,7 +335,7 @@ ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const c
|
||||
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);
|
||||
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_bool silent, zval *rv);
|
||||
|
||||
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t name_length, zend_bool silent);
|
||||
|
||||
@ -667,7 +667,7 @@ END_EXTERN_C()
|
||||
|
||||
/* Fast parameter parsing API */
|
||||
|
||||
/* TODO: This API is experemental. It may be changed or removed ???
|
||||
/* TODO: This API is experimental. It may be changed or removed ???
|
||||
* It should be used only for really often used functions.
|
||||
* (Keep the original parsing code and wrap usage with #ifndef FAST_ZPP)
|
||||
*/
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -1558,7 +1558,6 @@ static void *zend_mm_realloc_heap(zend_mm_heap *heap, void *ptr, size_t size ZEN
|
||||
}
|
||||
|
||||
/* Naive reallocation */
|
||||
old_size = zend_mm_size(heap, ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
ret = zend_mm_alloc_heap(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
memcpy(ret, ptr, MIN(old_size, size));
|
||||
zend_mm_free_heap(heap, ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
@ -2267,8 +2266,7 @@ ZEND_API void* ZEND_FASTCALL _safe_realloc(void *ptr, size_t nmemb, size_t size,
|
||||
ZEND_API void* ZEND_FASTCALL _ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
void *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
#endif
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
p = _safe_emalloc(nmemb, size, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
@ -2285,8 +2283,6 @@ ZEND_API char* ZEND_FASTCALL _estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_
|
||||
{
|
||||
size_t length;
|
||||
char *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
#endif
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
@ -2304,8 +2300,6 @@ ZEND_API char* ZEND_FASTCALL _estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_
|
||||
ZEND_API char* ZEND_FASTCALL _estrndup(const char *s, size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
char *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
#endif
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
@ -2324,8 +2318,6 @@ ZEND_API char* ZEND_FASTCALL _estrndup(const char *s, size_t length ZEND_FILE_LI
|
||||
ZEND_API char* ZEND_FASTCALL zend_strndup(const char *s, size_t length)
|
||||
{
|
||||
char *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
#endif
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -23,6 +23,8 @@
|
||||
#include "zend_API.h"
|
||||
#include "zend_operators.h"
|
||||
|
||||
ZEND_API zend_ast_process_t zend_ast_process = NULL;
|
||||
|
||||
static inline void *zend_ast_alloc(size_t size) {
|
||||
return zend_arena_alloc(&CG(ast_arena), size);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -186,6 +186,9 @@ typedef struct _zend_ast_decl {
|
||||
zend_ast *child[3];
|
||||
} zend_ast_decl;
|
||||
|
||||
typedef void (*zend_ast_process_t)(zend_ast *ast);
|
||||
extern ZEND_API zend_ast_process_t zend_ast_process;
|
||||
|
||||
ZEND_API zend_ast *zend_ast_create_zval_ex(zval *zv, zend_ast_attr attr);
|
||||
|
||||
ZEND_API zend_ast *zend_ast_create_ex(zend_ast_kind kind, zend_ast_attr attr, ...);
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -475,21 +475,13 @@ ZEND_FUNCTION(func_get_args)
|
||||
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(return_value)) {
|
||||
i = 0;
|
||||
p = ZEND_CALL_ARG(ex, 1);
|
||||
if (ZEND_CALL_NUM_ARGS(ex) > first_extra_arg) {
|
||||
if (arg_count > first_extra_arg) {
|
||||
while (i < first_extra_arg) {
|
||||
q = p;
|
||||
ZVAL_DEREF(q);
|
||||
if (Z_OPT_REFCOUNTED_P(q)) Z_ADDREF_P(q);
|
||||
ZEND_HASH_FILL_ADD(q);
|
||||
// q->h = i;
|
||||
// q->key = NULL;
|
||||
// if (!Z_ISREF_P(p)) {
|
||||
// ZVAL_COPY(&q->val, p);
|
||||
// } else {
|
||||
// ZVAL_COPY(&q->val, Z_REFVAL_P(p));
|
||||
// }
|
||||
p++;
|
||||
// q++;
|
||||
i++;
|
||||
}
|
||||
p = ZEND_CALL_VAR_NUM(ex, ex->func->op_array.last_var + ex->func->op_array.T);
|
||||
@ -499,15 +491,7 @@ ZEND_FUNCTION(func_get_args)
|
||||
ZVAL_DEREF(q);
|
||||
if (Z_OPT_REFCOUNTED_P(q)) Z_ADDREF_P(q);
|
||||
ZEND_HASH_FILL_ADD(q);
|
||||
// q->h = i;
|
||||
// q->key = NULL;
|
||||
// if (!Z_ISREF_P(p)) {
|
||||
// ZVAL_COPY(&q->val, p);
|
||||
// } else {
|
||||
// ZVAL_COPY(&q->val, Z_REFVAL_P(p));
|
||||
// }
|
||||
p++;
|
||||
// q++;
|
||||
i++;
|
||||
}
|
||||
} ZEND_HASH_FILL_END();
|
||||
@ -667,18 +651,54 @@ ZEND_FUNCTION(each)
|
||||
Return the current error_reporting level, and if an argument was passed - change to the new level */
|
||||
ZEND_FUNCTION(error_reporting)
|
||||
{
|
||||
zend_string *err;
|
||||
zval *err;
|
||||
int old_error_reporting;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &err) == FAILURE) {
|
||||
#ifndef FAST_ZPP
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &err) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_ZVAL(err)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
#endif
|
||||
|
||||
old_error_reporting = EG(error_reporting);
|
||||
if(ZEND_NUM_ARGS() != 0) {
|
||||
zend_string *key = zend_string_init("error_reporting", sizeof("error_reporting")-1, 0);
|
||||
zend_alter_ini_entry(key, err, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
|
||||
zend_string_release(key);
|
||||
do {
|
||||
zend_ini_entry *p = EG(error_reporting_ini_entry);
|
||||
|
||||
if (!p) {
|
||||
p = zend_hash_str_find_ptr(EG(ini_directives), "error_reporting", sizeof("error_reporting")-1);
|
||||
if (p) {
|
||||
EG(error_reporting_ini_entry) = p;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!p->modified) {
|
||||
if (!EG(modified_ini_directives)) {
|
||||
ALLOC_HASHTABLE(EG(modified_ini_directives));
|
||||
zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0);
|
||||
}
|
||||
if (EXPECTED(zend_hash_str_add_ptr(EG(modified_ini_directives), "error_reporting", sizeof("error_reporting")-1, p) != NULL)) {
|
||||
p->orig_value = p->value;
|
||||
p->orig_modifiable = p->modifiable;
|
||||
p->modified = 1;
|
||||
}
|
||||
} else if (p->orig_value != p->value) {
|
||||
zend_string_release(p->value);
|
||||
}
|
||||
|
||||
p->value = zval_get_string(err);
|
||||
if (Z_TYPE_P(err) == IS_LONG) {
|
||||
EG(error_reporting) = Z_LVAL_P(err);
|
||||
} else {
|
||||
EG(error_reporting) = atoi(p->value->val);
|
||||
}
|
||||
} while (0);
|
||||
}
|
||||
|
||||
RETVAL_LONG(old_error_reporting);
|
||||
@ -726,14 +746,7 @@ static void copy_constant_array(zval *dst, zval *src) /* {{{ */
|
||||
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);
|
||||
}
|
||||
}
|
||||
ZVAL_DEREF(val);
|
||||
if (key) {
|
||||
new_val = zend_hash_add_new(Z_ARRVAL_P(dst), key, val);
|
||||
} else {
|
||||
@ -978,14 +991,18 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) /*
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ce = zend_lookup_class_ex(class_name, NULL, 0);
|
||||
if (!ce) {
|
||||
retval = 0;
|
||||
if (!only_subclass && EXPECTED(zend_string_equals(instance_ce->name, class_name))) {
|
||||
retval = 1;
|
||||
} else {
|
||||
if (only_subclass && instance_ce == ce) {
|
||||
ce = zend_lookup_class_ex(class_name, NULL, 0);
|
||||
if (!ce) {
|
||||
retval = 0;
|
||||
} else {
|
||||
retval = instanceof_function(instance_ce, ce);
|
||||
} else {
|
||||
if (only_subclass && instance_ce == ce) {
|
||||
retval = 0;
|
||||
} else {
|
||||
retval = instanceof_function(instance_ce, ce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1041,6 +1058,8 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
|
||||
if (UNEXPECTED(Z_COPYABLE_P(prop))) {
|
||||
ZVAL_DUP(&prop_copy, prop);
|
||||
prop = &prop_copy;
|
||||
} else {
|
||||
Z_TRY_ADDREF_P(prop);
|
||||
}
|
||||
|
||||
/* this is necessary to make it able to work with default array
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -907,7 +907,6 @@ ZEND_API int do_bind_function(const zend_op_array *op_array, const zend_op *opli
|
||||
int error_level = compile_time ? E_COMPILE_ERROR : E_ERROR;
|
||||
zend_function *old_function;
|
||||
|
||||
efree_size(new_function, sizeof(zend_op_array));
|
||||
if ((old_function = zend_hash_find_ptr(function_table, Z_STR_P(op2))) != NULL
|
||||
&& old_function->type == ZEND_USER_FUNCTION
|
||||
&& old_function->op_array.last > 0) {
|
||||
@ -3251,23 +3250,23 @@ void zend_compile_while(zend_ast *ast) /* {{{ */
|
||||
{
|
||||
zend_ast *cond_ast = ast->child[0];
|
||||
zend_ast *stmt_ast = ast->child[1];
|
||||
|
||||
znode cond_node;
|
||||
uint32_t opnum_start, opnum_jmpz;
|
||||
uint32_t opnum_start, opnum_jmp, opnum_cond;
|
||||
|
||||
opnum_start = get_next_op_number(CG(active_op_array));
|
||||
zend_compile_expr(&cond_node, cond_ast);
|
||||
opnum_jmp = zend_emit_jump(0);
|
||||
|
||||
opnum_jmpz = zend_emit_cond_jump(ZEND_JMPZ, &cond_node, 0);
|
||||
zend_begin_loop();
|
||||
|
||||
opnum_start = get_next_op_number(CG(active_op_array));
|
||||
zend_compile_stmt(stmt_ast);
|
||||
|
||||
zend_emit_jump(opnum_start);
|
||||
opnum_cond = get_next_op_number(CG(active_op_array));
|
||||
zend_update_jump_target(opnum_jmp, opnum_cond);
|
||||
zend_compile_expr(&cond_node, cond_ast);
|
||||
|
||||
zend_update_jump_target_to_next(opnum_jmpz);
|
||||
zend_emit_cond_jump(ZEND_JMPNZ, &cond_node, opnum_start);
|
||||
|
||||
zend_end_loop(opnum_start, 0);
|
||||
zend_end_loop(opnum_cond, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -3323,27 +3322,27 @@ void zend_compile_for(zend_ast *ast) /* {{{ */
|
||||
zend_ast *stmt_ast = ast->child[3];
|
||||
|
||||
znode result;
|
||||
uint32_t opnum_cond, opnum_jmpz, opnum_loop;
|
||||
uint32_t opnum_start, opnum_jmp, opnum_loop;
|
||||
|
||||
zend_compile_expr_list(&result, init_ast);
|
||||
zend_do_free(&result);
|
||||
|
||||
opnum_cond = get_next_op_number(CG(active_op_array));
|
||||
zend_compile_expr_list(&result, cond_ast);
|
||||
zend_do_extended_info();
|
||||
opnum_jmp = zend_emit_jump(0);
|
||||
|
||||
opnum_jmpz = zend_emit_cond_jump(ZEND_JMPZ, &result, 0);
|
||||
zend_begin_loop();
|
||||
|
||||
opnum_start = get_next_op_number(CG(active_op_array));
|
||||
zend_compile_stmt(stmt_ast);
|
||||
|
||||
opnum_loop = get_next_op_number(CG(active_op_array));
|
||||
zend_compile_expr_list(&result, loop_ast);
|
||||
zend_do_free(&result);
|
||||
|
||||
zend_emit_jump(opnum_cond);
|
||||
zend_update_jump_target_to_next(opnum_jmp);
|
||||
zend_compile_expr_list(&result, cond_ast);
|
||||
zend_do_extended_info();
|
||||
|
||||
zend_update_jump_target_to_next(opnum_jmpz);
|
||||
zend_emit_cond_jump(ZEND_JMPNZ, &result, opnum_start);
|
||||
|
||||
zend_end_loop(opnum_loop, 0);
|
||||
}
|
||||
@ -3527,13 +3526,21 @@ void zend_compile_switch(zend_ast *ast) /* {{{ */
|
||||
|
||||
zend_compile_expr(&cond_node, cond_ast);
|
||||
|
||||
opline = zend_emit_op(NULL, ZEND_CASE, &expr_node, &cond_node);
|
||||
SET_NODE(opline->result, &case_node);
|
||||
if (opline->op1_type == IS_CONST) {
|
||||
zval_copy_ctor(CT_CONSTANT(opline->op1));
|
||||
}
|
||||
if (expr_node.op_type == IS_CONST
|
||||
&& Z_TYPE(expr_node.u.constant) == IS_FALSE) {
|
||||
jmpnz_opnums[i] = zend_emit_cond_jump(ZEND_JMPZ, &cond_node, 0);
|
||||
} else if (expr_node.op_type == IS_CONST
|
||||
&& Z_TYPE(expr_node.u.constant) == IS_TRUE) {
|
||||
jmpnz_opnums[i] = zend_emit_cond_jump(ZEND_JMPNZ, &cond_node, 0);
|
||||
} else {
|
||||
opline = zend_emit_op(NULL, ZEND_CASE, &expr_node, &cond_node);
|
||||
SET_NODE(opline->result, &case_node);
|
||||
if (opline->op1_type == IS_CONST) {
|
||||
zval_copy_ctor(CT_CONSTANT(opline->op1));
|
||||
}
|
||||
|
||||
jmpnz_opnums[i] = zend_emit_cond_jump(ZEND_JMPNZ, &case_node, 0);
|
||||
jmpnz_opnums[i] = zend_emit_cond_jump(ZEND_JMPNZ, &case_node, 0);
|
||||
}
|
||||
}
|
||||
|
||||
opnum_default_jmp = zend_emit_jump(0);
|
||||
@ -5124,7 +5131,32 @@ void zend_compile_binary_op(znode *result, zend_ast *ast) /* {{{ */
|
||||
return;
|
||||
}
|
||||
|
||||
zend_emit_op_tmp(result, opcode, &left_node, &right_node);
|
||||
do {
|
||||
if (opcode == ZEND_IS_EQUAL || opcode == ZEND_IS_NOT_EQUAL) {
|
||||
if (left_node.op_type == IS_CONST) {
|
||||
if (Z_TYPE(left_node.u.constant) == IS_FALSE) {
|
||||
opcode = (opcode == ZEND_IS_NOT_EQUAL) ? ZEND_BOOL : ZEND_BOOL_NOT;
|
||||
zend_emit_op_tmp(result, opcode, &right_node, NULL);
|
||||
break;
|
||||
} else if (Z_TYPE(left_node.u.constant) == IS_TRUE) {
|
||||
opcode = (opcode == ZEND_IS_EQUAL) ? ZEND_BOOL : ZEND_BOOL_NOT;
|
||||
zend_emit_op_tmp(result, opcode, &right_node, NULL);
|
||||
break;
|
||||
}
|
||||
} else if (right_node.op_type == IS_CONST) {
|
||||
if (Z_TYPE(right_node.u.constant) == IS_FALSE) {
|
||||
opcode = (opcode == ZEND_IS_NOT_EQUAL) ? ZEND_BOOL : ZEND_BOOL_NOT;
|
||||
zend_emit_op_tmp(result, opcode, &left_node, NULL);
|
||||
break;
|
||||
} else if (Z_TYPE(right_node.u.constant) == IS_TRUE) {
|
||||
opcode = (opcode == ZEND_IS_EQUAL) ? ZEND_BOOL : ZEND_BOOL_NOT;
|
||||
zend_emit_op_tmp(result, opcode, &left_node, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
zend_emit_op_tmp(result, opcode, &left_node, &right_node);
|
||||
} while (0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -5688,17 +5720,31 @@ void zend_compile_class_const(znode *result, zend_ast *ast) /* {{{ */
|
||||
zend_ast *const_ast = ast->child[1];
|
||||
|
||||
znode class_node, const_node;
|
||||
zend_op *opline;
|
||||
zend_op *opline, *class_op = NULL;
|
||||
|
||||
if (zend_is_const_default_class_ref(class_ast)) {
|
||||
class_node.op_type = IS_CONST;
|
||||
ZVAL_STR(&class_node.u.constant, zend_resolve_class_name_ast(class_ast));
|
||||
} else {
|
||||
zend_compile_class_ref(&class_node, class_ast);
|
||||
class_op = zend_compile_class_ref(&class_node, class_ast);
|
||||
}
|
||||
|
||||
zend_compile_expr(&const_node, const_ast);
|
||||
|
||||
if (class_op && const_node.op_type == IS_CONST && class_op->extended_value == ZEND_FETCH_CLASS_SELF && Z_TYPE(const_node.u.constant) == IS_STRING && CG(active_class_entry)) {
|
||||
zval *const_zv = zend_hash_find(&CG(active_class_entry)->constants_table, Z_STR(const_node.u.constant));
|
||||
if (const_zv && Z_TYPE_P(const_zv) < IS_CONSTANT) {
|
||||
CG(active_op_array)->last--;
|
||||
CG(active_op_array)->T--;
|
||||
|
||||
result->op_type = IS_CONST;
|
||||
ZVAL_COPY(&result->u.constant, const_zv);
|
||||
|
||||
zend_string_release(Z_STR(const_node.u.constant));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
opline = zend_emit_op_tmp(result, ZEND_FETCH_CONSTANT, NULL, &const_node);
|
||||
|
||||
zend_set_class_name_op1(opline, &class_node);
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -37,7 +37,7 @@ ZEND_API void (*zend_throw_exception_hook)(zval *ex);
|
||||
|
||||
void zend_exception_set_previous(zend_object *exception, zend_object *add_previous)
|
||||
{
|
||||
zval tmp, *previous, zv, *pzv;
|
||||
zval tmp, *previous, zv, *pzv, rv;
|
||||
|
||||
if (exception == add_previous || !add_previous || !exception) {
|
||||
return;
|
||||
@ -50,7 +50,7 @@ void zend_exception_set_previous(zend_object *exception, zend_object *add_previo
|
||||
ZVAL_OBJ(&zv, exception);
|
||||
pzv = &zv;
|
||||
do {
|
||||
previous = zend_read_property(default_exception_ce, pzv, "previous", sizeof("previous")-1, 1);
|
||||
previous = zend_read_property(default_exception_ce, pzv, "previous", sizeof("previous")-1, 1, &rv);
|
||||
if (Z_TYPE_P(previous) == IS_NULL) {
|
||||
zend_update_property(default_exception_ce, pzv, "previous", sizeof("previous")-1, &tmp);
|
||||
GC_REFCOUNT(add_previous)--;
|
||||
@ -264,14 +264,16 @@ ZEND_METHOD(error_exception, __construct)
|
||||
}
|
||||
|
||||
#define GET_PROPERTY(object, name) \
|
||||
zend_read_property(default_exception_ce, (object), name, sizeof(name) - 1, 0)
|
||||
zend_read_property(default_exception_ce, (object), name, sizeof(name) - 1, 0, &rv)
|
||||
#define GET_PROPERTY_SILENT(object, name) \
|
||||
zend_read_property(default_exception_ce, (object), name, sizeof(name) - 1, 1)
|
||||
zend_read_property(default_exception_ce, (object), name, sizeof(name) - 1, 1, &rv)
|
||||
|
||||
/* {{{ proto string Exception::getFile()
|
||||
Get the file in which the exception occurred */
|
||||
ZEND_METHOD(exception, getFile)
|
||||
{
|
||||
zval rv;
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), "file"));
|
||||
@ -282,6 +284,8 @@ ZEND_METHOD(exception, getFile)
|
||||
Get the line in which the exception occurred */
|
||||
ZEND_METHOD(exception, getLine)
|
||||
{
|
||||
zval rv;
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), "line"));
|
||||
@ -292,6 +296,8 @@ ZEND_METHOD(exception, getLine)
|
||||
Get the exception message */
|
||||
ZEND_METHOD(exception, getMessage)
|
||||
{
|
||||
zval rv;
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), "message"));
|
||||
@ -302,6 +308,8 @@ ZEND_METHOD(exception, getMessage)
|
||||
Get the exception code */
|
||||
ZEND_METHOD(exception, getCode)
|
||||
{
|
||||
zval rv;
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), "code"));
|
||||
@ -312,6 +320,8 @@ ZEND_METHOD(exception, getCode)
|
||||
Get the stack trace for the location in which the exception occurred */
|
||||
ZEND_METHOD(exception, getTrace)
|
||||
{
|
||||
zval rv;
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), "trace"));
|
||||
@ -322,6 +332,8 @@ ZEND_METHOD(exception, getTrace)
|
||||
Get the exception severity */
|
||||
ZEND_METHOD(error_exception, getSeverity)
|
||||
{
|
||||
zval rv;
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), "severity"));
|
||||
@ -519,14 +531,14 @@ static void _build_trace_string(smart_str *str, HashTable *ht, uint32_t num) /*
|
||||
Obtain the backtrace for the exception as a string (instead of an array) */
|
||||
ZEND_METHOD(exception, getTraceAsString)
|
||||
{
|
||||
zval *trace, *frame;
|
||||
zval *trace, *frame, rv;
|
||||
zend_ulong index;
|
||||
smart_str str = {0};
|
||||
uint32_t num = 0;
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1);
|
||||
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1, &rv);
|
||||
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);
|
||||
@ -549,6 +561,8 @@ ZEND_METHOD(exception, getTraceAsString)
|
||||
Return previous Exception or NULL. */
|
||||
ZEND_METHOD(exception, getPrevious)
|
||||
{
|
||||
zval rv;
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
ZVAL_COPY(return_value, GET_PROPERTY_SILENT(getThis(), "previous"));
|
||||
@ -585,7 +599,7 @@ ZEND_METHOD(exception, __toString)
|
||||
zval trace, *exception;
|
||||
zend_string *str;
|
||||
zend_fcall_info fci;
|
||||
zval fname;
|
||||
zval fname, rv;
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
@ -802,7 +816,7 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */
|
||||
ZVAL_OBJ(&exception, ex);
|
||||
ce_exception = Z_OBJCE(exception);
|
||||
if (instanceof_function(ce_exception, default_exception_ce)) {
|
||||
zval tmp;
|
||||
zval tmp, rv;
|
||||
zend_string *str, *file = NULL;
|
||||
zend_long line = 0;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -804,12 +804,12 @@ static zend_always_inline void zend_assign_to_object(zval *retval, zval *object,
|
||||
|
||||
if (property_op_type == IS_CONST &&
|
||||
EXPECTED(Z_OBJCE_P(object) == CACHED_PTR_EX(cache_slot))) {
|
||||
zend_property_info *prop_info = CACHED_PTR_EX(cache_slot + 1);
|
||||
uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR_EX(cache_slot + 1);
|
||||
zend_object *zobj = Z_OBJ_P(object);
|
||||
zval *property;
|
||||
|
||||
if (EXPECTED(prop_info)) {
|
||||
property = OBJ_PROP(zobj, prop_info->offset);
|
||||
if (EXPECTED(prop_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) {
|
||||
property = OBJ_PROP(zobj, prop_offset);
|
||||
if (Z_TYPE_P(property) != IS_UNDEF) {
|
||||
fast_assign:
|
||||
value = zend_assign_to_variable(property, value, value_type);
|
||||
@ -1442,12 +1442,12 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
|
||||
}
|
||||
if (prop_op_type == IS_CONST &&
|
||||
EXPECTED(Z_OBJCE_P(container) == CACHED_PTR_EX(cache_slot))) {
|
||||
zend_property_info *prop_info = CACHED_PTR_EX(cache_slot + 1);
|
||||
uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR_EX(cache_slot + 1);
|
||||
zend_object *zobj = Z_OBJ_P(container);
|
||||
zval *retval;
|
||||
|
||||
if (EXPECTED(prop_info)) {
|
||||
retval = OBJ_PROP(zobj, prop_info->offset);
|
||||
if (EXPECTED(prop_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) {
|
||||
retval = OBJ_PROP(zobj, prop_offset);
|
||||
if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
|
||||
ZVAL_INDIRECT(result, retval);
|
||||
return;
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -31,6 +31,8 @@ ZEND_API int gc_globals_id;
|
||||
ZEND_API zend_gc_globals gc_globals;
|
||||
#endif
|
||||
|
||||
ZEND_API int (*gc_collect_cycles)(TSRMLS_D);
|
||||
|
||||
#define GC_REMOVE_FROM_ROOTS(current) \
|
||||
gc_remove_from_roots((current))
|
||||
|
||||
@ -137,6 +139,11 @@ ZEND_API void gc_init(void)
|
||||
|
||||
ZEND_API void gc_possible_root(zend_refcounted *ref)
|
||||
{
|
||||
if (UNEXPECTED(GC_TYPE(ref) == IS_NULL) || UNEXPECTED(CG(unclean_shutdown))) {
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_ASSERT(GC_TYPE(ref) == IS_ARRAY || GC_TYPE(ref) == IS_OBJECT);
|
||||
GC_BENCH_INC(zval_possible_root);
|
||||
|
||||
if (EXPECTED(GC_GET_COLOR(GC_INFO(ref)) == GC_BLACK)) {
|
||||
@ -207,7 +214,7 @@ tail_call:
|
||||
ht = NULL;
|
||||
GC_SET_BLACK(GC_INFO(ref));
|
||||
|
||||
if (GC_TYPE(ref) == IS_OBJECT && EG(objects_store).object_buckets) {
|
||||
if (GC_TYPE(ref) == IS_OBJECT) {
|
||||
zend_object_get_gc_t get_gc;
|
||||
zend_object *obj = (zend_object*)ref;
|
||||
|
||||
@ -247,10 +254,6 @@ tail_call:
|
||||
}
|
||||
} else if (GC_TYPE(ref) == IS_REFERENCE) {
|
||||
if (Z_REFCOUNTED(((zend_reference*)ref)->val)) {
|
||||
if (UNEXPECTED(!EG(objects_store).object_buckets) &&
|
||||
Z_TYPE(((zend_reference*)ref)->val) == IS_OBJECT) {
|
||||
return;
|
||||
}
|
||||
ref = Z_COUNTED(((zend_reference*)ref)->val);
|
||||
if (GC_TYPE(ref) != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) {
|
||||
GC_REFCOUNT(ref)++;
|
||||
@ -291,7 +294,7 @@ tail_call:
|
||||
GC_BENCH_INC(zval_marked_grey);
|
||||
GC_SET_COLOR(GC_INFO(ref), GC_GREY);
|
||||
|
||||
if (GC_TYPE(ref) == IS_OBJECT && EG(objects_store).object_buckets) {
|
||||
if (GC_TYPE(ref) == IS_OBJECT) {
|
||||
zend_object_get_gc_t get_gc;
|
||||
zend_object *obj = (zend_object*)ref;
|
||||
|
||||
@ -333,7 +336,8 @@ tail_call:
|
||||
} else if (GC_TYPE(ref) == IS_REFERENCE) {
|
||||
if (Z_REFCOUNTED(((zend_reference*)ref)->val)) {
|
||||
if (UNEXPECTED(!EG(objects_store).object_buckets) &&
|
||||
Z_TYPE(((zend_reference*)ref)->val) == IS_OBJECT) {
|
||||
Z_TYPE(((zend_reference*)ref)->val) == IS_OBJECT) {
|
||||
Z_TYPE_INFO(((zend_reference*)ref)->val) = IS_NULL;
|
||||
return;
|
||||
}
|
||||
ref = Z_COUNTED(((zend_reference*)ref)->val);
|
||||
@ -348,6 +352,11 @@ tail_call:
|
||||
for (idx = 0; idx < ht->nNumUsed; idx++) {
|
||||
p = ht->arData + idx;
|
||||
if (!Z_REFCOUNTED(p->val)) continue;
|
||||
if (UNEXPECTED(!EG(objects_store).object_buckets) &&
|
||||
Z_TYPE(p->val) == IS_OBJECT) {
|
||||
Z_TYPE_INFO(p->val) = IS_NULL;
|
||||
continue;
|
||||
}
|
||||
ref = Z_COUNTED(p->val);
|
||||
if (GC_TYPE(ref) != IS_ARRAY || ((zend_array*)ref) != &EG(symbol_table)) {
|
||||
GC_REFCOUNT(ref)--;
|
||||
@ -386,7 +395,7 @@ tail_call:
|
||||
gc_scan_black(ref);
|
||||
} else {
|
||||
GC_SET_COLOR(GC_INFO(ref), GC_WHITE);
|
||||
if (GC_TYPE(ref) == IS_OBJECT && EG(objects_store).object_buckets) {
|
||||
if (GC_TYPE(ref) == IS_OBJECT) {
|
||||
zend_object_get_gc_t get_gc;
|
||||
zend_object *obj = (zend_object*)ref;
|
||||
|
||||
@ -423,10 +432,6 @@ tail_call:
|
||||
}
|
||||
} else if (GC_TYPE(ref) == IS_REFERENCE) {
|
||||
if (Z_REFCOUNTED(((zend_reference*)ref)->val)) {
|
||||
if (UNEXPECTED(!EG(objects_store).object_buckets) &&
|
||||
Z_TYPE(((zend_reference*)ref)->val) == IS_OBJECT) {
|
||||
return;
|
||||
}
|
||||
ref = Z_COUNTED(((zend_reference*)ref)->val);
|
||||
goto tail_call;
|
||||
}
|
||||
@ -501,7 +506,7 @@ tail_call:
|
||||
}
|
||||
#endif
|
||||
|
||||
if (GC_TYPE(ref) == IS_OBJECT && EG(objects_store).object_buckets) {
|
||||
if (GC_TYPE(ref) == IS_OBJECT) {
|
||||
zend_object_get_gc_t get_gc;
|
||||
zend_object *obj = (zend_object*)ref;
|
||||
|
||||
@ -546,10 +551,6 @@ tail_call:
|
||||
ht = &((zend_array*)ref)->ht;
|
||||
} else if (GC_TYPE(ref) == IS_REFERENCE) {
|
||||
if (Z_REFCOUNTED(((zend_reference*)ref)->val)) {
|
||||
if (UNEXPECTED(!EG(objects_store).object_buckets) &&
|
||||
Z_TYPE(((zend_reference*)ref)->val) == IS_OBJECT) {
|
||||
return count;
|
||||
}
|
||||
ref = Z_COUNTED(((zend_reference*)ref)->val);
|
||||
if (GC_TYPE(ref) != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) {
|
||||
GC_REFCOUNT(ref)++;
|
||||
@ -649,7 +650,7 @@ tail_call:
|
||||
if (GC_ADDRESS(GC_INFO(ref)) != 0) {
|
||||
GC_REMOVE_FROM_BUFFER(ref);
|
||||
|
||||
if (GC_TYPE(ref) == IS_OBJECT && EG(objects_store).object_buckets) {
|
||||
if (GC_TYPE(ref) == IS_OBJECT) {
|
||||
zend_object_get_gc_t get_gc;
|
||||
zend_object *obj = (zend_object*)ref;
|
||||
|
||||
@ -683,10 +684,6 @@ tail_call:
|
||||
ht = &((zend_array*)ref)->ht;
|
||||
} else if (GC_TYPE(ref) == IS_REFERENCE) {
|
||||
if (Z_REFCOUNTED(((zend_reference*)ref)->val)) {
|
||||
if (UNEXPECTED(!EG(objects_store).object_buckets) &&
|
||||
Z_TYPE(((zend_reference*)ref)->val) == IS_OBJECT) {
|
||||
return;
|
||||
}
|
||||
ref = Z_COUNTED(((zend_reference*)ref)->val);
|
||||
goto tail_call;
|
||||
}
|
||||
@ -706,7 +703,7 @@ tail_call:
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API int gc_collect_cycles(void)
|
||||
ZEND_API int zend_gc_collect_cycles(void)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
@ -750,36 +747,37 @@ ZEND_API int gc_collect_cycles(void)
|
||||
}
|
||||
|
||||
/* Call destructors */
|
||||
current = to_free.next;
|
||||
while (current != &to_free) {
|
||||
p = current->ref;
|
||||
GC_G(next_to_free) = current->next;
|
||||
if (GC_TYPE(p) == IS_OBJECT) {
|
||||
zend_object *obj = (zend_object*)p;
|
||||
if (EG(objects_store).object_buckets) {
|
||||
current = to_free.next;
|
||||
while (current != &to_free) {
|
||||
p = current->ref;
|
||||
GC_G(next_to_free) = current->next;
|
||||
if (GC_TYPE(p) == IS_OBJECT) {
|
||||
zend_object *obj = (zend_object*)p;
|
||||
|
||||
if (EG(objects_store).object_buckets &&
|
||||
IS_OBJ_VALID(EG(objects_store).object_buckets[obj->handle]) &&
|
||||
!(GC_FLAGS(obj) & IS_OBJ_DESTRUCTOR_CALLED)) {
|
||||
if (IS_OBJ_VALID(EG(objects_store).object_buckets[obj->handle]) &&
|
||||
!(GC_FLAGS(obj) & IS_OBJ_DESTRUCTOR_CALLED)) {
|
||||
|
||||
GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED;
|
||||
if (obj->handlers->dtor_obj) {
|
||||
GC_REFCOUNT(obj)++;
|
||||
obj->handlers->dtor_obj(obj);
|
||||
GC_REFCOUNT(obj)--;
|
||||
GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED;
|
||||
if (obj->handlers->dtor_obj) {
|
||||
GC_REFCOUNT(obj)++;
|
||||
obj->handlers->dtor_obj(obj);
|
||||
GC_REFCOUNT(obj)--;
|
||||
}
|
||||
}
|
||||
}
|
||||
current = GC_G(next_to_free);
|
||||
}
|
||||
current = GC_G(next_to_free);
|
||||
}
|
||||
|
||||
/* Remove values captured in destructors */
|
||||
current = to_free.next;
|
||||
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);
|
||||
/* Remove values captured in destructors */
|
||||
current = to_free.next;
|
||||
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);
|
||||
}
|
||||
current = GC_G(next_to_free);
|
||||
}
|
||||
current = GC_G(next_to_free);
|
||||
}
|
||||
|
||||
/* Destroy zvals */
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -119,13 +119,17 @@ extern ZEND_API zend_gc_globals gc_globals;
|
||||
#endif
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API int gc_collect_cycles(void);
|
||||
ZEND_API extern 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);
|
||||
|
||||
/* The default implementation of the gc_collect_cycles callback. */
|
||||
ZEND_API int zend_gc_collect_cycles(void);
|
||||
END_EXTERN_C()
|
||||
|
||||
#define GC_ZVAL_CHECK_POSSIBLE_ROOT(z) \
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -322,13 +322,14 @@ ZEND_API void zend_generator_resume(zend_generator *generator) /* {{{ */
|
||||
zend_execute_ex(generator->execute_data);
|
||||
generator->flags &= ~ZEND_GENERATOR_CURRENTLY_RUNNING;
|
||||
|
||||
/* Unlink generator call_frame from the caller */
|
||||
/* Unlink generator call_frame from the caller and backup vm_stack_top */
|
||||
if (generator->execute_data) {
|
||||
generator->stack = EG(vm_stack);
|
||||
generator->stack->top = EG(vm_stack_top);
|
||||
generator->execute_data->prev_execute_data = NULL;
|
||||
}
|
||||
|
||||
/* Restore executor globals */
|
||||
generator->stack->top = EG(vm_stack_top);
|
||||
EG(current_execute_data) = original_execute_data;
|
||||
EG(scope) = original_scope;
|
||||
EG(vm_stack_top) = original_stack->top;
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -36,7 +36,7 @@ BEGIN_EXTERN_C()
|
||||
# define CG(v) (compiler_globals.v)
|
||||
extern ZEND_API struct _zend_compiler_globals compiler_globals;
|
||||
#endif
|
||||
int zendparse(void);
|
||||
ZEND_API int zendparse(void);
|
||||
|
||||
|
||||
/* Executor */
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -101,25 +101,24 @@ static const uint32_t uninitialized_bucket = {INVALID_IDX};
|
||||
|
||||
ZEND_API void _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
|
||||
{
|
||||
#if defined(ZEND_WIN32)
|
||||
unsigned long index;
|
||||
#endif
|
||||
/* Use big enough power of 2 */
|
||||
#if defined(PHP_WIN32) && !defined(__clang__)
|
||||
if (nSize <= 8) {
|
||||
ht->nTableSize = 8;
|
||||
} else if (nSize >= 0x80000000) {
|
||||
/* prevent overflow */
|
||||
ht->nTableSize = 0x80000000;
|
||||
} else {
|
||||
ht->nTableSize = 1U << __lzcnt(nSize);
|
||||
if (ht->nTableSize < nSize) {
|
||||
ht->nTableSize <<= 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* size should be between 8 and 0x80000000 */
|
||||
nSize = (nSize <= 8 ? 8 : (nSize >= 0x80000000 ? 0x80000000 : nSize));
|
||||
# if defined(__GNUC__)
|
||||
|
||||
#if defined(ZEND_WIN32)
|
||||
if (BitScanReverse(&index, nSize - 1)) {
|
||||
ht->nTableSize = 0x2 << ((31 - index) ^ 0x1f);
|
||||
} else {
|
||||
/* nSize is ensured to be in the valid range, fall back to it
|
||||
rather than using an undefined bis scan result. */
|
||||
ht->nTableSize = nSize;
|
||||
}
|
||||
#elif defined(__GNUC__)
|
||||
ht->nTableSize = 0x2 << (__builtin_clz(nSize - 1) ^ 0x1f);
|
||||
# else
|
||||
#else
|
||||
nSize -= 1;
|
||||
nSize |= (nSize >> 1);
|
||||
nSize |= (nSize >> 2);
|
||||
@ -127,7 +126,6 @@ ZEND_API void _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestru
|
||||
nSize |= (nSize >> 8);
|
||||
nSize |= (nSize >> 16);
|
||||
ht->nTableSize = nSize + 1;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
ht->nTableMask = 0;
|
||||
@ -160,6 +158,7 @@ ZEND_API void zend_hash_packed_to_hash(HashTable *ht)
|
||||
{
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
ht->u.flags &= ~HASH_FLAG_PACKED;
|
||||
ht->nTableMask = ht->nTableSize - 1;
|
||||
ht->arData = (Bucket *) safe_perealloc(ht->arData, ht->nTableSize, sizeof(Bucket) + sizeof(uint32_t), 0, ht->u.flags & HASH_FLAG_PERSISTENT);
|
||||
ht->arHash = (uint32_t*)(ht->arData + ht->nTableSize);
|
||||
zend_hash_rehash(ht);
|
||||
@ -171,7 +170,7 @@ ZEND_API void zend_hash_to_packed(HashTable *ht)
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
ht->u.flags |= HASH_FLAG_PACKED;
|
||||
ht->nTableMask = 0;
|
||||
ht->arData = erealloc(ht->arData, ht->nTableSize * sizeof(Bucket));
|
||||
ht->arData = (Bucket *) perealloc(ht->arData, ht->nTableSize * sizeof(Bucket), ht->u.flags & HASH_FLAG_PERSISTENT);
|
||||
ht->arHash = (uint32_t*)&uninitialized_bucket;
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
}
|
||||
@ -1663,8 +1662,47 @@ 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)
|
||||
ZEND_API void zend_hash_bucket_swap(Bucket *p, Bucket *q) {
|
||||
zval val;
|
||||
zend_ulong h;
|
||||
zend_string *key;
|
||||
|
||||
ZVAL_COPY_VALUE(&val, &p->val);
|
||||
h = p->h;
|
||||
key = p->key;
|
||||
|
||||
ZVAL_COPY_VALUE(&p->val, &q->val);
|
||||
p->h = q->h;
|
||||
p->key = q->key;
|
||||
|
||||
ZVAL_COPY_VALUE(&q->val, &val);
|
||||
q->h = h;
|
||||
q->key = key;
|
||||
}
|
||||
|
||||
ZEND_API void zend_hash_bucket_renum_swap(Bucket *p, Bucket *q) {
|
||||
zval val;
|
||||
|
||||
ZVAL_COPY_VALUE(&val, &p->val);
|
||||
ZVAL_COPY_VALUE(&p->val, &q->val);
|
||||
ZVAL_COPY_VALUE(&q->val, &val);
|
||||
}
|
||||
|
||||
ZEND_API void zend_hash_bucket_packed_swap(Bucket *p, Bucket *q) {
|
||||
zval val;
|
||||
zend_ulong h;
|
||||
|
||||
ZVAL_COPY_VALUE(&val, &p->val);
|
||||
h = p->h;
|
||||
|
||||
ZVAL_COPY_VALUE(&p->val, &q->val);
|
||||
p->h = q->h;
|
||||
|
||||
ZVAL_COPY_VALUE(&q->val, &val);
|
||||
q->h = h;
|
||||
}
|
||||
|
||||
ZEND_API int zend_hash_sort_ex(HashTable *ht, sort_func_t sort, compare_func_t compar, zend_bool renumber)
|
||||
{
|
||||
Bucket *p;
|
||||
uint32_t i, j;
|
||||
@ -1688,7 +1726,9 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
|
||||
}
|
||||
}
|
||||
|
||||
(*sort_func)((void *) ht->arData, i, sizeof(Bucket), compar);
|
||||
sort((void *)ht->arData, i, sizeof(Bucket), compar,
|
||||
(swap_func_t)(renumber? zend_hash_bucket_renum_swap :
|
||||
((ht->u.flags & HASH_FLAG_PACKED) ? zend_hash_bucket_packed_swap : zend_hash_bucket_swap)));
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
ht->nNumUsed = i;
|
||||
@ -1714,7 +1754,7 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
|
||||
if (renumber) {
|
||||
ht->u.flags |= HASH_FLAG_PACKED;
|
||||
ht->nTableMask = 0;
|
||||
ht->arData = erealloc(ht->arData, ht->nTableSize * sizeof(Bucket));
|
||||
ht->arData = perealloc(ht->arData, ht->nTableSize * sizeof(Bucket), ht->u.flags & HASH_FLAG_PERSISTENT);
|
||||
ht->arHash = (uint32_t*)&uninitialized_bucket;
|
||||
} else {
|
||||
zend_hash_rehash(ht);
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -201,13 +201,19 @@ 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);
|
||||
ZEND_API void zend_hash_bucket_swap(Bucket *p, Bucket *q);
|
||||
ZEND_API void zend_hash_bucket_renum_swap(Bucket *p, Bucket *q);
|
||||
ZEND_API void zend_hash_bucket_packed_swap(Bucket *p, Bucket *q);
|
||||
ZEND_API int zend_hash_sort_ex(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)
|
||||
|
||||
#define zend_hash_sort(ht, compare_func, renumber) \
|
||||
zend_hash_sort_ex(ht, zend_sort, compare_func, renumber)
|
||||
|
||||
#define zend_hash_num_elements(ht) \
|
||||
(ht)->nNumOfElements
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -19,7 +19,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_qsort.h"
|
||||
#include "zend_sort.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_ini.h"
|
||||
#include "zend_alloc.h"
|
||||
@ -202,7 +202,7 @@ static int ini_key_compare(const void *a, const void *b) /* {{{ */
|
||||
|
||||
ZEND_API void zend_ini_sort_entries(void) /* {{{ */
|
||||
{
|
||||
zend_hash_sort(EG(ini_directives), zend_qsort, ini_key_compare, 0);
|
||||
zend_hash_sort(EG(ini_directives), ini_key_compare, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -3,7 +3,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -29,6 +29,10 @@
|
||||
#include <zend_ini_parser.h>
|
||||
#include "zend_ini_scanner.h"
|
||||
|
||||
#ifdef YYDEBUG
|
||||
#undef YYDEBUG
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
# define YYDEBUG(s, c) printf("state: %d char: %c\n", s, c)
|
||||
#else
|
||||
@ -636,13 +640,6 @@ end_raw_value_chars:
|
||||
return END_OF_LINE;
|
||||
}
|
||||
|
||||
<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(), SCNG(lineno));
|
||||
BEGIN(INITIAL);
|
||||
SCNG(lineno)++;
|
||||
return END_OF_LINE;
|
||||
}
|
||||
|
||||
<ST_VALUE,ST_RAW>[^] { /* End of option value (if EOF is reached before EOL */
|
||||
BEGIN(INITIAL);
|
||||
return END_OF_LINE;
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -3,7 +3,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -49,6 +49,9 @@ typedef struct _zend_lex_state {
|
||||
zend_encoding_filter input_filter;
|
||||
zend_encoding_filter output_filter;
|
||||
const zend_encoding *script_encoding;
|
||||
|
||||
zend_ast *ast;
|
||||
zend_arena *ast_arena;
|
||||
} zend_lex_state;
|
||||
|
||||
typedef struct _zend_heredoc_label {
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -222,6 +222,9 @@ ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state)
|
||||
lex_state->input_filter = SCNG(input_filter);
|
||||
lex_state->output_filter = SCNG(output_filter);
|
||||
lex_state->script_encoding = SCNG(script_encoding);
|
||||
|
||||
lex_state->ast = CG(ast);
|
||||
lex_state->ast_arena = CG(ast_arena);
|
||||
}
|
||||
|
||||
ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state)
|
||||
@ -257,6 +260,9 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state)
|
||||
SCNG(output_filter) = lex_state->output_filter;
|
||||
SCNG(script_encoding) = lex_state->script_encoding;
|
||||
|
||||
CG(ast) = lex_state->ast;
|
||||
CG(ast_arena) = lex_state->ast_arena;
|
||||
|
||||
RESET_DOC_COMMENT();
|
||||
}
|
||||
|
||||
@ -586,6 +592,9 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type)
|
||||
if (compiler_result != 0) { /* parser error */
|
||||
zend_bailout();
|
||||
}
|
||||
if (zend_ast_process) {
|
||||
zend_ast_process(CG(ast));
|
||||
}
|
||||
zend_compile_top_stmt(CG(ast));
|
||||
zend_ast_destroy(CG(ast));
|
||||
zend_arena_destroy(CG(ast_arena));
|
||||
@ -747,6 +756,9 @@ zend_op_array *compile_string(zval *source_string, char *filename)
|
||||
|
||||
zend_stack_push(&CG(context_stack), (void *) &CG(context));
|
||||
zend_init_compiler_context();
|
||||
if (zend_ast_process) {
|
||||
zend_ast_process(CG(ast));
|
||||
}
|
||||
zend_compile_top_stmt(CG(ast));
|
||||
zend_do_end_compilation();
|
||||
zend_emit_final_return(NULL);
|
||||
@ -1574,6 +1586,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
<ST_IN_SCRIPTING>{BNUM} {
|
||||
char *bin = yytext + 2; /* Skip "0b" */
|
||||
int len = yyleng - 2;
|
||||
char *end;
|
||||
|
||||
/* Skip any leading 0s */
|
||||
while (*bin == '0') {
|
||||
@ -1585,29 +1598,54 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
if (len == 0) {
|
||||
ZVAL_LONG(zendlval, 0);
|
||||
} else {
|
||||
ZVAL_LONG(zendlval, ZEND_STRTOL(bin, NULL, 2));
|
||||
errno = 0;
|
||||
ZVAL_LONG(zendlval, ZEND_STRTOL(bin, &end, 2));
|
||||
ZEND_ASSERT(!errno && end == yytext + yyleng);
|
||||
}
|
||||
return T_LNUMBER;
|
||||
} else {
|
||||
ZVAL_DOUBLE(zendlval, zend_bin_strtod(bin, NULL));
|
||||
ZVAL_DOUBLE(zendlval, zend_bin_strtod(bin, (const char **)&end));
|
||||
/* errno isn't checked since we allow HUGE_VAL/INF overflow */
|
||||
ZEND_ASSERT(end == yytext + yyleng);
|
||||
return T_DNUMBER;
|
||||
}
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>{LNUM} {
|
||||
char *end;
|
||||
if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */
|
||||
ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 0));
|
||||
errno = 0;
|
||||
ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, &end, 0));
|
||||
/* This isn't an assert, we need to ensure 019 isn't valid octal
|
||||
* Because the lexing itself doesn't do that for us
|
||||
*/
|
||||
if (end != yytext + yyleng) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Invalid numeric literal");
|
||||
}
|
||||
ZEND_ASSERT(!errno);
|
||||
} else {
|
||||
errno = 0;
|
||||
ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 0));
|
||||
ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, &end, 0));
|
||||
if (errno == ERANGE) { /* Overflow */
|
||||
errno = 0;
|
||||
if (yytext[0] == '0') { /* octal overflow */
|
||||
ZVAL_DOUBLE(zendlval, zend_oct_strtod(yytext, NULL));
|
||||
errno = 0;
|
||||
ZVAL_DOUBLE(zendlval, zend_oct_strtod(yytext, (const char **)&end));
|
||||
} else {
|
||||
ZVAL_DOUBLE(zendlval, zend_strtod(yytext, NULL));
|
||||
ZVAL_DOUBLE(zendlval, zend_strtod(yytext, (const char **)&end));
|
||||
}
|
||||
/* Also not an assert for the same reason */
|
||||
if (end != yytext + yyleng) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Invalid numeric literal");
|
||||
}
|
||||
ZEND_ASSERT(!errno);
|
||||
return T_DNUMBER;
|
||||
}
|
||||
/* Also not an assert for the same reason */
|
||||
if (end != yytext + yyleng) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Invalid numeric literal");
|
||||
}
|
||||
ZEND_ASSERT(!errno);
|
||||
}
|
||||
return T_LNUMBER;
|
||||
}
|
||||
@ -1615,6 +1653,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
<ST_IN_SCRIPTING>{HNUM} {
|
||||
char *hex = yytext + 2; /* Skip "0x" */
|
||||
int len = yyleng - 2;
|
||||
char *end;
|
||||
|
||||
/* Skip any leading 0s */
|
||||
while (*hex == '0') {
|
||||
@ -1626,19 +1665,30 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
if (len == 0) {
|
||||
ZVAL_LONG(zendlval, 0);
|
||||
} else {
|
||||
ZVAL_LONG(zendlval, ZEND_STRTOL(hex, NULL, 16));
|
||||
errno = 0;
|
||||
ZVAL_LONG(zendlval, ZEND_STRTOL(hex, &end, 16));
|
||||
ZEND_ASSERT(!errno && end == hex + len);
|
||||
}
|
||||
return T_LNUMBER;
|
||||
} else {
|
||||
ZVAL_DOUBLE(zendlval, zend_hex_strtod(hex, NULL));
|
||||
ZVAL_DOUBLE(zendlval, zend_hex_strtod(hex, (const char **)&end));
|
||||
/* errno isn't checked since we allow HUGE_VAL/INF overflow */
|
||||
ZEND_ASSERT(end == hex + len);
|
||||
return T_DNUMBER;
|
||||
}
|
||||
}
|
||||
|
||||
<ST_VAR_OFFSET>[0]|([1-9][0-9]*) { /* Offset could be treated as a long */
|
||||
if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) {
|
||||
ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 10));
|
||||
char *end;
|
||||
errno = 0;
|
||||
ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, &end, 10));
|
||||
if (errno == ERANGE) {
|
||||
goto string;
|
||||
}
|
||||
ZEND_ASSERT(end == yytext + yyleng);
|
||||
} else {
|
||||
string:
|
||||
ZVAL_STRINGL(zendlval, yytext, yyleng);
|
||||
}
|
||||
return T_NUM_STRING;
|
||||
@ -1650,7 +1700,11 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>{DNUM}|{EXPONENT_DNUM} {
|
||||
ZVAL_DOUBLE(zendlval, zend_strtod(yytext, NULL));
|
||||
const char *end;
|
||||
|
||||
ZVAL_DOUBLE(zendlval, zend_strtod(yytext, &end));
|
||||
/* errno isn't checked since we allow HUGE_VAL/INF overflow */
|
||||
ZEND_ASSERT(end == yytext + yyleng);
|
||||
return T_DNUMBER;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.13.6 */
|
||||
/* Generated by re2c 0.13.5 */
|
||||
#line 3 "Zend/zend_language_scanner_defs.h"
|
||||
|
||||
enum YYCONDTYPE {
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_llist.h"
|
||||
#include "zend_qsort.h"
|
||||
#include "zend_sort.h"
|
||||
|
||||
ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent)
|
||||
{
|
||||
@ -33,7 +33,6 @@ ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor
|
||||
l->persistent = persistent;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_llist_add_element(zend_llist *l, void *element)
|
||||
{
|
||||
zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent);
|
||||
@ -186,6 +185,14 @@ ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func)
|
||||
}
|
||||
}
|
||||
|
||||
static void zend_llist_swap(zend_llist_element **p, zend_llist_element **q)
|
||||
{
|
||||
zend_llist_element *t;
|
||||
t = *p;
|
||||
*p = *q;
|
||||
*q = t;
|
||||
}
|
||||
|
||||
ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func)
|
||||
{
|
||||
size_t i;
|
||||
@ -205,7 +212,8 @@ ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func)
|
||||
*ptr++ = element;
|
||||
}
|
||||
|
||||
zend_qsort(elements, l->count, sizeof(zend_llist_element *), (compare_func_t) comp_func);
|
||||
zend_sort(elements, l->count, sizeof(zend_llist_element *),
|
||||
(compare_func_t) comp_func, (swap_func_t) zend_llist_swap);
|
||||
|
||||
l->head = elements[0];
|
||||
elements[0]->prev = NULL;
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -286,16 +286,94 @@ 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) /* {{{ */
|
||||
static zend_always_inline uint32_t zend_get_property_offset(zend_class_entry *ce, zend_string *member, int silent, void **cache_slot) /* {{{ */
|
||||
{
|
||||
zval *zv;
|
||||
zend_property_info *property_info = NULL;
|
||||
uint32_t flags;
|
||||
|
||||
if (cache_slot && EXPECTED(ce == CACHED_PTR_EX(cache_slot))) {
|
||||
return CACHED_PTR_EX(cache_slot + 1);
|
||||
return (uint32_t)(intptr_t)CACHED_PTR_EX(cache_slot + 1);
|
||||
}
|
||||
|
||||
if (UNEXPECTED(member->val[0] == '\0')) {
|
||||
if (!silent) {
|
||||
if (member->len == 0) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot access empty property");
|
||||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Cannot access property started with '\\0'");
|
||||
}
|
||||
}
|
||||
return ZEND_WRONG_PROPERTY_OFFSET;
|
||||
}
|
||||
|
||||
if (UNEXPECTED(zend_hash_num_elements(&ce->properties_info) == 0)) {
|
||||
goto exit_dynamic;
|
||||
}
|
||||
|
||||
zv = zend_hash_find(&ce->properties_info, member);
|
||||
if (EXPECTED(zv != NULL)) {
|
||||
property_info = (zend_property_info*)Z_PTR_P(zv);
|
||||
flags = property_info->flags;
|
||||
if (UNEXPECTED((flags & ZEND_ACC_SHADOW) != 0)) {
|
||||
/* if it's a shadow - go to access it's private */
|
||||
property_info = NULL;
|
||||
} else {
|
||||
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)) {
|
||||
if (!silent) {
|
||||
zend_error(E_STRICT, "Accessing static property %s::$%s as non static", ce->name->val, member->val);
|
||||
}
|
||||
return ZEND_DYNAMIC_PROPERTY_OFFSET;
|
||||
}
|
||||
goto exit;
|
||||
}
|
||||
} else {
|
||||
/* Try to look in the scope instead */
|
||||
property_info = ZEND_WRONG_PROPERTY_INFO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (EG(scope) != ce
|
||||
&& EG(scope)
|
||||
&& is_derived_class(ce, EG(scope))
|
||||
&& (zv = zend_hash_find(&EG(scope)->properties_info, member)) != NULL
|
||||
&& ((zend_property_info*)Z_PTR_P(zv))->flags & ZEND_ACC_PRIVATE) {
|
||||
property_info = (zend_property_info*)Z_PTR_P(zv);
|
||||
if (UNEXPECTED((property_info->flags & ZEND_ACC_STATIC) != 0)) {
|
||||
return ZEND_DYNAMIC_PROPERTY_OFFSET;
|
||||
}
|
||||
} else if (UNEXPECTED(property_info == NULL)) {
|
||||
exit_dynamic:
|
||||
if (cache_slot) {
|
||||
CACHE_POLYMORPHIC_PTR_EX(cache_slot, ce, (void*)(intptr_t)ZEND_DYNAMIC_PROPERTY_OFFSET);
|
||||
}
|
||||
return ZEND_DYNAMIC_PROPERTY_OFFSET;
|
||||
} else if (UNEXPECTED(property_info == ZEND_WRONG_PROPERTY_INFO)) {
|
||||
/* Information was available, but we were denied access. Error out. */
|
||||
if (!silent) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(flags), ce->name->val, member->val);
|
||||
}
|
||||
return ZEND_WRONG_PROPERTY_OFFSET;
|
||||
}
|
||||
|
||||
exit:
|
||||
if (cache_slot) {
|
||||
CACHE_POLYMORPHIC_PTR_EX(cache_slot, ce, (void*)(intptr_t)property_info->offset);
|
||||
}
|
||||
return property_info->offset;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent) /* {{{ */
|
||||
{
|
||||
zval *zv;
|
||||
zend_property_info *property_info = NULL;
|
||||
uint32_t flags;
|
||||
|
||||
if (UNEXPECTED(member->val[0] == '\0')) {
|
||||
if (!silent) {
|
||||
if (member->len == 0) {
|
||||
@ -326,9 +404,6 @@ static zend_always_inline zend_property_info *zend_get_property_info_quick(zend_
|
||||
if (!silent) {
|
||||
zend_error(E_STRICT, "Accessing static property %s::$%s as non static", ce->name->val, member->val);
|
||||
}
|
||||
if (!allow_static) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
goto exit;
|
||||
}
|
||||
@ -345,14 +420,8 @@ static zend_always_inline zend_property_info *zend_get_property_info_quick(zend_
|
||||
&& (zv = zend_hash_find(&EG(scope)->properties_info, member)) != NULL
|
||||
&& ((zend_property_info*)Z_PTR_P(zv))->flags & ZEND_ACC_PRIVATE) {
|
||||
property_info = (zend_property_info*)Z_PTR_P(zv);
|
||||
if (!allow_static && UNEXPECTED((property_info->flags & ZEND_ACC_STATIC) != 0)) {
|
||||
return NULL;
|
||||
}
|
||||
} else if (UNEXPECTED(property_info == NULL)) {
|
||||
exit_dynamic:
|
||||
if (cache_slot) {
|
||||
CACHE_POLYMORPHIC_PTR_EX(cache_slot, ce, NULL);
|
||||
}
|
||||
return NULL;
|
||||
} else if (UNEXPECTED(property_info == ZEND_WRONG_PROPERTY_INFO)) {
|
||||
/* Information was available, but we were denied access. Error out. */
|
||||
@ -363,19 +432,10 @@ exit_dynamic:
|
||||
}
|
||||
|
||||
exit:
|
||||
if (cache_slot) {
|
||||
CACHE_POLYMORPHIC_PTR_EX(cache_slot, ce, property_info);
|
||||
}
|
||||
return property_info;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
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);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name) /* {{{ */
|
||||
{
|
||||
zend_property_info *property_info;
|
||||
@ -390,7 +450,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);
|
||||
property_info = zend_get_property_info(zobj->ce, member, 1);
|
||||
zend_string_release(member);
|
||||
if (property_info == NULL) {
|
||||
/* undefined public property */
|
||||
@ -437,7 +497,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
|
||||
zend_object *zobj;
|
||||
zval tmp_member;
|
||||
zval *retval;
|
||||
zend_property_info *property_info;
|
||||
uint32_t property_offset;
|
||||
|
||||
zobj = Z_OBJ_P(object);
|
||||
|
||||
@ -453,11 +513,11 @@ 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);
|
||||
property_offset = zend_get_property_offset(zobj->ce, Z_STR_P(member), (type == BP_VAR_IS) || (zobj->ce->__get != NULL), cache_slot);
|
||||
|
||||
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
||||
if (EXPECTED(property_info != NULL)) {
|
||||
retval = OBJ_PROP(zobj, property_info->offset);
|
||||
if (EXPECTED(property_offset != ZEND_WRONG_PROPERTY_OFFSET)) {
|
||||
if (EXPECTED(property_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) {
|
||||
retval = OBJ_PROP(zobj, property_offset);
|
||||
if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
|
||||
goto exit;
|
||||
}
|
||||
@ -523,7 +583,7 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, v
|
||||
zend_object *zobj;
|
||||
zval tmp_member;
|
||||
zval *variable_ptr;
|
||||
zend_property_info *property_info;
|
||||
uint32_t property_offset;
|
||||
|
||||
zobj = Z_OBJ_P(object);
|
||||
|
||||
@ -534,11 +594,11 @@ 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);
|
||||
property_offset = zend_get_property_offset(zobj->ce, Z_STR_P(member), (zobj->ce->__set != NULL), cache_slot);
|
||||
|
||||
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
||||
if (EXPECTED(property_info != NULL)) {
|
||||
variable_ptr = OBJ_PROP(zobj, property_info->offset);
|
||||
if (EXPECTED(property_offset != ZEND_WRONG_PROPERTY_OFFSET)) {
|
||||
if (EXPECTED(property_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) {
|
||||
variable_ptr = OBJ_PROP(zobj, property_offset);
|
||||
if (Z_TYPE_P(variable_ptr) != IS_UNDEF) {
|
||||
goto found;
|
||||
}
|
||||
@ -565,7 +625,7 @@ found:
|
||||
}
|
||||
(*guard) &= ~IN_SET;
|
||||
zval_ptr_dtor(&tmp_object);
|
||||
} else if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
||||
} else if (EXPECTED(property_offset != ZEND_WRONG_PROPERTY_OFFSET)) {
|
||||
goto write_std_property;
|
||||
} else {
|
||||
if (Z_STRVAL_P(member)[0] == '\0') {
|
||||
@ -576,7 +636,7 @@ found:
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
||||
} else if (EXPECTED(property_offset != ZEND_WRONG_PROPERTY_OFFSET)) {
|
||||
zval tmp;
|
||||
|
||||
write_std_property:
|
||||
@ -589,10 +649,8 @@ write_std_property:
|
||||
Z_ADDREF_P(value);
|
||||
}
|
||||
}
|
||||
if (EXPECTED(property_info != NULL) &&
|
||||
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
|
||||
|
||||
ZVAL_COPY_VALUE(OBJ_PROP(zobj, property_info->offset), value);
|
||||
if (EXPECTED(property_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) {
|
||||
ZVAL_COPY_VALUE(OBJ_PROP(zobj, property_offset), value);
|
||||
} else {
|
||||
if (!zobj->properties) {
|
||||
rebuild_object_properties(zobj);
|
||||
@ -695,7 +753,7 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type,
|
||||
zend_object *zobj;
|
||||
zend_string *name;
|
||||
zval *retval = NULL;
|
||||
zend_property_info *property_info;
|
||||
uint32_t property_offset;
|
||||
|
||||
zobj = Z_OBJ_P(object);
|
||||
if (EXPECTED(Z_TYPE_P(member) == IS_STRING)) {
|
||||
@ -708,11 +766,11 @@ 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);
|
||||
property_offset = zend_get_property_offset(zobj->ce, name, (zobj->ce->__get != NULL), cache_slot);
|
||||
|
||||
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
||||
if (EXPECTED(property_info != NULL)) {
|
||||
retval = OBJ_PROP(zobj, property_info->offset);
|
||||
if (EXPECTED(property_offset != ZEND_WRONG_PROPERTY_OFFSET)) {
|
||||
if (EXPECTED(property_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) {
|
||||
retval = OBJ_PROP(zobj, property_offset);
|
||||
if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
|
||||
if (EXPECTED(!zobj->ce->__get) ||
|
||||
UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET)) {
|
||||
@ -757,7 +815,7 @@ static void zend_std_unset_property(zval *object, zval *member, void **cache_slo
|
||||
{
|
||||
zend_object *zobj;
|
||||
zval tmp_member;
|
||||
zend_property_info *property_info;
|
||||
uint32_t property_offset;
|
||||
|
||||
zobj = Z_OBJ_P(object);
|
||||
|
||||
@ -768,11 +826,11 @@ 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);
|
||||
property_offset = zend_get_property_offset(zobj->ce, Z_STR_P(member), (zobj->ce->__unset != NULL), cache_slot);
|
||||
|
||||
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
||||
if (EXPECTED(property_info != NULL)) {
|
||||
zval *slot = OBJ_PROP(zobj, property_info->offset);
|
||||
if (EXPECTED(property_offset != ZEND_WRONG_PROPERTY_OFFSET)) {
|
||||
if (EXPECTED(property_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) {
|
||||
zval *slot = OBJ_PROP(zobj, property_offset);
|
||||
|
||||
if (Z_TYPE_P(slot) != IS_UNDEF) {
|
||||
zval_ptr_dtor(slot);
|
||||
@ -977,6 +1035,9 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str
|
||||
|
||||
if (EXPECTED(key != NULL)) {
|
||||
lc_method_name = Z_STR_P(key);
|
||||
#ifdef ZEND_ALLOCA_MAX_SIZE
|
||||
use_heap = 0;
|
||||
#endif
|
||||
} else {
|
||||
STR_ALLOCA_ALLOC(lc_method_name, method_name->len, use_heap);
|
||||
zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len);
|
||||
@ -1195,54 +1256,43 @@ 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) /* {{{ */
|
||||
ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent) /* {{{ */
|
||||
{
|
||||
zend_property_info *property_info;
|
||||
zend_property_info *property_info = zend_hash_find_ptr(&ce->properties_info, property_name);
|
||||
zval *ret;
|
||||
|
||||
if (UNEXPECTED(cache_slot == NULL) ||
|
||||
(property_info = CACHED_POLYMORPHIC_PTR_EX(cache_slot, ce)) == NULL) {
|
||||
|
||||
if (UNEXPECTED((property_info = zend_hash_find_ptr(&ce->properties_info, property_name)) == NULL)) {
|
||||
if (!silent) {
|
||||
zend_error_noreturn(E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, property_name->val);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (UNEXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
|
||||
if (!silent) {
|
||||
zend_error_noreturn(E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, property_name->val);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
zend_update_class_constants(ce);
|
||||
|
||||
if (EXPECTED(cache_slot != NULL)) {
|
||||
CACHE_POLYMORPHIC_PTR_EX(cache_slot, ce, property_info);
|
||||
}
|
||||
if (UNEXPECTED(property_info == NULL)) {
|
||||
goto undeclared_property;
|
||||
}
|
||||
|
||||
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL) ||
|
||||
UNEXPECTED(Z_TYPE(CE_STATIC_MEMBERS(ce)[property_info->offset]) == IS_UNDEF)) {
|
||||
if (UNEXPECTED(!zend_verify_property_access(property_info, ce))) {
|
||||
if (!silent) {
|
||||
zend_error_noreturn(E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, property_name->val);
|
||||
zend_error_noreturn(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ce->name->val, property_name->val);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &CE_STATIC_MEMBERS(ce)[property_info->offset];
|
||||
if (UNEXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
|
||||
goto undeclared_property;
|
||||
}
|
||||
|
||||
zend_update_class_constants(ce);
|
||||
ret = CE_STATIC_MEMBERS(ce) + property_info->offset;
|
||||
|
||||
/* check if static properties were destoyed */
|
||||
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
|
||||
undeclared_property:
|
||||
if (!silent) {
|
||||
zend_error_noreturn(E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, property_name->val);
|
||||
}
|
||||
ret = NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name, void **cache_slot) /* {{{ */
|
||||
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name) /* {{{ */
|
||||
{
|
||||
zend_error_noreturn(E_ERROR, "Attempt to unset static property %s::$%s", ce->name->val, property_name->val);
|
||||
return 0;
|
||||
@ -1351,7 +1401,7 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists,
|
||||
int result;
|
||||
zval *value = NULL;
|
||||
zval tmp_member;
|
||||
zend_property_info *property_info;
|
||||
uint32_t property_offset;
|
||||
|
||||
zobj = Z_OBJ_P(object);
|
||||
|
||||
@ -1362,11 +1412,11 @@ 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);
|
||||
property_offset = zend_get_property_offset(zobj->ce, Z_STR_P(member), 1, cache_slot);
|
||||
|
||||
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
||||
if (EXPECTED(property_info != NULL)) {
|
||||
value = OBJ_PROP(zobj, property_info->offset);
|
||||
if (EXPECTED(property_offset != ZEND_WRONG_PROPERTY_OFFSET)) {
|
||||
if (EXPECTED(property_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) {
|
||||
value = OBJ_PROP(zobj, property_offset);
|
||||
if (Z_TYPE_P(value) != IS_UNDEF) {
|
||||
goto found;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -28,6 +28,9 @@ struct _zend_property_info;
|
||||
#define ZEND_WRONG_PROPERTY_INFO \
|
||||
((struct _zend_property_info*)((zend_intptr_t)-1))
|
||||
|
||||
#define ZEND_DYNAMIC_PROPERTY_OFFSET (-1)
|
||||
#define ZEND_WRONG_PROPERTY_OFFSET (-2)
|
||||
|
||||
/* The following rule applies to read_property() and read_dimension() implementations:
|
||||
If you return a zval which is not otherwise referenced by the extension or the engine's
|
||||
symbol table, its reference count should be 0.
|
||||
@ -160,8 +163,8 @@ extern ZEND_API zend_object_handlers std_object_handlers;
|
||||
|
||||
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);
|
||||
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 zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent);
|
||||
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name);
|
||||
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);
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user