mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-19 23:16:38 +00:00
Compare commits
466
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5475d38fb7 | ||
|
|
7c289f7f8e | ||
|
|
5956ba851a | ||
|
|
ab38726a59 | ||
|
|
bf6827697b | ||
|
|
1735305f34 | ||
|
|
1a5b1da9c1 | ||
|
|
a7fd79b948 | ||
|
|
a884bbf1e9 | ||
|
|
c99e0d9314 | ||
|
|
a550566ce9 | ||
|
|
c5a650e815 | ||
|
|
eb180ac30b | ||
|
|
5e923d23b4 | ||
|
|
ad4d6d1ce3 | ||
|
|
2edd90100c | ||
|
|
83039b8fee | ||
|
|
1c83f5e04c | ||
|
|
3b7cdd0227 | ||
|
|
5b5c393f82 | ||
|
|
fa78f7a4c0 | ||
|
|
0c5dd2c360 | ||
|
|
a7e1a71bad | ||
|
|
9ffc8b739f | ||
|
|
65cbcb3be9 | ||
|
|
0158804a15 | ||
|
|
7e5a214251 | ||
|
|
858164624d | ||
|
|
f52197815a | ||
|
|
0b619f4f0b | ||
|
|
2b606e0a39 | ||
|
|
9c88553456 | ||
|
|
61780c3dbc | ||
|
|
74de7dd66d | ||
|
|
618b480d91 | ||
|
|
bc165d3a65 | ||
|
|
3f28c4eb11 | ||
|
|
582c2fa868 | ||
|
|
103d475021 | ||
|
|
be217d08a4 | ||
|
|
15383e046e | ||
|
|
ef7229ed17 | ||
|
|
fa7c07b10c | ||
|
|
e7d106f11d | ||
|
|
7e0b627b02 | ||
|
|
bbd6fe7011 | ||
|
|
11e4f1e39a | ||
|
|
9159e3d246 | ||
|
|
741abeb20f | ||
|
|
1ffcbc5b73 | ||
|
|
6e4435d628 | ||
|
|
57536d31eb | ||
|
|
b95187fa29 | ||
|
|
ec0b5ffca9 | ||
|
|
db25201ffb | ||
|
|
5d4d7837fa | ||
|
|
62b3c85b05 | ||
|
|
48d47da8af | ||
|
|
41c94d26a4 | ||
|
|
3b6ad85fa9 | ||
|
|
5107df2d04 | ||
|
|
e2f5272dac | ||
|
|
f330e9fc08 | ||
|
|
a746dbb579 | ||
|
|
6effbcb140 | ||
|
|
a02d8cfa33 | ||
|
|
48ec4ace5f | ||
|
|
bd07868280 | ||
|
|
93b501ed61 | ||
|
|
68e5e29850 | ||
|
|
468d13513c | ||
|
|
4b30846b50 | ||
|
|
f1f2a649e2 | ||
|
|
c2663588e1 | ||
|
|
dca6f950a9 | ||
|
|
24392c37d9 | ||
|
|
4d926b1fa3 | ||
|
|
e72a3ea450 | ||
|
|
51d3680306 | ||
|
|
80496c9dc4 | ||
|
|
1fc4bc1d56 | ||
|
|
9a483afa5b | ||
|
|
9f66085649 | ||
|
|
52b81b8566 | ||
|
|
8355230480 | ||
|
|
ebbb2b1df1 | ||
|
|
a6eaf353c0 | ||
|
|
824726073b | ||
|
|
45420bb669 | ||
|
|
7c90a9daa8 | ||
|
|
9805e1674a | ||
|
|
8bfb9bcd01 | ||
|
|
d108429f82 | ||
|
|
02bf16db03 | ||
|
|
56c563dff7 | ||
|
|
530311f4ba | ||
|
|
386abb9f5a | ||
|
|
08cab10dc9 | ||
|
|
cd6f4bcf8d | ||
|
|
f7c269b119 | ||
|
|
7907f66e4b | ||
|
|
b0683007c9 | ||
|
|
a07a4af30b | ||
|
|
b03817afb5 | ||
|
|
8a2736fd77 | ||
|
|
591e0e446f | ||
|
|
3afe772423 | ||
|
|
64a0c79a07 | ||
|
|
81e8615cc3 | ||
|
|
90737c19e2 | ||
|
|
dacd564031 | ||
|
|
6b48551c93 | ||
|
|
29745da338 | ||
|
|
ecfc54c5e6 | ||
|
|
eccc017ab5 | ||
|
|
f577f22de0 | ||
|
|
264e5c0567 | ||
|
|
b7bee05d46 | ||
|
|
58b7766aec | ||
|
|
801d140782 | ||
|
|
f191ecaa9c | ||
|
|
bbce374565 | ||
|
|
d70bddb02d | ||
|
|
0b71f4f58b | ||
|
|
e615a86cf0 | ||
|
|
85edf25143 | ||
|
|
06c20347ae | ||
|
|
cf7724d5a3 | ||
|
|
66dd371c43 | ||
|
|
cc1ccefc0d | ||
|
|
7cdef345d5 | ||
|
|
e89370d4dc | ||
|
|
fa79f2f46b | ||
|
|
1bc1d3572f | ||
|
|
4e5960ed88 | ||
|
|
894a746a80 | ||
|
|
cf9aaf22ce | ||
|
|
11a096c3cc | ||
|
|
6f0c93da8e | ||
|
|
a93fd42b6f | ||
|
|
61940e4a6a | ||
|
|
12ceab222e | ||
|
|
8ae7586e87 | ||
|
|
292a7936c5 | ||
|
|
29b47bbff4 | ||
|
|
2f0a379c03 | ||
|
|
0909cafc7d | ||
|
|
fdce66dfd2 | ||
|
|
dd1a0be3c0 | ||
|
|
76285595b4 | ||
|
|
a10a6135db | ||
|
|
c6076da77c | ||
|
|
4a5959d113 | ||
|
|
6be6c2d62d | ||
|
|
c4197dc35e | ||
|
|
46407e6f5e | ||
|
|
9f782a73e8 | ||
|
|
d5cab148b3 | ||
|
|
e80c55448c | ||
|
|
8806c371c8 | ||
|
|
a0974f2d59 | ||
|
|
adb87c8d06 | ||
|
|
b9b749b704 | ||
|
|
f214fd4f7d | ||
|
|
c5901b64a7 | ||
|
|
c70eeb731a | ||
|
|
5fb2570742 | ||
|
|
4276fd63b5 | ||
|
|
8a18b29d23 | ||
|
|
327a9d45c9 | ||
|
|
9aa25d0938 | ||
|
|
c6396dd9de | ||
|
|
ce211cf5e6 | ||
|
|
70cacfd3a8 | ||
|
|
644b5fdec0 | ||
|
|
32a4d68013 | ||
|
|
32f47f5c41 | ||
|
|
09842e83ba | ||
|
|
5ddd67d90b | ||
|
|
b7e124004f | ||
|
|
fdd4aa7073 | ||
|
|
93776977d8 | ||
|
|
8953916314 | ||
|
|
505537274d | ||
|
|
e77b49bfd3 | ||
|
|
1a4456bb76 | ||
|
|
5842a4147f | ||
|
|
81579a352a | ||
|
|
afe4570cda | ||
|
|
0494615b3c | ||
|
|
4afe3eb3f3 | ||
|
|
3fd5fc9cd7 | ||
|
|
01249bb40b | ||
|
|
adabdede5e | ||
|
|
aba5ecbad9 | ||
|
|
7711da059e | ||
|
|
3e6b211935 | ||
|
|
3923d02332 | ||
|
|
b7e5a7f206 | ||
|
|
d8e8e68f07 | ||
|
|
440727f4ed | ||
|
|
d7897c2c2a | ||
|
|
1e0cb5fec5 | ||
|
|
7a402242bc | ||
|
|
d3b1d5b531 | ||
|
|
71e52a5ccd | ||
|
|
18e0f8a489 | ||
|
|
404686447b | ||
|
|
3f3ae34fc2 | ||
|
|
c1abc8938d | ||
|
|
54b84f832a | ||
|
|
9115712263 | ||
|
|
b9ffb87960 | ||
|
|
c1c3fada7a | ||
|
|
3c4bafc45a | ||
|
|
a814063804 | ||
|
|
f99938c6ee | ||
|
|
6cc66ef964 | ||
|
|
eb9093160f | ||
|
|
2310029923 | ||
|
|
7c1bdf2c45 | ||
|
|
89c9a8ef44 | ||
|
|
4f21d3132e | ||
|
|
3acd5811ae | ||
|
|
849d4e0357 | ||
|
|
c5a4e11bab | ||
|
|
5304004cc7 | ||
|
|
29588a6fa3 | ||
|
|
dc467a70d3 | ||
|
|
213e1f4456 | ||
|
|
8e30050416 | ||
|
|
db34dc0a8b | ||
|
|
fe724baa4d | ||
|
|
918e9f852a | ||
|
|
12cc948688 | ||
|
|
b632c3ac06 | ||
|
|
09607226d4 | ||
|
|
e9ce400f8b | ||
|
|
0372e6ad80 | ||
|
|
f9f298cc0b | ||
|
|
ffc6da20a0 | ||
|
|
ddac85a947 | ||
|
|
86c44e119f | ||
|
|
73b6310098 | ||
|
|
34ef66d7a4 | ||
|
|
7b91a9778a | ||
|
|
10bea32e8d | ||
|
|
5121f10926 | ||
|
|
34d93f0c06 | ||
|
|
512be854e5 | ||
|
|
f027884ca1 | ||
|
|
8480b7f4be | ||
|
|
b83af94c2b | ||
|
|
dcccfc2267 | ||
|
|
b4a83a3eef | ||
|
|
2c6b2f64df | ||
|
|
5b921a87a1 | ||
|
|
b3a063643b | ||
|
|
8a956399fe | ||
|
|
864caa2de1 | ||
|
|
0f19777b7a | ||
|
|
d6f5f3782b | ||
|
|
335cf2fc23 | ||
|
|
603252546b | ||
|
|
ed87dbab91 | ||
|
|
de5254743e | ||
|
|
bbf1904f3d | ||
|
|
4b0e699051 | ||
|
|
177612ca4d | ||
|
|
7f04d85d31 | ||
|
|
90789cf0a7 | ||
|
|
f417c732a9 | ||
|
|
868b808f4c | ||
|
|
d8782ddaeb | ||
|
|
b9746b0ba6 | ||
|
|
6765a19d23 | ||
|
|
fbb5aae32c | ||
|
|
772768f41c | ||
|
|
8c3335b96b | ||
|
|
72c4e72570 | ||
|
|
63db6d1435 | ||
|
|
94cd08457b | ||
|
|
886cf1a318 | ||
|
|
eefbc4398a | ||
|
|
ebf9db550f | ||
|
|
e63f59191d | ||
|
|
2a852af8f7 | ||
|
|
a8068a676b | ||
|
|
dec96a12fa | ||
|
|
3a5d2b2129 | ||
|
|
444289e03e | ||
|
|
68c8c34a77 | ||
|
|
9437d4cea4 | ||
|
|
740285307d | ||
|
|
0a7292087c | ||
|
|
104cd28e95 | ||
|
|
25849ab967 | ||
|
|
358316b2ed | ||
|
|
1717764476 | ||
|
|
240653bad7 | ||
|
|
af482a4fc8 | ||
|
|
08e7b84b7b | ||
|
|
a5974fdba8 | ||
|
|
a96426874a | ||
|
|
fcff17524a | ||
|
|
5670174b66 | ||
|
|
c9e41e8901 | ||
|
|
0333b86f2d | ||
|
|
907fd926e5 | ||
|
|
fb2ce0bb00 | ||
|
|
7a0bd8b967 | ||
|
|
2b8026cfff | ||
|
|
bc6cb0c70d | ||
|
|
80d432ca62 | ||
|
|
8d52500d41 | ||
|
|
f277d8a22f | ||
|
|
bc9c089f3a | ||
|
|
e2a48862f7 | ||
|
|
d2c47040f5 | ||
|
|
f641cf8b2c | ||
|
|
ea2cad7e76 | ||
|
|
191df85605 | ||
|
|
15f5dd5cb3 | ||
|
|
7bc6fbc448 | ||
|
|
a643bda32d | ||
|
|
199510ef07 | ||
|
|
02023fc8fe | ||
|
|
cee9b6603c | ||
|
|
4cd96965fb | ||
|
|
b99e1ba2d8 | ||
|
|
060ceea06e | ||
|
|
efb6757e16 | ||
|
|
0a0443f07c | ||
|
|
6e668453ac | ||
|
|
80f46ca2c5 | ||
|
|
9622d0050d | ||
|
|
ddaddf6c2a | ||
|
|
c27079d9e0 | ||
|
|
707e6dac61 | ||
|
|
08b3d76cbf | ||
|
|
af43d306c0 | ||
|
|
a3ddc02e8e | ||
|
|
a641ccb774 | ||
|
|
de2291689c | ||
|
|
d86b3633cf | ||
|
|
66ac89a00b | ||
|
|
32b5f8a1a3 | ||
|
|
a311dc2443 | ||
|
|
6f56bf1cfc | ||
|
|
eed6bdb5c7 | ||
|
|
513faa54bb | ||
|
|
8f3e6433b2 | ||
|
|
86209a3919 | ||
|
|
148120e1e9 | ||
|
|
2da7edbc8d | ||
|
|
5fac6a938f | ||
|
|
45f4c5dd7e | ||
|
|
f57cbfcaa1 | ||
|
|
e1a5443f97 | ||
|
|
31b91d7cdb | ||
|
|
a1ae8af54c | ||
|
|
3837f1205b | ||
|
|
aea69cb06a | ||
|
|
e18618905c | ||
|
|
0c107d3bf3 | ||
|
|
76cbcc7f66 | ||
|
|
ce966baaa4 | ||
|
|
767f924665 | ||
|
|
329eae2a7a | ||
|
|
b8ffccb3ab | ||
|
|
a8b8fe1f7f | ||
|
|
a7dfb31557 | ||
|
|
6406521a44 | ||
|
|
ce816cb883 | ||
|
|
11f667e82d | ||
|
|
f848423608 | ||
|
|
c270347c0b | ||
|
|
6fca028fc5 | ||
|
|
eaeb4537ec | ||
|
|
0de3cd84a5 | ||
|
|
3300cc8e38 | ||
|
|
c76af7c041 | ||
|
|
f5779d5e16 | ||
|
|
9392b9cd73 | ||
|
|
2c03acef35 | ||
|
|
34de2c30c5 | ||
|
|
d2b11712ff | ||
|
|
8199f8dcfc | ||
|
|
845d0805a8 | ||
|
|
c16bfe403f | ||
|
|
c2f796c58b | ||
|
|
a2390fca5d | ||
|
|
28edcb949d | ||
|
|
d1ea827f27 | ||
|
|
565d4bc695 | ||
|
|
5c9080d3a6 | ||
|
|
378cf70c81 | ||
|
|
f5b67e09b9 | ||
|
|
ad0666eb94 | ||
|
|
07e9cfe6a5 | ||
|
|
76ec6924cb | ||
|
|
708017dd3f | ||
|
|
04d0210c8e | ||
|
|
59c102bf51 | ||
|
|
6f594fc5ea | ||
|
|
1056c57fa9 | ||
|
|
b60f6774dc | ||
|
|
70f4069138 | ||
|
|
388fa176be | ||
|
|
9eb5cb6571 | ||
|
|
a95a021509 | ||
|
|
a6acb1f09e | ||
|
|
f5a9e17f9c | ||
|
|
964f44a280 | ||
|
|
30f19bd524 | ||
|
|
1101293b3f | ||
|
|
4ad9f1970c | ||
|
|
01a6840bbd | ||
|
|
3012b74e96 | ||
|
|
fe790643ca | ||
|
|
fceeb296e6 | ||
|
|
3cb4de03dc | ||
|
|
c24ef71e63 | ||
|
|
1e2aa4416c | ||
|
|
6fad717299 | ||
|
|
0a17fe52fb | ||
|
|
4b450a0f85 | ||
|
|
1e3b32c777 | ||
|
|
cfdd25d5c0 | ||
|
|
e6368659a7 | ||
|
|
778273291d | ||
|
|
85eb08885b | ||
|
|
469b6d2b9e | ||
|
|
5d10bb6231 | ||
|
|
52c1db4b7d | ||
|
|
41533cdee1 | ||
|
|
6b593349cb | ||
|
|
a93c3ddbb7 | ||
|
|
ac96bcdc90 | ||
|
|
0f7d022eea | ||
|
|
db6a29e533 | ||
|
|
a546b3207f | ||
|
|
a5eeecb13f | ||
|
|
75ec1fedc7 | ||
|
|
27dd44db95 | ||
|
|
a90b7da435 | ||
|
|
8ab4c89d0b | ||
|
|
353077d234 | ||
|
|
c0748c7856 | ||
|
|
6f9d0a25fd | ||
|
|
245d15fdc6 | ||
|
|
8e256774b0 | ||
|
|
d19c366c4a | ||
|
|
654aa838cd | ||
|
|
0f29950d9c | ||
|
|
516c2f5920 | ||
|
|
1ca8acda40 | ||
|
|
6c513876d0 | ||
|
|
8c3428eeb8 | ||
|
|
a377c4c580 | ||
|
|
499006bbb8 | ||
|
|
bc4588b1d9 | ||
|
|
a99e0b69df | ||
|
|
84f1562f99 | ||
|
|
cfdfcac8aa | ||
|
|
8ad52ac7c1 |
No files matched your search
+2
-2
@@ -497,8 +497,8 @@ STATUS: Working
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: snmp
|
||||
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>, Pierre-Alain Joye <pajoye@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
PRIMARY MAINTAINER: Boris Lytochkin <lytboris@php.net>, Rasmus Lerdorf <rasmus@php.net>, Pierre-Alain Joye <pajoye@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sockets
|
||||
|
||||
@@ -51,6 +51,7 @@ Type specifiers
|
||||
L - long, limits out-of-range numbers to LONG_MAX/LONG_MIN (long)
|
||||
o - object of any type (zval*)
|
||||
O - object of specific type given by class entry (zval*, zend_class_entry)
|
||||
p - valid path (string without null bytes in the middle) and its length (char*, int)
|
||||
r - resource (zval*)
|
||||
s - string (with possible null bytes) and its length (char*, int)
|
||||
z - the actual zval (zval*)
|
||||
|
||||
+20
-7
@@ -51,27 +51,40 @@ SUCH DAMAGE.
|
||||
|
||||
6. ext/standard crypt's blowfish implementation
|
||||
|
||||
The crypt_blowfish homepage is:
|
||||
|
||||
http://www.openwall.com/crypt/
|
||||
|
||||
This code comes from John the Ripper password cracker, with reentrant
|
||||
and crypt(3) interfaces added, but optimizations specific to password
|
||||
cracking removed.
|
||||
|
||||
Written by Solar Designer <solar at openwall.com> in 1998-2002 and
|
||||
placed in the public domain.
|
||||
Written by Solar Designer <solar at openwall.com> in 1998-2011.
|
||||
No copyright is claimed, and the software is hereby placed in the public
|
||||
domain. In case this attempt to disclaim copyright and place the software
|
||||
in the public domain is deemed null and void, then the software is
|
||||
Copyright (c) 1998-2011 Solar Designer and it is hereby released to the
|
||||
general public under the following terms:
|
||||
|
||||
There's absolutely no warranty.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted.
|
||||
|
||||
There's ABSOLUTELY NO WARRANTY, express or implied.
|
||||
|
||||
It is my intent that you should be able to use this on your system,
|
||||
as a part of a software package, or anywhere else to improve security,
|
||||
as part of a software package, or anywhere else to improve security,
|
||||
ensure compatibility, or for any other purpose. I would appreciate
|
||||
it if you give credit where it is due and keep your modifications in
|
||||
the public domain as well, but I don't require that in order to let
|
||||
you place this code and any modifications you make under a license
|
||||
of your choice.
|
||||
|
||||
This implementation is compatible with OpenBSD bcrypt.c (version 2a)
|
||||
by Niels Provos <provos at citi.umich.edu>, and uses some of his
|
||||
This implementation is mostly compatible with OpenBSD's bcrypt.c (prefix
|
||||
"$2a$") by Niels Provos <provos at citi.umich.edu>, and uses some of his
|
||||
ideas. The password hashing algorithm was designed by David Mazieres
|
||||
<dm at lcs.mit.edu>.
|
||||
<dm at lcs.mit.edu>. For more information on the level of compatibility,
|
||||
please refer to the comments in BF_set_key() and to the crypt(3) man page
|
||||
included in the crypt_blowfish tarball.
|
||||
|
||||
There's a paper on the algorithm that explains its design decisions:
|
||||
|
||||
|
||||
+10
-13
@@ -104,16 +104,15 @@ Derick) run the following commands for you:
|
||||
|
||||
``sudo -u ezmlm ezmlm-sub ~ezmlm/primary-qa-tester/mod moderator-email-address``
|
||||
|
||||
3. Update the MD5 sums in ``web/qa/trunk/include/rc-md5sums.txt`` (no empty lines, ordered by filename, odler version number first, .bz2 before .gz).
|
||||
3. Update ``web/qa/trunk/include/release-qa.php`` with the appropriate information.
|
||||
See the documentation within release-qa.php for more information, but all releases
|
||||
and RCs are configured here. Only $QA_RELEASES needs to be edited.
|
||||
|
||||
4. Update in ``web/qa/trunk/include/release-qa.php`` constants with the new RC and
|
||||
commit this.
|
||||
Example: When rolling an RC, set the 'rc' with appropriate information for the
|
||||
given version.
|
||||
|
||||
a. ``$BUILD_TEST_RELEASES`` = array("4.4.7RC1", "5.2.2RC1")
|
||||
Note: Remember to update the MD5 checksum information.
|
||||
|
||||
b. ``$CURRENT_QA_RELEASE_4`` = "4.4.7RC1" (``$CURRENT_QA_RELEASE_5`` for PHP5)
|
||||
|
||||
c. ``$RELEASE_PROCESS`` = array(4 => true, 5 => true)
|
||||
|
||||
1. Update in ``web/php-bugs/trunk/include/php_versions.php`` to include the new RC and commit.
|
||||
|
||||
@@ -247,13 +246,11 @@ number, and remove the RC from there.
|
||||
|
||||
11. Update ``qaweb/include/release-qa.php``
|
||||
|
||||
a. Update the $BUILD_TEST_RELEASES array with the release name
|
||||
- Update $QA_RELEASES with the appropriate information, which means bumping
|
||||
the version number to an upcoming version.
|
||||
|
||||
b. Update $RELEASE_PROCESS array (set to false)
|
||||
|
||||
I. For PHP4: Set $CURRENT_QA_RELEASE_4 to false
|
||||
|
||||
II. For PHP5: Set $CURRENT_QA_RELEASE_5 to false
|
||||
Example: If PHP 5.3.7 is being released, then PHP 5.3.8 is the next QA version,
|
||||
so replace 5.3.7 with 5.3.8 within $QA_RELEASES.
|
||||
|
||||
Re-releasing the same version (or -pl)
|
||||
--------------------------------------
|
||||
|
||||
+8
-4
@@ -43,13 +43,17 @@ Having said that, here are the organizational rules::
|
||||
|
||||
Currently we have the following branches in use::
|
||||
|
||||
trunk Will become PHP 6.0. This CVS branch is for active development.
|
||||
trunk The active development branch.
|
||||
|
||||
branches/PHP_5_3 Is used to release the PHP 5.3.x series. It still allows for
|
||||
branches/PHP_5_4 Is used to release the PHP 5.4.x series. It still allows for
|
||||
larger enhancements.
|
||||
|
||||
branches/PHP_5_2 Is used to release the PHP 5.2.x series. Only bugfixes are permitted
|
||||
on this branch (Consult the releasemaster prior to commit).
|
||||
branches/PHP_5_3 Is used to release the PHP 5.3.x series. This is current
|
||||
stable version and is open for bugfixes and small
|
||||
improvements (check with RMs if in doubt).
|
||||
|
||||
branches/PHP_5_2 Is used to release the PHP 5.2.x series. It is closed for
|
||||
changes now.
|
||||
|
||||
branches/PHP_5_1 This branch is closed.
|
||||
|
||||
|
||||
+16
@@ -710,6 +710,22 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
Changes the signal mask of the calling thread
|
||||
*/
|
||||
#ifdef HAVE_SIGPROCMASK
|
||||
TSRM_API int tsrm_sigmask(int how, const sigset_t *set, sigset_t *oldset)
|
||||
{
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Changed sigmask in thread: %ld", tsrm_thread_id()));
|
||||
/* TODO: add support for other APIs */
|
||||
#ifdef PTHREADS
|
||||
return pthread_sigmask(how, set, oldset);
|
||||
#else
|
||||
return sigprocmask(how, set, oldset);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler)
|
||||
{
|
||||
|
||||
@@ -90,6 +90,10 @@ typedef struct {
|
||||
# define MUTEX_T beos_ben *
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
typedef void (*ts_allocate_ctor)(void *, void ***);
|
||||
typedef void (*ts_allocate_dtor)(void *, void ***);
|
||||
|
||||
@@ -138,6 +142,9 @@ TSRM_API MUTEX_T tsrm_mutex_alloc(void);
|
||||
TSRM_API void tsrm_mutex_free(MUTEX_T mutexp);
|
||||
TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp);
|
||||
TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp);
|
||||
#ifdef HAVE_SIGPROCMASK
|
||||
TSRM_API int tsrm_sigmask(int how, const sigset_t *set, sigset_t *oldset);
|
||||
#endif
|
||||
|
||||
TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler);
|
||||
TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
#undef PTHREADS
|
||||
+1
-1
@@ -33,7 +33,7 @@ $(makefile_in_files): $(makefile_am_files)
|
||||
aclocal.m4: configure.in acinclude.m4
|
||||
aclocal
|
||||
|
||||
$(config_h_in): configure.in acconfig.h
|
||||
$(config_h_in): configure.in
|
||||
# explicitly remove target since autoheader does not seem to work
|
||||
# correctly otherwise (timestamps are not updated)
|
||||
@rm -f $@
|
||||
|
||||
@@ -7,6 +7,10 @@ AC_INIT(TSRM.c)
|
||||
AM_INIT_AUTOMAKE(TSRM, 1.0, nodefine)
|
||||
AM_CONFIG_HEADER(tsrm_config.h)
|
||||
|
||||
AH_TOP([
|
||||
#undef PTHREADS
|
||||
])
|
||||
|
||||
sinclude(tsrm.m4)
|
||||
|
||||
TSRM_BASIC_CHECKS
|
||||
|
||||
@@ -30,6 +30,8 @@ AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
|
||||
AC_CHECK_HEADERS(stdarg.h)
|
||||
|
||||
AC_CHECK_FUNCS(sigprocmask)
|
||||
|
||||
])
|
||||
|
||||
|
||||
|
||||
+17
-3
@@ -617,7 +617,14 @@ CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{
|
||||
memcmp(path, (*bucket)->path, path_len) == 0) {
|
||||
realpath_cache_bucket *r = *bucket;
|
||||
*bucket = (*bucket)->next;
|
||||
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
|
||||
|
||||
/* if the pointers match then only subtract the length of the path */
|
||||
if(r->path == r->realpath) {
|
||||
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1;
|
||||
} else {
|
||||
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
|
||||
}
|
||||
|
||||
free(r);
|
||||
return;
|
||||
} else {
|
||||
@@ -692,7 +699,13 @@ static inline realpath_cache_bucket* realpath_cache_find(const char *path, int p
|
||||
if (CWDG(realpath_cache_ttl) && (*bucket)->expires < t) {
|
||||
realpath_cache_bucket *r = *bucket;
|
||||
*bucket = (*bucket)->next;
|
||||
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
|
||||
|
||||
/* if the pointers match then only subtract the length of the path */
|
||||
if(r->path == r->realpath) {
|
||||
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1;
|
||||
} else {
|
||||
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
|
||||
}
|
||||
free(r);
|
||||
} else if (key == (*bucket)->key && path_len == (*bucket)->path_len &&
|
||||
memcmp(path, (*bucket)->path, path_len) == 0) {
|
||||
@@ -1067,6 +1080,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
}
|
||||
if (is_dir && !directory) {
|
||||
/* not a directory */
|
||||
tsrm_free_alloca(tmp, use_heap);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1438,7 +1452,7 @@ CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC) /* {{{
|
||||
}
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) {
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -530,6 +530,10 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
|
||||
}
|
||||
|
||||
cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c ")+2);
|
||||
if (!cmd) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sprintf(cmd, "%s /c \"%s\"", TWG(comspec), command);
|
||||
if (asuser) {
|
||||
res = CreateProcessAsUser(token_user, NULL, cmd, &security, &security, security.bInheritHandle, dwCreateFlags, env, cwd, &startup, &process);
|
||||
|
||||
@@ -30,6 +30,7 @@ UPGRADE NOTES - PHP X.Y
|
||||
h. New methods
|
||||
i. New class constants
|
||||
j. New hash algorithms
|
||||
k. New Syntax
|
||||
|
||||
========================================
|
||||
1. Changes made to default configuration
|
||||
@@ -170,6 +171,15 @@ UPGRADE NOTES - PHP X.Y
|
||||
- fclose() closes streams with resource refcount > 1; it doesn't merely
|
||||
decrement the resource refcount.
|
||||
- socket_set_options() and socket_get_options() now support multicast options.
|
||||
- Arrays cast from SimpleXMLElement now always contain all nodes instead of
|
||||
just the first matching node.
|
||||
- All SimpleXMLElement children are now always printed when using var_dump(),
|
||||
var_export(), and print_r().
|
||||
- The raw data parameter in openssl_encrypt()/openssl_decrypt() is now an options
|
||||
integer rather than a boolean. A value of true produces the same behaviour.
|
||||
- Write operations within XSLT (for example with the extension sax:output) are
|
||||
disabled by default. You can define what is forbidden with the method
|
||||
XsltProcess::setSecurityPrefs($options)
|
||||
|
||||
===================================
|
||||
5. Changes made to existing methods
|
||||
@@ -208,6 +218,14 @@ UPGRADE NOTES - PHP X.Y
|
||||
|
||||
a. removed features
|
||||
|
||||
- magic quotes
|
||||
. remove magic_quotes_gpc, magic_quotes_runtime,
|
||||
magic_quotes_sybase (calling ini_set('magic_....')
|
||||
returns 0|false
|
||||
. get_magic_quotes_gpc, get_magic_quotes_runtime are kept but
|
||||
always return false
|
||||
. set_magic_quotes_runtime raises an E_CORE_ERROR
|
||||
|
||||
- register_globals
|
||||
- register_long_arrays
|
||||
- Safe mode
|
||||
@@ -276,6 +294,13 @@ UPGRADE NOTES - PHP X.Y
|
||||
- Multi OID get/getnext/set queries are now supported.
|
||||
- New constants added for use in snmp_set_oid_output_format()
|
||||
function.
|
||||
- Function snmp_set_valueretrieval() changed it's behaviour:
|
||||
SNMP_VALUE_OBJECT can be combined with one of
|
||||
SNMP_VALUE_PLAIN or SNMP_VALUE_LIBRARY resulting OID value
|
||||
changes. When no SNMP_VALUE_PLAIN or SNMP_VALUE_LIBRARY
|
||||
is supplied with SNMP_VALUE_OBJECT, SNMP_VALUE_LIBRARY is used.
|
||||
Prior to 5.4.0 when no SNMP_VALUE_PLAIN or SNMP_VALUE_LIBRARY
|
||||
was supplied with SNMP_VALUE_OBJECT, SNMP_VALUE_PLAIN was used.
|
||||
- Added feature-rich OO API (SNMP class)
|
||||
- Dropped UCD-SNMP compatibility code. Consider upgrading to
|
||||
net-snmp v5.3+. Net-SNMP v5.4+ is required for Windows version.
|
||||
@@ -311,6 +336,8 @@ UPGRADE NOTES - PHP X.Y
|
||||
raw POST data in multipart requests and read/process the POST data in a
|
||||
stream fashion (through php://input), without having it copied in memory two/
|
||||
three times.
|
||||
- Changed E_ALL to include E_STRICT. Recommended production value changed to
|
||||
E_ALL & ~E_DEPRECATED & ~E_STRICT.
|
||||
|
||||
====================
|
||||
12. Syntax additions
|
||||
@@ -352,10 +379,15 @@ UPGRADE NOTES - PHP X.Y
|
||||
|
||||
- Core:
|
||||
- get_declared_traits()
|
||||
- hex2bin()
|
||||
- http_response_code()
|
||||
- trait_exists()
|
||||
- stream_set_chunk_size()
|
||||
- socket_import_stream()
|
||||
- trait_exists()
|
||||
|
||||
- LDAP:
|
||||
- ldap_control_paged_results()
|
||||
- ldap_control_paged_results_response()
|
||||
|
||||
f. New global constants
|
||||
|
||||
@@ -384,6 +416,8 @@ UPGRADE NOTES - PHP X.Y
|
||||
- IPV6_MULTICAST_LOOP
|
||||
- IPPROTO_IP
|
||||
- IPPROTO_IPV6
|
||||
- OPENSSL_RAW_DATA
|
||||
- OPENSSL_ZERO_PADDING
|
||||
|
||||
g. New classes
|
||||
|
||||
@@ -433,5 +467,12 @@ UPGRADE NOTES - PHP X.Y
|
||||
- fnv132
|
||||
- fnv164
|
||||
- joaat
|
||||
|
||||
k. New Syntax
|
||||
- Short array syntax in 5.4.0
|
||||
$a = [1, 2, 3, 4];
|
||||
$a = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4];
|
||||
$a = ['one' => 1, 2, 'three' => 3, 4];
|
||||
|
||||
|
||||
- Binary number format
|
||||
0b00100 0b010101
|
||||
@@ -11,6 +11,7 @@ UPGRADE NOTES - PHP X.Y
|
||||
f. streams that enclose private streams
|
||||
g. leak_variable
|
||||
h. API Signature changes
|
||||
i. new TSRM function expand_filepath_with_mode
|
||||
|
||||
2. Build system changes
|
||||
a. Unix build system changes
|
||||
@@ -184,6 +185,9 @@ it increments the refcounts of those objects instead.
|
||||
. php_unescape_html_entities
|
||||
PHPAPI char *php_unescape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC);
|
||||
|
||||
i.
|
||||
PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, const char *relative_to, size_t relative_to_len, int realpath_mode TSRMLS_DC);
|
||||
expand_filepath_with_mode lets define how realpath will behave, using one of the existing mode: CWD_EXPAND , CWD_FILEPATH or CWD_REALPATH.
|
||||
|
||||
========================
|
||||
2. Build system changes
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ libZend_la_SOURCES=\
|
||||
zend_objects_API.c zend_ts_hash.c zend_stream.c \
|
||||
zend_default_classes.c \
|
||||
zend_iterators.c zend_interfaces.c zend_exceptions.c \
|
||||
zend_strtod.c zend_closures.c zend_float.c zend_string.c
|
||||
zend_strtod.c zend_closures.c zend_float.c zend_string.c zend_signal.c
|
||||
|
||||
libZend_la_LDFLAGS =
|
||||
libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
|
||||
|
||||
+15
-1
@@ -392,8 +392,22 @@ int main()
|
||||
|
||||
AC_CHECK_FUNCS(mremap)
|
||||
|
||||
])
|
||||
|
||||
AC_CHECK_FUNC(sigaction, [
|
||||
ZEND_SIGNALS=yes
|
||||
AC_DEFINE(ZEND_SIGNALS, 1, [Use zend signal handling])
|
||||
AC_DEFINE(HAVE_SIGACTION, 1, [Whether sigaction() is available])
|
||||
], [
|
||||
ZEND_SIGNALS=no
|
||||
])
|
||||
if test "$ZEND_SIGNALS" = "yes"; then
|
||||
CFLAGS="$CFLAGS -DZEND_SIGNALS"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(whether to enable zend signal handling)
|
||||
AC_MSG_RESULT($ZEND_SIGNALS)
|
||||
|
||||
])
|
||||
|
||||
AC_DEFUN([LIBZEND_CPLUSPLUS_CHECKS],[
|
||||
|
||||
|
||||
-127
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2011 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.zend.com/license/2_00.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define ZEND_API __attribute__ ((visibility("default")))
|
||||
# define ZEND_DLEXPORT __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define ZEND_API
|
||||
# define ZEND_DLEXPORT
|
||||
#endif
|
||||
|
||||
#define ZEND_DLIMPORT
|
||||
|
||||
@TOP@
|
||||
|
||||
#undef uint
|
||||
#undef ulong
|
||||
|
||||
/* Define if you want to enable memory limit support */
|
||||
#define MEMORY_LIMIT 0
|
||||
|
||||
@BOTTOM@
|
||||
|
||||
#ifndef ZEND_ACCONFIG_H_NO_C_PROTOS
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IEEEFP_H
|
||||
# include <ieeefp.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#if ZEND_BROKEN_SPRINTF
|
||||
int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#else
|
||||
# define zend_sprintf sprintf
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/* To enable the is_nan, is_infinite and is_finite PHP functions */
|
||||
#ifdef NETWARE
|
||||
#define HAVE_ISNAN 1
|
||||
#define HAVE_ISINF 1
|
||||
#define HAVE_ISFINITE 1
|
||||
#endif
|
||||
|
||||
#ifndef zend_isnan
|
||||
#ifdef HAVE_ISNAN
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
#else
|
||||
#define zend_isnan(a) 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ISINF
|
||||
#define zend_isinf(a) isinf(a)
|
||||
#elif defined(INFINITY)
|
||||
/* Might not work, but is required by ISO C99 */
|
||||
#define zend_isinf(a) (((a)==INFINITY)?1:0)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
|
||||
#else
|
||||
#define zend_isinf(a) 0
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FINITE
|
||||
#define zend_finite(a) finite(a)
|
||||
#elif defined(HAVE_ISFINITE) || defined(isfinite)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(fpclassify)
|
||||
#define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0)
|
||||
#else
|
||||
#define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1)
|
||||
#endif
|
||||
|
||||
#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */
|
||||
|
||||
#ifdef NETWARE
|
||||
#ifdef USE_WINSOCK
|
||||
#/*This detection against winsock is of no use*/ undef HAVE_SOCKLEN_T
|
||||
#/*This detection against winsock is of no use*/ undef HAVE_SYS_SOCKET_H
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
*/
|
||||
+1
-1
@@ -4,7 +4,7 @@ dnl This file contains local autoconf functions.
|
||||
|
||||
AC_DEFUN([LIBZEND_BISON_CHECK],[
|
||||
# we only support certain bison versions
|
||||
bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3"
|
||||
bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5"
|
||||
|
||||
# for standalone build of Zend Engine
|
||||
test -z "$SED" && SED=sed
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ $(makefile_in_files): $(makefile_am_files)
|
||||
aclocal.m4: configure.in acinclude.m4
|
||||
aclocal
|
||||
|
||||
$(config_h_in): configure.in acconfig.h
|
||||
$(config_h_in): configure.in
|
||||
# explicitly remove target since autoheader does not seem to work
|
||||
# correctly otherwise (timestamps are not updated)
|
||||
@rm -f $@
|
||||
|
||||
@@ -11,6 +11,105 @@ AM_PROG_CC_STDC
|
||||
ZEND_VERSION=$VERSION
|
||||
AC_ZEND_C_BIGENDIAN
|
||||
|
||||
AH_TOP([
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define ZEND_API __attribute__ ((visibility("default")))
|
||||
# define ZEND_DLEXPORT __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define ZEND_API
|
||||
# define ZEND_DLEXPORT
|
||||
#endif
|
||||
|
||||
#define ZEND_DLIMPORT
|
||||
|
||||
#undef uint
|
||||
#undef ulong
|
||||
|
||||
/* Define if you want to enable memory limit support */
|
||||
#define MEMORY_LIMIT 0
|
||||
])
|
||||
|
||||
AH_BOTTOM([
|
||||
#ifndef ZEND_ACCONFIG_H_NO_C_PROTOS
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IEEEFP_H
|
||||
# include <ieeefp.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#if ZEND_BROKEN_SPRINTF
|
||||
int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#else
|
||||
# define zend_sprintf sprintf
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/* To enable the is_nan, is_infinite and is_finite PHP functions */
|
||||
#ifdef NETWARE
|
||||
#define HAVE_ISNAN 1
|
||||
#define HAVE_ISINF 1
|
||||
#define HAVE_ISFINITE 1
|
||||
#endif
|
||||
|
||||
#ifndef zend_isnan
|
||||
#ifdef HAVE_ISNAN
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
#else
|
||||
#define zend_isnan(a) 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ISINF
|
||||
#define zend_isinf(a) isinf(a)
|
||||
#elif defined(INFINITY)
|
||||
/* Might not work, but is required by ISO C99 */
|
||||
#define zend_isinf(a) (((a)==INFINITY)?1:0)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
|
||||
#else
|
||||
#define zend_isinf(a) 0
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FINITE
|
||||
#define zend_finite(a) finite(a)
|
||||
#elif defined(HAVE_ISFINITE) || defined(isfinite)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(fpclassify)
|
||||
#define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0)
|
||||
#else
|
||||
#define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1)
|
||||
#endif
|
||||
|
||||
#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */
|
||||
|
||||
#ifdef NETWARE
|
||||
#ifdef USE_WINSOCK
|
||||
#/*This detection against winsock is of no use*/ undef HAVE_SOCKLEN_T
|
||||
#/*This detection against winsock is of no use*/ undef HAVE_SYS_SOCKET_H
|
||||
#endif
|
||||
#endif
|
||||
])
|
||||
|
||||
dnl We want this one before the checks, so the checks can modify CFLAGS.
|
||||
test -z "$CFLAGS" && auto_cflags=1
|
||||
|
||||
|
||||
@@ -20,5 +20,5 @@ var_dump( ArrayProperty::$array );
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[1]=>
|
||||
int(23)
|
||||
int(42)
|
||||
}
|
||||
@@ -20,7 +20,7 @@ var_dump(
|
||||
--EXPECTF--
|
||||
Parse error: syntax error, unexpected '}' in %s(%d) : runtime-created function on line 1
|
||||
|
||||
Parse error: syntax error, unexpected $end in %s(%d) : runtime-created function on line 1
|
||||
Parse error: syntax error, unexpected end of file in %s(%d) : runtime-created function on line 1
|
||||
bool(false)
|
||||
int(2)
|
||||
bool(false)
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
--TEST--
|
||||
Bug #50816 (Using class constants in array definition fails)
|
||||
--FILE--
|
||||
<?php
|
||||
define("ONE", 1);
|
||||
define("TWO", 1);
|
||||
|
||||
class Foo {
|
||||
const ONE = 1;
|
||||
const TWO = 1;
|
||||
|
||||
public static $mapWithConst = array(self::ONE => 'one', self::TWO => 'two',);
|
||||
|
||||
public static $mapWithConst1 = array(1 => 'one', self::TWO => 'two',);
|
||||
public static $mapWithConst2 = array(self::ONE => 'one', 1 => 'two',);
|
||||
|
||||
public static $mapWithoutConst = array(1 => 'one', 1 => 'two',);
|
||||
}
|
||||
|
||||
$mapWithConst = array(1 => 'one', 1 => 'two',);
|
||||
|
||||
$mapWithoutConst = array(Foo::ONE => 'one', Foo::TWO => 'two',);
|
||||
$mapWithoutConst0 = array(1 => 'one', 1 => 'two',);
|
||||
$mapWithoutConst1 = array(ONE => 'one', 1 => 'two',);
|
||||
$mapWithoutConst2 = array(1 => 'one', TWO => 'two',);
|
||||
$mapWithoutConst3 = array(ONE => 'one', TWO => 'two',);
|
||||
|
||||
var_dump(Foo::$mapWithConst[1]);
|
||||
var_dump(Foo::$mapWithConst1[1]);
|
||||
var_dump(Foo::$mapWithConst2[1]);
|
||||
var_dump(Foo::$mapWithoutConst[1]);
|
||||
var_dump($mapWithConst[1]);
|
||||
var_dump($mapWithoutConst[1]);
|
||||
var_dump($mapWithoutConst0[1]);
|
||||
var_dump($mapWithoutConst1[1]);
|
||||
var_dump($mapWithoutConst2[1]);
|
||||
var_dump($mapWithoutConst3[1]);
|
||||
--EXPECT--
|
||||
string(3) "two"
|
||||
string(3) "two"
|
||||
string(3) "two"
|
||||
string(3) "two"
|
||||
string(3) "two"
|
||||
string(3) "two"
|
||||
string(3) "two"
|
||||
string(3) "two"
|
||||
string(3) "two"
|
||||
string(3) "two"
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #53727 (Inconsistent behavior of is_subclass_of with interfaces)
|
||||
--FILE--
|
||||
<?php
|
||||
interface MyInterface {
|
||||
const TEST_CONSTANT = true;
|
||||
}
|
||||
|
||||
class ParentClass implements MyInterface { }
|
||||
|
||||
class ChildClass extends ParentClass { }
|
||||
|
||||
echo (is_subclass_of('ChildClass', 'MyInterface') ? 'true' : 'false') . "\n";
|
||||
echo (defined('ChildClass::TEST_CONSTANT') ? 'true' : 'false') . "\n";
|
||||
|
||||
echo (is_subclass_of('ParentClass', 'MyInterface') ? 'true' : 'false') . "\n";
|
||||
echo (defined('ParentClass::TEST_CONSTANT') ? 'true' : 'false') . "\n";
|
||||
--EXPECT--
|
||||
true
|
||||
true
|
||||
true
|
||||
true
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #54305 (Crash in gc_remove_zval_from_buffer)
|
||||
--FILE--
|
||||
<?php
|
||||
class TestClass {
|
||||
public function methodWithArgs($a, $b) {
|
||||
}
|
||||
}
|
||||
abstract class AbstractClass {
|
||||
}
|
||||
$methodWithArgs = new ReflectionMethod('TestClass', 'methodWithArgs');
|
||||
echo $methodWithArgs++;
|
||||
?>
|
||||
--EXPECTF--
|
||||
Method [ <user> public method methodWithArgs ] {
|
||||
@@ %sbug54305.php %d - %d
|
||||
|
||||
- Parameters [2] {
|
||||
Parameter #0 [ <required> $a ]
|
||||
Parameter #1 [ <required> $b ]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #54624 (class_alias and type hint)
|
||||
--FILE--
|
||||
<?php
|
||||
class A
|
||||
{
|
||||
function foo(A $param) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class_alias('A', 'AliasA');
|
||||
|
||||
eval('
|
||||
class B extends A
|
||||
{
|
||||
function foo(AliasA $param) {
|
||||
}
|
||||
|
||||
}
|
||||
');
|
||||
|
||||
echo "DONE\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
DONE
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
namespace b\c {}
|
||||
namespace b\d {}
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #54804 (__halt_compiler and imported namespaces)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace a;
|
||||
require __DIR__ . '/bug54804.inc';
|
||||
echo 'DONE';
|
||||
__halt_compiler();
|
||||
?>
|
||||
--EXPECT--
|
||||
DONE
|
||||
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #54910 (Crash when calling call_user_func with unknown function name)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
public function __call($method, $args) {
|
||||
if (stripos($method, 'get') === 0) {
|
||||
return $this->get();
|
||||
}
|
||||
die("No such method - '$method'\n");
|
||||
}
|
||||
|
||||
protected function get() {
|
||||
$class = get_class($this);
|
||||
$call = array($class, 'noSuchMethod');
|
||||
|
||||
if (is_callable($call)) {
|
||||
call_user_func($call);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
$input = new B();
|
||||
echo $input->getEmail();
|
||||
--EXPECT--
|
||||
No such method - 'noSuchMethod'
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #55007 (compiler fail after previous fail)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($classname) {
|
||||
if ('CompileErrorClass'==$classname) eval('class CompileErrorClass { function foo() { $a[] } }');
|
||||
if ('MyErrorHandler'==$classname) eval('class MyErrorHandler { function __construct() { print "My error handler runs.\n"; } }');
|
||||
}
|
||||
|
||||
function shutdown() {
|
||||
new MyErrorHandler();
|
||||
}
|
||||
|
||||
|
||||
register_shutdown_function('shutdown');
|
||||
|
||||
new CompileErrorClass();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot use [] for reading in %s(%d) : eval()'d code on line %d
|
||||
My error handler runs.
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Bug #55086 (Namespace alias does not work inside trait's use block)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace N1 {
|
||||
|
||||
trait T1 {
|
||||
public function hello() { return 'hello from t1'; }
|
||||
}
|
||||
|
||||
trait T2 {
|
||||
public function hello() { return 'hello from t2'; }
|
||||
}
|
||||
|
||||
}
|
||||
namespace N2 {
|
||||
use N1\T1;
|
||||
use N1\T2;
|
||||
class A {
|
||||
use T1, T2 {
|
||||
T1::hello insteadof T2;
|
||||
T1::hello as foo;
|
||||
}
|
||||
}
|
||||
$a = new A;
|
||||
echo $a->hello(), PHP_EOL;
|
||||
echo $a->foo(), PHP_EOL;
|
||||
try {
|
||||
} catch(namespace \Foo $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
hello from t1
|
||||
hello from t1
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Bug #55135 (Array keys are no longer type casted in unset())
|
||||
--FILE--
|
||||
<?php
|
||||
// This fails.
|
||||
$array = array(1 => 2);
|
||||
$a = "1";
|
||||
unset($array[$a]);
|
||||
print_r($array);
|
||||
|
||||
// Those works.
|
||||
$array = array(1 => 2);
|
||||
$a = 1;
|
||||
unset($array[$a]);
|
||||
print_r($array);
|
||||
|
||||
$array = array(1 => 2);
|
||||
unset($array[1]);
|
||||
print_r($array);
|
||||
|
||||
$array = array(1 => 2);
|
||||
$a = 1;
|
||||
unset($array["1"]);
|
||||
print_r($array);
|
||||
?>
|
||||
--EXPECT--
|
||||
Array
|
||||
(
|
||||
)
|
||||
Array
|
||||
(
|
||||
)
|
||||
Array
|
||||
(
|
||||
)
|
||||
Array
|
||||
(
|
||||
)
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #55137 (Changing trait static method visibility)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait A {
|
||||
protected static function foo() { echo "abc\n"; }
|
||||
private static function bar() { echo "def\n"; }
|
||||
}
|
||||
|
||||
|
||||
class B {
|
||||
use A {
|
||||
A::foo as public;
|
||||
A::bar as public baz;
|
||||
}
|
||||
}
|
||||
|
||||
B::foo();
|
||||
B::baz();
|
||||
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
abc
|
||||
def
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Bug #55156 (ReflectionClass::getDocComment() returns comment even though the class has none)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/** test */
|
||||
namespace foo {
|
||||
function test() { }
|
||||
|
||||
$x = new \ReflectionFunction('foo\test');
|
||||
var_dump($x->getDocComment());
|
||||
|
||||
/** test1 */
|
||||
class bar { }
|
||||
|
||||
/** test2 */
|
||||
class foo extends namespace\bar { }
|
||||
|
||||
$x = new \ReflectionClass('foo\bar');
|
||||
var_dump($x->getDocComment());
|
||||
|
||||
$x = new \ReflectionClass('foo\foo');
|
||||
var_dump($x->getDocComment());
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
string(12) "/** test1 */"
|
||||
string(12) "/** test2 */"
|
||||
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Request #55247 (Parser problem with static calls using string method name)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test{
|
||||
public static function __callStatic($method, $arguments)
|
||||
{
|
||||
echo $method . PHP_EOL;
|
||||
}
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
echo $method . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
$method = 'method';
|
||||
|
||||
$test = new Test();
|
||||
|
||||
$test->method();
|
||||
$test->$method();
|
||||
$test->{'method'}();
|
||||
|
||||
Test::method();
|
||||
Test::$method();
|
||||
Test::{'method'}();
|
||||
--EXPECT--
|
||||
method
|
||||
method
|
||||
method
|
||||
method
|
||||
method
|
||||
method
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #55305 (ref lost: 1st ref instantiated in class def, 2nd ref made w/o instantiating)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
var $foo = "test";
|
||||
}
|
||||
|
||||
$f = new Foo();
|
||||
$f->bar =& $f->foo;
|
||||
var_dump($f->foo);
|
||||
var_dump($f->bar);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(4) "test"
|
||||
string(4) "test"
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
concat difffent types
|
||||
concat different types
|
||||
--INI--
|
||||
precision=14
|
||||
--FILE--
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Persistent case insensetive and user defined constants
|
||||
Persistent case insensitive and user defined constants
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(ZEND_THREAD_safe);
|
||||
@@ -7,5 +7,6 @@ define("ZEND_THREAD_safe", 123);
|
||||
var_dump(ZEND_THREAD_safe);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(%s)
|
||||
Notice: Use of undefined constant ZEND_THREAD_safe - assumed 'ZEND_THREAD_safe' in %s on line %d
|
||||
string(16) "ZEND_THREAD_safe"
|
||||
int(123)
|
||||
@@ -1,12 +1,18 @@
|
||||
--TEST--
|
||||
Testing declare statement with several type values
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mbstring")) {
|
||||
die("skip Requires ext/mbstring");
|
||||
}
|
||||
?>
|
||||
--INI--
|
||||
zend.multibyte=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
declare(encoding = 1);
|
||||
declare(encoding = 1123131232131312321);
|
||||
declare(encoding = 112313123213131232100);
|
||||
declare(encoding = NULL);
|
||||
declare(encoding = 'utf-8');
|
||||
declare(encoding = M_PI);
|
||||
@@ -17,8 +23,8 @@ print 'DONE';
|
||||
--EXPECTF--
|
||||
Warning: Unsupported encoding [1] in %sdeclare_001.php on line %d
|
||||
|
||||
Warning: Unsupported encoding [1.1231312321313E+18] in %sdeclare_001.php on line %d
|
||||
Warning: Unsupported encoding [1.1231312321313E+20] in %sdeclare_001.php on line %d
|
||||
|
||||
Warning: Unsupported encoding [] in %sdeclare_001.php on line %d
|
||||
|
||||
Fatal error: Cannot use constants as encoding in %sdeclare_001.php on line %d
|
||||
Fatal error: Cannot use constants as encoding in %sdeclare_001.php on line %d
|
||||
@@ -5,6 +5,9 @@ Testing declare statement with several type values
|
||||
if (!ini_get("zend.multibyte")) {
|
||||
die("skip Requires zend.multibyte=1");
|
||||
}
|
||||
if (!extension_loaded("mbstring")) {
|
||||
die("skip Requires ext/mbstring");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Testing declare statement with several type values
|
||||
--INI--
|
||||
precision=15
|
||||
zend.multibyte=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
declare(encoding = 1);
|
||||
declare(encoding = 11111111111111);
|
||||
declare(encoding = NULL);
|
||||
declare(encoding = M_PI);
|
||||
|
||||
print 'DONE';
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Unsupported encoding [1] in %sdeclare_003.php on line %d
|
||||
|
||||
Warning: Unsupported encoding [11111111111111] in %sdeclare_003.php on line %d
|
||||
|
||||
Warning: Unsupported encoding [] in %sdeclare_003.php on line %d
|
||||
|
||||
Fatal error: Cannot use constants as encoding in %sdeclare_003.php on line %d
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Testing declare statement with several type values
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!ini_get("zend.multibyte")) {
|
||||
die("skip Requires zend.multibyte=1");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
declare(encoding = 1);
|
||||
declare(encoding = 1123131232131312321);
|
||||
declare(encoding = NULL);
|
||||
declare(encoding = M_PI);
|
||||
|
||||
print 'DONE';
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Unsupported encoding [%d] in %sdeclare_004.php on line 3
|
||||
|
||||
Warning: Unsupported encoding [%f] in %sdeclare_004.php on line 4
|
||||
|
||||
Warning: Unsupported encoding [] in %sdeclare_004.php on line 5
|
||||
|
||||
Fatal error: Cannot use constants as encoding in %sdeclare_004.php on line 6
|
||||
@@ -22,5 +22,5 @@ var_dump(error_reporting());
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
int(30719)
|
||||
int(32767)
|
||||
Done
|
||||
@@ -30,5 +30,5 @@ echo "Done\n";
|
||||
Notice: Undefined variable: undef_value in %s on line %d
|
||||
|
||||
Notice: Undefined variable: undef_name in %s on line %d
|
||||
int(30719)
|
||||
int(32767)
|
||||
Done
|
||||
@@ -26,5 +26,5 @@ var_dump(error_reporting());
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(30719)
|
||||
int(32767)
|
||||
Done
|
||||
@@ -26,5 +26,5 @@ var_dump(error_reporting());
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(30719)
|
||||
int(32767)
|
||||
Done
|
||||
@@ -30,6 +30,6 @@ var_dump(error_reporting());
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(30719)
|
||||
int(30711)
|
||||
int(32767)
|
||||
int(32759)
|
||||
Done
|
||||
@@ -0,0 +1,150 @@
|
||||
--TEST--
|
||||
Calling method from array
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Hello {
|
||||
public function world($x) {
|
||||
echo "Hello, $x\n"; return $this;
|
||||
}
|
||||
}
|
||||
|
||||
class Hello2 {
|
||||
static public function world($x) {
|
||||
echo "Hello, $x\n";
|
||||
}
|
||||
}
|
||||
|
||||
class Magic {
|
||||
public function __call($f, $a) {
|
||||
printf("%s called (%s)!\n", __METHOD__, $f);
|
||||
}
|
||||
}
|
||||
|
||||
class Magic2 {
|
||||
public static function __callStatic($f, $a) {
|
||||
printf("%s called (%s)!\n", __METHOD__, $f);
|
||||
}
|
||||
}
|
||||
|
||||
class Magic3 {
|
||||
public static function __callStatic($f, $a) {
|
||||
printf("%s called (%s)!\n", __METHOD__, $f);
|
||||
}
|
||||
public function __call($f, $a) {
|
||||
printf("%s called (%s)!\n", __METHOD__, $f);
|
||||
}
|
||||
}
|
||||
|
||||
$f = array('Hello','world');
|
||||
var_dump($f('you'));
|
||||
var_dump(call_user_func($f, 'you'));
|
||||
|
||||
printf("-----\n");
|
||||
|
||||
$h= new Hello;
|
||||
$f = array($h,'world');
|
||||
var_dump($f('again'));
|
||||
var_dump(call_user_func($f, 'again'));
|
||||
|
||||
printf("-----\n");
|
||||
|
||||
function bar() {
|
||||
return array(new Hello,'world');
|
||||
}
|
||||
$f = bar();
|
||||
var_dump($f('there'));
|
||||
var_dump(call_user_func($f, 'there'));
|
||||
|
||||
printf("-----\n");
|
||||
|
||||
$x = function ($c,$v) { return array($c, $v); };
|
||||
|
||||
$c = new Hello;
|
||||
$m = 'world';
|
||||
$f = $x($c, $m);
|
||||
var_dump($f('devs'));
|
||||
var_dump(call_user_func($f, 'devs'));
|
||||
|
||||
printf("-----\n");
|
||||
|
||||
$f = array(new Magic, 'foo');
|
||||
$f();
|
||||
call_user_func($f);
|
||||
|
||||
printf("-----\n");
|
||||
|
||||
$f = array('Magic2', 'foo');
|
||||
$f();
|
||||
call_user_func($f);
|
||||
|
||||
|
||||
printf("-----\n");
|
||||
|
||||
$f = array('Magic3', 'foo');
|
||||
$f();
|
||||
call_user_func($f);
|
||||
|
||||
printf("-----\n");
|
||||
|
||||
$f = array(new Magic3, 'foo');
|
||||
$f();
|
||||
call_user_func($f);
|
||||
|
||||
printf("-----\n");
|
||||
|
||||
$f = array(new Hello2, 'world');
|
||||
var_dump($f('you'));
|
||||
var_dump(call_user_func($f, 'you'));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Strict Standards: Non-static method Hello::world() should not be called statically in %s on line %d
|
||||
Hello, you
|
||||
|
||||
Notice: Undefined variable: this in %s on line %d
|
||||
NULL
|
||||
|
||||
Strict Standards: call_user_func() expects parameter 1 to be a valid callback, non-static method Hello::world() should not be called statically in %s on line %d
|
||||
Hello, you
|
||||
|
||||
Notice: Undefined variable: this in %s on line %d
|
||||
NULL
|
||||
-----
|
||||
Hello, again
|
||||
object(Hello)#1 (0) {
|
||||
}
|
||||
Hello, again
|
||||
object(Hello)#1 (0) {
|
||||
}
|
||||
-----
|
||||
Hello, there
|
||||
object(Hello)#2 (0) {
|
||||
}
|
||||
Hello, there
|
||||
object(Hello)#2 (0) {
|
||||
}
|
||||
-----
|
||||
Hello, devs
|
||||
object(Hello)#4 (0) {
|
||||
}
|
||||
Hello, devs
|
||||
object(Hello)#4 (0) {
|
||||
}
|
||||
-----
|
||||
Magic::__call called (foo)!
|
||||
Magic::__call called (foo)!
|
||||
-----
|
||||
Magic2::__callStatic called (foo)!
|
||||
Magic2::__callStatic called (foo)!
|
||||
-----
|
||||
Magic3::__callStatic called (foo)!
|
||||
Magic3::__callStatic called (foo)!
|
||||
-----
|
||||
Magic3::__call called (foo)!
|
||||
Magic3::__call called (foo)!
|
||||
-----
|
||||
Hello, you
|
||||
NULL
|
||||
Hello, you
|
||||
NULL
|
||||
@@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
Argument parsing error #001
|
||||
--FILE--
|
||||
<?php
|
||||
function foo($arg1 string) {}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Parse error: syntax error, unexpected 'string' (T_STRING), expecting ')' in %sfunction_arguments_001.php on line %d
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
Argument parsing error #002
|
||||
--FILE--
|
||||
<?php
|
||||
function foo($arg1/) {}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Parse error: syntax error, unexpected '/', expecting ')' in %sfunction_arguments_002.php on line %d
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
--TEST--
|
||||
Parameter type hint - Reflection
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test(int $a, double $b, string $c, boolean $d = true, resource $e, array $f = array(), object $g) {
|
||||
}
|
||||
|
||||
$func = new ReflectionFunction('test');
|
||||
Reflection::Export($func);
|
||||
|
||||
foreach ($func->getParameters() as $i => $param) {
|
||||
printf(
|
||||
"-- Parameter #%d: %s {\n".
|
||||
" Allows NULL: %s\n".
|
||||
" Hint Type: %s\n".
|
||||
" Passed to by reference: %s\n".
|
||||
" Is optional?: %s\n",
|
||||
$i,
|
||||
$param->getName(),
|
||||
var_export($param->getClass(), 1),
|
||||
$param->getTypeHint(),
|
||||
var_export($param->allowsNull(), 1),
|
||||
var_export($param->isPassedByReference(), 1),
|
||||
$param->isOptional() ? 'yes' : 'no'
|
||||
);
|
||||
printf(" Int: %d | Double: %d | Bool: %d | String: %d | Resource: %d | Array: %d | Object: %d\n",
|
||||
$param->isInt(), $param->isDouble(), $param->isBool(), $param->isString(),
|
||||
$param->isResource(), $param->isArray(), $param->isObject());
|
||||
print "}\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Function [ <user> function test ] {
|
||||
@@ %s 3 - 4
|
||||
|
||||
- Parameters [7] {
|
||||
Parameter #0 [ <required> integer $a ]
|
||||
Parameter #1 [ <required> double $b ]
|
||||
Parameter #2 [ <required> string $c ]
|
||||
Parameter #3 [ <required> boolean $d ]
|
||||
Parameter #4 [ <required> resource $e ]
|
||||
Parameter #5 [ <required> array $f ]
|
||||
Parameter #6 [ <required> object $g ]
|
||||
}
|
||||
}
|
||||
|
||||
-- Parameter #0: a {
|
||||
Allows NULL: NULL
|
||||
Hint Type: integer
|
||||
Passed to by reference: false
|
||||
Is optional?: false
|
||||
Int: 1 | Double: 0 | Bool: 0 | String: 0 | Resource: 0 | Array: 0 | Object: 0
|
||||
}
|
||||
-- Parameter #1: b {
|
||||
Allows NULL: NULL
|
||||
Hint Type: double
|
||||
Passed to by reference: false
|
||||
Is optional?: false
|
||||
Int: 0 | Double: 1 | Bool: 0 | String: 0 | Resource: 0 | Array: 0 | Object: 0
|
||||
}
|
||||
-- Parameter #2: c {
|
||||
Allows NULL: NULL
|
||||
Hint Type: string
|
||||
Passed to by reference: false
|
||||
Is optional?: false
|
||||
Int: 0 | Double: 0 | Bool: 0 | String: 1 | Resource: 0 | Array: 0 | Object: 0
|
||||
}
|
||||
-- Parameter #3: d {
|
||||
Allows NULL: NULL
|
||||
Hint Type: boolean
|
||||
Passed to by reference: false
|
||||
Is optional?: false
|
||||
Int: 0 | Double: 0 | Bool: 1 | String: 0 | Resource: 0 | Array: 0 | Object: 0
|
||||
}
|
||||
-- Parameter #4: e {
|
||||
Allows NULL: NULL
|
||||
Hint Type: resource
|
||||
Passed to by reference: false
|
||||
Is optional?: false
|
||||
Int: 0 | Double: 0 | Bool: 0 | String: 0 | Resource: 1 | Array: 0 | Object: 0
|
||||
}
|
||||
-- Parameter #5: f {
|
||||
Allows NULL: NULL
|
||||
Hint Type: array
|
||||
Passed to by reference: false
|
||||
Is optional?: false
|
||||
Int: 0 | Double: 0 | Bool: 0 | String: 0 | Resource: 0 | Array: 1 | Object: 0
|
||||
}
|
||||
-- Parameter #6: g {
|
||||
Allows NULL: NULL
|
||||
Hint Type: object
|
||||
Passed to by reference: false
|
||||
Is optional?: false
|
||||
Int: 0 | Double: 0 | Bool: 0 | String: 0 | Resource: 0 | Array: 0 | Object: 1
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Parameter type hint - Testing NULL when allowed
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test_int(int $a = null) {
|
||||
}
|
||||
test_int(null);
|
||||
|
||||
function test_double(double $a = null) {
|
||||
}
|
||||
test_double(null);
|
||||
|
||||
function test_bool(bool $a = null) {
|
||||
}
|
||||
test_bool(null);
|
||||
|
||||
print "Done";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Done
|
||||
@@ -1,46 +0,0 @@
|
||||
--TEST--
|
||||
Parameter type hint - Testing parameter with reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/* string */
|
||||
function test_string(string &$a) {
|
||||
$a .= '!!!';
|
||||
}
|
||||
|
||||
$str = 'foo';
|
||||
test_string($str);
|
||||
var_dump($str);
|
||||
|
||||
/* integer */
|
||||
function test_int(int &$b) {
|
||||
$b += 2;
|
||||
}
|
||||
|
||||
$b = 2;
|
||||
test_int($b);
|
||||
var_dump($b);
|
||||
|
||||
/* object */
|
||||
function test_obj(object &$c) {
|
||||
$c->tested = 1;
|
||||
}
|
||||
$c = new stdclass;
|
||||
test_obj($c);
|
||||
var_dump($c);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(6) "foo!!!"
|
||||
int(4)
|
||||
object(stdClass)#1 (1) {
|
||||
["tested"]=>
|
||||
int(1)
|
||||
}
|
||||
--UEXPECT--
|
||||
unicode(6) "foo!!!"
|
||||
int(4)
|
||||
object(stdClass)#1 (1) {
|
||||
[u"tested"]=>
|
||||
int(1)
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Parameter type hint - Testing string type hint with reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test(string &$a) {
|
||||
$a .= '!!!';
|
||||
}
|
||||
|
||||
$x = 'foo';
|
||||
|
||||
test($x);
|
||||
|
||||
var_dump($x);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(6) "foo!!!"
|
||||
--UEXPECT--
|
||||
unicode(6) "foo!!!"
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Parameter type hint - Testing default parameter value
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test(string &$a, integer $x = 1) {
|
||||
var_dump($x);
|
||||
}
|
||||
|
||||
$y = 'foo';
|
||||
test($y, 2);
|
||||
test($y);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
int(1)
|
||||
@@ -1,28 +0,0 @@
|
||||
--TEST--
|
||||
Parameter type hint - Testing with heredoc
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test(string $str) {
|
||||
}
|
||||
|
||||
test(<<<FOO
|
||||
test!
|
||||
FOO
|
||||
);
|
||||
|
||||
test(<<<'FOO'
|
||||
test!
|
||||
FOO
|
||||
);
|
||||
|
||||
test(<<<"FOO"
|
||||
test!
|
||||
FOO
|
||||
);
|
||||
|
||||
print "Ok!";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Ok!
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Parameter type hint - Testing default parameter values
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test(string $a, bool $b = NULL, integer $c, double $d = NULL, $e) {
|
||||
print "ok\n";
|
||||
}
|
||||
|
||||
test('foo', NULL, 1, NULL, 'bar');
|
||||
test('foo', true, 0, -1., NULL);
|
||||
test('true', false, -1, 2.2222, 1.1);
|
||||
test('1.1', false, -1, 11111111111111111111111111, true);
|
||||
test('1', false, -1, NULL, new stdClass);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
ok
|
||||
ok
|
||||
ok
|
||||
ok
|
||||
@@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
Parameter type hint - Testing default parameter values as constants
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test(int $foo = PHP_INT_MAX) {
|
||||
print "ok\n";
|
||||
}
|
||||
|
||||
test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
@@ -1,18 +0,0 @@
|
||||
--TEST--
|
||||
Parameter type hint - formatting
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test(int$foo) { print "ok\n";}
|
||||
test(1);
|
||||
|
||||
function test2(int
|
||||
|
||||
|
||||
$foo) { print "ok\n";}
|
||||
test2(1);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
ok
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Parameter type hint - scalar type hints, default value
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function bar1(scalar $param = null) {}
|
||||
function bar2(scalar $param = 123) {}
|
||||
function bar3(scalar $param = false) {}
|
||||
function bar4(scalar $param = 988.99) {}
|
||||
function bar5(scalar $param = "1233") {}
|
||||
function bar6(scalar $param = array(1,2,3)) {}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Default value for parameters with scalar type hint can only be scalar or NULL in %s on line 8
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Indirect method call by array - Invalid class name
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = array('a', 'b');
|
||||
$arr();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Class 'a' not found in %s on line %d
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Indirect method call by array - Invalid method name
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = array('stdclass', 'b');
|
||||
$arr();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Call to undefined method stdClass::b() in %s on line %d
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Indirect method call by array - Calling __call() and __callStatic()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class foo {
|
||||
public function __call($a, $b) {
|
||||
printf("From %s:\n", __METHOD__);
|
||||
var_dump($a);
|
||||
var_dump($this);
|
||||
}
|
||||
static public function __callStatic($a, $b) {
|
||||
printf("From %s:\n", __METHOD__);
|
||||
var_dump($a);
|
||||
var_dump($this);
|
||||
}
|
||||
}
|
||||
|
||||
$arr = array('foo', 'abc');
|
||||
$arr();
|
||||
|
||||
$foo = new foo;
|
||||
$arr = array($foo, 'abc');
|
||||
$arr();
|
||||
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
From foo::__callStatic:
|
||||
string(3) "abc"
|
||||
|
||||
Notice: Undefined variable: this in %s on line %d
|
||||
NULL
|
||||
From foo::__call:
|
||||
string(3) "abc"
|
||||
object(foo)#%d (0) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
--TEST--
|
||||
Indirect method call by array - Testing exception and method magics
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class foo {
|
||||
static public function abc() {
|
||||
throw new Exception('foo');
|
||||
}
|
||||
public function __call($a, $b) {
|
||||
printf("From %s:\n", __METHOD__);
|
||||
throw new Exception($a);
|
||||
}
|
||||
static public function __callStatic($a, $b) {
|
||||
printf("From %s:\n", __METHOD__);
|
||||
throw new Exception($a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$arr = array('foo', 'abc');
|
||||
|
||||
try {
|
||||
$arr();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
$arr = array('foo', '123');
|
||||
|
||||
try {
|
||||
$arr();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
|
||||
echo "------\n";
|
||||
|
||||
$foo = new foo;
|
||||
$arr = array($foo, 'abc');
|
||||
|
||||
try {
|
||||
$arr();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
|
||||
$foo = new foo;
|
||||
$arr = array($foo, '123');
|
||||
|
||||
try {
|
||||
$arr();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
foo
|
||||
From foo::__callStatic:
|
||||
123
|
||||
------
|
||||
foo
|
||||
From foo::__call:
|
||||
123
|
||||
@@ -38,6 +38,6 @@ bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
AUTOLOAD 'X1'
|
||||
bool(false)
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #55137 (Changing trait static method visibility)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait A {
|
||||
protected static function foo() { echo "abc\n"; }
|
||||
private static function bar() { echo "def\n"; }
|
||||
}
|
||||
|
||||
|
||||
class B {
|
||||
use A {
|
||||
A::foo as public;
|
||||
A::bar as public baz;
|
||||
}
|
||||
}
|
||||
|
||||
B::foo();
|
||||
B::baz();
|
||||
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
abc
|
||||
def
|
||||
@@ -0,0 +1,48 @@
|
||||
--TEST--
|
||||
Bug #55214 (Use of __CLASS__ within trait returns trait name not class name)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait ATrait {
|
||||
public static function get_class_name() {
|
||||
return __CLASS__;
|
||||
}
|
||||
|
||||
public function get_class_name_obj() {
|
||||
return __CLASS__;
|
||||
}
|
||||
}
|
||||
|
||||
trait Indirect {
|
||||
use ATrait;
|
||||
}
|
||||
|
||||
class SomeClass {
|
||||
use ATrait;
|
||||
}
|
||||
|
||||
class UsingIndirect {
|
||||
use Indirect;
|
||||
}
|
||||
|
||||
$r = SomeClass::get_class_name();
|
||||
var_dump($r);
|
||||
|
||||
$o = new SomeClass();
|
||||
$r = $o->get_class_name_obj();
|
||||
var_dump($r);
|
||||
|
||||
$r = UsingIndirect::get_class_name();
|
||||
var_dump($r);
|
||||
|
||||
$o = new UsingIndirect();
|
||||
$r = $o->get_class_name_obj();
|
||||
var_dump($r);
|
||||
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(9) "SomeClass"
|
||||
string(9) "SomeClass"
|
||||
string(13) "UsingIndirect"
|
||||
string(13) "UsingIndirect"
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Properties are considered incompatible if they are different in any of their
|
||||
defined characteristics. Thus, initialization values have to be equal, too.
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
trait foo
|
||||
{
|
||||
public $zoo = 'foo::zoo';
|
||||
}
|
||||
|
||||
class baz
|
||||
{
|
||||
use foo;
|
||||
public $zoo = 'baz::zoo';
|
||||
}
|
||||
|
||||
$obj = new baz();
|
||||
echo $obj->zoo, "\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: baz and foo define the same property ($zoo) in the composition of baz. However, the definition differs and is considered incompatible. Class was composed in %s on line %d
|
||||
@@ -13,6 +13,7 @@ trait THello2 {
|
||||
}
|
||||
|
||||
echo "PRE-CLASS-GUARD-TraitsTest\n";
|
||||
error_reporting(E_ALL & ~E_STRICT); // ensuring that it is only for E_STRICT
|
||||
|
||||
class TraitsTest {
|
||||
use THello1;
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
__TRAIT__: Basics, a constant denoiting the trait of definition.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function test() {
|
||||
return __TRAIT__;
|
||||
}
|
||||
}
|
||||
|
||||
class Direct {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
class IndirectInheritance extends Direct {
|
||||
|
||||
}
|
||||
|
||||
trait TestTraitIndirect {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
class Indirect {
|
||||
use TestTraitIndirect;
|
||||
}
|
||||
|
||||
echo Direct::test()."\n";
|
||||
echo IndirectInheritance::test()."\n";
|
||||
echo Indirect::test()."\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
TestTrait
|
||||
TestTrait
|
||||
TestTrait
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
__TRAIT__: Use outside of traits.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class MyClass {
|
||||
static function test() {
|
||||
return __TRAIT__;
|
||||
}
|
||||
}
|
||||
|
||||
function someFun() {
|
||||
return __TRAIT__;
|
||||
}
|
||||
|
||||
|
||||
$t = __TRAIT__;
|
||||
var_dump($t);
|
||||
$t = MyClass::test();
|
||||
var_dump($t);
|
||||
$t = someFun();
|
||||
var_dump($t);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
+50
@@ -108,6 +108,9 @@ ZEND_INI_BEGIN()
|
||||
STD_ZEND_INI_BOOLEAN("zend.multibyte", "0", ZEND_INI_PERDIR, OnUpdateBool, multibyte, zend_compiler_globals, compiler_globals)
|
||||
ZEND_INI_ENTRY("zend.script_encoding", NULL, ZEND_INI_ALL, OnUpdateScriptEncoding)
|
||||
STD_ZEND_INI_BOOLEAN("zend.detect_unicode", "1", ZEND_INI_ALL, OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals)
|
||||
#ifdef ZEND_SIGNALS
|
||||
STD_ZEND_INI_BOOLEAN("zend.signal_check", "0", ZEND_INI_SYSTEM, OnUpdateBool, check, zend_signal_globals_t, zend_signal_globals)
|
||||
#endif
|
||||
ZEND_INI_END()
|
||||
|
||||
|
||||
@@ -659,8 +662,10 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions TS
|
||||
}
|
||||
zend_stream_open_function = utility_functions->stream_open_function;
|
||||
zend_message_dispatcher_p = utility_functions->message_handler;
|
||||
#ifndef ZEND_SIGNALS
|
||||
zend_block_interruptions = utility_functions->block_interruptions;
|
||||
zend_unblock_interruptions = utility_functions->unblock_interruptions;
|
||||
#endif
|
||||
zend_get_configuration_directive_p = utility_functions->get_configuration_directive;
|
||||
zend_ticks_function = utility_functions->ticks_function;
|
||||
zend_on_timeout = utility_functions->on_timeout;
|
||||
@@ -791,6 +796,9 @@ void zend_post_startup(TSRMLS_D) /* {{{ */
|
||||
|
||||
void zend_shutdown(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
#ifdef ZEND_SIGNALS
|
||||
zend_signal_shutdown(TSRMLS_C);
|
||||
#endif
|
||||
#ifdef ZEND_WIN32
|
||||
zend_shutdown_timeout_thread();
|
||||
#endif
|
||||
@@ -849,6 +857,7 @@ ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */
|
||||
exit(-1);
|
||||
}
|
||||
CG(unclean_shutdown) = 1;
|
||||
CG(active_class_entry) = NULL;
|
||||
CG(in_compilation) = EG(in_execution) = 0;
|
||||
EG(current_execute_data) = NULL;
|
||||
LONGJMP(*EG(bailout), FAILURE);
|
||||
@@ -966,6 +975,23 @@ ZEND_API int zend_get_configuration_directive(const char *name, uint name_length
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#define SAVE_STACK(stack) do { \
|
||||
if (CG(stack).top) { \
|
||||
memcpy(&stack, &CG(stack), sizeof(zend_stack)); \
|
||||
CG(stack).top = CG(stack).max = 0; \
|
||||
CG(stack).elements = NULL; \
|
||||
} else { \
|
||||
stack.top = 0; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define RESTORE_STACK(stack) do { \
|
||||
if (stack.top) { \
|
||||
zend_stack_destroy(&CG(stack)); \
|
||||
memcpy(&CG(stack), &stack, sizeof(zend_stack)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
{
|
||||
va_list args;
|
||||
@@ -978,6 +1004,14 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
zval *orig_user_error_handler;
|
||||
zend_bool in_compilation;
|
||||
zend_class_entry *saved_class_entry;
|
||||
zend_stack bp_stack;
|
||||
zend_stack function_call_stack;
|
||||
zend_stack switch_cond_stack;
|
||||
zend_stack foreach_copy_stack;
|
||||
zend_stack object_stack;
|
||||
zend_stack declare_stack;
|
||||
zend_stack list_stack;
|
||||
zend_stack context_stack;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
/* Obtain relevant filename and lineno */
|
||||
@@ -1114,6 +1148,14 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
if (in_compilation) {
|
||||
saved_class_entry = CG(active_class_entry);
|
||||
CG(active_class_entry) = NULL;
|
||||
SAVE_STACK(bp_stack);
|
||||
SAVE_STACK(function_call_stack);
|
||||
SAVE_STACK(switch_cond_stack);
|
||||
SAVE_STACK(foreach_copy_stack);
|
||||
SAVE_STACK(object_stack);
|
||||
SAVE_STACK(declare_stack);
|
||||
SAVE_STACK(list_stack);
|
||||
SAVE_STACK(context_stack);
|
||||
}
|
||||
|
||||
if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) {
|
||||
@@ -1130,6 +1172,14 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
|
||||
if (in_compilation) {
|
||||
CG(active_class_entry) = saved_class_entry;
|
||||
RESTORE_STACK(bp_stack);
|
||||
RESTORE_STACK(function_call_stack);
|
||||
RESTORE_STACK(switch_cond_stack);
|
||||
RESTORE_STACK(foreach_copy_stack);
|
||||
RESTORE_STACK(object_stack);
|
||||
RESTORE_STACK(declare_stack);
|
||||
RESTORE_STACK(list_stack);
|
||||
RESTORE_STACK(context_stack);
|
||||
}
|
||||
|
||||
if (!EG(user_error_handler)) {
|
||||
|
||||
+11
-4
@@ -531,8 +531,10 @@ typedef struct _zend_utility_functions {
|
||||
int (*write_function)(const char *str, uint str_length);
|
||||
FILE *(*fopen_function)(const char *filename, char **opened_path TSRMLS_DC);
|
||||
void (*message_handler)(long message, void *data TSRMLS_DC);
|
||||
#ifndef ZEND_SIGNALS
|
||||
void (*block_interruptions)(void);
|
||||
void (*unblock_interruptions)(void);
|
||||
#endif
|
||||
int (*get_configuration_directive)(const char *name, uint name_length, zval *contents);
|
||||
void (*ticks_function)(int ticks);
|
||||
void (*on_timeout)(int seconds TSRMLS_DC);
|
||||
@@ -573,10 +575,6 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length);
|
||||
#define IS_RESOURCE 7
|
||||
#define IS_CONSTANT 8
|
||||
#define IS_CONSTANT_ARRAY 9
|
||||
/* used for type-hinting only */
|
||||
#define IS_CLASS 10
|
||||
#define IS_SCALAR 11
|
||||
#define IS_NUMERIC 12
|
||||
|
||||
/* Ugly hack to support constants as static array indices */
|
||||
#define IS_CONSTANT_TYPE_MASK 0x00f
|
||||
@@ -678,8 +676,10 @@ BEGIN_EXTERN_C()
|
||||
extern ZEND_API int (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
|
||||
extern ZEND_API zend_write_func_t zend_write;
|
||||
extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC);
|
||||
#ifndef ZEND_SIGNALS
|
||||
extern ZEND_API void (*zend_block_interruptions)(void);
|
||||
extern ZEND_API void (*zend_unblock_interruptions)(void);
|
||||
#endif
|
||||
extern ZEND_API void (*zend_ticks_function)(int ticks);
|
||||
extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
|
||||
extern void (*zend_on_timeout)(int seconds TSRMLS_DC);
|
||||
@@ -702,8 +702,15 @@ END_EXTERN_C()
|
||||
|
||||
#define ZEND_UV(name) (zend_uv.name)
|
||||
|
||||
#ifndef ZEND_SIGNALS
|
||||
#define HANDLE_BLOCK_INTERRUPTIONS() if (zend_block_interruptions) { zend_block_interruptions(); }
|
||||
#define HANDLE_UNBLOCK_INTERRUPTIONS() if (zend_unblock_interruptions) { zend_unblock_interruptions(); }
|
||||
#else
|
||||
#include "zend_signal.h"
|
||||
|
||||
#define HANDLE_BLOCK_INTERRUPTIONS() SIGG(depth)++;
|
||||
#define HANDLE_UNBLOCK_INTERRUPTIONS() if (UNEXPECTED((--SIGG(depth))==SIGG(blocked))) { zend_signal_handler_unblock(TSRMLS_C); }
|
||||
#endif
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_message_dispatcher(long message, void *data TSRMLS_DC);
|
||||
|
||||
+28
-12
@@ -205,10 +205,6 @@ ZEND_API char *zend_get_type_by_const(int type) /* {{{ */
|
||||
switch(type) {
|
||||
case IS_BOOL:
|
||||
return "boolean";
|
||||
case IS_SCALAR:
|
||||
return "scalar";
|
||||
case IS_NUMERIC:
|
||||
return "numeric";
|
||||
case IS_LONG:
|
||||
return "integer";
|
||||
case IS_DOUBLE:
|
||||
@@ -216,7 +212,6 @@ ZEND_API char *zend_get_type_by_const(int type) /* {{{ */
|
||||
case IS_STRING:
|
||||
return "string";
|
||||
case IS_OBJECT:
|
||||
case IS_CLASS:
|
||||
return "object";
|
||||
case IS_RESOURCE:
|
||||
return "resource";
|
||||
@@ -411,6 +406,7 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, const cha
|
||||
}
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
case 's':
|
||||
{
|
||||
char **p = va_arg(*va, char **);
|
||||
@@ -437,17 +433,23 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, const cha
|
||||
}
|
||||
*p = Z_STRVAL_PP(arg);
|
||||
*pl = Z_STRLEN_PP(arg);
|
||||
if (c == 'p' && CHECK_ZVAL_NULL_PATH(*arg)) {
|
||||
return "a valid path";
|
||||
}
|
||||
break;
|
||||
|
||||
case IS_OBJECT:
|
||||
if (parse_arg_object_to_string(arg, p, pl, IS_STRING TSRMLS_CC) == SUCCESS) {
|
||||
if (c == 'p' && CHECK_ZVAL_NULL_PATH(*arg)) {
|
||||
return "a valid path";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IS_ARRAY:
|
||||
case IS_RESOURCE:
|
||||
default:
|
||||
return "string";
|
||||
return c == 's' ? "string" : "a valid path";
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -713,7 +715,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
|
||||
case 'z': case 'Z':
|
||||
case 'C': case 'h':
|
||||
case 'f': case 'A':
|
||||
case 'H':
|
||||
case 'H': case 'p':
|
||||
max_num_args++;
|
||||
break;
|
||||
|
||||
@@ -1915,7 +1917,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
|
||||
const zend_function_entry *ptr = functions;
|
||||
zend_function function, *reg_function;
|
||||
zend_internal_function *internal_function = (zend_internal_function *)&function;
|
||||
int count=0, unload=0;
|
||||
int count=0, unload=0, result=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;
|
||||
@@ -2021,7 +2023,12 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
|
||||
}
|
||||
fname_len = strlen(ptr->fname);
|
||||
lowercase_name = zend_new_interned_string(zend_str_tolower_dup(ptr->fname, fname_len), fname_len + 1, 1 TSRMLS_CC);
|
||||
if (zend_hash_add(target_function_table, lowercase_name, fname_len+1, &function, sizeof(zend_function), (void**)®_function) == FAILURE) {
|
||||
if (IS_INTERNED(lowercase_name)) {
|
||||
result = zend_hash_quick_add(target_function_table, lowercase_name, fname_len+1, INTERNED_HASH(lowercase_name), &function, sizeof(zend_function), (void**)®_function);
|
||||
} else {
|
||||
result = zend_hash_add(target_function_table, lowercase_name, fname_len+1, &function, sizeof(zend_function), (void**)®_function);
|
||||
}
|
||||
if (result == FAILURE) {
|
||||
unload=1;
|
||||
str_efree(lowercase_name);
|
||||
break;
|
||||
@@ -2031,7 +2038,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
|
||||
* If it's an old-style constructor, store it only if we don't have
|
||||
* a constructor already.
|
||||
*/
|
||||
if ((fname_len == class_name_len) && !memcmp(lowercase_name, lc_class_name, class_name_len+1) && !ctor) {
|
||||
if ((fname_len == class_name_len) && !ctor && !memcmp(lowercase_name, lc_class_name, class_name_len+1)) {
|
||||
ctor = reg_function;
|
||||
} else if ((fname_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME))) {
|
||||
ctor = reg_function;
|
||||
@@ -2259,7 +2266,7 @@ void module_destructor(zend_module_entry *module) /* {{{ */
|
||||
|
||||
#if HAVE_LIBDL
|
||||
#if !(defined(NETWARE) && defined(APACHE_1_BUILD))
|
||||
if (module->handle) {
|
||||
if (module->handle && !getenv("ZEND_DONT_UNLOAD_MODULES")) {
|
||||
DL_UNLOAD(module->handle);
|
||||
}
|
||||
#endif
|
||||
@@ -2385,7 +2392,11 @@ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class
|
||||
|
||||
zend_str_tolower_copy(lowercase_name, orig_class_entry->name, class_entry->name_length);
|
||||
lowercase_name = zend_new_interned_string(lowercase_name, class_entry->name_length + 1, 1 TSRMLS_CC);
|
||||
zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, &class_entry, sizeof(zend_class_entry *), NULL);
|
||||
if (IS_INTERNED(lowercase_name)) {
|
||||
zend_hash_quick_update(CG(class_table), lowercase_name, class_entry->name_length+1, INTERNED_HASH(lowercase_name), &class_entry, sizeof(zend_class_entry *), NULL);
|
||||
} else {
|
||||
zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, &class_entry, sizeof(zend_class_entry *), NULL);
|
||||
}
|
||||
str_efree(lowercase_name);
|
||||
return class_entry;
|
||||
}
|
||||
@@ -2773,6 +2784,11 @@ get_function_via_handler:
|
||||
if (fcc->function_handler) {
|
||||
retval = 1;
|
||||
call_via_handler = (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0;
|
||||
if (call_via_handler && !fcc->object_ptr && EG(This) &&
|
||||
Z_OBJ_HT_P(EG(This))->get_class_entry &&
|
||||
instanceof_function(Z_OBJCE_P(EG(This)), fcc->calling_scope TSRMLS_CC)) {
|
||||
fcc->object_ptr = EG(This);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -96,9 +96,11 @@ typedef struct _zend_fcall_info_cache {
|
||||
#define ZEND_NS_FALIAS(ns, name, alias, arg_info) ZEND_NS_FENTRY(ns, name, ZEND_FN(alias), arg_info, 0)
|
||||
#define ZEND_NS_DEP_FALIAS(ns, name, alias, arg_info) ZEND_NS_FENTRY(ns, name, ZEND_FN(alias), arg_info, ZEND_ACC_DEPRECATED)
|
||||
|
||||
#define ZEND_FE_END { NULL, NULL, NULL, 0, 0 }
|
||||
|
||||
#define ZEND_ARG_INFO(pass_by_ref, name) { #name, sizeof(#name)-1, NULL, 0, 0, 0, pass_by_ref},
|
||||
#define ZEND_ARG_PASS_INFO(pass_by_ref) { NULL, 0, NULL, 0, 0, 0, pass_by_ref},
|
||||
#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, sizeof(#name)-1, #classname, sizeof(#classname)-1, IS_CLASS, allow_null, pass_by_ref},
|
||||
#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, sizeof(#name)-1, #classname, sizeof(#classname)-1, IS_OBJECT, allow_null, pass_by_ref},
|
||||
#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, sizeof(#name)-1, NULL, 0, IS_ARRAY, allow_null, pass_by_ref},
|
||||
#define ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) { #name, sizeof(#name)-1, NULL, 0, type_hint, allow_null, pass_by_ref},
|
||||
#define ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, return_reference, required_num_args) \
|
||||
@@ -526,6 +528,9 @@ END_EXTERN_C()
|
||||
#define CHECK_ZVAL_STRING_REL(z)
|
||||
#endif
|
||||
|
||||
#define CHECK_ZVAL_NULL_PATH(p) (Z_STRLEN_P(p) != strlen(Z_STRVAL_P(p)))
|
||||
#define CHECK_NULL_PATH(p, l) (strlen(p) != l)
|
||||
|
||||
#define ZVAL_RESOURCE(z, l) do { \
|
||||
zval *__z = (z); \
|
||||
Z_LVAL_P(__z) = l; \
|
||||
|
||||
+53
-14
@@ -1602,6 +1602,9 @@ ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent
|
||||
int internal;
|
||||
|
||||
if (!heap->use_zend_alloc) {
|
||||
if (full_shutdown) {
|
||||
free(heap);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1879,6 +1882,11 @@ static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D
|
||||
size_t segment_size;
|
||||
zend_mm_segment *segment;
|
||||
int keep_rest = 0;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
if (EXPECTED(ZEND_MM_SMALL_SIZE(true_size))) {
|
||||
size_t index = ZEND_MM_BUCKET_INDEX(true_size);
|
||||
@@ -1899,6 +1907,7 @@ static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D
|
||||
heap->cached -= true_size;
|
||||
ZEND_MM_CHECK_MAGIC(best_fit, MEM_BLOCK_CACHED);
|
||||
ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 0);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return ZEND_MM_DATA_OF(best_fit);
|
||||
}
|
||||
#if ZEND_MM_CACHE_STAT
|
||||
@@ -1952,8 +1961,6 @@ static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D
|
||||
segment_size = heap->block_size;
|
||||
}
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
if (segment_size < true_size ||
|
||||
heap->real_size + segment_size > heap->limit) {
|
||||
/* Memory limit overflow */
|
||||
@@ -1975,8 +1982,8 @@ static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D
|
||||
#if ZEND_MM_CACHE
|
||||
zend_mm_free_cache(heap);
|
||||
#endif
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
out_of_memory:
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
#if ZEND_DEBUG
|
||||
zend_mm_safe_error(heap, "Out of memory (allocated %ld) at %s:%d (tried to allocate %lu bytes)", heap->real_size, __zend_filename, __zend_lineno, size);
|
||||
#else
|
||||
@@ -2004,7 +2011,6 @@ out_of_memory:
|
||||
} else {
|
||||
zend_mm_finished_searching_for_block:
|
||||
/* remove from free list */
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
ZEND_MM_CHECK_MAGIC(best_fit, MEM_BLOCK_FREED);
|
||||
ZEND_MM_CHECK_COOKIE(best_fit);
|
||||
ZEND_MM_CHECK_BLOCK_LINKAGE(best_fit);
|
||||
@@ -2052,11 +2058,15 @@ static void _zend_mm_free_int(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND
|
||||
zend_mm_block *mm_block;
|
||||
zend_mm_block *next_block;
|
||||
size_t size;
|
||||
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
if (!ZEND_MM_VALID_PTR(p)) {
|
||||
return;
|
||||
}
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
mm_block = ZEND_MM_HEADER_OF(p);
|
||||
size = ZEND_MM_BLOCK_SIZE(mm_block);
|
||||
ZEND_MM_CHECK_PROTECTION(mm_block);
|
||||
@@ -2079,12 +2089,11 @@ static void _zend_mm_free_int(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND
|
||||
heap->cache_stat[index].max_count = heap->cache_stat[index].count;
|
||||
}
|
||||
#endif
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
heap->size -= size;
|
||||
|
||||
next_block = ZEND_MM_BLOCK_AT(mm_block, size);
|
||||
@@ -2114,10 +2123,15 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
|
||||
size_t true_size;
|
||||
size_t orig_size;
|
||||
void *ptr;
|
||||
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
if (UNEXPECTED(!p) || !ZEND_MM_VALID_PTR(p)) {
|
||||
return _zend_mm_alloc_int(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
}
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
mm_block = ZEND_MM_HEADER_OF(p);
|
||||
true_size = ZEND_MM_TRUE_SIZE(size);
|
||||
orig_size = ZEND_MM_BLOCK_SIZE(mm_block);
|
||||
@@ -2133,7 +2147,6 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
|
||||
if (remaining_size >= ZEND_MM_ALIGNED_MIN_HEADER_SIZE) {
|
||||
zend_mm_free_block *new_free_block;
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
next_block = ZEND_MM_BLOCK_AT(mm_block, orig_size);
|
||||
if (ZEND_MM_IS_FREE_BLOCK(next_block)) {
|
||||
remaining_size += ZEND_MM_FREE_BLOCK_SIZE(next_block);
|
||||
@@ -2149,9 +2162,9 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
|
||||
/* add the new free block to the free list */
|
||||
zend_mm_add_to_free_list(heap, new_free_block);
|
||||
heap->size += (true_size - orig_size);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
}
|
||||
ZEND_MM_SET_DEBUG_INFO(mm_block, size, 0, 0);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -2194,6 +2207,7 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
|
||||
}
|
||||
#endif
|
||||
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return ptr;
|
||||
}
|
||||
}
|
||||
@@ -2208,7 +2222,6 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
|
||||
size_t block_size = orig_size + ZEND_MM_FREE_BLOCK_SIZE(next_block);
|
||||
size_t remaining_size = block_size - true_size;
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) next_block);
|
||||
|
||||
if (remaining_size < ZEND_MM_ALIGNED_MIN_HEADER_SIZE) {
|
||||
@@ -2239,7 +2252,6 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
|
||||
return p;
|
||||
} else if (ZEND_MM_IS_FIRST_BLOCK(mm_block) &&
|
||||
ZEND_MM_IS_GUARD_BLOCK(ZEND_MM_BLOCK_AT(next_block, ZEND_MM_FREE_BLOCK_SIZE(next_block)))) {
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) next_block);
|
||||
goto realloc_segment;
|
||||
}
|
||||
@@ -2250,7 +2262,6 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
|
||||
size_t block_size;
|
||||
size_t remaining_size;
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
realloc_segment:
|
||||
/* segment size, size of block and size of guard block */
|
||||
if (true_size > heap->block_size - (ZEND_MM_ALIGNED_SEGMENT_SIZE + ZEND_MM_ALIGNED_HEADER_SIZE)) {
|
||||
@@ -2283,8 +2294,8 @@ realloc_segment:
|
||||
#if ZEND_MM_CACHE
|
||||
zend_mm_free_cache(heap);
|
||||
#endif
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
out_of_memory:
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
#if ZEND_DEBUG
|
||||
zend_mm_safe_error(heap, "Out of memory (allocated %ld) at %s:%d (tried to allocate %ld bytes)", heap->real_size, __zend_filename, __zend_lineno, size);
|
||||
#else
|
||||
@@ -2348,6 +2359,7 @@ out_of_memory:
|
||||
memcpy(ptr, p, orig_size - ZEND_MM_ALIGNED_HEADER_SIZE);
|
||||
#endif
|
||||
_zend_mm_free_int(heap, p ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -2536,12 +2548,18 @@ ZEND_API void *_safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset
|
||||
ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
void *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
p = _safe_emalloc(nmemb, size, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
if (UNEXPECTED(p == NULL)) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
memset(p, 0, size * nmemb);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -2549,26 +2567,40 @@ ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
int length;
|
||||
char *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
length = strlen(s)+1;
|
||||
p = (char *) _emalloc(length ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
if (UNEXPECTED(p == NULL)) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
memcpy(p, s, length);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
|
||||
ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
char *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
p = (char *) _emalloc(length+1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
if (UNEXPECTED(p == NULL)) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
memcpy(p, s, length);
|
||||
p[length] = 0;
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -2576,15 +2608,22 @@ ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_
|
||||
ZEND_API char *zend_strndup(const char *s, uint length)
|
||||
{
|
||||
char *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
p = (char *) malloc(length+1);
|
||||
if (UNEXPECTED(p == NULL)) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
if (length) {
|
||||
memcpy(p, s, length);
|
||||
}
|
||||
p[length] = 0;
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */
|
||||
ZEND_FE(gc_enabled, arginfo_zend__void)
|
||||
ZEND_FE(gc_enable, arginfo_zend__void)
|
||||
ZEND_FE(gc_disable, arginfo_zend__void)
|
||||
{ NULL, NULL, NULL }
|
||||
ZEND_FE_END
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
@@ -845,45 +845,25 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
|
||||
return;
|
||||
}
|
||||
|
||||
if (only_subclass && Z_TYPE_P(obj) == IS_STRING) {
|
||||
if (Z_TYPE_P(obj) == IS_STRING) {
|
||||
zend_class_entry **the_ce;
|
||||
if (zend_lookup_class(Z_STRVAL_P(obj), Z_STRLEN_P(obj), &the_ce TSRMLS_CC) == FAILURE) {
|
||||
zend_error(E_WARNING, "Unknown class passed as parameter");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
instance_ce = *the_ce;
|
||||
} else if (Z_TYPE_P(obj) != IS_OBJECT) {
|
||||
RETURN_FALSE;
|
||||
} else if (Z_TYPE_P(obj) == IS_OBJECT && HAS_CLASS_ENTRY(*obj)) {
|
||||
instance_ce = Z_OBJCE_P(obj);
|
||||
} else {
|
||||
instance_ce = NULL;
|
||||
}
|
||||
|
||||
/* TBI!! new object handlers */
|
||||
if (Z_TYPE_P(obj) == IS_OBJECT && !HAS_CLASS_ENTRY(*obj)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (zend_lookup_class_ex(class_name, class_name_len, NULL, 0, &ce TSRMLS_CC) == FAILURE) {
|
||||
retval = 0;
|
||||
} else {
|
||||
if (only_subclass) {
|
||||
if (!instance_ce) {
|
||||
instance_ce = Z_OBJCE_P(obj)->parent;
|
||||
} else {
|
||||
instance_ce = instance_ce->parent;
|
||||
}
|
||||
} else {
|
||||
instance_ce = Z_OBJCE_P(obj);
|
||||
}
|
||||
|
||||
if (!instance_ce) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (instanceof_function(instance_ce, *ce TSRMLS_CC)) {
|
||||
retval = 1;
|
||||
} else {
|
||||
if (only_subclass && instance_ce == *ce) {
|
||||
retval = 0;
|
||||
} else {
|
||||
retval = instanceof_function(instance_ce, *ce TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1235,7 +1215,7 @@ ZEND_FUNCTION(class_exists)
|
||||
|
||||
found = zend_hash_find(EG(class_table), name, len+1, (void **) &ce);
|
||||
free_alloca(lc_name, use_heap);
|
||||
RETURN_BOOL(found == SUCCESS && !((*ce)->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS));
|
||||
RETURN_BOOL(found == SUCCESS && !(((*ce)->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT)) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS));
|
||||
}
|
||||
|
||||
if (zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC) == SUCCESS) {
|
||||
@@ -1521,7 +1501,7 @@ ZEND_FUNCTION(set_error_handler)
|
||||
zval *error_handler;
|
||||
zend_bool had_orig_error_handler=0;
|
||||
char *error_handler_name = NULL;
|
||||
long error_type = E_ALL | E_STRICT;
|
||||
long error_type = E_ALL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &error_handler, &error_type) == FAILURE) {
|
||||
return;
|
||||
|
||||
+283
-253
File diff suppressed because it is too large.
Load diff
+8
-1
@@ -39,6 +39,7 @@
|
||||
#define INC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { (CG(context).backpatch_count++); }
|
||||
#define DEC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { (CG(context).backpatch_count--); }
|
||||
#define HANDLE_INTERACTIVE() if (CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) { execute_new_code(TSRMLS_C); }
|
||||
#define DO_TICKS() if (Z_LVAL(CG(declarables).ticks)) { zend_do_ticks(TSRMLS_C); }
|
||||
|
||||
#define RESET_DOC_COMMENT() \
|
||||
{ \
|
||||
@@ -133,6 +134,11 @@ typedef struct _zend_try_catch_element {
|
||||
zend_uint catch_op; /* ketchup! */
|
||||
} zend_try_catch_element;
|
||||
|
||||
#if SIZEOF_LONG == 8
|
||||
#define THIS_HASHVAL 210728972157UL
|
||||
#else
|
||||
#define THIS_HASHVAL 275574653UL
|
||||
#endif
|
||||
|
||||
/* method flags (types) */
|
||||
#define ZEND_ACC_STATIC 0x01
|
||||
@@ -408,7 +414,7 @@ ZEND_API int zend_get_compiled_lineno(TSRMLS_D);
|
||||
ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D);
|
||||
|
||||
void zend_resolve_non_class_name(znode *element_name, zend_bool check_namespace TSRMLS_DC);
|
||||
void zend_resolve_class_name(znode *class_name, ulong *fetch_type, int check_ns_name TSRMLS_DC);
|
||||
void zend_resolve_class_name(znode *class_name, ulong fetch_type, int check_ns_name TSRMLS_DC);
|
||||
ZEND_API char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len);
|
||||
|
||||
#ifdef ZTS
|
||||
@@ -676,6 +682,7 @@ typedef struct _zend_auto_global {
|
||||
ZEND_API int zend_register_auto_global(const char *name, uint name_len, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC);
|
||||
ZEND_API void zend_activate_auto_globals(TSRMLS_D);
|
||||
ZEND_API zend_bool zend_is_auto_global(const char *name, uint name_len TSRMLS_DC);
|
||||
ZEND_API zend_bool zend_is_auto_global_quick(const char *name, uint name_len, ulong hashval TSRMLS_DC);
|
||||
ZEND_API size_t zend_dirname(char *path, size_t len);
|
||||
|
||||
int zendlex(znode *zendlval TSRMLS_DC);
|
||||
|
||||
@@ -141,7 +141,7 @@ void zend_register_standard_constants(TSRMLS_D)
|
||||
c.value.type = IS_NULL;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
|
||||
c.flags = CONST_PERSISTENT;
|
||||
c.flags = CONST_PERSISTENT | CONST_CS;
|
||||
|
||||
c.name = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE"));
|
||||
c.name_len = sizeof("ZEND_THREAD_SAFE");
|
||||
@@ -452,6 +452,7 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
|
||||
char *lowercase_name = NULL;
|
||||
char *name;
|
||||
int ret = SUCCESS;
|
||||
ulong chash = 0;
|
||||
|
||||
#if 0
|
||||
printf("Registering constant for module %d\n", c->module_number);
|
||||
@@ -463,6 +464,7 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
|
||||
zend_str_tolower(lowercase_name, c->name_len-1);
|
||||
lowercase_name = zend_new_interned_string(lowercase_name, c->name_len, 1 TSRMLS_CC);
|
||||
name = lowercase_name;
|
||||
chash = IS_INTERNED(lowercase_name) ? INTERNED_HASH(lowercase_name) : 0;
|
||||
} else {
|
||||
char *slash = strrchr(c->name, '\\');
|
||||
if(slash) {
|
||||
@@ -470,15 +472,20 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
|
||||
zend_str_tolower(lowercase_name, slash-c->name);
|
||||
lowercase_name = zend_new_interned_string(lowercase_name, c->name_len, 1 TSRMLS_CC);
|
||||
name = lowercase_name;
|
||||
|
||||
chash = IS_INTERNED(lowercase_name) ? INTERNED_HASH(lowercase_name) : 0;
|
||||
} else {
|
||||
name = c->name;
|
||||
}
|
||||
}
|
||||
if (chash == 0) {
|
||||
chash = zend_hash_func(name, c->name_len);
|
||||
}
|
||||
|
||||
/* Check if the user is trying to define the internal pseudo constant name __COMPILER_HALT_OFFSET__ */
|
||||
if ((c->name_len == sizeof("__COMPILER_HALT_OFFSET__")
|
||||
&& !memcmp(name, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1))
|
||||
|| zend_hash_add(EG(zend_constants), name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {
|
||||
|| zend_hash_quick_add(EG(zend_constants), name, c->name_len, chash, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {
|
||||
|
||||
/* The internal __COMPILER_HALT_OFFSET__ is prefixed by NULL byte */
|
||||
if (c->name[0] == '\0' && c->name_len > sizeof("\0__COMPILER_HALT_OFFSET__")
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@
|
||||
#define E_DEPRECATED (1<<13L)
|
||||
#define E_USER_DEPRECATED (1<<14L)
|
||||
|
||||
#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_RECOVERABLE_ERROR | E_DEPRECATED | E_USER_DEPRECATED)
|
||||
#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_RECOVERABLE_ERROR | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT)
|
||||
#define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
|
||||
|
||||
#endif /* ZEND_ERRORS_H */
|
||||
|
||||
+15
-13
@@ -1469,7 +1469,7 @@ void zend_set_timeout(long seconds, int reset_signals) /* {{{ */
|
||||
# ifdef HAVE_SETITIMER
|
||||
{
|
||||
struct itimerval t_r; /* timeout requested */
|
||||
sigset_t sigset;
|
||||
int signo;
|
||||
|
||||
if(seconds) {
|
||||
t_r.it_value.tv_sec = seconds;
|
||||
@@ -1478,25 +1478,27 @@ void zend_set_timeout(long seconds, int reset_signals) /* {{{ */
|
||||
# ifdef __CYGWIN__
|
||||
setitimer(ITIMER_REAL, &t_r, NULL);
|
||||
}
|
||||
if(reset_signals) {
|
||||
signal(SIGALRM, zend_timeout);
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGALRM);
|
||||
}
|
||||
signo = SIGALRM;
|
||||
# else
|
||||
setitimer(ITIMER_PROF, &t_r, NULL);
|
||||
}
|
||||
if(reset_signals) {
|
||||
signal(SIGPROF, zend_timeout);
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGPROF);
|
||||
}
|
||||
signo = SIGPROF;
|
||||
# endif
|
||||
if(reset_signals) {
|
||||
|
||||
if (reset_signals) {
|
||||
# ifdef ZEND_SIGNALS
|
||||
zend_signal(signo, zend_timeout TSRMLS_CC);
|
||||
# else
|
||||
sigset_t sigset;
|
||||
|
||||
signal(signo, zend_timeout);
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, signo);
|
||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
# endif
|
||||
}
|
||||
}
|
||||
# endif
|
||||
# endif /* HAVE_SETITIMER */
|
||||
#endif
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -101,6 +101,7 @@ struct _zend_compiler_globals {
|
||||
|
||||
HashTable *auto_globals;
|
||||
|
||||
zend_bool parse_error;
|
||||
zend_bool in_compilation;
|
||||
zend_bool short_tags;
|
||||
zend_bool asp_tags;
|
||||
|
||||
+143
-80
@@ -197,6 +197,9 @@ ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKe
|
||||
ulong h;
|
||||
uint nIndex;
|
||||
Bucket *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
|
||||
@@ -276,6 +279,9 @@ ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, ui
|
||||
{
|
||||
uint nIndex;
|
||||
Bucket *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
|
||||
@@ -362,6 +368,9 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void
|
||||
{
|
||||
uint nIndex;
|
||||
Bucket *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
CHECK_INIT(ht);
|
||||
@@ -431,6 +440,9 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void
|
||||
static int zend_hash_do_resize(HashTable *ht)
|
||||
{
|
||||
Bucket **t;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
|
||||
@@ -475,6 +487,9 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint n
|
||||
{
|
||||
uint nIndex;
|
||||
Bucket *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
|
||||
@@ -595,6 +610,9 @@ ZEND_API void zend_hash_clean(HashTable *ht)
|
||||
static Bucket *zend_hash_apply_deleter(HashTable *ht, Bucket *p)
|
||||
{
|
||||
Bucket *retval;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
if (p->pLast) {
|
||||
@@ -1193,7 +1211,11 @@ ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosi
|
||||
*/
|
||||
ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, uint str_length, ulong num_index, int mode, HashPosition *pos)
|
||||
{
|
||||
Bucket *p;
|
||||
Bucket *p, *q;
|
||||
ulong h;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
p = pos ? (*pos) : ht->pInternalPointer;
|
||||
|
||||
@@ -1206,105 +1228,142 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (mode != HASH_UPDATE_KEY_ANYWAY) {
|
||||
Bucket *q = ht->arBuckets[num_index & ht->nTableMask];
|
||||
int found = 0;
|
||||
|
||||
while (q != NULL) {
|
||||
if (q == p) {
|
||||
found = 1;
|
||||
} else if (!q->nKeyLength && q->h == num_index) {
|
||||
if (found) {
|
||||
if (mode & HASH_UPDATE_KEY_IF_BEFORE) {
|
||||
break;
|
||||
} else {
|
||||
if (p->nKeyLength) {
|
||||
zend_hash_del(ht, p->arKey, p->nKeyLength);
|
||||
} else {
|
||||
zend_hash_index_del(ht, p->h);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
if (mode & HASH_UPDATE_KEY_IF_AFTER) {
|
||||
break;
|
||||
} else {
|
||||
if (p->nKeyLength) {
|
||||
zend_hash_del(ht, p->arKey, p->nKeyLength);
|
||||
} else {
|
||||
zend_hash_index_del(ht, p->h);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
q = q->pNext;
|
||||
q = ht->arBuckets[num_index & ht->nTableMask];
|
||||
while (q != NULL) {
|
||||
if (!q->nKeyLength && q->h == num_index) {
|
||||
break;
|
||||
}
|
||||
q = q->pNext;
|
||||
}
|
||||
} else if (key_type == HASH_KEY_IS_STRING) {
|
||||
if (IS_INTERNED(str_index)) {
|
||||
h = INTERNED_HASH(str_index);
|
||||
} else {
|
||||
h = zend_inline_hash_func(str_index, str_length);
|
||||
}
|
||||
|
||||
zend_hash_index_del(ht, num_index);
|
||||
} else if (key_type == HASH_KEY_IS_STRING) {
|
||||
if (p->nKeyLength == str_length &&
|
||||
memcmp(p->arKey, str_index, str_length) == 0) {
|
||||
if (p->arKey == str_index ||
|
||||
(p->nKeyLength == str_length &&
|
||||
p->h == h &&
|
||||
memcmp(p->arKey, str_index, str_length) == 0)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (mode != HASH_UPDATE_KEY_ANYWAY) {
|
||||
ulong h = zend_inline_hash_func(str_index, str_length);
|
||||
Bucket *q = ht->arBuckets[h & ht->nTableMask];
|
||||
int found = 0;
|
||||
q = ht->arBuckets[h & ht->nTableMask];
|
||||
|
||||
while (q != NULL) {
|
||||
if (q == p) {
|
||||
found = 1;
|
||||
} else if (q->h == h && q->nKeyLength == str_length &&
|
||||
memcmp(q->arKey, str_index, str_length) == 0) {
|
||||
if (found) {
|
||||
if (mode & HASH_UPDATE_KEY_IF_BEFORE) {
|
||||
break;
|
||||
} else {
|
||||
if (p->nKeyLength) {
|
||||
zend_hash_del(ht, p->arKey, p->nKeyLength);
|
||||
} else {
|
||||
zend_hash_index_del(ht, p->h);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
if (mode & HASH_UPDATE_KEY_IF_AFTER) {
|
||||
break;
|
||||
} else {
|
||||
if (p->nKeyLength) {
|
||||
zend_hash_del(ht, p->arKey, p->nKeyLength);
|
||||
} else {
|
||||
zend_hash_index_del(ht, p->h);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
q = q->pNext;
|
||||
while (q != NULL) {
|
||||
if (q->arKey == str_index ||
|
||||
(q->h == h && q->nKeyLength == str_length &&
|
||||
memcmp(q->arKey, str_index, str_length) == 0)) {
|
||||
break;
|
||||
}
|
||||
q = q->pNext;
|
||||
}
|
||||
|
||||
zend_hash_del(ht, str_index, str_length);
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
if (q) {
|
||||
if (mode != HASH_UPDATE_KEY_ANYWAY) {
|
||||
Bucket *r = p->pListLast;
|
||||
int found = HASH_UPDATE_KEY_IF_BEFORE;
|
||||
|
||||
while (r) {
|
||||
if (r == q) {
|
||||
found = HASH_UPDATE_KEY_IF_AFTER;
|
||||
break;
|
||||
}
|
||||
r = r->pListLast;
|
||||
}
|
||||
if (mode & found) {
|
||||
/* delete current bucket */
|
||||
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;
|
||||
}
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(p->pData);
|
||||
}
|
||||
if (p->pData != &p->pDataPtr) {
|
||||
pefree(p->pData, ht->persistent);
|
||||
}
|
||||
pefree(p, ht->persistent);
|
||||
ht->nNumOfElements--;
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
/* delete another bucket with the same key */
|
||||
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;
|
||||
}
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(q->pData);
|
||||
}
|
||||
if (q->pData != &q->pDataPtr) {
|
||||
pefree(q->pData, ht->persistent);
|
||||
}
|
||||
pefree(q, ht->persistent);
|
||||
ht->nNumOfElements--;
|
||||
}
|
||||
|
||||
if (p->pNext) {
|
||||
p->pNext->pLast = p->pLast;
|
||||
}
|
||||
if (p->pLast) {
|
||||
p->pLast->pNext = p->pNext;
|
||||
} else{
|
||||
} else {
|
||||
ht->arBuckets[p->h & ht->nTableMask] = p->pNext;
|
||||
}
|
||||
|
||||
if (p->nKeyLength != str_length) {
|
||||
Bucket *q = (Bucket *) pemalloc(sizeof(Bucket) + str_length, ht->persistent);
|
||||
if ((IS_INTERNED(p->arKey) != IS_INTERNED(str_index)) ||
|
||||
(!IS_INTERNED(p->arKey) && p->nKeyLength != str_length)) {
|
||||
Bucket *q;
|
||||
|
||||
if (IS_INTERNED(str_index)) {
|
||||
q = (Bucket *) pemalloc(sizeof(Bucket), ht->persistent);
|
||||
} else {
|
||||
q = (Bucket *) pemalloc(sizeof(Bucket) + str_length, ht->persistent);
|
||||
}
|
||||
|
||||
q->nKeyLength = str_length;
|
||||
if (p->pData == &p->pDataPtr) {
|
||||
@@ -1338,9 +1397,13 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
|
||||
if (key_type == HASH_KEY_IS_LONG) {
|
||||
p->h = num_index;
|
||||
} else {
|
||||
p->arKey = (char*)(p+1);
|
||||
memcpy(p->arKey, str_index, str_length);
|
||||
p->h = zend_inline_hash_func(str_index, str_length);
|
||||
p->h = h;
|
||||
if (IS_INTERNED(str_index)) {
|
||||
p->arKey = str_index;
|
||||
} else {
|
||||
p->arKey = (char*)(p+1);
|
||||
memcpy(p->arKey, str_index, str_length);
|
||||
}
|
||||
}
|
||||
|
||||
CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[p->h & ht->nTableMask]);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.13.5 on Mon Aug 30 19:00:33 2010 */
|
||||
/* Generated by re2c 0.13.5 on Mon Jan 17 14:03:33 2011 */
|
||||
#line 1 "Zend/zend_ini_scanner.l"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.13.5 on Mon Aug 30 19:00:34 2010 */
|
||||
/* Generated by re2c 0.13.5 on Wed Jun 29 02:53:12 2011 */
|
||||
#line 3 "Zend/zend_ini_scanner_defs.h"
|
||||
|
||||
enum YYCONDTYPE {
|
||||
|
||||
+214
-104
@@ -35,6 +35,9 @@
|
||||
#include "zend_API.h"
|
||||
#include "zend_constants.h"
|
||||
|
||||
#define YYSIZE_T size_t
|
||||
#define yytnamerr zend_yytnamerr
|
||||
static YYSIZE_T zend_yytnamerr(char*, const char*);
|
||||
|
||||
#define YYERROR_VERBOSE
|
||||
#define YYSTYPE znode
|
||||
@@ -49,115 +52,161 @@
|
||||
%pure_parser
|
||||
%expect 2
|
||||
|
||||
%token END 0 "end of file"
|
||||
%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
|
||||
%token T_INCLUDE "include (T_INCLUDE)"
|
||||
%token T_INCLUDE_ONCE "include_once (T_INCLUDE_ONCE)"
|
||||
%token T_EVAL "eval (T_EVAL)"
|
||||
%token T_REQUIRE "require (T_REQUIRE)"
|
||||
%token T_REQUIRE_ONCE "require_once (T_REQUIRE_ONCE)"
|
||||
%left ','
|
||||
%left T_LOGICAL_OR
|
||||
%token T_LOGICAL_OR "or (T_LOGICAL_OR)"
|
||||
%left T_LOGICAL_XOR
|
||||
%token T_LOGICAL_XOR "xor (T_LOGICAL_XOR)"
|
||||
%left T_LOGICAL_AND
|
||||
%token T_LOGICAL_AND "and (T_LOGICAL_AND)"
|
||||
%right T_PRINT
|
||||
%token T_PRINT "print (T_PRINT)"
|
||||
%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL
|
||||
%token T_PLUS_EQUAL "+= (T_PLUS_EQUAL)"
|
||||
%token T_MINUS_EQUAL "-= (T_MINUS_EQUAL)"
|
||||
%token T_MUL_EQUAL "*= (T_MUL_EQUAL)"
|
||||
%token T_DIV_EQUAL "/= (T_DIV_EQUAL)"
|
||||
%token T_CONCAT_EQUAL ".= (T_CONCAT_EQUAL)"
|
||||
%token T_MOD_EQUAL "%= (T_MOD_EQUAL)"
|
||||
%token T_AND_EQUAL "&= (T_AND_EQUAL)"
|
||||
%token T_OR_EQUAL "|= (T_OR_EQUAL)"
|
||||
%token T_XOR_EQUAL "^= (T_XOR_EQUAL)"
|
||||
%token T_SL_EQUAL "<<= (T_SL_EQUAL)"
|
||||
%token T_SR_EQUAL ">>= (T_SR_EQUAL)"
|
||||
%left '?' ':'
|
||||
%left T_BOOLEAN_OR
|
||||
%left T_BOOLEAN_AND
|
||||
%token T_BOOLEAN_OR "|| (T_BOOLEAN_OR)"
|
||||
%left T_BOOLEAN_AND
|
||||
%token T_BOOLEAN_AND "&& (T_BOOLEAN_AND)"
|
||||
%left '|'
|
||||
%left '^'
|
||||
%left '&'
|
||||
%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL
|
||||
%token T_IS_EQUAL "== (T_IS_EQUAL)"
|
||||
%token T_IS_NOT_EQUAL "!= (T_IS_NOT_EQUAL)"
|
||||
%token T_IS_IDENTICAL "=== (T_IS_IDENTICAL)"
|
||||
%token T_IS_NOT_IDENTICAL "!== (T_IS_NOT_IDENTICAL)"
|
||||
%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
|
||||
%token T_IS_SMALLER_OR_EQUAL "<= (T_IS_SMALLER_OR_EQUAL)"
|
||||
%token T_IS_GREATER_OR_EQUAL ">= (T_IS_GREATER_OR_EQUAL)"
|
||||
%left T_SL T_SR
|
||||
%token T_SL "<< (T_SL)"
|
||||
%token T_SR ">> (T_SR)"
|
||||
%left '+' '-' '.'
|
||||
%left '*' '/' '%'
|
||||
%right '!'
|
||||
%nonassoc T_INSTANCEOF
|
||||
%right '~' T_INC T_DEC T_INT_CAST T_NUMERIC_CAST T_SCALAR_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
|
||||
%token T_INSTANCEOF "instanceof (T_INSTANCEOF)"
|
||||
%right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
|
||||
%token T_INC "++ (T_INC)"
|
||||
%token T_DEC "-- (T_DEC)"
|
||||
%token T_INT_CAST "(int) (T_INT_CAST)"
|
||||
%token T_SCALAR_CAST "(scalar) (T_SCALAR_CAST)"
|
||||
%token T_DOUBLE_CAST "(double) (T_DOUBLE_CAST)"
|
||||
%token T_STRING_CAST "(string) (T_STRING_CAST)"
|
||||
%token T_ARRAY_CAST "(array) (T_ARRAY_CAST)"
|
||||
%token T_OBJECT_CAST "(object) (T_OBJECT_CAST)"
|
||||
%token T_BOOL_CAST "(bool) (T_BOOL_CAST)"
|
||||
%token T_UNSET_CAST "(unset) (T_UNSET_CAST)"
|
||||
%right '['
|
||||
%nonassoc T_NEW T_CLONE
|
||||
%token T_EXIT
|
||||
%token T_IF
|
||||
%token T_NEW "new (T_NEW)"
|
||||
%token T_CLONE "clone (T_CLONE)"
|
||||
%token T_EXIT "exit (T_EXIT)"
|
||||
%token T_IF "if (T_IF)"
|
||||
%left T_ELSEIF
|
||||
%left T_ELSE
|
||||
%left T_ENDIF
|
||||
%token T_LNUMBER
|
||||
%token T_DNUMBER
|
||||
%token T_STRING
|
||||
%token T_STRING_VARNAME
|
||||
%token T_VARIABLE
|
||||
%token T_NUM_STRING
|
||||
%token T_ELSEIF "elseif (T_ELSEIF)"
|
||||
%left T_ELSE
|
||||
%token T_ELSE "else (T_ELSE)"
|
||||
%left T_ENDIF
|
||||
%token T_ENDIF "endif (T_ENDIF)"
|
||||
%token T_LNUMBER "integer number (T_LNUMBER)"
|
||||
%token T_DNUMBER "floating-point number (T_DNUMBER)"
|
||||
%token T_STRING "identifier (T_STRING)"
|
||||
%token T_STRING_VARNAME "variable name (T_STRING_VARNAME)"
|
||||
%token T_VARIABLE "variable (T_VARIABLE)"
|
||||
%token T_NUM_STRING "number (T_NUM_STRING)"
|
||||
%token T_INLINE_HTML
|
||||
%token T_CHARACTER
|
||||
%token T_BAD_CHARACTER
|
||||
%token T_ENCAPSED_AND_WHITESPACE
|
||||
%token T_CONSTANT_ENCAPSED_STRING
|
||||
%token T_ECHO
|
||||
%token T_DO
|
||||
%token T_WHILE
|
||||
%token T_ENDWHILE
|
||||
%token T_FOR
|
||||
%token T_ENDFOR
|
||||
%token T_FOREACH
|
||||
%token T_ENDFOREACH
|
||||
%token T_DECLARE
|
||||
%token T_ENDDECLARE
|
||||
%token T_AS
|
||||
%token T_SWITCH
|
||||
%token T_ENDSWITCH
|
||||
%token T_CASE
|
||||
%token T_DEFAULT
|
||||
%token T_BREAK
|
||||
%token T_CONTINUE
|
||||
%token T_GOTO
|
||||
%token T_FUNCTION
|
||||
%token T_CONST
|
||||
%token T_RETURN
|
||||
%token T_TRY
|
||||
%token T_CATCH
|
||||
%token T_THROW
|
||||
%token T_USE
|
||||
%token T_INSTEADOF
|
||||
%token T_GLOBAL
|
||||
%token T_ENCAPSED_AND_WHITESPACE "quoted-string and whitespace (T_ENCAPSED_AND_WHITESPACE)"
|
||||
%token T_CONSTANT_ENCAPSED_STRING "quoted-string (T_CONSTANT_ENCAPSED_STRING)"
|
||||
%token T_ECHO "echo (T_ECHO)"
|
||||
%token T_DO "do (T_DO)"
|
||||
%token T_WHILE "while (T_WHILE)"
|
||||
%token T_ENDWHILE "endwhile (T_ENDWHILE)"
|
||||
%token T_FOR "for (T_FOR)"
|
||||
%token T_ENDFOR "endfor (T_ENDFOR)"
|
||||
%token T_FOREACH "foreach (T_FOREACH)"
|
||||
%token T_ENDFOREACH "endforeach (T_ENDFOREACH)"
|
||||
%token T_DECLARE "declare (T_DECLARE)"
|
||||
%token T_ENDDECLARE "enddeclare (T_ENDDECLARE)"
|
||||
%token T_AS "as (T_AS)"
|
||||
%token T_SWITCH "switch (T_SWITCH)"
|
||||
%token T_ENDSWITCH "endswitch (T_ENDSWITCH)"
|
||||
%token T_CASE "case (T_CASE)"
|
||||
%token T_DEFAULT "default (T_DEFAULT)"
|
||||
%token T_BREAK "break (T_BREAK)"
|
||||
%token T_CONTINUE "continue (T_CONTINUE)"
|
||||
%token T_GOTO "goto (T_GOTO)"
|
||||
%token T_FUNCTION "function (T_FUNCTION)"
|
||||
%token T_CONST "const (T_CONST)"
|
||||
%token T_RETURN "return (T_RETURN)"
|
||||
%token T_TRY "try (T_TRY)"
|
||||
%token T_CATCH "catch (T_CATCH)"
|
||||
%token T_THROW "throw (T_THROW)"
|
||||
%token T_USE "use (T_USE)"
|
||||
%token T_INSTEADOF "insteadof (T_INSTEADOF)"
|
||||
%token T_GLOBAL "global (T_GLOBAL)"
|
||||
%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
|
||||
%token T_VAR
|
||||
%token T_UNSET
|
||||
%token T_ISSET
|
||||
%token T_EMPTY
|
||||
%token T_HALT_COMPILER
|
||||
%token T_CLASS
|
||||
%token T_TRAIT
|
||||
%token T_INTERFACE
|
||||
%token T_EXTENDS
|
||||
%token T_IMPLEMENTS
|
||||
%token T_OBJECT_OPERATOR
|
||||
%token T_DOUBLE_ARROW
|
||||
%token T_LIST
|
||||
%token T_ARRAY
|
||||
%token T_BOOL_HINT
|
||||
%token T_STRING_HINT
|
||||
%token T_INT_HINT
|
||||
%token T_DOUBLE_HINT
|
||||
%token T_RESOURCE_HINT
|
||||
%token T_OBJECT_HINT
|
||||
%token T_SCALAR_HINT
|
||||
%token T_NUMERIC_HINT
|
||||
%token T_CLASS_C
|
||||
%token T_METHOD_C
|
||||
%token T_FUNC_C
|
||||
%token T_LINE
|
||||
%token T_FILE
|
||||
%token T_COMMENT
|
||||
%token T_DOC_COMMENT
|
||||
%token T_OPEN_TAG
|
||||
%token T_OPEN_TAG_WITH_ECHO
|
||||
%token T_CLOSE_TAG
|
||||
%token T_WHITESPACE
|
||||
%token T_START_HEREDOC
|
||||
%token T_END_HEREDOC
|
||||
%token T_DOLLAR_OPEN_CURLY_BRACES
|
||||
%token T_CURLY_OPEN
|
||||
%token T_PAAMAYIM_NEKUDOTAYIM
|
||||
%token T_NAMESPACE
|
||||
%token T_NS_C
|
||||
%token T_DIR
|
||||
%token T_NS_SEPARATOR
|
||||
%token T_STATIC "static (T_STATIC)"
|
||||
%token T_ABSTRACT "abstract (T_ABSTRACT)"
|
||||
%token T_FINAL "final (T_FINAL)"
|
||||
%token T_PRIVATE "private (T_PRIVATE)"
|
||||
%token T_PROTECTED "protected (T_PROTECTED)"
|
||||
%token T_PUBLIC "public (T_PUBLIC)"
|
||||
%token T_VAR "var (T_VAR)"
|
||||
%token T_UNSET "unset (T_UNSET)"
|
||||
%token T_ISSET "isset (T_ISSET)"
|
||||
%token T_EMPTY "empty (T_EMPTY)"
|
||||
%token T_HALT_COMPILER "__halt_compiler (T_HALT_COMPILER)"
|
||||
%token T_CLASS "class (T_CLASS)"
|
||||
%token T_TRAIT "trait (T_TRAIT)"
|
||||
%token T_INTERFACE "interface (T_INTERFACE)"
|
||||
%token T_EXTENDS "extends (T_EXTENDS)"
|
||||
%token T_IMPLEMENTS "implements (T_IMPLEMENTS)"
|
||||
%token T_OBJECT_OPERATOR "-> (T_OBJECT_OPERATOR)"
|
||||
%token T_DOUBLE_ARROW "=> (T_DOUBLE_ARROW)"
|
||||
%token T_LIST "list (T_LIST)"
|
||||
%token T_ARRAY "array (T_ARRAY)"
|
||||
%token T_CLASS_C "__CLASS__ (T_CLASS_C)"
|
||||
%token T_TRAIT_C "__TRAIT__ (T_TRAIT_C)"
|
||||
%token T_METHOD_C "__METHOD__ (T_METHOD_C)"
|
||||
%token T_FUNC_C "__FUNCTION__ (T_FUNC_C)"
|
||||
%token T_LINE "__LINE__ (T_LINE)"
|
||||
%token T_FILE "__FILE__ (T_FILE)"
|
||||
%token T_COMMENT "comment (T_COMMENT)"
|
||||
%token T_DOC_COMMENT "doc comment (T_DOC_COMMENT)"
|
||||
%token T_OPEN_TAG "open tag (T_OPEN_TAG)"
|
||||
%token T_OPEN_TAG_WITH_ECHO "open tag with echo (T_OPEN_TAG_WITH_ECHO)"
|
||||
%token T_CLOSE_TAG "close tag (T_CLOSE_TAG)"
|
||||
%token T_WHITESPACE "whitespace (T_WHITESPACE)"
|
||||
%token T_START_HEREDOC "heredoc start (T_START_HEREDOC)"
|
||||
%token T_END_HEREDOC "heredoc end (T_END_HEREDOC)"
|
||||
%token T_DOLLAR_OPEN_CURLY_BRACES "${ (T_DOLLAR_OPEN_CURLY_BRACES)"
|
||||
%token T_CURLY_OPEN "{$ (T_CURLY_OPEN)"
|
||||
%token T_PAAMAYIM_NEKUDOTAYIM ":: (T_PAAMAYIM_NEKUDOTAYIM)"
|
||||
%token T_NAMESPACE "namespace (T_NAMESPACE)"
|
||||
%token T_NS_C "__NAMESPACE__ (T_NS_C)"
|
||||
%token T_DIR "__DIR__ (T_DIR)"
|
||||
%token T_NS_SEPARATOR "\\ (T_NS_SEPARATOR)"
|
||||
|
||||
%% /* Rules */
|
||||
|
||||
@@ -221,7 +270,7 @@ inner_statement:
|
||||
|
||||
|
||||
statement:
|
||||
unticked_statement { zend_do_ticks(TSRMLS_C); }
|
||||
unticked_statement { DO_TICKS(); }
|
||||
| T_STRING ':' { zend_do_label(&$1 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
@@ -301,11 +350,11 @@ unset_variable:
|
||||
;
|
||||
|
||||
function_declaration_statement:
|
||||
unticked_function_declaration_statement { zend_do_ticks(TSRMLS_C); }
|
||||
unticked_function_declaration_statement { DO_TICKS(); }
|
||||
;
|
||||
|
||||
class_declaration_statement:
|
||||
unticked_class_declaration_statement { zend_do_ticks(TSRMLS_C); }
|
||||
unticked_class_declaration_statement { DO_TICKS(); }
|
||||
;
|
||||
|
||||
|
||||
@@ -474,16 +523,8 @@ non_empty_parameter_list:
|
||||
|
||||
optional_class_type:
|
||||
/* empty */ { $$.op_type = IS_UNUSED; }
|
||||
| T_ARRAY { $$ = $1; $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_ARRAY; }
|
||||
| T_BOOL_HINT { $$ = $1; $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_BOOL; }
|
||||
| T_STRING_HINT { $$ = $1; $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_STRING; }
|
||||
| T_INT_HINT { $$ = $1; $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_LONG; }
|
||||
| T_DOUBLE_HINT { $$ = $1; $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_DOUBLE; }
|
||||
| T_RESOURCE_HINT { $$ = $1; $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_RESOURCE; }
|
||||
| T_OBJECT_HINT { $$ = $1; $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_OBJECT; }
|
||||
| T_SCALAR_HINT { $$ = $1; $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_SCALAR; }
|
||||
| T_NUMERIC_HINT { $$ = $1; $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_NUMERIC; }
|
||||
| fully_qualified_class_name { $$ = $1; $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_CLASS; }
|
||||
| T_ARRAY { $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_NULL; }
|
||||
| fully_qualified_class_name { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
@@ -572,8 +613,8 @@ trait_precedence:
|
||||
;
|
||||
|
||||
trait_reference_list:
|
||||
fully_qualified_class_name { zend_init_list(&$$.u.op.ptr, Z_STRVAL($1.u.constant) TSRMLS_CC); }
|
||||
| trait_reference_list ',' fully_qualified_class_name { zend_add_to_list(&$1.u.op.ptr, Z_STRVAL($3.u.constant) TSRMLS_CC); $$ = $1; }
|
||||
fully_qualified_class_name { zend_resolve_class_name(&$1, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); zend_init_list(&$$.u.op.ptr, Z_STRVAL($1.u.constant) TSRMLS_CC); }
|
||||
| trait_reference_list ',' fully_qualified_class_name { zend_resolve_class_name(&$3, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); zend_add_to_list(&$1.u.op.ptr, Z_STRVAL($3.u.constant) TSRMLS_CC); $$ = $1; }
|
||||
;
|
||||
|
||||
trait_method_reference:
|
||||
@@ -716,13 +757,12 @@ expr_without_variable:
|
||||
| T_ARRAY_CAST expr { zend_do_cast(&$$, &$2, IS_ARRAY TSRMLS_CC); }
|
||||
| T_OBJECT_CAST expr { zend_do_cast(&$$, &$2, IS_OBJECT TSRMLS_CC); }
|
||||
| T_BOOL_CAST expr { zend_do_cast(&$$, &$2, IS_BOOL TSRMLS_CC); }
|
||||
| T_SCALAR_CAST expr { zend_do_cast(&$$, &$2, IS_SCALAR TSRMLS_CC); }
|
||||
| T_NUMERIC_CAST expr { zend_do_cast(&$$, &$2, IS_NUMERIC TSRMLS_CC); }
|
||||
| T_UNSET_CAST expr { zend_do_cast(&$$, &$2, IS_NULL TSRMLS_CC); }
|
||||
| T_EXIT exit_expr { zend_do_exit(&$$, &$2 TSRMLS_CC); }
|
||||
| '@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end_silence(&$1 TSRMLS_CC); $$ = $3; }
|
||||
| scalar { $$ = $1; }
|
||||
| T_ARRAY '(' array_pair_list ')' { $$ = $3; }
|
||||
| '[' array_pair_list ']' { $$ = $2; }
|
||||
| '`' backticks_expr '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); }
|
||||
| T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); }
|
||||
| function is_reference '(' { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, 0 TSRMLS_CC); }
|
||||
@@ -757,13 +797,13 @@ function_call:
|
||||
| T_NS_SEPARATOR namespace_name '(' { $3.u.op.opline_num = zend_do_begin_function_call(&$2, 0 TSRMLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { zend_do_end_function_call(&$2, &$$, &$5, 0, $3.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { $4.u.op.opline_num = zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM variable_name '(' { $4.u.op.opline_num = zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { zend_do_end_function_call($4.u.op.opline_num?NULL:&$3, &$$, &$6, $4.u.op.opline_num, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_name '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
@@ -840,6 +880,7 @@ common_scalar:
|
||||
| T_FILE { $$ = $1; }
|
||||
| T_DIR { $$ = $1; }
|
||||
| T_CLASS_C { $$ = $1; }
|
||||
| T_TRAIT_C { $$ = $1; }
|
||||
| T_METHOD_C { $$ = $1; }
|
||||
| T_FUNC_C { $$ = $1; }
|
||||
| T_NS_C { $$ = $1; }
|
||||
@@ -856,6 +897,7 @@ static_scalar: /* compile-time evaluated scalars */
|
||||
| '+' static_scalar { ZVAL_LONG(&$1.u.constant, 0); add_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; }
|
||||
| '-' static_scalar { ZVAL_LONG(&$1.u.constant, 0); sub_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; }
|
||||
| T_ARRAY '(' static_array_pair_list ')' { $$ = $3; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; }
|
||||
| '[' static_array_pair_list ']' { $$ = $2; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; }
|
||||
| static_class_constant { $$ = $1; }
|
||||
;
|
||||
|
||||
@@ -941,7 +983,7 @@ method:
|
||||
{ zend_do_end_function_call(&$1, &$$, &$3, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
|
||||
;
|
||||
|
||||
method_or_not:
|
||||
method_or_not:
|
||||
method { $$ = $1; $$.EA = ZEND_PARSED_METHOD_CALL; zend_do_push_object(&$$ TSRMLS_CC); }
|
||||
| array_method_dereference { $$ = $1; zend_do_push_object(&$$ TSRMLS_CC); }
|
||||
| /* empty */ { $$.EA = ZEND_PARSED_MEMBER; }
|
||||
@@ -964,7 +1006,7 @@ variable_class_name:
|
||||
|
||||
array_function_dereference:
|
||||
array_function_dereference '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
| function_call { zend_do_begin_variable_parse(TSRMLS_C); $1.EA = ZEND_PARSED_FUNCTION_CALL; }
|
||||
| function_call { zend_do_begin_variable_parse(TSRMLS_C); $1.EA = ZEND_PARSED_FUNCTION_CALL; }
|
||||
'[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$4 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
@@ -1097,6 +1139,74 @@ class_constant:
|
||||
|
||||
%%
|
||||
|
||||
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
|
||||
quotes and backslashes, so that it's suitable for yyerror. The
|
||||
heuristic is that double-quoting is unnecessary unless the string
|
||||
contains an apostrophe, a comma, or backslash (other than
|
||||
backslash-backslash). YYSTR is taken from yytname. If YYRES is
|
||||
null, do not copy; instead, return the length of what the result
|
||||
would have been. */
|
||||
static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
|
||||
{
|
||||
if (!yyres) {
|
||||
return yystrlen(yystr);
|
||||
}
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
if (CG(parse_error) == 0) {
|
||||
char buffer[120];
|
||||
const unsigned char *end, *str, *tok1 = NULL, *tok2 = NULL;
|
||||
unsigned int len = 0, toklen = 0, yystr_len;
|
||||
|
||||
CG(parse_error) = 1;
|
||||
|
||||
if (LANG_SCNG(yy_text)[0] == 0 &&
|
||||
LANG_SCNG(yy_leng) == 1 &&
|
||||
memcmp(yystr, ZEND_STRL("\"end of file\"")) == 0) {
|
||||
yystpcpy(yyres, "end of file");
|
||||
return sizeof("end of file")-1;
|
||||
}
|
||||
|
||||
str = LANG_SCNG(yy_text);
|
||||
end = memchr(str, '\n', LANG_SCNG(yy_leng));
|
||||
yystr_len = yystrlen(yystr);
|
||||
|
||||
if ((tok1 = memchr(yystr, '(', yystr_len)) != NULL
|
||||
&& (tok2 = zend_memrchr(yystr, ')', yystr_len)) != NULL) {
|
||||
toklen = (tok2 - tok1) + 1;
|
||||
} else {
|
||||
tok1 = tok2 = NULL;
|
||||
toklen = 0;
|
||||
}
|
||||
|
||||
if (end == NULL) {
|
||||
len = LANG_SCNG(yy_leng) > 30 ? 30 : LANG_SCNG(yy_leng);
|
||||
} else {
|
||||
len = (end - str) > 30 ? 30 : (end - str);
|
||||
}
|
||||
if (toklen) {
|
||||
snprintf(buffer, sizeof(buffer), "'%.*s' %.*s", len, str, toklen, tok1);
|
||||
} else {
|
||||
snprintf(buffer, sizeof(buffer), "'%.*s'", len, str);
|
||||
}
|
||||
yystpcpy(yyres, buffer);
|
||||
return len + (toklen ? toklen + 1 : 0) + 2;
|
||||
}
|
||||
}
|
||||
if (*yystr == '"') {
|
||||
YYSIZE_T yyn = 0;
|
||||
const char *yyp = yystr;
|
||||
|
||||
for (; *++yyp != '"'; ++yyn) {
|
||||
yyres[yyn] = *yyp;
|
||||
}
|
||||
yyres[yyn] = '\0';
|
||||
return yyn;
|
||||
}
|
||||
yystpcpy(yyres, yystr);
|
||||
return strlen(yystr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
|
||||
+2933
-3909
File diff suppressed because it is too large.
Load diff
@@ -174,6 +174,7 @@ static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
|
||||
|
||||
void startup_scanner(TSRMLS_D)
|
||||
{
|
||||
CG(parse_error) = 0;
|
||||
CG(heredoc) = NULL;
|
||||
CG(heredoc_len) = 0;
|
||||
CG(doc_comment) = NULL;
|
||||
@@ -187,6 +188,7 @@ void shutdown_scanner(TSRMLS_D)
|
||||
efree(CG(heredoc));
|
||||
CG(heredoc_len)=0;
|
||||
}
|
||||
CG(parse_error) = 0;
|
||||
zend_stack_destroy(&SCNG(state_stack));
|
||||
RESET_DOC_COMMENT();
|
||||
}
|
||||
@@ -469,7 +471,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
|
||||
{
|
||||
char *file_path = NULL, *buf;
|
||||
size_t size, offset = 0;
|
||||
|
||||
|
||||
/* The shebang line was read, get the current position to obtain the buffer start */
|
||||
if (CG(start_lineno) == 2 && file_handle->type == ZEND_HANDLE_FP && file_handle->handle.fp) {
|
||||
if ((offset = ftell(file_handle->handle.fp)) == -1) {
|
||||
@@ -496,7 +498,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
|
||||
if (size != -1) {
|
||||
if (CG(multibyte)) {
|
||||
SCNG(script_org) = buf;
|
||||
SCNG(script_org_size) = size;
|
||||
SCNG(script_org_size) = size;
|
||||
SCNG(script_filtered) = NULL;
|
||||
|
||||
zend_multibyte_set_filter(NULL TSRMLS_CC);
|
||||
@@ -985,6 +987,7 @@ LNUM [0-9]+
|
||||
DNUM ([0-9]*"."[0-9]+)|([0-9]+"."[0-9]*)
|
||||
EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM})
|
||||
HNUM "0x"[0-9a-fA-F]+
|
||||
BNUM "0b"[01]+
|
||||
LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*
|
||||
WHITESPACE [ \n\r\t]+
|
||||
TABS_AND_SPACES [ \t]*
|
||||
@@ -1206,10 +1209,6 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
return T_STRING_CAST;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"scalar"{TABS_AND_SPACES}")" {
|
||||
return T_SCALAR_CAST;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"array"{TABS_AND_SPACES}")" {
|
||||
return T_ARRAY_CAST;
|
||||
}
|
||||
@@ -1314,62 +1313,6 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
return T_ARRAY;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>("bool"|"boolean"){TABS_AND_SPACES}[ \r\n\t&]*"$" {
|
||||
if (yytext[4] == 'e') {
|
||||
yyless((sizeof("boolean") - 1));
|
||||
} else {
|
||||
yyless((sizeof("bool") - 1));
|
||||
}
|
||||
return T_BOOL_HINT;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>("string"|"binary"){TABS_AND_SPACES}[ \r\n\t&]*"$" {
|
||||
yyless(6);
|
||||
return T_STRING_HINT;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"scalar"{TABS_AND_SPACES}[ \r\n\t&]*"$" {
|
||||
yyless(6);
|
||||
return T_SCALAR_HINT;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"numeric"{TABS_AND_SPACES}[ \r\n\t&]*"$" {
|
||||
yyless(7);
|
||||
return T_NUMERIC_HINT;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>("int"|"integer"|"long"){TABS_AND_SPACES}[ \r\n\t&]*"$" {
|
||||
if (yytext[3] == 'e') {
|
||||
yyless((sizeof("integer") - 1));
|
||||
} else if (yytext[3] == 'g') {
|
||||
yyless((sizeof("long") - 1));
|
||||
} else {
|
||||
yyless(3);
|
||||
}
|
||||
return T_INT_HINT;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>("real"|"double"|"float"){TABS_AND_SPACES}[ \r\n\t&]*"$" {
|
||||
if (yytext[4] == 'l') {
|
||||
yyless((sizeof("double") - 1));
|
||||
} else if (yytext[4] == 't') {
|
||||
yyless((sizeof("float") - 1));
|
||||
} else {
|
||||
yyless(4);
|
||||
}
|
||||
return T_DOUBLE_HINT;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"resource"{TABS_AND_SPACES}[ \t\r\n&]*"$" {
|
||||
yyless((sizeof("resource") - 1));
|
||||
return T_RESOURCE_HINT;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"object"{TABS_AND_SPACES}[ \t\r\n&]*"$" {
|
||||
yyless((sizeof("object") - 1));
|
||||
return T_OBJECT_HINT;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"++" {
|
||||
return T_INC;
|
||||
}
|
||||
@@ -1516,6 +1459,26 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
goto restart;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>{BNUM} {
|
||||
char *bin = yytext + 2; /* Skip "0b" */
|
||||
int len = yyleng - 2;
|
||||
|
||||
/* Skip any leading 0s */
|
||||
while (*bin == '0') {
|
||||
++bin;
|
||||
--len;
|
||||
}
|
||||
|
||||
if (len < SIZEOF_LONG * 2) {
|
||||
zendlval->value.lval = strtol(bin, NULL, 2);
|
||||
zendlval->type = IS_LONG;
|
||||
return T_LNUMBER;
|
||||
} else {
|
||||
zendlval->value.dval = zend_bin_strtod(bin, NULL);
|
||||
zendlval->type = IS_DOUBLE;
|
||||
return T_DNUMBER;
|
||||
}
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>{LNUM} {
|
||||
if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */
|
||||
@@ -1571,7 +1534,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
return T_NUM_STRING;
|
||||
}
|
||||
|
||||
<ST_VAR_OFFSET>{LNUM}|{HNUM} { /* Offset must be treated as a string */
|
||||
<ST_VAR_OFFSET>{LNUM}|{HNUM}|{BNUM} { /* Offset must be treated as a string */
|
||||
zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
|
||||
zendlval->value.str.len = yyleng;
|
||||
zendlval->type = IS_STRING;
|
||||
@@ -1586,20 +1549,51 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
|
||||
<ST_IN_SCRIPTING>"__CLASS__" {
|
||||
char *class_name = NULL;
|
||||
|
||||
if (CG(active_class_entry)) {
|
||||
class_name = CG(active_class_entry)->name;
|
||||
|
||||
if (CG(active_class_entry)
|
||||
&& (ZEND_ACC_TRAIT ==
|
||||
(CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT))) {
|
||||
// This is a hack, we abuse IS_NULL to indicate an invalid value
|
||||
// if __CLASS__ is encountered in a trait, however, we also not that we
|
||||
// should fix it up when we copy the method into an actual class
|
||||
zendlval->value.lval = ZEND_ACC_TRAIT;
|
||||
zendlval->type = IS_NULL;
|
||||
} else {
|
||||
if (CG(active_class_entry)) {
|
||||
class_name = CG(active_class_entry)->name;
|
||||
}
|
||||
|
||||
if (!class_name) {
|
||||
class_name = "";
|
||||
}
|
||||
|
||||
zendlval->value.str.len = strlen(class_name);
|
||||
zendlval->value.str.val = estrndup(class_name, zendlval->value.str.len);
|
||||
zendlval->type = IS_STRING;
|
||||
}
|
||||
|
||||
if (!class_name) {
|
||||
class_name = "";
|
||||
}
|
||||
zendlval->value.str.len = strlen(class_name);
|
||||
zendlval->value.str.val = estrndup(class_name, zendlval->value.str.len);
|
||||
zendlval->type = IS_STRING;
|
||||
return T_CLASS_C;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"__TRAIT__" {
|
||||
char *trait_name = NULL;
|
||||
|
||||
if (CG(active_class_entry)
|
||||
&& (ZEND_ACC_TRAIT ==
|
||||
(CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT))) {
|
||||
trait_name = CG(active_class_entry)->name;
|
||||
}
|
||||
|
||||
if (!trait_name) {
|
||||
trait_name = "";
|
||||
}
|
||||
|
||||
zendlval->value.str.len = strlen(trait_name);
|
||||
zendlval->value.str.val = estrndup(trait_name, zendlval->value.str.len);
|
||||
zendlval->type = IS_STRING;
|
||||
|
||||
return T_TRAIT_C;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"__FUNCTION__" {
|
||||
char *func_name = NULL;
|
||||
|
||||
@@ -1628,7 +1622,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
len += strlen(func_name);
|
||||
}
|
||||
|
||||
zendlval->value.str.len = zend_spprintf(&zendlval->value.str.val, 0, "%s%s%s",
|
||||
zendlval->value.str.len = zend_spprintf(&zendlval->value.str.val, 0, "%s%s%s",
|
||||
class_name ? class_name : "",
|
||||
class_name && func_name ? "::" : "",
|
||||
func_name ? func_name : ""
|
||||
@@ -1724,15 +1718,11 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
|
||||
|
||||
<INITIAL>"<?=" {
|
||||
if (CG(short_tags)) {
|
||||
zendlval->value.str.val = yytext; /* no copying - intentional */
|
||||
zendlval->value.str.len = yyleng;
|
||||
zendlval->type = IS_STRING;
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
return T_OPEN_TAG_WITH_ECHO;
|
||||
} else {
|
||||
goto inline_char_handler;
|
||||
}
|
||||
zendlval->value.str.val = yytext; /* no copying - intentional */
|
||||
zendlval->value.str.len = yyleng;
|
||||
zendlval->type = IS_STRING;
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
return T_OPEN_TAG_WITH_ECHO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.13.5 on Sun Apr 3 14:18:11 2011 */
|
||||
/* Generated by re2c 0.13.5 on Sun Jul 31 20:09:48 2011 */
|
||||
#line 3 "Zend/zend_language_scanner_defs.h"
|
||||
|
||||
enum YYCONDTYPE {
|
||||
|
||||
@@ -31,6 +31,18 @@
|
||||
else (lval) = __tmpvar; \
|
||||
} while (0)
|
||||
|
||||
#elif defined(__x86_64__) && defined(__GNUC__)
|
||||
|
||||
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
|
||||
long __tmpvar; \
|
||||
__asm__ ("imulq %3,%0\n" \
|
||||
"adcq $0,%1" \
|
||||
: "=r"(__tmpvar),"=r"(usedval) \
|
||||
: "0"(a), "r"(b), "1"(0)); \
|
||||
if (usedval) (dval) = (double) (a) * (double) (b); \
|
||||
else (lval) = __tmpvar; \
|
||||
} while (0)
|
||||
|
||||
#elif SIZEOF_LONG == 4 && defined(HAVE_ZEND_LONG64)
|
||||
|
||||
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
|
||||
|
||||
@@ -27,13 +27,10 @@
|
||||
#include "zend_globals.h"
|
||||
#include "zend_list.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_multiply.h"
|
||||
#include "zend_strtod.h"
|
||||
#include "zend_exceptions.h"
|
||||
#include "zend_closures.h"
|
||||
|
||||
#define LONG_SIGN_MASK (1L << (8*sizeof(long)-1))
|
||||
|
||||
#if ZEND_USE_TOLOWER_L
|
||||
#include <locale.h>
|
||||
static _locale_t current_locale = NULL;
|
||||
|
||||
@@ -31,11 +31,14 @@
|
||||
#endif
|
||||
|
||||
#include "zend_strtod.h"
|
||||
#include "zend_multiply.h"
|
||||
|
||||
#if 0&&HAVE_BCMATH
|
||||
#include "ext/bcmath/libbcmath/src/bcmath.h"
|
||||
#endif
|
||||
|
||||
#define LONG_SIGN_MASK (1L << (8*sizeof(long)-1))
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
@@ -448,6 +451,416 @@ ZEND_API void zend_update_current_locale(void);
|
||||
#define zend_update_current_locale()
|
||||
#endif
|
||||
|
||||
static zend_always_inline int fast_increment_function(zval *op1)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
__asm__(
|
||||
"incl (%0)\n\t"
|
||||
"jno 0f\n\t"
|
||||
"movl $0x0, (%0)\n\t"
|
||||
"movl $0x41e00000, 0x4(%0)\n\t"
|
||||
"movb $0x2,0xc(%0)\n"
|
||||
"0:"
|
||||
:
|
||||
: "r"(op1));
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
__asm__(
|
||||
"incq (%0)\n\t"
|
||||
"jno 0f\n\t"
|
||||
"movl $0x0, (%0)\n\t"
|
||||
"movl $0x43e00000, 0x4(%0)\n\t"
|
||||
"movb $0x2,0x14(%0)\n"
|
||||
"0:"
|
||||
:
|
||||
: "r"(op1));
|
||||
#else
|
||||
if (UNEXPECTED(Z_LVAL_P(op1) == LONG_MAX)) {
|
||||
/* switch to double */
|
||||
Z_DVAL_P(op1) = (double)LONG_MAX + 1.0;
|
||||
Z_TYPE_P(op1) = IS_DOUBLE;
|
||||
} else {
|
||||
Z_LVAL_P(op1)++;
|
||||
}
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
return increment_function(op1);
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_decrement_function(zval *op1)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
__asm__(
|
||||
"decl (%0)\n\t"
|
||||
"jno 0f\n\t"
|
||||
"movl $0x00200000, (%0)\n\t"
|
||||
"movl $0xc1e00000, 0x4(%0)\n\t"
|
||||
"movb $0x2,0xc(%0)\n"
|
||||
"0:"
|
||||
:
|
||||
: "r"(op1));
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
__asm__(
|
||||
"decq (%0)\n\t"
|
||||
"jno 0f\n\t"
|
||||
"movl $0x00000000, (%0)\n\t"
|
||||
"movl $0xc3e00000, 0x4(%0)\n\t"
|
||||
"movb $0x2,0x14(%0)\n"
|
||||
"0:"
|
||||
:
|
||||
: "r"(op1));
|
||||
#else
|
||||
if (UNEXPECTED(Z_LVAL_P(op1) == LONG_MIN)) {
|
||||
/* switch to double */
|
||||
Z_DVAL_P(op1) = (double)LONG_MIN - 1.0;
|
||||
Z_TYPE_P(op1) = IS_DOUBLE;
|
||||
} else {
|
||||
Z_LVAL_P(op1)--;
|
||||
}
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
return decrement_function(op1);
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
__asm__(
|
||||
"movl (%1), %%eax\n\t"
|
||||
"addl (%2), %%eax\n\t"
|
||||
"jo 0f\n\t"
|
||||
"movl %%eax, (%0)\n\t"
|
||||
"movb $0x1,0xc(%0)\n\t"
|
||||
"jmp 1f\n"
|
||||
"0:\n\t"
|
||||
"fildl (%1)\n\t"
|
||||
"fildl (%2)\n\t"
|
||||
"faddp %%st, %%st(1)\n\t"
|
||||
"movb $0x2,0xc(%0)\n\t"
|
||||
"fstpl (%0)\n"
|
||||
"1:"
|
||||
:
|
||||
: "r"(result),
|
||||
"r"(op1),
|
||||
"r"(op2)
|
||||
: "eax");
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
__asm__(
|
||||
"movq (%1), %%rax\n\t"
|
||||
"addq (%2), %%rax\n\t"
|
||||
"jo 0f\n\t"
|
||||
"movq %%rax, (%0)\n\t"
|
||||
"movb $0x1,0x14(%0)\n\t"
|
||||
"jmp 1f\n"
|
||||
"0:\n\t"
|
||||
"fildq (%1)\n\t"
|
||||
"fildq (%2)\n\t"
|
||||
"faddp %%st, %%st(1)\n\t"
|
||||
"movb $0x2,0x14(%0)\n\t"
|
||||
"fstpl (%0)\n"
|
||||
"1:"
|
||||
:
|
||||
: "r"(result),
|
||||
"r"(op1),
|
||||
"r"(op2)
|
||||
: "rax");
|
||||
#else
|
||||
Z_LVAL_P(result) = Z_LVAL_P(op1) + Z_LVAL_P(op2);
|
||||
|
||||
if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK)
|
||||
&& (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(result) & LONG_SIGN_MASK))) {
|
||||
Z_DVAL_P(result) = (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
} else {
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
}
|
||||
#endif
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) + Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
return add_function(result, op1, op2 TSRMLS_CC);
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
__asm__(
|
||||
"movl (%1), %%eax\n\t"
|
||||
"subl (%2), %%eax\n\t"
|
||||
"jo 0f\n\t"
|
||||
"movl %%eax, (%0)\n\t"
|
||||
"movb $0x1,0xc(%0)\n\t"
|
||||
"jmp 1f\n"
|
||||
"0:\n\t"
|
||||
"fildl (%2)\n\t"
|
||||
"fildl (%1)\n\t"
|
||||
"fsubp %%st, %%st(1)\n\t"
|
||||
"movb $0x2,0xc(%0)\n\t"
|
||||
"fstpl (%0)\n"
|
||||
"1:"
|
||||
:
|
||||
: "r"(result),
|
||||
"r"(op1),
|
||||
"r"(op2)
|
||||
: "eax");
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
__asm__(
|
||||
"movq (%1), %%rax\n\t"
|
||||
"subq (%2), %%rax\n\t"
|
||||
"jo 0f\n\t"
|
||||
"movq %%rax, (%0)\n\t"
|
||||
"movb $0x1,0x14(%0)\n\t"
|
||||
"jmp 1f\n"
|
||||
"0:\n\t"
|
||||
"fildq (%2)\n\t"
|
||||
"fildq (%1)\n\t"
|
||||
"fsubp %%st, %%st(1)\n\t"
|
||||
"movb $0x2,0x14(%0)\n\t"
|
||||
"fstpl (%0)\n"
|
||||
"1:"
|
||||
:
|
||||
: "r"(result),
|
||||
"r"(op1),
|
||||
"r"(op2)
|
||||
: "rax");
|
||||
#else
|
||||
Z_LVAL_P(result) = Z_LVAL_P(op1) - Z_LVAL_P(op2);
|
||||
|
||||
if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK)
|
||||
&& (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(result) & LONG_SIGN_MASK))) {
|
||||
Z_DVAL_P(result) = (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
} else {
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
}
|
||||
#endif
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) - Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
return sub_function(result, op1, op2 TSRMLS_CC);
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
long overflow;
|
||||
|
||||
ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1), Z_LVAL_P(op2), Z_LVAL_P(result), Z_DVAL_P(result), overflow);
|
||||
Z_TYPE_P(result) = overflow ? IS_DOUBLE : IS_LONG;
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) * Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
return mul_function(result, op1, op2 TSRMLS_CC);
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG) && 0) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
return FAILURE;
|
||||
} else if (UNEXPECTED(Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == LONG_MIN)) {
|
||||
/* Prevent overflow error/crash */
|
||||
Z_DVAL_P(result) = (double) LONG_MIN / -1;
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
} else if (EXPECTED(Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0)) {
|
||||
/* integer */
|
||||
Z_LVAL_P(result) = Z_LVAL_P(op1) / Z_LVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
} else {
|
||||
Z_DVAL_P(result) = ((double) Z_LVAL_P(op1)) / ((double)Z_LVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
}
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
if (UNEXPECTED(Z_DVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
return FAILURE;
|
||||
}
|
||||
Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) / Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE) && 0) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
if (UNEXPECTED(Z_DVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
return FAILURE;
|
||||
}
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) / Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
return FAILURE;
|
||||
}
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) / ((double)Z_LVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
return div_function(result, op1, op2 TSRMLS_CC);
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
return FAILURE;
|
||||
} else if (UNEXPECTED(Z_LVAL_P(op2) == -1)) {
|
||||
/* Prevent overflow error/crash if op1==LONG_MIN */
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
return SUCCESS;
|
||||
}
|
||||
Z_LVAL_P(result) = Z_LVAL_P(op1) % Z_LVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
return mod_function(result, op1, op2 TSRMLS_CC);
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_LVAL_P(op1) == Z_LVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return ((double)Z_LVAL_P(op1)) == Z_DVAL_P(op2);
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return Z_DVAL_P(op1) == Z_DVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_DVAL_P(op1) == ((double)Z_LVAL_P(op2));
|
||||
}
|
||||
}
|
||||
compare_function(result, op1, op2 TSRMLS_CC);
|
||||
return Z_LVAL_P(result) == 0;
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_LVAL_P(op1) != Z_LVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return ((double)Z_LVAL_P(op1)) != Z_DVAL_P(op2);
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return Z_DVAL_P(op1) != Z_DVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_DVAL_P(op1) != ((double)Z_LVAL_P(op2));
|
||||
}
|
||||
}
|
||||
compare_function(result, op1, op2 TSRMLS_CC);
|
||||
return Z_LVAL_P(result) != 0;
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_LVAL_P(op1) < Z_LVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return ((double)Z_LVAL_P(op1)) < Z_DVAL_P(op2);
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return Z_DVAL_P(op1) < Z_DVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_DVAL_P(op1) < ((double)Z_LVAL_P(op2));
|
||||
}
|
||||
}
|
||||
compare_function(result, op1, op2 TSRMLS_CC);
|
||||
return Z_LVAL_P(result) < 0;
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_LVAL_P(op1) <= Z_LVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return ((double)Z_LVAL_P(op1)) <= Z_DVAL_P(op2);
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return Z_DVAL_P(op1) <= Z_DVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_DVAL_P(op1) <= ((double)Z_LVAL_P(op2));
|
||||
}
|
||||
}
|
||||
compare_function(result, op1, op2 TSRMLS_CC);
|
||||
return Z_LVAL_P(result) <= 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,414 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Signal Handling |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2008 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Lucas Nealan <lucas@php.net> |
|
||||
| Arnaud Le Blanc <lbarnaud@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
This software was contributed to PHP by Facebook Inc. in 2008.
|
||||
|
||||
Future revisions and derivatives of this source code must acknowledge
|
||||
Facebook Inc. as the original contributor of this module by leaving
|
||||
this note intact in the source code.
|
||||
|
||||
All other licensing and usage conditions are those of the PHP Group.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <string.h>
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_globals.h"
|
||||
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef ZEND_SIGNALS
|
||||
|
||||
#include "zend_signal.h"
|
||||
|
||||
#ifdef ZTS
|
||||
ZEND_API int zend_signal_globals_id;
|
||||
#else
|
||||
zend_signal_globals_t zend_signal_globals;
|
||||
#endif
|
||||
|
||||
static void zend_signal_handler(int signo, siginfo_t *siginfo, void *context TSRMLS_DC);
|
||||
static int zend_signal_register(int signo, void (*handler)(int, siginfo_t*, void*) TSRMLS_DC);
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#define TIMEOUT_SIG SIGALRM
|
||||
#else
|
||||
#define TIMEOUT_SIG SIGPROF
|
||||
#endif
|
||||
|
||||
static int zend_sigs[] = { TIMEOUT_SIG, SIGHUP, SIGINT, SIGQUIT, SIGTERM, SIGUSR1, SIGUSR2 };
|
||||
|
||||
#define SA_FLAGS_MASK ~(SA_NODEFER | SA_RESETHAND)
|
||||
|
||||
/* True globals, written only at process startup */
|
||||
static zend_signal_entry_t global_orig_handlers[NSIG];
|
||||
static sigset_t global_sigmask;
|
||||
|
||||
/* {{{ zend_signal_handler_defer
|
||||
* Blocks signals if in critical section */
|
||||
void zend_signal_handler_defer(int signo, siginfo_t *siginfo, void *context)
|
||||
{
|
||||
int errno_save = errno;
|
||||
zend_signal_queue_t *queue, *qtmp;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (SIGG(active)) {
|
||||
if (SIGG(depth) == 0) { /* try to handle signal */
|
||||
if (SIGG(blocked) != -1) { /* inverse */
|
||||
SIGG(blocked) = -1; /* signal is not blocked */
|
||||
}
|
||||
if (SIGG(running) == 0) {
|
||||
SIGG(running) = 1;
|
||||
zend_signal_handler(signo, siginfo, context TSRMLS_CC);
|
||||
|
||||
queue = SIGG(phead);
|
||||
SIGG(phead) = NULL;
|
||||
|
||||
while (queue) {
|
||||
zend_signal_handler(queue->zend_signal.signo, queue->zend_signal.siginfo, queue->zend_signal.context TSRMLS_CC);
|
||||
qtmp = queue->next;
|
||||
queue->next = SIGG(pavail);
|
||||
queue->zend_signal.signo = 0;
|
||||
SIGG(pavail) = queue;
|
||||
queue = qtmp;
|
||||
}
|
||||
SIGG(running) = 0;
|
||||
}
|
||||
} else { /* delay signal handling */
|
||||
SIGG(blocked) = 0; /* signal is blocked */
|
||||
|
||||
if ((queue = SIGG(pavail))) { /* if none available it's simply forgotton */
|
||||
SIGG(pavail) = queue->next;
|
||||
queue->zend_signal.signo = signo;
|
||||
queue->zend_signal.siginfo = siginfo;
|
||||
queue->zend_signal.context = context;
|
||||
queue->next = NULL;
|
||||
|
||||
if (SIGG(phead) && SIGG(ptail)) {
|
||||
SIGG(ptail)->next = queue;
|
||||
} else {
|
||||
SIGG(phead) = queue;
|
||||
}
|
||||
SIGG(ptail) = queue;
|
||||
}
|
||||
#if ZEND_DEBUG
|
||||
else { /* this may not be safe to do, but could work and be useful */
|
||||
zend_output_debug_string(0, "zend_signal: not enough queue storage, lost signal (%d)", signo);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
/* need to just run handler if we're inactive and getting a signal */
|
||||
zend_signal_handler(signo, siginfo, context TSRMLS_CC);
|
||||
}
|
||||
|
||||
errno = errno_save;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ zend_signal_handler_unblock
|
||||
* Handle deferred signal from HANDLE_UNBLOCK_ALARMS */
|
||||
void zend_signal_handler_unblock(TSRMLS_D)
|
||||
{
|
||||
zend_signal_queue_t *queue;
|
||||
zend_signal_t zend_signal;
|
||||
|
||||
if (SIGG(active)) {
|
||||
SIGNAL_BEGIN_CRITICAL(); /* procmask to protect handler_defer as if it were called by the kernel */
|
||||
queue = SIGG(phead);
|
||||
SIGG(phead) = queue->next;
|
||||
zend_signal = queue->zend_signal;
|
||||
queue->next = SIGG(pavail);
|
||||
queue->zend_signal.signo = 0;
|
||||
SIGG(pavail) = queue;
|
||||
|
||||
zend_signal_handler_defer(zend_signal.signo, zend_signal.siginfo, zend_signal.context);
|
||||
SIGNAL_END_CRITICAL();
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ zend_signal_handler
|
||||
* Call the previously registered handler for a signal
|
||||
*/
|
||||
static void zend_signal_handler(int signo, siginfo_t *siginfo, void *context TSRMLS_DC)
|
||||
{
|
||||
int errno_save = errno;
|
||||
struct sigaction sa = {{0}};
|
||||
sigset_t sigset;
|
||||
zend_signal_entry_t p_sig = SIGG(handlers)[signo-1];
|
||||
|
||||
if (p_sig.handler == SIG_DFL) { /* raise default handler */
|
||||
if (sigaction(signo, NULL, &sa) == 0) {
|
||||
sa.sa_handler = SIG_DFL;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, signo);
|
||||
|
||||
if (sigaction(signo, &sa, NULL) == 0) {
|
||||
/* throw away any blocked signals */
|
||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
raise(signo);
|
||||
}
|
||||
}
|
||||
} else if (p_sig.handler != SIG_IGN) { /* ignore SIG_IGN */
|
||||
if (p_sig.flags & SA_SIGINFO) {
|
||||
if (p_sig.flags & SA_RESETHAND) {
|
||||
SIGG(handlers)[signo-1].flags = 0;
|
||||
SIGG(handlers)[signo-1].handler = SIG_DFL;
|
||||
}
|
||||
(*(void (*)(int, siginfo_t*, void*))p_sig.handler)(signo, siginfo, context);
|
||||
} else {
|
||||
(*(void (*)(int))p_sig.handler)(signo);
|
||||
}
|
||||
}
|
||||
|
||||
errno = errno_save;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ zend_sigaction
|
||||
* Register a signal handler that will be deferred in critical sections */
|
||||
ZEND_API int zend_sigaction(int signo, const struct sigaction *act, struct sigaction *oldact TSRMLS_DC)
|
||||
{
|
||||
struct sigaction sa = {{0}};
|
||||
sigset_t sigset;
|
||||
|
||||
if (oldact != NULL) {
|
||||
oldact->sa_flags = SIGG(handlers)[signo-1].flags;
|
||||
oldact->sa_handler = (void *) SIGG(handlers)[signo-1].handler;
|
||||
oldact->sa_mask = global_sigmask;
|
||||
}
|
||||
if (act != NULL) {
|
||||
SIGG(handlers)[signo-1].flags = act->sa_flags;
|
||||
if (act->sa_flags & SA_SIGINFO) {
|
||||
SIGG(handlers)[signo-1].handler = (void *) act->sa_sigaction;
|
||||
} else {
|
||||
SIGG(handlers)[signo-1].handler = (void *) act->sa_handler;
|
||||
}
|
||||
|
||||
sa.sa_flags = SA_SIGINFO | (act->sa_flags & SA_FLAGS_MASK);
|
||||
sa.sa_sigaction = zend_signal_handler_defer;
|
||||
sa.sa_mask = global_sigmask;
|
||||
|
||||
if (sigaction(signo, &sa, NULL) < 0) {
|
||||
zend_error(E_ERROR, "Error installing signal handler for %d", signo);
|
||||
}
|
||||
|
||||
/* unsure this signal is not blocked */
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, signo);
|
||||
zend_sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ zend_signal
|
||||
* Register a signal handler that will be deferred in critical sections */
|
||||
ZEND_API int zend_signal(int signo, void (*handler)(int) TSRMLS_DC)
|
||||
{
|
||||
struct sigaction sa = {{0}};
|
||||
|
||||
sa.sa_flags = 0;
|
||||
sa.sa_handler = handler;
|
||||
sa.sa_mask = global_sigmask;
|
||||
|
||||
return zend_sigaction(signo, &sa, NULL TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ zend_signal_register
|
||||
* Set a handler for a signal we want to defer.
|
||||
* Previously set handler must have been saved before.
|
||||
*/
|
||||
static int zend_signal_register(int signo, void (*handler)(int, siginfo_t*, void*) TSRMLS_DC)
|
||||
{
|
||||
struct sigaction sa = {{0}};
|
||||
|
||||
if (sigaction(signo, NULL, &sa) == 0) {
|
||||
if ((sa.sa_flags & SA_SIGINFO) && sa.sa_sigaction == handler) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
SIGG(handlers)[signo-1].flags = sa.sa_flags;
|
||||
if (sa.sa_flags & SA_SIGINFO) {
|
||||
SIGG(handlers)[signo-1].handler = (void *)sa.sa_sigaction;
|
||||
} else {
|
||||
SIGG(handlers)[signo-1].handler = (void *)sa.sa_handler;
|
||||
}
|
||||
|
||||
sa.sa_flags = SA_SIGINFO; /* we'll use a siginfo handler */
|
||||
sa.sa_sigaction = handler;
|
||||
sa.sa_mask = global_sigmask;
|
||||
|
||||
if (sigaction(signo, &sa, NULL) < 0) {
|
||||
zend_error(E_ERROR, "Error installing signal handler for %d", signo);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
return FAILURE;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ zend_signal_activate
|
||||
* Install our signal handlers, per request */
|
||||
void zend_signal_activate(TSRMLS_D)
|
||||
{
|
||||
int x;
|
||||
|
||||
memcpy(&SIGG(handlers), &global_orig_handlers, sizeof(global_orig_handlers));
|
||||
|
||||
for (x=0; x < sizeof(zend_sigs) / sizeof(*zend_sigs); x++) {
|
||||
zend_signal_register(zend_sigs[x], zend_signal_handler_defer TSRMLS_CC);
|
||||
}
|
||||
|
||||
SIGG(active) = 1;
|
||||
SIGG(depth) = 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ zend_signal_deactivate
|
||||
* */
|
||||
void zend_signal_deactivate(TSRMLS_D)
|
||||
{
|
||||
int x;
|
||||
struct sigaction sa = {{0}};
|
||||
|
||||
if (SIGG(check)) {
|
||||
if (SIGG(depth) != 0) {
|
||||
zend_error(E_CORE_WARNING, "zend_signal: shutdown with non-zero blocking depth (%d)", SIGG(depth));
|
||||
}
|
||||
/* did anyone steal our installed handler */
|
||||
for (x=0; x < sizeof(zend_sigs) / sizeof(*zend_sigs); x++) {
|
||||
sigaction(zend_sigs[x], NULL, &sa);
|
||||
if (sa.sa_sigaction != zend_signal_handler_defer) {
|
||||
zend_error(E_CORE_WARNING, "zend_signal: handler was replaced for signal (%d) after startup", zend_sigs[x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SIGNAL_BEGIN_CRITICAL();
|
||||
SIGG(active) = 0;
|
||||
SIGG(running) = 0;
|
||||
SIGG(blocked) = -1;
|
||||
SIGG(depth) = 0;
|
||||
SIGNAL_END_CRITICAL();
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void zend_signal_globals_ctor(zend_signal_globals_t *zend_signal_globals TSRMLS_DC)
|
||||
{
|
||||
size_t x;
|
||||
|
||||
memset(zend_signal_globals, 0, sizeof(*zend_signal_globals));
|
||||
zend_signal_globals->blocked = -1;
|
||||
|
||||
for (x = 0; x < sizeof(zend_signal_globals->pstorage) / sizeof(*zend_signal_globals->pstorage); ++x) {
|
||||
zend_signal_queue_t *queue = &zend_signal_globals->pstorage[x];
|
||||
queue->zend_signal.signo = 0;
|
||||
queue->next = zend_signal_globals->pavail;
|
||||
zend_signal_globals->pavail = queue;
|
||||
}
|
||||
}
|
||||
|
||||
static void zend_signal_globals_dtor(zend_signal_globals_t *zend_signal_globals TSRMLS_DC)
|
||||
{
|
||||
zend_signal_globals->blocked = -1;
|
||||
}
|
||||
|
||||
/* {{{ zend_signal_startup
|
||||
* alloc zend signal globals */
|
||||
void zend_signal_startup()
|
||||
{
|
||||
int signo;
|
||||
struct sigaction sa = {{0}};
|
||||
|
||||
#ifdef ZTS
|
||||
ts_allocate_id(&zend_signal_globals_id, sizeof(zend_signal_globals_t), (ts_allocate_ctor) zend_signal_globals_ctor, (ts_allocate_dtor) zend_signal_globals_dtor);
|
||||
#else
|
||||
zend_signal_globals_ctor(&zend_signal_globals);
|
||||
#endif
|
||||
|
||||
/* Used to block signals during execution of signal handlers */
|
||||
sigfillset(&global_sigmask);
|
||||
sigdelset(&global_sigmask, SIGILL);
|
||||
sigdelset(&global_sigmask, SIGABRT);
|
||||
sigdelset(&global_sigmask, SIGFPE);
|
||||
sigdelset(&global_sigmask, SIGKILL);
|
||||
sigdelset(&global_sigmask, SIGSEGV);
|
||||
sigdelset(&global_sigmask, SIGCONT);
|
||||
sigdelset(&global_sigmask, SIGSTOP);
|
||||
sigdelset(&global_sigmask, SIGTSTP);
|
||||
sigdelset(&global_sigmask, SIGTTIN);
|
||||
sigdelset(&global_sigmask, SIGTTOU);
|
||||
#ifdef SIGBUS
|
||||
sigdelset(&global_sigmask, SIGBUS);
|
||||
#endif
|
||||
#ifdef SIGSYS
|
||||
sigdelset(&global_sigmask, SIGSYS);
|
||||
#endif
|
||||
#ifdef SIGTRAP
|
||||
sigdelset(&global_sigmask, SIGTRAP);
|
||||
#endif
|
||||
|
||||
/* Save previously registered signal handlers into orig_handlers */
|
||||
memset(&global_orig_handlers, 0, sizeof(global_orig_handlers));
|
||||
for (signo = 1; signo < NSIG; ++signo) {
|
||||
if (sigaction(signo, NULL, &sa) == 0) {
|
||||
global_orig_handlers[signo-1].flags = sa.sa_flags;
|
||||
if (sa.sa_flags & SA_SIGINFO) {
|
||||
global_orig_handlers[signo-1].handler = (void *) sa.sa_sigaction;
|
||||
} else {
|
||||
global_orig_handlers[signo-1].handler = (void *) sa.sa_handler;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ zend_signal_shutdown
|
||||
* called by zend_shutdown */
|
||||
void zend_signal_shutdown(TSRMLS_D)
|
||||
{
|
||||
#ifndef ZTS
|
||||
zend_signal_globals_dtor(&zend_signal_globals);
|
||||
#endif
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
#endif /* ZEND_SIGNALS */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* vim600: fdm=marker
|
||||
* vim: noet sw=4 ts=4
|
||||
*/
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Signal Handling |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2008 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Lucas Nealan <lucas@php.net> |
|
||||
| Arnaud Le Blanc <lbarnaud@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef ZEND_SIGNAL_H
|
||||
#define ZEND_SIGNAL_H
|
||||
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifndef NSIG
|
||||
#define NSIG 65
|
||||
#endif
|
||||
|
||||
#ifndef ZEND_SIGNAL_QUEUE_SIZE
|
||||
#define ZEND_SIGNAL_QUEUE_SIZE 32
|
||||
#endif
|
||||
|
||||
/* Signal structs */
|
||||
typedef struct _zend_signal_entry_t {
|
||||
int flags; /* sigaction style flags */
|
||||
void* handler; /* signal handler or context */
|
||||
} zend_signal_entry_t;
|
||||
|
||||
typedef struct _zend_signal_t {
|
||||
int signo;
|
||||
siginfo_t *siginfo;
|
||||
void* context;
|
||||
} zend_signal_t;
|
||||
|
||||
typedef struct _zend_signal_queue_t {
|
||||
zend_signal_t zend_signal;
|
||||
struct _zend_signal_queue_t *next;
|
||||
} zend_signal_queue_t;
|
||||
|
||||
/* Signal Globals */
|
||||
typedef struct _zend_signal_globals_t {
|
||||
int depth;
|
||||
int blocked; /* 0==TRUE, -1==FALSE */
|
||||
int running; /* in signal handler execution */
|
||||
int active; /* internal signal handling is enabled */
|
||||
int initialized; /* memory initialized */
|
||||
zend_bool check; /* check for replaced handlers on shutdown */
|
||||
zend_signal_entry_t handlers[NSIG];
|
||||
zend_signal_queue_t pstorage[ZEND_SIGNAL_QUEUE_SIZE], *phead, *ptail, *pavail; /* pending queue */
|
||||
} zend_signal_globals_t;
|
||||
|
||||
#ifdef ZTS
|
||||
# define SIGG(v) TSRMG(zend_signal_globals_id, zend_signal_globals_t *, v)
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API extern int zend_signal_globals_id;
|
||||
END_EXTERN_C()
|
||||
#else /* ZTS */
|
||||
# define SIGG(v) (zend_signal_globals.v)
|
||||
extern ZEND_API zend_signal_globals_t zend_signal_globals;
|
||||
#endif /* not ZTS */
|
||||
|
||||
# define SIGNAL_BEGIN_CRITICAL() sigset_t oldmask; \
|
||||
zend_sigprocmask(SIG_BLOCK, &global_sigmask, &oldmask);
|
||||
# define SIGNAL_END_CRITICAL() zend_sigprocmask(SIG_SETMASK, &oldmask, NULL);
|
||||
|
||||
void zend_signal_handler_defer(int signo, siginfo_t *siginfo, void *context);
|
||||
void zend_signal_handler_unblock();
|
||||
void zend_signal_activate(TSRMLS_D);
|
||||
void zend_signal_deactivate(TSRMLS_D);
|
||||
void zend_signal_startup();
|
||||
void zend_signal_shutdown(TSRMLS_D);
|
||||
ZEND_API int zend_signal(int signo, void (*handler)(int) TSRMLS_DC);
|
||||
ZEND_API int zend_sigaction(int signo, const struct sigaction *act, struct sigaction *oldact TSRMLS_DC);
|
||||
|
||||
#ifdef ZTS
|
||||
#define zend_sigprocmask(signo, set, oldset) tsrm_sigmask((signo), (set), (oldset))
|
||||
#else
|
||||
#define zend_sigprocmask(signo, set, oldset) sigprocmask((signo), (set), (oldset))
|
||||
#endif
|
||||
|
||||
#endif /* ZEND_SIGNAL_H */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
*/
|
||||
@@ -2585,6 +2585,11 @@ ZEND_API double zend_hex_strtod(const char *str, const char **endptr)
|
||||
int any = 0;
|
||||
double value = 0;
|
||||
|
||||
if (strlen(str) < 2) {
|
||||
*endptr = str;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
if (*s == '0' && (s[1] == 'x' || s[1] == 'X')) {
|
||||
s += 2;
|
||||
}
|
||||
@@ -2618,6 +2623,11 @@ ZEND_API double zend_oct_strtod(const char *str, const char **endptr)
|
||||
double value = 0;
|
||||
int any = 0;
|
||||
|
||||
if (strlen(str) < 1) {
|
||||
*endptr = str;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/* skip leading zero */
|
||||
s++;
|
||||
|
||||
@@ -2639,6 +2649,49 @@ ZEND_API double zend_oct_strtod(const char *str, const char **endptr)
|
||||
return value;
|
||||
}
|
||||
|
||||
ZEND_API double zend_bin_strtod(const char *str, const char **endptr)
|
||||
{
|
||||
const char *s = str;
|
||||
char c;
|
||||
double value = 0;
|
||||
int any = 0;
|
||||
|
||||
if (strlen(str) < 2) {
|
||||
*endptr = str;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
if ('0' == *s && ('b' == s[1] || 'B' == s[1])) {
|
||||
s += 2;
|
||||
}
|
||||
|
||||
while ((c = *s++)) {
|
||||
/*
|
||||
* Verify the validity of the current character as a base-2 digit. In
|
||||
* the event that an invalid digit is found, halt the conversion and
|
||||
* return the portion which has been converted thus far.
|
||||
*/
|
||||
if ('0' == c || '1' == c)
|
||||
value = value * 2 + c - '0';
|
||||
else
|
||||
break;
|
||||
|
||||
any = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* As with many strtoX implementations, should the subject sequence be
|
||||
* empty or not well-formed, no conversion is performed and the original
|
||||
* value of str is stored in *endptr, provided that endptr is not a null
|
||||
* pointer.
|
||||
*/
|
||||
if (NULL != endptr) {
|
||||
*endptr = (char *)(any ? s - 1 : str);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
|
||||
@@ -30,6 +30,7 @@ ZEND_API char * zend_dtoa(double _d, int mode, int ndigits, int *decpt, int *sig
|
||||
ZEND_API double zend_strtod(const char *s00, const char **se);
|
||||
ZEND_API double zend_hex_strtod(const char *str, const char **endptr);
|
||||
ZEND_API double zend_oct_strtod(const char *str, const char **endptr);
|
||||
ZEND_API double zend_bin_strtod(const char *str, const char **endptr);
|
||||
ZEND_API int zend_startup_strtod(void);
|
||||
ZEND_API int zend_shutdown_strtod(void);
|
||||
END_EXTERN_C()
|
||||
|
||||
@@ -32,7 +32,6 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) {
|
||||
case IS_STRING:
|
||||
case IS_CONSTANT:
|
||||
case IS_CLASS:
|
||||
CHECK_ZVAL_STRING_REL(zvalue);
|
||||
STR_FREE_REL(zvalue->value.str.val);
|
||||
break;
|
||||
|
||||
Loaded 100 of 1063 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user