mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge mainstream 'master' branch into refactoring
During merge I had to revert: Nikita's patch for php_splice() (it probably needs to be applyed again) Bob Weinand's patches related to constant expression handling (we need to review them carefully) I also reverted all our attempts to support sapi/phpdbg (we didn't test it anyway) Conflicts: Zend/zend.h Zend/zend_API.c Zend/zend_ast.c Zend/zend_compile.c Zend/zend_compile.h Zend/zend_constants.c Zend/zend_exceptions.c Zend/zend_execute.c Zend/zend_execute.h Zend/zend_execute_API.c Zend/zend_hash.c Zend/zend_highlight.c Zend/zend_language_parser.y Zend/zend_language_scanner.c Zend/zend_language_scanner_defs.h Zend/zend_variables.c Zend/zend_vm_def.h Zend/zend_vm_execute.h ext/date/php_date.c ext/dom/documenttype.c ext/hash/hash.c ext/iconv/iconv.c ext/mbstring/tests/zend_multibyte-10.phpt ext/mbstring/tests/zend_multibyte-11.phpt ext/mbstring/tests/zend_multibyte-12.phpt ext/mysql/php_mysql.c ext/mysqli/mysqli.c ext/mysqlnd/mysqlnd_reverse_api.c ext/mysqlnd/php_mysqlnd.c ext/opcache/ZendAccelerator.c ext/opcache/zend_accelerator_util_funcs.c ext/opcache/zend_persist.c ext/opcache/zend_persist_calc.c ext/pcre/php_pcre.c ext/pdo/pdo_dbh.c ext/pdo/pdo_stmt.c ext/pdo_pgsql/pgsql_driver.c ext/pgsql/pgsql.c ext/reflection/php_reflection.c ext/session/session.c ext/spl/spl_array.c ext/spl/spl_observer.c ext/standard/array.c ext/standard/basic_functions.c ext/standard/html.c ext/standard/mail.c ext/standard/php_array.h ext/standard/proc_open.c ext/standard/streamsfuncs.c ext/standard/user_filters.c ext/standard/var_unserializer.c ext/standard/var_unserializer.re main/php_variables.c sapi/phpdbg/phpdbg.c sapi/phpdbg/phpdbg_bp.c sapi/phpdbg/phpdbg_frame.c sapi/phpdbg/phpdbg_help.c sapi/phpdbg/phpdbg_list.c sapi/phpdbg/phpdbg_print.c sapi/phpdbg/phpdbg_prompt.c
This commit is contained in:
commit
f9927a6c97
777 changed files with 165051 additions and 96985 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -206,6 +206,8 @@ ext/pdo_sqlite/sqlite3.h
|
|||
ext/pdo_sqlite/tests/*.db
|
||||
ext/pdo_sqlite/tests/*.tmp
|
||||
ext/phar/phar.phar
|
||||
ext/phar/phar.1
|
||||
ext/phar/phar.phar.1
|
||||
ext/pspell/tests/*.tmp
|
||||
ext/reflection/xml
|
||||
ext/reflection/html
|
||||
|
@ -237,12 +239,16 @@ sapi/apache/libphp5.module
|
|||
sapi/apache2handler/libphp5.module
|
||||
sapi/apache_hooks/libphp5.module
|
||||
sapi/cgi/php-cgi
|
||||
sapi/cgi/php-cgi.1
|
||||
sapi/cli/php.1
|
||||
sapi/fpm/php-fpm
|
||||
sapi/fpm/php-fpm.1
|
||||
sapi/fpm/init.d.php-fpm
|
||||
sapi/fpm/php-fpm.conf
|
||||
sapi/fpm/fpm/php-cgi
|
||||
sapi/phpdbg/phpdbg_parser.c
|
||||
sapi/phpdbg/phpdbg_parser.h
|
||||
sapi/phpdbg/phpdbg
|
||||
scripts/php-config
|
||||
scripts/phpize
|
||||
scripts/man1/*.1
|
||||
|
|
|
@ -82,7 +82,7 @@ Exceptions:
|
|||
library may need to control or free the memory, or when the memory in
|
||||
question needs to survive between multiple requests.
|
||||
|
||||
Naming Conventions
|
||||
User Functions/Methods Naming Conventions
|
||||
------------------
|
||||
|
||||
1. Function names for user-level functions should be enclosed with in
|
||||
|
@ -163,6 +163,26 @@ Naming Conventions
|
|||
'foobar'
|
||||
'foo_bar'
|
||||
|
||||
Internal Function Naming Convensions
|
||||
----------------------
|
||||
|
||||
1. Functions that are part of the external API should be named
|
||||
'php_modulename_function()' to avoid symbol collision. They should be in
|
||||
lowercase, with words underscore delimited. Exposed API must be defined
|
||||
in 'php_modulename.h'.
|
||||
|
||||
PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS);
|
||||
|
||||
Unexposed module function should be static and should not be defined in
|
||||
'php_modulename.h'.
|
||||
|
||||
static int php_session_destroy(TSRMLS_D)
|
||||
|
||||
2. Main module source file must be named 'modulename.c'.
|
||||
|
||||
3. Header file that is used by other sources must be named 'php_modulename.h'.
|
||||
|
||||
|
||||
Syntax and indentation
|
||||
----------------------
|
||||
|
||||
|
@ -181,9 +201,9 @@ Syntax and indentation
|
|||
of PHP or one of its standard modules, please maintain the K&R
|
||||
style. This applies to just about everything, starting with
|
||||
indentation and comment styles and up to function declaration
|
||||
syntax. Also see Indentstyle_.
|
||||
syntax. Also see Indentstyle.
|
||||
|
||||
.. _Indentstyle: http://www.catb.org/~esr/jargon/html/I/indent-style.html
|
||||
Indentstyle: http://www.catb.org/~esr/jargon/html/I/indent-style.html
|
||||
|
||||
3. Be generous with whitespace and braces. Keep one empty line between the
|
||||
variable declaration section and the statements in a block, as well as
|
||||
|
|
3
NEWS
3
NEWS
|
@ -5,6 +5,9 @@ PHP NEWS
|
|||
- DBA:
|
||||
. Fixed bug #62490 (dba_delete returns true on missing item (inifile)). (Mike)
|
||||
|
||||
- Standard:
|
||||
. Removed call_user_method() and call_user_method_array() functions. (Kalle)
|
||||
|
||||
- XSL:
|
||||
. Fixed bug #64776 (The XSLT extension is not thread safe). (Mike)
|
||||
|
||||
|
|
|
@ -45,12 +45,29 @@ HOW TO USE IT
|
|||
|
||||
--proto=filename.
|
||||
|
||||
SOURCE AND HEADER FILE NAME
|
||||
|
||||
./ext_skel generates 'module_name.c' and 'php_module_name.h' as main source
|
||||
and header files. Keep these names.
|
||||
|
||||
Module functions (User functions) must be named
|
||||
|
||||
module_name_function()
|
||||
|
||||
When you need to expose module functions to other modules, expose functions
|
||||
strictly needed by others. Exposed internal function must be named
|
||||
|
||||
php_module_name_function()
|
||||
|
||||
See also CODING_STANDARDS.
|
||||
|
||||
|
||||
FORMAT OF FUNCTION DEFINITIONS FILE
|
||||
|
||||
All the definitions must be on one line. In it's simplest form, it's just
|
||||
the function name, e.g.
|
||||
|
||||
my_function
|
||||
module_name_function
|
||||
|
||||
but then you'll be left with an almost empty function body without any
|
||||
argument handling.
|
||||
|
@ -72,8 +89,9 @@ FORMAT OF FUNCTION DEFINITIONS FILE
|
|||
|
||||
An example:
|
||||
|
||||
my_function(int arg1, int arg2 [, int arg3 [, int arg4]]) this is my 1st
|
||||
module_name_function(int arg1, int arg2 [, int arg3 [, int arg4]])
|
||||
|
||||
Arguments arg1 and arg2 are required.
|
||||
Arguments arg3 and arg4 are optional.
|
||||
|
||||
If possible, the function definition should also contain it's return type
|
||||
|
@ -133,15 +151,15 @@ EXAMPLE
|
|||
|
||||
The following _one_ line
|
||||
|
||||
bool my_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
bool module_name_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
|
||||
will create this function definition for you (note that there are a few
|
||||
question marks to be replaced by you, and you must of course add your own
|
||||
value definitions too):
|
||||
|
||||
/* {{{ proto bool my_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
/* {{{ proto bool module_name_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
*/
|
||||
PHP_FUNCTION(my_drawtext)
|
||||
PHP_FUNCTION(module_name_drawtext)
|
||||
{
|
||||
char *text = NULL;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
|
@ -164,7 +182,7 @@ PHP_FUNCTION(my_drawtext)
|
|||
ZEND_FETCH_RESOURCE(???, ???, font, font_id, "???", ???_rsrc_id);
|
||||
}
|
||||
|
||||
php_error(E_WARNING, "my_drawtext: not yet implemented");
|
||||
php_error(E_WARNING, "module_name_drawtext: not yet implemented");
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
|
|
@ -101,10 +101,10 @@ pointing out "the location of the release" and "the possible release date of
|
|||
either the next RC, or the final release".
|
||||
|
||||
2. Send an email (see example here http://news.php.net/php.pear.qa/5201) **To**
|
||||
``php-qa@lists.php.net`` and ``primary-qa-tests@lists.php.net``.
|
||||
``php-qa@lists.php.net`` and ``primary-qa-tester@lists.php.net``.
|
||||
This email is to notify the selected projects about a new release so that they
|
||||
can make sure their projects keep working. Make sure that you have been setup
|
||||
as a moderator for ``primary-qa-tests@lists.php.net`` by having someone (Wez,
|
||||
as a moderator for ``primary-qa-tester@lists.php.net`` by having someone (Hannes, Dan,
|
||||
Derick) run the following commands for you:
|
||||
|
||||
``ssh lists.php.net``
|
||||
|
@ -139,7 +139,7 @@ Rolling a stable release
|
|||
1. Checkout your release branch, you should have created when releasing previous RC
|
||||
and bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
|
||||
|
||||
2. If a CVE commit needs to be merged to the release, then have it commited to
|
||||
2. If a CVE commit needs to be merged to the release, then have it committed to
|
||||
the base branches and merged upwards as usual (f.e commit the CVE fix to 5.3,
|
||||
merge to 5.4, 5.5 etc...). Then you can cherry-pick it in your release branch.
|
||||
Don't forget to update NEWS manually in an extra commit then.
|
||||
|
|
|
@ -50,6 +50,17 @@ Please make the mail subject prefix "[PATCH]". If attaching a patch,
|
|||
ensure it has a file extension of ".txt". This is because only MIME
|
||||
attachments of type 'text/*' are accepted.
|
||||
|
||||
The preferred way to propose PHP patch is sending pull request from
|
||||
github.
|
||||
|
||||
https://github.com/php/php-src
|
||||
|
||||
Fork the official PHP repository and send a pull request. A
|
||||
notification will be sent to the pull request mailing list. Sending a
|
||||
note to PHP Internals list (internals@lists.php.net) may help getting
|
||||
more feedback and quicker turnaround. You can also add pull requests
|
||||
to bug reports at http://bugs.php.net/.
|
||||
|
||||
|
||||
PHP Documentation Patches
|
||||
-------------------------
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
------------------
|
||||
Failed tests usually indicate a problem with your local system setup
|
||||
and not within PHP itself (at least for official PHP release versions).
|
||||
You may decide to automaticaly submit a test summary to our QA workflow
|
||||
You may decide to automatically submit a test summary to our QA workflow
|
||||
at the end of a test run.
|
||||
Please do *not* submit a failed test as a bug or ask for help on why
|
||||
it failed on your system without providing substantial backup information
|
||||
|
|
|
@ -171,10 +171,6 @@ SOURCE=.\tsrm_strtok_r.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_virtual_cwd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_win32.h
|
||||
# End Source File
|
||||
# End Group
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define TSRM_CONFIG_COMMON_H
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
# if WINNT|WIN32
|
||||
# ifdef _WIN32
|
||||
# define TSRM_WIN32
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
@ -78,3 +78,5 @@ PHP X.Y UPGRADE NOTES
|
|||
11. Other Changes
|
||||
========================================
|
||||
|
||||
- Standard
|
||||
. call_user_method() and call_user_method_array() no longer exists.
|
||||
|
|
|
@ -269,6 +269,10 @@ SOURCE=.\zend_variables.c
|
|||
|
||||
SOURCE=.\zend_vm_opcodes.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_virtual_cwd.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
|
@ -437,10 +441,6 @@ SOURCE=.\zend_ts_hash.h
|
|||
|
||||
SOURCE=.\zend_variables.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_virtual_cwd.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Parsers"
|
||||
|
||||
|
|
|
@ -30,12 +30,12 @@ test(...getArray([1, 2, 3]));
|
|||
test(...arrayGen([]));
|
||||
test(...arrayGen([1, 2, 3]));
|
||||
|
||||
test(1, ...[2, 3], ...[4, 5], 6);
|
||||
test(1, ...getArray([2, 3]), ...arrayGen([4, 5]), 6);
|
||||
test(1, ...[2, 3], ...[4, 5]);
|
||||
test(1, ...getArray([2, 3]), ...arrayGen([4, 5]));
|
||||
|
||||
test2(...[1, 2]);
|
||||
test2(...[1, 2, 3]);
|
||||
test2(...[1], ...[], ...[], ...[2, 3], 4, ...[5, 6]);
|
||||
test2(...[1], ...[], ...[], ...[2, 3], ...[4, 5]);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
@ -75,7 +75,7 @@ array(3) {
|
|||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
array(6) {
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
|
@ -86,10 +86,8 @@ array(6) {
|
|||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
[5]=>
|
||||
int(6)
|
||||
}
|
||||
array(6) {
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
|
@ -100,8 +98,6 @@ array(6) {
|
|||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
[5]=>
|
||||
int(6)
|
||||
}
|
||||
int(1)
|
||||
int(2)
|
||||
|
|
|
@ -17,46 +17,37 @@ $array = [1, 2, 3];
|
|||
test1(...$array);
|
||||
var_dump($array);
|
||||
|
||||
$array1 = [1, 2]; $val2 = 3; $array2 = [4, 5];
|
||||
test1(...$array1, $val2, ...$array2);
|
||||
var_dump($array1, $val2, $array2);
|
||||
$array1 = [1, 2]; $array2 = [3, 4];
|
||||
test1(...$array1, ...$array2);
|
||||
var_dump($array1, $array2);
|
||||
|
||||
function test2($val1, &$ref1, $val2, &$ref2) {
|
||||
$ref1++;
|
||||
$ref2++;
|
||||
}
|
||||
|
||||
$array = [1, 2, 3, 4];
|
||||
$array = [0, 0, 0, 0];
|
||||
test2(...$array);
|
||||
var_dump($array);
|
||||
|
||||
$array1 = [1, 2]; $array2 = [4, 5];
|
||||
test1(...$array1, ...$array2);
|
||||
var_dump($array1, $array2);
|
||||
|
||||
$a = $b = $c = $d = 0;
|
||||
$array = [0, 0, 0, 0];
|
||||
|
||||
$array = [];
|
||||
test2(...$array, $a, $b, $c, $d);
|
||||
var_dump($array, $a, $b, $c, $d);
|
||||
test2($a, ...$array);
|
||||
var_dump($a, $array);
|
||||
|
||||
$array = [1];
|
||||
test2(...$array, $a, $b, $c, $d);
|
||||
var_dump($array, $a, $b, $c, $d);
|
||||
test2($a, $b, ...$array);
|
||||
var_dump($a, $b, $array);
|
||||
|
||||
$array = [1, 2];
|
||||
test2(...$array, $a, $b, $c, $d);
|
||||
var_dump($array, $a, $b, $c, $d);
|
||||
test2($a, $b, $c, ...$array);
|
||||
var_dump($a, $b, $c, $array);
|
||||
|
||||
$array = [1, 2, 3];
|
||||
test2(...$array, $a, $b, $c, $d);
|
||||
var_dump($array, $a, $b, $c, $d);
|
||||
|
||||
$vars = [];
|
||||
$array = [];
|
||||
test2(...$array, $vars['a'], $vars['b'], $vars['c'], $vars['d']);
|
||||
var_dump($vars);
|
||||
|
||||
$vars = [];
|
||||
$array = [1];
|
||||
test2(...$array, $vars['a'], $vars['b'], $vars['c'], $vars['d']);
|
||||
var_dump($vars);
|
||||
test2($a, $b, $c, $d, ...$array);
|
||||
var_dump($a, $b, $c, $d, $array);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
@ -74,76 +65,81 @@ array(2) {
|
|||
[1]=>
|
||||
int(3)
|
||||
}
|
||||
int(4)
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(4)
|
||||
[1]=>
|
||||
int(5)
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
int(0)
|
||||
[1]=>
|
||||
int(1)
|
||||
[2]=>
|
||||
int(0)
|
||||
[3]=>
|
||||
int(1)
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(2)
|
||||
[1]=>
|
||||
int(3)
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(5)
|
||||
[1]=>
|
||||
int(6)
|
||||
}
|
||||
int(0)
|
||||
array(4) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(3)
|
||||
int(0)
|
||||
[2]=>
|
||||
int(3)
|
||||
int(1)
|
||||
[3]=>
|
||||
int(5)
|
||||
}
|
||||
array(0) {
|
||||
int(0)
|
||||
}
|
||||
int(0)
|
||||
int(1)
|
||||
int(0)
|
||||
int(1)
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
array(2) {
|
||||
array(4) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(3)
|
||||
}
|
||||
int(1)
|
||||
int(2)
|
||||
int(1)
|
||||
int(1)
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(3)
|
||||
[2]=>
|
||||
int(3)
|
||||
int(1)
|
||||
[3]=>
|
||||
int(0)
|
||||
}
|
||||
int(0)
|
||||
int(2)
|
||||
int(2)
|
||||
int(1)
|
||||
int(1)
|
||||
|
||||
Notice: Undefined index: a in %s on line %d
|
||||
|
||||
Notice: Undefined index: c in %s on line %d
|
||||
array(2) {
|
||||
["b"]=>
|
||||
int(0)
|
||||
array(4) {
|
||||
[0]=>
|
||||
int(2)
|
||||
[1]=>
|
||||
int(1)
|
||||
["d"]=>
|
||||
[2]=>
|
||||
int(1)
|
||||
[3]=>
|
||||
int(0)
|
||||
}
|
||||
|
||||
Notice: Undefined index: b in %s on line %d
|
||||
|
||||
Notice: Undefined index: d in %s on line %d
|
||||
array(2) {
|
||||
["a"]=>
|
||||
int(0)
|
||||
int(3)
|
||||
int(0)
|
||||
int(1)
|
||||
array(4) {
|
||||
[0]=>
|
||||
int(2)
|
||||
[1]=>
|
||||
int(1)
|
||||
["c"]=>
|
||||
[2]=>
|
||||
int(1)
|
||||
[3]=>
|
||||
int(0)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ $fn = function(...$args) {
|
|||
|
||||
$fn(...[]);
|
||||
$fn(...[1, 2, 3]);
|
||||
$fn(1, ...[2, 3], ...[], 4, 5);
|
||||
$fn(1, ...[2, 3], ...[], ...[4, 5]);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -12,7 +12,7 @@ test(...42);
|
|||
test(...new stdClass);
|
||||
|
||||
test(1, 2, 3, ..."foo", ...[4, 5]);
|
||||
test(1, 2, ...new StdClass, 3, ...3.14, ...[4, 5]);
|
||||
test(1, 2, 3, ...new StdClass, ...3.14, ...[4, 5]);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
|
|
@ -14,8 +14,7 @@ class Foo {
|
|||
}
|
||||
|
||||
$foo = new Foo;
|
||||
$foo->test(...[1, 2], 3, 4, ...[], 5);
|
||||
Foo::test2(1, 2, ...[3, 4], ...[], 5);
|
||||
Foo::test2(1, 2, ...[3, 4], ...[], ...[5]);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
@ -31,15 +30,3 @@ array(5) {
|
|||
[4]=>
|
||||
int(5)
|
||||
}
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class Foo {
|
|||
|
||||
new Foo(...[]);
|
||||
new Foo(...[1, 2, 3]);
|
||||
new Foo(...[1], 2, ...[], ...[3, 4], 5);
|
||||
new Foo(...[1], ...[], ...[2, 3]);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
@ -25,15 +25,11 @@ array(3) {
|
|||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
array(5) {
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
}
|
||||
|
|
10
Zend/tests/arg_unpack/positional_arg_after_unpack_error.phpt
Normal file
10
Zend/tests/arg_unpack/positional_arg_after_unpack_error.phpt
Normal file
|
@ -0,0 +1,10 @@
|
|||
--TEST--
|
||||
Positional arguments cannot be used after argument unpacking
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(...[1, 2, 3], 4);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot use positional argument after argument unpacking in %s on line %d
|
|
@ -20,11 +20,11 @@ function gen() {
|
|||
}
|
||||
|
||||
try {
|
||||
test(1, 2, ...new Foo, 3, 4);
|
||||
test(1, 2, ...new Foo, ...[3, 4]);
|
||||
} catch (Exception $e) { var_dump($e->getMessage()); }
|
||||
|
||||
try {
|
||||
test(1, 2, ...gen(), 3, 4);
|
||||
test(1, 2, ...gen(), ...[3, 4]);
|
||||
} catch (Exception $e) { var_dump($e->getMessage()); }
|
||||
|
||||
?>
|
||||
|
|
|
@ -13,8 +13,6 @@ function gen($array) {
|
|||
}
|
||||
}
|
||||
|
||||
test(...gen([1, 2, 3]), $a);
|
||||
var_dump($a);
|
||||
test(1, 2, 3, $b, ...gen([4, 5, 6]));
|
||||
var_dump($b);
|
||||
|
||||
|
@ -25,7 +23,6 @@ test(...gen([1, 2]), ...gen([3, 4]));
|
|||
?>
|
||||
--EXPECTF--
|
||||
int(42)
|
||||
int(42)
|
||||
|
||||
Warning: Cannot pass by-reference argument 4 of test() by unpacking a Traversable, passing by-value instead in %s on line %d
|
||||
|
||||
|
|
30
Zend/tests/bug66015.phpt
Normal file
30
Zend/tests/bug66015.phpt
Normal file
|
@ -0,0 +1,30 @@
|
|||
--TEST--
|
||||
Bug #66015 (wrong array indexing in class's static property)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test
|
||||
{
|
||||
const FIRST = 1;
|
||||
const SECOND = 2;
|
||||
const THIRD = 3;
|
||||
|
||||
protected static $array = [
|
||||
self::FIRST => 'first',
|
||||
'second',
|
||||
'third'
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
var_export(self::$array);
|
||||
}
|
||||
}
|
||||
|
||||
$test = new Test();
|
||||
?>
|
||||
--EXPECTF--
|
||||
array (
|
||||
1 => 'first',
|
||||
2 => 'second',
|
||||
3 => 'third',
|
||||
)
|
13
Zend/tests/bug66660.phpt
Normal file
13
Zend/tests/bug66660.phpt
Normal file
|
@ -0,0 +1,13 @@
|
|||
--TEST--
|
||||
Bug #66660 (Composer.phar install/update fails)
|
||||
--STDIN--
|
||||
<?php __CLASS__ ?>
|
||||
--FILE--
|
||||
<?php
|
||||
file_put_contents(__DIR__."/bug66660.tmp.php", "<?php __CLASS__ ?>");
|
||||
echo php_strip_whitespace(__DIR__."/bug66660.tmp.php");
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php unlink(__DIR__."/bug66660.tmp.php"); ?>
|
||||
--EXPECT--
|
||||
<?php __CLASS__ ?>
|
|
@ -35,6 +35,9 @@ const T_25 = 1 + 2 * 3;
|
|||
// Test for memory leaks
|
||||
const T_26 = "1" + 2 + "3";
|
||||
|
||||
// Allow T_POW
|
||||
const T_27 = 2 ** 3;
|
||||
|
||||
var_dump(T_1);
|
||||
var_dump(T_2);
|
||||
var_dump(T_3);
|
||||
|
@ -61,6 +64,7 @@ var_dump(T_23);
|
|||
var_dump(T_24);
|
||||
var_dump(T_25);
|
||||
var_dump(T_26);
|
||||
var_dump(T_27);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
|
@ -89,3 +93,4 @@ bool(false)
|
|||
bool(true)
|
||||
int(7)
|
||||
int(6)
|
||||
int(8)
|
||||
|
|
19
Zend/tests/debug_info-error-0.0.phpt
Normal file
19
Zend/tests/debug_info-error-0.0.phpt
Normal file
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
Testing __debugInfo() magic method with bad returns ZERO (float)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public $val;
|
||||
public function __debugInfo() {
|
||||
return $this->val;
|
||||
}
|
||||
public function __construct($val) {
|
||||
$this->val = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$c = new C(0.0);
|
||||
var_dump($c);
|
||||
--EXPECTF--
|
||||
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-0.0.php on line %d
|
19
Zend/tests/debug_info-error-0.phpt
Normal file
19
Zend/tests/debug_info-error-0.phpt
Normal file
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
Testing __debugInfo() magic method with bad returns ZERO
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public $val;
|
||||
public function __debugInfo() {
|
||||
return $this->val;
|
||||
}
|
||||
public function __construct($val) {
|
||||
$this->val = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$c = new C(0);
|
||||
var_dump($c);
|
||||
--EXPECTF--
|
||||
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-0.php on line %d
|
19
Zend/tests/debug_info-error-1.0.phpt
Normal file
19
Zend/tests/debug_info-error-1.0.phpt
Normal file
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
Testing __debugInfo() magic method with bad returns ONE (float)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public $val;
|
||||
public function __debugInfo() {
|
||||
return $this->val;
|
||||
}
|
||||
public function __construct($val) {
|
||||
$this->val = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$c = new C(1.0);
|
||||
var_dump($c);
|
||||
--EXPECTF--
|
||||
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-1.0.php on line %d
|
19
Zend/tests/debug_info-error-1.phpt
Normal file
19
Zend/tests/debug_info-error-1.phpt
Normal file
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
Testing __debugInfo() magic method with bad returns ONE
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public $val;
|
||||
public function __debugInfo() {
|
||||
return $this->val;
|
||||
}
|
||||
public function __construct($val) {
|
||||
$this->val = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$c = new C(1);
|
||||
var_dump($c);
|
||||
--EXPECTF--
|
||||
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-1.php on line %d
|
19
Zend/tests/debug_info-error-empty_str.phpt
Normal file
19
Zend/tests/debug_info-error-empty_str.phpt
Normal file
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
Testing __debugInfo() magic method with bad returns EMPTY STRING
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public $val;
|
||||
public function __debugInfo() {
|
||||
return $this->val;
|
||||
}
|
||||
public function __construct($val) {
|
||||
$this->val = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$c = new C("");
|
||||
var_dump($c);
|
||||
--EXPECTF--
|
||||
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-empty_str.php on line %d
|
19
Zend/tests/debug_info-error-false.phpt
Normal file
19
Zend/tests/debug_info-error-false.phpt
Normal file
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
Testing __debugInfo() magic method with bad returns FALSE
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public $val;
|
||||
public function __debugInfo() {
|
||||
return $this->val;
|
||||
}
|
||||
public function __construct($val) {
|
||||
$this->val = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$c = new C(false);
|
||||
var_dump($c);
|
||||
--EXPECTF--
|
||||
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-false.php on line %d
|
19
Zend/tests/debug_info-error-object.phpt
Normal file
19
Zend/tests/debug_info-error-object.phpt
Normal file
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
Testing __debugInfo() magic method with bad returns OBJECT
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public $val;
|
||||
public function __debugInfo() {
|
||||
return $this->val;
|
||||
}
|
||||
public function __construct($val) {
|
||||
$this->val = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$c = new C(new stdClass);
|
||||
var_dump($c);
|
||||
--EXPECTF--
|
||||
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-object.php on line %d
|
19
Zend/tests/debug_info-error-resource.phpt
Normal file
19
Zend/tests/debug_info-error-resource.phpt
Normal file
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
Testing __debugInfo() magic method with bad returns RESOURCE
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public $val;
|
||||
public function __debugInfo() {
|
||||
return $this->val;
|
||||
}
|
||||
public function __construct($val) {
|
||||
$this->val = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$c = new C(fopen("data:text/plain,Foo", 'r'));
|
||||
var_dump($c);
|
||||
--EXPECTF--
|
||||
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-resource.php on line %d
|
19
Zend/tests/debug_info-error-str.phpt
Normal file
19
Zend/tests/debug_info-error-str.phpt
Normal file
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
Testing __debugInfo() magic method with bad returns STRING
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public $val;
|
||||
public function __debugInfo() {
|
||||
return $this->val;
|
||||
}
|
||||
public function __construct($val) {
|
||||
$this->val = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$c = new C("foo");
|
||||
var_dump($c);
|
||||
--EXPECTF--
|
||||
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-str.php on line %d
|
19
Zend/tests/debug_info-error-true.phpt
Normal file
19
Zend/tests/debug_info-error-true.phpt
Normal file
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
Testing __debugInfo() magic method with bad returns TRUE
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public $val;
|
||||
public function __debugInfo() {
|
||||
return $this->val;
|
||||
}
|
||||
public function __construct($val) {
|
||||
$this->val = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$c = new C(true);
|
||||
var_dump($c);
|
||||
--EXPECTF--
|
||||
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-true.php on line %d
|
39
Zend/tests/debug_info.phpt
Normal file
39
Zend/tests/debug_info.phpt
Normal file
|
@ -0,0 +1,39 @@
|
|||
--TEST--
|
||||
Testing __debugInfo() magic method
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Foo {
|
||||
public $d = 4;
|
||||
protected $e = 5;
|
||||
private $f = 6;
|
||||
|
||||
public function __debugInfo() {
|
||||
return ['a'=>1, "\0*\0b"=>2, "\0Foo\0c"=>3];
|
||||
}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
public $val = 123;
|
||||
|
||||
public function __debugInfo() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
$f = new Foo;
|
||||
var_dump($f);
|
||||
|
||||
$b = new Bar;
|
||||
var_dump($b);
|
||||
--EXPECTF--
|
||||
object(Foo)#%d (3) {
|
||||
["a"]=>
|
||||
int(1)
|
||||
["b":protected]=>
|
||||
int(2)
|
||||
["c":"Foo":private]=>
|
||||
int(3)
|
||||
}
|
||||
object(Bar)#%d (0) {
|
||||
}
|
|
@ -32,12 +32,11 @@ Stack trace:
|
|||
#0 %s(%d): serialize(Object(Generator))
|
||||
#1 {main}
|
||||
|
||||
exception 'Exception' with message 'Unserialization of 'Generator' is not allowed' in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: Generator->__wakeup()
|
||||
#1 %s(%d): unserialize('O:9:"Generator"...')
|
||||
#2 {main}
|
||||
|
||||
Warning: Erroneous data format for unserializing 'Generator' in %sserialize_unserialize_error.php on line %d
|
||||
|
||||
Notice: unserialize(): Error at offset 19 of 20 bytes in %sserialize_unserialize_error.php on line %s
|
||||
bool(false)
|
||||
exception 'Exception' with message 'Unserialization of 'Generator' is not allowed' in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): unserialize('C:9:"Generator"...')
|
||||
|
|
|
@ -470,6 +470,7 @@ struct _zend_class_entry {
|
|||
union _zend_function *__call;
|
||||
union _zend_function *__callstatic;
|
||||
union _zend_function *__tostring;
|
||||
union _zend_function *__debugInfo;
|
||||
union _zend_function *serialize_func;
|
||||
union _zend_function *unserialize_func;
|
||||
|
||||
|
|
|
@ -1128,7 +1128,7 @@ static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS
|
|||
int ret;
|
||||
zend_class_entry *old_scope = *scope;
|
||||
*scope = prop_info->ce;
|
||||
ret = zval_update_constant(pp, (void*)1 TSRMLS_CC);
|
||||
ret = zval_update_constant(pp, 1 TSRMLS_CC);
|
||||
*scope = old_scope;
|
||||
return ret;
|
||||
}
|
||||
|
@ -1137,7 +1137,7 @@ static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS
|
|||
} while (ce);
|
||||
|
||||
}
|
||||
return zval_update_constant(pp, (void*)1 TSRMLS_CC);
|
||||
return zval_update_constant(pp, 1 TSRMLS_CC);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1151,7 +1151,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
|
|||
int i;
|
||||
|
||||
*scope = class_type;
|
||||
zend_hash_apply_with_argument(&class_type->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
|
||||
zend_hash_apply_with_argument(&class_type->constants_table, (apply_func_arg_t) zval_update_constant, (void *)1 TSRMLS_CC);
|
||||
|
||||
for (i = 0; i < class_type->default_properties_count; i++) {
|
||||
if (Z_TYPE(class_type->default_properties_table[i]) != IS_UNDEF) {
|
||||
|
@ -2085,6 +2085,9 @@ ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce,
|
|||
!memcmp(lcname, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && fptr->common.num_args != 0
|
||||
) {
|
||||
zend_error(error_type, "Method %s::%s() cannot take arguments", ce->name->val, ZEND_TOSTRING_FUNC_NAME);
|
||||
} else if (name_len == sizeof(ZEND_DEBUGINFO_FUNC_NAME) - 1 &&
|
||||
!memcmp(lcname, ZEND_DEBUGINFO_FUNC_NAME, sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1) && fptr->common.num_args != 0) {
|
||||
zend_error(error_type, "Method %s::%s() cannot take arguments", ce->name->val, ZEND_DEBUGINFO_FUNC_NAME);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -2098,7 +2101,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
|
|||
int count=0, unload=0;
|
||||
HashTable *target_function_table = function_table;
|
||||
int error_type;
|
||||
zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL;
|
||||
zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL, *__debugInfo = NULL;
|
||||
zend_string *lowercase_name;
|
||||
int fname_len;
|
||||
const char *lc_class_name = NULL;
|
||||
|
@ -2250,6 +2253,8 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
|
|||
__unset = reg_function;
|
||||
} else if ((fname_len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME) - 1)) {
|
||||
__isset = reg_function;
|
||||
} else if ((fname_len == sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_DEBUGINFO_FUNC_NAME, sizeof(ZEND_DEBUGINFO_FUNC_NAME) - 1)) {
|
||||
__debugInfo = reg_function;
|
||||
} else {
|
||||
reg_function = NULL;
|
||||
}
|
||||
|
@ -2289,6 +2294,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
|
|||
scope->__set = __set;
|
||||
scope->__unset = __unset;
|
||||
scope->__isset = __isset;
|
||||
scope->__debugInfo = __debugInfo;
|
||||
if (ctor) {
|
||||
ctor->common.fn_flags |= ZEND_ACC_CTOR;
|
||||
if (ctor->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
|
@ -2352,6 +2358,11 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
|
|||
}
|
||||
__isset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
if (__debugInfo) {
|
||||
if (__debugInfo->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __debugInfo->common.function_name->val);
|
||||
}
|
||||
}
|
||||
efree((char*)lc_class_name);
|
||||
}
|
||||
return SUCCESS;
|
||||
|
|
|
@ -193,6 +193,7 @@ typedef struct _zend_fcall_info_cache {
|
|||
class_container.__set = handle_propset; \
|
||||
class_container.__unset = handle_propunset; \
|
||||
class_container.__isset = handle_propisset; \
|
||||
class_container.__debugInfo = NULL; \
|
||||
class_container.serialize_func = NULL; \
|
||||
class_container.unserialize_func = NULL; \
|
||||
class_container.serialize = NULL; \
|
||||
|
|
|
@ -106,6 +106,13 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
|
|||
zval_dtor(&op1);
|
||||
zval_dtor(&op2);
|
||||
break;
|
||||
case ZEND_POW:
|
||||
zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
|
||||
zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
|
||||
pow_function(result, &op1, &op2 TSRMLS_CC);
|
||||
zval_dtor(&op1);
|
||||
zval_dtor(&op2);
|
||||
break;
|
||||
case ZEND_DIV:
|
||||
zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
|
||||
zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
|
||||
|
@ -224,7 +231,7 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
|
|||
case ZEND_CONST:
|
||||
ZVAL_DUP(result, &ast->u.val);
|
||||
if (Z_OPT_CONSTANT_P(result)) {
|
||||
zval_update_constant_ex(result, (void *) 1, scope TSRMLS_CC);
|
||||
zval_update_constant_ex(result, 1, scope TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
case ZEND_BOOL_AND:
|
||||
|
@ -288,24 +295,15 @@ ZEND_API zend_ast *zend_ast_copy(zend_ast *ast)
|
|||
zend_ast *copy = zend_ast_create_constant(&ast->u.val);
|
||||
zval_copy_ctor(©->u.val);
|
||||
return copy;
|
||||
} else {
|
||||
switch (ast->children) {
|
||||
case 1:
|
||||
return zend_ast_create_unary(
|
||||
ast->kind,
|
||||
zend_ast_copy((&ast->u.child)[0]));
|
||||
case 2:
|
||||
return zend_ast_create_binary(
|
||||
ast->kind,
|
||||
zend_ast_copy((&ast->u.child)[0]),
|
||||
zend_ast_copy((&ast->u.child)[1]));
|
||||
case 3:
|
||||
return zend_ast_create_ternary(
|
||||
ast->kind,
|
||||
zend_ast_copy((&ast->u.child)[0]),
|
||||
zend_ast_copy((&ast->u.child)[1]),
|
||||
zend_ast_copy((&ast->u.child)[2]));
|
||||
} else if (ast->children) {
|
||||
zend_ast *new = emalloc(sizeof(zend_ast) + sizeof(zend_ast*) * (ast->children - 1));
|
||||
int i;
|
||||
new->kind = ast->kind;
|
||||
new->children = ast->children;
|
||||
for (i = 0; i < ast->children; i++) {
|
||||
(&new->u.child)[i] = zend_ast_copy((&ast->u.child)[i]);
|
||||
}
|
||||
return new;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -97,6 +97,13 @@ ZEND_API zend_compiler_globals compiler_globals;
|
|||
ZEND_API zend_executor_globals executor_globals;
|
||||
#endif
|
||||
|
||||
static void zend_push_function_call_entry(zend_function *fbc TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_function_call_entry fcall = { fbc };
|
||||
zend_stack_push(&CG(function_call_stack), &fcall, sizeof(zend_function_call_entry));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void zend_duplicate_property_info(zend_property_info *property_info) /* {{{ */
|
||||
{
|
||||
STR_ADDREF(property_info->name);
|
||||
|
@ -1611,6 +1618,11 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
|
|||
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
|
||||
zend_error(E_WARNING, "The magic method __invoke() must have public visibility and cannot be static");
|
||||
}
|
||||
|
||||
} else if ((name->len == sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_DEBUGINFO_FUNC_NAME, sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1))) {
|
||||
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
|
||||
zend_error(E_WARNING, "The magic method __debugInfo() must have public visibility and cannot be static");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
char *class_lcname;
|
||||
|
@ -1671,6 +1683,11 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
|
|||
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
|
||||
zend_error(E_WARNING, "The magic method __invoke() must have public visibility and cannot be static");
|
||||
}
|
||||
} else if ((name->len == sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_DEBUGINFO_FUNC_NAME, sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1))) {
|
||||
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
|
||||
zend_error(E_WARNING, "The magic method __debugInfo() must have public visibility and cannot be static");
|
||||
}
|
||||
CG(active_class_entry)->__debugInfo = (zend_function *) CG(active_op_array);
|
||||
} else if (!(fn_flags & ZEND_ACC_STATIC)) {
|
||||
CG(active_op_array)->fn_flags |= ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
|
@ -1981,7 +1998,7 @@ int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace
|
|||
STR_RELEASE(Z_STR(function_name->u.constant));
|
||||
Z_STR(function_name->u.constant) = lcname;
|
||||
|
||||
zend_stack_push(&CG(function_call_stack), (void *) &function, sizeof(zend_function *));
|
||||
zend_push_function_call_entry(function TSRMLS_CC);
|
||||
if (CG(context).nested_calls + 1 > CG(active_op_array)->nested_calls) {
|
||||
CG(active_op_array)->nested_calls = CG(context).nested_calls + 1;
|
||||
}
|
||||
|
@ -1994,7 +2011,6 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */
|
|||
{
|
||||
zend_op *last_op;
|
||||
int last_op_number;
|
||||
unsigned char *ptr = NULL;
|
||||
|
||||
zend_do_end_variable_parse(left_bracket, BP_VAR_R, 0 TSRMLS_CC);
|
||||
zend_do_begin_variable_parse(TSRMLS_C);
|
||||
|
@ -2038,7 +2054,7 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */
|
|||
}
|
||||
}
|
||||
|
||||
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
|
||||
zend_push_function_call_entry(NULL TSRMLS_CC);
|
||||
if (++CG(context).nested_calls > CG(active_op_array)->nested_calls) {
|
||||
CG(active_op_array)->nested_calls = CG(context).nested_calls;
|
||||
}
|
||||
|
@ -2061,7 +2077,6 @@ void zend_do_clone(znode *result, znode *expr TSRMLS_DC) /* {{{ */
|
|||
|
||||
void zend_do_begin_dynamic_function_call(znode *function_name, int ns_call TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
unsigned char *ptr = NULL;
|
||||
zend_op *opline;
|
||||
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
@ -2087,7 +2102,7 @@ void zend_do_begin_dynamic_function_call(znode *function_name, int ns_call TSRML
|
|||
}
|
||||
}
|
||||
|
||||
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
|
||||
zend_push_function_call_entry(NULL TSRMLS_CC);
|
||||
if (++CG(context).nested_calls > CG(active_op_array)->nested_calls) {
|
||||
CG(active_op_array)->nested_calls = CG(context).nested_calls;
|
||||
}
|
||||
|
@ -2489,7 +2504,6 @@ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_c
|
|||
int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
znode class_node;
|
||||
unsigned char *ptr = NULL;
|
||||
zend_op *opline;
|
||||
|
||||
if (method_name->op_type == IS_CONST) {
|
||||
|
@ -2538,7 +2552,7 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na
|
|||
SET_NODE(opline->op2, method_name);
|
||||
}
|
||||
|
||||
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
|
||||
zend_push_function_call_entry(NULL TSRMLS_CC);
|
||||
if (++CG(context).nested_calls > CG(active_op_array)->nested_calls) {
|
||||
CG(active_op_array)->nested_calls = CG(context).nested_calls;
|
||||
}
|
||||
|
@ -2547,22 +2561,21 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_do_end_function_call(znode *function_name, znode *result, const znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC) /* {{{ */
|
||||
void zend_do_end_function_call(znode *function_name, znode *result, int is_method, int is_dynamic_fcall TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_op *opline;
|
||||
zend_function_call_entry *fcall;
|
||||
zend_stack_top(&CG(function_call_stack), (void **) &fcall);
|
||||
|
||||
if (is_method && function_name && function_name->op_type == IS_UNUSED) {
|
||||
/* clone */
|
||||
if (Z_LVAL(argument_list->u.constant) != 0) {
|
||||
if (fcall->arg_num != 0) {
|
||||
zend_error(E_WARNING, "Clone method does not require arguments");
|
||||
}
|
||||
opline = &CG(active_op_array)->opcodes[Z_LVAL(function_name->u.constant)];
|
||||
} else {
|
||||
zend_function **function_ptr_ptr;
|
||||
zend_stack_top(&CG(function_call_stack), (void **) &function_ptr_ptr);
|
||||
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
if (*function_ptr_ptr) {
|
||||
if (fcall->fbc) {
|
||||
opline->opcode = ZEND_DO_FCALL;
|
||||
SET_NODE(opline->op1, function_name);
|
||||
SET_UNUSED(opline->op2);
|
||||
|
@ -2586,33 +2599,39 @@ void zend_do_end_function_call(znode *function_name, znode *result, const znode
|
|||
opline->result.var = get_temporary_variable(CG(active_op_array));
|
||||
opline->result_type = IS_VAR;
|
||||
GET_NODE(result, opline->result);
|
||||
|
||||
zend_stack_del_top(&CG(function_call_stack));
|
||||
opline->extended_value = Z_LVAL(argument_list->u.constant);
|
||||
opline->extended_value = fcall->arg_num;
|
||||
|
||||
if (CG(context).used_stack + 1 > CG(active_op_array)->used_stack) {
|
||||
CG(active_op_array)->used_stack = CG(context).used_stack + 1;
|
||||
}
|
||||
CG(context).used_stack -= Z_LVAL(argument_list->u.constant);
|
||||
CG(context).used_stack -= fcall->arg_num;
|
||||
zend_stack_del_top(&CG(function_call_stack));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) /* {{{ */
|
||||
void zend_do_pass_param(znode *param, zend_uchar op TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_op *opline;
|
||||
int original_op = op;
|
||||
zend_function **function_ptr_ptr, *function_ptr;
|
||||
zend_function_call_entry *fcall;
|
||||
zend_function *function_ptr;
|
||||
int send_by_reference = 0;
|
||||
int send_function = 0;
|
||||
|
||||
zend_stack_top(&CG(function_call_stack), (void **) &function_ptr_ptr);
|
||||
function_ptr = *function_ptr_ptr;
|
||||
zend_stack_top(&CG(function_call_stack), (void **) &fcall);
|
||||
function_ptr = fcall->fbc;
|
||||
fcall->arg_num++;
|
||||
|
||||
if (fcall->uses_argument_unpacking) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR,
|
||||
"Cannot use positional argument after argument unpacking");
|
||||
}
|
||||
|
||||
if (original_op == ZEND_SEND_REF) {
|
||||
if (function_ptr &&
|
||||
function_ptr->common.function_name &&
|
||||
function_ptr->common.type == ZEND_USER_FUNCTION &&
|
||||
!ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) {
|
||||
!ARG_SHOULD_BE_SENT_BY_REF(function_ptr, fcall->arg_num)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR,
|
||||
"Call-time pass-by-reference has been removed; "
|
||||
"If you would like to pass argument by reference, modify the declaration of %s().",
|
||||
|
@ -2624,7 +2643,7 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) /* {{
|
|||
}
|
||||
|
||||
if (function_ptr) {
|
||||
if (ARG_MAY_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) {
|
||||
if (ARG_MAY_BE_SENT_BY_REF(function_ptr, fcall->arg_num)) {
|
||||
if (op == ZEND_SEND_VAR && param->op_type & (IS_VAR|IS_CV)) {
|
||||
send_by_reference = ZEND_ARG_SEND_BY_REF;
|
||||
if (zend_is_function_or_method_call(param)) {
|
||||
|
@ -2635,7 +2654,7 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) /* {{
|
|||
} else {
|
||||
op = ZEND_SEND_VAL;
|
||||
}
|
||||
} else if (ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) {
|
||||
} else if (ARG_SHOULD_BE_SENT_BY_REF(function_ptr, fcall->arg_num)) {
|
||||
send_by_reference = ZEND_ARG_SEND_BY_REF;
|
||||
}
|
||||
}
|
||||
|
@ -2670,7 +2689,7 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) /* {{
|
|||
if (function_ptr) {
|
||||
zend_do_end_variable_parse(param, BP_VAR_R, 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_do_end_variable_parse(param, BP_VAR_FUNC_ARG, offset TSRMLS_CC);
|
||||
zend_do_end_variable_parse(param, BP_VAR_FUNC_ARG, fcall->arg_num TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
case ZEND_SEND_REF:
|
||||
|
@ -2696,7 +2715,7 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) /* {{
|
|||
}
|
||||
opline->opcode = op;
|
||||
SET_NODE(opline->op1, param);
|
||||
opline->op2.opline_num = offset;
|
||||
opline->op2.opline_num = fcall->arg_num;
|
||||
SET_UNUSED(opline->op2);
|
||||
|
||||
if (++CG(context).used_stack > CG(active_op_array)->used_stack) {
|
||||
|
@ -2705,18 +2724,20 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) /* {{
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_do_unpack_params(znode *params, int offset TSRMLS_DC) /* {{{ */
|
||||
void zend_do_unpack_params(znode *params TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_op *opline;
|
||||
zend_function **function_ptr_ptr;
|
||||
zend_function_call_entry *fcall;
|
||||
|
||||
zend_stack_top(&CG(function_call_stack), (void **) &function_ptr_ptr);
|
||||
if (*function_ptr_ptr) {
|
||||
zend_stack_top(&CG(function_call_stack), (void **) &fcall);
|
||||
fcall->uses_argument_unpacking = 1;
|
||||
|
||||
if (fcall->fbc) {
|
||||
/* If argument unpacking is used argument numbers and sending modes can no longer be
|
||||
* computed at compile time, thus we need access to EX(call). In order to have it we
|
||||
* retroactively emit a ZEND_INIT_FCALL_BY_NAME opcode. */
|
||||
zval func_name;
|
||||
ZVAL_STR(&func_name, STR_COPY((*function_ptr_ptr)->common.function_name));
|
||||
ZVAL_STR(&func_name, STR_COPY(fcall->fbc->common.function_name));
|
||||
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_INIT_FCALL_BY_NAME;
|
||||
|
@ -2727,14 +2748,14 @@ void zend_do_unpack_params(znode *params, int offset TSRMLS_DC) /* {{{ */
|
|||
GET_CACHE_SLOT(opline->op2.constant);
|
||||
|
||||
++CG(context).nested_calls;
|
||||
*function_ptr_ptr = NULL;
|
||||
fcall->fbc = NULL;
|
||||
}
|
||||
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_SEND_UNPACK;
|
||||
SET_NODE(opline->op1, params);
|
||||
SET_UNUSED(opline->op2);
|
||||
opline->op2.num = (zend_uint) offset;
|
||||
opline->op2.num = fcall->arg_num;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -3134,6 +3155,9 @@ static void do_inherit_parent_constructor(zend_class_entry *ce) /* {{{ */
|
|||
if (!ce->destructor) {
|
||||
ce->destructor = ce->parent->destructor;
|
||||
}
|
||||
if (!ce->__debugInfo) {
|
||||
ce->__debugInfo = ce->parent->__debugInfo;
|
||||
}
|
||||
if (ce->constructor) {
|
||||
if (ce->parent->constructor && ce->parent->constructor->common.fn_flags & ZEND_ACC_FINAL) {
|
||||
zend_error(E_ERROR, "Cannot override final %s::%s() with %s::%s()",
|
||||
|
@ -3469,7 +3493,7 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
|
|||
zval zv;
|
||||
|
||||
ZVAL_DUP(&zv, precv->op2.zv);
|
||||
zval_update_constant_ex(&zv, (void*)1, fptr->common.scope TSRMLS_CC);
|
||||
zval_update_constant_ex(&zv, 1, fptr->common.scope TSRMLS_CC);
|
||||
if (Z_TYPE(zv) == IS_BOOL) {
|
||||
if (Z_LVAL(zv)) {
|
||||
memcpy(offset, "true", 4);
|
||||
|
@ -4006,6 +4030,8 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen
|
|||
ce->__callstatic = fe;
|
||||
} else if (!strncmp(mname->val, ZEND_TOSTRING_FUNC_NAME, mname->len)) {
|
||||
ce->__tostring = fe;
|
||||
} else if (!strncmp(mname->val, ZEND_DEBUGINFO_FUNC_NAME, mname->len)) {
|
||||
ce->__debugInfo = fe;
|
||||
} else if (ce->name->len == mname->len) {
|
||||
zend_string *lowercase_name = STR_ALLOC(ce->name->len, 0);
|
||||
zend_str_tolower_copy(lowercase_name->val, ce->name->val, ce->name->len);
|
||||
|
@ -5602,7 +5628,6 @@ void zend_do_pop_object(znode *object TSRMLS_DC) /* {{{ */
|
|||
void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_op *opline;
|
||||
unsigned char *ptr = NULL;
|
||||
|
||||
new_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
@ -5613,18 +5638,18 @@ void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC) /*
|
|||
SET_NODE(opline->op1, class_type);
|
||||
SET_UNUSED(opline->op2);
|
||||
|
||||
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(unsigned char *));
|
||||
zend_push_function_call_entry(NULL TSRMLS_CC);
|
||||
if (++CG(context).nested_calls > CG(active_op_array)->nested_calls) {
|
||||
CG(active_op_array)->nested_calls = CG(context).nested_calls;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_do_end_new_object(znode *result, const znode *new_token, const znode *argument_list TSRMLS_DC) /* {{{ */
|
||||
void zend_do_end_new_object(znode *result, const znode *new_token TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
znode ctor_result;
|
||||
|
||||
zend_do_end_function_call(NULL, &ctor_result, argument_list, 1, 0 TSRMLS_CC);
|
||||
zend_do_end_function_call(NULL, &ctor_result, 1, 0 TSRMLS_CC);
|
||||
zend_do_free(&ctor_result TSRMLS_CC);
|
||||
|
||||
CG(active_op_array)->opcodes[new_token->u.op.opline_num].op2.opline_num = get_next_op_number(CG(active_op_array));
|
||||
|
@ -6986,6 +7011,7 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify
|
|||
ce->unserialize = NULL;
|
||||
ce->serialize_func = NULL;
|
||||
ce->unserialize_func = NULL;
|
||||
ce->__debugInfo = NULL;
|
||||
if (ce->type == ZEND_INTERNAL_CLASS) {
|
||||
ce->info.internal.module = NULL;
|
||||
ce->info.internal.builtin_functions = NULL;
|
||||
|
|
|
@ -343,6 +343,11 @@ typedef struct _zend_function_state {
|
|||
zval *arguments;
|
||||
} zend_function_state;
|
||||
|
||||
typedef struct _zend_function_call_entry {
|
||||
zend_function *fbc;
|
||||
zend_uint arg_num;
|
||||
zend_bool uses_argument_unpacking;
|
||||
} zend_function_call_entry;
|
||||
|
||||
typedef struct _zend_switch_entry {
|
||||
znode cond;
|
||||
|
@ -506,7 +511,7 @@ void zend_do_begin_dynamic_function_call(znode *function_name, int prefix_len TS
|
|||
void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC);
|
||||
void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_class_member TSRMLS_DC);
|
||||
int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC);
|
||||
void zend_do_end_function_call(znode *function_name, znode *result, const znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC);
|
||||
void zend_do_end_function_call(znode *function_name, znode *result, int is_method, int is_dynamic_fcall TSRMLS_DC);
|
||||
void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC);
|
||||
void zend_do_yield(znode *result, znode *value, znode *key, zend_bool is_variable TSRMLS_DC);
|
||||
void zend_do_handle_exception(TSRMLS_D);
|
||||
|
@ -542,8 +547,8 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
|
|||
void zend_do_early_binding(TSRMLS_D);
|
||||
ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS_DC);
|
||||
|
||||
void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC);
|
||||
void zend_do_unpack_params(znode *params, int offset TSRMLS_DC);
|
||||
void zend_do_pass_param(znode *param, zend_uchar op TSRMLS_DC);
|
||||
void zend_do_unpack_params(znode *params TSRMLS_DC);
|
||||
|
||||
|
||||
void zend_do_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC);
|
||||
|
@ -573,7 +578,7 @@ void zend_do_pop_object(znode *object TSRMLS_DC);
|
|||
|
||||
|
||||
void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC);
|
||||
void zend_do_end_new_object(znode *result, const znode *new_token, const znode *argument_list TSRMLS_DC);
|
||||
void zend_do_end_new_object(znode *result, const znode *new_token TSRMLS_DC);
|
||||
|
||||
void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode, zend_bool check_namespace TSRMLS_DC);
|
||||
|
||||
|
@ -862,6 +867,7 @@ END_EXTERN_C()
|
|||
#define ZEND_TOSTRING_FUNC_NAME "__tostring"
|
||||
#define ZEND_AUTOLOAD_FUNC_NAME "__autoload"
|
||||
#define ZEND_INVOKE_FUNC_NAME "__invoke"
|
||||
#define ZEND_DEBUGINFO_FUNC_NAME "__debuginfo"
|
||||
|
||||
/* The following constants may be combined in CG(compiler_options)
|
||||
* to change the default compiler behavior */
|
||||
|
|
|
@ -396,7 +396,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
|
|||
STR_FREE(class_name);
|
||||
STR_FREE(constant_name);
|
||||
if (ret_constant && Z_CONSTANT_P(ret_constant)) {
|
||||
zval_update_constant_ex(ret_constant, (void*)1, ce TSRMLS_CC);
|
||||
zval_update_constant_ex(ret_constant, 1, ce TSRMLS_CC);
|
||||
}
|
||||
return ret_constant;
|
||||
}
|
||||
|
|
|
@ -360,6 +360,13 @@ ZEND_METHOD(error_exception, getSeverity)
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define TRACE_ARG_APPEND(vallen) do { \
|
||||
int len = str->len; \
|
||||
str = STR_REALLOC(str, len + vallen, 0); \
|
||||
memmove(str->val + len - l_added + 1 + vallen, str->val + len - l_added + 1, l_added); \
|
||||
} while (0)
|
||||
|
||||
/* }}} */
|
||||
|
||||
static int _build_trace_args(zval *arg TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
|
||||
|
@ -370,7 +377,7 @@ static int _build_trace_args(zval *arg TSRMLS_DC, int num_args, va_list args, ze
|
|||
str = *str_ptr;
|
||||
|
||||
/* the trivial way would be to do:
|
||||
* conver_to_string_ex(arg);
|
||||
* convert_to_string_ex(arg);
|
||||
* append it and kill the now tmp arg.
|
||||
* but that could cause some E_NOTICE and also damn long lines.
|
||||
*/
|
||||
|
@ -394,8 +401,57 @@ static int _build_trace_args(zval *arg TSRMLS_DC, int num_args, va_list args, ze
|
|||
l_added += 3 + 1;
|
||||
}
|
||||
while (--l_added) {
|
||||
if (str->val[str->len - l_added] < 32) {
|
||||
str->val[str->len - l_added] = '?';
|
||||
unsigned char chr = str->val[str->len - l_added];
|
||||
if (chr < 32 || chr == '\\' || chr > 126) {
|
||||
str->val[str->len - l_added] = '\\';
|
||||
|
||||
switch (chr) {
|
||||
case '\n':
|
||||
TRACE_ARG_APPEND(1);
|
||||
str->val[str->len - l_added] = 'n';
|
||||
break;
|
||||
case '\r':
|
||||
TRACE_ARG_APPEND(1);
|
||||
str->val[str->len - l_added] = 'r';
|
||||
break;
|
||||
case '\t':
|
||||
TRACE_ARG_APPEND(1);
|
||||
str->val[str->len - l_added] = 't';
|
||||
break;
|
||||
case '\f':
|
||||
TRACE_ARG_APPEND(1);
|
||||
str->val[str->len - l_added] = 'f';
|
||||
break;
|
||||
case '\v':
|
||||
TRACE_ARG_APPEND(1);
|
||||
str->val[str->len - l_added] = 'v';
|
||||
break;
|
||||
#ifndef PHP_WIN32
|
||||
case '\e':
|
||||
#else
|
||||
case VK_ESCAPE:
|
||||
#endif
|
||||
TRACE_ARG_APPEND(1);
|
||||
str->val[str->len - l_added] = 'e';
|
||||
break;
|
||||
case '\\':
|
||||
TRACE_ARG_APPEND(1);
|
||||
str->val[str->len - l_added] = '\\';
|
||||
break;
|
||||
default:
|
||||
TRACE_ARG_APPEND(3);
|
||||
str->val[str->len - l_added - 2] = 'x';
|
||||
if ((chr >> 4) < 10) {
|
||||
str->val[str->len - l_added - 1] = (chr >> 4) + '0';
|
||||
} else {
|
||||
str->val[str->len - l_added - 1] = (chr >> 4) + 'A' - 10;
|
||||
}
|
||||
if (chr % 16 < 10) {
|
||||
str->val[str->len - l_added] = chr % 16 + '0';
|
||||
} else {
|
||||
str->val[str->len - l_added] = chr % 16 + 'A' - 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1681,7 +1681,7 @@ ZEND_API zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array
|
|||
|
||||
static zend_always_inline zend_bool zend_is_by_ref_func_arg_fetch(zend_op *opline, call_slot *call TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_uint arg_num = (opline->extended_value & ZEND_FETCH_ARG_MASK) + call->num_additional_args;
|
||||
zend_uint arg_num = opline->extended_value & ZEND_FETCH_ARG_MASK;
|
||||
return ARG_SHOULD_BE_SENT_BY_REF(call->fbc, arg_num);
|
||||
}
|
||||
/* }}} */
|
||||
|
|
|
@ -134,10 +134,10 @@ again:
|
|||
return result;
|
||||
}
|
||||
|
||||
ZEND_API int zval_update_constant(zval *pp, void *arg TSRMLS_DC);
|
||||
ZEND_API int zval_update_constant_inline_change(zval *pp, void *arg TSRMLS_DC);
|
||||
ZEND_API int zval_update_constant_no_inline_change(zval *pp, void *arg TSRMLS_DC);
|
||||
ZEND_API int zval_update_constant_ex(zval *pp, void *arg, zend_class_entry *scope TSRMLS_DC);
|
||||
ZEND_API int zval_update_constant(zval *pp, zend_bool inline_change TSRMLS_DC);
|
||||
ZEND_API int zval_update_constant_inline_change(zval *pp, zend_class_entry *scope TSRMLS_DC);
|
||||
ZEND_API int zval_update_constant_no_inline_change(zval *pp, zend_class_entry *scope TSRMLS_DC);
|
||||
ZEND_API int zval_update_constant_ex(zval *pp, zend_bool inline_change, zend_class_entry *scope TSRMLS_DC);
|
||||
|
||||
/* dedicated Zend executor functions - do not use! */
|
||||
#define ZEND_VM_STACK_PAGE_SIZE ((16 * 1024) - 16)
|
||||
|
|
|
@ -501,14 +501,13 @@ ZEND_API int zend_is_true(zval *op TSRMLS_DC) /* {{{ */
|
|||
|
||||
#include "../TSRM/tsrm_strtok_r.h"
|
||||
|
||||
#define IS_VISITED_CONSTANT 0x080
|
||||
#define IS_VISITED_CONSTANT 0x80
|
||||
#define IS_CONSTANT_VISITED(p) (Z_TYPE_P(p) & IS_VISITED_CONSTANT)
|
||||
#define Z_REAL_TYPE_P(p) (Z_TYPE_P(p) & ~IS_VISITED_CONSTANT)
|
||||
#define MARK_CONSTANT_VISITED(p) Z_TYPE_INFO_P(p) |= IS_VISITED_CONSTANT
|
||||
|
||||
ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_class_entry *scope TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_bool inline_change = (zend_bool) (zend_uintptr_t) arg;
|
||||
zval *const_value, tmp;
|
||||
char *colon;
|
||||
|
||||
|
@ -588,7 +587,7 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope
|
|||
//???!
|
||||
ZVAL_COPY_VALUE(p, const_value);
|
||||
if (Z_OPT_CONSTANT_P(p)) {
|
||||
zval_update_constant_ex(p, (void*)1, NULL TSRMLS_CC);
|
||||
zval_update_constant_ex(p, 1, NULL TSRMLS_CC);
|
||||
}
|
||||
zval_opt_copy_ctor(p);
|
||||
}
|
||||
|
@ -670,7 +669,7 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope
|
|||
//???!
|
||||
ZVAL_COPY_VALUE(&tmp, const_value);
|
||||
if (Z_OPT_CONSTANT(tmp)) {
|
||||
zval_update_constant_ex(&tmp, (void*)1, NULL TSRMLS_CC);
|
||||
zval_update_constant_ex(&tmp, 1, NULL TSRMLS_CC);
|
||||
}
|
||||
zval_opt_copy_ctor(&tmp);
|
||||
const_value = &tmp;
|
||||
|
@ -721,21 +720,21 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zval_update_constant_inline_change(zval *pp, void *scope TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zval_update_constant_inline_change(zval *pp, zend_class_entry *scope TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return zval_update_constant_ex(pp, (void*)1, scope TSRMLS_CC);
|
||||
return zval_update_constant_ex(pp, 1, scope TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zval_update_constant_no_inline_change(zval *pp, void *scope TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zval_update_constant_no_inline_change(zval *pp, zend_class_entry *scope TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return zval_update_constant_ex(pp, (void*)0, scope TSRMLS_CC);
|
||||
return zval_update_constant_ex(pp, 0, scope TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zval_update_constant(zval *pp, void *arg TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zval_update_constant(zval *pp, zend_bool inline_change TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return zval_update_constant_ex(pp, arg, NULL TSRMLS_CC);
|
||||
return zval_update_constant_ex(pp, inline_change, NULL TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ ZEND_API void zend_html_putc(char c)
|
|||
ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC)
|
||||
{
|
||||
const unsigned char *ptr = (const unsigned char*)s, *end = ptr + len;
|
||||
unsigned char *filtered;
|
||||
unsigned char *filtered = NULL;
|
||||
size_t filtered_len;
|
||||
|
||||
if (LANG_SCNG(output_filter)) {
|
||||
|
|
|
@ -120,7 +120,7 @@ static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC)
|
|||
if (Z_TYPE_P(c) != IS_STRING) {
|
||||
ZVAL_COPY_VALUE(&tmp, c);
|
||||
if (Z_OPT_CONSTANT(tmp)) {
|
||||
zval_update_constant_ex(&tmp, (void*)1, NULL TSRMLS_CC);
|
||||
zval_update_constant_ex(&tmp, 1, NULL TSRMLS_CC);
|
||||
}
|
||||
zval_opt_copy_ctor(&tmp);
|
||||
convert_to_string(&tmp);
|
||||
|
|
|
@ -72,7 +72,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
|
|||
%token T_PRINT "print (T_PRINT)"
|
||||
%right T_YIELD
|
||||
%token T_YIELD "yield (T_YIELD)"
|
||||
%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL
|
||||
%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL
|
||||
%token T_PLUS_EQUAL "+= (T_PLUS_EQUAL)"
|
||||
%token T_MINUS_EQUAL "-= (T_MINUS_EQUAL)"
|
||||
%token T_MUL_EQUAL "*= (T_MUL_EQUAL)"
|
||||
|
@ -109,6 +109,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
|
|||
%nonassoc T_INSTANCEOF
|
||||
%token T_INSTANCEOF "instanceof (T_INSTANCEOF)"
|
||||
%right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
|
||||
%right T_POW
|
||||
%token T_INC "++ (T_INC)"
|
||||
%token T_DEC "-- (T_DEC)"
|
||||
%token T_INT_CAST "(int) (T_INT_CAST)"
|
||||
|
@ -213,6 +214,8 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
|
|||
%token T_DIR "__DIR__ (T_DIR)"
|
||||
%token T_NS_SEPARATOR "\\ (T_NS_SEPARATOR)"
|
||||
%token T_ELLIPSIS "... (T_ELLIPSIS)"
|
||||
%token T_POW "** (T_POW)"
|
||||
%token T_POW_EQUAL "**= (T_POW_EQUAL)"
|
||||
|
||||
%% /* Rules */
|
||||
|
||||
|
@ -577,19 +580,20 @@ optional_class_type:
|
|||
function_call_parameter_list:
|
||||
'(' ')' { Z_LVAL($$.u.constant) = 0; }
|
||||
| '(' non_empty_function_call_parameter_list ')' { $$ = $2; }
|
||||
| '(' yield_expr ')' { Z_LVAL($$.u.constant) = 1; zend_do_pass_param(&$2, ZEND_SEND_VAL, Z_LVAL($$.u.constant) TSRMLS_CC); }
|
||||
| '(' yield_expr ')' { zend_do_pass_param(&$2, ZEND_SEND_VAL TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
non_empty_function_call_parameter_list:
|
||||
expr_without_variable { Z_LVAL($$.u.constant) = 1; zend_do_pass_param(&$1, ZEND_SEND_VAL, Z_LVAL($$.u.constant) TSRMLS_CC); }
|
||||
| variable { Z_LVAL($$.u.constant) = 1; zend_do_pass_param(&$1, ZEND_SEND_VAR, Z_LVAL($$.u.constant) TSRMLS_CC); }
|
||||
| '&' w_variable { Z_LVAL($$.u.constant) = 1; zend_do_pass_param(&$2, ZEND_SEND_REF, Z_LVAL($$.u.constant) TSRMLS_CC); }
|
||||
| T_ELLIPSIS expr { Z_LVAL($$.u.constant) = 0; zend_do_unpack_params(&$2, Z_LVAL($$.u.constant) TSRMLS_CC); }
|
||||
| non_empty_function_call_parameter_list ',' expr_without_variable { Z_LVAL($$.u.constant)=Z_LVAL($1.u.constant)+1; zend_do_pass_param(&$3, ZEND_SEND_VAL, Z_LVAL($$.u.constant) TSRMLS_CC); }
|
||||
| non_empty_function_call_parameter_list ',' variable { Z_LVAL($$.u.constant)=Z_LVAL($1.u.constant)+1; zend_do_pass_param(&$3, ZEND_SEND_VAR, Z_LVAL($$.u.constant) TSRMLS_CC); }
|
||||
| non_empty_function_call_parameter_list ',' '&' w_variable { Z_LVAL($$.u.constant)=Z_LVAL($1.u.constant)+1; zend_do_pass_param(&$4, ZEND_SEND_REF, Z_LVAL($$.u.constant) TSRMLS_CC); }
|
||||
| non_empty_function_call_parameter_list ',' T_ELLIPSIS expr { Z_LVAL($$.u.constant)=Z_LVAL($1.u.constant); zend_do_unpack_params(&$4, Z_LVAL($$.u.constant) TSRMLS_CC); }
|
||||
function_call_parameter
|
||||
| non_empty_function_call_parameter_list ',' function_call_parameter
|
||||
;
|
||||
|
||||
function_call_parameter:
|
||||
expr_without_variable { zend_do_pass_param(&$1, ZEND_SEND_VAL TSRMLS_CC); }
|
||||
| variable { zend_do_pass_param(&$1, ZEND_SEND_VAR TSRMLS_CC); }
|
||||
| '&' w_variable { zend_do_pass_param(&$2, ZEND_SEND_REF TSRMLS_CC); }
|
||||
| T_ELLIPSIS expr { zend_do_unpack_params(&$2 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
global_var_list:
|
||||
|
@ -766,18 +770,19 @@ instance_call:
|
|||
;
|
||||
|
||||
new_expr:
|
||||
T_NEW class_name_reference { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$1, &$2 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$1, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
T_NEW class_name_reference { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$1, &$2 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
;
|
||||
|
||||
expr_without_variable:
|
||||
T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' '=' expr { zend_do_list_end(&$$, &$7 TSRMLS_CC); }
|
||||
| variable '=' expr { zend_check_writable_variable(&$1); zend_do_assign(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
| variable '=' '&' variable { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$4, BP_VAR_W, 1 TSRMLS_CC); zend_do_end_variable_parse(&$1, BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); }
|
||||
| variable '=' '&' T_NEW class_name_reference { zend_error(E_DEPRECATED, "Assigning the return value of new by reference is deprecated"); zend_check_writable_variable(&$1); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(&$1, BP_VAR_W, 0 TSRMLS_CC); $3.EA = ZEND_PARSED_NEW; zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
| variable '=' '&' T_NEW class_name_reference { zend_error(E_DEPRECATED, "Assigning the return value of new by reference is deprecated"); zend_check_writable_variable(&$1); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(&$1, BP_VAR_W, 0 TSRMLS_CC); $3.EA = ZEND_PARSED_NEW; zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
| T_CLONE expr { zend_do_clone(&$$, &$2 TSRMLS_CC); }
|
||||
| variable T_PLUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| variable T_MINUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| variable T_MUL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| variable T_POW_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_POW, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| variable T_DIV_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_DIV, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| variable T_CONCAT_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_CONCAT, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| variable T_MOD_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MOD, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
|
@ -802,6 +807,7 @@ expr_without_variable:
|
|||
| expr '+' expr { zend_do_binary_op(ZEND_ADD, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '-' expr { zend_do_binary_op(ZEND_SUB, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '*' expr { zend_do_binary_op(ZEND_MUL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr T_POW expr { zend_do_binary_op(ZEND_POW, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '/' expr { zend_do_binary_op(ZEND_DIV, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr '%' expr { zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr T_SL expr { zend_do_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
|
@ -885,21 +891,21 @@ lexical_var_list:
|
|||
|
||||
function_call:
|
||||
namespace_name { $$.u.op.opline_num = zend_do_begin_function_call(&$1, 1 TSRMLS_CC); }
|
||||
function_call_parameter_list { zend_do_end_function_call(&$1, &$$, &$3, 0, $2.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
|
||||
function_call_parameter_list { zend_do_end_function_call(&$1, &$$, 0, $2.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $1.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$1.u.constant); zend_do_build_namespace_name(&$1, &$1, &$3 TSRMLS_CC); $$.u.op.opline_num = zend_do_begin_function_call(&$1, 0 TSRMLS_CC); }
|
||||
function_call_parameter_list { zend_do_end_function_call(&$1, &$$, &$5, 0, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
|
||||
function_call_parameter_list { zend_do_end_function_call(&$1, &$$, 0, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
|
||||
| T_NS_SEPARATOR namespace_name { $$.u.op.opline_num = zend_do_begin_function_call(&$2, 0 TSRMLS_CC); }
|
||||
function_call_parameter_list { zend_do_end_function_call(&$2, &$$, &$4, 0, $3.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
|
||||
function_call_parameter_list { zend_do_end_function_call(&$2, &$$, 0, $3.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM variable_name { $$.u.op.opline_num = zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
function_call_parameter_list { zend_do_end_function_call($4.u.op.opline_num?NULL:&$3, &$$, &$5, $4.u.op.opline_num, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
function_call_parameter_list { zend_do_end_function_call($4.u.op.opline_num?NULL:&$3, &$$, $4.u.op.opline_num, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
function_call_parameter_list { zend_do_end_function_call(NULL, &$$, &$5, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
function_call_parameter_list { zend_do_end_function_call(NULL, &$$, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_name { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
function_call_parameter_list { zend_do_end_function_call(NULL, &$$, &$5, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
function_call_parameter_list { zend_do_end_function_call(NULL, &$$, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
function_call_parameter_list { zend_do_end_function_call(NULL, &$$, &$5, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
function_call_parameter_list { zend_do_end_function_call(NULL, &$$, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| variable_without_objects { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1, 0 TSRMLS_CC); }
|
||||
function_call_parameter_list { zend_do_end_function_call(&$1, &$$, &$3, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
function_call_parameter_list { zend_do_end_function_call(&$1, &$$, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
;
|
||||
|
||||
class_name:
|
||||
|
@ -1000,6 +1006,7 @@ static_operation:
|
|||
static_scalar_value '+' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_ADD, $1.u.ast, $3.u.ast); }
|
||||
| static_scalar_value '-' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_SUB, $1.u.ast, $3.u.ast); }
|
||||
| static_scalar_value '*' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_MUL, $1.u.ast, $3.u.ast); }
|
||||
| static_scalar_value T_POW static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_POW, $1.u.ast, $3.u.ast); }
|
||||
| static_scalar_value '/' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_DIV, $1.u.ast, $3.u.ast); }
|
||||
| static_scalar_value '%' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_MOD, $1.u.ast, $3.u.ast); }
|
||||
| '!' static_scalar_value { $$.u.ast = zend_ast_create_unary(ZEND_BOOL_NOT, $2.u.ast); }
|
||||
|
@ -1112,7 +1119,7 @@ array_method_dereference:
|
|||
|
||||
method:
|
||||
{ zend_do_pop_object(&$$ TSRMLS_CC); zend_do_begin_method_call(&$$ TSRMLS_CC); }
|
||||
function_call_parameter_list { zend_do_end_function_call(&$1, &$$, &$2, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
|
||||
function_call_parameter_list { zend_do_end_function_call(&$1, &$$, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
|
||||
;
|
||||
|
||||
method_or_not:
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1402,6 +1402,14 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
|||
return T_MUL_EQUAL;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"*\*" {
|
||||
return T_POW;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"*\*=" {
|
||||
return T_POW_EQUAL;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"/=" {
|
||||
return T_DIV_EQUAL;
|
||||
}
|
||||
|
|
|
@ -137,8 +137,39 @@ ZEND_API HashTable *zend_std_get_gc(zval *object, zval **table, int *n TSRMLS_DC
|
|||
|
||||
ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_class_entry *ce = Z_OBJCE_P(object);
|
||||
zval retval;
|
||||
HashTable *ht;
|
||||
|
||||
if (!ce->__debugInfo) {
|
||||
*is_temp = 0;
|
||||
return zend_std_get_properties(object TSRMLS_CC);
|
||||
return Z_OBJ_HANDLER_P(object, get_properties)
|
||||
? Z_OBJ_HANDLER_P(object, get_properties)(object TSRMLS_CC)
|
||||
: NULL;
|
||||
}
|
||||
|
||||
zend_call_method_with_0_params(object, ce, &ce->__debugInfo, ZEND_DEBUGINFO_FUNC_NAME, &retval);
|
||||
if (Z_TYPE(retval) == IS_ARRAY) {
|
||||
if (Z_REFCOUNT(retval) <= 1) {
|
||||
*is_temp = 1;
|
||||
ALLOC_HASHTABLE(ht);
|
||||
*ht = *Z_ARRVAL(retval);
|
||||
efree(Z_ARR(retval));
|
||||
return ht;
|
||||
} else {
|
||||
*is_temp = 0;
|
||||
zval_ptr_dtor(&retval);
|
||||
}
|
||||
} else if (Z_TYPE(retval) == IS_NULL) {
|
||||
*is_temp = 1;
|
||||
ALLOC_HASHTABLE(ht);
|
||||
zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
return ht;
|
||||
}
|
||||
|
||||
zend_error_noreturn(E_ERROR, ZEND_DEBUGINFO_FUNC_NAME "() must return an array");
|
||||
|
||||
return NULL; /* Compilers are dumb and don't understand that noreturn means that the function does NOT need a return value... */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -1623,7 +1654,7 @@ ZEND_API zend_object_handlers std_object_handlers = {
|
|||
zend_std_compare_objects, /* compare_objects */
|
||||
zend_std_cast_object_tostring, /* cast_object */
|
||||
NULL, /* count_elements */
|
||||
NULL, /* get_debug_info */
|
||||
zend_std_get_debug_info, /* get_debug_info */
|
||||
zend_std_get_closure, /* get_closure */
|
||||
zend_std_get_gc, /* get_gc */
|
||||
NULL, /* do_operation */
|
||||
|
|
|
@ -749,6 +749,9 @@ ZEND_API binary_op_type get_binary_op(int opcode)
|
|||
case ZEND_ASSIGN_MUL:
|
||||
return (binary_op_type) mul_function;
|
||||
break;
|
||||
case ZEND_POW:
|
||||
return (binary_op_type) pow_function;
|
||||
break;
|
||||
case ZEND_DIV:
|
||||
case ZEND_ASSIGN_DIV:
|
||||
return (binary_op_type) div_function;
|
||||
|
|
|
@ -1126,6 +1126,89 @@ ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ *
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int pow_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
zval op1_copy, op2_copy;
|
||||
int converted = 0;
|
||||
|
||||
while (1) {
|
||||
switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) {
|
||||
case TYPE_PAIR(IS_LONG, IS_LONG):
|
||||
if (Z_LVAL_P(op2) >= 0) {
|
||||
long l1 = 1, l2 = Z_LVAL_P(op1), i = Z_LVAL_P(op2);
|
||||
|
||||
if (i == 0) {
|
||||
ZVAL_LONG(result, 1L);
|
||||
return SUCCESS;
|
||||
} else if (l2 == 0) {
|
||||
ZVAL_LONG(result, 0);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
while (i >= 1) {
|
||||
long overflow;
|
||||
double dval = 0.0;
|
||||
|
||||
if (i % 2) {
|
||||
--i;
|
||||
ZEND_SIGNED_MULTIPLY_LONG(l1, l2, l1, dval, overflow);
|
||||
if (overflow) {
|
||||
ZVAL_DOUBLE(result, dval * pow(l2, i));
|
||||
return SUCCESS;
|
||||
}
|
||||
} else {
|
||||
i /= 2;
|
||||
ZEND_SIGNED_MULTIPLY_LONG(l2, l2, l2, dval, overflow);
|
||||
if (overflow) {
|
||||
ZVAL_DOUBLE(result, (double)l1 * pow(dval, i));
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* i == 0 */
|
||||
ZVAL_LONG(result, l1);
|
||||
} else {
|
||||
ZVAL_DOUBLE(result, pow((double)Z_LVAL_P(op1), (double)Z_LVAL_P(op2)));
|
||||
}
|
||||
return SUCCESS;
|
||||
|
||||
case TYPE_PAIR(IS_LONG, IS_DOUBLE):
|
||||
ZVAL_DOUBLE(result, pow((double)Z_LVAL_P(op1), Z_DVAL_P(op2)));
|
||||
return SUCCESS;
|
||||
|
||||
case TYPE_PAIR(IS_DOUBLE, IS_LONG):
|
||||
ZVAL_DOUBLE(result, pow(Z_DVAL_P(op1), (double)Z_LVAL_P(op2)));
|
||||
return SUCCESS;
|
||||
|
||||
case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
|
||||
ZVAL_DOUBLE(result, pow(Z_DVAL_P(op1), Z_DVAL_P(op2)));
|
||||
return SUCCESS;
|
||||
|
||||
default:
|
||||
if (!converted) {
|
||||
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_POW);
|
||||
|
||||
if (Z_TYPE_P(op1) == IS_ARRAY) {
|
||||
ZVAL_LONG(result, 0);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
}
|
||||
if (Z_TYPE_P(op2) == IS_ARRAY) {
|
||||
ZVAL_LONG(result, 1L);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
}
|
||||
converted = 1;
|
||||
} else {
|
||||
zend_error(E_ERROR, "Unsupported operand types");
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval op1_copy, op2_copy;
|
||||
|
|
|
@ -47,6 +47,7 @@ BEGIN_EXTERN_C()
|
|||
ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
ZEND_API int pow_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
|
|
|
@ -1194,7 +1194,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
|
|||
}
|
||||
}
|
||||
if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_STATIC) {
|
||||
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
|
||||
zval_update_constant(retval, 1 TSRMLS_CC);
|
||||
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
|
||||
FREE_OP1();
|
||||
}
|
||||
|
@ -2992,9 +2992,8 @@ ZEND_VM_HANDLER(65, ZEND_SEND_VAL, CONST|TMP, ANY)
|
|||
|
||||
SAVE_OPLINE();
|
||||
if (opline->extended_value == ZEND_DO_FCALL_BY_NAME) {
|
||||
int arg_num = opline->op2.num + EX(call)->num_additional_args;
|
||||
if (ARG_MUST_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", arg_num);
|
||||
if (ARG_MUST_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.num);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3032,7 +3031,6 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
|
|||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval *varptr, *top;
|
||||
int arg_num;
|
||||
|
||||
SAVE_OPLINE();
|
||||
if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */
|
||||
|
@ -3040,8 +3038,7 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
|
|||
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper);
|
||||
}
|
||||
} else {
|
||||
arg_num = opline->op2.num + EX(call)->num_additional_args;
|
||||
if (!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
|
||||
if (!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) {
|
||||
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper);
|
||||
}
|
||||
}
|
||||
|
@ -3064,7 +3061,7 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
|
|||
} else {
|
||||
if ((opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) ?
|
||||
!(opline->extended_value & ZEND_ARG_SEND_SILENT) :
|
||||
!ARG_MAY_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
|
||||
!ARG_MAY_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) {
|
||||
zend_error(E_STRICT, "Only variables should be passed by reference");
|
||||
}
|
||||
top = zend_vm_stack_top_inc(TSRMLS_C);
|
||||
|
@ -3119,8 +3116,7 @@ ZEND_VM_HANDLER(66, ZEND_SEND_VAR, VAR|CV, ANY)
|
|||
zend_free_op free_op1;
|
||||
|
||||
if (opline->extended_value == ZEND_DO_FCALL_BY_NAME) {
|
||||
int arg_num = opline->op2.num + EX(call)->num_additional_args;
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) {
|
||||
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_SEND_REF);
|
||||
}
|
||||
}
|
||||
|
@ -3607,8 +3603,6 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
|
|||
}
|
||||
retval = EX_VAR(opline->result.var);
|
||||
ZVAL_DUP(retval, &c->value);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else {
|
||||
/* class constant */
|
||||
zend_class_entry *ce;
|
||||
|
@ -3618,8 +3612,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
|
|||
if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
|
||||
value = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
|
||||
ZVAL_DUP(EX_VAR(opline->result.var), value);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
goto constant_fetch_end;
|
||||
} else if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
|
||||
ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
|
||||
} else {
|
||||
|
@ -3636,8 +3629,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
|
|||
ce = Z_CE_P(EX_VAR(opline->op1.var));
|
||||
if ((value = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce)) != NULL) {
|
||||
ZVAL_DUP(EX_VAR(opline->result.var), value);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
goto constant_fetch_end;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3649,7 +3641,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
|
|||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
EG(scope) = ce;
|
||||
zval_update_constant(value, (void *) 1 TSRMLS_CC);
|
||||
zval_update_constant(value, 1 TSRMLS_CC);
|
||||
EG(scope) = old_scope;
|
||||
}
|
||||
if (OP1_TYPE == IS_CONST) {
|
||||
|
@ -3665,10 +3657,10 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
|
|||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
|
||||
}
|
||||
|
||||
}
|
||||
constant_fetch_end:
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUSED|CV)
|
||||
|
@ -5264,7 +5256,7 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
|
|||
if (Z_TYPE_P(val) == IS_CONSTANT_ARRAY) {
|
||||
zval_opt_copy_ctor(&c.value);
|
||||
}
|
||||
zval_update_constant(&c.value, NULL TSRMLS_CC);
|
||||
zval_update_constant(&c.value, 0 TSRMLS_CC);
|
||||
} else {
|
||||
/* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
|
||||
if (UNEXPECTED(Z_OPT_COPYABLE(c.value))) {
|
||||
|
@ -5505,4 +5497,24 @@ ZEND_VM_HANDLER(163, ZEND_FAST_RET, ANY, ANY)
|
|||
}
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(166, ZEND_POW, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R),
|
||||
GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R) TSRMLS_CC);
|
||||
FREE_OP1();
|
||||
FREE_OP2();
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(167, ZEND_ASSIGN_POW, VAR|UNUSED|CV, CONST|TMP|VAR|UNUSED|CV)
|
||||
{
|
||||
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_binary_assign_op_helper, binary_op,pow_function);
|
||||
}
|
||||
|
||||
ZEND_VM_EXPORT_HELPER(zend_do_fcall, zend_do_fcall_common_helper)
|
||||
|
|
|
@ -2687,9 +2687,8 @@ static int ZEND_FASTCALL ZEND_SEND_VAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
|
|||
|
||||
SAVE_OPLINE();
|
||||
if (opline->extended_value == ZEND_DO_FCALL_BY_NAME) {
|
||||
int arg_num = opline->op2.num + EX(call)->num_additional_args;
|
||||
if (ARG_MUST_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", arg_num);
|
||||
if (ARG_MUST_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.num);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3622,7 +3621,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type
|
|||
}
|
||||
}
|
||||
if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_STATIC) {
|
||||
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
|
||||
zval_update_constant(retval, 1 TSRMLS_CC);
|
||||
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
|
||||
|
||||
}
|
||||
|
@ -3881,8 +3880,6 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
|
|||
}
|
||||
retval = EX_VAR(opline->result.var);
|
||||
ZVAL_DUP(retval, &c->value);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else {
|
||||
/* class constant */
|
||||
zend_class_entry *ce;
|
||||
|
@ -3892,8 +3889,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
|
|||
if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
|
||||
value = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
|
||||
ZVAL_DUP(EX_VAR(opline->result.var), value);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
goto constant_fetch_end;
|
||||
} else if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
|
||||
ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
|
||||
} else {
|
||||
|
@ -3910,8 +3906,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
|
|||
ce = Z_CE_P(EX_VAR(opline->op1.var));
|
||||
if ((value = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce)) != NULL) {
|
||||
ZVAL_DUP(EX_VAR(opline->result.var), value);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
goto constant_fetch_end;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3923,7 +3918,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
|
|||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
EG(scope) = ce;
|
||||
zval_update_constant(value, (void *) 1 TSRMLS_CC);
|
||||
zval_update_constant(value, 1 TSRMLS_CC);
|
||||
EG(scope) = old_scope;
|
||||
}
|
||||
if (IS_CONST == IS_CONST) {
|
||||
|
@ -3939,10 +3934,10 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
|
|||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
|
||||
}
|
||||
|
||||
}
|
||||
constant_fetch_end:
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
|
@ -4223,7 +4218,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD
|
|||
if (Z_TYPE_P(val) == IS_CONSTANT_ARRAY) {
|
||||
zval_opt_copy_ctor(&c.value);
|
||||
}
|
||||
zval_update_constant(&c.value, NULL TSRMLS_CC);
|
||||
zval_update_constant(&c.value, 0 TSRMLS_CC);
|
||||
} else {
|
||||
/* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
|
||||
if (UNEXPECTED(Z_OPT_COPYABLE(c.value))) {
|
||||
|
@ -4372,6 +4367,21 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
opline->op1.zv,
|
||||
opline->op2.zv TSRMLS_CC);
|
||||
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -5035,6 +5045,21 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op2;
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
opline->op1.zv,
|
||||
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
|
||||
|
||||
zval_dtor(free_op2.var);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -5398,7 +5423,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type,
|
|||
}
|
||||
}
|
||||
if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_STATIC) {
|
||||
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
|
||||
zval_update_constant(retval, 1 TSRMLS_CC);
|
||||
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
|
||||
|
||||
}
|
||||
|
@ -5995,6 +6020,21 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op2;
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
opline->op1.zv,
|
||||
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
|
||||
|
||||
zval_ptr_dtor_nogc(free_op2.var);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int type, ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -6082,7 +6122,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ
|
|||
}
|
||||
}
|
||||
if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_STATIC) {
|
||||
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
|
||||
zval_update_constant(retval, 1 TSRMLS_CC);
|
||||
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
|
||||
|
||||
}
|
||||
|
@ -7379,6 +7419,21 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
opline->op1.zv,
|
||||
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
|
||||
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -7722,9 +7777,8 @@ static int ZEND_FASTCALL ZEND_SEND_VAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
|||
|
||||
SAVE_OPLINE();
|
||||
if (opline->extended_value == ZEND_DO_FCALL_BY_NAME) {
|
||||
int arg_num = opline->op2.num + EX(call)->num_additional_args;
|
||||
if (ARG_MUST_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", arg_num);
|
||||
if (ARG_MUST_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.num);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8708,7 +8762,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
|
|||
}
|
||||
}
|
||||
if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_STATIC) {
|
||||
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
|
||||
zval_update_constant(retval, 1 TSRMLS_CC);
|
||||
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
|
||||
zval_dtor(free_op1.var);
|
||||
}
|
||||
|
@ -9319,6 +9373,21 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
|
||||
opline->op2.zv TSRMLS_CC);
|
||||
zval_dtor(free_op1.var);
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -9982,6 +10051,21 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
|
||||
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
|
||||
zval_dtor(free_op1.var);
|
||||
zval_dtor(free_op2.var);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -10345,7 +10429,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
|
|||
}
|
||||
}
|
||||
if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_STATIC) {
|
||||
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
|
||||
zval_update_constant(retval, 1 TSRMLS_CC);
|
||||
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
|
||||
zval_dtor(free_op1.var);
|
||||
}
|
||||
|
@ -10942,6 +11026,21 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
|
||||
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
|
||||
zval_dtor(free_op1.var);
|
||||
zval_ptr_dtor_nogc(free_op2.var);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -11029,7 +11128,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
|
|||
}
|
||||
}
|
||||
if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_STATIC) {
|
||||
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
|
||||
zval_update_constant(retval, 1 TSRMLS_CC);
|
||||
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
|
||||
zval_dtor(free_op1.var);
|
||||
}
|
||||
|
@ -12139,6 +12238,21 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
|
||||
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
|
||||
zval_dtor(free_op1.var);
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -12724,7 +12838,6 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
|
|||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval *varptr, *top;
|
||||
int arg_num;
|
||||
|
||||
SAVE_OPLINE();
|
||||
if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */
|
||||
|
@ -12732,8 +12845,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
|
|||
return zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
} else {
|
||||
arg_num = opline->op2.num + EX(call)->num_additional_args;
|
||||
if (!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
|
||||
if (!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) {
|
||||
return zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
}
|
||||
|
@ -12756,7 +12868,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
|
|||
} else {
|
||||
if ((opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) ?
|
||||
!(opline->extended_value & ZEND_ARG_SEND_SILENT) :
|
||||
!ARG_MAY_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
|
||||
!ARG_MAY_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) {
|
||||
zend_error(E_STRICT, "Only variables should be passed by reference");
|
||||
}
|
||||
top = zend_vm_stack_top_inc(TSRMLS_C);
|
||||
|
@ -12811,8 +12923,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
|||
zend_free_op free_op1;
|
||||
|
||||
if (opline->extended_value == ZEND_DO_FCALL_BY_NAME) {
|
||||
int arg_num = opline->op2.num + EX(call)->num_additional_args;
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) {
|
||||
return ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
}
|
||||
|
@ -14454,7 +14565,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type,
|
|||
}
|
||||
}
|
||||
if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_STATIC) {
|
||||
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
|
||||
zval_update_constant(retval, 1 TSRMLS_CC);
|
||||
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
|
||||
zval_ptr_dtor_nogc(free_op1.var);
|
||||
}
|
||||
|
@ -15174,8 +15285,6 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
|
|||
}
|
||||
retval = EX_VAR(opline->result.var);
|
||||
ZVAL_DUP(retval, &c->value);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else {
|
||||
/* class constant */
|
||||
zend_class_entry *ce;
|
||||
|
@ -15185,8 +15294,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
|
|||
if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
|
||||
value = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
|
||||
ZVAL_DUP(EX_VAR(opline->result.var), value);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
goto constant_fetch_end;
|
||||
} else if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
|
||||
ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
|
||||
} else {
|
||||
|
@ -15203,8 +15311,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
|
|||
ce = Z_CE_P(EX_VAR(opline->op1.var));
|
||||
if ((value = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce)) != NULL) {
|
||||
ZVAL_DUP(EX_VAR(opline->result.var), value);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
goto constant_fetch_end;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15216,7 +15323,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
|
|||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
EG(scope) = ce;
|
||||
zval_update_constant(value, (void *) 1 TSRMLS_CC);
|
||||
zval_update_constant(value, 1 TSRMLS_CC);
|
||||
EG(scope) = old_scope;
|
||||
}
|
||||
if (IS_VAR == IS_CONST) {
|
||||
|
@ -15232,10 +15339,10 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
|
|||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
|
||||
}
|
||||
|
||||
}
|
||||
constant_fetch_end:
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
|
@ -15885,6 +15992,26 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
|
||||
opline->op2.zv TSRMLS_CC);
|
||||
zval_ptr_dtor_nogc(free_op1.var);
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_VAR_CONST(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -17825,6 +17952,26 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
|
||||
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
|
||||
zval_ptr_dtor_nogc(free_op1.var);
|
||||
zval_dtor(free_op2.var);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_VAR_TMP(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -18720,7 +18867,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE
|
|||
}
|
||||
}
|
||||
if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_STATIC) {
|
||||
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
|
||||
zval_update_constant(retval, 1 TSRMLS_CC);
|
||||
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
|
||||
zval_ptr_dtor_nogc(free_op1.var);
|
||||
}
|
||||
|
@ -20126,6 +20273,26 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
|
||||
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
|
||||
zval_ptr_dtor_nogc(free_op1.var);
|
||||
zval_ptr_dtor_nogc(free_op2.var);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_VAR_VAR(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -20564,7 +20731,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type,
|
|||
}
|
||||
}
|
||||
if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_STATIC) {
|
||||
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
|
||||
zval_update_constant(retval, 1 TSRMLS_CC);
|
||||
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
|
||||
zval_ptr_dtor_nogc(free_op1.var);
|
||||
}
|
||||
|
@ -21290,6 +21457,11 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_VAR_UNUSED(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -23282,6 +23454,26 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
|
||||
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
|
||||
zval_ptr_dtor_nogc(free_op1.var);
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_VAR_CV(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -24222,8 +24414,6 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
|
|||
}
|
||||
retval = EX_VAR(opline->result.var);
|
||||
ZVAL_DUP(retval, &c->value);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else {
|
||||
/* class constant */
|
||||
zend_class_entry *ce;
|
||||
|
@ -24233,8 +24423,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
|
|||
if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
|
||||
value = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
|
||||
ZVAL_DUP(EX_VAR(opline->result.var), value);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
goto constant_fetch_end;
|
||||
} else if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
|
||||
ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
|
||||
} else {
|
||||
|
@ -24251,8 +24440,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
|
|||
ce = Z_CE_P(EX_VAR(opline->op1.var));
|
||||
if ((value = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce)) != NULL) {
|
||||
ZVAL_DUP(EX_VAR(opline->result.var), value);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
goto constant_fetch_end;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24264,7 +24452,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
|
|||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
EG(scope) = ce;
|
||||
zval_update_constant(value, (void *) 1 TSRMLS_CC);
|
||||
zval_update_constant(value, 1 TSRMLS_CC);
|
||||
EG(scope) = old_scope;
|
||||
}
|
||||
if (IS_UNUSED == IS_CONST) {
|
||||
|
@ -24280,10 +24468,10 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
|
|||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
|
||||
}
|
||||
|
||||
}
|
||||
constant_fetch_end:
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
|
@ -24702,6 +24890,11 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_UNUSED_CONST(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -25960,6 +26153,11 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_UNUSED_TMP(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -27218,6 +27416,11 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_UNUSED_VAR(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -27729,6 +27932,11 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -28978,6 +29186,11 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_UNUSED_CV(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -29543,7 +29756,6 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
|
|||
USE_OPLINE
|
||||
|
||||
zval *varptr, *top;
|
||||
int arg_num;
|
||||
|
||||
SAVE_OPLINE();
|
||||
if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */
|
||||
|
@ -29551,8 +29763,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
|
|||
return zend_send_by_var_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
} else {
|
||||
arg_num = opline->op2.num + EX(call)->num_additional_args;
|
||||
if (!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
|
||||
if (!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) {
|
||||
return zend_send_by_var_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
}
|
||||
|
@ -29575,7 +29786,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
|
|||
} else {
|
||||
if ((opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) ?
|
||||
!(opline->extended_value & ZEND_ARG_SEND_SILENT) :
|
||||
!ARG_MAY_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
|
||||
!ARG_MAY_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) {
|
||||
zend_error(E_STRICT, "Only variables should be passed by reference");
|
||||
}
|
||||
top = zend_vm_stack_top_inc(TSRMLS_C);
|
||||
|
@ -29629,8 +29840,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
|
|||
|
||||
|
||||
if (opline->extended_value == ZEND_DO_FCALL_BY_NAME) {
|
||||
int arg_num = opline->op2.num + EX(call)->num_additional_args;
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) {
|
||||
return ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
}
|
||||
|
@ -31118,7 +31328,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z
|
|||
}
|
||||
}
|
||||
if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_STATIC) {
|
||||
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
|
||||
zval_update_constant(retval, 1 TSRMLS_CC);
|
||||
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
|
||||
|
||||
}
|
||||
|
@ -32337,6 +32547,26 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
|
||||
opline->op2.zv TSRMLS_CC);
|
||||
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_CV_CONST(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -34160,6 +34390,26 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op2;
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
|
||||
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
|
||||
|
||||
zval_dtor(free_op2.var);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_CV_TMP(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -35054,7 +35304,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN
|
|||
}
|
||||
}
|
||||
if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_STATIC) {
|
||||
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
|
||||
zval_update_constant(retval, 1 TSRMLS_CC);
|
||||
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
|
||||
|
||||
}
|
||||
|
@ -36343,6 +36593,26 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op2;
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
|
||||
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
|
||||
|
||||
zval_ptr_dtor_nogc(free_op2.var);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_CV_VAR(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -36780,7 +37050,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type,
|
|||
}
|
||||
}
|
||||
if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_STATIC) {
|
||||
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
|
||||
zval_update_constant(retval, 1 TSRMLS_CC);
|
||||
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
|
||||
|
||||
}
|
||||
|
@ -37373,6 +37643,11 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_CV_UNUSED(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
@ -39247,6 +39522,26 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
|
|||
ZEND_VM_RETURN();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_POW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
|
||||
SAVE_OPLINE();
|
||||
pow_function(EX_VAR(opline->result.var),
|
||||
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
|
||||
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
|
||||
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_ASSIGN_POW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
return zend_binary_assign_op_helper_SPEC_CV_CV(pow_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_FASTCALL ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_error_noreturn(E_ERROR, "Invalid opcode %d/%d/%d.", OPLINE->opcode, OPLINE->op1_type, OPLINE->op2_type);
|
||||
|
@ -43407,6 +43702,56 @@ void zend_init_opcodes_handlers(void)
|
|||
ZEND_SEND_UNPACK_SPEC_HANDLER,
|
||||
ZEND_SEND_UNPACK_SPEC_HANDLER,
|
||||
ZEND_SEND_UNPACK_SPEC_HANDLER,
|
||||
ZEND_POW_SPEC_CONST_CONST_HANDLER,
|
||||
ZEND_POW_SPEC_CONST_TMP_HANDLER,
|
||||
ZEND_POW_SPEC_CONST_VAR_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_POW_SPEC_CONST_CV_HANDLER,
|
||||
ZEND_POW_SPEC_TMP_CONST_HANDLER,
|
||||
ZEND_POW_SPEC_TMP_TMP_HANDLER,
|
||||
ZEND_POW_SPEC_TMP_VAR_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_POW_SPEC_TMP_CV_HANDLER,
|
||||
ZEND_POW_SPEC_VAR_CONST_HANDLER,
|
||||
ZEND_POW_SPEC_VAR_TMP_HANDLER,
|
||||
ZEND_POW_SPEC_VAR_VAR_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_POW_SPEC_VAR_CV_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_POW_SPEC_CV_CONST_HANDLER,
|
||||
ZEND_POW_SPEC_CV_TMP_HANDLER,
|
||||
ZEND_POW_SPEC_CV_VAR_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_POW_SPEC_CV_CV_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_VAR_CONST_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_VAR_TMP_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_VAR_VAR_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_VAR_UNUSED_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_VAR_CV_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_UNUSED_CONST_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_UNUSED_TMP_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_UNUSED_VAR_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_UNUSED_UNUSED_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_UNUSED_CV_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_CV_CONST_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_CV_TMP_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_CV_VAR_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_CV_UNUSED_HANDLER,
|
||||
ZEND_ASSIGN_POW_SPEC_CV_CV_HANDLER,
|
||||
ZEND_NULL_HANDLER
|
||||
};
|
||||
zend_opcode_handlers = (opcode_handler_t*)labels;
|
||||
|
|
|
@ -1313,7 +1313,7 @@ function gen_vm($def, $skel) {
|
|||
out($f, "# pragma warning(once : 6285)\n");
|
||||
// Suppress (<non-zero constant> || <expression>) warnings on windows
|
||||
out($f, "# pragma warning(once : 6286)\n");
|
||||
// Suppress constant with constant comparsion warnings on windows
|
||||
// Suppress constant with constant comparison warnings on windows
|
||||
out($f, "# pragma warning(once : 6326)\n");
|
||||
}
|
||||
out($f, "#endif\n");
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <stdio.h>
|
||||
#include <zend.h>
|
||||
|
||||
const char *zend_vm_opcodes_map[166] = {
|
||||
const char *zend_vm_opcodes_map[168] = {
|
||||
"ZEND_NOP",
|
||||
"ZEND_ADD",
|
||||
"ZEND_SUB",
|
||||
|
@ -188,6 +188,8 @@ const char *zend_vm_opcodes_map[166] = {
|
|||
"ZEND_FAST_RET",
|
||||
"ZEND_RECV_VARIADIC",
|
||||
"ZEND_SEND_UNPACK",
|
||||
"ZEND_POW",
|
||||
"ZEND_ASSIGN_POW",
|
||||
};
|
||||
|
||||
ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {
|
||||
|
|
|
@ -171,5 +171,7 @@ ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);
|
|||
#define ZEND_FAST_RET 163
|
||||
#define ZEND_RECV_VARIADIC 164
|
||||
#define ZEND_SEND_UNPACK 165
|
||||
#define ZEND_POW 166
|
||||
#define ZEND_ASSIGN_POW 167
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,14 +33,14 @@ ac_version=`$PHP_AUTOCONF --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//'
|
|||
if test -z "$ac_version"; then
|
||||
echo "buildconf: autoconf not found."
|
||||
echo " You need autoconf version 2.59 or newer installed"
|
||||
echo " to build PHP from SVN."
|
||||
echo " to build PHP from Git."
|
||||
exit 1
|
||||
fi
|
||||
IFS=.; set $ac_version; IFS=' '
|
||||
if test "$1" = "2" -a "$2" -lt "59" || test "$1" -lt "2"; then
|
||||
echo "buildconf: autoconf version $ac_version found."
|
||||
echo " You need autoconf version 2.59 or newer installed"
|
||||
echo " to build PHP from SVN."
|
||||
echo " to build PHP from Git."
|
||||
exit 1
|
||||
else
|
||||
echo "buildconf: autoconf version $ac_version (ok)"
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "ext/standard/file.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "ext/standard/php_string.h"
|
||||
#include "main/php_network.h"
|
||||
|
||||
/* for fileno() */
|
||||
#include <stdio.h>
|
||||
|
@ -245,7 +246,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
|
|||
stream = php_stream_open_wrapper(path, mode, options | STREAM_WILL_CAST, opened_path);
|
||||
|
||||
if (stream) {
|
||||
int fd;
|
||||
php_socket_t fd;
|
||||
if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **) &fd, REPORT_ERRORS)) {
|
||||
bz_file = BZ2_bzdopen(fd, mode);
|
||||
}
|
||||
|
@ -394,7 +395,7 @@ static PHP_FUNCTION(bzopen)
|
|||
NULL);
|
||||
} else if (Z_TYPE_PP(file) == IS_RESOURCE) {
|
||||
/* If it is a resource, than its a stream resource */
|
||||
int fd;
|
||||
php_socket_t fd;
|
||||
int stream_mode_len;
|
||||
|
||||
php_stream_from_zval(stream, file);
|
||||
|
|
|
@ -160,7 +160,7 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep
|
|||
|
||||
case IS_RESOURCE:
|
||||
case IS_CONSTANT:
|
||||
case IS_CONSTANT_ARRAY:
|
||||
case IS_CONSTANT_AST:
|
||||
default:
|
||||
V_VT(v) = VT_NULL;
|
||||
break;
|
||||
|
|
|
@ -165,50 +165,62 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
|||
# define php_curl_ret(__ret) RETVAL_FALSE; return;
|
||||
#endif
|
||||
|
||||
static int php_curl_option_url(php_curl *ch, const char *url, const int len TSRMLS_DC) /* {{{ */
|
||||
static int php_curl_option_str(php_curl *ch, long option, const char *str, const int len, zend_bool make_copy TSRMLS_DC)
|
||||
{
|
||||
CURLcode error = CURLE_OK;
|
||||
#if LIBCURL_VERSION_NUM < 0x071100
|
||||
char *copystr = NULL;
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
if (make_copy) {
|
||||
#endif
|
||||
char *copystr;
|
||||
|
||||
/* Strings passed to libcurl as 'char *' arguments, are copied by the library since 7.17.0 */
|
||||
copystr = estrndup(str, len);
|
||||
error = curl_easy_setopt(ch->cp, option, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
} else {
|
||||
error = curl_easy_setopt(ch->cp, option, str);
|
||||
}
|
||||
#endif
|
||||
|
||||
SAVE_CURL_ERROR(ch, error)
|
||||
|
||||
return error == CURLE_OK ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
static int php_curl_option_url(php_curl *ch, const char *url, const int len TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
/* Disable file:// if open_basedir are used */
|
||||
if (PG(open_basedir) && *PG(open_basedir)) {
|
||||
#if LIBCURL_VERSION_NUM >= 0x071304
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_PROTOCOLS, CURLPROTO_ALL & ~CURLPROTO_FILE);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_PROTOCOLS, CURLPROTO_ALL & ~CURLPROTO_FILE);
|
||||
#else
|
||||
php_url *uri;
|
||||
|
||||
if (!(uri = php_url_parse_ex(url, len))) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL '%s'", url);
|
||||
return 0;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (uri->scheme && !strncasecmp("file", uri->scheme, sizeof("file"))) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Protocol 'file' disabled in cURL");
|
||||
php_url_free(uri);
|
||||
return 0;
|
||||
return FAILURE;
|
||||
}
|
||||
php_url_free(uri);
|
||||
#endif
|
||||
}
|
||||
/* Strings passed to libcurl as 'char *' arguments, are copied by the library... NOTE: before 7.17.0 strings were not copied. */
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_URL, url);
|
||||
#else
|
||||
copystr = estrndup(url, len);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_URL, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
#endif
|
||||
|
||||
return (error == CURLE_OK ? 1 : 0);
|
||||
return php_curl_option_str(ch, CURLOPT_URL, url, len, 0 TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
int _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC) /* {{{ */
|
||||
void _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
php_stream *stream;
|
||||
if (!ch || !ch->handlers) {
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ch->handlers->std_err) {
|
||||
|
@ -265,7 +277,7 @@ int _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC) /* {{{ */
|
|||
curl_easy_setopt(ch->cp, CURLOPT_FILE, (void *) ch);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return ;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -621,7 +633,6 @@ PHP_MINIT_FUNCTION(curl)
|
|||
REGISTER_CURL_CONSTANT(CURLOPT_BUFFERSIZE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_CAINFO);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_CAPATH);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_CLOSEPOLICY);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_CONNECTTIMEOUT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_COOKIE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_COOKIEFILE);
|
||||
|
@ -711,13 +722,6 @@ PHP_MINIT_FUNCTION(curl)
|
|||
REGISTER_CURL_CONSTANT(CURLOPT_WRITEFUNCTION);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_WRITEHEADER);
|
||||
|
||||
/* Constants effecting the way CURLOPT_CLOSEPOLICY works */
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_CALLBACK);
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_TRAFFIC);
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_OLDEST);
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_SLOWEST);
|
||||
|
||||
/* */
|
||||
REGISTER_CURL_CONSTANT(CURLE_ABORTED_BY_CALLBACK);
|
||||
REGISTER_CURL_CONSTANT(CURLE_BAD_CALLING_ORDER);
|
||||
|
@ -1895,7 +1899,10 @@ static void _php_curl_set_default_options(php_curl *ch)
|
|||
curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20); /* prevent infinite redirects */
|
||||
|
||||
cainfo = INI_STR("openssl.cafile");
|
||||
if (!(cainfo && strlen(cainfo) > 0)) {
|
||||
cainfo = INI_STR("curl.cainfo");
|
||||
}
|
||||
if (cainfo && strlen(cainfo) > 0) {
|
||||
curl_easy_setopt(ch->cp, CURLOPT_CAINFO, cainfo);
|
||||
}
|
||||
|
@ -1941,7 +1948,7 @@ PHP_FUNCTION(curl_init)
|
|||
_php_curl_set_default_options(ch);
|
||||
|
||||
if (url) {
|
||||
if (!php_curl_option_url(ch, url, url_len TSRMLS_CC)) {
|
||||
if (php_curl_option_url(ch, url, url_len TSRMLS_CC) == FAILURE) {
|
||||
_php_curl_close_ex(ch TSRMLS_CC);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
@ -2058,7 +2065,7 @@ PHP_FUNCTION(curl_copy_handle)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *return_value TSRMLS_DC) /* {{{ */
|
||||
static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
CURLcode error=CURLE_OK;
|
||||
|
||||
|
@ -2076,7 +2083,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
|||
}
|
||||
case CURLOPT_AUTOREFERER:
|
||||
case CURLOPT_BUFFERSIZE:
|
||||
case CURLOPT_CLOSEPOLICY:
|
||||
case CURLOPT_CONNECTTIMEOUT:
|
||||
case CURLOPT_COOKIESESSION:
|
||||
case CURLOPT_CRLF:
|
||||
|
@ -2225,7 +2231,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
|||
if ((option == CURLOPT_PROTOCOLS || option == CURLOPT_REDIR_PROTOCOLS) &&
|
||||
(PG(open_basedir) && *PG(open_basedir)) && (Z_LVAL_PP(zvalue) & CURLPROTO_FILE)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLPROTO_FILE cannot be activated when an open_basedir is set");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
@ -2240,14 +2245,10 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
|||
case CURLOPT_CAINFO:
|
||||
case CURLOPT_CAPATH:
|
||||
case CURLOPT_COOKIE:
|
||||
case CURLOPT_CUSTOMREQUEST:
|
||||
case CURLOPT_EGDSOCKET:
|
||||
case CURLOPT_FTPPORT:
|
||||
case CURLOPT_INTERFACE:
|
||||
case CURLOPT_PRIVATE:
|
||||
case CURLOPT_PROXY:
|
||||
case CURLOPT_PROXYUSERPWD:
|
||||
case CURLOPT_RANGE:
|
||||
case CURLOPT_REFERER:
|
||||
case CURLOPT_SSLCERTTYPE:
|
||||
case CURLOPT_SSLENGINE:
|
||||
|
@ -2256,23 +2257,14 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
|||
case CURLOPT_SSLKEYPASSWD:
|
||||
case CURLOPT_SSLKEYTYPE:
|
||||
case CURLOPT_SSL_CIPHER_LIST:
|
||||
case CURLOPT_URL:
|
||||
case CURLOPT_USERAGENT:
|
||||
case CURLOPT_USERPWD:
|
||||
#if LIBCURL_VERSION_NUM >= 0x070d00 /* Available since 7.13.0 */
|
||||
case CURLOPT_FTP_ACCOUNT:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x070e01 /* Available since 7.14.1 */
|
||||
case CURLOPT_COOKIELIST:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x070f05 /* Available since 7.15.5 */
|
||||
case CURLOPT_FTP_ALTERNATIVE_TO_USER:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
|
||||
case CURLOPT_KRBLEVEL:
|
||||
#else
|
||||
case CURLOPT_KRB4LEVEL:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x071101 /* Available since 7.17.1 */
|
||||
case CURLOPT_SSH_HOST_PUBLIC_KEY_MD5:
|
||||
#endif
|
||||
|
@ -2287,7 +2279,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
|||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x071400 /* Available since 7.20.0 */
|
||||
case CURLOPT_MAIL_FROM:
|
||||
case CURLOPT_RTSP_SESSION_ID:
|
||||
case CURLOPT_RTSP_STREAM_URI:
|
||||
case CURLOPT_RTSP_TRANSPORT:
|
||||
#endif
|
||||
|
@ -2309,32 +2300,44 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
|||
#endif
|
||||
{
|
||||
convert_to_string_ex(zvalue);
|
||||
if (option == CURLOPT_URL) {
|
||||
if (!php_curl_option_url(ch, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue) TSRMLS_CC)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return php_curl_option_str(ch, option, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 0 TSRMLS_CC);
|
||||
}
|
||||
} else {
|
||||
if (option == CURLOPT_PRIVATE) {
|
||||
char *copystr;
|
||||
#if LIBCURL_VERSION_NUM < 0x071100
|
||||
string_copy:
|
||||
|
||||
/* Curl nullable string options */
|
||||
case CURLOPT_CUSTOMREQUEST:
|
||||
case CURLOPT_FTPPORT:
|
||||
case CURLOPT_RANGE:
|
||||
#if LIBCURL_VERSION_NUM >= 0x070d00 /* Available since 7.13.0 */
|
||||
case CURLOPT_FTP_ACCOUNT:
|
||||
#endif
|
||||
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
||||
error = curl_easy_setopt(ch->cp, option, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
} else {
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
/* Strings passed to libcurl as ’char *’ arguments, are copied by the library... NOTE: before 7.17.0 strings were not copied. */
|
||||
error = curl_easy_setopt(ch->cp, option, Z_STRVAL_PP(zvalue));
|
||||
#if LIBCURL_VERSION_NUM >= 0x071400 /* Available since 7.20.0 */
|
||||
case CURLOPT_RTSP_SESSION_ID:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
|
||||
case CURLOPT_KRBLEVEL:
|
||||
#else
|
||||
goto string_copy;
|
||||
case CURLOPT_KRB4LEVEL:
|
||||
#endif
|
||||
}
|
||||
{
|
||||
if (Z_TYPE_PP(zvalue) == IS_NULL) {
|
||||
error = curl_easy_setopt(ch->cp, option, NULL);
|
||||
} else {
|
||||
convert_to_string_ex(zvalue);
|
||||
return php_curl_option_str(ch, option, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 0 TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Curl private option */
|
||||
case CURLOPT_PRIVATE:
|
||||
convert_to_string_ex(zvalue);
|
||||
return php_curl_option_str(ch, option, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 1 TSRMLS_CC);
|
||||
|
||||
/* Curl url option */
|
||||
case CURLOPT_URL:
|
||||
convert_to_string_ex(zvalue);
|
||||
return php_curl_option_url(ch, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue) TSRMLS_CC);
|
||||
|
||||
/* Curl file handle options */
|
||||
case CURLOPT_FILE:
|
||||
case CURLOPT_INFILE:
|
||||
|
@ -2346,18 +2349,15 @@ string_copy:
|
|||
|
||||
what = zend_fetch_resource(zvalue TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream(), php_file_le_pstream());
|
||||
if (!what) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (FAILURE == php_stream_cast((php_stream *) what, PHP_STREAM_AS_STDIO, (void *) &fp, REPORT_ERRORS)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (!fp) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
error = CURLE_OK;
|
||||
|
@ -2373,8 +2373,7 @@ string_copy:
|
|||
ch->handlers->write->stream = *zvalue;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
break;
|
||||
case CURLOPT_WRITEHEADER:
|
||||
|
@ -2388,8 +2387,7 @@ string_copy:
|
|||
ch->handlers->write_header->stream = *zvalue;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
break;
|
||||
case CURLOPT_INFILE:
|
||||
|
@ -2410,8 +2408,7 @@ string_copy:
|
|||
ch->handlers->std_err = *zvalue;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
/* break omitted intentionally */
|
||||
default:
|
||||
|
@ -2473,8 +2470,7 @@ string_copy:
|
|||
#endif
|
||||
}
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must pass either an object or an array with the %s argument", name);
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
for (zend_hash_internal_pointer_reset(ph);
|
||||
|
@ -2487,7 +2483,6 @@ string_copy:
|
|||
slist = curl_slist_append(slist, Z_STRVAL_PP(current));
|
||||
if (!slist) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not build curl_slist");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -2508,8 +2503,7 @@ string_copy:
|
|||
if (PG(open_basedir) && *PG(open_basedir)) {
|
||||
if (Z_LVAL_PP(zvalue) != 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -2536,8 +2530,7 @@ string_copy:
|
|||
postfields = HASH_OF(*zvalue);
|
||||
if (!postfields) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't get HashTable in CURLOPT_POSTFIELDS");
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
for (zend_hash_internal_pointer_reset(postfields);
|
||||
|
@ -2573,7 +2566,6 @@ string_copy:
|
|||
postval = Z_STRVAL_P(prop);
|
||||
|
||||
if (php_check_open_basedir(postval TSRMLS_CC)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2622,8 +2614,7 @@ string_copy:
|
|||
}
|
||||
/* open_basedir check */
|
||||
if (php_check_open_basedir(postval TSRMLS_CC)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
error = curl_formadd(&first, &last,
|
||||
CURLFORM_COPYNAME, string_key,
|
||||
|
@ -2654,8 +2645,7 @@ string_copy:
|
|||
|
||||
SAVE_CURL_ERROR(ch, error);
|
||||
if (error != CURLE_OK) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (Z_REFCOUNT_P(ch->clone) <= 1) {
|
||||
|
@ -2677,7 +2667,7 @@ string_copy:
|
|||
post = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
||||
zend_llist_add_element(&ch->to_free->str, &post);
|
||||
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_PP(zvalue));
|
||||
#endif
|
||||
}
|
||||
|
@ -2775,26 +2765,13 @@ string_copy:
|
|||
case CURLOPT_SSH_KNOWNHOSTS:
|
||||
#endif
|
||||
{
|
||||
#if LIBCURL_VERSION_NUM < 0x071100
|
||||
char *copystr = NULL;
|
||||
#endif
|
||||
|
||||
convert_to_string_ex(zvalue);
|
||||
|
||||
if (Z_STRLEN_PP(zvalue) && php_check_open_basedir(Z_STRVAL_PP(zvalue) TSRMLS_CC)) {
|
||||
RETVAL_FALSE;
|
||||
return 1;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
error = curl_easy_setopt(ch->cp, option, Z_STRVAL_PP(zvalue));
|
||||
#else
|
||||
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
||||
|
||||
error = curl_easy_setopt(ch->cp, option, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
#endif
|
||||
break;
|
||||
return php_curl_option_str(ch, option, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
case CURLINFO_HEADER_OUT:
|
||||
|
@ -2839,9 +2816,9 @@ string_copy:
|
|||
|
||||
SAVE_CURL_ERROR(ch, error);
|
||||
if (error != CURLE_OK) {
|
||||
return 1;
|
||||
return FAILURE;
|
||||
} else {
|
||||
return 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -2865,7 +2842,7 @@ PHP_FUNCTION(curl_setopt)
|
|||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (!_php_curl_setopt(ch, options, zvalue, return_value TSRMLS_CC)) {
|
||||
if (_php_curl_setopt(ch, options, zvalue TSRMLS_CC) == SUCCESS) {
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
|
@ -2896,7 +2873,7 @@ PHP_FUNCTION(curl_setopt_array)
|
|||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array keys must be CURLOPT constants or equivalent integer values");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (_php_curl_setopt(ch, (long) option, entry, return_value TSRMLS_CC)) {
|
||||
if (_php_curl_setopt(ch, (long) option, entry TSRMLS_CC) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
zend_hash_move_forward_ex(Z_ARRVAL_P(arr), &pos);
|
||||
|
@ -3161,6 +3138,7 @@ PHP_FUNCTION(curl_getinfo)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#if LIBCURL_VERSION_NUM >= 0x070c03 /* Available since 7.12.3 */
|
||||
case CURLINFO_SLIST:
|
||||
{
|
||||
struct curl_slist *slist;
|
||||
|
@ -3176,6 +3154,7 @@ PHP_FUNCTION(curl_getinfo)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
|
|
@ -248,6 +248,8 @@ PHP_FUNCTION(curl_multi_getcontent)
|
|||
smart_str_0(&ch->handlers->write->buf);
|
||||
RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 1);
|
||||
}
|
||||
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ typedef struct {
|
|||
|
||||
void _php_curl_cleanup_handle(php_curl *);
|
||||
void _php_curl_multi_cleanup_list(void *data);
|
||||
int _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC);
|
||||
void _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC);
|
||||
|
||||
void curlfile_register_class(TSRMLS_D);
|
||||
PHP_CURL_API extern zend_class_entry *curl_CURLFile_class;
|
||||
|
|
|
@ -81,8 +81,7 @@ Ok for CURLOPT_WRITEHEADER
|
|||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
%A
|
||||
Ok for CURLOPT_FILE
|
||||
%AOk for CURLOPT_FILE
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
|
||||
|
|
|
@ -58,15 +58,14 @@ foreach($options_to_check as $option) {
|
|||
--EXPECTF--
|
||||
Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %sbug54798.php on line %d
|
||||
* About to connect() %a
|
||||
* Closing connection #%d
|
||||
* Closing connection %d
|
||||
Ok for CURLOPT_STDERR
|
||||
|
||||
Warning: curl_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %sbug54798.php on line 24
|
||||
Ok for CURLOPT_WRITEHEADER
|
||||
|
||||
Warning: curl_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug54798.php on line 24
|
||||
%a
|
||||
Ok for CURLOPT_FILE
|
||||
%aOk for CURLOPT_FILE
|
||||
|
||||
Warning: curl_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %sbug54798.php on line %d
|
||||
Ok for CURLOPT_INFILE
|
||||
|
|
|
@ -17,9 +17,7 @@ open_basedir="c:/tmp"
|
|||
?>
|
||||
--EXPECTF--
|
||||
%a
|
||||
|
||||
Warning: curl_setopt(): open_basedir restriction in effect. File(c:/tmp/foo) is not within the allowed path(s): (c:/tmp) in %sbug61948-win32.php on line %d
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
Warning: curl_setopt(): open_basedir restriction in effect. File(c:/xxx/bar) is not within the allowed path(s): (c:/tmp) in %sbug61948-win32.php on line %d
|
||||
bool(false)
|
||||
|
|
31
ext/curl/tests/bug66109.phpt
Normal file
31
ext/curl/tests/bug66109.phpt
Normal file
|
@ -0,0 +1,31 @@
|
|||
--TEST--
|
||||
Bug #66109 (Option CURLOPT_CUSTOMREQUEST can't be reset to default.)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "{$host}/get.php?test=method");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, NULL);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(6) "DELETE"
|
||||
string(3) "GET"
|
|
@ -33,6 +33,5 @@ echo "Closed correctly\n";
|
|||
<?php
|
||||
unlink(dirname(__FILE__) . '/curl_file_deleted_before_curl_close.tmp');
|
||||
?>
|
||||
--EXPECTF--
|
||||
* Closing connection #%d
|
||||
--EXPECT--
|
||||
Closed correctly
|
||||
|
|
|
@ -48,5 +48,4 @@ curl_close($ch);
|
|||
*** Testing curl_setopt with CURLOPT_STDERR
|
||||
string(%d) "%S"
|
||||
string(%d) "%S"
|
||||
* Closing connection #%d
|
||||
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
|
||||
}
|
||||
break;
|
||||
case 'method':
|
||||
echo $_SERVER['REQUEST_METHOD'];
|
||||
break;
|
||||
default:
|
||||
echo "Hello World!\n";
|
||||
echo "Hello World!";
|
||||
|
|
|
@ -1,40 +1,42 @@
|
|||
{ "sst", 0, -11, "Pacific/Apia" },
|
||||
{ "hst", 0, -10, "Pacific/Honolulu" },
|
||||
{ "akst", 0, -9, "America/Anchorage" },
|
||||
{ "akdt", 1, -8, "America/Anchorage" },
|
||||
{ "pst", 0, -8, "America/Los_Angeles" },
|
||||
{ "pdt", 1, -7, "America/Los_Angeles" },
|
||||
{ "mst", 0, -7, "America/Denver" },
|
||||
{ "mdt", 1, -6, "America/Denver" },
|
||||
{ "cst", 0, -6, "America/Chicago" },
|
||||
{ "cdt", 1, -5, "America/Chicago" },
|
||||
{ "est", 0, -5, "America/New_York" },
|
||||
{ "edt", 1, -4, "America/New_York" },
|
||||
{ "ast", 0, -4, "America/Halifax" },
|
||||
{ "adt", 1, -3, "America/Halifax" },
|
||||
{ "brt", 0, -3, "America/Sao_Paulo" },
|
||||
{ "brst", 1, -2, "America/Sao_Paulo" },
|
||||
{ "azost", 0, -1, "Atlantic/Azores" },
|
||||
{ "sst", 0, -660, "Pacific/Apia" },
|
||||
{ "hst", 0, -600, "Pacific/Honolulu" },
|
||||
{ "akst", 0, -540, "America/Anchorage" },
|
||||
{ "akdt", 1, -480, "America/Anchorage" },
|
||||
{ "pst", 0, -480, "America/Los_Angeles" },
|
||||
{ "pdt", 1, -420, "America/Los_Angeles" },
|
||||
{ "mst", 0, -420, "America/Denver" },
|
||||
{ "mdt", 1, -360, "America/Denver" },
|
||||
{ "cst", 0, -360, "America/Chicago" },
|
||||
{ "cdt", 1, -300, "America/Chicago" },
|
||||
{ "est", 0, -300, "America/New_York" },
|
||||
{ "vet", 0, -270, "America/Caracas" },
|
||||
{ "edt", 1, -240, "America/New_York" },
|
||||
{ "ast", 0, -240, "America/Halifax" },
|
||||
{ "adt", 1, -180, "America/Halifax" },
|
||||
{ "brt", 0, -180, "America/Sao_Paulo" },
|
||||
{ "brst", 1, -120, "America/Sao_Paulo" },
|
||||
{ "azost", 0, -60, "Atlantic/Azores" },
|
||||
{ "azodt", 1, 0, "Atlantic/Azores" },
|
||||
{ "gmt", 0, 0, "Europe/London" },
|
||||
{ "bst", 1, 1, "Europe/London" },
|
||||
{ "cet", 0, 1, "Europe/Paris" },
|
||||
{ "cest", 1, 2, "Europe/Paris" },
|
||||
{ "eet", 0, 2, "Europe/Helsinki" },
|
||||
{ "eest", 1, 3, "Europe/Helsinki" },
|
||||
{ "msk", 0, 3, "Europe/Moscow" },
|
||||
{ "msd", 1, 4, "Europe/Moscow" },
|
||||
{ "gst", 0, 4, "Asia/Dubai" },
|
||||
{ "pkt", 0, 5, "Asia/Karachi" },
|
||||
{ "ist", 0, 5.5, "Asia/Kolkata" },
|
||||
{ "npt", 0, 5.75, "Asia/Katmandu" },
|
||||
{ "yekt", 1, 6, "Asia/Yekaterinburg" },
|
||||
{ "novst", 1, 7, "Asia/Novosibirsk" },
|
||||
{ "krat", 0, 7, "Asia/Krasnoyarsk" },
|
||||
{ "krast", 1, 8, "Asia/Krasnoyarsk" },
|
||||
{ "jst", 0, 9, "Asia/Tokyo" },
|
||||
{ "est", 0, 10, "Australia/Melbourne" },
|
||||
{ "cst", 1, 10.5, "Australia/Adelaide" },
|
||||
{ "est", 1, 11, "Australia/Melbourne" },
|
||||
{ "nzst", 0, 12, "Pacific/Auckland" },
|
||||
{ "nzdt", 1, 13, "Pacific/Auckland" },
|
||||
{ "bst", 1, 60, "Europe/London" },
|
||||
{ "cet", 0, 60, "Europe/Paris" },
|
||||
{ "cest", 1, 120, "Europe/Paris" },
|
||||
{ "eet", 0, 120, "Europe/Helsinki" },
|
||||
{ "eest", 1, 180, "Europe/Helsinki" },
|
||||
{ "msk", 0, 180, "Europe/Moscow" },
|
||||
{ "msd", 1, 240, "Europe/Moscow" },
|
||||
{ "gst", 0, 240, "Asia/Dubai" },
|
||||
{ "pkt", 0, 300, "Asia/Karachi" },
|
||||
{ "ist", 0, 330, "Asia/Kolkata" },
|
||||
{ "npt", 0, 345, "Asia/Katmandu" },
|
||||
{ "yekt", 1, 360, "Asia/Yekaterinburg" },
|
||||
{ "novst", 1, 420, "Asia/Novosibirsk" },
|
||||
{ "krat", 0, 420, "Asia/Krasnoyarsk" },
|
||||
{ "cst", 0, 480, "Asia/Shanghai" },
|
||||
{ "krast", 1, 480, "Asia/Krasnoyarsk" },
|
||||
{ "jst", 0, 540, "Asia/Tokyo" },
|
||||
{ "est", 0, 600, "Australia/Melbourne" },
|
||||
{ "cst", 1, 630, "Australia/Adelaide" },
|
||||
{ "est", 1, 660, "Australia/Melbourne" },
|
||||
{ "nzst", 0, 720, "Pacific/Auckland" },
|
||||
{ "nzdt", 1, 780, "Pacific/Auckland" },
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* Generated by re2c 0.13.5 on Sun Aug 25 15:12:48 2013 */
|
||||
/* Generated by re2c 0.13.5 on Thu Feb 6 07:35:53 2014 */
|
||||
#line 1 "ext/date/lib/parse_date.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
| Copyright (c) 1997-2013 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 |
|
||||
|
@ -717,7 +717,7 @@ const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffs
|
|||
/* Still didn't find anything, let's find the zone solely based on
|
||||
* offset/isdst then */
|
||||
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
|
||||
if ((fmp->gmtoffset * 3600) == gmtoffset && fmp->type == isdst) {
|
||||
if ((fmp->gmtoffset * 60) == gmtoffset && fmp->type == isdst) {
|
||||
return fmp;
|
||||
}
|
||||
}
|
||||
|
@ -751,7 +751,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
|
|||
return value;
|
||||
}
|
||||
|
||||
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
|
||||
long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
|
||||
{
|
||||
timelib_tzinfo *res;
|
||||
long retval = 0;
|
||||
|
@ -1006,7 +1006,7 @@ yy4:
|
|||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_TZ();
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
|
@ -4468,7 +4468,7 @@ yy223:
|
|||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
|
@ -9798,7 +9798,7 @@ yy491:
|
|||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
|
@ -12073,7 +12073,7 @@ yy701:
|
|||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
|
@ -13464,7 +13464,7 @@ yy843:
|
|||
if (*ptr == '.') {
|
||||
s->time->f = timelib_get_frac_nr((char **) &ptr, 9);
|
||||
if (*ptr) { /* timezone is optional */
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
|
@ -15813,7 +15813,7 @@ yy1076:
|
|||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
|
@ -25047,7 +25047,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
|||
case 'O': /* timezone */
|
||||
{
|
||||
int tz_not_found;
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_pbf_error(s, "The timezone could not be found in the database", string, begin);
|
||||
}
|
||||
|
|
|
@ -715,7 +715,7 @@ const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffs
|
|||
/* Still didn't find anything, let's find the zone solely based on
|
||||
* offset/isdst then */
|
||||
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
|
||||
if ((fmp->gmtoffset * 3600) == gmtoffset && fmp->type == isdst) {
|
||||
if ((fmp->gmtoffset * 60) == gmtoffset && fmp->type == isdst) {
|
||||
return fmp;
|
||||
}
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
|
|||
return value;
|
||||
}
|
||||
|
||||
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
|
||||
long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
|
||||
{
|
||||
timelib_tzinfo *res;
|
||||
long retval = 0;
|
||||
|
@ -1161,7 +1161,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
|||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
|
@ -1202,7 +1202,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
|||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->s = 0;
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, s->tzdb, tz_get_wrapper);
|
||||
break;
|
||||
case 1:
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
|
@ -1227,7 +1227,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
|||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
|
@ -1429,7 +1429,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
|||
if (*ptr == '.') {
|
||||
s->time->f = timelib_get_frac_nr((char **) &ptr, 9);
|
||||
if (*ptr) { /* timezone is optional */
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
|
@ -1532,7 +1532,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
|||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
|
@ -1645,7 +1645,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
|||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_TZ();
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
|
@ -1698,7 +1698,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
|||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
|
@ -2054,7 +2054,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
|||
case 'O': /* timezone */
|
||||
{
|
||||
int tz_not_found;
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_pbf_error(s, "The timezone could not be found in the database", string, begin);
|
||||
}
|
||||
|
|
|
@ -92,6 +92,8 @@ int timelib_apply_localtime(timelib_time *t, unsigned int localtime);
|
|||
void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts);
|
||||
void timelib_unixtime2local(timelib_time *tm, timelib_sll ts);
|
||||
void timelib_update_from_sse(timelib_time *tm);
|
||||
void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset);
|
||||
void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info);
|
||||
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz);
|
||||
|
||||
/* From parse_tz.c */
|
||||
|
@ -103,6 +105,7 @@ timelib_sll timelib_get_current_offset(timelib_time *t);
|
|||
void timelib_dump_tzinfo(timelib_tzinfo *tz);
|
||||
const timelib_tzdb *timelib_builtin_db(void);
|
||||
const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count);
|
||||
long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper);
|
||||
|
||||
/* From timelib.c */
|
||||
timelib_tzinfo* timelib_tzinfo_ctor(char *name);
|
||||
|
|
|
@ -142,6 +142,12 @@ typedef struct timelib_time {
|
|||
* 2 TimeZone abbreviation */
|
||||
} timelib_time;
|
||||
|
||||
typedef struct timelib_abbr_info {
|
||||
timelib_sll utc_offset;
|
||||
char *abbr;
|
||||
int dst;
|
||||
} timelib_abbr_info;
|
||||
|
||||
typedef struct timelib_error_message {
|
||||
int position;
|
||||
char character;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -28,7 +28,7 @@ static int month_tab[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 24
|
|||
static int days_in_month_leap[13] = { 31, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
static int days_in_month[13] = { 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
|
||||
static int do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, timelib_sll *a, timelib_sll *b)
|
||||
static void do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, timelib_sll *a, timelib_sll *b)
|
||||
{
|
||||
if (*a < start) {
|
||||
*b -= (start - *a - 1) / adj + 1;
|
||||
|
@ -38,7 +38,6 @@ static int do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, t
|
|||
*b += *a / adj;
|
||||
*a -= adj * (*a / adj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void inc_month(timelib_sll *y, timelib_sll *m)
|
||||
|
@ -170,24 +169,24 @@ static void do_adjust_for_weekday(timelib_time* time)
|
|||
|
||||
void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt)
|
||||
{
|
||||
do {} while (do_range_limit(0, 60, 60, &rt->s, &rt->i));
|
||||
do {} while (do_range_limit(0, 60, 60, &rt->i, &rt->h));
|
||||
do {} while (do_range_limit(0, 24, 24, &rt->h, &rt->d));
|
||||
do {} while (do_range_limit(0, 12, 12, &rt->m, &rt->y));
|
||||
do_range_limit(0, 60, 60, &rt->s, &rt->i);
|
||||
do_range_limit(0, 60, 60, &rt->i, &rt->h);
|
||||
do_range_limit(0, 24, 24, &rt->h, &rt->d);
|
||||
do_range_limit(0, 12, 12, &rt->m, &rt->y);
|
||||
|
||||
do_range_limit_days_relative(&base->y, &base->m, &rt->y, &rt->m, &rt->d, rt->invert);
|
||||
do {} while (do_range_limit(0, 12, 12, &rt->m, &rt->y));
|
||||
do_range_limit(0, 12, 12, &rt->m, &rt->y);
|
||||
}
|
||||
|
||||
void timelib_do_normalize(timelib_time* time)
|
||||
{
|
||||
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 60, 60, &time->s, &time->i));
|
||||
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 60, 60, &time->i, &time->h));
|
||||
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 24, 24, &time->h, &time->d));
|
||||
do {} while (do_range_limit(1, 13, 12, &time->m, &time->y));
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->s, &time->i);
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->i, &time->h);
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 24, 24, &time->h, &time->d);
|
||||
do_range_limit(1, 13, 12, &time->m, &time->y);
|
||||
|
||||
do {} while (do_range_limit_days(&time->y, &time->m, &time->d));
|
||||
do {} while (do_range_limit(1, 13, 12, &time->m, &time->y));
|
||||
do_range_limit(1, 13, 12, &time->m, &time->y);
|
||||
}
|
||||
|
||||
static void do_adjust_relative(timelib_time* time)
|
||||
|
|
|
@ -214,6 +214,34 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
|
|||
tm->have_zone = 1;
|
||||
}
|
||||
|
||||
void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset)
|
||||
{
|
||||
if (t->tz_abbr) {
|
||||
free(t->tz_abbr);
|
||||
}
|
||||
t->tz_abbr = NULL;
|
||||
|
||||
t->z = utc_offset;
|
||||
t->have_zone = 1;
|
||||
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
|
||||
t->dst = 0;
|
||||
t->tz_info = NULL;
|
||||
}
|
||||
|
||||
void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info)
|
||||
{
|
||||
if (t->tz_abbr) {
|
||||
free(t->tz_abbr);
|
||||
}
|
||||
t->tz_abbr = strdup(abbr_info.abbr);
|
||||
|
||||
t->z = abbr_info.utc_offset;
|
||||
t->have_zone = 1;
|
||||
t->zone_type = TIMELIB_ZONETYPE_ABBR;
|
||||
t->dst = abbr_info.dst;
|
||||
t->tz_info = NULL;
|
||||
}
|
||||
|
||||
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz)
|
||||
{
|
||||
timelib_time_offset *gmt_offset;
|
||||
|
|
|
@ -299,6 +299,10 @@ ZEND_END_ARG_INFO()
|
|||
ZEND_BEGIN_ARG_INFO(arginfo_date_method_timestamp_get, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_create_from_mutable, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, DateTime)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_open, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, timezone)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
@ -495,6 +499,7 @@ const zend_function_entry date_funcs_immutable[] = {
|
|||
PHP_ME(DateTimeImmutable, setDate, arginfo_date_method_date_set, 0)
|
||||
PHP_ME(DateTimeImmutable, setISODate, arginfo_date_method_isodate_set, 0)
|
||||
PHP_ME(DateTimeImmutable, setTimestamp, arginfo_date_method_timestamp_set, 0)
|
||||
PHP_ME(DateTimeImmutable, createFromMutable, arginfo_date_method_create_from_mutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_FE_END
|
||||
};
|
||||
|
||||
|
@ -2267,7 +2272,7 @@ static zend_object *date_object_clone_timezone(zval *this_ptr TSRMLS_DC) /* {{{
|
|||
case TIMELIB_ZONETYPE_ABBR:
|
||||
new_obj->tzi.z.utc_offset = old_obj->tzi.z.utc_offset;
|
||||
new_obj->tzi.z.dst = old_obj->tzi.z.dst;
|
||||
new_obj->tzi.z.abbr = old_obj->tzi.z.abbr;
|
||||
new_obj->tzi.z.abbr = strdup(old_obj->tzi.z.abbr);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2699,6 +2704,34 @@ PHP_METHOD(DateTimeImmutable, __construct)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto DateTimeImmutable::createFromMutable(DateTimeZone object)
|
||||
Creates new DateTimeImmutable object from an existing mutable DateTime object.
|
||||
*/
|
||||
PHP_METHOD(DateTimeImmutable, createFromMutable)
|
||||
{
|
||||
zval *datetime_object = NULL;
|
||||
php_date_obj *new_obj = NULL;
|
||||
php_date_obj *old_obj = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O!", &datetime_object, date_ce_date) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
php_date_instantiate(date_ce_immutable, return_value TSRMLS_CC);
|
||||
old_obj = Z_PHPDATE_P(datetime_object);
|
||||
new_obj = Z_PHPDATE_P(return_value);
|
||||
|
||||
new_obj->time = timelib_time_ctor();
|
||||
*new_obj->time = *old_obj->time;
|
||||
if (old_obj->time->tz_abbr) {
|
||||
new_obj->time->tz_abbr = strdup(old_obj->time->tz_abbr);
|
||||
}
|
||||
if (old_obj->time->tz_info) {
|
||||
new_obj->time->tz_info = old_obj->time->tz_info;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int php_date_initialize_from_hash(zval *return_value, php_date_obj **dateobj, HashTable *myht TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval *z_date;
|
||||
|
@ -2735,6 +2768,10 @@ static int php_date_initialize_from_hash(zval *return_value, php_date_obj **date
|
|||
|
||||
tzi = php_date_parse_tzfile(Z_STRVAL_P(z_timezone), DATE_TIMEZONEDB TSRMLS_CC);
|
||||
|
||||
if (tzi == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
tzobj = Z_PHPTIMEZONE_P(php_date_instantiate(date_ce_timezone, &tmp_obj TSRMLS_CC));
|
||||
tzobj->type = TIMELIB_ZONETYPE_ID;
|
||||
tzobj->tzi.tz = tzi;
|
||||
|
@ -3188,6 +3225,26 @@ PHP_METHOD(DateTimeImmutable, sub)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
static void set_timezone_from_timelib_time(php_timezone_obj *tzobj, timelib_time *t)
|
||||
{
|
||||
tzobj->initialized = 1;
|
||||
tzobj->type = t->zone_type;
|
||||
switch (t->zone_type) {
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
tzobj->tzi.tz = t->tz_info;
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_OFFSET:
|
||||
tzobj->tzi.utc_offset = t->z;
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
tzobj->tzi.z.utc_offset = t->z;
|
||||
tzobj->tzi.z.dst = t->dst;
|
||||
tzobj->tzi.z.abbr = strdup(t->tz_abbr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* {{{ proto DateTimeZone date_timezone_get(DateTimeInterface object)
|
||||
Return new DateTimeZone object relative to give DateTime
|
||||
*/
|
||||
|
@ -3205,21 +3262,7 @@ PHP_FUNCTION(date_timezone_get)
|
|||
if (dateobj->time->is_localtime/* && dateobj->time->tz_info*/) {
|
||||
php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC);
|
||||
tzobj = Z_PHPTIMEZONE_P(return_value);
|
||||
tzobj->initialized = 1;
|
||||
tzobj->type = dateobj->time->zone_type;
|
||||
switch (dateobj->time->zone_type) {
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
tzobj->tzi.tz = dateobj->time->tz_info;
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_OFFSET:
|
||||
tzobj->tzi.utc_offset = dateobj->time->z;
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
tzobj->tzi.z.utc_offset = dateobj->time->z;
|
||||
tzobj->tzi.z.dst = dateobj->time->dst;
|
||||
tzobj->tzi.z.abbr = strdup(dateobj->time->tz_abbr);
|
||||
break;
|
||||
}
|
||||
set_timezone_from_timelib_time(tzobj, dateobj->time);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
@ -3234,11 +3277,18 @@ static void php_date_timezone_set(zval *object, zval *timezone_object, zval *ret
|
|||
dateobj = Z_PHPDATE_P(object);
|
||||
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
|
||||
tzobj = Z_PHPTIMEZONE_P(timezone_object);
|
||||
if (tzobj->type != TIMELIB_ZONETYPE_ID) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only do this for zones with ID for now");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (tzobj->type) {
|
||||
case TIMELIB_ZONETYPE_OFFSET:
|
||||
timelib_set_timezone_from_offset(dateobj->time, tzobj->tzi.utc_offset);
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
timelib_set_timezone_from_abbr(dateobj->time, tzobj->tzi.z);
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
timelib_set_timezone(dateobj->time, tzobj->tzi.tz);
|
||||
break;
|
||||
}
|
||||
timelib_unixtime2local(dateobj->time, dateobj->time->sse);
|
||||
} /* }}} */
|
||||
|
||||
|
@ -3563,23 +3613,21 @@ PHP_FUNCTION(date_diff)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
static int timezone_initialize(timelib_tzinfo **tzi, /*const*/ char *tz TSRMLS_DC) /* {{{ */
|
||||
static int timezone_initialize(php_timezone_obj *tzobj, /*const*/ char *tz TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
char *tzid;
|
||||
timelib_time *dummy_t = ecalloc(1, sizeof(timelib_time));
|
||||
int dst, not_found;
|
||||
char *orig_tz = tz;
|
||||
|
||||
*tzi = NULL;
|
||||
|
||||
if ((tzid = timelib_timezone_id_from_abbr(tz, -1, 0))) {
|
||||
*tzi = php_date_parse_tzfile(tzid, DATE_TIMEZONEDB TSRMLS_CC);
|
||||
} else {
|
||||
*tzi = php_date_parse_tzfile(tz, DATE_TIMEZONEDB TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (*tzi) {
|
||||
return SUCCESS;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad timezone (%s)", tz);
|
||||
dummy_t->z = timelib_parse_zone(&tz, &dst, dummy_t, ¬_found, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
if (not_found) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad timezone (%s)", orig_tz);
|
||||
efree(dummy_t);
|
||||
return FAILURE;
|
||||
} else {
|
||||
set_timezone_from_timelib_time(tzobj, dummy_t);
|
||||
efree(dummy_t);
|
||||
return SUCCESS;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
|
@ -3590,19 +3638,15 @@ PHP_FUNCTION(timezone_open)
|
|||
{
|
||||
char *tz;
|
||||
int tz_len;
|
||||
timelib_tzinfo *tzi = NULL;
|
||||
php_timezone_obj *tzobj;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (SUCCESS != timezone_initialize(&tzi, tz TSRMLS_CC)) {
|
||||
tzobj = Z_PHPTIMEZONE_P(php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC));
|
||||
if (SUCCESS != timezone_initialize(tzobj, tz TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
tzobj = Z_PHPTIMEZONE_P(php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC));
|
||||
tzobj->type = TIMELIB_ZONETYPE_ID;
|
||||
tzobj->tzi.tz = tzi;
|
||||
tzobj->initialized = 1;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -3613,18 +3657,13 @@ PHP_METHOD(DateTimeZone, __construct)
|
|||
{
|
||||
char *tz;
|
||||
int tz_len;
|
||||
timelib_tzinfo *tzi = NULL;
|
||||
php_timezone_obj *tzobj;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
|
||||
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) {
|
||||
if (SUCCESS == timezone_initialize(&tzi, tz TSRMLS_CC)) {
|
||||
tzobj = Z_PHPTIMEZONE_P(getThis());
|
||||
tzobj->type = TIMELIB_ZONETYPE_ID;
|
||||
tzobj->tzi.tz = tzi;
|
||||
tzobj->initialized = 1;
|
||||
//??? } else {
|
||||
if (FAILURE == timezone_initialize(tzobj, tz TSRMLS_CC)) {
|
||||
//??? ZVAL_NULL(getThis());
|
||||
}
|
||||
}
|
||||
|
@ -3636,41 +3675,12 @@ static int php_date_timezone_initialize_from_hash(zval **return_value, php_timez
|
|||
{
|
||||
zval *z_timezone;
|
||||
zval *z_timezone_type;
|
||||
timelib_tzinfo *tzi;
|
||||
|
||||
z_timezone_type = zend_hash_str_find(myht, "timezone_type", sizeof("timezone_type")-1);
|
||||
if (z_timezone_type) {
|
||||
z_timezone = zend_hash_str_find(myht, "timezone", sizeof("timezone")-1);
|
||||
if (z_timezone) {
|
||||
if ((z_timezone_type = zend_hash_str_find(myht, "timezone_type", sizeof("timezone_type")-1)) != NULL) {
|
||||
if ((z_timezone = zend_hash_str_find(myht, "timezone", sizeof("timezone")-1)) != NULL) {
|
||||
convert_to_long(z_timezone_type);
|
||||
switch (Z_LVAL_P(z_timezone_type)) {
|
||||
case TIMELIB_ZONETYPE_OFFSET: {
|
||||
char *offset, *offset_start;
|
||||
|
||||
offset = emalloc(sizeof(char) * (Z_STRLEN_P(z_timezone) + 1));
|
||||
memmove(offset, Z_STRVAL_P(z_timezone), Z_STRLEN_P(z_timezone)+1);
|
||||
offset_start = offset;
|
||||
|
||||
++offset;
|
||||
if(*offset_start == '+'){
|
||||
(*tzobj)->tzi.utc_offset = -1 * timelib_parse_tz_cor(&offset);
|
||||
} else {
|
||||
(*tzobj)->tzi.utc_offset = timelib_parse_tz_cor(&offset);
|
||||
}
|
||||
efree(offset_start);
|
||||
(*tzobj)->type = TIMELIB_ZONETYPE_OFFSET;
|
||||
(*tzobj)->initialized = 1;
|
||||
if (SUCCESS == timezone_initialize(*tzobj, Z_STRVAL_P(z_timezone) TSRMLS_CC)) {
|
||||
return SUCCESS;
|
||||
break;
|
||||
}
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
if (SUCCESS == timezone_initialize(&tzi, Z_STRVAL_P(z_timezone) TSRMLS_CC)) {
|
||||
(*tzobj)->type = TIMELIB_ZONETYPE_ID;
|
||||
(*tzobj)->tzi.tz = tzi;
|
||||
(*tzobj)->initialized = 1;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4942,7 +4952,6 @@ static zval *date_period_read_property(zval *object, zval *member, int type, zen
|
|||
zv = std_object_handlers.read_property(object, member, type, cache_slot, rv TSRMLS_CC);
|
||||
if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJ_HANDLER_P(zv, clone_obj)) {
|
||||
/* defensive copy */
|
||||
//??? MAKE_STD_ZVAL(zv);
|
||||
ZVAL_OBJ(zv, Z_OBJ_HANDLER_P(zv, clone_obj)(zv TSRMLS_CC));
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ PHP_METHOD(DateTimeImmutable, setTime);
|
|||
PHP_METHOD(DateTimeImmutable, setDate);
|
||||
PHP_METHOD(DateTimeImmutable, setISODate);
|
||||
PHP_METHOD(DateTimeImmutable, setTimestamp);
|
||||
PHP_METHOD(DateTimeImmutable, createFromMutable);
|
||||
|
||||
PHP_METHOD(DateTimeZone, __construct);
|
||||
PHP_METHOD(DateTimeZone, __wakeup);
|
||||
|
@ -142,14 +143,9 @@ struct _php_timezone_obj {
|
|||
int initialized;
|
||||
int type;
|
||||
union {
|
||||
timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID; */
|
||||
timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID */
|
||||
timelib_sll utc_offset; /* TIMELIB_ZONETYPE_OFFSET */
|
||||
struct /* TIMELIB_ZONETYPE_ABBR */
|
||||
{
|
||||
timelib_sll utc_offset;
|
||||
char *abbr;
|
||||
int dst;
|
||||
} z;
|
||||
timelib_abbr_info z; /* TIMELIB_ZONETYPE_ABBR */
|
||||
} tzi;
|
||||
HashTable *props;
|
||||
zend_object std;
|
||||
|
|
26
ext/date/tests/DateTimeImmutable_createFromMutable.phpt
Normal file
26
ext/date/tests/DateTimeImmutable_createFromMutable.phpt
Normal file
|
@ -0,0 +1,26 @@
|
|||
--TEST--
|
||||
Tests for DateTimeImmutable::createFromMutable.
|
||||
--INI--
|
||||
date.timezone=Europe/London
|
||||
--FILE--
|
||||
<?php
|
||||
$current = "2014-03-02 16:24:08";
|
||||
|
||||
$i = DateTimeImmutable::createFromMutable( date_create( $current ) );
|
||||
var_dump( $i );
|
||||
|
||||
$i = DateTimeImmutable::createFromMutable( date_create_immutable( $current ) );
|
||||
var_dump( $i );
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(DateTimeImmutable)#%d (3) {
|
||||
["date"]=>
|
||||
string(19) "2014-03-02 16:24:08"
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
string(13) "Europe/London"
|
||||
}
|
||||
|
||||
Warning: DateTimeImmutable::createFromMutable() expects parameter 1 to be DateTime, object given in %stests%eDateTimeImmutable_createFromMutable.php on line %d
|
||||
NULL
|
|
@ -31,15 +31,15 @@ if ($clone != $orig) {
|
|||
*** Testing clone on DateTime objects ***
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
int(2)
|
||||
["timezone"]=>
|
||||
string(3) "UTC"
|
||||
string(3) "GMT"
|
||||
}
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
int(2)
|
||||
["timezone"]=>
|
||||
string(3) "UTC"
|
||||
string(3) "GMT"
|
||||
}
|
||||
TEST PASSED : Objects equal but not indetical
|
||||
===DONE===
|
||||
|
|
|
@ -23,9 +23,9 @@ var_dump( new DateTimeZone("America/Los_Angeles") );
|
|||
*** Testing new DateTimeZone() : basic functionality ***
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
int(2)
|
||||
["timezone"]=>
|
||||
string(3) "UTC"
|
||||
string(3) "GMT"
|
||||
}
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
|
|
|
@ -48,11 +48,9 @@ $inputs = array(
|
|||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -12345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
|
@ -123,15 +121,9 @@ FAILED: DateTimeZone::__construct(): Unknown or bad timezone (1)
|
|||
-- int 12345 --
|
||||
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (12345)
|
||||
|
||||
-- int -12345 --
|
||||
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (-12345)
|
||||
|
||||
-- float 10.5 --
|
||||
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (10.5)
|
||||
|
||||
-- float -10.5 --
|
||||
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (-10.5)
|
||||
|
||||
-- float .5 --
|
||||
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (0.5)
|
||||
|
||||
|
|
|
@ -20,16 +20,16 @@ var_dump( $tz2->getName() );
|
|||
--EXPECTF--
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
int(2)
|
||||
["timezone"]=>
|
||||
string(16) "America/New_York"
|
||||
string(3) "EST"
|
||||
}
|
||||
string(88) "O:12:"DateTimeZone":2:{s:13:"timezone_type";i:3;s:8:"timezone";s:16:"America/New_York";}"
|
||||
string(74) "O:12:"DateTimeZone":2:{s:13:"timezone_type";i:2;s:8:"timezone";s:3:"EST";}"
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
int(2)
|
||||
["timezone"]=>
|
||||
string(16) "America/New_York"
|
||||
string(3) "EST"
|
||||
}
|
||||
string(16) "America/New_York"
|
||||
string(3) "EST"
|
||||
===DONE===
|
||||
|
|
|
@ -18,14 +18,14 @@ var_dump( $tz2->getName() );
|
|||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
object(DateTimeZone)#%d (2) {
|
||||
object(DateTimeZone)#1 (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
string(16) "America/New_York"
|
||||
}
|
||||
string(88) "O:12:"DateTimeZone":2:{s:13:"timezone_type";i:3;s:8:"timezone";s:16:"America/New_York";}"
|
||||
object(DateTimeZone)#%d (2) {
|
||||
object(DateTimeZone)#2 (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
|
|
10
ext/date/tests/bug44780.phpt
Normal file
10
ext/date/tests/bug44780.phpt
Normal file
|
@ -0,0 +1,10 @@
|
|||
--TEST--
|
||||
Bug #44780 (some time zone offsets not recognized by timezone_name_from_abbr)
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump( timezone_name_from_abbr("", 5.5*3600, false) );
|
||||
var_dump( timezone_name_from_abbr("", 28800, false) );
|
||||
?>
|
||||
--EXPECT--
|
||||
string(12) "Asia/Kolkata"
|
||||
string(13) "Asia/Shanghai"
|
34
ext/date/tests/bug45543.phpt
Normal file
34
ext/date/tests/bug45543.phpt
Normal file
|
@ -0,0 +1,34 @@
|
|||
--TEST--
|
||||
Test for bug #45543: DateTime::setTimezone can not set timezones without ID.
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
$test_dates = array(
|
||||
'2008-01-01 12:00:00 PDT',
|
||||
'2008-01-01 12:00:00 +02:00',
|
||||
);
|
||||
|
||||
foreach ($test_dates as $test_date)
|
||||
{
|
||||
$d1 = new DateTime($test_date);
|
||||
$d2 = new DateTime('2008-01-01 12:00:00 UTC');
|
||||
echo $d1->format(DATE_ISO8601), PHP_EOL;
|
||||
echo $d2->format(DATE_ISO8601), PHP_EOL;
|
||||
$tz = $d1->getTimeZone();
|
||||
$d2->setTimeZone($tz);
|
||||
echo $d1->format(DATE_ISO8601), PHP_EOL;
|
||||
echo $d2->format(DATE_ISO8601), PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
}
|
||||
--EXPECT--
|
||||
2008-01-01T12:00:00-0700
|
||||
2008-01-01T12:00:00+0000
|
||||
2008-01-01T12:00:00-0700
|
||||
2008-01-01T05:00:00-0700
|
||||
|
||||
2008-01-01T12:00:00+0200
|
||||
2008-01-01T12:00:00+0000
|
||||
2008-01-01T12:00:00+0200
|
||||
2008-01-01T14:00:00+0200
|
||||
|
11
ext/date/tests/bug66721.phpt
Normal file
11
ext/date/tests/bug66721.phpt
Normal file
|
@ -0,0 +1,11 @@
|
|||
--TEST--
|
||||
Test for bug #66721: __wakeup of DateTime segfaults when invalid object data is supplied
|
||||
--CREDITS--
|
||||
Boro Sitnikovski <buritomath@yahoo.com>
|
||||
--FILE--
|
||||
<?php
|
||||
$y = 'O:8:"DateTime":3:{s:4:"date";s:19:"2014-02-15 02:00:51";s:13:"timezone_type";i:3;s:8:"timezone";s:10:"1234567890";}';
|
||||
var_dump(unserialize($y));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Invalid serialization data for DateTime object in %s on line %d
|
|
@ -20,9 +20,9 @@ var_dump( timezone_open("America/Los_Angeles") );
|
|||
*** Testing timezone_open() : basic functionality ***
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
int(2)
|
||||
["timezone"]=>
|
||||
string(3) "UTC"
|
||||
string(3) "GMT"
|
||||
}
|
||||
object(DateTimeZone)#%d (2) {
|
||||
["timezone_type"]=>
|
||||
|
|
|
@ -48,11 +48,9 @@ $inputs = array(
|
|||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -12345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
|
@ -124,21 +122,11 @@ bool(false)
|
|||
Warning: timezone_open(): Unknown or bad timezone (12345) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- int -12345 --
|
||||
|
||||
Warning: timezone_open(): Unknown or bad timezone (-12345) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- float 10.5 --
|
||||
|
||||
Warning: timezone_open(): Unknown or bad timezone (10.5) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- float -10.5 --
|
||||
|
||||
Warning: timezone_open(): Unknown or bad timezone (-10.5) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- float .5 --
|
||||
|
||||
Warning: timezone_open(): Unknown or bad timezone (0.5) in %s on line %d
|
||||
|
|
|
@ -57,14 +57,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_popen, 0, 0, 2)
|
|||
ZEND_ARG_INFO(0, path)
|
||||
ZEND_ARG_INFO(0, mode)
|
||||
ZEND_ARG_INFO(0, handlername)
|
||||
ZEND_ARG_INFO(0, ...)
|
||||
ZEND_ARG_VARIADIC_INFO(0, handler_parameters)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_open, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, path)
|
||||
ZEND_ARG_INFO(0, mode)
|
||||
ZEND_ARG_INFO(0, handlername)
|
||||
ZEND_ARG_INFO(0, ...)
|
||||
ZEND_ARG_VARIADIC_INFO(0, handler_parameters)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_dba_close, 0)
|
||||
|
|
|
@ -1301,6 +1301,12 @@ char *_dom_get_valid_file_path(char *source, char *resolved_path, int resolved_p
|
|||
|
||||
if (uri->scheme != NULL) {
|
||||
/* absolute file uris - libxml only supports localhost or empty host */
|
||||
#ifdef PHP_WIN32
|
||||
if (strncasecmp(source, "file://",7) == 0 && ':' == source[8]) {
|
||||
isFileUri = 1;
|
||||
source += 7;
|
||||
} else
|
||||
#endif
|
||||
if (strncasecmp(source, "file:///",8) == 0) {
|
||||
isFileUri = 1;
|
||||
#ifdef PHP_WIN32
|
||||
|
|
|
@ -172,30 +172,44 @@ Since: DOM Level 2
|
|||
int dom_documenttype_internal_subset_read(dom_object *obj, zval *retval TSRMLS_DC)
|
||||
{
|
||||
xmlDtdPtr dtdptr = (xmlDtdPtr) dom_object_get_node(obj);
|
||||
xmlDtd *intsubset;
|
||||
xmlOutputBuffer *buff = NULL;
|
||||
xmlDtdPtr intsubset;
|
||||
|
||||
if (dtdptr == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (dtdptr->doc != NULL && ((intsubset = dtdptr->doc->intSubset) != NULL)) {
|
||||
buff = xmlAllocOutputBuffer(NULL);
|
||||
if (dtdptr->doc != NULL && ((intsubset = xmlGetIntSubset(dtdptr->doc)) != NULL)) {
|
||||
smart_str ret_buf = {0};
|
||||
xmlNodePtr cur = intsubset->children;
|
||||
|
||||
while (cur != NULL) {
|
||||
xmlOutputBuffer *buff = xmlAllocOutputBuffer(NULL);
|
||||
|
||||
if (buff != NULL) {
|
||||
xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
|
||||
xmlNodeDumpOutput (buff, NULL, cur, 0, 0, NULL);
|
||||
xmlOutputBufferFlush(buff);
|
||||
|
||||
#ifdef LIBXML2_NEW_BUFFER
|
||||
ZVAL_STRINGL(retval, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff));
|
||||
smart_str_appendl(&ret_buf, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff));
|
||||
#else
|
||||
ZVAL_STRINGL(retval, buff->buffer->content, buff->buffer->use);
|
||||
smart_str_appendl(&ret_buf, buff->buffer->content, buff->buffer->use);
|
||||
#endif
|
||||
|
||||
(void)xmlOutputBufferClose(buff);
|
||||
}
|
||||
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
if (ret_buf.s) {
|
||||
smart_str_0(&ret_buf);
|
||||
ZVAL_STR(retval, ret_buf.s);
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
ZVAL_EMPTY_STRING(retval);
|
||||
ZVAL_NULL(retval);
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
|
|
|
@ -43,6 +43,6 @@ print 'notation: '.$notation->nodeName."\n";
|
|||
publicId: -//OASIS//DTD DocBook XML//EN
|
||||
systemId: docbookx.dtd
|
||||
name: chapter
|
||||
internalSubset: <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML//EN" "docbookx.dtd">
|
||||
internalSubset:
|
||||
entity: logo
|
||||
notation: gif
|
43
ext/dom/tests/bug67081.phpt
Normal file
43
ext/dom/tests/bug67081.phpt
Normal file
|
@ -0,0 +1,43 @@
|
|||
--TEST--
|
||||
Bug #67081 DOMDocumentType->internalSubset returns entire DOCTYPE tag, not only the subset
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$domDocument = new DOMDocument();
|
||||
$domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug67081_0.xml");
|
||||
var_dump($domDocument->doctype->internalSubset);
|
||||
|
||||
$domDocument = new DOMDocument();
|
||||
$domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug67081_1.xml");
|
||||
var_dump($domDocument->doctype->internalSubset);
|
||||
|
||||
$domDocument = new DOMDocument();
|
||||
$domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug67081_2.xml");
|
||||
var_dump($domDocument->doctype->internalSubset);
|
||||
|
||||
$domDocument = new DOMDocument();
|
||||
$domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "dom.xml");
|
||||
var_dump($domDocument->doctype->internalSubset);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
string(19) "<!ELEMENT a EMPTY>
|
||||
"
|
||||
string(38) "<!ELEMENT a EMPTY>
|
||||
<!ELEMENT b EMPTY>
|
||||
"
|
||||
NULL
|
||||
string(277) "<!ENTITY % incent SYSTEM "dom.ent">
|
||||
<!ENTITY amp "&#38;">
|
||||
<!ENTITY gt ">">
|
||||
<!ENTITY % coreattrs "title CDATA #IMPLIED">
|
||||
<!ENTITY % attrs "%coreattrs;">
|
||||
<!ATTLIST foo bar CDATA #IMPLIED>
|
||||
<!ELEMENT foo (#PCDATA)>
|
||||
<!ELEMENT root (foo)+>
|
||||
<!ATTLIST th title CDATA #IMPLIED>
|
||||
"
|
||||
===DONE===
|
6
ext/dom/tests/bug67081_0.xml
Normal file
6
ext/dom/tests/bug67081_0.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE a [
|
||||
<!ELEMENT a EMPTY>
|
||||
]>
|
||||
<a></a>
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue