mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-26 02:15:42 +00:00
Compare commits
355
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45d2df5f11 | ||
|
|
e5ded6e843 | ||
|
|
190c7772c1 | ||
|
|
bf0d383aba | ||
|
|
7d62a321c7 | ||
|
|
b35c788a62 | ||
|
|
ff390d788f | ||
|
|
6c1cdd0814 | ||
|
|
60846fab58 | ||
|
|
f27eaa1578 | ||
|
|
2e8e2db82a | ||
|
|
0e764dc657 | ||
|
|
6597d86389 | ||
|
|
eacab735e0 | ||
|
|
8aaec7d1c3 | ||
|
|
202dcc0f6a | ||
|
|
ee42849f8f | ||
|
|
37f4f132fc | ||
|
|
4c6816ddf2 | ||
|
|
dc02b5a1fd | ||
|
|
f08e8772a7 | ||
|
|
0893a13e32 | ||
|
|
f197dafd1c | ||
|
|
5ed1bdf9a5 | ||
|
|
11e47b1cdc | ||
|
|
d76a6a3e4d | ||
|
|
210b444e1d | ||
|
|
ba8cdc855d | ||
|
|
c91ad8233b | ||
|
|
79e0c273b8 | ||
|
|
1c7f54d4f7 | ||
|
|
cbb1097770 | ||
|
|
83c302840e | ||
|
|
3828b5d83d | ||
|
|
6edc84fcdf | ||
|
|
4bc8f94b58 | ||
|
|
fb5c7cda5d | ||
|
|
3834771b2e | ||
|
|
d9078c7c8d | ||
|
|
4b8c098f02 | ||
|
|
b1396cc7a5 | ||
|
|
aafce7353e | ||
|
|
9f3a98b124 | ||
|
|
473cd4d6a9 | ||
|
|
586f379b88 | ||
|
|
909ef53e9d | ||
|
|
4e89151159 | ||
|
|
ceca4d2490 | ||
|
|
a0445644e0 | ||
|
|
8e08f6c28d | ||
|
|
c4259f90b1 | ||
|
|
6dd41435a3 | ||
|
|
c2a93ba3af | ||
|
|
1eee68d3f4 | ||
|
|
0f62b94971 | ||
|
|
a791671f40 | ||
|
|
3aa6f8bfdd | ||
|
|
dc6b14149d | ||
|
|
874a0bb7eb | ||
|
|
28e0a2129b | ||
|
|
7072db5a6b | ||
|
|
4904be6d94 | ||
|
|
03dfe0d5e0 | ||
|
|
dcdf236467 | ||
|
|
74fff1512a | ||
|
|
36a7f48e84 | ||
|
|
9cefeea860 | ||
|
|
d5f79e40e5 | ||
|
|
4b7148711b | ||
|
|
676864684b | ||
|
|
807d937e91 | ||
|
|
2bf13b2042 | ||
|
|
15acd4ee50 | ||
|
|
a3541301eb | ||
|
|
aaad97675a | ||
|
|
89a9acea1f | ||
|
|
d501707248 | ||
|
|
5b5b9b9239 | ||
|
|
3b82a477b0 | ||
|
|
fd45f1eb78 | ||
|
|
d788a85736 | ||
|
|
9eb4bc2f84 | ||
|
|
4e5195f82c | ||
|
|
89eab884d9 | ||
|
|
84efb8fc71 | ||
|
|
86096a99ec | ||
|
|
f1fc5a5bf5 | ||
|
|
deb56c010e | ||
|
|
cfce5a4d02 | ||
|
|
a053e69991 | ||
|
|
feb4eb850d | ||
|
|
998f506b6d | ||
|
|
7691926bbe | ||
|
|
7b5b2b4efa | ||
|
|
511a375e60 | ||
|
|
61028ad45e | ||
|
|
e4f1eee6c3 | ||
|
|
a92c5b14cf | ||
|
|
ee4e5ce2cf | ||
|
|
42c134df4b | ||
|
|
aca07343ce | ||
|
|
25e57e702b | ||
|
|
681e1a5ce0 | ||
|
|
d599d36d49 | ||
|
|
bbc37e78e8 | ||
|
|
73008bb5ce | ||
|
|
5980e987d2 | ||
|
|
de137e5a8d | ||
|
|
127eb33b84 | ||
|
|
e141592da6 | ||
|
|
f5182741a6 | ||
|
|
3458dac342 | ||
|
|
cf9966671c | ||
|
|
01d5e28057 | ||
|
|
aab2e8eb7e | ||
|
|
a86e869ee8 | ||
|
|
4facc35413 | ||
|
|
82dfe1acc8 | ||
|
|
9aaea81cfe | ||
|
|
3572a0482d | ||
|
|
83b00bbd08 | ||
|
|
e9883779a0 | ||
|
|
32d9409a24 | ||
|
|
6fe34014f0 | ||
|
|
28beaaad9c | ||
|
|
42f084c692 | ||
|
|
24cc7c0be2 | ||
|
|
e797e058c5 | ||
|
|
ac875f8f7e | ||
|
|
19aafe43b2 | ||
|
|
250ee4c17a | ||
|
|
6e7d24dd14 | ||
|
|
b502c0a3dc | ||
|
|
b209c27302 | ||
|
|
af6c11c5f0 | ||
|
|
0f53e37494 | ||
|
|
c9f909cd42 | ||
|
|
63d390cdf9 | ||
|
|
9e4ab7c53f | ||
|
|
57a6209051 | ||
|
|
73db3cda8b | ||
|
|
79d1c70e99 | ||
|
|
056f3441fd | ||
|
|
a3c7971f94 | ||
|
|
7844fb292c | ||
|
|
717dcdaa67 | ||
|
|
764190c1d6 | ||
|
|
6b34343479 | ||
|
|
8b72df0608 | ||
|
|
408ae9a452 | ||
|
|
bd3e5aab1d | ||
|
|
8785e22bca | ||
|
|
50f09d8256 | ||
|
|
fb4678f1ac | ||
|
|
c0476ff44b | ||
|
|
1a4863d560 | ||
|
|
65fd18fd88 | ||
|
|
d6713f3989 | ||
|
|
ef56cfb991 | ||
|
|
c676f5b36d | ||
|
|
734c28d242 | ||
|
|
bd0a8f31a4 | ||
|
|
03e36cd5b8 | ||
|
|
b3c43a1aec | ||
|
|
3af0ee0ea3 | ||
|
|
c02acf3c29 | ||
|
|
ca8ff0725b | ||
|
|
e07dfa96b3 | ||
|
|
ad358593a8 | ||
|
|
6daa84f199 | ||
|
|
056f6fd895 | ||
|
|
392f6830a1 | ||
|
|
67eccf8617 | ||
|
|
bd88bed670 | ||
|
|
209ec406ca | ||
|
|
f4a96983e1 | ||
|
|
62fa84a031 | ||
|
|
5bc9e006e8 | ||
|
|
6a2a2b52f9 | ||
|
|
befdd1770a | ||
|
|
523a6b50ae | ||
|
|
8ce521a6a7 | ||
|
|
621862a192 | ||
|
|
e700cbff22 | ||
|
|
2bf271bbb0 | ||
|
|
5b1f6caaf0 | ||
|
|
0cc89be244 | ||
|
|
e2b75e5bb7 | ||
|
|
1b1b706818 | ||
|
|
3926362d30 | ||
|
|
f500be8838 | ||
|
|
ba51a375ae | ||
|
|
db025b3789 | ||
|
|
e1a5edaac2 | ||
|
|
e75b967610 | ||
|
|
551569262b | ||
|
|
ce4ba54583 | ||
|
|
b11b3d201f | ||
|
|
26096aa73f | ||
|
|
a8a36b7d52 | ||
|
|
aed4b086ac | ||
|
|
c83598119b | ||
|
|
d02340bb39 | ||
|
|
f883d3cc7a | ||
|
|
ed5a8d510f | ||
|
|
f70f89c1b1 | ||
|
|
520d969fea | ||
|
|
432e91f112 | ||
|
|
e6b471933c | ||
|
|
bd58146ad6 | ||
|
|
2eb9bd316d | ||
|
|
d14670ccdb | ||
|
|
c0f1e6946d | ||
|
|
72389dd53f | ||
|
|
a9c503bc27 | ||
|
|
ac719610f4 | ||
|
|
5613d70ee8 | ||
|
|
d7d0ceb90d | ||
|
|
82d67af60d | ||
|
|
48dcc43488 | ||
|
|
304d97933f | ||
|
|
fc4761a07c | ||
|
|
50377b5bf2 | ||
|
|
735f930bac | ||
|
|
9b829c92b5 | ||
|
|
914de05bf5 | ||
|
|
e92ea13bff | ||
|
|
1433dec2d0 | ||
|
|
0fc8e6af0a | ||
|
|
4411641b1e | ||
|
|
8708b13d62 | ||
|
|
6a299514f8 | ||
|
|
0fbb421ec1 | ||
|
|
fd4a7388d7 | ||
|
|
c0e87e9bb1 | ||
|
|
9d08f09e06 | ||
|
|
bc1c2b3b31 | ||
|
|
a23bcba875 | ||
|
|
8738e6d86f | ||
|
|
58b754ca4a | ||
|
|
b97156113e | ||
|
|
98d929290c | ||
|
|
fa1802381f | ||
|
|
2f707bf246 | ||
|
|
9a5944d960 | ||
|
|
35b8f57906 | ||
|
|
8e29235b6c | ||
|
|
ad4f0c7812 | ||
|
|
d439b3970a | ||
|
|
90c5689b59 | ||
|
|
6eaf57eb3c | ||
|
|
1dafdaa31b | ||
|
|
78265a44c5 | ||
|
|
c786c30108 | ||
|
|
b260cb92e4 | ||
|
|
6b6a4e466a | ||
|
|
21fd125343 | ||
|
|
912be12432 | ||
|
|
e3ebe995c9 | ||
|
|
d81d61fcc4 | ||
|
|
01a13bb8c1 | ||
|
|
9adfcea241 | ||
|
|
ecf95a4cc5 | ||
|
|
44ff944b37 | ||
|
|
5a420c8680 | ||
|
|
de3b9bc77c | ||
|
|
0cb38a3d26 | ||
|
|
406d5a5ecc | ||
|
|
e51ddf9dc8 | ||
|
|
8f11f7f179 | ||
|
|
f0c85fab45 | ||
|
|
b0415856fd | ||
|
|
9e309a2d10 | ||
|
|
a7f0465c0b | ||
|
|
f4912e3a96 | ||
|
|
48cc47d55a | ||
|
|
a87233f98a | ||
|
|
c23a1f78b4 | ||
|
|
7cd702640d | ||
|
|
df484b0008 | ||
|
|
f8148a3905 | ||
|
|
86c806a36e | ||
|
|
1acee05579 | ||
|
|
cb9000f15e | ||
|
|
52611a2c7e | ||
|
|
508738251f | ||
|
|
2e0a960e97 | ||
|
|
065c8e77e2 | ||
|
|
f65e652f9f | ||
|
|
0eb519de66 | ||
|
|
f92eba241e | ||
|
|
77cdda452d | ||
|
|
38574614c5 | ||
|
|
0d65cd50dd | ||
|
|
b6ef87f803 | ||
|
|
a1193b23b6 | ||
|
|
609efa2623 | ||
|
|
7fa9032d0b | ||
|
|
be5b98ef0d | ||
|
|
98f3c410d9 | ||
|
|
fe451e9a72 | ||
|
|
e7a6d0b163 | ||
|
|
45d399b96e | ||
|
|
fca64efd62 | ||
|
|
bc68ab8b57 | ||
|
|
a3cb536d24 | ||
|
|
42a35c9b8b | ||
|
|
e9f2de918d | ||
|
|
3baad45b21 | ||
|
|
b64ac1faa3 | ||
|
|
9960ecc5cd | ||
|
|
dd7c33d0c9 | ||
|
|
0d61202427 | ||
|
|
ccd1babbfc | ||
|
|
bbdcbbdba5 | ||
|
|
9c036b13f9 | ||
|
|
1d65e8f135 | ||
|
|
8b83b48e98 | ||
|
|
34a55790f2 | ||
|
|
854c9abcd4 | ||
|
|
b3ce714cbf | ||
|
|
36a3011613 | ||
|
|
704b24d048 | ||
|
|
7f0d637de4 | ||
|
|
e09e45eb86 | ||
|
|
6f2d32fd1f | ||
|
|
bccead024d | ||
|
|
b2ca20312d | ||
|
|
b41a2755c4 | ||
|
|
e68792dbb2 | ||
|
|
a833f7d460 | ||
|
|
9e3551ba1f | ||
|
|
f046189e34 | ||
|
|
b93f8e6277 | ||
|
|
5a282136a3 | ||
|
|
3e4e173296 | ||
|
|
a37ff1fa4b | ||
|
|
6cf46f49e3 | ||
|
|
b6f76adef4 | ||
|
|
b8525baecf | ||
|
|
91cb087727 | ||
|
|
fac240b5d1 | ||
|
|
7e01935dc2 | ||
|
|
90d4ae4da8 | ||
|
|
43cb6ba763 | ||
|
|
8f097fb466 | ||
|
|
6357cdaecf | ||
|
|
4c13992f0d | ||
|
|
911ba0293a | ||
|
|
308edceb51 | ||
|
|
0d506131af | ||
|
|
d17b684b91 | ||
|
|
117955daf6 | ||
|
|
1d93f396bb | ||
|
|
a90a93f1a4 |
No files matched your search
@@ -22,10 +22,6 @@ sapi/nsapi/nsapi.c ident
|
||||
sapi/continuity/capi.c ident
|
||||
Zend/RFCs/002.txt ident
|
||||
Zend/RFCs/003.txt ident
|
||||
ext/exif/exif.c ident
|
||||
ext/ldap/ldap.c ident
|
||||
ext/pdo_pgsql/pdo_pgsql.c ident
|
||||
ext/tidy/tidy.c ident
|
||||
NEWS merge=NEWS
|
||||
UPGRADING merge=NEWS
|
||||
UPGRADING.INTERNALS merge=NEWS
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
*.tgz
|
||||
*.tar.gz
|
||||
*.tar.bz2
|
||||
*.tar.xz
|
||||
.FBCIndex
|
||||
.FBCLockFolder
|
||||
.deps
|
||||
@@ -247,8 +246,6 @@ 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
|
||||
|
||||
+8
-19
@@ -1,11 +1,11 @@
|
||||
language: c
|
||||
language: php
|
||||
|
||||
php:
|
||||
# We only specify one version so we only get one worker
|
||||
- 5.4
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_failure: change
|
||||
|
||||
cache:
|
||||
- apt
|
||||
email: false
|
||||
|
||||
env:
|
||||
global:
|
||||
@@ -15,17 +15,8 @@ env:
|
||||
- PDO_MYSQL_TEST_USER=travis
|
||||
- PDO_MYSQL_TEST_PASS=
|
||||
- PDO_MYSQL_TEST_HOST=127.0.0.1
|
||||
- REPORT_EXIT_STATUS=1
|
||||
matrix:
|
||||
- ENABLE_MAINTAINER_ZTS=0 ENABLE_DEBUG=0
|
||||
- ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1
|
||||
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y libenchant-dev libaspell-dev libpspell-dev librecode-dev
|
||||
- sudo cp ./travis/de /var/lib/locales/supported.d/de
|
||||
- sudo dpkg-reconfigure locales
|
||||
- ./travis/install.sh
|
||||
- REPORT_EXIT_STATUS=1
|
||||
|
||||
before_script:
|
||||
# Compile PHP
|
||||
@@ -38,6 +29,4 @@ before_script:
|
||||
- . ./travis/ext/pdo_pgsql/setup.sh
|
||||
|
||||
# Run PHPs run-tests.php
|
||||
script:
|
||||
- ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120
|
||||
- ./sapi/cli/php sapi/phpdbg/tests/run-tests.php -diff2stdout --phpdbg sapi/phpdbg/phpdbg
|
||||
script: ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120
|
||||
+1
-1
@@ -42,7 +42,7 @@ Exceptions:
|
||||
|
||||
4. When writing functions that deal with strings, be sure to remember
|
||||
that PHP holds the length property of each string, and that it
|
||||
shouldn't be calculated with strlen(). Write your functions in such
|
||||
shouldn't be calculated with strlen(). Write your functions in a such
|
||||
a way so that they'll take advantage of the length property, both
|
||||
for efficiency and in order for them to be binary-safe.
|
||||
Functions that change strings and obtain their new lengths while
|
||||
|
||||
-12
@@ -385,12 +385,6 @@ MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: hash
|
||||
PRIMARY MAINTAINER: Sara Golemon <pollita@php.net>, Mike Wallner <mike@php.net>, Anatol Belski <ab@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.1.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: iconv
|
||||
PRIMARY MAINTAINER: Moriyoshi Koizumi <moriyoshi@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
@@ -444,12 +438,6 @@ PRIMARY MAINTAINER: Frank M. Kromann
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: opcache
|
||||
PRIMARY MAINTAINER: Dmitry Stogov <dmitry@zend.com>, Xinchen Hui <laruence@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.5.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: openssl
|
||||
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>, Pierre-Alain Joye <pajoye@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
|
||||
@@ -155,7 +155,7 @@ Table of Contents
|
||||
a list of all available options along with short explanations running
|
||||
./configure --help. Our manual documents the different options
|
||||
separately. You will find the core options in the appendix, while the
|
||||
different extension specific options are described on the reference
|
||||
different extension specific options are descibed on the reference
|
||||
pages.
|
||||
|
||||
When PHP is configured, you are ready to build the module and/or
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2014 The PHP Group. All rights reserved.
|
||||
Copyright (c) 1999 - 2012 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ php_lcov.info: lcov-test
|
||||
@rm -rf lcov_data/
|
||||
@$(mkinstalldirs) lcov_data/
|
||||
@echo
|
||||
-@files=`find . -name \*.gcda -o -name \*.gcno -o -name \*.da -o -name \*.c -o -name \*.h | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' -e 's/\.da//g' | $(EGREP) $(LCOV_INCLUDE) | sed -e 's/.libs/zzzz/g' | sort | sed -e 's/zzzz/.libs/g' | uniq` ;\
|
||||
-@files=`find . -name \*.gcda -o -name \*.gcno -o -name \*.da -o -name \*.c -o -name \*.h | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' -e 's/\.da//g' | $(EGREP) $(LCOV_INCLUDE) | uniq` ;\
|
||||
for x in $$files; do \
|
||||
echo -n . ;\
|
||||
y=`echo $$x | sed -e 's!\.libs/!!'`; \
|
||||
|
||||
@@ -115,6 +115,7 @@ clean:
|
||||
find . -name \*.la -o -name \*.a | xargs rm -f
|
||||
find . -name \*.so | xargs rm -f
|
||||
find . -name .libs -a -type d|xargs rm -rf
|
||||
find . -name \*.1 | xargs rm -f
|
||||
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_MILTER_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
|
||||
|
||||
distclean: clean
|
||||
|
||||
+4
-8
@@ -45,16 +45,15 @@ Currently we have the following branches in use::
|
||||
|
||||
master The active development branch.
|
||||
|
||||
PHP-5.6 Is used to release the PHP 5.6.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.5 Is used to release the PHP 5.5.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.4 Is used to release the PHP 5.4.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.3 This branch is closed.
|
||||
PHP-5.3 Is used to release the PHP 5.3.x series. This is currently
|
||||
in extended support and open forsecurity fixes only. Triaged
|
||||
via security@php.net
|
||||
|
||||
PHP-5.2 This branch is closed.
|
||||
|
||||
@@ -62,12 +61,9 @@ Currently we have the following branches in use::
|
||||
|
||||
PHP-4.4 This branch is closed.
|
||||
|
||||
PHP-X.Y.Z These branches are used for the release managers for tagging
|
||||
the releases, hence they are closed to the general public.
|
||||
|
||||
The next few rules are more of a technical nature::
|
||||
|
||||
1. All changes should first go to the lowest branch (i.e. 5.4) and then
|
||||
1. All changes should first go to the lowest branch (i.e. 5.3) and then
|
||||
get merged up to all other branches. If a change is not needed for
|
||||
later branches (i.e. fixes for features which where dropped from later
|
||||
branches) an empty merge should be done.
|
||||
|
||||
+20
-33
@@ -11,27 +11,17 @@ because the sysadmins can not upgrade stuff then.
|
||||
2. Package two days before a release. So if the release is to be on Thursday,
|
||||
package on Tuesday. Think about timezones as well.
|
||||
|
||||
3. Ensure that the tests on Travis CI are green.
|
||||
See: https://travis-ci.org/php/php-src/builds
|
||||
It is recommended to do so a couple of days before the packaging day, to
|
||||
have enough time to investigate failures, communicate with the authors and
|
||||
commit the fixes.
|
||||
The RM for the branch is also responsible for keeping the CI green on
|
||||
ongoing bases between the releases. Check the CI status for your branch
|
||||
periodically and resolve the failures ASAP. See more in:
|
||||
https://wiki.php.net/rfc/travis_ci
|
||||
3. Ensure that Windows builds will work before packaging
|
||||
|
||||
4. Ensure that Windows builds will work before packaging
|
||||
|
||||
5. Follow all steps to the letter. When unclear ask previous RM's (David/Julien/
|
||||
4. Follow all steps to the letter. When unclear ask previous RM's (David/Julien/
|
||||
Johannes/Stas/Derick/Ilia) before proceeding. Ideally make sure that for the
|
||||
first releases one of the previous RM's is around to answer questions. For the
|
||||
steps related to the php/QA/bug websites try to have someone from the webmaster
|
||||
team (Bjori) on hand.
|
||||
|
||||
6. Verify the tags to be extra sure everything was tagged properly.
|
||||
5. Verify the tags to be extra sure everything was tagged properly.
|
||||
|
||||
7. Moving extensions from/to PECL requires write acces to the destination.
|
||||
6. Moving extensions from/to PECL requires write acces to the destination.
|
||||
Most developers should have this.
|
||||
|
||||
Moving extensions from php-src to PECL
|
||||
@@ -58,49 +48,47 @@ Rolling a non stable release (alpha/beta/RC)
|
||||
|
||||
1. Check windows snapshot builder logs (http://windows.php.net/downloads/snaps/ the last revision)
|
||||
|
||||
2. Check the tests at https://travis-ci.org/php/php-src/builds
|
||||
|
||||
3. run the "scripts/dev/credits" script in php-src and commit the changes in the
|
||||
2. run the "scripts/dev/credits" script in php-src and commit the changes in the
|
||||
credits files in ext/standard.
|
||||
|
||||
4. Checkout the release branch for this release (e.g., PHP-5.4.2) from the main branch.
|
||||
3. Checkout the release branch for this release (e.g., PHP-5.4.2) from the main branch.
|
||||
|
||||
5. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
|
||||
4. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
|
||||
Do not use abbreviations for alpha and beta. Do not use dashes, you should
|
||||
``#define PHP_VERSION "5.4.22RC1"`` and not ``#define PHP_VERSION "5.4.22-RC1"``
|
||||
|
||||
6. Compile and make test, with and without ZTS, using the right Bison version
|
||||
5. Compile and make test, with and without ZTS, using the right Bison version
|
||||
(for example, for 5.5, Bison 2.4.1 is used)
|
||||
|
||||
7. Check ./sapi/cli/php -v output for version matching.
|
||||
6. Check ./sapi/cli/php -v output for version matching.
|
||||
|
||||
8. If all is right, commit the changes to the release branch with ``git commit -a``.
|
||||
7. If all is right, commit the changes to the release branch with ``git commit -a``.
|
||||
|
||||
9. Tag the repository release branch with the version, e.g.:
|
||||
8. Tag the repository release branch with the version, e.g.:
|
||||
``git tag -u YOURKEYID php-5.4.2RC2``
|
||||
|
||||
10. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and ``NEWS``
|
||||
9. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and ``NEWS``
|
||||
in the *main* branch (PHP-5.4 for example) to prepare for the **next** version.
|
||||
F.e. if the RC is "5.4.1RC1" then the new one should be "5.4.2-dev" - regardless if we get
|
||||
a new RC or not. This is to make sure ``version_compare()`` can correctly work.
|
||||
Commit the changes to the main branch.
|
||||
|
||||
11. Push the changes to the main repo, the tag, the main branch and the release branch :
|
||||
10. Push the changes to the main repo, the tag, the main branch and the release branch :
|
||||
``git push --tags origin HEAD``
|
||||
``git push origin {main branch}``
|
||||
``git push origin {release branch}``
|
||||
|
||||
12. run: ``PHPROOT=. ./makedist 5.4.2RC2``, this will export the tree, create configure
|
||||
11. run: ``PHPROOT=. ./makedist 5.4.2RC2``, this will export the tree, create configure
|
||||
and build three tarballs (gz, bz2 and xz).
|
||||
|
||||
13. Copy those tarballs (scp, rsync) to downloads.php.net, in your homedir there should be a
|
||||
12. Copy those tarballs (scp, rsync) to downloads.php.net, in your homedir there should be a
|
||||
directory "downloads/". Copy them into there, so that the system can generate
|
||||
MD5 sums. If you do not have this directory, talk to Derick or Dan.
|
||||
|
||||
14. Now the RC can be found on http://downloads.php.net/yourname,
|
||||
13. Now the RC can be found on http://downloads.php.net/yourname,
|
||||
f.e. http://downloads.php.net/derick/
|
||||
|
||||
15. Once the release has been tagged, contact the PHP Windows development team
|
||||
14. Once the release has been tagged, contact the PHP Windows development team
|
||||
(internals-win@lists.php.net) so that Windows binaries can be created. Once
|
||||
those are made, they should be placed into the same directory as the source snapshots.
|
||||
|
||||
@@ -151,13 +139,12 @@ 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 committed to
|
||||
2. If a CVE commit needs to be merged to the release, then have it commited 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.
|
||||
|
||||
3. Commit those changes. Ensure the tests at https://travis-ci.org/php/php-src/builds are
|
||||
still passing.
|
||||
3. Commit those changes
|
||||
|
||||
4. run the "scripts/dev/credits" script in php-src and commit the changes in the
|
||||
credits files in ext/standard.
|
||||
@@ -167,7 +154,7 @@ credits files in ext/standard.
|
||||
|
||||
6. Check ./sapi/cli/php -v output for version matching.
|
||||
|
||||
7. tag the repository with the version f.e. "``git tag -u YOURKEYID -s php-5.4.1``"
|
||||
7. tag the repository with the version f.e. "``git tag -s php-5.4.1``"
|
||||
|
||||
8. Push the tag f.e. "``git push origin php-5.4.1``"
|
||||
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@ the original run-tests.php script. server-tests is *not* used by
|
||||
'make test'. server-tests was developed to provide support for
|
||||
testing PHP under it's primary environment, HTTP, and can run the
|
||||
PHP tests under any of the SAPI modules that are direct executables,
|
||||
or are accessible via HTTP.
|
||||
or are accessable via HTTP.
|
||||
|
||||
[New features]
|
||||
----------------
|
||||
@@ -95,7 +95,7 @@ include:
|
||||
$filename full native path to file, will become PATH_TRANSLATED
|
||||
$filepath =dirname($filename)
|
||||
$scriptname this is what will become SCRIPT_NAME unless you override it
|
||||
$docroot the equivalent of DOCUMENT_ROOT under Apache
|
||||
$docroot the equivelant of DOCUMENT_ROOT under Apache
|
||||
$cwd the directory that the test is being initiated from
|
||||
$this->conf all server-tests configuration vars
|
||||
$this->env all environment variables that will get passed to the test
|
||||
@@ -105,7 +105,7 @@ include:
|
||||
This section is also eval'd, and is similar in nature to --ENV--. However,
|
||||
this section is used to build the url used in an HTTP request. Valid values
|
||||
to set in this section would include:
|
||||
SCRIPT_NAME The initial part of the request url
|
||||
SCRIPT_NAME The inital part of the request url
|
||||
PATH_INFO The pathinfo part of a request url
|
||||
FRAGMENT The fragment section of a url (after #)
|
||||
QUERY_STRING The query part of a url (after ?)
|
||||
|
||||
Regular → Executable
File mode changed.
@@ -2,7 +2,7 @@
|
||||
#define TSRM_CONFIG_COMMON_H
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
# ifdef _WIN32
|
||||
# if WINNT|WIN32
|
||||
# define TSRM_WIN32
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -1,509 +1,80 @@
|
||||
$Id$
|
||||
|
||||
PHP 5.6 UPGRADE NOTES
|
||||
PHP X.Y UPGRADE NOTES
|
||||
|
||||
1. Backward Incompatible Changes
|
||||
2. New Features
|
||||
3. Changes in SAPI modules
|
||||
4. Deprecated Functionality
|
||||
5. Changed Functions
|
||||
6. New Functions
|
||||
7. New Classes and Interfaces
|
||||
8. Removed Extensions
|
||||
9. Other Changes to Extensions
|
||||
10. New Global Constants
|
||||
11. Changes to INI File Handling
|
||||
12. Other Changes
|
||||
2. Changes in SAPI modules
|
||||
3. Deprecated Functionality
|
||||
4. Changed Functions
|
||||
5. New Functions
|
||||
6. New Classes and Interfaces
|
||||
7. Removed Extensions
|
||||
8. Other Changes to Extensions
|
||||
9. New Global Constants
|
||||
10. Changes to INI File Handling
|
||||
11. Other Changes
|
||||
|
||||
|
||||
========================================
|
||||
1. Backward Incompatible Changes
|
||||
========================================
|
||||
|
||||
- Core:
|
||||
By fixing bug #66015 it is no longer possible to overwrite keys in static scalar
|
||||
arrays. Quick example to illustrate:
|
||||
class Test {
|
||||
const FIRST = 1;
|
||||
public $array = array(
|
||||
self::FIRST => 'first',
|
||||
'second',
|
||||
'third'
|
||||
);
|
||||
}
|
||||
Test::$array will have as expected three array keys (1, 2, 3) and no longer
|
||||
two (0, 1). self::FIRST will no longer overwrite 'third' having key 1 then,
|
||||
but will mark the beginning of indexing.
|
||||
|
||||
- JSON:
|
||||
json_decode() no longer accepts non-lowercase variants of lone JSON true,
|
||||
false or null values. For example, True or FALSE will now cause json_decode to
|
||||
return NULL and set an error value you can fetch with json_last_error().
|
||||
This affects JSON texts consisting solely of true, false or null. Text
|
||||
containing non-lowercase values inside JSON arrays or objects has never been
|
||||
accepted.
|
||||
|
||||
- OpenSSL:
|
||||
To prevent man-in-the-middle attacks against encrypted transfers client
|
||||
streams now verify peer certificates by default. Previous versions
|
||||
required users to manually enable peer verification. As a result of this
|
||||
change, existing code using ssl:// or tls:// stream wrappers (e.g.
|
||||
file_get_contents(), fsockopen(), stream_socket_client()) may no longer
|
||||
connect successfully without manually disabling peer verification via the
|
||||
stream context's "verify_peer" setting. Encrypted transfers delegate to
|
||||
operating system certificate stores by default if not overridden via the
|
||||
new openssl.cafile and openssl.cafile ini directives or via call-time SSL
|
||||
context options, so most users should be unaffected by this transparent
|
||||
security enhancement. (https://wiki.php.net/rfc/tls-peer-verification)
|
||||
|
||||
- Mcrypt:
|
||||
The mcrypt_encrypt(), mcrypt_decrypt() and mcrypt_{MODE}() functions no
|
||||
longer accept keys or IVs with incorrect sizes. Furthermore an IV is now
|
||||
required if the used block cipher mode requires it.
|
||||
- DBA
|
||||
. dba_delete() now returns false if the key was not found for the inifile
|
||||
handler, too.
|
||||
|
||||
========================================
|
||||
2. New Features
|
||||
========================================
|
||||
|
||||
- Added constant scalar expressions syntax.
|
||||
(https://wiki.php.net/rfc/const_scalar_exprs)
|
||||
|
||||
- Added dedicated syntax for variadic functions.
|
||||
(https://wiki.php.net/rfc/variadics)
|
||||
|
||||
- Added support for argument unpacking to complement the variadic syntax.
|
||||
(https://wiki.php.net/rfc/argument_unpacking)
|
||||
|
||||
- Added an exponentiation operator (**).
|
||||
(https://wiki.php.net/rfc/pow-operator)
|
||||
|
||||
- Added unified default encoding. default_charset=UTF-8 and functions/extensions
|
||||
use encoding settings honor default_charset.
|
||||
|
||||
- The php://input stream is now re-usable and can be used concurrently with
|
||||
enable_post_data_reading=0.
|
||||
|
||||
- Added use function and use const.
|
||||
(https://wiki.php.net/rfc/use_function)
|
||||
|
||||
- Added a function for timing attack safe string comparison
|
||||
(https://wiki.php.net/rfc/timing_attack)
|
||||
|
||||
- Added the __debugInfo() magic method to allow userland classes to implement
|
||||
the get_debug_info API previously available only to extensions.
|
||||
(https://wiki.php.net/rfc/debug-info)
|
||||
|
||||
- Added gost-crypto (CryptoPro S-box) hash algorithm.
|
||||
|
||||
- Stream wrappers verify peer certificates and host names by default in
|
||||
encrypted client streams.
|
||||
|
||||
- Added openssl certificate fingerprint support (inclusive stream context
|
||||
option).
|
||||
|
||||
- Added support for SAN x509 extension matching when verifing host names in
|
||||
encrypted streams.
|
||||
|
||||
- Added a range of new SSL context options for improved encrypted stream
|
||||
server security (https://wiki.php.net/rfc/improved-tls-defaults):
|
||||
|
||||
. "honor_cipher_order" allows servers to prioritize cipher suites of their
|
||||
choosing when negotiating SSL/TLS handshakes.
|
||||
. "single_ecdh_use" and "single_dh_use" allow for improved forward
|
||||
secrecy in encrypted stream servers.
|
||||
. "dh_param" allows specification of pre-generated key generation
|
||||
parameters when negotiating ephemeral DHE ciphers in stream servers.
|
||||
. "ecdh_curve" allows stream servers to specify which curve to use when
|
||||
negotiating ephemeral ECDHE ciphers (defaults to NIST P-256).
|
||||
. "rsa_key_size" SSL context option gives stream servers control
|
||||
over the key size (in bits) used when negotiating RSA ciphers.
|
||||
. "capture_session_meta" if specified stores an array of data describing
|
||||
the TLS session's protocol/cipher in the "session_meta" SSL context key.
|
||||
|
||||
- Added automatic mitigation against client-initated TLS renegotiation DoS
|
||||
attacks in encrypted server streams. Renegotiation limiting may be
|
||||
customized via three new SSL context options:
|
||||
|
||||
. "reneg_limit" (number of allowed renegotiations per time window)
|
||||
. "reneg_window" (renegotiation time window in seconds)
|
||||
. "reneg_limit_callback" (optional notification callback on limiting)
|
||||
|
||||
- Encrypted TLS servers now support the server name indication (SNI) TLS
|
||||
extension via the new "SNI_server_certs" SSL context option.
|
||||
|
||||
- Added "crypto_method" SSL context option for use in encrypted streams.
|
||||
|
||||
- Added "peer_name" SSL context option to better reflect peer certificate
|
||||
name matching using SAN extension (replaces deprecated "CN_match").
|
||||
|
||||
- Added stream wrapper support when specifying "cafile" SSL context paths.
|
||||
|
||||
- Independent peer cert and peer name validation is now available via a new
|
||||
boolean "verify_peer_name" SSL context option. This option is enabled by
|
||||
default in encrypted client streams.
|
||||
|
||||
- Added protocol-specific tlsv1.0://, tlsv1.1:// and tlsv1.2:// encryption
|
||||
stream wrappers. tls:// wrapper now supports TLSv1.1 and TLSv1.2 (previously
|
||||
only supported TLSv1).
|
||||
|
||||
- Stream crypto method specification now accepts flags instead of values
|
||||
allowing support for multiple discrete protocols in a given stream.
|
||||
|
||||
- PostgreSQL database connections may now be established asynchronously using
|
||||
new constants and polling functions in ext/pgsql.
|
||||
|
||||
- Non-blocking read/write query behavior now optionally available in database
|
||||
operations using the ext/pgsql extension.
|
||||
|
||||
========================================
|
||||
3. Changes in SAPI modules
|
||||
========================================
|
||||
|
||||
- Added phpdbg SAPI.
|
||||
(https://wiki.php.net/rfc/phpdbg)
|
||||
|
||||
- Support for FPM workers changing the apparmor profile through the pool configuration.
|
||||
(https://wiki.php.net/rfc/fpm_change_hat)
|
||||
|
||||
- Support for several XML MIME types in the built-in CLI server. For static
|
||||
files with extensions .xml, .xsl, .xsd the Content-Type header
|
||||
application/xml is now sent automatically.
|
||||
|
||||
========================================
|
||||
4. Deprecated Functionality
|
||||
========================================
|
||||
|
||||
- Incompatible context calls:
|
||||
Instance calls from an incompatible context are now deprecated and issue
|
||||
E_DEPRECATED instead of E_STRICT. See https://wiki.php.net/rfc/incompat_ctx
|
||||
|
||||
- The "CN_match" and "SNI_server_name" SSL context options are deprecated in
|
||||
favor of the new "peer_name" option. Name verification now checks certificate
|
||||
SAN names as well as the CN field and the specific name fields are deprecated
|
||||
to avoid confusion. Their use triggers E_DEPRECATED but continues to work as
|
||||
before. If specified, the specific values take precedence over the general
|
||||
"peer_name" value.
|
||||
|
||||
- Deprecated PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, an
|
||||
undocument constant effectively equivalent to PDO::ATTR_EMULATE_PREPARES.
|
||||
|
||||
- Deprecated INIs: Following INIs are deprecated in favour of new
|
||||
internal_encoding/input_encoding/output_encoding. Refer to "Changes to
|
||||
encodings in PHP 5.6" in "11. Other Changes" section for more details.
|
||||
|
||||
iconv.input_encoding
|
||||
iconv.output_encoding
|
||||
iconv.internal_encoding
|
||||
mbstring.http_input
|
||||
mbstring.http_output
|
||||
mbstring.internal_encoding
|
||||
|
||||
========================================
|
||||
5. Changed Functions
|
||||
========================================
|
||||
|
||||
- cURL:
|
||||
CURLOPT_SAFE_UPLOAD is now turned on by default and uploads with @file
|
||||
do not work unless it is explicitly set to false.
|
||||
|
||||
curl_setopt() now supports the following nullable settings (>= 5.5.11):
|
||||
. CURLOPT_CUSTOMREQUEST
|
||||
. CURLOPT_FTPPORT
|
||||
. CURLOPT_RANGE
|
||||
. CURLOPT_FTP_ACCOUNT
|
||||
. CURLOPT_RTSP_SESSION_ID
|
||||
. CURLOPT_KRBLEVEL
|
||||
. CURLOPT_KRB4LEVEL
|
||||
|
||||
- Strings:
|
||||
substr_compare() now allows $length to be zero.
|
||||
pack() and unpack() now support 64-bit format specifiers: q, Q, J and P.
|
||||
|
||||
- Crypt:
|
||||
crypt() will now raise an E_NOTICE error if the salt parameter is omitted.
|
||||
See: https://wiki.php.net/rfc/crypt_function_salt
|
||||
|
||||
- Mcrypt:
|
||||
The $source parameter of mcrypt_create_iv() now defaults to
|
||||
MCRYPT_DEV_URANDOM instead of MCRYPT_DEV_RANDOM.
|
||||
|
||||
- OpenSSL:
|
||||
The $crypto_type parameter is now optional in stream_socket_enable_crypto()
|
||||
if the stream's SSL context specifies the new "crypto_type" option. The
|
||||
crypto method from the context is used as a fallback if no crypto method is
|
||||
specified at call-time.
|
||||
|
||||
- Reflection:
|
||||
ReflectionClass::newInstanceWithoutConstructor previously didn't allow the
|
||||
instantiation of any internal class which used custom object storage
|
||||
(overriding the default create_object handler), this was changed to only
|
||||
reject the instantiation of such classes if the class is also marked as
|
||||
final.
|
||||
|
||||
- XMLReader:
|
||||
XMLReader::getAttributeNs and XMLReader::getAttributeNo now return NULL if
|
||||
the attribute could not be found, just like XMLReader::getAttribute.
|
||||
|
||||
- Pgsql:
|
||||
pg_insert()/pg_select()/pg_update()/pg_delete() are no longer EXPERIMENTAL.
|
||||
The following functions no longer block until query write completion if the
|
||||
socket stream underlying a database connection is set to non-blocking mode:
|
||||
. pg_send_execute()
|
||||
. pg_send_prepare()
|
||||
. pg_send_query()
|
||||
. pg_send_query_params()
|
||||
|
||||
- unserialize:
|
||||
Manipulated serialization strings for objects implementing Serializable by
|
||||
replacing "C:" with "O:" at the start will now produce an error.
|
||||
|
||||
- parse_ini_file():
|
||||
- parse_ini_string():
|
||||
Added scanner mode INI_SCANNER_TYPED to yield typed .ini values.
|
||||
For PHP >= 5.6.1
|
||||
|
||||
========================================
|
||||
6. New Functions
|
||||
========================================
|
||||
|
||||
- Datetime:
|
||||
Added DatePeriod::getStartDate(), DatePeriod::getEndDate(), DatePeriod::getDateInterval() in 5.6.5.
|
||||
|
||||
- GMP:
|
||||
Added gmp_root($a, $nth) and gmp_rootrem($a, $nth) for calculating nth roots.
|
||||
Added gmp_import($data, $word_size = 1, $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN) in PHP 5.6.1.
|
||||
Added gmp_export($gmpnumber, $word_size = 1, $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN) in PHP 5.6.1.
|
||||
Added gmp_random_range() and gmp_random_bits() in PHP 5.6.3.
|
||||
|
||||
- Hash
|
||||
Added hash_equals($known_string, $user_string)
|
||||
|
||||
- OpenSSL:
|
||||
Added string openssl_x509_fingerprint($x509, $type, $binary).
|
||||
Added string openssl_spki_new($private_key, $challenge, $algorithm)
|
||||
Added bool openssl_spki_verify($spkac)
|
||||
Added string openssl_spki_export($spkac)
|
||||
Added string openssl_spki_export_challenge($spkac)
|
||||
Added array openssl_get_cert_locations()
|
||||
|
||||
- LDAP:
|
||||
Added ldap_escape($value, $ignore = "", $flags = 0).
|
||||
Added ldap_modify_batch($link_identifier, $dn, $modifications) described in
|
||||
https://wiki.php.net/rfc/ldap_modify_batch.
|
||||
|
||||
- Pgsql:
|
||||
Added pg_socket($connection) to allow async connections and non-blocking IO
|
||||
Added pg_connect_poll($connection) for establishing async connections
|
||||
Added pg_consume_input($connection) for non-blocking query result consumption
|
||||
Added pg_flush($connection) for non-blocking query write completion
|
||||
|
||||
- PDO_pgsql
|
||||
Added PDO::pgsqlGetNotify($result_type = PDO::FETCH_USE_DEFAULT, $ms_timeout = 0)
|
||||
Added PDO::pgsqlGetPid()
|
||||
|
||||
- Reflection
|
||||
Added ReflectionFunction::isVariadic() and ReflectionParameter::isVariadic().
|
||||
|
||||
- SPL
|
||||
Added SplFileObject::fread($length) to complement fwrite() method (>= 5.5.11)
|
||||
|
||||
- Zip:
|
||||
Added ZipArchive::setPassword($password)
|
||||
|
||||
========================================
|
||||
7. New Classes and Interfaces
|
||||
2. Changes in SAPI modules
|
||||
========================================
|
||||
|
||||
|
||||
========================================
|
||||
8. Removed Extensions
|
||||
3. Deprecated Functionality
|
||||
========================================
|
||||
|
||||
|
||||
========================================
|
||||
9. Other Changes to Extensions
|
||||
4. Changed Functions
|
||||
========================================
|
||||
|
||||
- cURL:
|
||||
- The following constants have been removed as they are now marked "obsolete"
|
||||
in the underlying library and never had any effect to begin with:
|
||||
. CURLOPT_CLOSEPOLICY
|
||||
. CURLCLOSEPOLICY_CALLBACK
|
||||
. CURLCLOSEPOLICY_LEAST_RECENTLY_USED
|
||||
. CURLCLOSEPOLICY_LEAST_TRAFFIC
|
||||
. CURLCLOSEPOLICY_OLDEST
|
||||
. CURLCLOSEPOLICY_SLOWEST
|
||||
|
||||
- GMP:
|
||||
The GMP extension now uses objects as the underlying data structure, rather
|
||||
than resources. GMP instances now support dumping, serialization, cloning,
|
||||
casts to primitive types and have overloaded operators.
|
||||
(RFC: https://wiki.php.net/rfc/operator_overloading_gmp)
|
||||
|
||||
- OCI8:
|
||||
- Added Implicit Result Set support for Oracle Database 12c with a
|
||||
new oci_get_implicit_resultset() function.
|
||||
- Using 'oci_execute($s, OCI_NO_AUTO_COMMIT)' for a SELECT no longer
|
||||
unnecessarily initiates an internal ROLLBACK during connection
|
||||
close.
|
||||
- Multi-row OCI_RETURN_LOB queries require fewer "round trips" to the database.
|
||||
- Added DTrace probes enabled with PHP's generic --enable-dtrace
|
||||
- The oci_internal_debug() function is now a no-op.
|
||||
- The phpinfo() output format for OCI8 has changed.
|
||||
|
||||
- OpenSSL:
|
||||
- The "SNI_enabled" SSL stream context option is now set to TRUE by default
|
||||
if supported by the underlying openssl library.
|
||||
|
||||
- PCRE:
|
||||
- The information collected by the (*MARK) backtracking control verb is now
|
||||
collected into the "MARK" index of the $matches array for preg_match(),
|
||||
preg_match_all() and preg_replace_callback().
|
||||
|
||||
- Pgsql:
|
||||
- pg_insert()/pg_select()/pg_update()/pg_delete()/pg_meta_data()/pg_convert()
|
||||
are no longer EXPERIMENTAL
|
||||
- Added PGSQL_DML_ESCAPE option for pg_insert()/pg_select()/pg_update()/pg_delete()
|
||||
that simply escapes all supplied parameters. These functions can be as fast as
|
||||
native query. Unvalidated data(Unknown data types) is passed as string.
|
||||
JSON/Array/etc are supported both PGSQL_DML_ESCAPE and pg_convert() as string.
|
||||
- pg_select() returns PostgreSQL query resource when query is executed.
|
||||
- Added extended flag parameter for pg_meta_data(). pg_meta_data() always
|
||||
returns "is enum" attribute.
|
||||
- The new pg_socket() function returns a socket stream with no behavior other
|
||||
than to allow IO-readiness polling on a DB connection socket. Calling
|
||||
stream_set_blocking() on its result enables non-blocking behavior.
|
||||
- Passing the new PGSQL_CONNECT_ASYNC flag to pg_connect() allows applications
|
||||
to poll for IO readiness via pg_connect_poll() and establish connections
|
||||
asynchronously.
|
||||
|
||||
- PDO_pgsql:
|
||||
- Added PDO::PGSQL_ATTR_DISABLE_PREPARES constant to execute the queries
|
||||
without preparing them, while still passing parameters separately from
|
||||
the command text using PQexecParams.
|
||||
- Added LISTEN/NOTIFY support via PDO::pgsqlGetNotify / PDO::pgsqlGetPid()
|
||||
as described in https://bugs.php.net/bug.php?id=42614.
|
||||
|
||||
- DOM:
|
||||
- DOMNode::textContent is now a writeable property. (>= 5.6.1)
|
||||
|
||||
========================================
|
||||
10. New Global Constants
|
||||
5. New Functions
|
||||
========================================
|
||||
|
||||
- LDAP:
|
||||
LDAP_ESCAPE_FILTER int(1)
|
||||
LDAP_ESCAPE_DN int(2)
|
||||
|
||||
- Pgsql:
|
||||
PGSQL_DML_ESCAPE int(4096)
|
||||
PGSQL_CONNECT_ASYNC
|
||||
PGSQL_CONNECTION_STARTED
|
||||
PGSQL_CONNECTION_MADE
|
||||
PGSQL_CONNECTION_AWAITING_RESPONSE
|
||||
PGSQL_CONNECTION_AUTH_OK
|
||||
PGSQL_CONNECTION_SSL_STARTUP
|
||||
PGSQL_CONNECTION_SETENV
|
||||
PGSQL_POLLING_FAILED
|
||||
PGSQL_POLLING_READING
|
||||
PGSQL_POLLING_WRITING
|
||||
PGSQL_POLLING_OK
|
||||
PGSQL_POLLING_ACTIVE
|
||||
|
||||
- OpenSSL:
|
||||
STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT int(9)
|
||||
STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT int(17)
|
||||
STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT int(33)
|
||||
STREAM_CRYPTO_METHOD_ANY_CLIENT int(63)
|
||||
STREAM_CRYPTO_METHOD_TLSv1_0_SERVER int(8)
|
||||
STREAM_CRYPTO_METHOD_TLSv1_1_SERVER int(16)
|
||||
STREAM_CRYPTO_METHOD_TLSv1_2_SERVER int(32)
|
||||
STREAM_CRYPTO_METHOD_ANY_SERVER int(62)
|
||||
OPENSSL_DEFAULT_STREAM_CIPHERS string
|
||||
|
||||
========================================
|
||||
11. Changes to INI File Handling
|
||||
6. New Classes and Interfaces
|
||||
========================================
|
||||
|
||||
- Core:
|
||||
Changed always_populate_raw_post_data to throw a deprecation warning when
|
||||
enabled and to recognize the value -1 for never populating the global
|
||||
$HTTP_RAW_POST_DATA variable, which will be default in future PHP versions.
|
||||
|
||||
default_charset is set to UTF-8. It was empty previously. default_charset
|
||||
is used where it is applicable. Iconv/Mbstring/htmlentities/htmlspecialchars/
|
||||
html_entity_decode use default_charset as default encoding.
|
||||
|
||||
internal_encoding/input_encoding/output_encoding is added for encoding
|
||||
handling modules. Refer to "Changes to encodings in PHP 5.6" in "11. Other Changes"
|
||||
section for more details.
|
||||
|
||||
- cURL:
|
||||
If the new openssl.cafile ini directive is specified ext/curl will give the
|
||||
openssl path precedence over its own curl.cainfo directive.
|
||||
|
||||
- OpenSSL:
|
||||
openssl.cafile and openssl.capath ini directives have been added to allow
|
||||
global CA default specification as necessary.
|
||||
|
||||
========================================
|
||||
12. Other Changes
|
||||
7. Removed Extensions
|
||||
========================================
|
||||
|
||||
- File upload:
|
||||
Uploads equal or greater than 2GB in size are now accepted.
|
||||
|
||||
- HTTP stream wrapper:
|
||||
HTTP 1.1 requests now include a Connection: close header unless explicitly
|
||||
overridden by setting a Connection header via the header context option.
|
||||
========================================
|
||||
8. Other Changes to Extensions
|
||||
========================================
|
||||
|
||||
- PDO_pgsql
|
||||
A libpq version providing PQexecParams, PQprepare, PQescapeStringConn,
|
||||
PQescapeByteaConn is now required. According to the release notes that means
|
||||
8.0.8+ or 8.1.4+.
|
||||
|
||||
- Zip:
|
||||
New --with-libzip option allow to use system libzip. Version > 0.11 required,
|
||||
Version >= 0.11.2 recommended for all features.
|
||||
========================================
|
||||
9. New Global Constants
|
||||
========================================
|
||||
|
||||
- Changes to encodings in PHP 5.6
|
||||
The default value of default_charset is now UTF-8 when it is not
|
||||
explicitly set in php.ini
|
||||
|
||||
The following php.ini parameters were added:
|
||||
internal_encoding
|
||||
input_encoding
|
||||
output_encoding
|
||||
========================================
|
||||
10. Changes to INI File Handling
|
||||
========================================
|
||||
|
||||
The values of the following php.ini parameters have become empty in
|
||||
PHP 5.6 (previously they were all ISO-8859-1)
|
||||
|
||||
iconv.input_encoding
|
||||
iconv.output_encoding
|
||||
iconv.internal_encoding
|
||||
|
||||
Changes were made to character set handling in:
|
||||
- the iconv and mbstring extensions,
|
||||
- and htmlentities(), htmlspecialchars(), html_entity_decode() functions
|
||||
|
||||
The precedence for these is now:
|
||||
|
||||
default_charset < internal/input/output_encoding < (mbstring.* || iconv.*) < function parameter
|
||||
|
||||
For example, the easiest way to use the UTF-8 encoding is to set
|
||||
default_charset=UTF-8 and leave the following php.ini parameters
|
||||
|
||||
empty:
|
||||
|
||||
iconv.input_encoding
|
||||
iconv.output_encoding
|
||||
iconv.internal_encoding
|
||||
mbstring.http_input
|
||||
mbstring.http_output
|
||||
mbstring.internal_encoding
|
||||
internal_encoding
|
||||
input_encoding
|
||||
output_encoding
|
||||
|
||||
The mb_regex_encoding() default setting is changed from EUC-JP to UTF-8.
|
||||
========================================
|
||||
11. Other Changes
|
||||
========================================
|
||||
|
||||
+3
-201
@@ -1,19 +1,12 @@
|
||||
$Id$
|
||||
|
||||
PHP 5.6 INTERNALS UPGRADE NOTES
|
||||
UPGRADE NOTES - PHP X.Y
|
||||
|
||||
1. Internal API changes
|
||||
a. Addition of do_operation and compare object handlers
|
||||
b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros
|
||||
c. POST data handling
|
||||
d. Arginfo changes
|
||||
e. tsrm_virtual_cwd.h moved to zend_virtual_cwd.h
|
||||
f. empty strings are interned
|
||||
g. Additional str_* APIs
|
||||
h. Addition of zend_hash_reindex
|
||||
i. Addition of zend_hash_splice
|
||||
j. Unserialization of manipulated object strings
|
||||
k. Removal of IS_CONSTANT_ARRAY and IS_CONSTANT_INDEX hack
|
||||
|
||||
2. Build system changes
|
||||
a. Unix build system changes
|
||||
@@ -24,202 +17,11 @@ PHP 5.6 INTERNALS UPGRADE NOTES
|
||||
1. Internal API changes
|
||||
========================
|
||||
|
||||
a. Addition of do_operation and compare object handlers
|
||||
a. zend_set_memory_limit() now takes the TSRMLS_CC macro as its last argument
|
||||
|
||||
Two new object handlers have been added:
|
||||
|
||||
do_operation:
|
||||
typedef int (*zend_object_do_operation_t)(
|
||||
zend_uchar opcode, zval *result, zval *op1, zval *op2 TSRMLS_DC
|
||||
);
|
||||
|
||||
compare:
|
||||
typedef int (*zend_object_compare_zvals_t)(
|
||||
zval *result, zval *op1, zval *op2 TSRMLS_DC
|
||||
);
|
||||
|
||||
The first handler is used to overload arithmetic operations. The first
|
||||
argument specifies the opcode of the operator, result is the target zval,
|
||||
op1 the first operand and op2 the second operand. For unary operations
|
||||
op2 is NULL. If the handler returns FAILURE PHP falls back to the default
|
||||
behavior for the operation.
|
||||
|
||||
The second handler is used to perform comparison operations with
|
||||
non-objects. The value written into result must be an IS_LONG with value
|
||||
-1 (smaller), 0 (equal) or 1 (greater). The return value is a SUCCESS/FAILURE
|
||||
return code. The difference between this handler and compare_objects is
|
||||
that it will be triggered for comparisons with non-objects and objects of
|
||||
different types. It takes precedence over compare_objects.
|
||||
|
||||
Further docs in the RFC: https://wiki.php.net/rfc/operator_overloading_gmp
|
||||
|
||||
b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros
|
||||
|
||||
The return_value_ptr argument to internal functions is now always set.
|
||||
Previously it was only available for functions returning by-reference.
|
||||
return_value_ptr can now be used to return zvals without copying them.
|
||||
For this purpose two new macros are provided:
|
||||
|
||||
RETVAL_ZVAL_FAST(zv); /* analog to RETVAL_ZVAL(zv, 1, 0) */
|
||||
RETURN_ZVAL_FAST(zv); /* analog to RETURN_ZVAL(zv, 1, 0) */
|
||||
|
||||
The macros behave similarly to the non-FAST variants with copy=1 and
|
||||
dtor=0, but will try to return the zval without making a copy by utilizing
|
||||
return_value_ptr.
|
||||
|
||||
c. POST data handling
|
||||
|
||||
The sapi_request_info's members post_data, post_data_len and raw_post_data as
|
||||
well as raw_post_data_len have been replaced with a temp PHP stream
|
||||
request_body.
|
||||
|
||||
The recommended way to access raw POST data is to open and use a php://input
|
||||
stream wrapper. It is safe to be used concurrently and more than once.
|
||||
|
||||
d. Arginfo changes
|
||||
|
||||
The pass_rest_by_reference argument of the ZEND_BEGIN_ARG_INFO and
|
||||
ZEND_BEGIN_ARG_INFO_EX() is no longer used. The value passed to it is ignored.
|
||||
|
||||
Instead a variadic argument is created using ZEND_ARG_VARIADIC_INFO():
|
||||
|
||||
ZEND_ARG_VARIADIC_INFO(0, name) /* pass rest by value */
|
||||
ZEND_ARG_VARIADIC_INFO(1, name) /* pass rest by reference */
|
||||
ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, name)
|
||||
/* pass rest by prefer-ref */
|
||||
|
||||
ZEND_ARG_VARIADIC_INFO() should only be used for the last argument.
|
||||
|
||||
The following changes were applied to the zend_arg_info struct:
|
||||
|
||||
typedef struct _zend_arg_info {
|
||||
const char *class_name;
|
||||
zend_uint class_name_len;
|
||||
zend_uchar type_hint;
|
||||
+ zend_uchar pass_by_reference;
|
||||
zend_bool allow_null;
|
||||
- zend_bool pass_by_reference;
|
||||
+ zend_bool is_variadic;
|
||||
} zend_arg_info;
|
||||
|
||||
The following changes were applied to the zend_internal_function_info struct:
|
||||
|
||||
typedef struct _zend_internal_function_info {
|
||||
zend_uint required_num_args;
|
||||
zend_uchar _type_hint;
|
||||
zend_bool return_reference;
|
||||
- zend_bool pass_rest_by_reference;
|
||||
+ zend_bool _allow_null;
|
||||
+ zend_bool _is_variadic;
|
||||
} zend_internal_function_info;
|
||||
|
||||
The CHECK_ARG_SEND_TYPE(), ARG_MUST_BE_SENT_BY_REF(),
|
||||
ARG_SHOULD_BE_SENT_BY_REF() and ARG_MAY_BE_SENT_BY_REF() macros now assume
|
||||
that the argument passed to them is a zend_function* and that it is non-NULL.
|
||||
|
||||
e. tsrm_virtual_cwd.h moved to zend_virtual_cwd.h
|
||||
|
||||
Memory allocation is now managed by emalloc/efree instead of malloc/free.
|
||||
|
||||
f. empty strings are interned
|
||||
|
||||
String created using STR_EMPTY_ALLOC() are now interned.
|
||||
convert_to_string use STR_EMPTY_ALLOC() for zval when IS_NULL.
|
||||
str_efree() shoud be preferred as efree() on such strings can cause memory
|
||||
corruption.
|
||||
|
||||
g. Additional str_* APIs
|
||||
|
||||
In addition to the previously existing str_free() and str_efree() macros, the
|
||||
following macros have been introduced to simplify dealing with potentially
|
||||
interned strings:
|
||||
|
||||
str_efree_rel(str) - efree_rel() if not interned
|
||||
str_erealloc(str, new_len) - erealloc() or emalloc+memcpy if interned
|
||||
str_estrndup(str, len) - estrndup() if not interned
|
||||
str_strndup(str, len) - zend_strndup() if not interned
|
||||
str_hash(str, len) - INTERNED_HASH(str) if interned,
|
||||
zend_hash_func(str, len+1) otherwise
|
||||
|
||||
h. Addition of zend_hash_reindex
|
||||
|
||||
A zend_hash_reindex() function with the following prototype has been added:
|
||||
|
||||
void zend_hash_reindex(HashTable *ht, zend_bool only_integer_keys);
|
||||
|
||||
If only_integer_keys==0, this function will change all keys to be continuous,
|
||||
zero-based integers in hash order. If only_integer_keys==1 the same will be
|
||||
done only for keys that were already integers previously, while leaving
|
||||
string keys alone.
|
||||
|
||||
i. Addition of zend_hash_splice
|
||||
|
||||
A zend_hash_splice() macro with the following prototype has been added:
|
||||
|
||||
void zend_hash_splice(
|
||||
HashTable *ht, uint nDataSize, copy_ctor_func_t pCopyConstructor,
|
||||
uint offset, uint length,
|
||||
void **list, uint list_count, HashTable *removed
|
||||
);
|
||||
|
||||
This function performs an in-place splice operation on a hashtable:
|
||||
|
||||
The elements between offset and offset+length are removed and the elements in
|
||||
list[list_count] are inserted in their place. The removed elements can be
|
||||
optionally collected into a hashtable.
|
||||
|
||||
This operation reindexes the hashtable, i.e. integer keys will be zero-based
|
||||
and sequential, while string keys stay intact. The same applies to the
|
||||
elements inserted into the removed HT.
|
||||
|
||||
As a side-effect of this addition the signature of the php_splice() function
|
||||
changed:
|
||||
|
||||
void php_splice(
|
||||
HashTable *ht, zend_uint offset, zend_uint length,
|
||||
zval ***list, zend_uint list_count, HashTable *removed TSRMLS_DC
|
||||
)
|
||||
|
||||
This function now directly forwards to zend_hash_splice(), resets the
|
||||
IAP of ht (for compatibility with the previous implementation) and resets
|
||||
CVs if the passed hashtable is the global symbol table.
|
||||
|
||||
j. Unserialization of manipulated object strings
|
||||
|
||||
Strings requiring unserialization of objects are now explicitly checked
|
||||
whether the object they contain implements the Serializable interface.
|
||||
This solves the situation where manipulated strings could be passed for
|
||||
objects using Serializable to disallow serialization. An object
|
||||
implementing Serializable will always start with "C:" in the serialized
|
||||
string, all other objects are represented with starting "O:". Objects
|
||||
implementing Serializable to disable serialization using
|
||||
zend_class_unserialize_deny and zend_class_serialize_deny, when
|
||||
instantiated from the serializer with a manipulated "O:" string at the
|
||||
start, will most likely be defectively initialized. This is now
|
||||
fixed at the appropriate place by checking for the presence of the
|
||||
serialize callback in the class entry.
|
||||
|
||||
k. Removal of IS_CONSTANT_ARRAY and IS_CONSTANT_INDEX hack
|
||||
|
||||
These two #defines disappeared. Instead we have now IS_CONSTANT_AST which
|
||||
covers also the functionality IS_CONSTANT_ARRAY bid and furthermore the
|
||||
hack for marking zvals as constant index with IS_CONSTANT_INDEX is now
|
||||
superfluous and so removed.
|
||||
Please note that IS_CONSTANT_AST now has the same value than
|
||||
IS_CONSTANT_ARRAY had.
|
||||
|
||||
========================
|
||||
2. Build system changes
|
||||
========================
|
||||
|
||||
a. Unix build system changes
|
||||
- The bison version check is now a blacklist instead of a whitelist.
|
||||
- The bison binary can be specified through the YACC environment/configure
|
||||
variable. Previously `bison` was assumed to be in $PATH.
|
||||
|
||||
b. Windows build system changes
|
||||
- The configure option --enable-static-analyze isn't available anymore.
|
||||
The new option was introduced --with-analyzer.
|
||||
- It is possible to disable PGO for single extensions, to do that
|
||||
define a global variable PHP_MYMODULE_PGO evaluating to false
|
||||
inside config.w32
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
Bug #67468 (Segfault in highlight_file()/highlight_string())
|
||||
--SKIPIF--
|
||||
<?php if(!function_exists("leak")) print "skip only for debug builds"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
highlight_string("<?php __CLASS__;", true);
|
||||
echo "done";
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
||||
@@ -30,12 +30,12 @@ test(...getArray([1, 2, 3]));
|
||||
test(...arrayGen([]));
|
||||
test(...arrayGen([1, 2, 3]));
|
||||
|
||||
test(1, ...[2, 3], ...[4, 5]);
|
||||
test(1, ...getArray([2, 3]), ...arrayGen([4, 5]));
|
||||
test(1, ...[2, 3], ...[4, 5], 6);
|
||||
test(1, ...getArray([2, 3]), ...arrayGen([4, 5]), 6);
|
||||
|
||||
test2(...[1, 2]);
|
||||
test2(...[1, 2, 3]);
|
||||
test2(...[1], ...[], ...[], ...[2, 3], ...[4, 5]);
|
||||
test2(...[1], ...[], ...[], ...[2, 3], 4, ...[5, 6]);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
@@ -75,7 +75,7 @@ array(3) {
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
array(5) {
|
||||
array(6) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
@@ -86,8 +86,10 @@ array(5) {
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
[5]=>
|
||||
int(6)
|
||||
}
|
||||
array(5) {
|
||||
array(6) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
@@ -98,6 +100,8 @@ array(5) {
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
[5]=>
|
||||
int(6)
|
||||
}
|
||||
int(1)
|
||||
int(2)
|
||||
|
||||
@@ -17,37 +17,46 @@ $array = [1, 2, 3];
|
||||
test1(...$array);
|
||||
var_dump($array);
|
||||
|
||||
$array1 = [1, 2]; $array2 = [3, 4];
|
||||
test1(...$array1, ...$array2);
|
||||
var_dump($array1, $array2);
|
||||
$array1 = [1, 2]; $val2 = 3; $array2 = [4, 5];
|
||||
test1(...$array1, $val2, ...$array2);
|
||||
var_dump($array1, $val2, $array2);
|
||||
|
||||
function test2($val1, &$ref1, $val2, &$ref2) {
|
||||
$ref1++;
|
||||
$ref2++;
|
||||
}
|
||||
|
||||
$array = [0, 0, 0, 0];
|
||||
$array = [1, 2, 3, 4];
|
||||
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];
|
||||
|
||||
test2($a, ...$array);
|
||||
var_dump($a, $array);
|
||||
$array = [];
|
||||
test2(...$array, $a, $b, $c, $d);
|
||||
var_dump($array, $a, $b, $c, $d);
|
||||
|
||||
test2($a, $b, ...$array);
|
||||
var_dump($a, $b, $array);
|
||||
$array = [1];
|
||||
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];
|
||||
test2(...$array, $a, $b, $c, $d);
|
||||
var_dump($array, $a, $b, $c, $d);
|
||||
|
||||
test2($a, $b, $c, $d, ...$array);
|
||||
var_dump($a, $b, $c, $d, $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);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
@@ -65,81 +74,76 @@ array(2) {
|
||||
[1]=>
|
||||
int(3)
|
||||
}
|
||||
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)
|
||||
}
|
||||
int(4)
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(5)
|
||||
[1]=>
|
||||
int(6)
|
||||
}
|
||||
int(0)
|
||||
array(4) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(0)
|
||||
int(3)
|
||||
[2]=>
|
||||
int(1)
|
||||
int(3)
|
||||
[3]=>
|
||||
int(0)
|
||||
int(5)
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
int(0)
|
||||
int(1)
|
||||
array(4) {
|
||||
int(0)
|
||||
int(1)
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(1)
|
||||
[2]=>
|
||||
int(1)
|
||||
[3]=>
|
||||
int(0)
|
||||
int(3)
|
||||
}
|
||||
int(0)
|
||||
int(1)
|
||||
int(2)
|
||||
int(0)
|
||||
array(4) {
|
||||
[0]=>
|
||||
int(2)
|
||||
[1]=>
|
||||
int(1)
|
||||
[2]=>
|
||||
int(1)
|
||||
[3]=>
|
||||
int(0)
|
||||
}
|
||||
int(0)
|
||||
int(3)
|
||||
int(0)
|
||||
int(1)
|
||||
array(4) {
|
||||
int(1)
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(2)
|
||||
int(1)
|
||||
[1]=>
|
||||
int(1)
|
||||
int(3)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
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(1)
|
||||
[3]=>
|
||||
int(0)
|
||||
["d"]=>
|
||||
int(1)
|
||||
}
|
||||
|
||||
Notice: Undefined index: b in %s on line %d
|
||||
|
||||
Notice: Undefined index: d in %s on line %d
|
||||
array(2) {
|
||||
["a"]=>
|
||||
int(1)
|
||||
["c"]=>
|
||||
int(1)
|
||||
}
|
||||
@@ -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, 3, ...new StdClass, ...3.14, ...[4, 5]);
|
||||
test(1, 2, ...new StdClass, 3, ...3.14, ...[4, 5]);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
@@ -14,7 +14,8 @@ class Foo {
|
||||
}
|
||||
|
||||
$foo = new Foo;
|
||||
Foo::test2(1, 2, ...[3, 4], ...[], ...[5]);
|
||||
$foo->test(...[1, 2], 3, 4, ...[], 5);
|
||||
Foo::test2(1, 2, ...[3, 4], ...[], 5);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
@@ -30,3 +31,15 @@ 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]);
|
||||
new Foo(...[1], 2, ...[], ...[3, 4], 5);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
@@ -25,11 +25,15 @@ array(3) {
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
array(3) {
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--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,6 +13,8 @@ function gen($array) {
|
||||
}
|
||||
}
|
||||
|
||||
test(...gen([1, 2, 3]), $a);
|
||||
var_dump($a);
|
||||
test(1, 2, 3, $b, ...gen([4, 5, 6]));
|
||||
var_dump($b);
|
||||
|
||||
@@ -23,6 +25,7 @@ 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
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
Bug #65419 (Inside trait, self::class != __CLASS__)
|
||||
--FILE--
|
||||
<?php
|
||||
trait abc
|
||||
{
|
||||
static function def()
|
||||
{
|
||||
echo self::class, "\n";
|
||||
echo __CLASS__, "\n";
|
||||
}
|
||||
}
|
||||
|
||||
class ghi
|
||||
{
|
||||
use abc;
|
||||
}
|
||||
|
||||
ghi::def();
|
||||
?>
|
||||
--EXPECTF--
|
||||
ghi
|
||||
ghi
|
||||
@@ -1,30 +0,0 @@
|
||||
--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',
|
||||
)
|
||||
@@ -1,73 +0,0 @@
|
||||
--TEST--
|
||||
Bug #66608 (Incorrect behavior with nested "finally" blocks)
|
||||
--FILE--
|
||||
<?php
|
||||
function bar() {
|
||||
try {
|
||||
echo "1\n";
|
||||
try {
|
||||
} finally {
|
||||
try {
|
||||
} finally {
|
||||
}
|
||||
echo "2\n";
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
throw new Exception ("");
|
||||
} catch (Exception $ab) {
|
||||
echo "3\n";
|
||||
} finally {
|
||||
try {
|
||||
} finally {
|
||||
echo "4\n";
|
||||
try {
|
||||
} finally {
|
||||
}
|
||||
echo "5\n";
|
||||
}
|
||||
}
|
||||
echo "6\n";
|
||||
try {
|
||||
} finally {
|
||||
while (1) {
|
||||
try {
|
||||
echo "7\n";
|
||||
break;
|
||||
} finally {
|
||||
echo "8\n";
|
||||
}
|
||||
echo "bad";
|
||||
}
|
||||
echo "9\n";
|
||||
while (1) {
|
||||
try {
|
||||
throw new Exception("");
|
||||
} catch(Exception $e) {
|
||||
echo "10\n";
|
||||
break;
|
||||
} finally {
|
||||
echo "11\n";
|
||||
}
|
||||
echo "bak\n";
|
||||
}
|
||||
}
|
||||
echo "12\n";
|
||||
}
|
||||
echo "13\n";
|
||||
}
|
||||
bar();
|
||||
--EXPECT--
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
@@ -1,13 +0,0 @@
|
||||
--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__ ?>
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Bug #67111: Memory leak when using "continue 2" inside two foreach loops
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$array1 = [1, 2, 3];
|
||||
$array2 = [1, 2, 3];
|
||||
|
||||
foreach ($array1 as $x) {
|
||||
foreach ($array2 as $y) {
|
||||
echo "$x.$y\n";
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
1.1
|
||||
2.1
|
||||
3.1
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Bug #67169: array_splice all elements, then []= gives wrong index
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$array = array('a', 'b');
|
||||
array_splice($array, 0, 2);
|
||||
$array[] = 'c';
|
||||
var_dump($array);
|
||||
|
||||
$array = array('a', 'b');
|
||||
array_shift($array);
|
||||
array_shift($array);
|
||||
$array[] = 'c';
|
||||
var_dump($array);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(1) "c"
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(1) "c"
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
Bug #67368 (Memory leak with immediately dereferenced array in class constant)
|
||||
--INI--
|
||||
report_memleaks=1
|
||||
--FILE--
|
||||
<?php
|
||||
class FooBar {
|
||||
const bar = ["bar" => 3]["bar"];
|
||||
}
|
||||
echo "okey";
|
||||
--EXPECTF--
|
||||
okey
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
class a {
|
||||
public function test($arg = c::TESTCONSTANT) {
|
||||
echo __METHOD__ . "($arg)\n";
|
||||
}
|
||||
|
||||
static public function staticTest() {
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
class b extends a {
|
||||
public function test() {
|
||||
echo __METHOD__ . "()\n";
|
||||
parent::test();
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
bug67436: Autoloader isn't called if user defined error handler is present
|
||||
|
||||
--INI--
|
||||
error_reporting=
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
spl_autoload_register(function($classname) {
|
||||
if (in_array($classname, array('a','b','c'))) {
|
||||
require_once ($classname . '.php');
|
||||
}
|
||||
});
|
||||
|
||||
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
|
||||
}, error_reporting());
|
||||
|
||||
a::staticTest();
|
||||
|
||||
$b = new b();
|
||||
$b->test();
|
||||
|
||||
--EXPECT--
|
||||
b::test()
|
||||
a::test(c::TESTCONSTANT)
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
bug67436: E_STRICT instead of custom error handler
|
||||
|
||||
--INI--
|
||||
error_reporting=-1
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
spl_autoload_register(function($classname) {
|
||||
if (in_array($classname, array('a','b','c'))) {
|
||||
require_once ($classname . '.php');
|
||||
}
|
||||
});
|
||||
|
||||
a::staticTest();
|
||||
|
||||
$b = new b();
|
||||
$b->test();
|
||||
|
||||
--EXPECTF--
|
||||
Strict Standards: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s%ebug67436%eb.php on line %d
|
||||
b::test()
|
||||
a::test(c::TESTCONSTANT)
|
||||
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class c {
|
||||
const TESTCONSTANT = "c::TESTCONSTANT";
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
--TEST--
|
||||
Bug #67633: A foreach on an array returned from a function not doing copy-on-write
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function id($x) {
|
||||
return $x;
|
||||
}
|
||||
|
||||
function &ref_id(&$x) {
|
||||
return $x;
|
||||
}
|
||||
|
||||
$c = 'c';
|
||||
$array = ['a', 'b', $c];
|
||||
|
||||
foreach(id($array) as &$v) {
|
||||
$v .= 'q';
|
||||
}
|
||||
var_dump($array);
|
||||
|
||||
foreach(ref_id($array) as &$v) {
|
||||
$v .= 'q';
|
||||
}
|
||||
var_dump($array);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(1) "a"
|
||||
[1]=>
|
||||
string(1) "b"
|
||||
[2]=>
|
||||
string(1) "c"
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(2) "aq"
|
||||
[1]=>
|
||||
string(2) "bq"
|
||||
[2]=>
|
||||
&string(2) "cq"
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
Bug #67938: Segfault when extending interface method with variadic
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
interface TestInterface {
|
||||
public function foo();
|
||||
public function bar(array $bar);
|
||||
}
|
||||
|
||||
class Test implements TestInterface {
|
||||
public function foo(...$args) {
|
||||
echo __METHOD__, "\n";
|
||||
}
|
||||
public function bar(array $bar, ...$args) {
|
||||
echo __METHOD__, "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$obj->foo();
|
||||
$obj->bar([]);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Test::foo
|
||||
Test::bar
|
||||
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Bug #67985 - Last used array index not copied to new array at assignment
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = ['zero', 'one', 'two'];
|
||||
unset($a[2]);
|
||||
$b = $a;
|
||||
$a[] = 'three';
|
||||
$b[] = 'three';
|
||||
|
||||
var_dump($a === $b);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Bug #68118: $a->foo .= 'test'; can leave $a->foo undefined
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_error_handler(function() {
|
||||
$obj = new stdClass;
|
||||
$obj->test = 'meow';
|
||||
return true;
|
||||
});
|
||||
|
||||
$a = new stdClass;
|
||||
$a->undefined .= 'test';
|
||||
var_dump($a);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(stdClass)#2 (1) {
|
||||
["undefined"]=>
|
||||
string(4) "test"
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
--TEST--
|
||||
Bug #68370 "unset($this)" can make the program crash
|
||||
--FILE--
|
||||
<?php
|
||||
class C {
|
||||
public function test() {
|
||||
unset($this);
|
||||
return get_defined_vars();
|
||||
}
|
||||
}
|
||||
$c = new C();
|
||||
$x = $c->test();
|
||||
print_r($x);
|
||||
unset($c, $x);
|
||||
--EXPECTF--
|
||||
Array
|
||||
(
|
||||
)
|
||||
@@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
Bug #68446 (Array constant not accepted for array parameter default)
|
||||
--FILE--
|
||||
<?php
|
||||
const FOO = [1];
|
||||
const BAR = null;
|
||||
|
||||
function a(array $a = FOO) {
|
||||
var_dump($a);
|
||||
}
|
||||
|
||||
function b(array $b = BAR) {
|
||||
var_dump($b);
|
||||
}
|
||||
|
||||
b(null);
|
||||
b([]);
|
||||
b();
|
||||
a([]);
|
||||
a();
|
||||
a(null);
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
array(0) {
|
||||
}
|
||||
NULL
|
||||
array(0) {
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
|
||||
Catchable fatal error: Argument 1 passed to a() must be of the type array, null given, called in %s on line %d and defined in %s on line %d
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Closure 049: static::class in static closure in non-static method.
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
function foo() {
|
||||
$f = static function() {
|
||||
return static::class;
|
||||
};
|
||||
return $f();
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
$b = new B;
|
||||
|
||||
var_dump($b->foo());
|
||||
--EXPECT--
|
||||
string(1) "B"
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Closure 050: static::class in non-static closure in non-static method.
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
function foo() {
|
||||
$f = function() {
|
||||
return static::class;
|
||||
};
|
||||
return $f();
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
$b = new B;
|
||||
var_dump($b->foo());
|
||||
|
||||
--EXPECT--
|
||||
string(1) "B"
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Closure 051: static::class in static closure in static method.
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
static function foo() {
|
||||
$f = static function() {
|
||||
return static::class;
|
||||
};
|
||||
return $f();
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
var_dump(B::foo());
|
||||
|
||||
--EXPECT--
|
||||
string(1) "B"
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Closure 052: static::class in non-static closure in static method.
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
static function foo() {
|
||||
$f = function() {
|
||||
return static::class;
|
||||
};
|
||||
return $f();
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
var_dump(B::foo());
|
||||
|
||||
--EXPECT--
|
||||
string(1) "B"
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Closure 053: self::class in static closure in non-static method.
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
function foo() {
|
||||
$f = static function() {
|
||||
return self::class;
|
||||
};
|
||||
return $f();
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
$b = new B;
|
||||
var_dump($b->foo());
|
||||
|
||||
--EXPECT--
|
||||
string(1) "A"
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Closure 054: self::class in non-static closure in non-static method.
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
function foo() {
|
||||
$f = function() {
|
||||
return self::class;
|
||||
};
|
||||
return $f();
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
$b = new B;
|
||||
var_dump($b->foo());
|
||||
|
||||
--EXPECT--
|
||||
string(1) "A"
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Closure 055: self::class in static closure in static method.
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
static function foo() {
|
||||
$f = static function() {
|
||||
return self::class;
|
||||
};
|
||||
return $f();
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
var_dump(B::foo());
|
||||
|
||||
--EXPECT--
|
||||
string(1) "A"
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Closure 056: self::class in non-static closure in static method.
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
static function foo() {
|
||||
$f = function() {
|
||||
return self::class;
|
||||
};
|
||||
return $f();
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
var_dump(B::foo());
|
||||
|
||||
--EXPECT--
|
||||
string(1) "A"
|
||||
@@ -1,37 +0,0 @@
|
||||
--TEST--
|
||||
Bug 66622: Closures do not correctly capture the late bound class (static::) in some cases
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
static function name() { return 'A'; }
|
||||
function foo() {
|
||||
$fn = function() { return static::name(); };
|
||||
echo static::name() . ' vs ' . $fn() . "\n";
|
||||
}
|
||||
function bar() {
|
||||
$fn = static function() { return static::name(); };
|
||||
echo static::name() . ' vs ' . $fn() . "\n";
|
||||
}
|
||||
static function baz() {
|
||||
$fn = function() { return static::name(); };
|
||||
echo static::name() . ' vs ' . $fn() . "\n";
|
||||
}
|
||||
}
|
||||
class B extends A {
|
||||
static function name() { return 'B'; }
|
||||
}
|
||||
|
||||
function test() {
|
||||
(new B)->foo();
|
||||
(new B)->bar();
|
||||
(new B)->baz();
|
||||
B::baz();
|
||||
}
|
||||
test();
|
||||
|
||||
--EXPECT--
|
||||
B vs B
|
||||
B vs B
|
||||
B vs B
|
||||
B vs B
|
||||
@@ -35,9 +35,6 @@ 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);
|
||||
@@ -64,7 +61,6 @@ var_dump(T_23);
|
||||
var_dump(T_24);
|
||||
var_dump(T_25);
|
||||
var_dump(T_26);
|
||||
var_dump(T_27);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
@@ -93,4 +89,3 @@ bool(false)
|
||||
bool(true)
|
||||
int(7)
|
||||
int(6)
|
||||
int(8)
|
||||
@@ -1,66 +0,0 @@
|
||||
--TEST--
|
||||
Constant expressions with arrays
|
||||
--FILE--
|
||||
<?php
|
||||
const a = [1,2,[3,[4]]];
|
||||
const b = a[0];
|
||||
const c = a[2][0];
|
||||
const d = a[2];
|
||||
const e = ["string" => [1]]["string"][0];
|
||||
|
||||
var_dump(b, c, e);
|
||||
|
||||
function test ($a = d[1][0]) {
|
||||
var_dump($a);
|
||||
}
|
||||
|
||||
test();
|
||||
|
||||
class foo {
|
||||
const bar = [1][0];
|
||||
}
|
||||
|
||||
var_dump(foo::bar);
|
||||
|
||||
var_dump(a, a[0], a[2], a[2][1], a[3]);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(1)
|
||||
int(3)
|
||||
int(1)
|
||||
int(4)
|
||||
int(1)
|
||||
|
||||
Notice: Undefined offset: 3 in %s on line %d
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(3)
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(4)
|
||||
}
|
||||
}
|
||||
}
|
||||
int(1)
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(3)
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(4)
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(4)
|
||||
}
|
||||
NULL
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
Self-referencing constant expression (part of a constant AST)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
const FOO = [self::BAR];
|
||||
const BAR = [self::FOO];
|
||||
}
|
||||
var_dump(A::FOO);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot declare self-referencing constant 'self::FOO' in %s on line %d
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
--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
|
||||
@@ -1,19 +0,0 @@
|
||||
--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
|
||||
@@ -1,19 +0,0 @@
|
||||
--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
|
||||
@@ -1,19 +0,0 @@
|
||||
--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
|
||||
@@ -1,19 +0,0 @@
|
||||
--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
|
||||
@@ -1,19 +0,0 @@
|
||||
--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
|
||||
@@ -1,19 +0,0 @@
|
||||
--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
|
||||
@@ -1,19 +0,0 @@
|
||||
--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
|
||||
@@ -1,19 +0,0 @@
|
||||
--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
|
||||
@@ -1,19 +0,0 @@
|
||||
--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
|
||||
@@ -1,39 +0,0 @@
|
||||
--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) {
|
||||
}
|
||||
@@ -76,4 +76,4 @@ NULL
|
||||
|
||||
Notice: Undefined offset: 3 in %s on line %d
|
||||
|
||||
Fatal error: Call to a member function bar() on null in %s on line %d
|
||||
Fatal error: Call to a member function bar() on a non-object in %s on line %d
|
||||
@@ -7,17 +7,7 @@ class test {
|
||||
const TEST = array(1,2,3);
|
||||
}
|
||||
|
||||
var_dump(test::TEST);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
Done
|
||||
Fatal error: Arrays are not allowed in class constants in %s on line %d
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Bug #67467: eval with parse error causes segmentation fault in generator
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function gen() {
|
||||
$a = 1;
|
||||
yield $a;
|
||||
}
|
||||
|
||||
@eval('abc');
|
||||
|
||||
$values = gen();
|
||||
$values->next();
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -32,11 +32,12 @@ 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"...')
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
--FILE--
|
||||
<?php
|
||||
const C = array();
|
||||
|
||||
var_dump(C);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(0) {
|
||||
}
|
||||
Fatal error: Arrays are not allowed as constants in %sns_059.php on line 2
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
--TEST--
|
||||
Bug #65576 (Constructor from trait conflicts with inherited constructor)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait T
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
echo "Trait contructor\n";
|
||||
}
|
||||
}
|
||||
|
||||
class A
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
echo "Parent constructor\n";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A
|
||||
{
|
||||
use T;
|
||||
}
|
||||
|
||||
new B();
|
||||
|
||||
--EXPECT--
|
||||
Trait contructor
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
Bug #65576 (Constructor from trait conflicts with inherited constructor)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait T
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
echo "Trait contructor\n";
|
||||
}
|
||||
}
|
||||
|
||||
class A
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
echo "Parent constructor\n";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A
|
||||
{
|
||||
use T;
|
||||
}
|
||||
|
||||
new B();
|
||||
|
||||
--EXPECT--
|
||||
Parent constructor
|
||||
Trait contructor
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Try finally (segfault with empty break)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo () {
|
||||
try {
|
||||
break;
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
|
||||
foo();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot break/continue 1 level in %stry_finally_011.php on line %d
|
||||
+6
-17
@@ -52,7 +52,7 @@ ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC)
|
||||
ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
|
||||
ZEND_API void (*zend_block_interruptions)(void);
|
||||
ZEND_API void (*zend_unblock_interruptions)(void);
|
||||
ZEND_API void (*zend_ticks_function)(int ticks);
|
||||
ZEND_API void (*zend_ticks_function)(int ticks TSRMLS_DC);
|
||||
ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
|
||||
int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
|
||||
ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
|
||||
@@ -817,22 +817,11 @@ void zend_shutdown(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
#ifdef ZEND_SIGNALS
|
||||
zend_signal_shutdown(TSRMLS_C);
|
||||
#endif
|
||||
#ifdef ZEND_WIN32
|
||||
zend_shutdown_timeout_thread();
|
||||
#endif
|
||||
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
|
||||
|
||||
if (EG(active))
|
||||
{
|
||||
/*
|
||||
* The order of destruction is important here.
|
||||
* See bugs #65463 and 66036.
|
||||
*/
|
||||
zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
|
||||
zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) zend_cleanup_user_class_data TSRMLS_CC);
|
||||
zend_cleanup_internal_classes(TSRMLS_C);
|
||||
zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) clean_non_persistent_function_full TSRMLS_CC);
|
||||
zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) clean_non_persistent_class_full TSRMLS_CC);
|
||||
}
|
||||
|
||||
zend_destroy_modules();
|
||||
|
||||
virtual_cwd_deactivate(TSRMLS_C);
|
||||
@@ -898,7 +887,7 @@ ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */
|
||||
/* }}} */
|
||||
END_EXTERN_C()
|
||||
|
||||
ZEND_API void zend_append_version_info(const zend_extension *extension) /* {{{ */
|
||||
void zend_append_version_info(const zend_extension *extension) /* {{{ */
|
||||
{
|
||||
char *new_info;
|
||||
uint new_info_length;
|
||||
@@ -965,7 +954,7 @@ ZEND_API void zend_deactivate(TSRMLS_D) /* {{{ */
|
||||
|
||||
zend_destroy_rsrc_list(&EG(regular_list) TSRMLS_CC);
|
||||
|
||||
#if ZEND_DEBUG
|
||||
#ifdef ZEND_DEBUG
|
||||
if (GC_G(gc_enabled) && !CG(unclean_shutdown)) {
|
||||
gc_collect_cycles(TSRMLS_C);
|
||||
}
|
||||
|
||||
+8
-6
@@ -22,7 +22,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "2.6.0"
|
||||
#define ZEND_VERSION "2.7.0-dev"
|
||||
|
||||
#define ZEND_ENGINE_2
|
||||
|
||||
@@ -502,7 +502,6 @@ 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;
|
||||
|
||||
@@ -551,7 +550,7 @@ typedef struct _zend_utility_functions {
|
||||
void (*block_interruptions)(void);
|
||||
void (*unblock_interruptions)(void);
|
||||
int (*get_configuration_directive)(const char *name, uint name_length, zval *contents);
|
||||
void (*ticks_function)(int ticks);
|
||||
void (*ticks_function)(int ticks TSRMLS_DC);
|
||||
void (*on_timeout)(int seconds TSRMLS_DC);
|
||||
int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
|
||||
int (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap);
|
||||
@@ -589,11 +588,14 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length);
|
||||
#define IS_STRING 6
|
||||
#define IS_RESOURCE 7
|
||||
#define IS_CONSTANT 8
|
||||
#define IS_CONSTANT_AST 9
|
||||
#define IS_CALLABLE 10
|
||||
#define IS_CONSTANT_ARRAY 9
|
||||
#define IS_CONSTANT_AST 10
|
||||
#define IS_CALLABLE 11
|
||||
|
||||
/* Ugly hack to support constants as static array indices */
|
||||
#define IS_CONSTANT_TYPE_MASK 0x00f
|
||||
#define IS_CONSTANT_UNQUALIFIED 0x010
|
||||
#define IS_CONSTANT_INDEX 0x080
|
||||
#define IS_LEXICAL_VAR 0x020
|
||||
#define IS_LEXICAL_REF 0x040
|
||||
#define IS_CONSTANT_IN_NAMESPACE 0x100
|
||||
@@ -700,7 +702,7 @@ extern ZEND_API zend_write_func_t zend_write;
|
||||
extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC);
|
||||
extern ZEND_API void (*zend_block_interruptions)(void);
|
||||
extern ZEND_API void (*zend_unblock_interruptions)(void);
|
||||
extern ZEND_API void (*zend_ticks_function)(int ticks);
|
||||
extern ZEND_API void (*zend_ticks_function)(int ticks TSRMLS_DC);
|
||||
extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
|
||||
extern ZEND_API void (*zend_on_timeout)(int seconds TSRMLS_DC);
|
||||
extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
|
||||
|
||||
+16
-25
@@ -1070,7 +1070,7 @@ static int zval_update_class_constant(zval **pp, int is_static, int offset TSRML
|
||||
int ret;
|
||||
zend_class_entry *old_scope = *scope;
|
||||
*scope = prop_info->ce;
|
||||
ret = zval_update_constant(pp, 1 TSRMLS_CC);
|
||||
ret = zval_update_constant(pp, (void*)1 TSRMLS_CC);
|
||||
*scope = old_scope;
|
||||
return ret;
|
||||
}
|
||||
@@ -1079,7 +1079,7 @@ static int zval_update_class_constant(zval **pp, int is_static, int offset TSRML
|
||||
} while (ce);
|
||||
|
||||
}
|
||||
return zval_update_constant(pp, 1 TSRMLS_CC);
|
||||
return zval_update_constant(pp, (void*)1 TSRMLS_CC);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1093,7 +1093,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 (class_type->default_properties_table[i]) {
|
||||
@@ -2018,9 +2018,6 @@ 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, 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, ZEND_DEBUGINFO_FUNC_NAME);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2034,7 +2031,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, *__debugInfo = NULL;
|
||||
zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL;
|
||||
const char *lowercase_name;
|
||||
int fname_len;
|
||||
const char *lc_class_name = NULL;
|
||||
@@ -2183,8 +2180,6 @@ 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, 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, ZEND_DEBUGINFO_FUNC_NAME, sizeof(ZEND_DEBUGINFO_FUNC_NAME) - 1)) {
|
||||
__debugInfo = reg_function;
|
||||
} else {
|
||||
reg_function = NULL;
|
||||
}
|
||||
@@ -2223,7 +2218,6 @@ 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) {
|
||||
@@ -2287,11 +2281,6 @@ 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, __debugInfo->common.function_name);
|
||||
}
|
||||
}
|
||||
efree((char*)lc_class_name);
|
||||
}
|
||||
return SUCCESS;
|
||||
@@ -2324,10 +2313,8 @@ ZEND_API void zend_unregister_functions(const zend_function_entry *functions, in
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_startup_module(zend_module_entry *module) /* {{{ */
|
||||
ZEND_API int zend_startup_module(zend_module_entry *module TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if ((module = zend_register_internal_module(module TSRMLS_CC)) != NULL && zend_startup_module_ex(module TSRMLS_CC) == SUCCESS) {
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -2499,7 +2486,7 @@ ZEND_API void zend_post_deactivate_modules(TSRMLS_D) /* {{{ */
|
||||
/* }}} */
|
||||
|
||||
/* return the next free module number */
|
||||
ZEND_API int zend_next_free_module(void) /* {{{ */
|
||||
int zend_next_free_module(void) /* {{{ */
|
||||
{
|
||||
return zend_hash_num_elements(&module_registry) + 1;
|
||||
}
|
||||
@@ -2635,15 +2622,18 @@ ZEND_API ZEND_FUNCTION(display_disabled_function)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zend_function_entry disabled_function[] = {
|
||||
ZEND_FE(display_disabled_function, NULL)
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_internal_function *func;
|
||||
if (zend_hash_find(CG(function_table), function_name, function_name_length+1, (void **)&func)==SUCCESS) {
|
||||
func->arg_info = NULL;
|
||||
func->handler = ZEND_FN(display_disabled_function);
|
||||
return SUCCESS;
|
||||
if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
return FAILURE;
|
||||
disabled_function[0].fname = function_name;
|
||||
return zend_register_functions(NULL, disabled_function, CG(function_table), MODULE_PERSISTENT TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -3460,6 +3450,7 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, in
|
||||
if (ce->type & ZEND_INTERNAL_CLASS) {
|
||||
switch(Z_TYPE_P(property)) {
|
||||
case IS_ARRAY:
|
||||
case IS_CONSTANT_ARRAY:
|
||||
case IS_OBJECT:
|
||||
case IS_RESOURCE:
|
||||
zend_error(E_CORE_ERROR, "Internal zval's can't be arrays, objects or resources");
|
||||
|
||||
+2
-3
@@ -197,7 +197,6 @@ 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; \
|
||||
@@ -233,7 +232,7 @@ typedef struct _zend_fcall_info_cache {
|
||||
|
||||
#define ZEND_FCI_INITIALIZED(fci) ((fci).size != 0)
|
||||
|
||||
ZEND_API int zend_next_free_module(void);
|
||||
int zend_next_free_module(void);
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API int zend_get_parameters(int ht, int param_count, ...);
|
||||
@@ -267,7 +266,7 @@ ZEND_API int zend_parse_parameter(int flags, int arg_num TSRMLS_DC, zval **arg,
|
||||
|
||||
ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC);
|
||||
ZEND_API void zend_unregister_functions(const zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
|
||||
ZEND_API int zend_startup_module(zend_module_entry *module_entry);
|
||||
ZEND_API int zend_startup_module(zend_module_entry *module_entry TSRMLS_DC);
|
||||
ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module_entry TSRMLS_DC);
|
||||
ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC);
|
||||
ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC);
|
||||
|
||||
+1
-3
@@ -2682,10 +2682,8 @@ ZEND_API char *zend_strndup(const char *s, uint length)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_set_memory_limit(size_t memory_limit)
|
||||
ZEND_API int zend_set_memory_limit(size_t memory_limit TSRMLS_DC)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
AG(mm_heap)->limit = (memory_limit >= AG(mm_heap)->block_size) ? memory_limit : AG(mm_heap)->block_size;
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
+1
-1
@@ -139,7 +139,7 @@ inline static void * __zend_realloc(void *p, size_t len)
|
||||
#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):STR_EMPTY_ALLOC())
|
||||
#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):STR_EMPTY_ALLOC())
|
||||
|
||||
ZEND_API int zend_set_memory_limit(size_t memory_limit);
|
||||
ZEND_API int zend_set_memory_limit(size_t memory_limit TSRMLS_DC);
|
||||
|
||||
ZEND_API void start_memory_manager(TSRMLS_D);
|
||||
ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC);
|
||||
|
||||
+27
-83
@@ -63,27 +63,6 @@ ZEND_API zend_ast* zend_ast_create_ternary(uint kind, zend_ast *op0, zend_ast *o
|
||||
return ast;
|
||||
}
|
||||
|
||||
ZEND_API zend_ast* zend_ast_create_dynamic(uint kind)
|
||||
{
|
||||
zend_ast *ast = emalloc(sizeof(zend_ast) + sizeof(zend_ast*) * 3); /* use 4 children as deafult */
|
||||
ast->kind = kind;
|
||||
ast->children = 0;
|
||||
return ast;
|
||||
}
|
||||
|
||||
ZEND_API void zend_ast_dynamic_add(zend_ast **ast, zend_ast *op)
|
||||
{
|
||||
if ((*ast)->children >= 4 && (*ast)->children == ((*ast)->children & -(*ast)->children)) {
|
||||
*ast = erealloc(*ast, sizeof(zend_ast) + sizeof(zend_ast*) * ((*ast)->children * 2 + 1));
|
||||
}
|
||||
(&(*ast)->u.child)[(*ast)->children++] = op;
|
||||
}
|
||||
|
||||
ZEND_API void zend_ast_dynamic_shrink(zend_ast **ast)
|
||||
{
|
||||
*ast = erealloc(*ast, sizeof(zend_ast) + sizeof(zend_ast*) * ((*ast)->children - 1));
|
||||
}
|
||||
|
||||
ZEND_API int zend_ast_is_ct_constant(zend_ast *ast)
|
||||
{
|
||||
int i;
|
||||
@@ -128,13 +107,6 @@ 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);
|
||||
@@ -251,26 +223,17 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
|
||||
zval_dtor(&op2);
|
||||
break;
|
||||
case ZEND_CONST:
|
||||
/* class constants may be updated in-place */
|
||||
if (scope) {
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(ast->u.val))) {
|
||||
zval_update_constant_ex(&ast->u.val, 1, scope TSRMLS_CC);
|
||||
}
|
||||
*result = *ast->u.val;
|
||||
zval_copy_ctor(result);
|
||||
} else {
|
||||
*result = *ast->u.val;
|
||||
zval_copy_ctor(result);
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(result))) {
|
||||
zval_update_constant_ex(&result, 1, scope TSRMLS_CC);
|
||||
}
|
||||
*result = *ast->u.val;
|
||||
zval_copy_ctor(result);
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(result))) {
|
||||
zval_update_constant_ex(&result, (void *) 1, scope TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
case ZEND_BOOL_AND:
|
||||
zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
|
||||
if (zend_is_true(&op1)) {
|
||||
if (zend_is_true(&op1 TSRMLS_CC)) {
|
||||
zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
|
||||
ZVAL_BOOL(result, zend_is_true(&op2));
|
||||
ZVAL_BOOL(result, zend_is_true(&op2 TSRMLS_CC));
|
||||
zval_dtor(&op2);
|
||||
} else {
|
||||
ZVAL_BOOL(result, 0);
|
||||
@@ -279,18 +242,18 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
|
||||
break;
|
||||
case ZEND_BOOL_OR:
|
||||
zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
|
||||
if (zend_is_true(&op1)) {
|
||||
if (zend_is_true(&op1 TSRMLS_CC)) {
|
||||
ZVAL_BOOL(result, 1);
|
||||
} else {
|
||||
zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
|
||||
ZVAL_BOOL(result, zend_is_true(&op2));
|
||||
ZVAL_BOOL(result, zend_is_true(&op2 TSRMLS_CC));
|
||||
zval_dtor(&op2);
|
||||
}
|
||||
zval_dtor(&op1);
|
||||
break;
|
||||
case ZEND_SELECT:
|
||||
zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
|
||||
if (zend_is_true(&op1)) {
|
||||
if (zend_is_true(&op1 TSRMLS_CC)) {
|
||||
if (!(&ast->u.child)[1]) {
|
||||
*result = op1;
|
||||
} else {
|
||||
@@ -314,34 +277,6 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
|
||||
sub_function(result, &op1, &op2 TSRMLS_CC);
|
||||
zval_dtor(&op2);
|
||||
break;
|
||||
case ZEND_INIT_ARRAY:
|
||||
INIT_PZVAL(result);
|
||||
array_init(result);
|
||||
{
|
||||
int i;
|
||||
zend_bool has_key;
|
||||
for (i = 0; i < ast->children; i+=2) {
|
||||
zval *expr;
|
||||
MAKE_STD_ZVAL(expr);
|
||||
if ((has_key = !!(&ast->u.child)[i])) {
|
||||
zend_ast_evaluate(&op1, (&ast->u.child)[i], scope TSRMLS_CC);
|
||||
}
|
||||
zend_ast_evaluate(expr, (&ast->u.child)[i+1], scope TSRMLS_CC);
|
||||
zend_do_add_static_array_element(result, has_key?&op1:NULL, expr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ZEND_FETCH_DIM_R:
|
||||
zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
|
||||
zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
|
||||
{
|
||||
zval *tmp;
|
||||
zend_fetch_dimension_by_zval(&tmp, &op1, &op2 TSRMLS_CC);
|
||||
ZVAL_ZVAL(result, tmp, 1, 1);
|
||||
}
|
||||
zval_dtor(&op1);
|
||||
zval_dtor(&op2);
|
||||
break;
|
||||
default:
|
||||
zend_error(E_ERROR, "Unsupported constant expression");
|
||||
}
|
||||
@@ -355,17 +290,26 @@ ZEND_API zend_ast *zend_ast_copy(zend_ast *ast)
|
||||
zend_ast *copy = zend_ast_create_constant(ast->u.val);
|
||||
zval_copy_ctor(copy->u.val);
|
||||
return copy;
|
||||
} 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]);
|
||||
} 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]));
|
||||
}
|
||||
return new;
|
||||
}
|
||||
return zend_ast_create_dynamic(ast->kind);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ZEND_API void zend_ast_destroy(zend_ast *ast)
|
||||
|
||||
@@ -50,9 +50,6 @@ ZEND_API zend_ast *zend_ast_create_constant(zval *zv);
|
||||
ZEND_API zend_ast *zend_ast_create_unary(uint kind, zend_ast *op0);
|
||||
ZEND_API zend_ast *zend_ast_create_binary(uint kind, zend_ast *op0, zend_ast *op1);
|
||||
ZEND_API zend_ast *zend_ast_create_ternary(uint kind, zend_ast *op0, zend_ast *op1, zend_ast *op2);
|
||||
ZEND_API zend_ast* zend_ast_create_dynamic(uint kind);
|
||||
ZEND_API void zend_ast_dynamic_add(zend_ast **ast, zend_ast *op);
|
||||
ZEND_API void zend_ast_dynamic_shrink(zend_ast **ast);
|
||||
|
||||
ZEND_API int zend_ast_is_ct_constant(zend_ast *ast);
|
||||
|
||||
|
||||
@@ -245,16 +245,16 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */
|
||||
ZEND_FE(func_num_args, arginfo_zend__void)
|
||||
ZEND_FE(func_get_arg, arginfo_func_get_arg)
|
||||
ZEND_FE(func_get_args, arginfo_zend__void)
|
||||
ZEND_FE(strlen, arginfo_strlen)
|
||||
ZEND_FE(strcmp, arginfo_strcmp)
|
||||
ZEND_FE(strncmp, arginfo_strncmp)
|
||||
ZEND_FE(strcasecmp, arginfo_strcmp)
|
||||
ZEND_FE(strlen, arginfo_strlen)
|
||||
ZEND_FE(strcmp, arginfo_strcmp)
|
||||
ZEND_FE(strncmp, arginfo_strncmp)
|
||||
ZEND_FE(strcasecmp, arginfo_strcmp)
|
||||
ZEND_FE(strncasecmp, arginfo_strncmp)
|
||||
ZEND_FE(each, arginfo_each)
|
||||
ZEND_FE(each, arginfo_each)
|
||||
ZEND_FE(error_reporting, arginfo_error_reporting)
|
||||
ZEND_FE(define, arginfo_define)
|
||||
ZEND_FE(defined, arginfo_defined)
|
||||
ZEND_FE(get_class, arginfo_get_class)
|
||||
ZEND_FE(define, arginfo_define)
|
||||
ZEND_FE(defined, arginfo_defined)
|
||||
ZEND_FE(get_class, arginfo_get_class)
|
||||
ZEND_FE(get_called_class, arginfo_zend__void)
|
||||
ZEND_FE(get_parent_class, arginfo_get_class)
|
||||
ZEND_FE(method_exists, arginfo_method_exists)
|
||||
@@ -274,13 +274,13 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */
|
||||
ZEND_FE(get_included_files, arginfo_zend__void)
|
||||
ZEND_FALIAS(get_required_files, get_included_files, arginfo_zend__void)
|
||||
ZEND_FE(is_subclass_of, arginfo_is_subclass_of)
|
||||
ZEND_FE(is_a, arginfo_is_subclass_of)
|
||||
ZEND_FE(is_a, arginfo_is_subclass_of)
|
||||
ZEND_FE(get_class_vars, arginfo_get_class_vars)
|
||||
ZEND_FE(get_object_vars, arginfo_get_object_vars)
|
||||
ZEND_FE(get_class_methods, arginfo_get_class_methods)
|
||||
ZEND_FE(trigger_error, arginfo_trigger_error)
|
||||
ZEND_FALIAS(user_error, trigger_error, arginfo_trigger_error)
|
||||
ZEND_FE(set_error_handler, arginfo_set_error_handler)
|
||||
ZEND_FE(set_error_handler, arginfo_set_error_handler)
|
||||
ZEND_FE(restore_error_handler, arginfo_zend__void)
|
||||
ZEND_FE(set_exception_handler, arginfo_set_exception_handler)
|
||||
ZEND_FE(restore_exception_handler, arginfo_zend__void)
|
||||
@@ -288,14 +288,14 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */
|
||||
ZEND_FE(get_declared_traits, arginfo_zend__void)
|
||||
ZEND_FE(get_declared_interfaces, arginfo_zend__void)
|
||||
ZEND_FE(get_defined_functions, arginfo_zend__void)
|
||||
ZEND_FE(get_defined_vars, arginfo_zend__void)
|
||||
ZEND_FE(create_function, arginfo_create_function)
|
||||
ZEND_FE(get_resource_type, arginfo_get_resource_type)
|
||||
ZEND_FE(get_defined_vars, arginfo_zend__void)
|
||||
ZEND_FE(create_function, arginfo_create_function)
|
||||
ZEND_FE(get_resource_type, arginfo_get_resource_type)
|
||||
ZEND_FE(get_loaded_extensions, arginfo_get_loaded_extensions)
|
||||
ZEND_FE(extension_loaded, arginfo_extension_loaded)
|
||||
ZEND_FE(extension_loaded, arginfo_extension_loaded)
|
||||
ZEND_FE(get_extension_funcs, arginfo_extension_loaded)
|
||||
ZEND_FE(get_defined_constants, arginfo_get_defined_constants)
|
||||
ZEND_FE(debug_backtrace, arginfo_debug_backtrace)
|
||||
ZEND_FE(debug_backtrace, arginfo_debug_backtrace)
|
||||
ZEND_FE(debug_print_backtrace, arginfo_debug_print_backtrace)
|
||||
#if ZEND_DEBUG
|
||||
ZEND_FE(zend_test_func, NULL)
|
||||
@@ -305,7 +305,7 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */
|
||||
#endif
|
||||
ZEND_FE(gc_collect_cycles, arginfo_zend__void)
|
||||
ZEND_FE(gc_enabled, arginfo_zend__void)
|
||||
ZEND_FE(gc_enable, arginfo_zend__void)
|
||||
ZEND_FE(gc_enable, arginfo_zend__void)
|
||||
ZEND_FE(gc_disable, arginfo_zend__void)
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
@@ -480,7 +480,6 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
|
||||
}
|
||||
}
|
||||
|
||||
closure->this_ptr = NULL;
|
||||
/* Invariants:
|
||||
* If the closure is unscoped, it has no bound object.
|
||||
* The the closure is scoped, it's either static or it's bound */
|
||||
@@ -492,7 +491,10 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
|
||||
Z_ADDREF_P(this_ptr);
|
||||
} else {
|
||||
closure->func.common.fn_flags |= ZEND_ACC_STATIC;
|
||||
closure->this_ptr = NULL;
|
||||
}
|
||||
} else {
|
||||
closure->this_ptr = NULL;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+92
-113
@@ -102,13 +102,6 @@ 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) /* {{{ */
|
||||
{
|
||||
property_info->name = str_estrndup(property_info->name, property_info->name_length);
|
||||
@@ -1629,11 +1622,6 @@ 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, 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;
|
||||
@@ -1694,11 +1682,6 @@ 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, 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;
|
||||
}
|
||||
@@ -1931,23 +1914,17 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
|
||||
if (class_type->u.constant.type == IS_ARRAY) {
|
||||
cur_arg_info->type_hint = IS_ARRAY;
|
||||
if (op == ZEND_RECV_INIT) {
|
||||
if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) {
|
||||
if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
|
||||
cur_arg_info->allow_null = 1;
|
||||
} else if (IS_CONSTANT_TYPE(Z_TYPE(initialization->u.constant))) {
|
||||
/* delay constant resolution and check to run-time */
|
||||
cur_arg_info->allow_null = 0;
|
||||
} else if (Z_TYPE(initialization->u.constant) != IS_ARRAY) {
|
||||
} else if (Z_TYPE(initialization->u.constant) != IS_ARRAY && Z_TYPE(initialization->u.constant) != IS_CONSTANT_ARRAY) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with array type hint can only be an array or NULL");
|
||||
}
|
||||
}
|
||||
} else if (class_type->u.constant.type == IS_CALLABLE) {
|
||||
cur_arg_info->type_hint = IS_CALLABLE;
|
||||
if (op == ZEND_RECV_INIT) {
|
||||
if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) {
|
||||
if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
|
||||
cur_arg_info->allow_null = 1;
|
||||
} else if (IS_CONSTANT_TYPE(Z_TYPE(initialization->u.constant))) {
|
||||
/* delay constant resolution and check to run-time */
|
||||
cur_arg_info->allow_null = 0;
|
||||
} else {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with callable type hint can only be NULL");
|
||||
}
|
||||
@@ -1961,11 +1938,8 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
|
||||
cur_arg_info->class_name = Z_STRVAL(class_type->u.constant);
|
||||
cur_arg_info->class_name_len = Z_STRLEN(class_type->u.constant);
|
||||
if (op == ZEND_RECV_INIT) {
|
||||
if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) {
|
||||
if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
|
||||
cur_arg_info->allow_null = 1;
|
||||
} else if (IS_CONSTANT_TYPE(Z_TYPE(initialization->u.constant))) {
|
||||
/* delay constant resolution and check to run-time */
|
||||
cur_arg_info->allow_null = 0;
|
||||
} else {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with a class type hint can only be NULL");
|
||||
}
|
||||
@@ -2005,7 +1979,7 @@ int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace
|
||||
efree(Z_STRVAL(function_name->u.constant));
|
||||
Z_STRVAL(function_name->u.constant) = lcname;
|
||||
|
||||
zend_push_function_call_entry(function TSRMLS_CC);
|
||||
zend_stack_push(&CG(function_call_stack), (void *) &function, sizeof(zend_function *));
|
||||
if (CG(context).nested_calls + 1 > CG(active_op_array)->nested_calls) {
|
||||
CG(active_op_array)->nested_calls = CG(context).nested_calls + 1;
|
||||
}
|
||||
@@ -2018,6 +1992,7 @@ 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);
|
||||
@@ -2061,7 +2036,7 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
}
|
||||
|
||||
zend_push_function_call_entry(NULL TSRMLS_CC);
|
||||
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
|
||||
if (++CG(context).nested_calls > CG(active_op_array)->nested_calls) {
|
||||
CG(active_op_array)->nested_calls = CG(context).nested_calls;
|
||||
}
|
||||
@@ -2084,6 +2059,7 @@ void zend_do_clone(znode *result, const 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);
|
||||
@@ -2109,7 +2085,7 @@ void zend_do_begin_dynamic_function_call(znode *function_name, int ns_call TSRML
|
||||
}
|
||||
}
|
||||
|
||||
zend_push_function_call_entry(NULL TSRMLS_CC);
|
||||
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
|
||||
if (++CG(context).nested_calls > CG(active_op_array)->nested_calls) {
|
||||
CG(active_op_array)->nested_calls = CG(context).nested_calls;
|
||||
}
|
||||
@@ -2214,12 +2190,6 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static
|
||||
if (!CG(active_class_entry)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot access self::class when no class scope is active");
|
||||
}
|
||||
if (CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) {
|
||||
constant_name.op_type = IS_CONST;
|
||||
ZVAL_STRINGL(&constant_name.u.constant, "class", sizeof("class")-1, 1);
|
||||
zend_do_fetch_constant(result, class_name, &constant_name, ZEND_RT, 1 TSRMLS_CC);
|
||||
break;
|
||||
}
|
||||
zval_dtor(&class_name->u.constant);
|
||||
class_name->op_type = IS_CONST;
|
||||
ZVAL_STRINGL(&class_name->u.constant, CG(active_class_entry)->name, CG(active_class_entry)->name_length, 1);
|
||||
@@ -2510,6 +2480,7 @@ 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) {
|
||||
@@ -2558,7 +2529,7 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na
|
||||
SET_NODE(opline->op2, method_name);
|
||||
}
|
||||
|
||||
zend_push_function_call_entry(NULL TSRMLS_CC);
|
||||
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
|
||||
if (++CG(context).nested_calls > CG(active_op_array)->nested_calls) {
|
||||
CG(active_op_array)->nested_calls = CG(context).nested_calls;
|
||||
}
|
||||
@@ -2567,21 +2538,22 @@ 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, int is_method, int is_dynamic_fcall 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) /* {{{ */
|
||||
{
|
||||
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 (fcall->arg_num != 0) {
|
||||
if (Z_LVAL(argument_list->u.constant) != 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 (fcall->fbc) {
|
||||
if (*function_ptr_ptr) {
|
||||
opline->opcode = ZEND_DO_FCALL;
|
||||
SET_NODE(opline->op1, function_name);
|
||||
SET_UNUSED(opline->op2);
|
||||
@@ -2606,39 +2578,33 @@ void zend_do_end_function_call(znode *function_name, znode *result, int is_metho
|
||||
opline->result.var = get_temporary_variable(CG(active_op_array));
|
||||
opline->result_type = IS_VAR;
|
||||
GET_NODE(result, opline->result);
|
||||
opline->extended_value = fcall->arg_num;
|
||||
|
||||
zend_stack_del_top(&CG(function_call_stack));
|
||||
opline->extended_value = Z_LVAL(argument_list->u.constant);
|
||||
|
||||
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 -= fcall->arg_num;
|
||||
zend_stack_del_top(&CG(function_call_stack));
|
||||
CG(context).used_stack -= Z_LVAL(argument_list->u.constant);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_do_pass_param(znode *param, zend_uchar op TSRMLS_DC) /* {{{ */
|
||||
void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_op *opline;
|
||||
int original_op = op;
|
||||
zend_function_call_entry *fcall;
|
||||
zend_function *function_ptr;
|
||||
zend_function **function_ptr_ptr, *function_ptr;
|
||||
int send_by_reference = 0;
|
||||
int send_function = 0;
|
||||
|
||||
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");
|
||||
}
|
||||
zend_stack_top(&CG(function_call_stack), (void **) &function_ptr_ptr);
|
||||
function_ptr = *function_ptr_ptr;
|
||||
|
||||
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, fcall->arg_num)) {
|
||||
!ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) {
|
||||
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().",
|
||||
@@ -2650,7 +2616,7 @@ void zend_do_pass_param(znode *param, zend_uchar op TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
|
||||
if (function_ptr) {
|
||||
if (ARG_MAY_BE_SENT_BY_REF(function_ptr, fcall->arg_num)) {
|
||||
if (ARG_MAY_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) {
|
||||
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)) {
|
||||
@@ -2661,7 +2627,7 @@ void zend_do_pass_param(znode *param, zend_uchar op TSRMLS_DC) /* {{{ */
|
||||
} else {
|
||||
op = ZEND_SEND_VAL;
|
||||
}
|
||||
} else if (ARG_SHOULD_BE_SENT_BY_REF(function_ptr, fcall->arg_num)) {
|
||||
} else if (ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) {
|
||||
send_by_reference = ZEND_ARG_SEND_BY_REF;
|
||||
}
|
||||
}
|
||||
@@ -2696,7 +2662,7 @@ void zend_do_pass_param(znode *param, zend_uchar op 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, fcall->arg_num TSRMLS_CC);
|
||||
zend_do_end_variable_parse(param, BP_VAR_FUNC_ARG, offset TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
case ZEND_SEND_REF:
|
||||
@@ -2722,7 +2688,7 @@ void zend_do_pass_param(znode *param, zend_uchar op TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
opline->opcode = op;
|
||||
SET_NODE(opline->op1, param);
|
||||
opline->op2.opline_num = fcall->arg_num;
|
||||
opline->op2.opline_num = offset;
|
||||
SET_UNUSED(opline->op2);
|
||||
|
||||
if (++CG(context).used_stack > CG(active_op_array)->used_stack) {
|
||||
@@ -2731,20 +2697,18 @@ void zend_do_pass_param(znode *param, zend_uchar op TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_do_unpack_params(znode *params TSRMLS_DC) /* {{{ */
|
||||
void zend_do_unpack_params(znode *params, int offset TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_op *opline;
|
||||
zend_function_call_entry *fcall;
|
||||
zend_function **function_ptr_ptr;
|
||||
|
||||
zend_stack_top(&CG(function_call_stack), (void **) &fcall);
|
||||
fcall->uses_argument_unpacking = 1;
|
||||
|
||||
if (fcall->fbc) {
|
||||
zend_stack_top(&CG(function_call_stack), (void **) &function_ptr_ptr);
|
||||
if (*function_ptr_ptr) {
|
||||
/* 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_STRING(&func_name, fcall->fbc->common.function_name, 1);
|
||||
ZVAL_STRING(&func_name, (*function_ptr_ptr)->common.function_name, 1);
|
||||
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_INIT_FCALL_BY_NAME;
|
||||
@@ -2755,14 +2719,14 @@ void zend_do_unpack_params(znode *params TSRMLS_DC) /* {{{ */
|
||||
GET_CACHE_SLOT(opline->op2.constant);
|
||||
|
||||
++CG(context).nested_calls;
|
||||
fcall->fbc = NULL;
|
||||
*function_ptr_ptr = 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 = fcall->arg_num;
|
||||
opline->op2.num = (zend_uint) offset;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -3159,9 +3123,6 @@ 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()",
|
||||
@@ -3273,7 +3234,7 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
|
||||
* go through all the parameters of the function and not just those present in the
|
||||
* prototype. */
|
||||
num_args = proto->common.num_args;
|
||||
if ((proto->common.fn_flags & ZEND_ACC_VARIADIC)
|
||||
if ((fe->common.fn_flags & ZEND_ACC_VARIADIC)
|
||||
&& fe->common.num_args > proto->common.num_args) {
|
||||
num_args = fe->common.num_args;
|
||||
}
|
||||
@@ -3476,11 +3437,8 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
|
||||
*zv = *precv->op2.zv;
|
||||
zval_copy_ctor(zv);
|
||||
INIT_PZVAL(zv);
|
||||
if ((Z_TYPE_P(zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) {
|
||||
REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRLEN_P(zv));
|
||||
memcpy(offset, Z_STRVAL_P(zv), Z_STRLEN_P(zv));
|
||||
offset += Z_STRLEN_P(zv);
|
||||
} else if (Z_TYPE_P(zv) == IS_BOOL) {
|
||||
zval_update_constant_ex(&zv, (void*)1, fptr->common.scope TSRMLS_CC);
|
||||
if (Z_TYPE_P(zv) == IS_BOOL) {
|
||||
if (Z_LVAL_P(zv)) {
|
||||
memcpy(offset, "true", 4);
|
||||
offset += 4;
|
||||
@@ -3505,9 +3463,6 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
|
||||
} else if (Z_TYPE_P(zv) == IS_ARRAY) {
|
||||
memcpy(offset, "Array", 5);
|
||||
offset += 5;
|
||||
} else if ((Z_TYPE_P(zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT_AST) {
|
||||
memcpy(offset, "<expression>", 12);
|
||||
offset += 12;
|
||||
} else {
|
||||
zend_make_printable_zval(zv, &zv_copy, &use_copy);
|
||||
REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRLEN(zv_copy));
|
||||
@@ -3979,7 +3934,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint
|
||||
if (!strncmp(mname, ZEND_CLONE_FUNC_NAME, mname_len)) {
|
||||
ce->clone = fe; fe->common.fn_flags |= ZEND_ACC_CLONE;
|
||||
} else if (!strncmp(mname, ZEND_CONSTRUCTOR_FUNC_NAME, mname_len)) {
|
||||
if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) {
|
||||
if (ce->constructor) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name);
|
||||
}
|
||||
ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR;
|
||||
@@ -3999,14 +3954,12 @@ static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint
|
||||
ce->__callstatic = fe;
|
||||
} else if (!strncmp(mname, ZEND_TOSTRING_FUNC_NAME, mname_len)) {
|
||||
ce->__tostring = fe;
|
||||
} else if (!strncmp(mname, ZEND_DEBUGINFO_FUNC_NAME, mname_len)) {
|
||||
ce->__debugInfo = fe;
|
||||
} else if (ce->name_length + 1 == mname_len) {
|
||||
char *lowercase_name = emalloc(ce->name_length + 1);
|
||||
zend_str_tolower_copy(lowercase_name, ce->name, ce->name_length);
|
||||
lowercase_name = (char*)zend_new_interned_string(lowercase_name, ce->name_length + 1, 1 TSRMLS_CC);
|
||||
if (!memcmp(mname, lowercase_name, mname_len)) {
|
||||
if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) {
|
||||
if (ce->constructor) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name);
|
||||
}
|
||||
ce->constructor = fe;
|
||||
@@ -4261,8 +4214,8 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
|
||||
|
||||
/* make sure that the trait method is not from a class mentioned in
|
||||
exclude_from_classes, for consistency */
|
||||
if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[j]) {
|
||||
zend_error(E_COMPILE_ERROR,
|
||||
if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[i]) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR,
|
||||
"Inconsistent insteadof definition. "
|
||||
"The method %s is to be used from %s, but %s is also on the exclude list",
|
||||
cur_method_ref->method_name,
|
||||
@@ -5463,6 +5416,10 @@ void zend_do_declare_class_constant(znode *var_name, const znode *value TSRMLS_D
|
||||
const char *cname = NULL;
|
||||
zend_ulong hash;
|
||||
|
||||
if(Z_TYPE(value->u.constant) == IS_CONSTANT_ARRAY) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Arrays are not allowed in class constants");
|
||||
return;
|
||||
}
|
||||
if ((CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Traits cannot have constants");
|
||||
return;
|
||||
@@ -5605,6 +5562,7 @@ 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);
|
||||
@@ -5615,18 +5573,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_push_function_call_entry(NULL TSRMLS_CC);
|
||||
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(unsigned char *));
|
||||
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 TSRMLS_DC) /* {{{ */
|
||||
void zend_do_end_new_object(znode *result, const znode *new_token, const znode *argument_list TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
znode ctor_result;
|
||||
|
||||
zend_do_end_function_call(NULL, &ctor_result, 1, 0 TSRMLS_CC);
|
||||
zend_do_end_function_call(NULL, &ctor_result, argument_list, 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));
|
||||
@@ -5904,30 +5862,57 @@ void zend_do_add_array_element(znode *result, const znode *expr, const znode *of
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_do_add_static_array_element(zval *result, zval *offset, const zval *expr) /* {{{ */
|
||||
void zend_do_add_static_array_element(znode *result, znode *offset, const znode *expr) /* {{{ */
|
||||
{
|
||||
zval *element;
|
||||
|
||||
ALLOC_ZVAL(element);
|
||||
*element = expr->u.constant;
|
||||
if (offset) {
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
switch (Z_TYPE(offset->u.constant) & IS_CONSTANT_TYPE_MASK) {
|
||||
case IS_CONSTANT:
|
||||
/* Ugly hack to denote that this value has a constant index */
|
||||
Z_TYPE_P(element) |= IS_CONSTANT_INDEX;
|
||||
Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3);
|
||||
Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+1] = Z_TYPE(offset->u.constant);
|
||||
Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+2] = 0;
|
||||
zend_symtable_update(Z_ARRVAL(result->u.constant), Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3, &element, sizeof(zval *), NULL);
|
||||
zval_dtor(&offset->u.constant);
|
||||
break;
|
||||
case IS_CONSTANT_AST: {
|
||||
/* Another ugly hack to store the data about the AST in the array */
|
||||
char* key;
|
||||
int len = sizeof(zend_ast *);
|
||||
Z_TYPE_P(element) |= IS_CONSTANT_INDEX;
|
||||
|
||||
key = emalloc(len + 2);
|
||||
*(zend_ast **)key = Z_AST(offset->u.constant);
|
||||
key[len] = Z_TYPE(offset->u.constant);
|
||||
key[len + 1] = 0;
|
||||
zend_symtable_update(Z_ARRVAL(result->u.constant), key, len + 2, &element, sizeof(zval *), NULL);
|
||||
efree(key);
|
||||
break;
|
||||
}
|
||||
case IS_STRING:
|
||||
zend_symtable_update(Z_ARRVAL_P(result), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr, sizeof(zval *), NULL);
|
||||
zval_dtor(offset);
|
||||
zend_symtable_update(Z_ARRVAL(result->u.constant), Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+1, &element, sizeof(zval *), NULL);
|
||||
zval_dtor(&offset->u.constant);
|
||||
break;
|
||||
case IS_NULL:
|
||||
zend_symtable_update(Z_ARRVAL_P(result), "", 1, &expr, sizeof(zval *), NULL);
|
||||
zend_symtable_update(Z_ARRVAL(result->u.constant), "", 1, &element, sizeof(zval *), NULL);
|
||||
break;
|
||||
case IS_LONG:
|
||||
case IS_BOOL:
|
||||
zend_hash_index_update(Z_ARRVAL_P(result), Z_LVAL_P(offset), &expr, sizeof(zval *), NULL);
|
||||
zend_hash_index_update(Z_ARRVAL(result->u.constant), Z_LVAL(offset->u.constant), &element, sizeof(zval *), NULL);
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
zend_hash_index_update(Z_ARRVAL_P(result), zend_dval_to_lval(Z_DVAL_P(offset)), &expr, sizeof(zval *), NULL);
|
||||
zend_hash_index_update(Z_ARRVAL(result->u.constant), zend_dval_to_lval(Z_DVAL(offset->u.constant)), &element, sizeof(zval *), NULL);
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
case IS_CONSTANT_ARRAY:
|
||||
zend_error(E_ERROR, "Illegal offset type");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(result), &expr, sizeof(zval *), NULL);
|
||||
zend_hash_next_index_insert(Z_ARRVAL(result->u.constant), &element, sizeof(zval *), NULL);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -6352,15 +6337,6 @@ void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, zno
|
||||
/* save the location of FETCH_W instruction(s) */
|
||||
open_brackets_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
|
||||
zend_do_end_variable_parse(array, BP_VAR_W, 0 TSRMLS_CC);
|
||||
|
||||
if (zend_is_function_or_method_call(array)) {
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_SEPARATE;
|
||||
SET_NODE(opline->op1, array);
|
||||
SET_UNUSED(opline->op2);
|
||||
opline->result_type = IS_VAR;
|
||||
opline->result.var = opline->op1.var;
|
||||
}
|
||||
} else {
|
||||
is_variable = 0;
|
||||
open_brackets_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
|
||||
@@ -6970,7 +6946,6 @@ 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;
|
||||
@@ -7317,6 +7292,10 @@ void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */
|
||||
zend_op *opline;
|
||||
zval **ns_name;
|
||||
|
||||
if(Z_TYPE(value->u.constant) == IS_CONSTANT_ARRAY) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Arrays are not allowed as constants");
|
||||
}
|
||||
|
||||
if (zend_get_ct_const(&name->u.constant, 0 TSRMLS_CC)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare constant '%s'", Z_STRVAL(name->u.constant));
|
||||
}
|
||||
|
||||
+5
-16
@@ -363,11 +363,6 @@ typedef struct _zend_function_state {
|
||||
void **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;
|
||||
@@ -523,7 +518,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, int is_method, int is_dynamic_fcall 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_return(znode *expr, int do_end_vparse TSRMLS_DC);
|
||||
void zend_do_yield(znode *result, znode *value, const znode *key, zend_bool is_variable TSRMLS_DC);
|
||||
void zend_do_handle_exception(TSRMLS_D);
|
||||
@@ -559,8 +554,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 TSRMLS_DC);
|
||||
void zend_do_unpack_params(znode *params 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_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC);
|
||||
@@ -590,7 +585,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 TSRMLS_DC);
|
||||
void zend_do_end_new_object(znode *result, const znode *new_token, const znode *argument_list TSRMLS_DC);
|
||||
|
||||
void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode, zend_bool check_namespace TSRMLS_DC);
|
||||
|
||||
@@ -598,7 +593,7 @@ void zend_do_shell_exec(znode *result, const znode *cmd TSRMLS_DC);
|
||||
|
||||
void zend_do_init_array(znode *result, const znode *expr, const znode *offset, zend_bool is_ref TSRMLS_DC);
|
||||
void zend_do_add_array_element(znode *result, const znode *expr, const znode *offset, zend_bool is_ref TSRMLS_DC);
|
||||
void zend_do_add_static_array_element(zval *result, zval *offset, const zval *expr);
|
||||
void zend_do_add_static_array_element(znode *result, znode *offset, const znode *expr);
|
||||
void zend_do_list_init(TSRMLS_D);
|
||||
void zend_do_list_end(znode *result, znode *expr TSRMLS_DC);
|
||||
void zend_do_add_list_element(const znode *element TSRMLS_DC);
|
||||
@@ -686,8 +681,6 @@ ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce TSRMLS_DC);
|
||||
ZEND_API void zend_cleanup_internal_classes(TSRMLS_D);
|
||||
ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int clean_non_persistent_function_full(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC);
|
||||
|
||||
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
|
||||
ZEND_API void zend_function_dtor(zend_function *function);
|
||||
@@ -866,9 +859,6 @@ int zend_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC);
|
||||
#define ZEND_FAST_RET_TO_CATCH 1
|
||||
#define ZEND_FAST_RET_TO_FINALLY 2
|
||||
|
||||
#define ZEND_FAST_CALL_FROM_CATCH 1
|
||||
#define ZEND_FAST_CALL_FROM_FINALLY 2
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#define ZEND_CLONE_FUNC_NAME "__clone"
|
||||
@@ -883,7 +873,6 @@ 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 */
|
||||
|
||||
@@ -408,7 +408,7 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
|
||||
efree(lcname);
|
||||
if(found_const) {
|
||||
*result = c->value;
|
||||
zval_update_constant_ex(&result, 1, NULL TSRMLS_CC);
|
||||
zval_update_constant_ex(&result, (void*)1, NULL TSRMLS_CC);
|
||||
zval_copy_ctor(result);
|
||||
Z_SET_REFCOUNT_P(result, 1);
|
||||
Z_UNSET_ISREF_P(result);
|
||||
@@ -423,7 +423,7 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
|
||||
retval = 0;
|
||||
finish:
|
||||
if (retval) {
|
||||
zval_update_constant_ex(ret_constant, 1, ce TSRMLS_CC);
|
||||
zval_update_constant_ex(ret_constant, (void*)1, ce TSRMLS_CC);
|
||||
*result = **ret_constant;
|
||||
zval_copy_ctor(result);
|
||||
INIT_PZVAL(result);
|
||||
|
||||
+3
-58
@@ -360,11 +360,6 @@ ZEND_METHOD(error_exception, getSeverity)
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define TRACE_ARG_APPEND(vallen) \
|
||||
*str = (char*)erealloc(*str, *len + 1 + vallen); \
|
||||
memmove((*str) + *len - l_added + 1 + vallen, (*str) + *len - l_added + 1, l_added);
|
||||
|
||||
/* }}} */
|
||||
|
||||
static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
|
||||
@@ -376,7 +371,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
|
||||
len = va_arg(args, int*);
|
||||
|
||||
/* the trivial way would be to do:
|
||||
* convert_to_string_ex(arg);
|
||||
* conver_to_string_ex(arg);
|
||||
* append it and kill the now tmp arg.
|
||||
* but that could cause some E_NOTICE and also damn long lines.
|
||||
*/
|
||||
@@ -399,58 +394,8 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
|
||||
l_added += 3 + 1;
|
||||
}
|
||||
while (--l_added) {
|
||||
unsigned char chr = (*str)[*len - l_added];
|
||||
if (chr < 32 || chr == '\\' || chr > 126) {
|
||||
(*str)[*len - l_added] = '\\';
|
||||
|
||||
switch (chr) {
|
||||
case '\n':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'n';
|
||||
break;
|
||||
case '\r':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'r';
|
||||
break;
|
||||
case '\t':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 't';
|
||||
break;
|
||||
case '\f':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'f';
|
||||
break;
|
||||
case '\v':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'v';
|
||||
break;
|
||||
#ifndef PHP_WIN32
|
||||
case '\e':
|
||||
#else
|
||||
case VK_ESCAPE:
|
||||
#endif
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = 'e';
|
||||
break;
|
||||
case '\\':
|
||||
TRACE_ARG_APPEND(1);
|
||||
(*str)[++(*len) - l_added] = '\\';
|
||||
break;
|
||||
default:
|
||||
TRACE_ARG_APPEND(3);
|
||||
(*str)[*len - l_added + 1] = 'x';
|
||||
if ((chr >> 4) < 10) {
|
||||
(*str)[*len - l_added + 2] = (chr >> 4) + '0';
|
||||
} else {
|
||||
(*str)[*len - l_added + 2] = (chr >> 4) + 'A' - 10;
|
||||
}
|
||||
if (chr % 16 < 10) {
|
||||
(*str)[*len - l_added + 3] = chr % 16 + '0';
|
||||
} else {
|
||||
(*str)[*len - l_added + 3] = chr % 16 + 'A' - 10;
|
||||
}
|
||||
*len += 3;
|
||||
}
|
||||
if ((*str)[*len - l_added] < 32) {
|
||||
(*str)[*len - l_added] = '?';
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
+7
-49
@@ -608,22 +608,7 @@ ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_null_constant(zval *default_value TSRMLS_DC)
|
||||
{
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(default_value))) {
|
||||
zval constant = *default_value;
|
||||
zval *constant_ptr = &constant;
|
||||
|
||||
zval_update_constant(&constant_ptr, 0 TSRMLS_CC);
|
||||
if (Z_TYPE(constant) == IS_NULL) {
|
||||
return 1;
|
||||
}
|
||||
zval_dtor(&constant);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, ulong fetch_type, zval *default_value TSRMLS_DC)
|
||||
static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, ulong fetch_type TSRMLS_DC)
|
||||
{
|
||||
zend_arg_info *cur_arg_info;
|
||||
char *need_msg;
|
||||
@@ -653,7 +638,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
|
||||
if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) {
|
||||
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name TSRMLS_CC);
|
||||
}
|
||||
} else if (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC)))) {
|
||||
} else if (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null) {
|
||||
need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC);
|
||||
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "" TSRMLS_CC);
|
||||
}
|
||||
@@ -664,7 +649,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
|
||||
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "" TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC))))) {
|
||||
if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
|
||||
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "" TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
@@ -673,7 +658,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
|
||||
if (!arg) {
|
||||
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "" TSRMLS_CC);
|
||||
}
|
||||
if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC))))) {
|
||||
if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
|
||||
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "" TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
@@ -958,26 +943,6 @@ copy_value:
|
||||
}
|
||||
}
|
||||
|
||||
static void zval_deep_copy(zval **p)
|
||||
{
|
||||
zval *value;
|
||||
|
||||
ALLOC_ZVAL(value);
|
||||
*value = **p;
|
||||
if (Z_TYPE_P(value) == IS_ARRAY) {
|
||||
HashTable *ht;
|
||||
|
||||
ALLOC_HASHTABLE(ht);
|
||||
zend_hash_init(ht, zend_hash_num_elements(Z_ARRVAL_P(value)), NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_copy(ht, Z_ARRVAL_P(value), (copy_ctor_func_t) zval_deep_copy, NULL, sizeof(zval *));
|
||||
Z_ARRVAL_P(value) = ht;
|
||||
} else {
|
||||
zval_copy_ctor(value);
|
||||
}
|
||||
INIT_PZVAL(value);
|
||||
*p = value;
|
||||
}
|
||||
|
||||
/* Utility Functions for Extensions */
|
||||
static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
|
||||
{
|
||||
@@ -1387,15 +1352,9 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval *conta
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void zend_fetch_dimension_by_zval(zval **result, zval *container, zval *dim TSRMLS_DC) {
|
||||
temp_variable tmp;
|
||||
zend_fetch_dimension_address_read(&tmp, container, dim, IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
|
||||
*result = tmp.var.ptr;
|
||||
}
|
||||
|
||||
static void zend_fetch_property_address(temp_variable *result, zval **container_ptr, zval *prop_ptr, const zend_literal *key, int type TSRMLS_DC)
|
||||
{
|
||||
zval *container = *container_ptr;
|
||||
zval *container = *container_ptr;;
|
||||
|
||||
if (Z_TYPE_P(container) != IS_OBJECT) {
|
||||
if (container == &EG(error_zval)) {
|
||||
@@ -1525,8 +1484,7 @@ ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, zend_fcall_i
|
||||
} else {
|
||||
zval **return_value_ptr = &EX_TMP_VAR(execute_data_ptr, execute_data_ptr->opline->result.var)->var.ptr;
|
||||
execute_data_ptr->function_state.function->internal_function.handler(
|
||||
execute_data_ptr->opline->extended_value + execute_data_ptr->call->num_additional_args,
|
||||
*return_value_ptr, return_value_ptr,
|
||||
execute_data_ptr->opline->extended_value, *return_value_ptr, return_value_ptr,
|
||||
execute_data_ptr->object, return_value_used TSRMLS_CC
|
||||
);
|
||||
}
|
||||
@@ -1728,7 +1686,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;
|
||||
zend_uint arg_num = (opline->extended_value & ZEND_FETCH_ARG_MASK) + call->num_additional_args;
|
||||
return ARG_SHOULD_BE_SENT_BY_REF(call->fbc, arg_num);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+12
-9
@@ -60,7 +60,7 @@ ZEND_API zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array
|
||||
ZEND_API void zend_execute(zend_op_array *op_array TSRMLS_DC);
|
||||
ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC);
|
||||
ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC);
|
||||
ZEND_API int zend_is_true(zval *op);
|
||||
ZEND_API int zend_is_true(zval *op TSRMLS_DC);
|
||||
ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
|
||||
ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC);
|
||||
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
|
||||
@@ -101,7 +101,7 @@ static zend_always_inline void i_zval_ptr_dtor_nogc(zval *zval_ptr ZEND_FILE_LIN
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline int i_zend_is_true(zval *op)
|
||||
static zend_always_inline int i_zend_is_true(zval *op TSRMLS_DC)
|
||||
{
|
||||
int result;
|
||||
|
||||
@@ -130,8 +130,6 @@ static zend_always_inline int i_zend_is_true(zval *op)
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
if(IS_ZEND_STD_OBJECT(*op)) {
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (Z_OBJ_HT_P(op)->cast_object) {
|
||||
zval tmp;
|
||||
if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_BOOL TSRMLS_CC) == SUCCESS) {
|
||||
@@ -158,10 +156,10 @@ static zend_always_inline int i_zend_is_true(zval *op)
|
||||
return result;
|
||||
}
|
||||
|
||||
ZEND_API int zval_update_constant(zval **pp, zend_bool inline_change TSRMLS_DC);
|
||||
ZEND_API int zval_update_constant_inline_change(zval **pp, zend_class_entry *scope TSRMLS_DC);
|
||||
ZEND_API int zval_update_constant_no_inline_change(zval **pp, zend_class_entry *scope TSRMLS_DC);
|
||||
ZEND_API int zval_update_constant_ex(zval **pp, zend_bool inline_change, zend_class_entry *scope TSRMLS_DC);
|
||||
ZEND_API int zval_update_constant(zval **pp, 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);
|
||||
|
||||
/* dedicated Zend executor functions - do not use! */
|
||||
#define ZEND_VM_STACK_PAGE_SIZE ((16 * 1024) - 16)
|
||||
@@ -362,7 +360,12 @@ ZEND_API zend_class_entry *zend_fetch_class(const char *class_name, uint class_n
|
||||
ZEND_API zend_class_entry *zend_fetch_class_by_name(const char *class_name, uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC);
|
||||
void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_fetch_dimension_by_zval(zval **result, zval *container, zval *dim TSRMLS_DC);
|
||||
#ifdef ZEND_WIN32
|
||||
void zend_init_timeout_thread(void);
|
||||
void zend_shutdown_timeout_thread(void);
|
||||
#define WM_REGISTER_ZEND_TIMEOUT (WM_USER+1)
|
||||
#define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2)
|
||||
#endif
|
||||
|
||||
#define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p))
|
||||
#define zendi_zval_dtor(p) zval_dtor(&(p))
|
||||
|
||||
+253
-53
@@ -46,10 +46,13 @@ ZEND_API const zend_fcall_info empty_fcall_info = { 0, NULL, NULL, NULL, NULL, 0
|
||||
ZEND_API const zend_fcall_info_cache empty_fcall_info_cache = { 0, NULL, NULL, NULL, NULL };
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
#ifdef ZTS
|
||||
__declspec(thread)
|
||||
#endif
|
||||
HANDLE tq_timer = NULL;
|
||||
#include <process.h>
|
||||
static WNDCLASS wc;
|
||||
static HWND timeout_window;
|
||||
static HANDLE timeout_thread_event;
|
||||
static HANDLE timeout_thread_handle;
|
||||
static DWORD timeout_thread_id;
|
||||
static int timeout_thread_initialized=0;
|
||||
#endif
|
||||
|
||||
#if 0&&ZEND_DEBUG
|
||||
@@ -106,7 +109,7 @@ static int clean_non_persistent_function(zend_function *function TSRMLS_DC) /* {
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */
|
||||
static int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
@@ -118,7 +121,7 @@ static int clean_non_persistent_class(zend_class_entry **ce TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */
|
||||
static int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return ((*ce)->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
@@ -440,20 +443,36 @@ ZEND_API void _zval_internal_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) /* {{{
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_is_true(zval *op) /* {{{ */
|
||||
ZEND_API int zend_is_true(zval *op TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return i_zend_is_true(op);
|
||||
return i_zend_is_true(op TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#define IS_VISITED_CONSTANT 0x80
|
||||
#include "../TSRM/tsrm_strtok_r.h"
|
||||
|
||||
#define IS_VISITED_CONSTANT IS_CONSTANT_INDEX
|
||||
#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_P(p) |= IS_VISITED_CONSTANT
|
||||
|
||||
ZEND_API int zval_update_constant_ex(zval **pp, zend_bool inline_change, zend_class_entry *scope TSRMLS_DC) /* {{{ */
|
||||
static void zval_deep_copy(zval **p)
|
||||
{
|
||||
zval *value;
|
||||
|
||||
ALLOC_ZVAL(value);
|
||||
*value = **p;
|
||||
Z_TYPE_P(value) &= ~IS_CONSTANT_INDEX;
|
||||
zval_copy_ctor(value);
|
||||
Z_TYPE_P(value) = Z_TYPE_PP(p);
|
||||
INIT_PZVAL(value);
|
||||
*p = value;
|
||||
}
|
||||
|
||||
ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval *p = *pp;
|
||||
zend_bool inline_change = (zend_bool) (zend_uintptr_t) arg;
|
||||
zval const_value;
|
||||
char *colon;
|
||||
|
||||
@@ -540,6 +559,110 @@ ZEND_API int zval_update_constant_ex(zval **pp, zend_bool inline_change, zend_cl
|
||||
|
||||
Z_SET_REFCOUNT_P(p, refcount);
|
||||
Z_SET_ISREF_TO_P(p, is_ref);
|
||||
} else if (Z_TYPE_P(p) == IS_CONSTANT_ARRAY) {
|
||||
zval **element, *new_val;
|
||||
char *str_index;
|
||||
uint str_index_len;
|
||||
ulong num_index;
|
||||
int ret;
|
||||
|
||||
SEPARATE_ZVAL_IF_NOT_REF(pp);
|
||||
p = *pp;
|
||||
Z_TYPE_P(p) = IS_ARRAY;
|
||||
|
||||
if (!inline_change) {
|
||||
zval *tmp;
|
||||
HashTable *tmp_ht = NULL;
|
||||
|
||||
ALLOC_HASHTABLE(tmp_ht);
|
||||
zend_hash_init(tmp_ht, zend_hash_num_elements(Z_ARRVAL_P(p)), NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_copy(tmp_ht, Z_ARRVAL_P(p), (copy_ctor_func_t) zval_deep_copy, (void *) &tmp, sizeof(zval *));
|
||||
Z_ARRVAL_P(p) = tmp_ht;
|
||||
}
|
||||
|
||||
/* First go over the array and see if there are any constant indices */
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(p));
|
||||
while (zend_hash_get_current_data(Z_ARRVAL_P(p), (void **) &element) == SUCCESS) {
|
||||
if (!(Z_TYPE_PP(element) & IS_CONSTANT_INDEX)) {
|
||||
zend_hash_move_forward(Z_ARRVAL_P(p));
|
||||
continue;
|
||||
}
|
||||
Z_TYPE_PP(element) &= ~IS_CONSTANT_INDEX;
|
||||
if (zend_hash_get_current_key_ex(Z_ARRVAL_P(p), &str_index, &str_index_len, &num_index, 0, NULL) != HASH_KEY_IS_STRING) {
|
||||
zend_hash_move_forward(Z_ARRVAL_P(p));
|
||||
continue;
|
||||
}
|
||||
if (str_index[str_index_len - 2] == IS_CONSTANT_AST) {
|
||||
zend_ast_evaluate(&const_value, *(zend_ast **)str_index, scope TSRMLS_CC);
|
||||
zend_ast_destroy(*(zend_ast **)str_index);
|
||||
} else if (!zend_get_constant_ex(str_index, str_index_len - 3, &const_value, scope, str_index[str_index_len - 2] TSRMLS_CC)) {
|
||||
char *actual;
|
||||
const char *save = str_index;
|
||||
if ((colon = (char*)zend_memrchr(str_index, ':', str_index_len - 3))) {
|
||||
zend_error(E_ERROR, "Undefined class constant '%s'", str_index);
|
||||
str_index_len -= ((colon - str_index) + 1);
|
||||
str_index = colon;
|
||||
} else {
|
||||
if (str_index[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) {
|
||||
if ((actual = (char *)zend_memrchr(str_index, '\\', str_index_len - 3))) {
|
||||
actual++;
|
||||
str_index_len -= (actual - str_index);
|
||||
str_index = actual;
|
||||
}
|
||||
}
|
||||
if (str_index[0] == '\\') {
|
||||
++str_index;
|
||||
--str_index_len;
|
||||
}
|
||||
if (save[0] == '\\') {
|
||||
++save;
|
||||
}
|
||||
if ((str_index[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) == 0) {
|
||||
zend_error(E_ERROR, "Undefined constant '%s'", save);
|
||||
}
|
||||
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", str_index, str_index);
|
||||
}
|
||||
ZVAL_STRINGL(&const_value, str_index, str_index_len-3, 1);
|
||||
}
|
||||
|
||||
if (Z_REFCOUNT_PP(element) > 1) {
|
||||
ALLOC_ZVAL(new_val);
|
||||
*new_val = **element;
|
||||
zval_copy_ctor(new_val);
|
||||
Z_SET_REFCOUNT_P(new_val, 1);
|
||||
Z_UNSET_ISREF_P(new_val);
|
||||
|
||||
/* preserve this bit for inheritance */
|
||||
Z_TYPE_PP(element) |= IS_CONSTANT_INDEX;
|
||||
zval_ptr_dtor(element);
|
||||
*element = new_val;
|
||||
}
|
||||
|
||||
switch (Z_TYPE(const_value)) {
|
||||
case IS_STRING:
|
||||
ret = zend_symtable_update_current_key(Z_ARRVAL_P(p), Z_STRVAL(const_value), Z_STRLEN(const_value) + 1, HASH_UPDATE_KEY_IF_BEFORE);
|
||||
break;
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, Z_LVAL(const_value), HASH_UPDATE_KEY_IF_BEFORE, NULL);
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, zend_dval_to_lval(Z_DVAL(const_value)), HASH_UPDATE_KEY_IF_BEFORE, NULL);
|
||||
break;
|
||||
case IS_NULL:
|
||||
ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, "", 1, 0, HASH_UPDATE_KEY_IF_BEFORE, NULL);
|
||||
break;
|
||||
default:
|
||||
ret = SUCCESS;
|
||||
break;
|
||||
}
|
||||
if (ret == SUCCESS) {
|
||||
zend_hash_move_forward(Z_ARRVAL_P(p));
|
||||
}
|
||||
zval_dtor(&const_value);
|
||||
}
|
||||
zend_hash_apply_with_argument(Z_ARRVAL_P(p), (apply_func_arg_t) zval_update_constant_inline_change, (void *) scope TSRMLS_CC);
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(p));
|
||||
} else if (Z_TYPE_P(p) == IS_CONSTANT_AST) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(pp);
|
||||
p = *pp;
|
||||
@@ -554,21 +677,21 @@ ZEND_API int zval_update_constant_ex(zval **pp, zend_bool inline_change, zend_cl
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zval_update_constant_inline_change(zval **pp, zend_class_entry *scope TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zval_update_constant_inline_change(zval **pp, void *scope TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return zval_update_constant_ex(pp, 1, scope TSRMLS_CC);
|
||||
return zval_update_constant_ex(pp, (void*)1, scope TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zval_update_constant_no_inline_change(zval **pp, zend_class_entry *scope TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zval_update_constant_no_inline_change(zval **pp, void *scope TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return zval_update_constant_ex(pp, 0, scope TSRMLS_CC);
|
||||
return zval_update_constant_ex(pp, (void*)0, scope TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zval_update_constant(zval **pp, zend_bool inline_change TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return zval_update_constant_ex(pp, inline_change, NULL TSRMLS_CC);
|
||||
return zval_update_constant_ex(pp, arg, NULL TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1231,19 +1354,111 @@ ZEND_API void zend_timeout(int dummy) /* {{{ */
|
||||
/* }}} */
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
VOID CALLBACK tq_timer_cb(PVOID arg, BOOLEAN timed_out)
|
||||
static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) /* {{{ */
|
||||
{
|
||||
zend_bool *php_timed_out;
|
||||
switch (message) {
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
case WM_REGISTER_ZEND_TIMEOUT:
|
||||
/* wParam is the thread id pointer, lParam is the timeout amount in seconds */
|
||||
if (lParam == 0) {
|
||||
KillTimer(timeout_window, wParam);
|
||||
} else {
|
||||
#ifdef ZTS
|
||||
void ***tsrm_ls;
|
||||
#endif
|
||||
SetTimer(timeout_window, wParam, lParam*1000, NULL);
|
||||
#ifdef ZTS
|
||||
tsrm_ls = ts_resource_ex(0, &wParam);
|
||||
if (!tsrm_ls) {
|
||||
/* shouldn't normally happen */
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
EG(timed_out) = 0;
|
||||
}
|
||||
break;
|
||||
case WM_UNREGISTER_ZEND_TIMEOUT:
|
||||
/* wParam is the thread id pointer */
|
||||
KillTimer(timeout_window, wParam);
|
||||
break;
|
||||
case WM_TIMER: {
|
||||
#ifdef ZTS
|
||||
void ***tsrm_ls;
|
||||
|
||||
/* The doc states it'll be always true, however it theoretically
|
||||
could be FALSE when the thread was signaled. */
|
||||
if (!timed_out) {
|
||||
tsrm_ls = ts_resource_ex(0, &wParam);
|
||||
if (!tsrm_ls) {
|
||||
/* Thread died before receiving its timeout? */
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
KillTimer(timeout_window, wParam);
|
||||
EG(timed_out) = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static unsigned __stdcall timeout_thread_proc(void *pArgs) /* {{{ */
|
||||
{
|
||||
MSG message;
|
||||
|
||||
wc.style=0;
|
||||
wc.lpfnWndProc = zend_timeout_WndProc;
|
||||
wc.cbClsExtra=0;
|
||||
wc.cbWndExtra=0;
|
||||
wc.hInstance=NULL;
|
||||
wc.hIcon=NULL;
|
||||
wc.hCursor=NULL;
|
||||
wc.hbrBackground=(HBRUSH)(COLOR_BACKGROUND + 5);
|
||||
wc.lpszMenuName=NULL;
|
||||
wc.lpszClassName = "Zend Timeout Window";
|
||||
if (!RegisterClass(&wc)) {
|
||||
return -1;
|
||||
}
|
||||
timeout_window = CreateWindow(wc.lpszClassName, wc.lpszClassName, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL);
|
||||
SetEvent(timeout_thread_event);
|
||||
while (GetMessage(&message, NULL, 0, 0)) {
|
||||
SendMessage(timeout_window, message.message, message.wParam, message.lParam);
|
||||
if (message.message == WM_QUIT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
DestroyWindow(timeout_window);
|
||||
UnregisterClass(wc.lpszClassName, NULL);
|
||||
SetEvent(timeout_thread_handle);
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_init_timeout_thread(void) /* {{{ */
|
||||
{
|
||||
timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
timeout_thread_handle = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
_beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0, &timeout_thread_id);
|
||||
WaitForSingleObject(timeout_thread_event, INFINITE);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_shutdown_timeout_thread(void) /* {{{ */
|
||||
{
|
||||
if (!timeout_thread_initialized) {
|
||||
return;
|
||||
}
|
||||
PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0);
|
||||
|
||||
php_timed_out = (zend_bool *)arg;
|
||||
*php_timed_out = 1;
|
||||
/* Wait for thread termination */
|
||||
WaitForSingleObject(timeout_thread_handle, 5000);
|
||||
CloseHandle(timeout_thread_handle);
|
||||
timeout_thread_initialized = 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#endif
|
||||
|
||||
/* This one doesn't exists on QNX */
|
||||
@@ -1261,28 +1476,13 @@ void zend_set_timeout(long seconds, int reset_signals) /* {{{ */
|
||||
if(!seconds) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Don't use ChangeTimerQueueTimer() as it will not restart an expired
|
||||
timer, so we could end up with just an ignored timeout. Instead
|
||||
delete and recreate. */
|
||||
if (NULL != tq_timer) {
|
||||
if (!DeleteTimerQueueTimer(NULL, tq_timer, NULL)) {
|
||||
EG(timed_out) = 0;
|
||||
tq_timer = NULL;
|
||||
zend_error(E_ERROR, "Could not delete queued timer");
|
||||
return;
|
||||
}
|
||||
tq_timer = NULL;
|
||||
if (timeout_thread_initialized == 0 && InterlockedIncrement(&timeout_thread_initialized) == 1) {
|
||||
/* We start up this process-wide thread here and not in zend_startup(), because if Zend
|
||||
* is initialized inside a DllMain(), you're not supposed to start threads from it.
|
||||
*/
|
||||
zend_init_timeout_thread();
|
||||
}
|
||||
|
||||
/* XXX passing NULL means the default timer queue provided by the system is used */
|
||||
if (!CreateTimerQueueTimer(&tq_timer, NULL, (WAITORTIMERCALLBACK)tq_timer_cb, (VOID*)&EG(timed_out), seconds*1000, 0, WT_EXECUTEONLYONCE)) {
|
||||
EG(timed_out) = 0;
|
||||
tq_timer = NULL;
|
||||
zend_error(E_ERROR, "Could not queue new timer");
|
||||
return;
|
||||
}
|
||||
EG(timed_out) = 0;
|
||||
PostThreadMessage(timeout_thread_id, WM_REGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) seconds);
|
||||
#else
|
||||
# ifdef HAVE_SETITIMER
|
||||
{
|
||||
@@ -1324,16 +1524,9 @@ void zend_set_timeout(long seconds, int reset_signals) /* {{{ */
|
||||
void zend_unset_timeout(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
#ifdef ZEND_WIN32
|
||||
if (NULL != tq_timer) {
|
||||
if (!DeleteTimerQueueTimer(NULL, tq_timer, NULL)) {
|
||||
EG(timed_out) = 0;
|
||||
tq_timer = NULL;
|
||||
zend_error(E_ERROR, "Could not delete queued timer");
|
||||
return;
|
||||
}
|
||||
tq_timer = NULL;
|
||||
if(timeout_thread_initialized) {
|
||||
PostThreadMessage(timeout_thread_id, WM_UNREGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) 0);
|
||||
}
|
||||
EG(timed_out) = 0;
|
||||
#else
|
||||
# ifdef HAVE_SETITIMER
|
||||
if (EG(timeout_seconds)) {
|
||||
@@ -1583,6 +1776,13 @@ ZEND_API void zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */
|
||||
/*printf("Cache miss! Initialized %x\n", EG(active_symbol_table));*/
|
||||
}
|
||||
ex->symbol_table = EG(active_symbol_table);
|
||||
|
||||
if (ex->op_array->this_var != -1 &&
|
||||
!*EX_CV_NUM(ex, ex->op_array->this_var) &&
|
||||
EG(This)) {
|
||||
*EX_CV_NUM(ex, ex->op_array->this_var) = (zval**)EX_CV_NUM(ex, ex->op_array->last_var + ex->op_array->this_var);
|
||||
**EX_CV_NUM(ex, ex->op_array->this_var) = EG(This);
|
||||
}
|
||||
for (i = 0; i < ex->op_array->last_var; i++) {
|
||||
if (*EX_CV_NUM(ex, i)) {
|
||||
zend_hash_quick_update(EG(active_symbol_table),
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
ZEND_API zend_llist zend_extensions;
|
||||
static int last_resource_number;
|
||||
|
||||
int zend_load_extension(const char *path)
|
||||
int zend_load_extension(const char *path TSRMLS_DC)
|
||||
{
|
||||
#if ZEND_EXTENSIONS_SUPPORT
|
||||
DL_HANDLE handle;
|
||||
@@ -107,7 +107,7 @@ int zend_load_extension(const char *path)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
return zend_register_extension(new_extension, handle);
|
||||
return zend_register_extension(new_extension, handle TSRMLS_CC);
|
||||
#else
|
||||
fprintf(stderr, "Extensions are not supported on this platform.\n");
|
||||
/* See http://support.microsoft.com/kb/190351 */
|
||||
@@ -119,7 +119,7 @@ int zend_load_extension(const char *path)
|
||||
}
|
||||
|
||||
|
||||
int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle)
|
||||
int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle TSRMLS_DC)
|
||||
{
|
||||
#if ZEND_EXTENSIONS_SUPPORT
|
||||
zend_extension extension;
|
||||
@@ -127,7 +127,7 @@ int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle)
|
||||
extension = *new_extension;
|
||||
extension.handle = handle;
|
||||
|
||||
zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension);
|
||||
zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension TSRMLS_CC);
|
||||
|
||||
zend_llist_add_element(&zend_extensions, &extension);
|
||||
|
||||
@@ -208,10 +208,8 @@ static void zend_extension_message_dispatcher(const zend_extension *extension, i
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_extension_dispatch_message(int message, void *arg)
|
||||
ZEND_API void zend_extension_dispatch_message(int message, void *arg TSRMLS_DC)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
zend_llist_apply_with_arguments(&zend_extensions, (llist_apply_with_args_func_t) zend_extension_message_dispatcher TSRMLS_CC, 2, message, arg);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
/* The first number is the engine version and the rest is the date.
|
||||
* This way engine 2/3 API no. is always greater than engine 1 API no..
|
||||
*/
|
||||
#define ZEND_EXTENSION_API_NO 220131226
|
||||
#define ZEND_EXTENSION_API_NO 220131227
|
||||
|
||||
typedef struct _zend_extension_version_info {
|
||||
int zend_extension_api_no;
|
||||
@@ -94,7 +94,7 @@ struct _zend_extension {
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API int zend_get_resource_handle(zend_extension *extension);
|
||||
ZEND_API void zend_extension_dispatch_message(int message, void *arg);
|
||||
ZEND_API void zend_extension_dispatch_message(int message, void *arg TSRMLS_DC);
|
||||
END_EXTERN_C()
|
||||
|
||||
#define ZEND_EXTMSG_NEW_EXTENSION 1
|
||||
@@ -111,14 +111,14 @@ END_EXTERN_C()
|
||||
ZEND_API extern zend_llist zend_extensions;
|
||||
|
||||
void zend_extension_dtor(zend_extension *extension);
|
||||
ZEND_API void zend_append_version_info(const zend_extension *extension);
|
||||
void zend_append_version_info(const zend_extension *extension);
|
||||
int zend_startup_extensions_mechanism(void);
|
||||
int zend_startup_extensions(void);
|
||||
void zend_shutdown_extensions(TSRMLS_D);
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API int zend_load_extension(const char *path);
|
||||
ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle);
|
||||
ZEND_API int zend_load_extension(const char *path TSRMLS_DC);
|
||||
ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle TSRMLS_DC);
|
||||
ZEND_API zend_extension *zend_get_extension(const char *extension_name);
|
||||
END_EXTERN_C()
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#ifndef ZEND_FLOAT_H
|
||||
#define ZEND_FLOAT_H
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
/*
|
||||
Define functions for FP initialization and de-initialization.
|
||||
*/
|
||||
@@ -30,8 +28,6 @@ extern ZEND_API void zend_init_fpu(TSRMLS_D);
|
||||
extern ZEND_API void zend_shutdown_fpu(TSRMLS_D);
|
||||
extern ZEND_API void zend_ensure_fpu_mode(TSRMLS_D);
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
/* Copy of the contents of xpfpa.h (which is under public domain)
|
||||
See http://wiki.php.net/rfc/rounding for details.
|
||||
|
||||
|
||||
@@ -125,7 +125,6 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
|
||||
/* A fatal error / die occurred during the generator execution. Trying to clean
|
||||
* up the stack may not be safe in this case. */
|
||||
if (CG(unclean_shutdown)) {
|
||||
generator->execute_data = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -283,7 +283,7 @@ struct _zend_ini_scanner_globals {
|
||||
char *filename;
|
||||
int lineno;
|
||||
|
||||
/* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW, ZEND_INI_SCANNER_TYPED */
|
||||
/* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW */
|
||||
int scanner_mode;
|
||||
};
|
||||
|
||||
|
||||
+221
-195
@@ -29,24 +29,18 @@
|
||||
(element)->pNext->pLast = (element); \
|
||||
}
|
||||
|
||||
#define CONNECT_TO_GLOBAL_DLLIST_EX(element, ht, last, next)\
|
||||
(element)->pListLast = (last); \
|
||||
(element)->pListNext = (next); \
|
||||
if ((last) != NULL) { \
|
||||
(last)->pListNext = (element); \
|
||||
} else { \
|
||||
#define CONNECT_TO_GLOBAL_DLLIST(element, ht) \
|
||||
(element)->pListLast = (ht)->pListTail; \
|
||||
(ht)->pListTail = (element); \
|
||||
(element)->pListNext = NULL; \
|
||||
if ((element)->pListLast != NULL) { \
|
||||
(element)->pListLast->pListNext = (element); \
|
||||
} \
|
||||
if (!(ht)->pListHead) { \
|
||||
(ht)->pListHead = (element); \
|
||||
} \
|
||||
if ((next) != NULL) { \
|
||||
(next)->pListLast = (element); \
|
||||
} else { \
|
||||
(ht)->pListTail = (element); \
|
||||
} \
|
||||
|
||||
#define CONNECT_TO_GLOBAL_DLLIST(element, ht) \
|
||||
CONNECT_TO_GLOBAL_DLLIST_EX(element, ht, (ht)->pListTail, (Bucket *) NULL); \
|
||||
if ((ht)->pInternalPointer == NULL) { \
|
||||
(ht)->pInternalPointer = (element); \
|
||||
if ((ht)->pInternalPointer == NULL) { \
|
||||
(ht)->pInternalPointer = (element); \
|
||||
}
|
||||
|
||||
#if ZEND_DEBUG
|
||||
@@ -128,13 +122,13 @@ ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength)
|
||||
memcpy((p)->pData, pData, nDataSize); \
|
||||
}
|
||||
|
||||
#define INIT_DATA(ht, p, _pData, nDataSize); \
|
||||
#define INIT_DATA(ht, p, pData, nDataSize); \
|
||||
if (nDataSize == sizeof(void*)) { \
|
||||
memcpy(&(p)->pDataPtr, (_pData), sizeof(void *)); \
|
||||
memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
|
||||
(p)->pData = &(p)->pDataPtr; \
|
||||
} else { \
|
||||
(p)->pData = (void *) pemalloc_rel(nDataSize, (ht)->persistent);\
|
||||
memcpy((p)->pData, (_pData), nDataSize); \
|
||||
memcpy((p)->pData, pData, nDataSize); \
|
||||
(p)->pDataPtr=NULL; \
|
||||
}
|
||||
|
||||
@@ -147,51 +141,6 @@ ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength)
|
||||
|
||||
static const Bucket *uninitialized_bucket = NULL;
|
||||
|
||||
static zend_always_inline void i_zend_hash_bucket_delete(HashTable *ht, Bucket *p)
|
||||
{
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
if (p->pLast) {
|
||||
p->pLast->pNext = p->pNext;
|
||||
} else {
|
||||
ht->arBuckets[p->h & ht->nTableMask] = p->pNext;
|
||||
}
|
||||
if (p->pNext) {
|
||||
p->pNext->pLast = p->pLast;
|
||||
}
|
||||
if (p->pListLast != NULL) {
|
||||
p->pListLast->pListNext = p->pListNext;
|
||||
} else {
|
||||
/* Deleting the head of the list */
|
||||
ht->pListHead = p->pListNext;
|
||||
}
|
||||
if (p->pListNext != NULL) {
|
||||
p->pListNext->pListLast = p->pListLast;
|
||||
} else {
|
||||
/* Deleting the tail of the list */
|
||||
ht->pListTail = p->pListLast;
|
||||
}
|
||||
if (ht->pInternalPointer == p) {
|
||||
ht->pInternalPointer = p->pListNext;
|
||||
}
|
||||
ht->nNumOfElements--;
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(p->pData);
|
||||
}
|
||||
if (p->pData != &p->pDataPtr) {
|
||||
pefree(p->pData, ht->persistent);
|
||||
}
|
||||
pefree(p, ht->persistent);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
}
|
||||
|
||||
static void zend_hash_bucket_delete(HashTable *ht, Bucket *p) {
|
||||
i_zend_hash_bucket_delete(ht, p);
|
||||
}
|
||||
|
||||
ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
|
||||
{
|
||||
uint i = 3;
|
||||
@@ -409,6 +358,9 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void
|
||||
}
|
||||
UPDATE_DATA(ht, p, pData, nDataSize);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
if ((long)h >= (long)ht->nNextFreeElement) {
|
||||
ht->nNextFreeElement = h < LONG_MAX ? h + 1 : LONG_MAX;
|
||||
}
|
||||
if (pDest) {
|
||||
*pDest = p->pData;
|
||||
}
|
||||
@@ -472,43 +424,23 @@ ZEND_API int zend_hash_rehash(HashTable *ht)
|
||||
}
|
||||
|
||||
memset(ht->arBuckets, 0, ht->nTableSize * sizeof(Bucket *));
|
||||
for (p = ht->pListHead; p != NULL; p = p->pListNext) {
|
||||
p = ht->pListHead;
|
||||
while (p != NULL) {
|
||||
nIndex = p->h & ht->nTableMask;
|
||||
CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]);
|
||||
ht->arBuckets[nIndex] = p;
|
||||
p = p->pListNext;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
ZEND_API void zend_hash_reindex(HashTable *ht, zend_bool only_integer_keys) {
|
||||
Bucket *p;
|
||||
uint nIndex;
|
||||
ulong offset = 0;
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
if (UNEXPECTED(ht->nNumOfElements == 0)) {
|
||||
ht->nNextFreeElement = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
memset(ht->arBuckets, 0, ht->nTableSize * sizeof(Bucket *));
|
||||
for (p = ht->pListHead; p != NULL; p = p->pListNext) {
|
||||
if (!only_integer_keys || p->nKeyLength == 0) {
|
||||
p->h = offset++;
|
||||
p->nKeyLength = 0;
|
||||
}
|
||||
|
||||
nIndex = p->h & ht->nTableMask;
|
||||
CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]);
|
||||
ht->arBuckets[nIndex] = p;
|
||||
}
|
||||
ht->nNextFreeElement = offset;
|
||||
}
|
||||
|
||||
ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, int flag)
|
||||
{
|
||||
uint nIndex;
|
||||
Bucket *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
|
||||
@@ -523,7 +455,38 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint n
|
||||
&& (p->nKeyLength == nKeyLength)
|
||||
&& ((p->nKeyLength == 0) /* Numeric index (short circuits the memcmp() check) */
|
||||
|| !memcmp(p->arKey, arKey, nKeyLength))) { /* String index */
|
||||
i_zend_hash_bucket_delete(ht, p);
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
if (p == ht->arBuckets[nIndex]) {
|
||||
ht->arBuckets[nIndex] = p->pNext;
|
||||
} else {
|
||||
p->pLast->pNext = p->pNext;
|
||||
}
|
||||
if (p->pNext) {
|
||||
p->pNext->pLast = p->pLast;
|
||||
}
|
||||
if (p->pListLast != NULL) {
|
||||
p->pListLast->pListNext = p->pListNext;
|
||||
} else {
|
||||
/* Deleting the head of the list */
|
||||
ht->pListHead = p->pListNext;
|
||||
}
|
||||
if (p->pListNext != NULL) {
|
||||
p->pListNext->pListLast = p->pListLast;
|
||||
} else {
|
||||
ht->pListTail = p->pListLast;
|
||||
}
|
||||
if (ht->pInternalPointer == p) {
|
||||
ht->pInternalPointer = p->pListNext;
|
||||
}
|
||||
ht->nNumOfElements--;
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(p->pData);
|
||||
}
|
||||
if (p->pData != &p->pDataPtr) {
|
||||
pefree(p->pData, ht->persistent);
|
||||
}
|
||||
pefree(p, ht->persistent);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return SUCCESS;
|
||||
}
|
||||
p = p->pNext;
|
||||
@@ -590,14 +553,73 @@ ZEND_API void zend_hash_clean(HashTable *ht)
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void zend_hash_graceful_destroy(HashTable *ht)
|
||||
/* This function is used by the various apply() functions.
|
||||
* It deletes the passed bucket, and returns the address of the
|
||||
* next bucket. The hash *may* be altered during that time, the
|
||||
* returned value will still be valid.
|
||||
*/
|
||||
static Bucket *zend_hash_apply_deleter(HashTable *ht, Bucket *p)
|
||||
{
|
||||
IS_CONSISTENT(ht);
|
||||
Bucket *retval;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
while (ht->pListHead != NULL) {
|
||||
zend_hash_bucket_delete(ht, ht->pListHead);
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
if (p->pLast) {
|
||||
p->pLast->pNext = p->pNext;
|
||||
} else {
|
||||
uint nIndex;
|
||||
|
||||
nIndex = p->h & ht->nTableMask;
|
||||
ht->arBuckets[nIndex] = p->pNext;
|
||||
}
|
||||
if (p->pNext) {
|
||||
p->pNext->pLast = p->pLast;
|
||||
} else {
|
||||
/* Nothing to do as this list doesn't have a tail */
|
||||
}
|
||||
|
||||
if (p->pListLast != NULL) {
|
||||
p->pListLast->pListNext = p->pListNext;
|
||||
} else {
|
||||
/* Deleting the head of the list */
|
||||
ht->pListHead = p->pListNext;
|
||||
}
|
||||
if (p->pListNext != NULL) {
|
||||
p->pListNext->pListLast = p->pListLast;
|
||||
} else {
|
||||
ht->pListTail = p->pListLast;
|
||||
}
|
||||
if (ht->pInternalPointer == p) {
|
||||
ht->pInternalPointer = p->pListNext;
|
||||
}
|
||||
ht->nNumOfElements--;
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(p->pData);
|
||||
}
|
||||
if (p->pData != &p->pDataPtr) {
|
||||
pefree(p->pData, ht->persistent);
|
||||
}
|
||||
retval = p->pListNext;
|
||||
pefree(p, ht->persistent);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_hash_graceful_destroy(HashTable *ht)
|
||||
{
|
||||
Bucket *p;
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
|
||||
p = ht->pListHead;
|
||||
while (p != NULL) {
|
||||
p = zend_hash_apply_deleter(ht, p);
|
||||
}
|
||||
if (ht->nTableMask) {
|
||||
pefree(ht->arBuckets, ht->persistent);
|
||||
}
|
||||
@@ -607,10 +629,14 @@ ZEND_API void zend_hash_graceful_destroy(HashTable *ht)
|
||||
|
||||
ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht)
|
||||
{
|
||||
Bucket *p;
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
|
||||
while (ht->pListTail != NULL) {
|
||||
zend_hash_bucket_delete(ht, ht->pListTail);
|
||||
p = ht->pListTail;
|
||||
while (p != NULL) {
|
||||
zend_hash_apply_deleter(ht, p);
|
||||
p = ht->pListTail;
|
||||
}
|
||||
|
||||
if (ht->nTableMask) {
|
||||
@@ -639,13 +665,12 @@ ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
|
||||
p = ht->pListHead;
|
||||
while (p != NULL) {
|
||||
int result = apply_func(p->pData TSRMLS_CC);
|
||||
|
||||
Bucket *p_next = p->pListNext;
|
||||
|
||||
if (result & ZEND_HASH_APPLY_REMOVE) {
|
||||
zend_hash_bucket_delete(ht, p);
|
||||
p = zend_hash_apply_deleter(ht, p);
|
||||
} else {
|
||||
p = p->pListNext;
|
||||
}
|
||||
p = p_next;
|
||||
|
||||
if (result & ZEND_HASH_APPLY_STOP) {
|
||||
break;
|
||||
}
|
||||
@@ -665,12 +690,11 @@ ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t appl
|
||||
while (p != NULL) {
|
||||
int result = apply_func(p->pData, argument TSRMLS_CC);
|
||||
|
||||
Bucket *p_next = p->pListNext;
|
||||
if (result & ZEND_HASH_APPLY_REMOVE) {
|
||||
zend_hash_bucket_delete(ht, p);
|
||||
p = zend_hash_apply_deleter(ht, p);
|
||||
} else {
|
||||
p = p->pListNext;
|
||||
}
|
||||
p = p_next;
|
||||
|
||||
if (result & ZEND_HASH_APPLY_STOP) {
|
||||
break;
|
||||
}
|
||||
@@ -692,20 +716,17 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func
|
||||
p = ht->pListHead;
|
||||
while (p != NULL) {
|
||||
int result;
|
||||
Bucket *p_next;
|
||||
|
||||
va_start(args, num_args);
|
||||
hash_key.arKey = p->arKey;
|
||||
hash_key.nKeyLength = p->nKeyLength;
|
||||
hash_key.h = p->h;
|
||||
result = apply_func(p->pData TSRMLS_CC, num_args, args, &hash_key);
|
||||
|
||||
p_next = p->pListNext;
|
||||
if (result & ZEND_HASH_APPLY_REMOVE) {
|
||||
zend_hash_bucket_delete(ht, p);
|
||||
p = zend_hash_apply_deleter(ht, p);
|
||||
} else {
|
||||
p = p->pListNext;
|
||||
}
|
||||
p = p_next;
|
||||
|
||||
if (result & ZEND_HASH_APPLY_STOP) {
|
||||
va_end(args);
|
||||
break;
|
||||
@@ -719,7 +740,7 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func
|
||||
|
||||
ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
|
||||
{
|
||||
Bucket *p;
|
||||
Bucket *p, *q;
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
|
||||
@@ -728,12 +749,11 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR
|
||||
while (p != NULL) {
|
||||
int result = apply_func(p->pData TSRMLS_CC);
|
||||
|
||||
Bucket *p_last = p->pListLast;
|
||||
q = p;
|
||||
p = p->pListLast;
|
||||
if (result & ZEND_HASH_APPLY_REMOVE) {
|
||||
zend_hash_bucket_delete(ht, p);
|
||||
zend_hash_apply_deleter(ht, q);
|
||||
}
|
||||
p = p_last;
|
||||
|
||||
if (result & ZEND_HASH_APPLY_STOP) {
|
||||
break;
|
||||
}
|
||||
@@ -1203,6 +1223,8 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
if (q) {
|
||||
if (mode != HASH_UPDATE_KEY_ANYWAY) {
|
||||
Bucket *r = p->pListLast;
|
||||
@@ -1217,17 +1239,73 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
|
||||
}
|
||||
if (mode & found) {
|
||||
/* delete current bucket */
|
||||
zend_hash_bucket_delete(ht, p);
|
||||
if (p == ht->arBuckets[p->h & ht->nTableMask]) {
|
||||
ht->arBuckets[p->h & ht->nTableMask] = p->pNext;
|
||||
} else {
|
||||
p->pLast->pNext = p->pNext;
|
||||
}
|
||||
if (p->pNext) {
|
||||
p->pNext->pLast = p->pLast;
|
||||
}
|
||||
if (p->pListLast != NULL) {
|
||||
p->pListLast->pListNext = p->pListNext;
|
||||
} else {
|
||||
/* Deleting the head of the list */
|
||||
ht->pListHead = p->pListNext;
|
||||
}
|
||||
if (p->pListNext != NULL) {
|
||||
p->pListNext->pListLast = p->pListLast;
|
||||
} else {
|
||||
ht->pListTail = p->pListLast;
|
||||
}
|
||||
if (ht->pInternalPointer == p) {
|
||||
ht->pInternalPointer = p->pListNext;
|
||||
}
|
||||
ht->nNumOfElements--;
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(p->pData);
|
||||
}
|
||||
if (p->pData != &p->pDataPtr) {
|
||||
pefree(p->pData, ht->persistent);
|
||||
}
|
||||
pefree(p, ht->persistent);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/* delete another bucket with the same key */
|
||||
zend_hash_bucket_delete(ht, q);
|
||||
if (q == ht->arBuckets[q->h & ht->nTableMask]) {
|
||||
ht->arBuckets[q->h & ht->nTableMask] = q->pNext;
|
||||
} else {
|
||||
q->pLast->pNext = q->pNext;
|
||||
}
|
||||
if (q->pNext) {
|
||||
q->pNext->pLast = q->pLast;
|
||||
}
|
||||
if (q->pListLast != NULL) {
|
||||
q->pListLast->pListNext = q->pListNext;
|
||||
} else {
|
||||
/* Deleting the head of the list */
|
||||
ht->pListHead = q->pListNext;
|
||||
}
|
||||
if (q->pListNext != NULL) {
|
||||
q->pListNext->pListLast = q->pListLast;
|
||||
} else {
|
||||
ht->pListTail = q->pListLast;
|
||||
}
|
||||
if (ht->pInternalPointer == q) {
|
||||
ht->pInternalPointer = q->pListNext;
|
||||
}
|
||||
ht->nNumOfElements--;
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(q->pData);
|
||||
}
|
||||
if (q->pData != &q->pDataPtr) {
|
||||
pefree(q->pData, ht->persistent);
|
||||
}
|
||||
pefree(q, ht->persistent);
|
||||
}
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
if (p->pNext) {
|
||||
p->pNext->pLast = p->pLast;
|
||||
}
|
||||
@@ -1254,12 +1332,21 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
|
||||
q->pData = p->pData;
|
||||
}
|
||||
q->pDataPtr = p->pDataPtr;
|
||||
|
||||
CONNECT_TO_GLOBAL_DLLIST_EX(q, ht, p->pListLast, p->pListNext);
|
||||
q->pListNext = p->pListNext;
|
||||
q->pListLast = p->pListLast;
|
||||
if (q->pListNext) {
|
||||
p->pListNext->pListLast = q;
|
||||
} else {
|
||||
ht->pListTail = q;
|
||||
}
|
||||
if (q->pListLast) {
|
||||
p->pListLast->pListNext = q;
|
||||
} else {
|
||||
ht->pListHead = q;
|
||||
}
|
||||
if (ht->pInternalPointer == p) {
|
||||
ht->pInternalPointer = q;
|
||||
}
|
||||
|
||||
if (pos) {
|
||||
*pos = q;
|
||||
}
|
||||
@@ -1290,75 +1377,6 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
|
||||
}
|
||||
}
|
||||
|
||||
/* Performs an in-place splice operation on a hashtable:
|
||||
* The elements between offset and offset+length are removed and the elements in list[list_count]
|
||||
* are inserted in their place. The removed elements can be optionally collected into a hashtable.
|
||||
* This operation reindexes the hashtable, i.e. integer keys will be zero-based and sequential,
|
||||
* while string keys stay intact. The same applies to the elements inserted into the removed HT. */
|
||||
ZEND_API void _zend_hash_splice(HashTable *ht, uint nDataSize, copy_ctor_func_t pCopyConstructor, uint offset, uint length, void **list, uint list_count, HashTable *removed ZEND_FILE_LINE_DC) /* {{{ */
|
||||
{
|
||||
int pos;
|
||||
Bucket *p;
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
CHECK_INIT(ht);
|
||||
|
||||
/* Skip all elements until offset */
|
||||
for (pos = 0, p = ht->pListHead; pos < offset && p; pos++, p = p->pListNext);
|
||||
|
||||
while (pos < offset + length && p) {
|
||||
/* Copy removed element into HT, if it was specified */
|
||||
if (removed != NULL) {
|
||||
void *new_entry;
|
||||
|
||||
if (p->nKeyLength == 0) {
|
||||
zend_hash_next_index_insert(removed, p->pData, sizeof(zval *), &new_entry);
|
||||
} else {
|
||||
zend_hash_quick_update(removed, p->arKey, p->nKeyLength, p->h, p->pData, sizeof(zval *), &new_entry);
|
||||
}
|
||||
|
||||
if (pCopyConstructor) {
|
||||
pCopyConstructor(new_entry);
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove element */
|
||||
{
|
||||
Bucket *p_next = p->pListNext;
|
||||
zend_hash_bucket_delete(ht, p);
|
||||
p = p_next;
|
||||
}
|
||||
|
||||
pos++;
|
||||
}
|
||||
|
||||
if (list != NULL) {
|
||||
int i;
|
||||
for (i = 0; i < list_count; i++) {
|
||||
/* Add new element only to the global linked list, not the bucket list.
|
||||
* Also use key 0 for everything, as we'll reindex the hashtable anyways. */
|
||||
Bucket *q = pemalloc_rel(sizeof(Bucket), ht->persistent);
|
||||
q->arKey = NULL;
|
||||
q->nKeyLength = 0;
|
||||
q->h = 0;
|
||||
INIT_DATA(ht, q, list[i], nDataSize);
|
||||
|
||||
CONNECT_TO_GLOBAL_DLLIST_EX(q, ht, p ? p->pListLast : ht->pListTail, p);
|
||||
|
||||
ht->nNumOfElements++;
|
||||
|
||||
if (pCopyConstructor) {
|
||||
pCopyConstructor(q->pData);
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_HASH_IF_FULL_DO_RESIZE(ht);
|
||||
}
|
||||
|
||||
zend_hash_reindex(ht, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
|
||||
compare_func_t compar, int renumber TSRMLS_DC)
|
||||
{
|
||||
@@ -1405,7 +1423,15 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
|
||||
if (renumber) {
|
||||
zend_hash_reindex(ht, 0);
|
||||
p = ht->pListHead;
|
||||
i=0;
|
||||
while (p != NULL) {
|
||||
p->nKeyLength = 0;
|
||||
p->h = i++;
|
||||
p = p->pListNext;
|
||||
}
|
||||
ht->nNextFreeElement = i;
|
||||
zend_hash_rehash(ht);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -227,11 +227,6 @@ ZEND_API int zend_hash_minmax(const HashTable *ht, compare_func_t compar, int fl
|
||||
ZEND_API int zend_hash_num_elements(const HashTable *ht);
|
||||
|
||||
ZEND_API int zend_hash_rehash(HashTable *ht);
|
||||
ZEND_API void zend_hash_reindex(HashTable *ht, zend_bool only_integer_keys);
|
||||
|
||||
ZEND_API void _zend_hash_splice(HashTable *ht, uint nDataSize, copy_ctor_func_t pCopyConstructor, uint offset, uint length, void **list, uint list_count, HashTable *removed ZEND_FILE_LINE_DC);
|
||||
#define zend_hash_splice(ht, nDataSize, pCopyConstructor, offset, length, list, list_count, removed) \
|
||||
_zend_hash_splice(ht, nDataSize, pCopyConstructor, offset, length, list, list_count, removed ZEND_FILE_LINE_CC)
|
||||
|
||||
/*
|
||||
* DJBX33A (Daniel J. Bernstein, Times 33 with Addition)
|
||||
|
||||
Loaded 100 of 1380 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user