mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-16 21:46:38 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb7b49dcf8 | ||
|
|
763c61db29 | ||
|
|
fcf5bd7e2a | ||
|
|
bb858252ac | ||
|
|
7f68a7afe6 | ||
|
|
408272b8d9 | ||
|
|
fad87a24da | ||
|
|
edb9229b8b | ||
|
|
9552cf6b84 | ||
|
|
b63ea1047a | ||
|
|
cb9785add1 | ||
|
|
2dc75a9e93 | ||
|
|
2d858fbfb1 | ||
|
|
f73e419996 | ||
|
|
6d3d9104e6 | ||
|
|
2d7ada2c0b | ||
|
|
4fb8252186 | ||
|
|
7566742754 | ||
|
|
afe17cc1b6 | ||
|
|
f43097a2d7 | ||
|
|
64b1085464 | ||
|
|
882862563a | ||
|
|
7b7d99839c | ||
|
|
c70220205e | ||
|
|
8b9dd0a301 | ||
|
|
3646604203 | ||
|
|
8e9eeca0b3 | ||
|
|
44a80b64b9 | ||
|
|
6ec25f386f | ||
|
|
5199686873 | ||
|
|
226395a335 | ||
|
|
c34c523467 | ||
|
|
7215261349 | ||
|
|
cec5e30889 | ||
|
|
d80d918547 | ||
|
|
39c6aaa9cc | ||
|
|
fd5ff37db7 | ||
|
|
ce7935e82a | ||
|
|
40ba9f6a1a | ||
|
|
cff35ca0b2 | ||
|
|
788abb8cc8 | ||
|
|
32d128d219 | ||
|
|
45fa7596dc | ||
|
|
57cb01a927 | ||
|
|
838ae016d7 | ||
|
|
d4aff25473 | ||
|
|
f5768eaa2e | ||
|
|
186f9bab45 | ||
|
|
44192ce80b | ||
|
|
3549f48edc | ||
|
|
ab92ffee22 | ||
|
|
ff8da0dcff | ||
|
|
4f508003a9 | ||
|
|
92f71d9d42 | ||
|
|
03713ace23 | ||
|
|
f731477cd7 | ||
|
|
ca7547c9e2 | ||
|
|
e2c30c6a2e | ||
|
|
5e06dad411 | ||
|
|
f23bfc4b43 | ||
|
|
95e405023e | ||
|
|
4ff2665509 | ||
|
|
4be5b4aa25 | ||
|
|
3f8d21b922 | ||
|
|
0c6ff5eafa | ||
|
|
8b7aaad7d6 | ||
|
|
5cb25a2d32 | ||
|
|
767ddb1cd5 | ||
|
|
958e3b93c3 | ||
|
|
06c9633b43 | ||
|
|
f4332a36b4 | ||
|
|
1bb2a4f91c | ||
|
|
665e1f324a | ||
|
|
37ab72768f | ||
|
|
3d09626f0d | ||
|
|
039ca4e219 | ||
|
|
f1cf553437 | ||
|
|
8c04944b66 | ||
|
|
b20362c24b | ||
|
|
0ec7bfaa43 | ||
|
|
54fa0a69f8 | ||
|
|
f1a988af4b | ||
|
|
51d76c346e | ||
|
|
efe69168b4 | ||
|
|
675a9b2831 | ||
|
|
57257a4335 | ||
|
|
766d5846b1 | ||
|
|
7e9479083d | ||
|
|
cab1ea46e7 | ||
|
|
9efd7ddd0a | ||
|
|
217b9e7b41 | ||
|
|
c72957b409 | ||
|
|
ab8177de2c | ||
|
|
12d08db913 | ||
|
|
d94d0dda29 | ||
|
|
86de4d7af6 | ||
|
|
3c939e3f69 | ||
|
|
49ef8bc026 | ||
|
|
b23a4256a6 | ||
|
|
4a35f4a476 | ||
|
|
aeb4f21549 | ||
|
|
067f7e4150 | ||
|
|
27eb81604b | ||
|
|
17142eab22 | ||
|
|
e9b8b085a7 | ||
|
|
66a21e90cb | ||
|
|
21f861225a | ||
|
|
9c673083cd | ||
|
|
effa287b35 | ||
|
|
fbf8c758fe | ||
|
|
4a89e726bd | ||
|
|
64622979f9 | ||
|
|
01a348617f | ||
|
|
6a0b889f57 | ||
|
|
372fb75b68 | ||
|
|
94af11d5e1 | ||
|
|
b529d02d24 | ||
|
|
094e1a8b2d | ||
|
|
a2dcd44272 | ||
|
|
2e580da28e | ||
|
|
61ed904cec | ||
|
|
18507853cb | ||
|
|
d319098b24 | ||
|
|
527bcb1e2e | ||
|
|
fee80e397d | ||
|
|
f31538c997 | ||
|
|
3f183bbcf8 | ||
|
|
072cfef1d5 | ||
|
|
491488d217 | ||
|
|
a86443f5a3 | ||
|
|
bff7761653 | ||
|
|
02933f923e | ||
|
|
edb389730d | ||
|
|
c4e63c378c | ||
|
|
6adfb8c962 | ||
|
|
0ad78817a3 | ||
|
|
4c1b3e3036 | ||
|
|
286c13e1e6 | ||
|
|
6288228b56 | ||
|
|
34f0f60db5 | ||
|
|
9ce200f6cb | ||
|
|
b5599a37d7 | ||
|
|
a33d0c3aae | ||
|
|
e8a89c49db | ||
|
|
f3415758d1 | ||
|
|
05d168013a | ||
|
|
1bdd8f7ae4 | ||
|
|
5d31ee302d | ||
|
|
f33105dcb6 | ||
|
|
cfae999f1b | ||
|
|
68f5289e9e | ||
|
|
872f302b8d | ||
|
|
fbd8e20ed5 | ||
|
|
dd7d829896 | ||
|
|
f2364f316d | ||
|
|
7290dc4dcf | ||
|
|
ebf461a025 | ||
|
|
39077deea5 | ||
|
|
c31f9f7ee4 | ||
|
|
48e2e5324e | ||
|
|
0aad77418d | ||
|
|
c321896a37 | ||
|
|
38ad37ad43 | ||
|
|
880bf62224 | ||
|
|
f9fbba41b6 | ||
|
|
3edf5c969a | ||
|
|
41e9a8ebdc | ||
|
|
7a049cd6a4 | ||
|
|
973138f39d | ||
|
|
bc0f78a2da | ||
|
|
94a151a018 | ||
|
|
95a13ca989 | ||
|
|
52ed45745e | ||
|
|
25103c37aa | ||
|
|
35e0506a2e | ||
|
|
f40838eaaa | ||
|
|
8ae02c8a95 | ||
|
|
9450893dc6 | ||
|
|
34ef804b04 | ||
|
|
f674a3343c | ||
|
|
44a311dbbe | ||
|
|
90081c5391 | ||
|
|
66a74f2f4a | ||
|
|
d1b1c04398 | ||
|
|
b7689db7ab | ||
|
|
afc69e46b8 | ||
|
|
5c963731e2 | ||
|
|
dd335359e9 | ||
|
|
5e57f37247 | ||
|
|
6b631f073d | ||
|
|
121790eaff | ||
|
|
764b7bf108 | ||
|
|
9f96b2bdc8 | ||
|
|
821eaaf0b4 | ||
|
|
1b5c62facd | ||
|
|
af7445b9ac | ||
|
|
65f14b0d6c | ||
|
|
abe23bd9a3 | ||
|
|
6e90c75507 | ||
|
|
151fce1129 | ||
|
|
bf2bb39eac | ||
|
|
46d6daea7a | ||
|
|
4d1c1e4554 | ||
|
|
ced4c0bfe6 | ||
|
|
e65932060a | ||
|
|
ec589a27da | ||
|
|
65d7ade684 | ||
|
|
2498385dd9 | ||
|
|
8967e66559 | ||
|
|
8768621149 | ||
|
|
b132da7f9d | ||
|
|
aab23282fc | ||
|
|
e470f9b389 | ||
|
|
434c2b1bdb | ||
|
|
128fca4037 | ||
|
|
2d3d72412a | ||
|
|
cae0bcbab5 | ||
|
|
b2fba0ef62 | ||
|
|
b23c865d15 | ||
|
|
82f9e004da | ||
|
|
2e854791af | ||
|
|
446ad04524 | ||
|
|
abecaab09f | ||
|
|
da0ca53f39 | ||
|
|
56fde2a381 | ||
|
|
13f898b56a | ||
|
|
46a2c6a8d7 | ||
|
|
9cec093b7f | ||
|
|
420184ad52 | ||
|
|
45b638afe0 | ||
|
|
57430e6f1e | ||
|
|
0db6f5267c | ||
|
|
269936e680 | ||
|
|
23bbff2b05 | ||
|
|
ab4c5976d7 | ||
|
|
c1d766171b | ||
|
|
ed19cb6518 | ||
|
|
34aefa36f4 | ||
|
|
959d3c9636 | ||
|
|
7d9ddd61ec | ||
|
|
70dfbe0068 | ||
|
|
288332077f | ||
|
|
b043759cb4 | ||
|
|
27e250880b | ||
|
|
d6731d69bd | ||
|
|
74959b47cd | ||
|
|
2877642037 | ||
|
|
32c6c29d79 | ||
|
|
b67c232189 | ||
|
|
3c68f43251 | ||
|
|
51f57e7b81 | ||
|
|
ab84623108 | ||
|
|
bc166844e3 | ||
|
|
1860ef22eb | ||
|
|
c56701690a | ||
|
|
205d209de9 | ||
|
|
1a66d64717 | ||
|
|
315f3f8dc9 | ||
|
|
f6bd3dfdbc | ||
|
|
118ff03335 | ||
|
|
e586a35fc7 | ||
|
|
078cdd8f76 | ||
|
|
9eea9aae10 | ||
|
|
f1f78ac875 | ||
|
|
de78786566 | ||
|
|
c2fbab392c | ||
|
|
a53d67ceac | ||
|
|
305500a3b1 | ||
|
|
c0a1c2c5ee | ||
|
|
40d9e3ab86 | ||
|
|
724e241c9d | ||
|
|
b6d043aae2 | ||
|
|
54248b18fe | ||
|
|
1e6c7e776c | ||
|
|
2e974c8c81 | ||
|
|
15d9c42070 | ||
|
|
10c9d615de | ||
|
|
b3377028dc | ||
|
|
66e390707c | ||
|
|
a12e7affd7 | ||
|
|
d254078020 | ||
|
|
a221e17b41 | ||
|
|
b0e858da8b | ||
|
|
ccb7f1c7d8 | ||
|
|
7a89157f8c | ||
|
|
81f012a164 | ||
|
|
e4e88bd7e3 | ||
|
|
ad8eb116d8 | ||
|
|
d6b4b82a38 | ||
|
|
4e51059d52 | ||
|
|
43741a3f26 | ||
|
|
c927c831e6 | ||
|
|
54a63d91b8 | ||
|
|
9e3ba775b7 | ||
|
|
a5527577e7 | ||
|
|
15b51a215a | ||
|
|
dde5572937 | ||
|
|
288581fade | ||
|
|
d63aedd173 | ||
|
|
e450621f5e | ||
|
|
9b678bc4d5 | ||
|
|
4922049213 | ||
|
|
26c7b9402d | ||
|
|
c95680d4b7 | ||
|
|
f3d5877845 | ||
|
|
e9f9e9f863 | ||
|
|
106e7e4bca | ||
|
|
fcfa7fd06b | ||
|
|
ef342b0730 | ||
|
|
a073b0218c | ||
|
|
b9ea8d6b96 | ||
|
|
fb69c7752d | ||
|
|
8d268e8443 | ||
|
|
186b766368 | ||
|
|
23193e89e4 | ||
|
|
71b5f1446e | ||
|
|
44b234a9bc | ||
|
|
18517e7a63 | ||
|
|
9c0712d2cd | ||
|
|
311a77d08e | ||
|
|
2df09b9b64 | ||
|
|
bfa69d27bc | ||
|
|
713ef8511b | ||
|
|
fb4bc0f9e5 | ||
|
|
20e75329f2 | ||
|
|
d6ae0f010e | ||
|
|
65f5573bc8 | ||
|
|
c3734f9ae1 | ||
|
|
bd72e4aa44 | ||
|
|
bd093ad861 | ||
|
|
db34491a62 | ||
|
|
2d467abc46 | ||
|
|
7971602574 | ||
|
|
9dc42b4114 | ||
|
|
a83cc03c13 | ||
|
|
b52db133df | ||
|
|
8588ae7215 | ||
|
|
77325c4448 | ||
|
|
426fe2f20c | ||
|
|
e45cc31c41 | ||
|
|
724ee93ce6 | ||
|
|
8f8e6f95af | ||
|
|
1a1eeee716 | ||
|
|
0f6c41c6f8 | ||
|
|
0697a64f7e | ||
|
|
98cccd304a | ||
|
|
5d5c1cea5f | ||
|
|
261faa62da | ||
|
|
53f7bddbeb | ||
|
|
8d2a1c8966 | ||
|
|
d386ed1e6b | ||
|
|
7bc7a80445 | ||
|
|
72cd5793be | ||
|
|
9dda22bd1e | ||
|
|
f2833ca1be | ||
|
|
d6fcaf5da4 | ||
|
|
a89aaf6c38 | ||
|
|
7a61984a2b | ||
|
|
5aaffc8095 | ||
|
|
83cf4aa13a | ||
|
|
c283f53b24 | ||
|
|
44475e70e2 | ||
|
|
1674c96c0b | ||
|
|
8ad2b59e12 | ||
|
|
f06afc434a | ||
|
|
5dfec886d6 | ||
|
|
648cda6c9f | ||
|
|
4959c60524 | ||
|
|
31eafedf2e | ||
|
|
f1d11c118d | ||
|
|
841b00f641 | ||
|
|
5f36d0497f | ||
|
|
57463cf78b | ||
|
|
32cd5a1bc8 | ||
|
|
ecee3f1209 | ||
|
|
0076b47326 | ||
|
|
a55402d07c | ||
|
|
24a19cc232 | ||
|
|
a0baa09b99 | ||
|
|
4643c0aac5 | ||
|
|
ed9532cff0 | ||
|
|
666833b238 | ||
|
|
5e15c9c41f | ||
|
|
d5a82e2c4e | ||
|
|
15073d8e1d | ||
|
|
fdb05b92bf | ||
|
|
e77ac88a44 | ||
|
|
44ccccdfb8 | ||
|
|
5b3809e942 | ||
|
|
0ce9b5f755 | ||
|
|
a505fc627e | ||
|
|
a87d620543 | ||
|
|
b855907f54 | ||
|
|
685708160e | ||
|
|
08919578ca | ||
|
|
3430d856ac | ||
|
|
e5aae35855 | ||
|
|
4f3cf983dc | ||
|
|
4e30ab33d8 | ||
|
|
8b281e5b6b | ||
|
|
8e25cf26af | ||
|
|
bcefbf8602 | ||
|
|
07c5efbd76 | ||
|
|
4a10037cb4 | ||
|
|
2772f7c3ad | ||
|
|
f35b194029 | ||
|
|
4a7ebb6d83 | ||
|
|
f4e1768e21 | ||
|
|
0f579fd7c8 | ||
|
|
48ff654fb9 | ||
|
|
c61390cfb4 | ||
|
|
5240f8391f | ||
|
|
a9c44d1b5a | ||
|
|
49e1ed1941 | ||
|
|
3697648be5 | ||
|
|
6132389d1c | ||
|
|
ea372e7463 | ||
|
|
c65f0c7aca | ||
|
|
306555e11d | ||
|
|
217f247bb5 | ||
|
|
2fb12be84c | ||
|
|
f5b93626a6 | ||
|
|
518eb0ca2b | ||
|
|
233f507fe6 | ||
|
|
e3e6e1e59b | ||
|
|
367f8452c4 | ||
|
|
e3e67b721f | ||
|
|
308050e94b | ||
|
|
97d192b444 | ||
|
|
373fd61a51 | ||
|
|
7a3f25e370 | ||
|
|
e074e029ee | ||
|
|
4633e70ab1 | ||
|
|
37f96d990c | ||
|
|
cb399d0410 | ||
|
|
7fc2a3e15e | ||
|
|
cdd5ec7a3c | ||
|
|
70f59b3416 | ||
|
|
706241f82d | ||
|
|
fc26ad9b12 | ||
|
|
ae6e56fb98 | ||
|
|
d016434ad3 | ||
|
|
bf244757ee | ||
|
|
e589609b4c | ||
|
|
39f95f5614 | ||
|
|
337031abbd | ||
|
|
deb8b8190e | ||
|
|
5f9c82d514 | ||
|
|
b91bf22333 | ||
|
|
fa713ec17b | ||
|
|
03f8bccaf5 | ||
|
|
912cb8b8b5 | ||
|
|
4bbb98c24f | ||
|
|
68d5878097 | ||
|
|
807775b641 | ||
|
|
ce18899b44 | ||
|
|
337d2af6ca | ||
|
|
586ccfdfd5 | ||
|
|
4cf3da7383 | ||
|
|
9b1c02c2df | ||
|
|
221345a013 | ||
|
|
40ebfd6730 | ||
|
|
0dac69c059 | ||
|
|
ed949a1973 | ||
|
|
860f46e2f5 | ||
|
|
fa67864c13 | ||
|
|
c0d1dbcb43 | ||
|
|
c8df28d276 | ||
|
|
c7343510e4 | ||
|
|
881e43a03c | ||
|
|
2e27bb8682 | ||
|
|
c2b1182879 | ||
|
|
3c44e9c080 |
No files matched your search
@@ -340,7 +340,8 @@ define ____print_ht
|
||||
end
|
||||
printf "[%d] ", $i
|
||||
if $p->key
|
||||
printf "%s => ", $p->key->val
|
||||
____print_str $p->key->val $p->key->len
|
||||
printf " => "
|
||||
else
|
||||
printf "%d => ", $p->h
|
||||
end
|
||||
|
||||
@@ -70,8 +70,10 @@ jobs:
|
||||
include:
|
||||
- env: ENABLE_ZTS=0 ENABLE_DEBUG=0
|
||||
arch: amd64
|
||||
if: type = cron
|
||||
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1
|
||||
arch: amd64
|
||||
if: type = cron
|
||||
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 ARM64=1
|
||||
arch: arm64
|
||||
if: type = cron
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2019 The PHP Group. All rights reserved.
|
||||
Copyright (c) 1999 - 2021 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,230 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
04 Mar 2021, PHP 8.0.3
|
||||
|
||||
- Core:
|
||||
. Fixed #80706 (mail(): Headers after Bcc headers may be ignored). (cmb)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug #80600 (DOMChildNode::remove() doesn't work on CharacterData
|
||||
nodes). (beberlei)
|
||||
|
||||
- Gettext:
|
||||
. Fixed bug #53251 (bindtextdomain with null dir doesn't return old value).
|
||||
(cmb)
|
||||
|
||||
- MySQLnd:
|
||||
. Fixed bug #78680 (mysqlnd's mysql_clear_password does not transmit
|
||||
null-terminated password). (Daniel Black)
|
||||
. Fixed bug #80713 (SegFault when disabling ATTR_EMULATE_PREPARES and
|
||||
MySQL 8.0). (Nikita)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #74779 (x() and y() truncating floats to integers). (cmb)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #80634 (write_property handler of internal classes is skipped on
|
||||
preloaded JITted code). (Dmitry)
|
||||
. Fixed bug #80682 (opcache doesn't honour pcre.jit option). (Remi)
|
||||
. Fixed bug #80742 (Opcache JIT makes some boolean logic unexpectedly be
|
||||
true). (Dmitry)
|
||||
. Fixed bug #80745 (JIT produces Assert failure and UNKNOWN:0 var_dumps in
|
||||
code involving bitshifts). (Dmitry)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #80747 (Providing RSA key size < 512 generates key that crash
|
||||
PHP). (Nikita)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #75850 (Unclear error message wrt. __halt_compiler() w/o
|
||||
semicolon) (cmb)
|
||||
. Fixed bug #70091 (Phar does not mark UTF-8 filenames in ZIP archives). (cmb)
|
||||
. Fixed bug #53467 (Phar cannot compress large archives). (cmb, lserni)
|
||||
|
||||
- Socket:
|
||||
. Fixed bug #80723 (Different sockets compare as equal (regression in 8.0)).
|
||||
(Nikita)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug#80719 (Iterating after failed ArrayObject::setIteratorClass()
|
||||
causes Segmentation fault). (Nikita)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #80654 (file_get_contents() maxlen fails above (2**31)-1 bytes).
|
||||
(cmb)
|
||||
. Fixed bug #80718 (ext/standard/dl.c fallback code path with syntax error).
|
||||
(Nikita)
|
||||
|
||||
21 Jan 2021, PHP 8.0.2
|
||||
|
||||
- Core:
|
||||
. Fixed bug #80523 (bogus parse error on >4GB source code). (Nikita)
|
||||
. Fixed bug #80384 (filter buffers entire read until file closed). (Adam
|
||||
Seitz, cmb)
|
||||
. Fixed bug #80596 (Invalid union type TypeError in anonymous classes).
|
||||
(Daniil Gentili)
|
||||
. Fixed bug #80617 (GCC throws warning about type narrowing in
|
||||
ZEND_TYPE_INIT_CODE). (Nikita)
|
||||
|
||||
- BCMath:
|
||||
. Fixed bug #80545 (bcadd('a', 'a') doesn't throw an exception).
|
||||
(Jens de Nies)
|
||||
|
||||
- Curl:
|
||||
. Fixed bug #80595 (Resetting POSTFIELDS to empty array breaks request). (cmb)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #80376 (last day of the month causes runway cpu usage). (Derick)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug #80537 (Wrong parameter type in DOMElement::removeAttributeNode
|
||||
stub). (Nikita)
|
||||
|
||||
- Filter:
|
||||
. Fixed bug #80584 (0x and 0X are considered valid hex numbers by
|
||||
filter_var()). (girgias)
|
||||
|
||||
- GMP:
|
||||
. Fixed bug #80560 (Strings containing only a base prefix return 0 object).
|
||||
(girgias)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #80644 (Missing resource causes subsequent get() calls to fail).
|
||||
(Nikita)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #67983 (mysqlnd with MYSQLI_OPT_INT_AND_FLOAT_NATIVE fails to
|
||||
interpret bit columns). (Nikita)
|
||||
. Fixed bug #64638 (Fetching resultsets from stored procedure with cursor
|
||||
fails). (Nikita)
|
||||
. Fixed bug #72862 (segfault using prepared statements on stored procedures
|
||||
that use a cursor). (Nikita)
|
||||
. Fixed bug #77935 (Crash in mysqlnd_fetch_stmt_row_cursor when calling an SP
|
||||
with a cursor). (Nikita)
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #80592 (all floats are the same in ODBC parameters). (cmb)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #80422 (php_opcache.dll crashes when using Apache 2.4 with JIT).
|
||||
(Dmitry)
|
||||
|
||||
- PDO_Firebird:
|
||||
. Fixed bug #80521 (Parameters with underscores no longer recognized). (cmb,
|
||||
Simonov Denis)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #76929 (zip-based phar does not respect phar.require_hash).
|
||||
(david at bamsoftware, cmb)
|
||||
. Fixed bug #77565 (Incorrect locator detection in ZIP-based phars). (cmb)
|
||||
. Fixed bug #69279 (Compressed ZIP Phar extractTo() creates garbage files).
|
||||
(cmb)
|
||||
|
||||
- Phpdbg:
|
||||
. Reverted fix for bug #76813 (Access violation near NULL on source operand).
|
||||
(cmb)
|
||||
|
||||
07 Jan 2021, PHP 8.0.1
|
||||
|
||||
- Core:
|
||||
. Fixed bug #80345 (PHPIZE configuration has outdated PHP_RELEASE_VERSION).
|
||||
(cmb)
|
||||
. Fixed bug #72964 (White space not unfolded for CC/Bcc headers). (cmb)
|
||||
. Fixed bug #80391 (Iterable not covariant to mixed). (Nikita)
|
||||
. Fixed bug #80393 (Build of PHP extension fails due to configuration gap
|
||||
with libtool). (kir dot morozov at gmail dot com)
|
||||
. Fixed bug #77069 (stream filter loses final block of data). (cmb)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #77961 (finfo_open crafted magic parsing SIGABRT). (cmb)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #69625 (FPM returns 200 status on request without
|
||||
SCRIPT_FILENAME env). (Jakub Zelenka)
|
||||
|
||||
- IMAP
|
||||
. Fixed bug #80438 (imap_msgno() incorrectly warns and return false on valid UIDs in PHP 8.0.0). (girgias)
|
||||
. Fix a regression with valid UIDs in imap_savebody() (girgias)
|
||||
. Make warnings for invalid message numbers/UIDs between functions consistent (girgias)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #80425 (MessageFormatAdapter::getArgTypeList redefined). (Nikita)
|
||||
|
||||
- OCI8
|
||||
. Create Windows DLLs for Oracle Client 19c. (cmb)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #80404 (Incorrect range inference result when division results
|
||||
in float). (Nikita)
|
||||
. Fixed bug #80377 (Opcache misses executor_globals). (Nikita)
|
||||
. Fixed bug #80433 (Unable to disable the use of the AVX command when using
|
||||
JIT). (Nikita)
|
||||
. Fixed bug #80447 (Strange out of memory error when running with JIT).
|
||||
(Dmitry)
|
||||
. Fixed bug #80480 (Segmentation fault with JIT enabled). (Dmitry)
|
||||
. Fixed bug #80506 (Immediate SIGSEGV upon ini_set("opcache.jit_debug", 1)).
|
||||
(Dmitry)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #80368 (OpenSSL extension fails to build against LibreSSL due to
|
||||
lack of OCB support). (Nikita)
|
||||
|
||||
- PDO MySQL:
|
||||
. Fixed bug #80458 (PDOStatement::fetchAll() throws for upsert queries).
|
||||
(Kamil Tekiela)
|
||||
. Fixed bug #63185 (nextRowset() ignores MySQL errors with native prepared
|
||||
statements). (Nikita)
|
||||
. Fixed bug #78152 (PDO::exec() - Bad error handling with multiple commands).
|
||||
(Nikita)
|
||||
. Fixed bug #66878 (Multiple rowsets not returned unless PDO statement object
|
||||
is unset()). (Nikita)
|
||||
. Fixed bug #70066 (Unexpected "Cannot execute queries while other unbuffered
|
||||
queries"). (Nikita)
|
||||
. Fixed bug #71145 (Multiple statements in init command triggers unbuffered
|
||||
query error). (Nikita)
|
||||
. Fixed bug #76815 (PDOStatement cannot be GCed/closeCursor-ed when a
|
||||
PROCEDURE resultset SIGNAL). (Nikita)
|
||||
. Fixed bug #79872 (Can't execute query with pending result sets). (Nikita)
|
||||
. Fixed bug #79131 (PDO does not throw an exception when parameter values are
|
||||
missing). (Nikita)
|
||||
. Fixed bug #72368 (PdoStatement->execute() fails but does not throw an
|
||||
exception). (Nikita)
|
||||
. Fixed bug #62889 (LOAD DATA INFILE broken). (Nikita)
|
||||
. Fixed bug #67004 (Executing PDOStatement::fetch() more than once prevents
|
||||
releasing resultset). (Nikita)
|
||||
. Fixed bug #79132 (PDO re-uses parameter values from earlier calls to
|
||||
execute()). (Nikita)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #73809 (Phar Zip parse crash - mmap fail). (cmb)
|
||||
. Fixed bug #75102 (`PharData` says invalid checksum for valid tar). (cmb)
|
||||
. Fixed bug #77322 (PharData::addEmptyDir('/') Possible integer overflow).
|
||||
(cmb)
|
||||
|
||||
- Phpdbg:
|
||||
. Fixed bug #76813 (Access violation near NULL on source operand). (cmb)
|
||||
|
||||
- SPL:
|
||||
. Fixed #62004 (SplFileObject: fgets after seek returns wrong line). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #77423 (FILTER_VALIDATE_URL accepts URLs with invalid userinfo).
|
||||
(CVE-2020-7071) (cmb)
|
||||
. Fixed bug #80366 (Return Value of zend_fstat() not Checked). (sagpant, cmb)
|
||||
|
||||
- Tidy:
|
||||
. Fixed bug #77594 (ob_tidyhandler is never reset). (cmb)
|
||||
|
||||
- Tokenizer:
|
||||
. Fixed bug #80462 (Nullsafe operator tokenize with TOKEN_PARSE flag fails).
|
||||
(Nikita)
|
||||
|
||||
- XML:
|
||||
. XmlParser opaque object renamed to XMLParser for consistency with other XML objects. (girgias)
|
||||
|
||||
- Zlib:
|
||||
. Fixed #48725 (Support for flushing in zlib stream). (cmb)
|
||||
|
||||
26 Nov 2020, PHP 8.0.0
|
||||
|
||||
- BZ2:
|
||||
@@ -83,7 +308,7 @@ PHP NEWS
|
||||
. Fixed bug #80280 (ADD_EXTENSION_DEP() fails for ext/standard and ext/date).
|
||||
(cmb)
|
||||
. Fixed bug #80334 (assert() vs named parameters - confusing error). (Nikita)
|
||||
. Fixed bug #8055 (Abstract trait methods returning "self" cannot be
|
||||
. Fixed bug #80055 (Abstract trait methods returning "self" cannot be
|
||||
fulfilled by traits). (Nikita)
|
||||
. Fixed faulty generator cleanup with yield from. (Bob)
|
||||
. Implement #[Attr] Attribute syntax as per final vote in RFC
|
||||
|
||||
@@ -29,6 +29,7 @@ PHP 8.0 UPGRADE NOTES
|
||||
. Removed ability to call non-static methods statically.
|
||||
Thus `is_callable` will fail when checking for a non-static method with a
|
||||
classname (must check with an object instance).
|
||||
. Removed (real) cast.
|
||||
. Removed (unset) cast.
|
||||
. Removed track_errors ini directive. This means that $php_errormsg is no
|
||||
longer available. The error_get_last() function may be used instead.
|
||||
@@ -442,6 +443,12 @@ PHP 8.0 UPGRADE NOTES
|
||||
string $statement, ?int $fetch_mode = null, ...$fetch_mode_args)
|
||||
PDOStatement::setFetchMode(int $mode, ...$params)
|
||||
|
||||
- PDO MySQL:
|
||||
. PDO::inTransaction() now reports the actual transaction state of the
|
||||
connection, rather than an approximation maintained by PDO. If a query that
|
||||
is subject to "implicit commit" is executed, PDO::inTransaction() will
|
||||
subsequently return false, as a transaction is no longer active.
|
||||
|
||||
- PDO_ODBC:
|
||||
. The php.ini directive pdo_odbc.db2_instance_name has been removed
|
||||
|
||||
@@ -509,6 +516,8 @@ PHP 8.0 UPGRADE NOTES
|
||||
|
||||
- SPL:
|
||||
. SplFileObject::fgetss() has been removed.
|
||||
. SplFileObject::seek() now always seeks to the beginning of the line.
|
||||
Previously, positions >=1 sought to the beginning of the next line.
|
||||
. SplHeap::compare($a, $b) now specifies a method signature. Inheriting
|
||||
classes implementing this method will now have to use a compatible
|
||||
method signature.
|
||||
@@ -656,10 +665,10 @@ PHP 8.0 UPGRADE NOTES
|
||||
RFC: https://wiki.php.net/rfc/namespaced_names_as_token
|
||||
|
||||
- XML:
|
||||
. xml_parser_create(_ns) will now return an XmlParser object rather than a
|
||||
. xml_parser_create(_ns) will now return an XMLParser object rather than a
|
||||
resource. Return value checks using is_resource() should be replaced with
|
||||
checks for `false`. The xml_parser_free() function no longer has an effect,
|
||||
instead the XmlParser instance is automatically destroyed if it is no longer
|
||||
instead the XMLParser instance is automatically destroyed if it is no longer
|
||||
referenced.
|
||||
|
||||
- XMLReader:
|
||||
@@ -879,8 +888,8 @@ PHP 8.0 UPGRADE NOTES
|
||||
and this function is no longer needed to protect against XXE attacks.
|
||||
|
||||
- PGSQL / PDO PGSQL:
|
||||
. The constant PG_VERSION_STR has now the same value as PG_VERSION, and thus
|
||||
is deprecated.
|
||||
. The constant PGSQL_LIBPQ_VERSION_STR has now the same value as
|
||||
PGSQL_LIBPQ_VERSION, and thus is deprecated.
|
||||
. Function aliases in the pgsql extension have been deprecated.
|
||||
|
||||
- Zip:
|
||||
@@ -981,8 +990,8 @@ PHP 8.0 UPGRADE NOTES
|
||||
- Zip:
|
||||
. ZipArchive::setMtimeName and ZipArchive::setMtimeIndex to set the
|
||||
modification time of an entry.
|
||||
. ZipArchive::setProgressCallback to provide updates during archive close.
|
||||
. ZipArchive::setCancelCallback to allow cancellation during archive close.
|
||||
. ZipArchive::registerProgressCallback to provide updates during archive close.
|
||||
. ZipArchive::registerCancelCallback to allow cancellation during archive close.
|
||||
. ZipArchive::replaceFile to replace an entry content.
|
||||
. ZipArchive::isCompressionMethodSupported to check optional compression
|
||||
features.
|
||||
|
||||
@@ -190,12 +190,6 @@ dnl LIBZEND_OTHER_CHECKS
|
||||
dnl
|
||||
AC_DEFUN([LIBZEND_OTHER_CHECKS],[
|
||||
|
||||
AC_ARG_ENABLE([zts],
|
||||
[AS_HELP_STRING([--enable-zts],
|
||||
[Enable thread safety])],
|
||||
[ZEND_ZTS=$enableval],
|
||||
[ZEND_ZTS=no])
|
||||
|
||||
AC_MSG_CHECKING(whether to enable thread-safety)
|
||||
AC_MSG_RESULT($ZEND_ZTS)
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
Validation for "Attribute" does not use a scope when evaluating constant ASTs
|
||||
--FILE--
|
||||
<?php
|
||||
#[Attribute(parent::x)]
|
||||
class x extends y {}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot access "parent" when no class scope is active in %s on line %d
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Iterable not covariant to mixed
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
public function method1(): mixed {}
|
||||
public function method2(): array|object {}
|
||||
public function method3(iterable $x) {}
|
||||
public function method4(iterable $x) {}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
public function method1(): iterable {}
|
||||
public function method2(): iterable {}
|
||||
public function method3(mixed $x) {}
|
||||
public function method4(array|object $x) {}
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #80404: Incorrect range inference result when division results in float
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$n = 63;
|
||||
var_dump((int) ($n / 120 * 100));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(52)
|
||||
@@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
call_user_func_array() + array_slice() + named arguments
|
||||
--FILE--
|
||||
<?php
|
||||
call_user_func_array('func', array_slice(array: $a, 1, 2));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot use positional argument after named argument in %s on line %d
|
||||
@@ -22,6 +22,21 @@ function test() {
|
||||
}
|
||||
}
|
||||
|
||||
switch ($bar) {
|
||||
case 0:
|
||||
while ($xyz) {
|
||||
continue 2; // INVALID
|
||||
}
|
||||
case 1:
|
||||
while ($xyz) {
|
||||
continue;
|
||||
}
|
||||
case 2:
|
||||
while ($xyz) {
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
|
||||
while ($foo) {
|
||||
switch ($bar) {
|
||||
case 0:
|
||||
@@ -42,8 +57,10 @@ function test() {
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in %s on line 6
|
||||
Warning: "continue" targeting switch is equivalent to "break" in %s on line 6
|
||||
|
||||
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in %s on line 14
|
||||
|
||||
Warning: "continue 2" targeting switch is equivalent to "break 2". Did you mean to use "continue 3"? in %s on line 26
|
||||
Warning: "continue 2" targeting switch is equivalent to "break 2" in %s on line 25
|
||||
|
||||
Warning: "continue 2" targeting switch is equivalent to "break 2". Did you mean to use "continue 3"? in %s on line 41
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Promoting require_once warning to exception
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
|
||||
throw new Exception($errstr);
|
||||
}
|
||||
set_error_handler("exception_error_handler");
|
||||
|
||||
try {
|
||||
$results = require_once 'does-not-exist.php';
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
};
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
require_once(does-not-exist.php): Failed to open stream: No such file or directory
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Symtable cache slots may be acquired while cleaning symtable
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
// Must be larger than the symtable cache.
|
||||
static $max = 40;
|
||||
function __destruct() {
|
||||
if (self::$max-- < 0) return;
|
||||
$x = 'y';
|
||||
$$x = new a;
|
||||
}
|
||||
}
|
||||
new A;
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Union with anonymous class type
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = new class {
|
||||
public function testParam(self|string $a)
|
||||
{
|
||||
}
|
||||
public function test(): self|string
|
||||
{
|
||||
return new \stdClass;
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
$a->testParam(null);
|
||||
} catch (\Throwable $e) {
|
||||
echo $e->getMessage()."\n";
|
||||
}
|
||||
|
||||
try {
|
||||
$a->test();
|
||||
} catch (\Throwable $e) {
|
||||
echo $e->getMessage()."\n";
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
class@anonymous(): Argument #1 ($a) must be of type class@anonymous|string, null given, called in %s on line %d
|
||||
class@anonymous::test(): Return value must be of type class@anonymous|string, stdClass returned
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Infinite recursion in unlinked_instanceof()
|
||||
--FILE--
|
||||
<?php
|
||||
interface I {}
|
||||
spl_autoload_register(function() {
|
||||
class X {
|
||||
function test(): I {}
|
||||
}
|
||||
class Y extends X {
|
||||
function test(): C {}
|
||||
}
|
||||
});
|
||||
class C extends Z implements C {}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Declaration of Y::test(): C must be compatible with X::test(): I in %s on line %d
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "4.0.0-dev"
|
||||
#define ZEND_VERSION "4.0.3"
|
||||
|
||||
#define ZEND_ENGINE_3
|
||||
|
||||
|
||||
+33
-3
@@ -2455,10 +2455,40 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
|
||||
for (i = 0; i < num_args; i++) {
|
||||
if (ZEND_TYPE_HAS_CLASS(new_arg_info[i].type)) {
|
||||
ZEND_ASSERT(ZEND_TYPE_HAS_NAME(new_arg_info[i].type)
|
||||
&& "Only simple classes are currently supported");
|
||||
&& "Should be stored as simple name");
|
||||
const char *class_name = ZEND_TYPE_LITERAL_NAME(new_arg_info[i].type);
|
||||
ZEND_TYPE_SET_PTR(new_arg_info[i].type,
|
||||
zend_string_init_interned(class_name, strlen(class_name), 1));
|
||||
|
||||
size_t num_types = 1;
|
||||
const char *p = class_name;
|
||||
while ((p = strchr(p, '|'))) {
|
||||
num_types++;
|
||||
p++;
|
||||
}
|
||||
|
||||
if (num_types == 1) {
|
||||
/* Simple class type */
|
||||
ZEND_TYPE_SET_PTR(new_arg_info[i].type,
|
||||
zend_string_init_interned(class_name, strlen(class_name), 1));
|
||||
} else {
|
||||
/* Union type */
|
||||
zend_type_list *list = malloc(ZEND_TYPE_LIST_SIZE(num_types));
|
||||
list->num_types = num_types;
|
||||
ZEND_TYPE_SET_LIST(new_arg_info[i].type, list);
|
||||
|
||||
const char *start = class_name;
|
||||
uint32_t j = 0;
|
||||
while (true) {
|
||||
const char *end = strchr(start, '|');
|
||||
zend_string *str =
|
||||
zend_string_init(start, end ? end - start : strlen(start), 1);
|
||||
list->types[j] = (zend_type) ZEND_TYPE_INIT_CLASS(str, 0, 0);
|
||||
if (!end) {
|
||||
break;
|
||||
}
|
||||
start = end + 1;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,10 @@ void validate_attribute(zend_attribute *attr, uint32_t target, zend_class_entry
|
||||
if (attr->argc > 0) {
|
||||
zval flags;
|
||||
|
||||
if (FAILURE == zend_get_attribute_value(&flags, attr, 0, scope)) {
|
||||
/* As this is run in the middle of compilation, fetch the attribute value without
|
||||
* specifying a scope. The class is not fully linked yet, and we may seen an
|
||||
* inconsistent state. */
|
||||
if (FAILURE == zend_get_attribute_value(&flags, attr, 0, NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,10 +48,10 @@ function get_mangled_object_vars(object $object): array {}
|
||||
function get_class_methods(object|string $object_or_class): array {}
|
||||
|
||||
/** @param object|string $object_or_class */
|
||||
function method_exists(mixed $object_or_class, string $method): bool {}
|
||||
function method_exists($object_or_class, string $method): bool {}
|
||||
|
||||
/** @param object|string $object_or_class */
|
||||
function property_exists(mixed $object_or_class, string $property): bool {}
|
||||
function property_exists($object_or_class, string $property): bool {}
|
||||
|
||||
function class_exists(string $class, bool $autoload = true): bool {}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 9a77101b93e8584315bf43305830e129d359b033 */
|
||||
* Stub hash: b09e9199a21595a3b6f6c02db81c8e22c36c277f */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_version, 0, 0, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -84,12 +84,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_class_methods, 0, 1, IS_ARRA
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_method_exists, 0, 2, _IS_BOOL, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, object_or_class, IS_MIXED, 0)
|
||||
ZEND_ARG_INFO(0, object_or_class)
|
||||
ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_property_exists, 0, 2, _IS_BOOL, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, object_or_class, IS_MIXED, 0)
|
||||
ZEND_ARG_INFO(0, object_or_class)
|
||||
ZEND_ARG_TYPE_INFO(0, property, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
|
||||
+36
-12
@@ -422,6 +422,9 @@ void init_compiler(void) /* {{{ */
|
||||
|
||||
void shutdown_compiler(void) /* {{{ */
|
||||
{
|
||||
/* Reset filename before destroying the arena, as file cache may use arena allocated strings. */
|
||||
zend_restore_compiled_filename(NULL);
|
||||
|
||||
zend_stack_destroy(&CG(loop_var_stack));
|
||||
zend_stack_destroy(&CG(delayed_oplines_stack));
|
||||
zend_stack_destroy(&CG(short_circuiting_opnums));
|
||||
@@ -437,7 +440,6 @@ void shutdown_compiler(void) /* {{{ */
|
||||
FREE_HASHTABLE(CG(delayed_autoloads));
|
||||
CG(delayed_autoloads) = NULL;
|
||||
}
|
||||
zend_restore_compiled_filename(NULL);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1165,7 +1167,15 @@ static zend_string *resolve_class_name(zend_string *name, zend_class_entry *scop
|
||||
name = scope->parent->name;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
|
||||
/* The resolved name for anonymous classes contains null bytes. Cut off everything after the
|
||||
* null byte here, to avoid larger parts of the type being omitted by printing code later. */
|
||||
size_t len = strlen(ZSTR_VAL(name));
|
||||
if (len != ZSTR_LEN(name)) {
|
||||
ZEND_ASSERT(scope && "This should only happen with resolved types");
|
||||
return zend_string_init(ZSTR_VAL(name), len, 0);
|
||||
}
|
||||
return zend_string_copy(name);
|
||||
}
|
||||
|
||||
zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scope) {
|
||||
@@ -1177,11 +1187,13 @@ zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scop
|
||||
if (ZEND_TYPE_HAS_CE(*list_type)) {
|
||||
str = add_type_string(str, ZEND_TYPE_CE(*list_type)->name);
|
||||
} else {
|
||||
str = add_type_string(str, resolve_class_name(ZEND_TYPE_NAME(*list_type), scope));
|
||||
zend_string *resolved = resolve_class_name(ZEND_TYPE_NAME(*list_type), scope);
|
||||
str = add_type_string(str, resolved);
|
||||
zend_string_release(resolved);
|
||||
}
|
||||
} ZEND_TYPE_LIST_FOREACH_END();
|
||||
} else if (ZEND_TYPE_HAS_NAME(type)) {
|
||||
str = zend_string_copy(resolve_class_name(ZEND_TYPE_NAME(type), scope));
|
||||
str = resolve_class_name(ZEND_TYPE_NAME(type), scope);
|
||||
} else if (ZEND_TYPE_HAS_CE(type)) {
|
||||
str = zend_string_copy(ZEND_TYPE_CE(type)->name);
|
||||
}
|
||||
@@ -3866,6 +3878,7 @@ zend_result zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_stri
|
||||
zend_string *name = zend_resolve_function_name(orig_name, args->child[1]->child[0]->attr, &is_fully_qualified);
|
||||
|
||||
if (zend_string_equals_literal_ci(name, "array_slice")
|
||||
&& !zend_args_contain_unpack_or_named(list)
|
||||
&& list->children == 3
|
||||
&& list->child[1]->kind == ZEND_AST_ZVAL) {
|
||||
zval *zv = zend_ast_get_zval(list->child[1]);
|
||||
@@ -4879,15 +4892,26 @@ void zend_compile_break_continue(zend_ast *ast) /* {{{ */
|
||||
|
||||
if (CG(context).brk_cont_array[cur].is_switch) {
|
||||
if (depth == 1) {
|
||||
zend_error(E_WARNING,
|
||||
"\"continue\" targeting switch is equivalent to \"break\". " \
|
||||
"Did you mean to use \"continue " ZEND_LONG_FMT "\"?",
|
||||
depth + 1);
|
||||
if (CG(context).brk_cont_array[cur].parent == -1) {
|
||||
zend_error(E_WARNING,
|
||||
"\"continue\" targeting switch is equivalent to \"break\"");
|
||||
} else {
|
||||
zend_error(E_WARNING,
|
||||
"\"continue\" targeting switch is equivalent to \"break\". " \
|
||||
"Did you mean to use \"continue " ZEND_LONG_FMT "\"?",
|
||||
depth + 1);
|
||||
}
|
||||
} else {
|
||||
zend_error(E_WARNING,
|
||||
"\"continue " ZEND_LONG_FMT "\" targeting switch is equivalent to \"break " ZEND_LONG_FMT "\". " \
|
||||
"Did you mean to use \"continue " ZEND_LONG_FMT "\"?",
|
||||
depth, depth, depth + 1);
|
||||
if (CG(context).brk_cont_array[cur].parent == -1) {
|
||||
zend_error(E_WARNING,
|
||||
"\"continue " ZEND_LONG_FMT "\" targeting switch is equivalent to \"break " ZEND_LONG_FMT "\"",
|
||||
depth, depth);
|
||||
} else {
|
||||
zend_error(E_WARNING,
|
||||
"\"continue " ZEND_LONG_FMT "\" targeting switch is equivalent to \"break " ZEND_LONG_FMT "\". " \
|
||||
"Did you mean to use \"continue " ZEND_LONG_FMT "\"?",
|
||||
depth, depth, depth + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -531,6 +531,9 @@ struct _zend_execute_data {
|
||||
#define ZEND_CALL_DYNAMIC (1 << 25)
|
||||
#define ZEND_CALL_MAY_HAVE_UNDEF (1 << 26)
|
||||
#define ZEND_CALL_HAS_EXTRA_NAMED_PARAMS (1 << 27)
|
||||
#define ZEND_CALL_OBSERVED (1 << 28) /* "fcall_begin" observer handler may set this flag */
|
||||
/* to prevent optimization in RETURN handler and */
|
||||
/* keep all local variables for "fcall_end" handler */
|
||||
#define ZEND_CALL_SEND_ARG_BY_REF (1u << 31)
|
||||
|
||||
#define ZEND_CALL_NESTED_FUNCTION (ZEND_CALL_FUNCTION | ZEND_CALL_NESTED)
|
||||
|
||||
@@ -73,6 +73,44 @@ static void __zend_cpuid(uint32_t func, uint32_t subfunc, zend_cpu_info *cpuinfo
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
/* Function based on compiler-rt implementation. */
|
||||
static unsigned get_xcr0_eax() {
|
||||
# if defined(__GNUC__) || defined(__clang__)
|
||||
// Check xgetbv; this uses a .byte sequence instead of the instruction
|
||||
// directly because older assemblers do not include support for xgetbv and
|
||||
// there is no easy way to conditionally compile based on the assembler used.
|
||||
unsigned eax, edx;
|
||||
__asm__(".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c"(0));
|
||||
return eax;
|
||||
# elif defined(ZEND_WIN32) && defined(_XCR_XFEATURE_ENABLED_MASK)
|
||||
return _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
|
||||
# else
|
||||
return 0;
|
||||
# endif
|
||||
}
|
||||
|
||||
static zend_bool is_avx_supported() {
|
||||
if (!(cpuinfo.ecx & ZEND_CPU_FEATURE_AVX)) {
|
||||
/* No support for AVX */
|
||||
return 0;
|
||||
}
|
||||
if (!(cpuinfo.ecx & ZEND_CPU_FEATURE_OSXSAVE)) {
|
||||
/* The operating system does not support XSAVE. */
|
||||
return 0;
|
||||
}
|
||||
if ((get_xcr0_eax() & 0x6) != 0x6) {
|
||||
/* XCR0 SSE and AVX bits must be set. */
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
static zend_bool is_avx_supported() {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void zend_cpu_startup(void)
|
||||
{
|
||||
if (!cpuinfo.initialized) {
|
||||
@@ -95,10 +133,16 @@ void zend_cpu_startup(void)
|
||||
} else {
|
||||
cpuinfo.ebx = 0;
|
||||
}
|
||||
|
||||
if (!is_avx_supported()) {
|
||||
cpuinfo.edx &= ~ZEND_CPU_FEATURE_AVX;
|
||||
cpuinfo.ebx &= ~(ZEND_CPU_FEATURE_AVX2 & ~ZEND_CPU_EBX_MASK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API int zend_cpu_supports(zend_cpu_feature feature) {
|
||||
ZEND_ASSERT(cpuinfo.initialized);
|
||||
if (feature & ZEND_CPU_EDX_MASK) {
|
||||
return (cpuinfo.edx & (feature & ~ZEND_CPU_EDX_MASK));
|
||||
} else if (feature & ZEND_CPU_EBX_MASK) {
|
||||
|
||||
+28
-29
@@ -120,7 +120,7 @@ ZEND_API int zend_cpu_supports(zend_cpu_feature feature);
|
||||
* resolver functions should not depend on any external
|
||||
* functions */
|
||||
ZEND_NO_SANITIZE_ADDRESS
|
||||
static zend_always_inline int zend_cpu_supports_sse2() {
|
||||
static inline int zend_cpu_supports_sse2() {
|
||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
||||
__builtin_cpu_init();
|
||||
#endif
|
||||
@@ -128,7 +128,7 @@ static zend_always_inline int zend_cpu_supports_sse2() {
|
||||
}
|
||||
|
||||
ZEND_NO_SANITIZE_ADDRESS
|
||||
static zend_always_inline int zend_cpu_supports_sse3() {
|
||||
static inline int zend_cpu_supports_sse3() {
|
||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
||||
__builtin_cpu_init();
|
||||
#endif
|
||||
@@ -136,7 +136,7 @@ static zend_always_inline int zend_cpu_supports_sse3() {
|
||||
}
|
||||
|
||||
ZEND_NO_SANITIZE_ADDRESS
|
||||
static zend_always_inline int zend_cpu_supports_ssse3() {
|
||||
static inline int zend_cpu_supports_ssse3() {
|
||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
||||
__builtin_cpu_init();
|
||||
#endif
|
||||
@@ -144,7 +144,7 @@ static zend_always_inline int zend_cpu_supports_ssse3() {
|
||||
}
|
||||
|
||||
ZEND_NO_SANITIZE_ADDRESS
|
||||
static zend_always_inline int zend_cpu_supports_sse41() {
|
||||
static inline int zend_cpu_supports_sse41() {
|
||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
||||
__builtin_cpu_init();
|
||||
#endif
|
||||
@@ -152,26 +152,15 @@ static zend_always_inline int zend_cpu_supports_sse41() {
|
||||
}
|
||||
|
||||
ZEND_NO_SANITIZE_ADDRESS
|
||||
static zend_always_inline int zend_cpu_supports_sse42() {
|
||||
static inline int zend_cpu_supports_sse42() {
|
||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
||||
__builtin_cpu_init();
|
||||
#endif
|
||||
return __builtin_cpu_supports("sse4.2");
|
||||
}
|
||||
|
||||
/* __builtin_cpu_supports has pclmul from gcc9 */
|
||||
#if (!defined(__GNUC__) || (ZEND_GCC_VERSION >= 9000))
|
||||
ZEND_NO_SANITIZE_ADDRESS
|
||||
static zend_always_inline int zend_cpu_supports_pclmul() {
|
||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
||||
__builtin_cpu_init();
|
||||
#endif
|
||||
return __builtin_cpu_supports("pclmul");
|
||||
}
|
||||
#endif
|
||||
|
||||
ZEND_NO_SANITIZE_ADDRESS
|
||||
static zend_always_inline int zend_cpu_supports_avx() {
|
||||
static inline int zend_cpu_supports_avx() {
|
||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
||||
__builtin_cpu_init();
|
||||
#endif
|
||||
@@ -179,7 +168,7 @@ static zend_always_inline int zend_cpu_supports_avx() {
|
||||
}
|
||||
|
||||
ZEND_NO_SANITIZE_ADDRESS
|
||||
static zend_always_inline int zend_cpu_supports_avx2() {
|
||||
static inline int zend_cpu_supports_avx2() {
|
||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
||||
__builtin_cpu_init();
|
||||
#endif
|
||||
@@ -187,38 +176,48 @@ static zend_always_inline int zend_cpu_supports_avx2() {
|
||||
}
|
||||
#else
|
||||
|
||||
static zend_always_inline int zend_cpu_supports_sse2() {
|
||||
static inline int zend_cpu_supports_sse2() {
|
||||
return zend_cpu_supports(ZEND_CPU_FEATURE_SSE2);
|
||||
}
|
||||
|
||||
static zend_always_inline int zend_cpu_supports_sse3() {
|
||||
static inline int zend_cpu_supports_sse3() {
|
||||
return zend_cpu_supports(ZEND_CPU_FEATURE_SSE3);
|
||||
}
|
||||
|
||||
static zend_always_inline int zend_cpu_supports_ssse3() {
|
||||
static inline int zend_cpu_supports_ssse3() {
|
||||
return zend_cpu_supports(ZEND_CPU_FEATURE_SSSE3);
|
||||
}
|
||||
|
||||
static zend_always_inline int zend_cpu_supports_sse41() {
|
||||
static inline int zend_cpu_supports_sse41() {
|
||||
return zend_cpu_supports(ZEND_CPU_FEATURE_SSE41);
|
||||
}
|
||||
|
||||
static zend_always_inline int zend_cpu_supports_sse42() {
|
||||
static inline int zend_cpu_supports_sse42() {
|
||||
return zend_cpu_supports(ZEND_CPU_FEATURE_SSE42);
|
||||
}
|
||||
|
||||
static zend_always_inline int zend_cpu_supports_pclmul() {
|
||||
return zend_cpu_supports(ZEND_CPU_FEATURE_PCLMULQDQ);
|
||||
}
|
||||
|
||||
static zend_always_inline int zend_cpu_supports_avx() {
|
||||
static inline int zend_cpu_supports_avx() {
|
||||
return zend_cpu_supports(ZEND_CPU_FEATURE_AVX);
|
||||
}
|
||||
|
||||
static zend_always_inline int zend_cpu_supports_avx2() {
|
||||
static inline int zend_cpu_supports_avx2() {
|
||||
return zend_cpu_supports(ZEND_CPU_FEATURE_AVX2);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* __builtin_cpu_supports has pclmul from gcc9 */
|
||||
#if PHP_HAVE_BUILTIN_CPU_SUPPORTS && (!defined(__GNUC__) || (ZEND_GCC_VERSION >= 9000))
|
||||
ZEND_NO_SANITIZE_ADDRESS
|
||||
static inline int zend_cpu_supports_pclmul() {
|
||||
#if PHP_HAVE_BUILTIN_CPU_INIT
|
||||
__builtin_cpu_init();
|
||||
#endif
|
||||
return __builtin_cpu_supports("pclmul");
|
||||
}
|
||||
#else
|
||||
static inline int zend_cpu_supports_pclmul() {
|
||||
return zend_cpu_supports(ZEND_CPU_FEATURE_PCLMULQDQ);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -123,3 +123,7 @@ class ArithmeticError extends Error
|
||||
class DivisionByZeroError extends ArithmeticError
|
||||
{
|
||||
}
|
||||
|
||||
class UnhandledMatchError extends Error
|
||||
{
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 3699b51b31e509c11435845c7e0d35a2608dd268 */
|
||||
* Stub hash: 2fa61163fb7db8d87b14f9cf9a42c3cd8093f2a6 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Throwable_getMessage, 0, 0, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -180,3 +180,8 @@ static const zend_function_entry class_ArithmeticError_methods[] = {
|
||||
static const zend_function_entry class_DivisionByZeroError_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_UnhandledMatchError_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
+47
-21
@@ -763,6 +763,17 @@ static zend_bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg
|
||||
}
|
||||
|
||||
#if ZEND_DEBUG
|
||||
static bool can_convert_to_string(zval *zv) {
|
||||
/* We don't call cast_object here, because this check must be side-effect free. As this
|
||||
* is only used for a sanity check of arginfo/zpp consistency, it's okay if we accept
|
||||
* more than actually allowed here. */
|
||||
if (Z_TYPE_P(zv) == IS_OBJECT) {
|
||||
return Z_OBJ_HT_P(zv)->cast_object != zend_std_cast_object_tostring
|
||||
|| Z_OBJCE_P(zv)->__tostring;
|
||||
}
|
||||
return Z_TYPE_P(zv) <= IS_STRING;
|
||||
}
|
||||
|
||||
/* Used to sanity-check internal arginfo types without performing any actual type conversions. */
|
||||
static zend_bool zend_verify_weak_scalar_type_hint_no_sideeffect(uint32_t type_mask, zval *arg)
|
||||
{
|
||||
@@ -776,10 +787,7 @@ static zend_bool zend_verify_weak_scalar_type_hint_no_sideeffect(uint32_t type_m
|
||||
if ((type_mask & MAY_BE_DOUBLE) && zend_parse_arg_double_weak(arg, &dval)) {
|
||||
return 1;
|
||||
}
|
||||
/* We don't call cast_object here, because this check must be side-effect free. As this
|
||||
* is only used for a sanity check of arginfo/zpp consistency, it's okay if we accept
|
||||
* more than actually allowed here. */
|
||||
if ((type_mask & MAY_BE_STRING) && (Z_TYPE_P(arg) < IS_STRING || Z_TYPE_P(arg) == IS_OBJECT)) {
|
||||
if ((type_mask & MAY_BE_STRING) && can_convert_to_string(arg)) {
|
||||
return 1;
|
||||
}
|
||||
if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL && zend_parse_arg_bool_weak(arg, &bval)) {
|
||||
@@ -943,6 +951,13 @@ ZEND_API zend_bool zend_value_instanceof_static(zval *zv) {
|
||||
return instanceof_function(Z_OBJCE_P(zv), called_scope);
|
||||
}
|
||||
|
||||
/* The cache_slot may only be NULL in debug builds, where arginfo verification of
|
||||
* internal functions is enabled. Avoid unnecessary checks in release builds. */
|
||||
#if ZEND_DEBUG
|
||||
# define HAVE_CACHE_SLOT (cache_slot != NULL)
|
||||
#else
|
||||
# define HAVE_CACHE_SLOT 1
|
||||
#endif
|
||||
|
||||
static zend_always_inline zend_bool zend_check_type_slow(
|
||||
zend_type type, zval *arg, zend_reference *ref, void **cache_slot, zend_class_entry *scope,
|
||||
@@ -954,31 +969,39 @@ static zend_always_inline zend_bool zend_check_type_slow(
|
||||
if (ZEND_TYPE_HAS_LIST(type)) {
|
||||
zend_type *list_type;
|
||||
ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(type), list_type) {
|
||||
if (*cache_slot) {
|
||||
if (HAVE_CACHE_SLOT && *cache_slot) {
|
||||
ce = *cache_slot;
|
||||
} else {
|
||||
ce = zend_fetch_class(ZEND_TYPE_NAME(*list_type),
|
||||
(ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
|
||||
if (!ce) {
|
||||
cache_slot++;
|
||||
if (HAVE_CACHE_SLOT) {
|
||||
cache_slot++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
*cache_slot = ce;
|
||||
if (HAVE_CACHE_SLOT) {
|
||||
*cache_slot = ce;
|
||||
}
|
||||
}
|
||||
if (instanceof_function(Z_OBJCE_P(arg), ce)) {
|
||||
return 1;
|
||||
}
|
||||
cache_slot++;
|
||||
if (HAVE_CACHE_SLOT) {
|
||||
cache_slot++;
|
||||
}
|
||||
} ZEND_TYPE_LIST_FOREACH_END();
|
||||
} else {
|
||||
if (EXPECTED(*cache_slot)) {
|
||||
if (EXPECTED(HAVE_CACHE_SLOT && *cache_slot)) {
|
||||
ce = (zend_class_entry *) *cache_slot;
|
||||
} else {
|
||||
ce = zend_fetch_class(ZEND_TYPE_NAME(type), (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
|
||||
if (UNEXPECTED(!ce)) {
|
||||
goto builtin_types;
|
||||
}
|
||||
*cache_slot = (void *) ce;
|
||||
if (HAVE_CACHE_SLOT) {
|
||||
*cache_slot = (void *) ce;
|
||||
}
|
||||
}
|
||||
if (instanceof_function(Z_OBJCE_P(arg), ce)) {
|
||||
return 1;
|
||||
@@ -1071,8 +1094,6 @@ static zend_never_inline ZEND_ATTRIBUTE_UNUSED bool zend_verify_internal_arg_typ
|
||||
|
||||
for (i = 0; i < num_args; ++i) {
|
||||
zend_arg_info *cur_arg_info;
|
||||
void *dummy_cache_slot = NULL;
|
||||
|
||||
if (EXPECTED(i < fbc->common.num_args)) {
|
||||
cur_arg_info = &fbc->common.arg_info[i];
|
||||
} else if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_VARIADIC)) {
|
||||
@@ -1082,7 +1103,7 @@ static zend_never_inline ZEND_ATTRIBUTE_UNUSED bool zend_verify_internal_arg_typ
|
||||
}
|
||||
|
||||
if (ZEND_TYPE_IS_SET(cur_arg_info->type)
|
||||
&& UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, &dummy_cache_slot, fbc->common.scope, 0, /* is_internal */ 1))) {
|
||||
&& UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, /* cache_slot */ NULL, fbc->common.scope, 0, /* is_internal */ 1))) {
|
||||
return 0;
|
||||
}
|
||||
arg++;
|
||||
@@ -1123,7 +1144,7 @@ static zend_always_inline zend_bool zend_internal_call_should_throw(zend_functio
|
||||
|
||||
static ZEND_COLD void zend_internal_call_arginfo_violation(zend_function *fbc)
|
||||
{
|
||||
zend_error(E_CORE_ERROR, "Arginfo / zpp mismatch during call of %s%s%s()",
|
||||
zend_error(E_ERROR, "Arginfo / zpp mismatch during call of %s%s%s()",
|
||||
fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "",
|
||||
fbc->common.scope ? "::" : "",
|
||||
ZSTR_VAL(fbc->common.function_name));
|
||||
@@ -1207,8 +1228,6 @@ static ZEND_COLD void zend_verify_void_return_error(const zend_function *zf, con
|
||||
static bool zend_verify_internal_return_type(zend_function *zf, zval *ret)
|
||||
{
|
||||
zend_internal_arg_info *ret_info = zf->internal_function.arg_info - 1;
|
||||
void *dummy_cache_slot = NULL;
|
||||
|
||||
if (ZEND_TYPE_FULL_MASK(ret_info->type) & MAY_BE_VOID) {
|
||||
if (UNEXPECTED(Z_TYPE_P(ret) != IS_NULL)) {
|
||||
zend_verify_void_return_error(zf, zend_zval_type_name(ret), "");
|
||||
@@ -1217,7 +1236,7 @@ static bool zend_verify_internal_return_type(zend_function *zf, zval *ret)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (UNEXPECTED(!zend_check_type(ret_info->type, ret, &dummy_cache_slot, NULL, 1, /* is_internal */ 1))) {
|
||||
if (UNEXPECTED(!zend_check_type(ret_info->type, ret, /* cache_slot */ NULL, NULL, 1, /* is_internal */ 1))) {
|
||||
zend_verify_internal_return_error(zf, ret);
|
||||
return 0;
|
||||
}
|
||||
@@ -3262,6 +3281,7 @@ ZEND_API void ZEND_FASTCALL zend_ref_del_type_source(zend_property_info_source_l
|
||||
zend_property_info_list *list = ZEND_PROPERTY_INFO_SOURCE_TO_LIST(source_list->list);
|
||||
zend_property_info **ptr, **end;
|
||||
|
||||
ZEND_ASSERT(prop);
|
||||
if (!ZEND_PROPERTY_INFO_SOURCE_IS_LIST(source_list->list)) {
|
||||
ZEND_ASSERT(source_list->ptr == prop);
|
||||
source_list->ptr = NULL;
|
||||
@@ -3376,12 +3396,13 @@ ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_val
|
||||
|
||||
ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table) /* {{{ */
|
||||
{
|
||||
/* Clean before putting into the cache, since clean could call dtors,
|
||||
* which could use the cached hash. Also do this before the check for
|
||||
* available cache slots, as those may be used by a dtor as well. */
|
||||
zend_symtable_clean(symbol_table);
|
||||
if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) {
|
||||
zend_array_destroy(symbol_table);
|
||||
} else {
|
||||
/* clean before putting into the cache, since clean
|
||||
could call dtors, which could use cached hash */
|
||||
zend_symtable_clean(symbol_table);
|
||||
*(EG(symtable_cache_ptr)++) = symbol_table;
|
||||
}
|
||||
}
|
||||
@@ -4204,7 +4225,7 @@ static zend_never_inline zend_op_array* ZEND_FASTCALL zend_include_or_eval(zval
|
||||
already_compiled:
|
||||
new_op_array = ZEND_FAKE_OP_ARRAY;
|
||||
}
|
||||
} else {
|
||||
} else if (!EG(exception)) {
|
||||
zend_message_dispatcher(
|
||||
(type == ZEND_INCLUDE_ONCE) ?
|
||||
ZMSG_FAILED_INCLUDE_FOPEN : ZMSG_FAILED_REQUIRE_FOPEN,
|
||||
@@ -4757,6 +4778,11 @@ static zend_always_inline zend_execute_data *_zend_vm_stack_push_call_frame(uint
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifdef ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE
|
||||
/* This callback disables optimization of "vm_stack_data" variable in VM */
|
||||
void (*zend_touch_vm_stack_data)(void *vm_stack_data) = NULL;
|
||||
#endif
|
||||
|
||||
#include "zend_vm_execute.h"
|
||||
|
||||
ZEND_API zend_result zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler)
|
||||
|
||||
@@ -1382,7 +1382,7 @@ static void zend_set_timeout_ex(zend_long seconds, bool reset_signals) /* {{{ */
|
||||
t_r.it_value.tv_sec = seconds;
|
||||
t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0;
|
||||
|
||||
# ifdef __CYGWIN__
|
||||
# if defined(__CYGWIN__) || defined(__PASE__)
|
||||
setitimer(ITIMER_REAL, &t_r, NULL);
|
||||
}
|
||||
signo = SIGALRM;
|
||||
@@ -1444,7 +1444,7 @@ void zend_unset_timeout(void) /* {{{ */
|
||||
|
||||
no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0;
|
||||
|
||||
# ifdef __CYGWIN__
|
||||
# if defined(__CYGWIN__) || defined(__PASE__)
|
||||
setitimer(ITIMER_REAL, &no_timeout, NULL);
|
||||
# else
|
||||
setitimer(ITIMER_PROF, &no_timeout, NULL);
|
||||
|
||||
+2
-2
@@ -55,8 +55,6 @@ void gc_reset(void);
|
||||
size_t zend_gc_globals_size(void);
|
||||
#endif
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#define GC_REMOVE_FROM_BUFFER(p) do { \
|
||||
zend_refcounted *_p = (zend_refcounted*)(p); \
|
||||
if (GC_TYPE_INFO(_p) & GC_INFO_MASK) { \
|
||||
@@ -122,4 +120,6 @@ static zend_always_inline void zend_get_gc_buffer_use(
|
||||
*n = gc_buffer->cur - gc_buffer->start;
|
||||
}
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif /* ZEND_GC_H */
|
||||
@@ -20,3 +20,7 @@ final class Generator implements Iterator
|
||||
|
||||
public function getReturn(): mixed {}
|
||||
}
|
||||
|
||||
class ClosedGeneratorException extends Exception
|
||||
{
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 18d2bb68729ff622a5c0c124a8822f7ee882c2ec */
|
||||
* Stub hash: 50044c6c8d2a162a988906c0b752a5fe28adb933 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Generator_rewind, 0, 0, IS_VOID, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -46,3 +46,8 @@ static const zend_function_entry class_Generator_methods[] = {
|
||||
ZEND_ME(Generator, getReturn, arginfo_class_Generator_getReturn, ZEND_ACC_PUBLIC)
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_ClosedGeneratorException_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
@@ -311,7 +311,8 @@ static zend_bool unlinked_instanceof(zend_class_entry *ce1, zend_class_entry *ce
|
||||
zend_class_entry *ce = zend_lookup_class_ex(
|
||||
ce1->interface_names[i].name, ce1->interface_names[i].lc_name,
|
||||
ZEND_FETCH_CLASS_ALLOW_UNLINKED | ZEND_FETCH_CLASS_NO_AUTOLOAD);
|
||||
if (ce && unlinked_instanceof(ce, ce2)) {
|
||||
/* Avoid recursing if class implements ifself. */
|
||||
if (ce && ce != ce1 && unlinked_instanceof(ce, ce2)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -323,6 +324,10 @@ static zend_bool unlinked_instanceof(zend_class_entry *ce1, zend_class_entry *ce
|
||||
|
||||
static zend_bool zend_type_contains_traversable(zend_type type) {
|
||||
zend_type *single_type;
|
||||
if (ZEND_TYPE_FULL_MASK(type) & MAY_BE_OBJECT) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
ZEND_TYPE_FOREACH(type, single_type) {
|
||||
if (ZEND_TYPE_HAS_NAME(*single_type)
|
||||
&& zend_string_equals_literal_ci(ZEND_TYPE_NAME(*single_type), "Traversable")) {
|
||||
|
||||
@@ -48,7 +48,7 @@ interface ArrayAccess
|
||||
|
||||
interface Serializable
|
||||
{
|
||||
/** @return string */
|
||||
/** @return string|null */
|
||||
public function serialize();
|
||||
|
||||
/** @return void */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 29a5ed0b859b0732074c81cf9d26047a6eb9059a */
|
||||
* Stub hash: c6ef101bd3881348a74b60cecd22d1d7f80017c8 */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IteratorAggregate_getIterator, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
@@ -177,7 +177,7 @@ static void yy_pop_state(void)
|
||||
zend_stack_del_top(&SCNG(state_stack));
|
||||
}
|
||||
|
||||
static void yy_scan_buffer(char *str, unsigned int len)
|
||||
static void yy_scan_buffer(char *str, size_t len)
|
||||
{
|
||||
YYCURSOR = (YYCTYPE*)str;
|
||||
YYLIMIT = YYCURSOR + len;
|
||||
@@ -571,7 +571,7 @@ ZEND_API zend_result open_file_for_scanning(zend_file_handle *file_handle)
|
||||
}
|
||||
}
|
||||
SCNG(yy_start) = (unsigned char *)buf;
|
||||
yy_scan_buffer(buf, (unsigned int)size);
|
||||
yy_scan_buffer(buf, size);
|
||||
} else {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "zend_stream_mmap() failed");
|
||||
}
|
||||
@@ -772,7 +772,7 @@ ZEND_API void zend_prepare_string_for_scanning(zval *str, const char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
yy_scan_buffer(buf, (unsigned int)size);
|
||||
yy_scan_buffer(buf, size);
|
||||
|
||||
new_compiled_filename = zend_string_init(filename, strlen(filename), 0);
|
||||
zend_set_compiled_filename(new_compiled_filename);
|
||||
@@ -1564,7 +1564,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
|
||||
<ST_IN_SCRIPTING>"?->" {
|
||||
yy_push_state(ST_LOOKING_FOR_PROPERTY);
|
||||
return T_NULLSAFE_OBJECT_OPERATOR;
|
||||
RETURN_TOKEN(T_NULLSAFE_OBJECT_OPERATOR);
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING,ST_LOOKING_FOR_PROPERTY>{WHITESPACE}+ {
|
||||
|
||||
@@ -1608,6 +1608,11 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_objects_not_comparable(zval *o1, zval *o2)
|
||||
{
|
||||
return ZEND_UNCOMPARABLE;
|
||||
}
|
||||
|
||||
ZEND_API int zend_std_has_property(zend_object *zobj, zend_string *name, int has_set_exists, void **cache_slot) /* {{{ */
|
||||
{
|
||||
int result;
|
||||
|
||||
@@ -213,6 +213,10 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2);
|
||||
ZEND_API int zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only);
|
||||
ZEND_API void rebuild_object_properties(zend_object *zobj);
|
||||
|
||||
/* Handler for objects that cannot be meaningfully compared.
|
||||
* Only objects with the same identity will be considered equal. */
|
||||
ZEND_API int zend_objects_not_comparable(zval *o1, zval *o2);
|
||||
|
||||
ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope);
|
||||
|
||||
ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name, zend_bool is_dynamic);
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#define ZEND_OBSERVER_NOT_OBSERVED ((void *) 2)
|
||||
|
||||
#define ZEND_OBSERVABLE_FN(fn_flags) \
|
||||
(!(fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE | ZEND_ACC_FAKE_CLOSURE)))
|
||||
(!(fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE))
|
||||
|
||||
typedef struct _zend_observer_fcall_data {
|
||||
// points after the last handler
|
||||
@@ -220,7 +220,11 @@ ZEND_API void ZEND_FASTCALL zend_observer_fcall_end(
|
||||
first_observed_frame = NULL;
|
||||
current_observed_frame = NULL;
|
||||
} else {
|
||||
current_observed_frame = execute_data->prev_execute_data;
|
||||
zend_execute_data *ex = execute_data->prev_execute_data;
|
||||
while (ex && !ex->func) {
|
||||
ex = ex->prev_execute_data;
|
||||
}
|
||||
current_observed_frame = ex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +232,7 @@ ZEND_API void zend_observer_fcall_end_all(void)
|
||||
{
|
||||
zend_execute_data *ex = current_observed_frame;
|
||||
while (ex != NULL) {
|
||||
if (ex->func->type != ZEND_INTERNAL_FUNCTION) {
|
||||
if (ex->func && ex->func->type != ZEND_INTERNAL_FUNCTION) {
|
||||
zend_observer_fcall_end(ex, NULL);
|
||||
}
|
||||
ex = ex->prev_execute_data;
|
||||
|
||||
+2
-1
@@ -62,7 +62,8 @@ ZEND_API zend_signal_globals_t zend_signal_globals;
|
||||
static void zend_signal_handler(int signo, siginfo_t *siginfo, void *context);
|
||||
static int zend_signal_register(int signo, void (*handler)(int, siginfo_t*, void*));
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#if defined(__CYGWIN__) || defined(__PASE__)
|
||||
/* Matches zend_excute_API.c; these platforms don't support ITIMER_PROF. */
|
||||
#define TIMEOUT_SIG SIGALRM
|
||||
#else
|
||||
#define TIMEOUT_SIG SIGPROF
|
||||
|
||||
@@ -195,6 +195,19 @@ static zend_always_inline zend_string *zend_string_dup(zend_string *s, bool pers
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline zend_string *zend_string_separate(zend_string *s, bool persistent)
|
||||
{
|
||||
if (ZSTR_IS_INTERNED(s) || GC_REFCOUNT(s) > 1) {
|
||||
if (!ZSTR_IS_INTERNED(s)) {
|
||||
GC_DELREF(s);
|
||||
}
|
||||
return zend_string_init(ZSTR_VAL(s), ZSTR_LEN(s), persistent);
|
||||
}
|
||||
|
||||
zend_string_forget_hash_val(s);
|
||||
return s;
|
||||
}
|
||||
|
||||
static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_t len, bool persistent)
|
||||
{
|
||||
zend_string *ret;
|
||||
|
||||
+1
-1
@@ -150,7 +150,7 @@ typedef struct {
|
||||
/* Type mask excluding the flags above. */
|
||||
#define _ZEND_TYPE_MAY_BE_MASK ((1u << 20) - 1)
|
||||
/* Must have same value as MAY_BE_NULL */
|
||||
#define _ZEND_TYPE_NULLABLE_BIT 0x2
|
||||
#define _ZEND_TYPE_NULLABLE_BIT 0x2u
|
||||
|
||||
#define ZEND_TYPE_IS_SET(t) \
|
||||
(((t).type_mask & _ZEND_TYPE_MASK) != 0)
|
||||
|
||||
+2
-2
@@ -4185,7 +4185,7 @@ ZEND_VM_COLD_CONST_HANDLER(124, ZEND_VERIFY_RETURN_TYPE, CONST|TMP|VAR|UNUSED|CV
|
||||
retval_ref = retval_ptr = EX_VAR(opline->result.var);
|
||||
} else if (OP1_TYPE == IS_VAR) {
|
||||
if (UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_INDIRECT)) {
|
||||
retval_ptr = Z_INDIRECT_P(retval_ptr);
|
||||
retval_ref = retval_ptr = Z_INDIRECT_P(retval_ptr);
|
||||
}
|
||||
ZVAL_DEREF(retval_ptr);
|
||||
} else if (OP1_TYPE == IS_CV) {
|
||||
@@ -4269,7 +4269,7 @@ ZEND_VM_INLINE_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY, SPEC(OBSERVER))
|
||||
do {
|
||||
if (Z_OPT_REFCOUNTED_P(retval_ptr)) {
|
||||
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & (ZEND_CALL_CODE|ZEND_CALL_OBSERVED)))) {
|
||||
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
|
||||
ZVAL_COPY_VALUE(return_value, retval_ptr);
|
||||
if (GC_MAY_LEAK(ref)) {
|
||||
|
||||
+41
-22
@@ -4047,7 +4047,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_
|
||||
do {
|
||||
if (Z_OPT_REFCOUNTED_P(retval_ptr)) {
|
||||
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & (ZEND_CALL_CODE|ZEND_CALL_OBSERVED)))) {
|
||||
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
|
||||
ZVAL_COPY_VALUE(return_value, retval_ptr);
|
||||
if (GC_MAY_LEAK(ref)) {
|
||||
@@ -4124,7 +4124,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_OBSER
|
||||
do {
|
||||
if (Z_OPT_REFCOUNTED_P(retval_ptr)) {
|
||||
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & (ZEND_CALL_CODE|ZEND_CALL_OBSERVED)))) {
|
||||
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
|
||||
ZVAL_COPY_VALUE(return_value, retval_ptr);
|
||||
if (GC_MAY_LEAK(ref)) {
|
||||
@@ -9723,7 +9723,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYP
|
||||
retval_ref = retval_ptr = EX_VAR(opline->result.var);
|
||||
} else if (IS_CONST == IS_VAR) {
|
||||
if (UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_INDIRECT)) {
|
||||
retval_ptr = Z_INDIRECT_P(retval_ptr);
|
||||
retval_ref = retval_ptr = Z_INDIRECT_P(retval_ptr);
|
||||
}
|
||||
ZVAL_DEREF(retval_ptr);
|
||||
} else if (IS_CONST == IS_CV) {
|
||||
@@ -18568,7 +18568,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HA
|
||||
do {
|
||||
if (Z_OPT_REFCOUNTED_P(retval_ptr)) {
|
||||
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & (ZEND_CALL_CODE|ZEND_CALL_OBSERVED)))) {
|
||||
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
|
||||
ZVAL_COPY_VALUE(return_value, retval_ptr);
|
||||
if (GC_MAY_LEAK(ref)) {
|
||||
@@ -20077,7 +20077,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_TMP_UN
|
||||
retval_ref = retval_ptr = EX_VAR(opline->result.var);
|
||||
} else if (IS_TMP_VAR == IS_VAR) {
|
||||
if (UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_INDIRECT)) {
|
||||
retval_ptr = Z_INDIRECT_P(retval_ptr);
|
||||
retval_ref = retval_ptr = Z_INDIRECT_P(retval_ptr);
|
||||
}
|
||||
ZVAL_DEREF(retval_ptr);
|
||||
} else if (IS_TMP_VAR == IS_CV) {
|
||||
@@ -21140,7 +21140,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HA
|
||||
do {
|
||||
if (Z_OPT_REFCOUNTED_P(retval_ptr)) {
|
||||
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & (ZEND_CALL_CODE|ZEND_CALL_OBSERVED)))) {
|
||||
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
|
||||
ZVAL_COPY_VALUE(return_value, retval_ptr);
|
||||
if (GC_MAY_LEAK(ref)) {
|
||||
@@ -27692,7 +27692,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_VAR_UN
|
||||
retval_ref = retval_ptr = EX_VAR(opline->result.var);
|
||||
} else if (IS_VAR == IS_VAR) {
|
||||
if (UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_INDIRECT)) {
|
||||
retval_ptr = Z_INDIRECT_P(retval_ptr);
|
||||
retval_ref = retval_ptr = Z_INDIRECT_P(retval_ptr);
|
||||
}
|
||||
ZVAL_DEREF(retval_ptr);
|
||||
} else if (IS_VAR == IS_CV) {
|
||||
@@ -34892,7 +34892,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_UNUSED
|
||||
retval_ref = retval_ptr = EX_VAR(opline->result.var);
|
||||
} else if (IS_UNUSED == IS_VAR) {
|
||||
if (UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_INDIRECT)) {
|
||||
retval_ptr = Z_INDIRECT_P(retval_ptr);
|
||||
retval_ref = retval_ptr = Z_INDIRECT_P(retval_ptr);
|
||||
}
|
||||
ZVAL_DEREF(retval_ptr);
|
||||
} else if (IS_UNUSED == IS_CV) {
|
||||
@@ -37678,7 +37678,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HAN
|
||||
do {
|
||||
if (Z_OPT_REFCOUNTED_P(retval_ptr)) {
|
||||
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & (ZEND_CALL_CODE|ZEND_CALL_OBSERVED)))) {
|
||||
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
|
||||
ZVAL_COPY_VALUE(return_value, retval_ptr);
|
||||
if (GC_MAY_LEAK(ref)) {
|
||||
@@ -46594,7 +46594,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_CV_UNU
|
||||
retval_ref = retval_ptr = EX_VAR(opline->result.var);
|
||||
} else if (IS_CV == IS_VAR) {
|
||||
if (UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_INDIRECT)) {
|
||||
retval_ptr = Z_INDIRECT_P(retval_ptr);
|
||||
retval_ref = retval_ptr = Z_INDIRECT_P(retval_ptr);
|
||||
}
|
||||
ZVAL_DEREF(retval_ptr);
|
||||
} else if (IS_CV == IS_CV) {
|
||||
@@ -50826,15 +50826,34 @@ ZEND_API void execute_ex(zend_execute_data *ex)
|
||||
{
|
||||
DCL_OPLINE
|
||||
|
||||
#if defined(ZEND_VM_IP_GLOBAL_REG) || defined(ZEND_VM_IP_GLOBAL_REG)
|
||||
struct {
|
||||
#ifdef ZEND_VM_IP_GLOBAL_REG
|
||||
const zend_op *orig_opline = opline;
|
||||
const zend_op *orig_opline;
|
||||
#endif
|
||||
#ifdef ZEND_VM_FP_GLOBAL_REG
|
||||
zend_execute_data *orig_execute_data = execute_data;
|
||||
zend_execute_data *orig_execute_data;
|
||||
#ifdef ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE
|
||||
char hybrid_jit_red_zone[ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE];
|
||||
#endif
|
||||
#endif
|
||||
} vm_stack_data;
|
||||
#endif
|
||||
#ifdef ZEND_VM_IP_GLOBAL_REG
|
||||
vm_stack_data.orig_opline = opline;
|
||||
#endif
|
||||
#ifdef ZEND_VM_FP_GLOBAL_REG
|
||||
vm_stack_data.orig_execute_data = execute_data;
|
||||
execute_data = ex;
|
||||
#else
|
||||
zend_execute_data *execute_data = ex;
|
||||
#endif
|
||||
#ifdef ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE
|
||||
memset(vm_stack_data.hybrid_jit_red_zone, 0, ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE);
|
||||
if (zend_touch_vm_stack_data) {
|
||||
zend_touch_vm_stack_data(&vm_stack_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)
|
||||
if (UNEXPECTED(execute_data == NULL)) {
|
||||
@@ -54751,7 +54770,7 @@ zend_leave_helper_SPEC_LABEL:
|
||||
do {
|
||||
if (Z_OPT_REFCOUNTED_P(retval_ptr)) {
|
||||
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & (ZEND_CALL_CODE|ZEND_CALL_OBSERVED)))) {
|
||||
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
|
||||
ZVAL_COPY_VALUE(return_value, retval_ptr);
|
||||
if (GC_MAY_LEAK(ref)) {
|
||||
@@ -54829,7 +54848,7 @@ zend_leave_helper_SPEC_LABEL:
|
||||
do {
|
||||
if (Z_OPT_REFCOUNTED_P(retval_ptr)) {
|
||||
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & (ZEND_CALL_CODE|ZEND_CALL_OBSERVED)))) {
|
||||
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
|
||||
ZVAL_COPY_VALUE(return_value, retval_ptr);
|
||||
if (GC_MAY_LEAK(ref)) {
|
||||
@@ -56366,7 +56385,7 @@ zend_leave_helper_SPEC_LABEL:
|
||||
do {
|
||||
if (Z_OPT_REFCOUNTED_P(retval_ptr)) {
|
||||
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & (ZEND_CALL_CODE|ZEND_CALL_OBSERVED)))) {
|
||||
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
|
||||
ZVAL_COPY_VALUE(return_value, retval_ptr);
|
||||
if (GC_MAY_LEAK(ref)) {
|
||||
@@ -56667,7 +56686,7 @@ zend_leave_helper_SPEC_LABEL:
|
||||
do {
|
||||
if (Z_OPT_REFCOUNTED_P(retval_ptr)) {
|
||||
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & (ZEND_CALL_CODE|ZEND_CALL_OBSERVED)))) {
|
||||
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
|
||||
ZVAL_COPY_VALUE(return_value, retval_ptr);
|
||||
if (GC_MAY_LEAK(ref)) {
|
||||
@@ -57784,7 +57803,7 @@ zend_leave_helper_SPEC_LABEL:
|
||||
do {
|
||||
if (Z_OPT_REFCOUNTED_P(retval_ptr)) {
|
||||
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
|
||||
if (EXPECTED(!(EX_CALL_INFO() & (ZEND_CALL_CODE|ZEND_CALL_OBSERVED)))) {
|
||||
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
|
||||
ZVAL_COPY_VALUE(return_value, retval_ptr);
|
||||
if (GC_MAY_LEAK(ref)) {
|
||||
@@ -58788,10 +58807,10 @@ zend_leave_helper_SPEC_LABEL:
|
||||
HYBRID_BREAK();
|
||||
HYBRID_CASE(HYBRID_HALT):
|
||||
#ifdef ZEND_VM_FP_GLOBAL_REG
|
||||
execute_data = orig_execute_data;
|
||||
execute_data = vm_stack_data.orig_execute_data;
|
||||
#endif
|
||||
#ifdef ZEND_VM_IP_GLOBAL_REG
|
||||
opline = orig_opline;
|
||||
opline = vm_stack_data.orig_opline;
|
||||
#endif
|
||||
return;
|
||||
HYBRID_DEFAULT:
|
||||
@@ -58800,9 +58819,9 @@ zend_leave_helper_SPEC_LABEL:
|
||||
HYBRID_BREAK(); /* Never reached */
|
||||
#else
|
||||
#ifdef ZEND_VM_FP_GLOBAL_REG
|
||||
execute_data = orig_execute_data;
|
||||
execute_data = vm_stack_data.orig_execute_data;
|
||||
# ifdef ZEND_VM_IP_GLOBAL_REG
|
||||
opline = orig_opline;
|
||||
opline = vm_stack_data.orig_opline;
|
||||
# endif
|
||||
return;
|
||||
#else
|
||||
@@ -58811,7 +58830,7 @@ zend_leave_helper_SPEC_LABEL:
|
||||
ZEND_VM_LOOP_INTERRUPT_CHECK();
|
||||
} else {
|
||||
# ifdef ZEND_VM_IP_GLOBAL_REG
|
||||
opline = orig_opline;
|
||||
opline = vm_stack_data.orig_opline;
|
||||
# endif
|
||||
return;
|
||||
}
|
||||
|
||||
+32
-7
@@ -1780,10 +1780,10 @@ function gen_executor_code($f, $spec, $kind, $prolog, &$switch_labels = array())
|
||||
case ZEND_VM_KIND_HYBRID:
|
||||
out($f,"\t\t\tHYBRID_CASE(HYBRID_HALT):\n");
|
||||
out($f,"#ifdef ZEND_VM_FP_GLOBAL_REG\n");
|
||||
out($f,"\t\t\t\texecute_data = orig_execute_data;\n");
|
||||
out($f,"\t\t\t\texecute_data = vm_stack_data.orig_execute_data;\n");
|
||||
out($f,"#endif\n");
|
||||
out($f,"#ifdef ZEND_VM_IP_GLOBAL_REG\n");
|
||||
out($f,"\t\t\t\topline = orig_opline;\n");
|
||||
out($f,"\t\t\t\topline = vm_stack_data.orig_opline;\n");
|
||||
out($f,"#endif\n");
|
||||
out($f,"\t\t\t\treturn;\n");
|
||||
out($f,"\t\t\tHYBRID_DEFAULT:\n");
|
||||
@@ -2065,15 +2065,34 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
|
||||
out($f,$m[1]."zend_execute_data *execute_data = ex;\n");
|
||||
out($f,"#endif\n");
|
||||
} else {
|
||||
out($f,"#if defined(ZEND_VM_IP_GLOBAL_REG) || defined(ZEND_VM_IP_GLOBAL_REG)\n");
|
||||
out($f,$m[1]."struct {\n");
|
||||
out($f,"#ifdef ZEND_VM_IP_GLOBAL_REG\n");
|
||||
out($f,$m[1]."const zend_op *orig_opline = opline;\n");
|
||||
out($f,$m[1]."\tconst zend_op *orig_opline;\n");
|
||||
out($f,"#endif\n");
|
||||
out($f,"#ifdef ZEND_VM_FP_GLOBAL_REG\n");
|
||||
out($f,$m[1]."zend_execute_data *orig_execute_data = execute_data;\n");
|
||||
out($f,$m[1]."\tzend_execute_data *orig_execute_data;\n");
|
||||
out($f,"#ifdef ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE\n");
|
||||
out($f,$m[1]."\tchar hybrid_jit_red_zone[ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE];\n");
|
||||
out($f,"#endif\n");
|
||||
out($f,"#endif\n");
|
||||
out($f,$m[1]."} vm_stack_data;\n");
|
||||
out($f,"#endif\n");
|
||||
out($f,"#ifdef ZEND_VM_IP_GLOBAL_REG\n");
|
||||
out($f,$m[1]."vm_stack_data.orig_opline = opline;\n");
|
||||
out($f,"#endif\n");
|
||||
out($f,"#ifdef ZEND_VM_FP_GLOBAL_REG\n");
|
||||
out($f,$m[1]."vm_stack_data.orig_execute_data = execute_data;\n");
|
||||
out($f,$m[1]."execute_data = ex;\n");
|
||||
out($f,"#else\n");
|
||||
out($f,$m[1]."zend_execute_data *execute_data = ex;\n");
|
||||
out($f,"#endif\n");
|
||||
out($f,"#ifdef ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE\n");
|
||||
out($f,$m[1]."memset(vm_stack_data.hybrid_jit_red_zone, 0, ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE);\n");
|
||||
out($f,$m[1]."if (zend_touch_vm_stack_data) {\n");
|
||||
out($f,$m[1]."\tzend_touch_vm_stack_data(&vm_stack_data);\n");
|
||||
out($f,$m[1]."}\n");
|
||||
out($f,"#endif\n");
|
||||
}
|
||||
break;
|
||||
case "INTERNAL_LABELS":
|
||||
@@ -2159,9 +2178,9 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
|
||||
}
|
||||
out($f,
|
||||
"#ifdef ZEND_VM_FP_GLOBAL_REG\n" .
|
||||
$m[1]."execute_data = orig_execute_data;\n" .
|
||||
$m[1]."execute_data = vm_stack_data.orig_execute_data;\n" .
|
||||
"# ifdef ZEND_VM_IP_GLOBAL_REG\n" .
|
||||
$m[1]."opline = orig_opline;\n" .
|
||||
$m[1]."opline = vm_stack_data.orig_opline;\n" .
|
||||
"# endif\n" .
|
||||
$m[1]."return;\n" .
|
||||
"#else\n" .
|
||||
@@ -2170,7 +2189,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
|
||||
$m[1]."\tZEND_VM_LOOP_INTERRUPT_CHECK();\n".
|
||||
$m[1]."} else {\n" .
|
||||
"# ifdef ZEND_VM_IP_GLOBAL_REG\n" .
|
||||
$m[1]."\topline = orig_opline;\n" .
|
||||
$m[1]."\topline = vm_stack_data.orig_opline;\n" .
|
||||
"# endif\n".
|
||||
$m[1]."\treturn;\n".
|
||||
$m[1]."}\n".
|
||||
@@ -2578,6 +2597,12 @@ function gen_vm($def, $skel) {
|
||||
fputs($f, "#define ZEND_VM_KIND\t\t" . $GLOBALS["vm_kind_name"][ZEND_VM_KIND] . "\n");
|
||||
}
|
||||
fputs($f, "\n");
|
||||
fputs($f, "#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) && !defined(__SANITIZE_ADDRESS__)\n");
|
||||
fputs($f, "# if ((defined(i386) && !defined(__PIC__)) || defined(__x86_64__) || defined(_M_X64))\n");
|
||||
fputs($f, "# define ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE 16\n");
|
||||
fputs($f, "# endif\n");
|
||||
fputs($f, "#endif\n");
|
||||
fputs($f, "\n");
|
||||
foreach($vm_op_flags as $name => $val) {
|
||||
fprintf($f, "#define %-24s 0x%08x\n", $name, $val);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,12 @@
|
||||
# define ZEND_VM_KIND ZEND_VM_KIND_CALL
|
||||
#endif
|
||||
|
||||
#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) && !defined(__SANITIZE_ADDRESS__)
|
||||
# if ((defined(i386) && !defined(__PIC__)) || defined(__x86_64__) || defined(_M_X64))
|
||||
# define ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE 16
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define ZEND_VM_OP_SPEC 0x00000001
|
||||
#define ZEND_VM_OP_CONST 0x00000002
|
||||
#define ZEND_VM_OP_TMPVAR 0x00000004
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ jobs:
|
||||
CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC'
|
||||
LDFLAGS='-fsanitize=undefined,address'
|
||||
runTestsParameters: --asan
|
||||
timeoutInMinutes: 310
|
||||
timeoutInMinutes: 360
|
||||
- template: azure/msan_job.yml
|
||||
parameters:
|
||||
configurationName: DEBUG_ZTS_MSAN
|
||||
|
||||
@@ -51,8 +51,7 @@ jobs:
|
||||
- script: |
|
||||
git clone https://github.com/laravel/framework.git --branch=master --depth=1
|
||||
cd framework
|
||||
#php7.3 /usr/bin/composer require "doctrine/dbal:^3.0" --no-interaction
|
||||
php7.3 /usr/bin/composer install --no-progress
|
||||
php7.4 /usr/bin/composer install --no-progress
|
||||
# Hack to disable a test that hangs on azure
|
||||
sed -i 's/PHP_OS/"Darwin"/' tests/Filesystem/FilesystemTest.php
|
||||
export USE_ZEND_ALLOC=0
|
||||
@@ -65,8 +64,8 @@ jobs:
|
||||
- script: |
|
||||
git clone https://github.com/symfony/symfony.git --depth=1
|
||||
cd symfony
|
||||
php7.3 /usr/bin/composer install --no-progress
|
||||
php7.3 ./phpunit install
|
||||
php7.4 /usr/bin/composer install --no-progress
|
||||
php7.4 ./phpunit install
|
||||
export USE_ZEND_ALLOC=0
|
||||
export USE_TRACKED_ALLOC=1
|
||||
export ASAN_OPTIONS=exitcode=139
|
||||
@@ -96,14 +95,14 @@ jobs:
|
||||
export USE_ZEND_ALLOC=0
|
||||
export USE_TRACKED_ALLOC=1
|
||||
export ASAN_OPTIONS=exitcode=139
|
||||
php7.3 /usr/bin/composer install --no-progress
|
||||
php7.4 /usr/bin/composer install --no-progress
|
||||
php ./phpunit
|
||||
if [ $? -gt 128 ]; then
|
||||
exit 1
|
||||
fi
|
||||
displayName: 'Test PHPUnit'
|
||||
- script: |
|
||||
php7.3 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress
|
||||
php7.4 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress
|
||||
cd symfony_demo
|
||||
export USE_ZEND_ALLOC=0
|
||||
export USE_TRACKED_ALLOC=1
|
||||
|
||||
@@ -32,10 +32,13 @@ jobs:
|
||||
runTestsParameters: >-
|
||||
${{ parameters.runTestsParameters }}
|
||||
-d zend_extension=opcache.so
|
||||
- script: bash <(curl -s https://codecov.io/bash)
|
||||
displayName: 'Upload ${{ parameters.configurationName }} Test Coverage to Codecov.io'
|
||||
condition: or(succeeded(), failed())
|
||||
- script: |
|
||||
make gcovr-xml
|
||||
mv gcovr.xml coverage.xml
|
||||
displayName: 'Generate ${{ parameters.configurationName }} Test Coverage'
|
||||
displayName: 'Generate ${{ parameters.configurationName }} Test Coverage Cobertura XML Report'
|
||||
condition: or(succeeded(), failed())
|
||||
- task: PublishCodeCoverageResults@1
|
||||
inputs:
|
||||
|
||||
+2
-2
@@ -20,8 +20,8 @@ steps:
|
||||
set -e
|
||||
sudo groupadd -g 5000 vmail
|
||||
sudo useradd -m -d /var/vmail -s /bin/false -u 5000 -g vmail vmail
|
||||
sudo cp ext/imap/tests/dovecot.conf /etc/dovecot/dovecot.conf
|
||||
sudo cp ext/imap/tests/dovecotpass /etc/dovecot/dovecotpass
|
||||
sudo cp ext/imap/tests/setup/dovecot.conf /etc/dovecot/dovecot.conf
|
||||
sudo cp ext/imap/tests/setup/dovecotpass /etc/dovecot/dovecotpass
|
||||
sudo service dovecot restart
|
||||
displayName: 'Configure IMAP'
|
||||
|
||||
@@ -116,6 +116,7 @@ clean:
|
||||
find . -name \*.so | xargs rm -f
|
||||
find . -name .libs -a -type d|xargs rm -rf
|
||||
rm -f libphp.la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
|
||||
rm -f ext/opcache/jit/zend_jit_x86.c
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h
|
||||
@@ -124,7 +125,6 @@ distclean: clean
|
||||
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 sapi/phpdbg/phpdbg.1 ext/phar/phar.1 ext/phar/phar.phar.1
|
||||
rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html
|
||||
rm -f ext/phar/phar.phar ext/phar/phar.php
|
||||
rm -f ext/opcache/jit/zend_jit_x86.c
|
||||
if test "$(srcdir)" != "$(builddir)"; then \
|
||||
rm -f ext/phar/phar/phar.inc; \
|
||||
fi
|
||||
|
||||
+597
-73
@@ -111,7 +111,7 @@ class SimpleType {
|
||||
$this->isBuiltin = $isBuiltin;
|
||||
}
|
||||
|
||||
public static function fromNode(Node $node) {
|
||||
public static function fromNode(Node $node): SimpleType {
|
||||
if ($node instanceof Node\Name) {
|
||||
if ($node->toLowerString() === 'static') {
|
||||
// PHP internally considers "static" a builtin type.
|
||||
@@ -127,11 +127,48 @@ class SimpleType {
|
||||
throw new Exception("Unexpected node type");
|
||||
}
|
||||
|
||||
public function isNull() {
|
||||
public static function fromPhpDoc(string $type): SimpleType
|
||||
{
|
||||
switch (strtolower($type)) {
|
||||
case "void":
|
||||
case "null":
|
||||
case "false":
|
||||
case "bool":
|
||||
case "int":
|
||||
case "float":
|
||||
case "string":
|
||||
case "array":
|
||||
case "iterable":
|
||||
case "object":
|
||||
case "resource":
|
||||
case "mixed":
|
||||
case "self":
|
||||
case "static":
|
||||
return new SimpleType(strtolower($type), true);
|
||||
}
|
||||
|
||||
if (strpos($type, "[]") !== false) {
|
||||
return new SimpleType("array", true);
|
||||
}
|
||||
|
||||
return new SimpleType($type, false);
|
||||
}
|
||||
|
||||
public static function null(): SimpleType
|
||||
{
|
||||
return new SimpleType("null", true);
|
||||
}
|
||||
|
||||
public static function void(): SimpleType
|
||||
{
|
||||
return new SimpleType("void", true);
|
||||
}
|
||||
|
||||
public function isNull(): bool {
|
||||
return $this->isBuiltin && $this->name === 'null';
|
||||
}
|
||||
|
||||
public function toTypeCode() {
|
||||
public function toTypeCode(): string {
|
||||
assert($this->isBuiltin);
|
||||
switch (strtolower($this->name)) {
|
||||
case "bool":
|
||||
@@ -209,19 +246,30 @@ class Type {
|
||||
$this->types = $types;
|
||||
}
|
||||
|
||||
public static function fromNode(Node $node) {
|
||||
public static function fromNode(Node $node): Type {
|
||||
if ($node instanceof Node\UnionType) {
|
||||
return new Type(array_map(['SimpleType', 'fromNode'], $node->types));
|
||||
}
|
||||
if ($node instanceof Node\NullableType) {
|
||||
return new Type([
|
||||
SimpleType::fromNode($node->type),
|
||||
new SimpleType('null', true),
|
||||
SimpleType::null(),
|
||||
]);
|
||||
}
|
||||
return new Type([SimpleType::fromNode($node)]);
|
||||
}
|
||||
|
||||
public static function fromPhpDoc(string $phpDocType) {
|
||||
$types = explode("|", $phpDocType);
|
||||
|
||||
$simpleTypes = [];
|
||||
foreach ($types as $type) {
|
||||
$simpleTypes[] = SimpleType::fromPhpDoc($type);
|
||||
}
|
||||
|
||||
return new Type($simpleTypes);
|
||||
}
|
||||
|
||||
public function isNullable(): bool {
|
||||
foreach ($this->types as $type) {
|
||||
if ($type->isNull()) {
|
||||
@@ -245,20 +293,17 @@ class Type {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function tryToRepresentableType(): ?RepresentableType {
|
||||
$classType = null;
|
||||
public function toArginfoType(): ?ArginfoType {
|
||||
$classTypes = [];
|
||||
$builtinTypes = [];
|
||||
foreach ($this->types as $type) {
|
||||
if ($type->isBuiltin) {
|
||||
$builtinTypes[] = $type;
|
||||
} else if ($classType === null) {
|
||||
$classType = $type;
|
||||
} else {
|
||||
// We can only represent a single class type.
|
||||
return null;
|
||||
$classTypes[] = $type;
|
||||
}
|
||||
}
|
||||
return new RepresentableType($classType, $builtinTypes);
|
||||
return new ArginfoType($classTypes, $builtinTypes);
|
||||
}
|
||||
|
||||
public static function equals(?Type $a, ?Type $b): bool {
|
||||
@@ -278,20 +323,45 @@ class Type {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
if ($this->types === null) {
|
||||
return 'mixed';
|
||||
}
|
||||
|
||||
return implode('|', array_map(
|
||||
function ($type) { return $type->name; },
|
||||
$this->types)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class RepresentableType {
|
||||
/** @var ?SimpleType $classType */
|
||||
public $classType;
|
||||
/** @var SimpleType[] $builtinTypes */
|
||||
public $builtinTypes;
|
||||
class ArginfoType {
|
||||
/** @var ClassType[] $classTypes */
|
||||
public $classTypes;
|
||||
|
||||
public function __construct(?SimpleType $classType, array $builtinTypes) {
|
||||
$this->classType = $classType;
|
||||
/** @var SimpleType[] $builtinTypes */
|
||||
private $builtinTypes;
|
||||
|
||||
public function __construct(array $classTypes, array $builtinTypes) {
|
||||
$this->classTypes = $classTypes;
|
||||
$this->builtinTypes = $builtinTypes;
|
||||
}
|
||||
|
||||
public function hasClassType(): bool {
|
||||
return !empty($this->classTypes);
|
||||
}
|
||||
|
||||
public function toClassTypeString(): string {
|
||||
return implode('|', array_map(function(SimpleType $type) {
|
||||
return $type->toEscapedName();
|
||||
}, $this->classTypes));
|
||||
}
|
||||
|
||||
public function toTypeMask(): string {
|
||||
if (empty($this->builtinTypes)) {
|
||||
return '0';
|
||||
}
|
||||
return implode('|', array_map(function(SimpleType $type) {
|
||||
return $type->toTypeMask();
|
||||
}, $this->builtinTypes));
|
||||
@@ -311,14 +381,17 @@ class ArgInfo {
|
||||
public $isVariadic;
|
||||
/** @var Type|null */
|
||||
public $type;
|
||||
/** @var Type|null */
|
||||
public $phpDocType;
|
||||
/** @var string|null */
|
||||
public $defaultValue;
|
||||
|
||||
public function __construct(string $name, int $sendBy, bool $isVariadic, ?Type $type, ?string $defaultValue) {
|
||||
public function __construct(string $name, int $sendBy, bool $isVariadic, ?Type $type, ?Type $phpDocType, ?string $defaultValue) {
|
||||
$this->name = $name;
|
||||
$this->sendBy = $sendBy;
|
||||
$this->isVariadic = $isVariadic;
|
||||
$this->type = $type;
|
||||
$this->phpDocType = $phpDocType;
|
||||
$this->defaultValue = $defaultValue;
|
||||
}
|
||||
|
||||
@@ -342,22 +415,52 @@ class ArgInfo {
|
||||
throw new Exception("Invalid sendBy value");
|
||||
}
|
||||
|
||||
public function hasDefaultValue(): bool {
|
||||
public function getMethodSynopsisType(): Type {
|
||||
if ($this->type) {
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
if ($this->phpDocType) {
|
||||
return $this->phpDocType;
|
||||
}
|
||||
|
||||
throw new Exception("A parameter must have a type");
|
||||
}
|
||||
|
||||
public function hasProperDefaultValue(): bool {
|
||||
return $this->defaultValue !== null && $this->defaultValue !== "UNKNOWN";
|
||||
}
|
||||
|
||||
public function getDefaultValueString(): string {
|
||||
if ($this->hasDefaultValue()) {
|
||||
public function getDefaultValueAsArginfoString(): string {
|
||||
if ($this->hasProperDefaultValue()) {
|
||||
return '"' . addslashes($this->defaultValue) . '"';
|
||||
}
|
||||
|
||||
return "NULL";
|
||||
}
|
||||
|
||||
public function getDefaultValueAsMethodSynopsisString(): ?string {
|
||||
if ($this->defaultValue === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch ($this->defaultValue) {
|
||||
case 'UNKNOWN':
|
||||
return null;
|
||||
case 'false':
|
||||
case 'true':
|
||||
case 'null':
|
||||
return "&{$this->defaultValue};";
|
||||
}
|
||||
|
||||
return $this->defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
interface FunctionOrMethodName {
|
||||
public function getDeclaration(): string;
|
||||
public function getArgInfoName(): string;
|
||||
public function getMethodSynopsisFilename(): string;
|
||||
public function __toString(): string;
|
||||
public function isMethod(): bool;
|
||||
public function isConstructor(): bool;
|
||||
@@ -399,6 +502,10 @@ class FunctionName implements FunctionOrMethodName {
|
||||
return "arginfo_$underscoreName";
|
||||
}
|
||||
|
||||
public function getMethodSynopsisFilename(): string {
|
||||
return implode('_', $this->name->parts);
|
||||
}
|
||||
|
||||
public function __toString(): string {
|
||||
return $this->name->toString();
|
||||
}
|
||||
@@ -439,6 +546,10 @@ class MethodName implements FunctionOrMethodName {
|
||||
return "arginfo_class_{$this->getDeclarationClassName()}_{$this->methodName}";
|
||||
}
|
||||
|
||||
public function getMethodSynopsisFilename(): string {
|
||||
return $this->getDeclarationClassName() . "_{$this->methodName}";
|
||||
}
|
||||
|
||||
public function __toString(): string {
|
||||
return "$this->className::$this->methodName";
|
||||
}
|
||||
@@ -461,16 +572,23 @@ class ReturnInfo {
|
||||
public $byRef;
|
||||
/** @var Type|null */
|
||||
public $type;
|
||||
/** @var Type|null */
|
||||
public $phpDocType;
|
||||
|
||||
public function __construct(bool $byRef, ?Type $type) {
|
||||
public function __construct(bool $byRef, ?Type $type, ?Type $phpDocType) {
|
||||
$this->byRef = $byRef;
|
||||
$this->type = $type;
|
||||
$this->phpDocType = $phpDocType;
|
||||
}
|
||||
|
||||
public function equals(ReturnInfo $other): bool {
|
||||
return $this->byRef === $other->byRef
|
||||
&& Type::equals($this->type, $other->type);
|
||||
}
|
||||
|
||||
public function getMethodSynopsisType(): ?Type {
|
||||
return $this->type ?? $this->phpDocType;
|
||||
}
|
||||
}
|
||||
|
||||
class FuncInfo {
|
||||
@@ -538,6 +656,47 @@ class FuncInfo {
|
||||
return !($this->flags & Class_::MODIFIER_STATIC) && $this->isMethod() && !$this->name->isConstructor();
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
public function getModifierNames(): array
|
||||
{
|
||||
if (!$this->isMethod()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$result = [];
|
||||
|
||||
if ($this->flags & Class_::MODIFIER_FINAL) {
|
||||
$result[] = "final";
|
||||
} elseif ($this->flags & Class_::MODIFIER_ABSTRACT && $this->classFlags & ~Class_::MODIFIER_ABSTRACT) {
|
||||
$result[] = "abstract";
|
||||
}
|
||||
|
||||
if ($this->flags & Class_::MODIFIER_PROTECTED) {
|
||||
$result[] = "protected";
|
||||
} elseif ($this->flags & Class_::MODIFIER_PRIVATE) {
|
||||
$result[] = "private";
|
||||
} else {
|
||||
$result[] = "public";
|
||||
}
|
||||
|
||||
if ($this->flags & Class_::MODIFIER_STATIC) {
|
||||
$result[] = "static";
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function hasParamWithUnknownDefaultValue(): bool
|
||||
{
|
||||
foreach ($this->args as $arg) {
|
||||
if ($arg->defaultValue && !$arg->hasProperDefaultValue()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function equalsApartFromName(FuncInfo $other): bool {
|
||||
if (count($this->args) !== count($other->args)) {
|
||||
return false;
|
||||
@@ -583,13 +742,13 @@ class FuncInfo {
|
||||
return sprintf(
|
||||
"\tZEND_MALIAS(%s, %s, %s, %s, %s)\n",
|
||||
$this->alias->getDeclarationClassName(), $this->name->methodName,
|
||||
$this->alias->methodName, $this->getArgInfoName(), $this->getFlagsAsString()
|
||||
$this->alias->methodName, $this->getArgInfoName(), $this->getFlagsAsArginfoString()
|
||||
);
|
||||
} else if ($this->alias instanceof FunctionName) {
|
||||
return sprintf(
|
||||
"\tZEND_ME_MAPPING(%s, %s, %s, %s)\n",
|
||||
$this->name->methodName, $this->alias->getNonNamespacedName(),
|
||||
$this->getArgInfoName(), $this->getFlagsAsString()
|
||||
$this->getArgInfoName(), $this->getFlagsAsArginfoString()
|
||||
);
|
||||
} else {
|
||||
throw new Error("Cannot happen");
|
||||
@@ -600,14 +759,14 @@ class FuncInfo {
|
||||
return sprintf(
|
||||
"\tZEND_ABSTRACT_ME_WITH_FLAGS(%s, %s, %s, %s)\n",
|
||||
$declarationClassName, $this->name->methodName, $this->getArgInfoName(),
|
||||
$this->getFlagsAsString()
|
||||
$this->getFlagsAsArginfoString()
|
||||
);
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
"\tZEND_ME(%s, %s, %s, %s)\n",
|
||||
$declarationClassName, $this->name->methodName, $this->getArgInfoName(),
|
||||
$this->getFlagsAsString()
|
||||
$this->getFlagsAsArginfoString()
|
||||
);
|
||||
}
|
||||
} else if ($this->name instanceof FunctionName) {
|
||||
@@ -634,9 +793,10 @@ class FuncInfo {
|
||||
}
|
||||
|
||||
if ($namespace) {
|
||||
// Render A\B as "A\\B" in C strings for namespaces
|
||||
return sprintf(
|
||||
"\tZEND_NS_FE(\"%s\", %s, %s)\n",
|
||||
$namespace, $declarationName, $this->getArgInfoName());
|
||||
addslashes($namespace), $declarationName, $this->getArgInfoName());
|
||||
} else {
|
||||
return sprintf("\tZEND_FE(%s, %s)\n", $declarationName, $this->getArgInfoName());
|
||||
}
|
||||
@@ -645,7 +805,7 @@ class FuncInfo {
|
||||
}
|
||||
}
|
||||
|
||||
private function getFlagsAsString(): string
|
||||
private function getFlagsAsArginfoString(): string
|
||||
{
|
||||
$flags = "ZEND_ACC_PUBLIC";
|
||||
if ($this->flags & Class_::MODIFIER_PROTECTED) {
|
||||
@@ -673,6 +833,114 @@ class FuncInfo {
|
||||
return $flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FuncInfo[] $funcMap
|
||||
* @param FuncInfo[] $aliasMap
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getMethodSynopsisDocument(array $funcMap, array $aliasMap): ?string {
|
||||
|
||||
$doc = new DOMDocument();
|
||||
$doc->formatOutput = true;
|
||||
$methodSynopsis = $this->getMethodSynopsisElement($funcMap, $aliasMap, $doc);
|
||||
if (!$methodSynopsis) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$doc->appendChild($methodSynopsis);
|
||||
|
||||
return $doc->saveXML();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FuncInfo[] $funcMap
|
||||
* @param FuncInfo[] $aliasMap
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getMethodSynopsisElement(array $funcMap, array $aliasMap, DOMDocument $doc): ?DOMElement {
|
||||
if ($this->hasParamWithUnknownDefaultValue()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($this->name->isConstructor()) {
|
||||
$synopsisType = "constructorsynopsis";
|
||||
} elseif ($this->name->isDestructor()) {
|
||||
$synopsisType = "destructorsynopsis";
|
||||
} else {
|
||||
$synopsisType = "methodsynopsis";
|
||||
}
|
||||
|
||||
$methodSynopsis = $doc->createElement($synopsisType);
|
||||
|
||||
$aliasedFunc = $this->aliasType === "alias" && isset($funcMap[$this->alias->__toString()]) ? $funcMap[$this->alias->__toString()] : null;
|
||||
$aliasFunc = $aliasMap[$this->name->__toString()] ?? null;
|
||||
|
||||
if (($this->aliasType === "alias" && $aliasedFunc !== null && $aliasedFunc->isMethod() !== $this->isMethod()) ||
|
||||
($aliasFunc !== null && $aliasFunc->isMethod() !== $this->isMethod())
|
||||
) {
|
||||
$role = $doc->createAttribute("role");
|
||||
$role->value = $this->isMethod() ? "oop" : "procedural";
|
||||
$methodSynopsis->appendChild($role);
|
||||
}
|
||||
|
||||
$methodSynopsis->appendChild(new DOMText("\n "));
|
||||
|
||||
foreach ($this->getModifierNames() as $modifierString) {
|
||||
$modifierElement = $doc->createElement('modifier', $modifierString);
|
||||
$methodSynopsis->appendChild($modifierElement);
|
||||
$methodSynopsis->appendChild(new DOMText(" "));
|
||||
}
|
||||
|
||||
$returnType = $this->return->getMethodSynopsisType();
|
||||
if ($returnType) {
|
||||
$this->appendMethodSynopsisTypeToElement($doc, $methodSynopsis, $returnType);
|
||||
}
|
||||
|
||||
$methodname = $doc->createElement('methodname', $this->name->__toString());
|
||||
$methodSynopsis->appendChild($methodname);
|
||||
|
||||
if (empty($this->args)) {
|
||||
$methodSynopsis->appendChild(new DOMText("\n "));
|
||||
$void = $doc->createElement('void');
|
||||
$methodSynopsis->appendChild($void);
|
||||
} else {
|
||||
foreach ($this->args as $arg) {
|
||||
$methodSynopsis->appendChild(new DOMText("\n "));
|
||||
$methodparam = $doc->createElement('methodparam');
|
||||
if ($arg->defaultValue !== null) {
|
||||
$methodparam->setAttribute("choice", "opt");
|
||||
}
|
||||
if ($arg->isVariadic) {
|
||||
$methodparam->setAttribute("rep", "repeat");
|
||||
}
|
||||
|
||||
$methodSynopsis->appendChild($methodparam);
|
||||
$this->appendMethodSynopsisTypeToElement($doc, $methodparam, $arg->getMethodSynopsisType());
|
||||
|
||||
$parameter = $doc->createElement('parameter', $arg->name);
|
||||
if ($arg->sendBy !== ArgInfo::SEND_BY_VAL) {
|
||||
$parameter->setAttribute("role", "reference");
|
||||
}
|
||||
|
||||
$methodparam->appendChild($parameter);
|
||||
$defaultValue = $arg->getDefaultValueAsMethodSynopsisString();
|
||||
if ($defaultValue !== null) {
|
||||
$initializer = $doc->createElement('initializer');
|
||||
if (preg_match('/^[a-zA-Z_][a-zA-Z_0-9]*$/', $defaultValue)) {
|
||||
$constant = $doc->createElement('constant', $defaultValue);
|
||||
$initializer->appendChild($constant);
|
||||
} else {
|
||||
$initializer->nodeValue = $defaultValue;
|
||||
}
|
||||
$methodparam->appendChild($initializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
$methodSynopsis->appendChild(new DOMText("\n "));
|
||||
|
||||
return $methodSynopsis;
|
||||
}
|
||||
|
||||
public function discardInfoForOldPhpVersions(): void {
|
||||
$this->return->type = null;
|
||||
foreach ($this->args as $arg) {
|
||||
@@ -680,6 +948,22 @@ class FuncInfo {
|
||||
$arg->defaultValue = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function appendMethodSynopsisTypeToElement(DOMDocument $doc, DOMElement $elementToAppend, Type $type) {
|
||||
if (count($type->types) > 1) {
|
||||
$typeElement = $doc->createElement('type');
|
||||
$typeElement->setAttribute("class", "union");
|
||||
|
||||
foreach ($type->types as $type) {
|
||||
$unionTypeElement = $doc->createElement('type', $type->name);
|
||||
$typeElement->appendChild($unionTypeElement);
|
||||
}
|
||||
} else {
|
||||
$typeElement = $doc->createElement('type', $type->types[0]->name);
|
||||
}
|
||||
|
||||
$elementToAppend->appendChild($typeElement);
|
||||
}
|
||||
}
|
||||
|
||||
class ClassInfo {
|
||||
@@ -736,8 +1020,26 @@ class DocCommentTag {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function getVariableName(): string {
|
||||
public function getType(): string {
|
||||
$value = $this->getValue();
|
||||
|
||||
$matches = [];
|
||||
|
||||
if ($this->name === "param") {
|
||||
preg_match('/^\s*([\w\|\\\\\[\]]+)\s*\$\w+.*$/', $value, $matches);
|
||||
} elseif ($this->name === "return") {
|
||||
preg_match('/^\s*([\w\|\\\\\[\]]+)\s*$/', $value, $matches);
|
||||
}
|
||||
|
||||
if (isset($matches[1]) === false) {
|
||||
throw new Exception("@$this->name doesn't contain a type or has an invalid format \"$value\"");
|
||||
}
|
||||
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
public function getVariableName(): string {
|
||||
$value = $this->value;
|
||||
if ($value === null || strlen($value) === 0) {
|
||||
throw new Exception("@$this->name doesn't have any value");
|
||||
}
|
||||
@@ -745,13 +1047,13 @@ class DocCommentTag {
|
||||
$matches = [];
|
||||
|
||||
if ($this->name === "param") {
|
||||
preg_match('/^\s*[\w\|\\\\]+\s*\$(\w+).*$/', $value, $matches);
|
||||
preg_match('/^\s*[\w\|\\\\\[\]]+\s*\$(\w+).*$/', $value, $matches);
|
||||
} elseif ($this->name === "prefer-ref") {
|
||||
preg_match('/^\s*\$(\w+).*$/', $value, $matches);
|
||||
}
|
||||
|
||||
if (isset($matches[1]) === false) {
|
||||
throw new Exception("@$this->name doesn't contain variable name or has an invalid format \"$value\"");
|
||||
throw new Exception("@$this->name doesn't contain a variable name or has an invalid format \"$value\"");
|
||||
}
|
||||
|
||||
return $matches[1];
|
||||
@@ -786,7 +1088,7 @@ function parseFunctionLike(
|
||||
$alias = null;
|
||||
$isDeprecated = false;
|
||||
$verify = true;
|
||||
$haveDocReturnType = false;
|
||||
$docReturnType = null;
|
||||
$docParamTypes = [];
|
||||
|
||||
if ($comment) {
|
||||
@@ -811,9 +1113,9 @@ function parseFunctionLike(
|
||||
} else if ($tag->name === 'no-verify') {
|
||||
$verify = false;
|
||||
} else if ($tag->name === 'return') {
|
||||
$haveDocReturnType = true;
|
||||
$docReturnType = $tag->getType();
|
||||
} else if ($tag->name === 'param') {
|
||||
$docParamTypes[$tag->getVariableName()] = true;
|
||||
$docParamTypes[$tag->getVariableName()] = $tag->getType();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -867,6 +1169,7 @@ function parseFunctionLike(
|
||||
$sendBy,
|
||||
$param->variadic,
|
||||
$type,
|
||||
isset($docParamTypes[$varName]) ? Type::fromPhpDoc($docParamTypes[$varName]) : null,
|
||||
$param->default ? $prettyPrinter->prettyPrintExpr($param->default) : null
|
||||
);
|
||||
if (!$param->default && !$param->variadic) {
|
||||
@@ -879,13 +1182,14 @@ function parseFunctionLike(
|
||||
}
|
||||
|
||||
$returnType = $func->getReturnType();
|
||||
if ($returnType === null && !$haveDocReturnType && !$name->isConstructor() && !$name->isDestructor()) {
|
||||
if ($returnType === null && $docReturnType === null && !$name->isConstructor() && !$name->isDestructor()) {
|
||||
throw new Exception("Missing return type for function $name()");
|
||||
}
|
||||
|
||||
$return = new ReturnInfo(
|
||||
$func->returnsByRef(),
|
||||
$returnType ? Type::fromNode($returnType) : null
|
||||
$returnType ? Type::fromNode($returnType) : null,
|
||||
$docReturnType ? Type::fromPhpDoc($docReturnType) : null
|
||||
);
|
||||
|
||||
return new FuncInfo(
|
||||
@@ -1070,24 +1374,23 @@ function funcInfoToCode(FuncInfo $funcInfo): string {
|
||||
$simpleReturnType->toEscapedName(), $returnType->isNullable()
|
||||
);
|
||||
}
|
||||
} else if (null !== $representableType = $returnType->tryToRepresentableType()) {
|
||||
if ($representableType->classType !== null) {
|
||||
} else {
|
||||
$arginfoType = $returnType->toArginfoType();
|
||||
if ($arginfoType->hasClassType()) {
|
||||
$code .= sprintf(
|
||||
"ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(%s, %d, %d, %s, %s)\n",
|
||||
$funcInfo->getArgInfoName(), $funcInfo->return->byRef,
|
||||
$funcInfo->numRequiredArgs,
|
||||
$representableType->classType->toEscapedName(), $representableType->toTypeMask()
|
||||
$arginfoType->toClassTypeString(), $arginfoType->toTypeMask()
|
||||
);
|
||||
} else {
|
||||
$code .= sprintf(
|
||||
"ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(%s, %d, %d, %s)\n",
|
||||
$funcInfo->getArgInfoName(), $funcInfo->return->byRef,
|
||||
$funcInfo->numRequiredArgs,
|
||||
$representableType->toTypeMask()
|
||||
$arginfoType->toTypeMask()
|
||||
);
|
||||
}
|
||||
} else {
|
||||
throw new Exception('Unimplemented');
|
||||
}
|
||||
} else {
|
||||
$code .= sprintf(
|
||||
@@ -1098,7 +1401,7 @@ function funcInfoToCode(FuncInfo $funcInfo): string {
|
||||
|
||||
foreach ($funcInfo->args as $argInfo) {
|
||||
$argKind = $argInfo->isVariadic ? "ARG_VARIADIC" : "ARG";
|
||||
$argDefaultKind = $argInfo->hasDefaultValue() ? "_WITH_DEFAULT_VALUE" : "";
|
||||
$argDefaultKind = $argInfo->hasProperDefaultValue() ? "_WITH_DEFAULT_VALUE" : "";
|
||||
$argType = $argInfo->type;
|
||||
if ($argType !== null) {
|
||||
if (null !== $simpleArgType = $argType->tryToSimpleType()) {
|
||||
@@ -1107,41 +1410,39 @@ function funcInfoToCode(FuncInfo $funcInfo): string {
|
||||
"\tZEND_%s_TYPE_INFO%s(%s, %s, %s, %d%s)\n",
|
||||
$argKind, $argDefaultKind, $argInfo->getSendByString(), $argInfo->name,
|
||||
$simpleArgType->toTypeCode(), $argType->isNullable(),
|
||||
$argInfo->hasDefaultValue() ? ", " . $argInfo->getDefaultValueString() : ""
|
||||
$argInfo->hasProperDefaultValue() ? ", " . $argInfo->getDefaultValueAsArginfoString() : ""
|
||||
);
|
||||
} else {
|
||||
$code .= sprintf(
|
||||
"\tZEND_%s_OBJ_INFO%s(%s, %s, %s, %d%s)\n",
|
||||
$argKind,$argDefaultKind, $argInfo->getSendByString(), $argInfo->name,
|
||||
$simpleArgType->toEscapedName(), $argType->isNullable(),
|
||||
$argInfo->hasDefaultValue() ? ", " . $argInfo->getDefaultValueString() : ""
|
||||
$argInfo->hasProperDefaultValue() ? ", " . $argInfo->getDefaultValueAsArginfoString() : ""
|
||||
);
|
||||
}
|
||||
} else if (null !== $representableType = $argType->tryToRepresentableType()) {
|
||||
if ($representableType->classType !== null) {
|
||||
} else {
|
||||
$arginfoType = $argType->toArginfoType();
|
||||
if ($arginfoType->hasClassType()) {
|
||||
$code .= sprintf(
|
||||
"\tZEND_%s_OBJ_TYPE_MASK(%s, %s, %s, %s, %s)\n",
|
||||
$argKind, $argInfo->getSendByString(), $argInfo->name,
|
||||
$representableType->classType->toEscapedName(),
|
||||
$representableType->toTypeMask(),
|
||||
$argInfo->getDefaultValueString()
|
||||
$arginfoType->toClassTypeString(), $arginfoType->toTypeMask(),
|
||||
$argInfo->getDefaultValueAsArginfoString()
|
||||
);
|
||||
} else {
|
||||
$code .= sprintf(
|
||||
"\tZEND_%s_TYPE_MASK(%s, %s, %s, %s)\n",
|
||||
$argKind, $argInfo->getSendByString(), $argInfo->name,
|
||||
$representableType->toTypeMask(),
|
||||
$argInfo->getDefaultValueString()
|
||||
$arginfoType->toTypeMask(),
|
||||
$argInfo->getDefaultValueAsArginfoString()
|
||||
);
|
||||
}
|
||||
} else {
|
||||
throw new Exception('Unimplemented');
|
||||
}
|
||||
} else {
|
||||
$code .= sprintf(
|
||||
"\tZEND_%s_INFO%s(%s, %s%s)\n",
|
||||
$argKind, $argDefaultKind, $argInfo->getSendByString(), $argInfo->name,
|
||||
$argInfo->hasDefaultValue() ? ", " . $argInfo->getDefaultValueString() : ""
|
||||
$argInfo->hasProperDefaultValue() ? ", " . $argInfo->getDefaultValueAsArginfoString() : ""
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1253,6 +1554,194 @@ function generateFunctionEntries(?Name $className, array $funcInfos): string {
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FuncInfo[] $funcMap
|
||||
* @param FuncInfo[] $aliasMap
|
||||
* @return array<string, string>
|
||||
*/
|
||||
function generateMethodSynopses(array $funcMap, array $aliasMap): array {
|
||||
$result = [];
|
||||
|
||||
foreach ($funcMap as $funcInfo) {
|
||||
$methodSynopsis = $funcInfo->getMethodSynopsisDocument($funcMap, $aliasMap);
|
||||
if ($methodSynopsis !== null) {
|
||||
$result[$funcInfo->name->getMethodSynopsisFilename() . ".xml"] = $methodSynopsis;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FuncInfo[] $funcMap
|
||||
* @param FuncInfo[] $aliasMap
|
||||
* @return array<string, string>
|
||||
*/
|
||||
function replaceMethodSynopses(string $targetDirectory, array $funcMap, array $aliasMap): array {
|
||||
$methodSynopses = [];
|
||||
|
||||
$it = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($targetDirectory),
|
||||
RecursiveIteratorIterator::LEAVES_ONLY
|
||||
);
|
||||
|
||||
foreach ($it as $file) {
|
||||
$pathName = $file->getPathName();
|
||||
if (!preg_match('/\.xml$/i', $pathName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$xml = file_get_contents($pathName);
|
||||
if ($xml === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stripos($xml, "<methodsynopsis") === false && stripos($xml, "<constructorsynopsis") === false && stripos($xml, "<destructorsynopsis") === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$replacedXml = preg_replace("/&([A-Za-z0-9._{}%-]+?;)/", "REPLACED-ENTITY-$1", $xml);
|
||||
|
||||
$doc = new DOMDocument();
|
||||
$doc->formatOutput = false;
|
||||
$doc->preserveWhiteSpace = true;
|
||||
$doc->validateOnParse = true;
|
||||
$success = $doc->loadXML($replacedXml);
|
||||
if (!$success) {
|
||||
echo "Failed opening $pathName\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
$docComparator = new DOMDocument();
|
||||
$docComparator->preserveWhiteSpace = false;
|
||||
$docComparator->formatOutput = true;
|
||||
|
||||
$methodSynopsisElements = [];
|
||||
foreach ($doc->getElementsByTagName("constructorsynopsis") as $element) {
|
||||
$methodSynopsisElements[] = $element;
|
||||
}
|
||||
foreach ($doc->getElementsByTagName("destructorsynopsis") as $element) {
|
||||
$methodSynopsisElements[] = $element;
|
||||
}
|
||||
foreach ($doc->getElementsByTagName("methodsynopsis") as $element) {
|
||||
$methodSynopsisElements[] = $element;
|
||||
}
|
||||
|
||||
foreach ($methodSynopsisElements as $methodSynopsis) {
|
||||
if (!$methodSynopsis instanceof DOMElement) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$list = $methodSynopsis->getElementsByTagName("methodname");
|
||||
$item = $list->item(0);
|
||||
if (!$item instanceof DOMElement) {
|
||||
continue;
|
||||
}
|
||||
$funcName = $item->textContent;
|
||||
if (!isset($funcMap[$funcName])) {
|
||||
continue;
|
||||
}
|
||||
$funcInfo = $funcMap[$funcName];
|
||||
|
||||
$newMethodSynopsis = $funcInfo->getMethodSynopsisElement($funcMap, $aliasMap, $doc);
|
||||
if ($newMethodSynopsis === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Retrieve current signature
|
||||
|
||||
$params = [];
|
||||
$list = $methodSynopsis->getElementsByTagName("methodparam");
|
||||
foreach ($list as $i => $item) {
|
||||
if (!$item instanceof DOMElement) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$paramList = $item->getElementsByTagName("parameter");
|
||||
if ($paramList->count() !== 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$paramName = $paramList->item(0)->textContent;
|
||||
$paramTypes = [];
|
||||
|
||||
$paramList = $item->getElementsByTagName("type");
|
||||
foreach ($paramList as $type) {
|
||||
if (!$type instanceof DOMElement) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$paramTypes[] = $type->textContent;
|
||||
}
|
||||
|
||||
$params[$paramName] = ["index" => $i, "type" => $paramTypes];
|
||||
}
|
||||
|
||||
// Check if there is any change - short circuit if there is not any.
|
||||
|
||||
$xml1 = $doc->saveXML($methodSynopsis);
|
||||
$xml1 = preg_replace("/&([A-Za-z0-9._{}%-]+?;)/", "REPLACED-ENTITY-$1", $xml1);
|
||||
$docComparator->loadXML($xml1);
|
||||
$xml1 = $docComparator->saveXML();
|
||||
|
||||
$methodSynopsis->parentNode->replaceChild($newMethodSynopsis, $methodSynopsis);
|
||||
|
||||
$xml2 = $doc->saveXML($newMethodSynopsis);
|
||||
$xml2 = preg_replace("/&([A-Za-z0-9._{}%-]+?;)/", "REPLACED-ENTITY-$1", $xml2);
|
||||
$docComparator->loadXML($xml2);
|
||||
$xml2 = $docComparator->saveXML();
|
||||
|
||||
if ($xml1 === $xml2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Update parameter references
|
||||
|
||||
$paramList = $doc->getElementsByTagName("parameter");
|
||||
/** @var DOMElement $paramElement */
|
||||
foreach ($paramList as $paramElement) {
|
||||
if ($paramElement->parentNode && $paramElement->parentNode->nodeName === "methodparam") {
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = $paramElement->textContent;
|
||||
if (!isset($params[$name])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$index = $params[$name]["index"];
|
||||
if (!isset($funcInfo->args[$index])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$paramElement->textContent = $funcInfo->args[$index]->name;
|
||||
}
|
||||
|
||||
// Return the updated XML
|
||||
|
||||
$replacedXml = $doc->saveXML();
|
||||
|
||||
$replacedXml = preg_replace(
|
||||
[
|
||||
"/REPLACED-ENTITY-([A-Za-z0-9._{}%-]+?;)/",
|
||||
"/<refentry\s+xmlns=\"([a-z0-9.:\/]+)\"\s+xml:id=\"([a-z0-9._-]+)\"\s*>/i",
|
||||
"/<refentry\s+xmlns=\"([a-z0-9.:\/]+)\"\s+xmlns:xlink=\"([a-z0-9.:\/]+)\"\s+xml:id=\"([a-z0-9._-]+)\"\s*>/i",
|
||||
],
|
||||
[
|
||||
"&$1",
|
||||
"<refentry xml:id=\"$2\" xmlns=\"$1\">",
|
||||
"<refentry xml:id=\"$3\" xmlns=\"$1\" xmlns:xlink=\"$2\">",
|
||||
],
|
||||
$replacedXml
|
||||
);
|
||||
|
||||
$methodSynopses[$pathName] = $replacedXml;
|
||||
}
|
||||
}
|
||||
|
||||
return $methodSynopses;
|
||||
}
|
||||
|
||||
function installPhpParser(string $version, string $phpParserDir) {
|
||||
$lockFile = __DIR__ . "/PHP-Parser-install-lock";
|
||||
$lockFd = fopen($lockFile, 'w+');
|
||||
@@ -1318,16 +1807,22 @@ function initPhpParser() {
|
||||
}
|
||||
|
||||
$optind = null;
|
||||
$options = getopt("fh", ["force-regeneration", "parameter-stats", "help", "verify"], $optind);
|
||||
$options = getopt("fh", ["force-regeneration", "parameter-stats", "help", "verify", "generate-methodsynopses", "replace-methodsynopses"], $optind);
|
||||
|
||||
$context = new Context;
|
||||
$printParameterStats = isset($options["parameter-stats"]);
|
||||
$verify = isset($options["verify"]);
|
||||
$generateMethodSynopses = isset($options["generate-methodsynopses"]);
|
||||
$replaceMethodSynopses = isset($options["replace-methodsynopses"]);
|
||||
$context->forceRegeneration = isset($options["f"]) || isset($options["force-regeneration"]);
|
||||
$context->forceParse = $context->forceRegeneration || $printParameterStats || $verify;
|
||||
$context->forceParse = $context->forceRegeneration || $printParameterStats || $verify || $generateMethodSynopses || $replaceMethodSynopses;
|
||||
$targetMethodSynopses = $argv[$optind + 1] ?? null;
|
||||
if ($replaceMethodSynopses && $targetMethodSynopses === null) {
|
||||
die("A target directory must be provided.\n");
|
||||
}
|
||||
|
||||
if (isset($options["h"]) || isset($options["help"])) {
|
||||
die("\nusage: gen-stub.php [ -f | --force-regeneration ] [ --parameter-stats ] [ --verify ] [ -h | --help ] [ name.stub.php | directory ]\n\n");
|
||||
die("\nusage: gen-stub.php [ -f | --force-regeneration ] [ --generate-methodsynopses ] [ --replace-methodsynopses ] [ --parameter-stats ] [ --verify ] [ -h | --help ] [ name.stub.php | directory ] [ directory ]\n\n");
|
||||
}
|
||||
|
||||
$fileInfos = [];
|
||||
@@ -1363,23 +1858,26 @@ if ($printParameterStats) {
|
||||
echo json_encode($parameterStats, JSON_PRETTY_PRINT), "\n";
|
||||
}
|
||||
|
||||
if ($verify) {
|
||||
$errors = [];
|
||||
$funcMap = [];
|
||||
$aliases = [];
|
||||
/** @var FuncInfo[] $funcMap */
|
||||
$funcMap = [];
|
||||
/** @var FuncInfo[] $aliasMap */
|
||||
$aliasMap = [];
|
||||
|
||||
foreach ($fileInfos as $fileInfo) {
|
||||
foreach ($fileInfo->getAllFuncInfos() as $funcInfo) {
|
||||
/** @var FuncInfo $funcInfo */
|
||||
$funcMap[$funcInfo->name->__toString()] = $funcInfo;
|
||||
foreach ($fileInfos as $fileInfo) {
|
||||
foreach ($fileInfo->getAllFuncInfos() as $funcInfo) {
|
||||
/** @var FuncInfo $funcInfo */
|
||||
$funcMap[$funcInfo->name->__toString()] = $funcInfo;
|
||||
|
||||
if ($funcInfo->aliasType === "alias") {
|
||||
$aliases[] = $funcInfo;
|
||||
}
|
||||
if ($funcInfo->aliasType === "alias") {
|
||||
$aliasMap[$funcInfo->alias->__toString()] = $funcInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($aliases as $aliasFunc) {
|
||||
if ($verify) {
|
||||
$errors = [];
|
||||
|
||||
foreach ($aliasMap as $aliasFunc) {
|
||||
if (!isset($funcMap[$aliasFunc->alias->__toString()])) {
|
||||
$errors[] = "Aliased function {$aliasFunc->alias}() cannot be found";
|
||||
continue;
|
||||
@@ -1412,7 +1910,6 @@ if ($verify) {
|
||||
}
|
||||
|
||||
if ($aliasedArg === null) {
|
||||
assert($aliasArg !== null);
|
||||
$errors[] = "{$aliasedFunc->name}(): Argument \$$aliasArg->name of alias function {$aliasFunc->name}() is missing";
|
||||
return null;
|
||||
}
|
||||
@@ -1447,3 +1944,30 @@ if ($verify) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if ($generateMethodSynopses) {
|
||||
$methodSynopsesDirectory = getcwd() . "/methodsynopses";
|
||||
|
||||
$methodSynopses = generateMethodSynopses($funcMap, $aliasMap);
|
||||
if (!empty($methodSynopses)) {
|
||||
if (!file_exists($methodSynopsesDirectory)) {
|
||||
mkdir($methodSynopsesDirectory);
|
||||
}
|
||||
|
||||
foreach ($methodSynopses as $filename => $content) {
|
||||
if (file_put_contents("$methodSynopsesDirectory/$filename", $content)) {
|
||||
echo "Saved $filename\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($replaceMethodSynopses) {
|
||||
$methodSynopses = replaceMethodSynopses($targetMethodSynopses, $funcMap, $aliasMap);
|
||||
|
||||
foreach ($methodSynopses as $filename => $content) {
|
||||
if (file_put_contents($filename, $content)) {
|
||||
echo "Saved $filename\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+3
-3
@@ -340,7 +340,7 @@ AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[
|
||||
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
|
||||
10.[[012]]*)
|
||||
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
|
||||
10.*)
|
||||
*)
|
||||
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
|
||||
esac
|
||||
;;
|
||||
@@ -1522,7 +1522,7 @@ darwin* | rhapsody*)
|
||||
shlibpath_var=DYLD_LIBRARY_PATH
|
||||
shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
|
||||
ifelse([$1], [],[
|
||||
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
|
||||
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
|
||||
sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
|
||||
;;
|
||||
|
||||
@@ -5800,7 +5800,7 @@ _LT_EOF
|
||||
10.[[012]])
|
||||
_LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
|
||||
;;
|
||||
10.*)
|
||||
*)
|
||||
_LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
|
||||
;;
|
||||
esac
|
||||
|
||||
+1
-1
@@ -478,7 +478,7 @@ dnl Internal, don't use.
|
||||
dnl
|
||||
AC_DEFUN([_PHP_ADD_LIBRARY_SKELETON],[
|
||||
case $1 in
|
||||
c|c_r|pthread*[)] ;;
|
||||
c|c_r[)] ;;
|
||||
*[)] ifelse($3,,[
|
||||
_PHP_X_ADD_LIBRARY($1,$2,$5)
|
||||
],[
|
||||
|
||||
+14
-8
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
|
||||
dnl ----------------------------------------------------------------------------
|
||||
|
||||
AC_PREREQ([2.68])
|
||||
AC_INIT([PHP],[8.0.0],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_INIT([PHP],[8.0.3],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_CONFIG_SRCDIR([main/php_version.h])
|
||||
AC_CONFIG_AUX_DIR([build])
|
||||
AC_PRESERVE_HELP_ORDER
|
||||
@@ -797,6 +797,19 @@ if test "$PHP_DEBUG_ASSERTIONS" = "yes"; then
|
||||
ZEND_DEBUG=yes
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([zts],
|
||||
[AS_HELP_STRING([--enable-zts],
|
||||
[Enable thread safety])],
|
||||
[ZEND_ZTS=$enableval],
|
||||
[ZEND_ZTS=no])
|
||||
|
||||
if test "$ZEND_ZTS" = "yes"; then
|
||||
AC_DEFINE(ZTS, 1,[ ])
|
||||
PHP_THREAD_SAFETY=yes
|
||||
else
|
||||
PHP_THREAD_SAFETY=no
|
||||
fi
|
||||
|
||||
PHP_ARG_ENABLE([rtld-now],
|
||||
[whether to dlopen extensions with RTLD_NOW instead of RTLD_LAZY],
|
||||
[AS_HELP_STRING([--enable-rtld-now],
|
||||
@@ -1136,13 +1149,6 @@ LIBZEND_BASIC_CHECKS
|
||||
LIBZEND_DLSYM_CHECK
|
||||
LIBZEND_OTHER_CHECKS
|
||||
|
||||
if test "$ZEND_ZTS" = "yes"; then
|
||||
AC_DEFINE(ZTS,1,[ ])
|
||||
PHP_THREAD_SAFETY=yes
|
||||
else
|
||||
PHP_THREAD_SAFETY=no
|
||||
fi
|
||||
|
||||
INCLUDES="$INCLUDES -I\$(top_builddir)/TSRM"
|
||||
INCLUDES="$INCLUDES -I\$(top_builddir)/Zend"
|
||||
|
||||
|
||||
+144
-53
@@ -129,20 +129,23 @@ PHP_MINFO_FUNCTION(bcmath)
|
||||
|
||||
/* {{{ php_str2num
|
||||
Convert to bc_num detecting scale */
|
||||
static void php_str2num(bc_num *num, char *str)
|
||||
static zend_result php_str2num(bc_num *num, char *str)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (!(p = strchr(str, '.'))) {
|
||||
if (!bc_str2num(num, str, 0)) {
|
||||
php_error_docref(NULL, E_WARNING, "bcmath function argument is not well-formed");
|
||||
return FAILURE;
|
||||
}
|
||||
return;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (!bc_str2num(num, str, strlen(p+1))) {
|
||||
php_error_docref(NULL, E_WARNING, "bcmath function argument is not well-formed");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -174,15 +177,26 @@ PHP_FUNCTION(bcadd)
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
php_str2num(&first, ZSTR_VAL(left));
|
||||
php_str2num(&second, ZSTR_VAL(right));
|
||||
|
||||
if (php_str2num(&first, ZSTR_VAL(left)) == FAILURE) {
|
||||
zend_argument_value_error(1, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (php_str2num(&second, ZSTR_VAL(right)) == FAILURE) {
|
||||
zend_argument_value_error(2, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
bc_add (first, second, &result, scale);
|
||||
|
||||
RETVAL_STR(bc_num2str_ex(result, scale));
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
return;
|
||||
|
||||
cleanup: {
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
};
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -214,15 +228,26 @@ PHP_FUNCTION(bcsub)
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
php_str2num(&first, ZSTR_VAL(left));
|
||||
php_str2num(&second, ZSTR_VAL(right));
|
||||
|
||||
if (php_str2num(&first, ZSTR_VAL(left)) == FAILURE) {
|
||||
zend_argument_value_error(1, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (php_str2num(&second, ZSTR_VAL(right)) == FAILURE) {
|
||||
zend_argument_value_error(2, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
bc_sub (first, second, &result, scale);
|
||||
|
||||
RETVAL_STR(bc_num2str_ex(result, scale));
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
return;
|
||||
|
||||
cleanup: {
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
};
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -254,15 +279,26 @@ PHP_FUNCTION(bcmul)
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
php_str2num(&first, ZSTR_VAL(left));
|
||||
php_str2num(&second, ZSTR_VAL(right));
|
||||
|
||||
if (php_str2num(&first, ZSTR_VAL(left)) == FAILURE) {
|
||||
zend_argument_value_error(1, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (php_str2num(&second, ZSTR_VAL(right)) == FAILURE) {
|
||||
zend_argument_value_error(2, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
bc_multiply (first, second, &result, scale);
|
||||
|
||||
RETVAL_STR(bc_num2str_ex(result, scale));
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
return;
|
||||
|
||||
cleanup: {
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
};
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -294,8 +330,16 @@ PHP_FUNCTION(bcdiv)
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
php_str2num(&first, ZSTR_VAL(left));
|
||||
php_str2num(&second, ZSTR_VAL(right));
|
||||
|
||||
if (php_str2num(&first, ZSTR_VAL(left)) == FAILURE) {
|
||||
zend_argument_value_error(1, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (php_str2num(&second, ZSTR_VAL(right)) == FAILURE) {
|
||||
zend_argument_value_error(2, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
switch (bc_divide(first, second, &result, scale)) {
|
||||
case 0: /* OK */
|
||||
@@ -306,10 +350,11 @@ PHP_FUNCTION(bcdiv)
|
||||
break;
|
||||
}
|
||||
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
return;
|
||||
cleanup: {
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
};
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -341,8 +386,16 @@ PHP_FUNCTION(bcmod)
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
php_str2num(&first, ZSTR_VAL(left));
|
||||
php_str2num(&second, ZSTR_VAL(right));
|
||||
|
||||
if (php_str2num(&first, ZSTR_VAL(left)) == FAILURE) {
|
||||
zend_argument_value_error(1, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (php_str2num(&second, ZSTR_VAL(right)) == FAILURE) {
|
||||
zend_argument_value_error(2, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
switch (bc_modulo(first, second, &result, scale)) {
|
||||
case 0:
|
||||
@@ -353,9 +406,11 @@ PHP_FUNCTION(bcmod)
|
||||
break;
|
||||
}
|
||||
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
cleanup: {
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
};
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -389,18 +444,32 @@ PHP_FUNCTION(bcpowmod)
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&mod);
|
||||
bc_init_num(&result);
|
||||
php_str2num(&first, ZSTR_VAL(left));
|
||||
php_str2num(&second, ZSTR_VAL(right));
|
||||
php_str2num(&mod, ZSTR_VAL(modulus));
|
||||
|
||||
if (php_str2num(&first, ZSTR_VAL(left)) == FAILURE) {
|
||||
zend_argument_value_error(1, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (php_str2num(&second, ZSTR_VAL(right)) == FAILURE) {
|
||||
zend_argument_value_error(2, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (php_str2num(&mod, ZSTR_VAL(modulus)) == FAILURE) {
|
||||
zend_argument_value_error(3, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (bc_raisemod(first, second, mod, &result, scale) == SUCCESS) {
|
||||
RETVAL_STR(bc_num2str_ex(result, scale));
|
||||
}
|
||||
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&mod);
|
||||
bc_free_num(&result);
|
||||
cleanup: {
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&mod);
|
||||
bc_free_num(&result);
|
||||
};
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -432,14 +501,26 @@ PHP_FUNCTION(bcpow)
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
php_str2num(&first, ZSTR_VAL(left));
|
||||
php_str2num(&second, ZSTR_VAL(right));
|
||||
|
||||
if (php_str2num(&first, ZSTR_VAL(left)) == FAILURE) {
|
||||
zend_argument_value_error(1, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (php_str2num(&second, ZSTR_VAL(right)) == FAILURE) {
|
||||
zend_argument_value_error(2, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
bc_raise (first, second, &result, scale);
|
||||
|
||||
RETVAL_STR(bc_num2str_ex(result, scale));
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
|
||||
cleanup: {
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
};
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -468,7 +549,11 @@ PHP_FUNCTION(bcsqrt)
|
||||
}
|
||||
|
||||
bc_init_num(&result);
|
||||
php_str2num(&result, ZSTR_VAL(left));
|
||||
|
||||
if (php_str2num(&result, ZSTR_VAL(left)) == FAILURE) {
|
||||
zend_argument_value_error(1, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (bc_sqrt (&result, scale) != 0) {
|
||||
RETVAL_STR(bc_num2str_ex(result, scale));
|
||||
@@ -476,8 +561,9 @@ PHP_FUNCTION(bcsqrt)
|
||||
zend_argument_value_error(1, "must be greater than or equal to 0");
|
||||
}
|
||||
|
||||
bc_free_num(&result);
|
||||
return;
|
||||
cleanup: {
|
||||
bc_free_num(&result);
|
||||
};
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -510,16 +596,21 @@ PHP_FUNCTION(bccomp)
|
||||
bc_init_num(&second);
|
||||
|
||||
if (!bc_str2num(&first, ZSTR_VAL(left), scale)) {
|
||||
php_error_docref(NULL, E_WARNING, "bcmath function argument is not well-formed");
|
||||
zend_argument_value_error(1, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!bc_str2num(&second, ZSTR_VAL(right), scale)) {
|
||||
php_error_docref(NULL, E_WARNING, "bcmath function argument is not well-formed");
|
||||
zend_argument_value_error(2, "is not well-formed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
RETVAL_LONG(bc_compare(first, second));
|
||||
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
return;
|
||||
cleanup: {
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
};
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #80545 (bcadd('a', 'a') and bcadd('1', 'a') doesn't throw an exception)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
bcadd('a', 'a');
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
||||
try {
|
||||
bcadd('1', 'a');
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bcadd(): Argument #1 ($num1) is not well-formed
|
||||
bcadd(): Argument #2 ($num2) is not well-formed
|
||||
@@ -14,12 +14,39 @@ echo bcadd("", "2", 2),"\n";
|
||||
echo bcadd("+0", "2"), "\n";
|
||||
echo bcadd("-0", "2"), "\n";
|
||||
|
||||
echo bcadd(" 0", "2");
|
||||
echo bcadd("1e1", "2");
|
||||
echo bcadd("1,1", "2");
|
||||
echo bcadd("Hello", "2");
|
||||
echo bcadd("1 1", "2");
|
||||
echo "\n", "\n";
|
||||
echo "\n";
|
||||
|
||||
try {
|
||||
echo bcadd(" 0", "2");
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
||||
try {
|
||||
echo bcadd("1e1", "2");
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
||||
try {
|
||||
echo bcadd("1,1", "2");
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
||||
try {
|
||||
echo bcadd("Hello", "2");
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
||||
try {
|
||||
echo bcadd("1 1", "2");
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
echo bccomp("1", "2"),"\n";
|
||||
echo bccomp("1.1", "2", 2),"\n";
|
||||
@@ -27,11 +54,38 @@ echo bccomp("", "2"),"\n";
|
||||
echo bccomp("+0", "2"), "\n";
|
||||
echo bccomp("-0", "2"), "\n";
|
||||
|
||||
echo bccomp(" 0", "2");
|
||||
echo bccomp("1e1", "2");
|
||||
echo bccomp("1,1", "2");
|
||||
echo bccomp("Hello", "2");
|
||||
echo bccomp("1 1", "2");
|
||||
echo "\n";
|
||||
|
||||
try {
|
||||
echo bccomp(" 0", "2");
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
||||
try {
|
||||
echo bccomp("1e1", "2");
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
||||
try {
|
||||
echo bccomp("1,1", "2");
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
||||
try {
|
||||
echo bccomp("Hello", "2");
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
||||
try {
|
||||
echo bccomp("1 1", "2");
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
3
|
||||
@@ -40,16 +94,11 @@ echo bccomp("1 1", "2");
|
||||
2
|
||||
2
|
||||
|
||||
Warning: bcadd(): bcmath function argument is not well-formed in %s on line %d
|
||||
2
|
||||
Warning: bcadd(): bcmath function argument is not well-formed in %s on line %d
|
||||
2
|
||||
Warning: bcadd(): bcmath function argument is not well-formed in %s on line %d
|
||||
2
|
||||
Warning: bcadd(): bcmath function argument is not well-formed in %s on line %d
|
||||
2
|
||||
Warning: bcadd(): bcmath function argument is not well-formed in %s on line %d
|
||||
2
|
||||
bcadd(): Argument #1 ($num1) is not well-formed
|
||||
bcadd(): Argument #1 ($num1) is not well-formed
|
||||
bcadd(): Argument #1 ($num1) is not well-formed
|
||||
bcadd(): Argument #1 ($num1) is not well-formed
|
||||
bcadd(): Argument #1 ($num1) is not well-formed
|
||||
|
||||
-1
|
||||
-1
|
||||
@@ -57,13 +106,8 @@ Warning: bcadd(): bcmath function argument is not well-formed in %s on line %d
|
||||
-1
|
||||
-1
|
||||
|
||||
Warning: bccomp(): bcmath function argument is not well-formed in %s on line %d
|
||||
-1
|
||||
Warning: bccomp(): bcmath function argument is not well-formed in %s on line %d
|
||||
-1
|
||||
Warning: bccomp(): bcmath function argument is not well-formed in %s on line %d
|
||||
-1
|
||||
Warning: bccomp(): bcmath function argument is not well-formed in %s on line %d
|
||||
-1
|
||||
Warning: bccomp(): bcmath function argument is not well-formed in %s on line %d
|
||||
-1
|
||||
bccomp(): Argument #1 ($num1) is not well-formed
|
||||
bccomp(): Argument #1 ($num1) is not well-formed
|
||||
bccomp(): Argument #1 ($num1) is not well-formed
|
||||
bccomp(): Argument #1 ($num1) is not well-formed
|
||||
bccomp(): Argument #1 ($num1) is not well-formed
|
||||
@@ -82,3 +82,7 @@ class dotnet
|
||||
public function __construct(string $assembly_name, string $datatype_name, int $codepage = CP_ACP) {}
|
||||
}
|
||||
#endif
|
||||
|
||||
final class com_exception extends exception
|
||||
{
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: da1da8fcfe8a04d08d354ad2cc5a3658d16c3076 */
|
||||
* Stub hash: 6b162963bcceb90144fdd3165137fb567f916812 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_set, 0, 2, IS_VOID, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
|
||||
@@ -226,3 +226,8 @@ static const zend_function_entry class_dotnet_methods[] = {
|
||||
#endif
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_com_exception_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
final class COMPersistHelper
|
||||
{
|
||||
public function __construct(?variant $variant) {}
|
||||
public function __construct(?variant $variant = null) {}
|
||||
|
||||
public function GetCurFileName(): string|false {}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: d04d007cac328014c6cc76a00cc291237965d56d */
|
||||
* Stub hash: 2c2759e6c1894713439e3ee8da7f56810d00d8cf */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_COMPersistHelper___construct, 0, 0, 1)
|
||||
ZEND_ARG_OBJ_INFO(0, variant, variant, 1)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_COMPersistHelper___construct, 0, 0, 0)
|
||||
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, variant, variant, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_COMPersistHelper_GetCurFileName, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ if (PHP_CURL != "no") {
|
||||
) {
|
||||
EXTENSION("curl", "interface.c multi.c share.c curl_file.c");
|
||||
AC_DEFINE('HAVE_CURL', 1, 'Have cURL library');
|
||||
ADD_FLAG("CFLAGS_CURL", "/D CURL_STATICLIB");
|
||||
ADD_FLAG("CFLAGS_CURL", "/D CURL_STATICLIB /D PHP_CURL_EXPORTS=1");
|
||||
PHP_INSTALL_HEADERS("ext/curl", "php_curl.h");
|
||||
// TODO: check for curl_version_info
|
||||
} else {
|
||||
|
||||
+12
-1
@@ -1200,6 +1200,7 @@ PHP_MINIT_FUNCTION(curl)
|
||||
curl_object_handlers.get_constructor = curl_get_constructor;
|
||||
curl_object_handlers.clone_obj = curl_clone_obj;
|
||||
curl_object_handlers.cast_object = curl_cast_object;
|
||||
curl_object_handlers.compare = zend_objects_not_comparable;
|
||||
|
||||
curl_multi_register_class(class_CurlMultiHandle_methods);
|
||||
curl_share_register_class(class_CurlShareHandle_methods);
|
||||
@@ -2046,6 +2047,7 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
|
||||
#endif
|
||||
|
||||
prop = zend_read_property(curl_CURLFile_class, Z_OBJ_P(current), "name", sizeof("name")-1, 0, &rv);
|
||||
ZVAL_DEREF(prop);
|
||||
if (Z_TYPE_P(prop) != IS_STRING) {
|
||||
php_error_docref(NULL, E_WARNING, "Invalid filename for key %s", ZSTR_VAL(string_key));
|
||||
} else {
|
||||
@@ -2056,10 +2058,12 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
|
||||
}
|
||||
|
||||
prop = zend_read_property(curl_CURLFile_class, Z_OBJ_P(current), "mime", sizeof("mime")-1, 0, &rv);
|
||||
ZVAL_DEREF(prop);
|
||||
if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) {
|
||||
type = Z_STRVAL_P(prop);
|
||||
}
|
||||
prop = zend_read_property(curl_CURLFile_class, Z_OBJ_P(current), "postname", sizeof("postname")-1, 0, &rv);
|
||||
ZVAL_DEREF(prop);
|
||||
if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) {
|
||||
filename = Z_STRVAL_P(prop);
|
||||
}
|
||||
@@ -2722,7 +2726,14 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue, bool i
|
||||
|
||||
case CURLOPT_POSTFIELDS:
|
||||
if (Z_TYPE_P(zvalue) == IS_ARRAY) {
|
||||
return build_mime_structure_from_hash(ch, zvalue);
|
||||
if (zend_hash_num_elements(HASH_OF(zvalue)) == 0) {
|
||||
/* no need to build the mime structure for empty hashtables;
|
||||
also works around https://github.com/curl/curl/issues/6455 */
|
||||
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, "");
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, 0);
|
||||
} else {
|
||||
return build_mime_structure_from_hash(ch, zvalue);
|
||||
}
|
||||
} else {
|
||||
zend_string *tmp_str;
|
||||
zend_string *str = zval_get_tmp_string(zvalue, &tmp_str);
|
||||
|
||||
@@ -603,4 +603,5 @@ void curl_multi_register_class(const zend_function_entry *method_entries) {
|
||||
curl_multi_handlers.get_constructor = curl_multi_get_constructor;
|
||||
curl_multi_handlers.clone_obj = NULL;
|
||||
curl_multi_handlers.cast_object = curl_cast_object;
|
||||
curl_multi_handlers.compare = zend_objects_not_comparable;
|
||||
}
|
||||
+5
-1
@@ -21,7 +21,11 @@
|
||||
#include "php.h"
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
# define PHP_CURL_API __declspec(dllexport)
|
||||
# ifdef PHP_CURL_EXPORTS
|
||||
# define PHP_CURL_API __declspec(dllexport)
|
||||
# else
|
||||
# define PHP_CURL_API __declspec(dllimport)
|
||||
# endif
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define PHP_CURL_API __attribute__ ((visibility("default")))
|
||||
#else
|
||||
|
||||
@@ -176,4 +176,5 @@ void curl_share_register_class(const zend_function_entry *method_entries) {
|
||||
curl_share_handlers.free_obj = curl_share_free_obj;
|
||||
curl_share_handlers.get_constructor = curl_share_get_constructor;
|
||||
curl_share_handlers.clone_obj = NULL;
|
||||
curl_share_handlers.compare = zend_objects_not_comparable;
|
||||
}
|
||||
@@ -25,5 +25,6 @@ string(%d) "POST /get.inc?test=post HTTP/1.1
|
||||
Host: localhost:%d
|
||||
Accept: */*
|
||||
Content-Length: 0
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
|
||||
"
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Bug #80595 (Resetting POSTFIELDS to empty array breaks request)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
$ch = curl_init();
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_URL => "{$host}/get.inc?test=post",
|
||||
]);
|
||||
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, ['foo' => 'bar']);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, []);
|
||||
var_dump(curl_exec($ch));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(43) "array(1) {
|
||||
["foo"]=>
|
||||
string(3) "bar"
|
||||
}
|
||||
"
|
||||
string(13) "array(0) {
|
||||
}
|
||||
"
|
||||
@@ -48,7 +48,7 @@ PSL => No
|
||||
HTTPS_PROXY => Yes
|
||||
MULTI_SSL => %s
|
||||
BROTLI => %s
|
||||
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, %r(mqtt, )?%rpop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
|
||||
Protocols => dict, file, ftp, ftps, gopher, %r(gophers, )?%rhttp, https, imap, imaps, ldap, ldaps, %r(mqtt, )?%rpop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
|
||||
Host => %s-pc-win32
|
||||
SSL Version => OpenSSL/%s
|
||||
ZLib Version => %s
|
||||
|
||||
+23303
-20532
File diff suppressed because it is too large.
Load diff
+395
-432
File diff suppressed because it is too large.
Load diff
+2681
-2482
File diff suppressed because it is too large.
Load diff
+10
-10
@@ -57,7 +57,7 @@ function date_sub(DateTime $object, DateInterval $interval): DateTime {}
|
||||
|
||||
function date_timezone_get(DateTimeInterface $object): DateTimeZone|false {}
|
||||
|
||||
function date_timezone_set(DateTimeInterface $object, DateTimeZone $timezone): DateTime {}
|
||||
function date_timezone_set(DateTime $object, DateTimeZone $timezone): DateTime {}
|
||||
|
||||
function date_offset_get(DateTimeInterface $object): int {}
|
||||
|
||||
@@ -105,12 +105,12 @@ function date_default_timezone_get(): string {}
|
||||
function date_sunrise(
|
||||
int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING,
|
||||
?float $latitude = null, ?float $longitude = null, ?float $zenith = null,
|
||||
float $utcOffset = 0): string|int|float|false {}
|
||||
?float $utcOffset = null): string|int|float|false {}
|
||||
|
||||
function date_sunset(
|
||||
int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING,
|
||||
?float $latitude = null, ?float $longitude = null, ?float $zenith = null,
|
||||
float $utcOffset = 0): string|int|float|false {}
|
||||
?float $utcOffset = null): string|int|float|false {}
|
||||
|
||||
function date_sun_info(int $timestamp, float $latitude, float $longitude): array {}
|
||||
|
||||
@@ -125,7 +125,7 @@ interface DateTimeInterface
|
||||
/** @return DateTimeZone|false */
|
||||
public function getTimezone();
|
||||
|
||||
/** @return int|false */
|
||||
/** @return int */
|
||||
public function getOffset();
|
||||
|
||||
/** @return int|false */
|
||||
@@ -202,7 +202,7 @@ class DateTime implements DateTimeInterface
|
||||
public function setTimezone(DateTimeZone $timezone) {}
|
||||
|
||||
/**
|
||||
* @return int|false
|
||||
* @return int
|
||||
* @alias date_offset_get
|
||||
*/
|
||||
public function getOffset() {}
|
||||
@@ -238,7 +238,7 @@ class DateTime implements DateTimeInterface
|
||||
public function getTimestamp() {}
|
||||
|
||||
/**
|
||||
* @return DateInterval|false
|
||||
* @return DateInterval
|
||||
* @alias date_diff
|
||||
*/
|
||||
public function diff(DateTimeInterface $targetObject, bool $absolute = false) {}
|
||||
@@ -251,7 +251,7 @@ class DateTimeImmutable implements DateTimeInterface
|
||||
/** @return void */
|
||||
public function __wakeup() {}
|
||||
|
||||
/** @return DateTimeZone */
|
||||
/** @return DateTimeImmutable */
|
||||
public static function __set_state(array $array) {}
|
||||
|
||||
/**
|
||||
@@ -279,7 +279,7 @@ class DateTimeImmutable implements DateTimeInterface
|
||||
public function getTimezone() {}
|
||||
|
||||
/**
|
||||
* @return int|false
|
||||
* @return int
|
||||
* @alias date_offset_get
|
||||
*/
|
||||
public function getOffset() {}
|
||||
@@ -291,7 +291,7 @@ class DateTimeImmutable implements DateTimeInterface
|
||||
public function getTimestamp() {}
|
||||
|
||||
/**
|
||||
* @return DateInterval|false
|
||||
* @return DateInterval
|
||||
* @alias date_diff
|
||||
*/
|
||||
public function diff(DateTimeInterface $targetObject, bool $absolute = false) {}
|
||||
@@ -361,7 +361,7 @@ class DateTimeZone
|
||||
public static function listAbbreviations() {}
|
||||
|
||||
/**
|
||||
* @return array|false
|
||||
* @return array
|
||||
* @alias timezone_identifiers_list
|
||||
*/
|
||||
public static function listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null) {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 07d0e6179d838847d4a5d454f8b56438f8df19c0 */
|
||||
* Stub hash: 880a93d8a3461635447318317869fa7d3d7762dd */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtotime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
|
||||
ZEND_ARG_TYPE_INFO(0, datetime, IS_STRING, 0)
|
||||
@@ -110,7 +110,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_timezone_get, 0, 1, Dat
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_timezone_set, 0, 2, DateTime, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
@@ -214,7 +214,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_date_sunrise, 0, 1, MAY_BE_STRIN
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, latitude, IS_DOUBLE, 1, "null")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, longitude, IS_DOUBLE, 1, "null")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, zenith, IS_DOUBLE, 1, "null")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, utcOffset, IS_DOUBLE, 0, "0")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, utcOffset, IS_DOUBLE, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_date_sunset arginfo_date_sunrise
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
Bug #76770 'U' modifier in 'datetime::createFromFormat' adds seconds to other specifiers
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(datetime::createFromFormat('U H', '3600 01')->getTimestamp());
|
||||
?>
|
||||
--EXPECT--
|
||||
int(3600)
|
||||
+2
-34
@@ -349,9 +349,8 @@ PHP_METHOD(DOMCharacterData, replaceData)
|
||||
PHP_METHOD(DOMCharacterData, remove)
|
||||
{
|
||||
zval *id = ZEND_THIS;
|
||||
xmlNodePtr children, child;
|
||||
xmlNodePtr child;
|
||||
dom_object *intern;
|
||||
int stricterror;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
@@ -359,38 +358,7 @@ PHP_METHOD(DOMCharacterData, remove)
|
||||
|
||||
DOM_GET_OBJ(child, id, xmlNodePtr, intern);
|
||||
|
||||
if (dom_node_children_valid(child) == FAILURE) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
stricterror = dom_get_strict_error(intern->document);
|
||||
|
||||
if (dom_node_is_read_only(child) == SUCCESS ||
|
||||
(child->parent != NULL && dom_node_is_read_only(child->parent) == SUCCESS)) {
|
||||
php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, stricterror);
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
if (!child->parent) {
|
||||
php_dom_throw_error(NOT_FOUND_ERR, stricterror);
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
children = child->parent->children;
|
||||
if (!children) {
|
||||
php_dom_throw_error(NOT_FOUND_ERR, stricterror);
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
while (children) {
|
||||
if (children == child) {
|
||||
xmlUnlinkNode(child);
|
||||
RETURN_NULL();
|
||||
}
|
||||
children = children->next;
|
||||
}
|
||||
|
||||
php_dom_throw_error(NOT_FOUND_ERR, stricterror);
|
||||
dom_child_node_remove(intern);
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -986,7 +986,7 @@ PHP_METHOD(DOMDocument, getElementsByTagNameNS)
|
||||
xmlChar *local, *nsuri;
|
||||
|
||||
id = ZEND_THIS;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &uri, &uri_len, &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
@@ -995,7 +995,7 @@ PHP_METHOD(DOMDocument, getElementsByTagNameNS)
|
||||
php_dom_create_iterator(return_value, DOM_NODELIST);
|
||||
namednode = Z_DOMOBJ_P(return_value);
|
||||
local = xmlCharStrndup(name, name_len);
|
||||
nsuri = xmlCharStrndup(uri, uri_len);
|
||||
nsuri = xmlCharStrndup(uri ? uri : "", uri_len);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri);
|
||||
}
|
||||
/* }}} end dom_document_get_elements_by_tag_name_ns */
|
||||
|
||||
@@ -127,7 +127,7 @@ PHP_METHOD(DOMImplementation, createDocument)
|
||||
char *prefix = NULL, *localname = NULL;
|
||||
dom_object *doctobj;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ssO!", &uri, &uri_len, &name, &name_len, &node, dom_documenttype_class_entry) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!sO!", &uri, &uri_len, &name, &name_len, &node, dom_documenttype_class_entry) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -933,7 +933,7 @@ PHP_METHOD(DOMElement, getElementsByTagNameNS)
|
||||
xmlChar *local, *nsuri;
|
||||
|
||||
id = ZEND_THIS;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &uri, &uri_len, &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
@@ -942,7 +942,7 @@ PHP_METHOD(DOMElement, getElementsByTagNameNS)
|
||||
php_dom_create_iterator(return_value, DOM_NODELIST);
|
||||
namednode = Z_DOMOBJ_P(return_value);
|
||||
local = xmlCharStrndup(name, name_len);
|
||||
nsuri = xmlCharStrndup(uri, uri_len);
|
||||
nsuri = xmlCharStrndup(uri ? uri : "", uri_len);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri);
|
||||
|
||||
}
|
||||
|
||||
@@ -374,10 +374,6 @@ void dom_child_node_remove(dom_object *context)
|
||||
xmlNodePtr children;
|
||||
int stricterror;
|
||||
|
||||
if (dom_node_children_valid(child) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
stricterror = dom_get_strict_error(context->document);
|
||||
|
||||
if (dom_node_is_read_only(child) == SUCCESS ||
|
||||
@@ -391,6 +387,10 @@ void dom_child_node_remove(dom_object *context)
|
||||
return;
|
||||
}
|
||||
|
||||
if (dom_node_children_valid(child->parent) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
children = child->parent->children;
|
||||
if (!children) {
|
||||
php_dom_throw_error(NOT_FOUND_ERR, stricterror);
|
||||
|
||||
+20
-16
@@ -2,16 +2,16 @@
|
||||
|
||||
/** @generate-function-entries */
|
||||
|
||||
class DOMDocumentType
|
||||
class DOMDocumentType extends DOMNode
|
||||
{
|
||||
}
|
||||
|
||||
class DOMCdataSection
|
||||
class DOMCdataSection extends DOMText
|
||||
{
|
||||
public function __construct(string $data) {}
|
||||
}
|
||||
|
||||
class DOMComment
|
||||
class DOMComment extends DOMCharacterData
|
||||
{
|
||||
public function __construct(string $data = "") {}
|
||||
}
|
||||
@@ -93,6 +93,10 @@ class DOMNode
|
||||
public function replaceChild(DOMNode $node, DOMNode $child) {}
|
||||
}
|
||||
|
||||
class DOMNameSpaceNode
|
||||
{
|
||||
}
|
||||
|
||||
class DOMImplementation
|
||||
{
|
||||
/** @return void */
|
||||
@@ -105,10 +109,10 @@ class DOMImplementation
|
||||
public function createDocumentType(string $qualifiedName, string $publicId = "", string $systemId = "") {}
|
||||
|
||||
/** @return DOMDocument|false */
|
||||
public function createDocument(string $namespace = "", string $qualifiedName = "", ?DOMDocumentType $doctype = null) {}
|
||||
public function createDocument(?string $namespace = null, string $qualifiedName = "", ?DOMDocumentType $doctype = null) {}
|
||||
}
|
||||
|
||||
class DOMDocumentFragment implements DOMParentNode
|
||||
class DOMDocumentFragment extends DOMNode implements DOMParentNode
|
||||
{
|
||||
public function __construct() {}
|
||||
|
||||
@@ -129,11 +133,11 @@ class DOMNodeList implements IteratorAggregate, Countable
|
||||
|
||||
public function getIterator(): Iterator {}
|
||||
|
||||
/** @return ?DOMNode */
|
||||
/** @return DOMNode|null */
|
||||
public function item(int $index) {}
|
||||
}
|
||||
|
||||
class DOMCharacterData implements DOMChildNode
|
||||
class DOMCharacterData extends DOMNode implements DOMChildNode
|
||||
{
|
||||
/** @return bool */
|
||||
public function appendData(string $data) {}
|
||||
@@ -162,7 +166,7 @@ class DOMCharacterData implements DOMChildNode
|
||||
public function after(...$nodes): void {}
|
||||
}
|
||||
|
||||
class DOMAttr
|
||||
class DOMAttr extends DOMNode
|
||||
{
|
||||
public function __construct(string $name, string $value = "") {}
|
||||
|
||||
@@ -170,7 +174,7 @@ class DOMAttr
|
||||
public function isId() {}
|
||||
}
|
||||
|
||||
class DOMElement implements DOMParentNode, DOMChildNode
|
||||
class DOMElement extends DOMNode implements DOMParentNode, DOMChildNode
|
||||
{
|
||||
public function __construct(string $qualifiedName, ?string $value = null, string $namespace = "") {}
|
||||
|
||||
@@ -190,7 +194,7 @@ class DOMElement implements DOMParentNode, DOMChildNode
|
||||
public function getElementsByTagName(string $qualifiedName) {}
|
||||
|
||||
/** @return DOMNodeList */
|
||||
public function getElementsByTagNameNS(string $namespace, string $localName) {}
|
||||
public function getElementsByTagNameNS(?string $namespace, string $localName) {}
|
||||
|
||||
/** @return bool */
|
||||
public function hasAttribute(string $qualifiedName) {}
|
||||
@@ -205,7 +209,7 @@ class DOMElement implements DOMParentNode, DOMChildNode
|
||||
public function removeAttributeNS(?string $namespace, string $localName) {}
|
||||
|
||||
/** @return DOMAttr|false */
|
||||
public function removeAttributeNode(string $qualifiedName) {}
|
||||
public function removeAttributeNode(DOMAttr $attr) {}
|
||||
|
||||
/** @return DOMAttr|bool */
|
||||
public function setAttribute(string $qualifiedName, string $value) {}
|
||||
@@ -246,7 +250,7 @@ class DOMElement implements DOMParentNode, DOMChildNode
|
||||
public function prepend(...$nodes): void {}
|
||||
}
|
||||
|
||||
class DOMDocument implements DOMParentNode
|
||||
class DOMDocument extends DOMNode implements DOMParentNode
|
||||
{
|
||||
public function __construct(string $version = "1.0", string $encoding = "") {}
|
||||
|
||||
@@ -287,7 +291,7 @@ class DOMDocument implements DOMParentNode
|
||||
public function getElementsByTagName(string $qualifiedName) {}
|
||||
|
||||
/** @return DOMNodeList */
|
||||
public function getElementsByTagNameNS(string $namespace, string $localName) {}
|
||||
public function getElementsByTagNameNS(?string $namespace, string $localName) {}
|
||||
|
||||
/** @return DOMNode|false */
|
||||
public function importNode(DOMNode $node, bool $deep = false) {}
|
||||
@@ -358,7 +362,7 @@ final class DOMException extends Exception
|
||||
{
|
||||
}
|
||||
|
||||
class DOMText
|
||||
class DOMText extends DOMCharacterData
|
||||
{
|
||||
public function __construct(string $data = "") {}
|
||||
|
||||
@@ -396,7 +400,7 @@ class DOMEntity extends DOMNode
|
||||
{
|
||||
}
|
||||
|
||||
class DOMEntityReference
|
||||
class DOMEntityReference extends DOMNode
|
||||
{
|
||||
public function __construct(string $name) {}
|
||||
}
|
||||
@@ -405,7 +409,7 @@ class DOMNotation extends DOMNode
|
||||
{
|
||||
}
|
||||
|
||||
class DOMProcessingInstruction
|
||||
class DOMProcessingInstruction extends DOMNode
|
||||
{
|
||||
public function __construct(string $name, string $value = "") {}
|
||||
}
|
||||
|
||||
+14
-12
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 128108b08807ce0b125fc7b963bf3c5b77e6987a */
|
||||
* Stub hash: a4767d6ea60859c8897f681fb69d6f73b1f50471 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 1)
|
||||
ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0)
|
||||
@@ -106,7 +106,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMImplementation_createDocumentType, 0, 0,
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMImplementation_createDocument, 0, 0, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, namespace, IS_STRING, 0, "\"\"")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, namespace, IS_STRING, 1, "null")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, qualifiedName, IS_STRING, 0, "\"\"")
|
||||
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, doctype, DOMDocumentType, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -184,10 +184,7 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_class_DOMElement_getElementsByTagName arginfo_class_DOMElement_getAttribute
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_getElementsByTagNameNS, 0, 0, 2)
|
||||
ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, localName, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
#define arginfo_class_DOMElement_getElementsByTagNameNS arginfo_class_DOMElement_getAttributeNS
|
||||
|
||||
#define arginfo_class_DOMElement_hasAttribute arginfo_class_DOMElement_getAttribute
|
||||
|
||||
@@ -197,7 +194,9 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_class_DOMElement_removeAttributeNS arginfo_class_DOMElement_getAttributeNS
|
||||
|
||||
#define arginfo_class_DOMElement_removeAttributeNode arginfo_class_DOMElement_getAttribute
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_removeAttributeNode, 0, 0, 1)
|
||||
ZEND_ARG_OBJ_INFO(0, attr, DOMAttr, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_setAttribute, 0, 0, 2)
|
||||
ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0)
|
||||
@@ -210,11 +209,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_setAttributeNS, 0, 0, 3)
|
||||
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_setAttributeNode, 0, 0, 1)
|
||||
ZEND_ARG_OBJ_INFO(0, attr, DOMAttr, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
#define arginfo_class_DOMElement_setAttributeNode arginfo_class_DOMElement_removeAttributeNode
|
||||
|
||||
#define arginfo_class_DOMElement_setAttributeNodeNS arginfo_class_DOMElement_setAttributeNode
|
||||
#define arginfo_class_DOMElement_setAttributeNodeNS arginfo_class_DOMElement_removeAttributeNode
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_setIdAttribute, 0, 0, 2)
|
||||
ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0)
|
||||
@@ -292,7 +289,7 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_class_DOMDocument_getElementsByTagName arginfo_class_DOMElement_getAttribute
|
||||
|
||||
#define arginfo_class_DOMDocument_getElementsByTagNameNS arginfo_class_DOMElement_getElementsByTagNameNS
|
||||
#define arginfo_class_DOMDocument_getElementsByTagNameNS arginfo_class_DOMElement_getAttributeNS
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_importNode, 0, 0, 1)
|
||||
ZEND_ARG_OBJ_INFO(0, node, DOMNode, 0)
|
||||
@@ -649,6 +646,11 @@ static const zend_function_entry class_DOMNode_methods[] = {
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_DOMNameSpaceNode_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_DOMImplementation_methods[] = {
|
||||
ZEND_ME(DOMImplementation, getFeature, arginfo_class_DOMImplementation_getFeature, ZEND_ACC_PUBLIC)
|
||||
ZEND_ME(DOMImplementation, hasFeature, arginfo_class_DOMImplementation_hasFeature, ZEND_ACC_PUBLIC)
|
||||
|
||||
@@ -6,6 +6,7 @@ include('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
$x = new DOMImplementation();
|
||||
$doc = $x->createDocument(null, 'html');
|
||||
echo $doc->saveHTML();
|
||||
|
||||
@@ -6,13 +6,24 @@ require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadXML('<root xmlns:x="x"><a/><x:a/></root>');
|
||||
$list = $doc->getElementsByTagNameNS('', 'a');
|
||||
var_dump($list->length);
|
||||
$list = $doc->getElementsByTagNameNS(null, 'a');
|
||||
var_dump($list->length);
|
||||
|
||||
$elem = $doc->documentElement;
|
||||
$list = $elem->getElementsByTagNameNS('', 'a');
|
||||
var_dump($list->length);
|
||||
$list = $elem->getElementsByTagNameNS(null, 'a');
|
||||
var_dump($list->length);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
dom: DOMChildNode::remove does not work on character data
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$doc = new \DOMDocument();
|
||||
$doc->loadXML('<a><!-- foo --></a>');
|
||||
$doc->documentElement->firstChild->remove();
|
||||
echo $doc->saveXML($doc->documentElement);
|
||||
--EXPECTF--
|
||||
<a/>
|
||||
@@ -199,6 +199,7 @@ PHP_MINIT_FUNCTION(enchant)
|
||||
enchant_broker_handlers.offset = XtOffsetOf(enchant_broker, std);
|
||||
enchant_broker_handlers.free_obj = php_enchant_broker_free;
|
||||
enchant_broker_handlers.clone_obj = NULL;
|
||||
enchant_broker_handlers.compare = zend_objects_not_comparable;
|
||||
|
||||
INIT_CLASS_ENTRY(dce, "EnchantDictionary", class_EnchantDictionary_methods);
|
||||
enchant_dict_ce = zend_register_internal_class(&dce);
|
||||
@@ -211,6 +212,7 @@ PHP_MINIT_FUNCTION(enchant)
|
||||
enchant_dict_handlers.offset = XtOffsetOf(enchant_dict, std);
|
||||
enchant_dict_handlers.free_obj = php_enchant_dict_free;
|
||||
enchant_dict_handlers.clone_obj = NULL;
|
||||
enchant_dict_handlers.compare = zend_objects_not_comparable;
|
||||
|
||||
REGISTER_LONG_CONSTANT("ENCHANT_MYSPELL", PHP_ENCHANT_MYSPELL, CONST_CS | CONST_PERSISTENT | CONST_DEPRECATED);
|
||||
REGISTER_LONG_CONSTANT("ENCHANT_ISPELL", PHP_ENCHANT_ISPELL, CONST_CS | CONST_PERSISTENT | CONST_DEPRECATED);
|
||||
|
||||
+9
-9
@@ -3865,7 +3865,7 @@ ZEND_METHOD(FFI, cast) /* {{{ */
|
||||
RETURN_OBJ(&cdata->std);
|
||||
} else {
|
||||
zend_wrong_parameter_class_error(2, "FFI\\CData", zv);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4006,7 +4006,7 @@ ZEND_METHOD(FFI, typeof) /* {{{ */
|
||||
}
|
||||
} else {
|
||||
zend_wrong_parameter_class_error(1, "FFI\\CData", zv);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
ctype = (zend_ffi_ctype*)zend_ffi_ctype_new(zend_ffi_ctype_ce);
|
||||
@@ -4110,7 +4110,7 @@ ZEND_METHOD(FFI, addr) /* {{{ */
|
||||
ZVAL_DEREF(zv);
|
||||
if (Z_TYPE_P(zv) != IS_OBJECT || Z_OBJCE_P(zv) != zend_ffi_cdata_ce) {
|
||||
zend_wrong_parameter_class_error(1, "FFI\\CData", zv);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
cdata = (zend_ffi_cdata*)Z_OBJ_P(zv);
|
||||
@@ -4165,7 +4165,7 @@ ZEND_METHOD(FFI, sizeof) /* {{{ */
|
||||
type = ZEND_FFI_TYPE(ctype->type);
|
||||
} else {
|
||||
zend_wrong_parameter_class_error(1, "FFI\\CData or FFI\\CType", zv);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
RETURN_LONG(type->size);
|
||||
@@ -4191,7 +4191,7 @@ ZEND_METHOD(FFI, alignof) /* {{{ */
|
||||
type = ZEND_FFI_TYPE(ctype->type);
|
||||
} else {
|
||||
zend_wrong_parameter_class_error(1, "FFI\\CData or FFI\\CType", zv);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
RETURN_LONG(type->align);
|
||||
@@ -4246,7 +4246,7 @@ ZEND_METHOD(FFI, memcpy) /* {{{ */
|
||||
}
|
||||
} else {
|
||||
zend_wrong_parameter_class_error(2, "FFI\\CData or string", zv2);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
memcpy(ptr1, ptr2, size);
|
||||
@@ -4290,7 +4290,7 @@ ZEND_METHOD(FFI, memcmp) /* {{{ */
|
||||
}
|
||||
} else {
|
||||
zend_wrong_parameter_class_error(1, "FFI\\CData or string", zv1);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
ZVAL_DEREF(zv2);
|
||||
@@ -4314,7 +4314,7 @@ ZEND_METHOD(FFI, memcmp) /* {{{ */
|
||||
}
|
||||
} else {
|
||||
zend_wrong_parameter_class_error(2, "FFI\\CData or string", zv2);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
ret = memcmp(ptr1, ptr2, size);
|
||||
@@ -4416,7 +4416,7 @@ ZEND_METHOD(FFI, isNull) /* {{{ */
|
||||
ZVAL_DEREF(zv);
|
||||
if (Z_TYPE_P(zv) != IS_OBJECT || Z_OBJCE_P(zv) != zend_ffi_cdata_ce) {
|
||||
zend_wrong_parameter_class_error(1, "FFI\\CData", zv);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
cdata = (zend_ffi_cdata*)Z_OBJ_P(zv);
|
||||
|
||||
+17
-8
@@ -10,7 +10,7 @@ final class FFI
|
||||
|
||||
public static function load(string $filename): ?FFI {}
|
||||
|
||||
public static function scope(string $name): ?FFI {}
|
||||
public static function scope(string $name): FFI {}
|
||||
|
||||
public static function new(FFI\CType|string $type, bool $owned = true, bool $persistent = false): ?FFI\CData {}
|
||||
|
||||
@@ -18,7 +18,7 @@ final class FFI
|
||||
public static function free(FFI\CData $ptr): void {}
|
||||
|
||||
/**
|
||||
* @param FFI\CData|string|int|null $ptr
|
||||
* @param FFI\CData|int|float|bool|null $ptr
|
||||
* @prefer-ref $ptr
|
||||
*/
|
||||
public static function cast(FFI\CType|string $type, $ptr): ?FFI\CData {}
|
||||
@@ -26,18 +26,18 @@ final class FFI
|
||||
public static function type(string $type): ?FFI\CType {}
|
||||
|
||||
/** @prefer-ref $ptr */
|
||||
public static function typeof(FFI\CData $ptr): ?FFI\CType {}
|
||||
public static function typeof(FFI\CData $ptr): FFI\CType {}
|
||||
|
||||
public static function arrayType(FFI\CType $type, array $dimensions): ?FFI\CType {}
|
||||
public static function arrayType(FFI\CType $type, array $dimensions): FFI\CType {}
|
||||
|
||||
/** @prefer-ref $ptr */
|
||||
public static function addr(FFI\CData $ptr): FFI\CData {}
|
||||
|
||||
/** @prefer-ref $ptr */
|
||||
public static function sizeof(object $ptr): ?int {}
|
||||
public static function sizeof(FFI\CData|FFI\CType $ptr): int {}
|
||||
|
||||
/** @prefer-ref $ptr */
|
||||
public static function alignof(object $ptr): ?int {}
|
||||
public static function alignof(FFI\CData|FFI\CType $ptr): int {}
|
||||
|
||||
/**
|
||||
* @param FFI\CData|string $from
|
||||
@@ -52,13 +52,13 @@ final class FFI
|
||||
* @prefer-ref $ptr2
|
||||
* @param string|FFI\CData $ptr2
|
||||
*/
|
||||
public static function memcmp($ptr1, $ptr2, int $size): ?int {}
|
||||
public static function memcmp($ptr1, $ptr2, int $size): int {}
|
||||
|
||||
/** @prefer-ref $ptr */
|
||||
public static function memset(FFI\CData $ptr, int $value, int $size): void {}
|
||||
|
||||
/** @prefer-ref $ptr */
|
||||
public static function string(FFI\CData $ptr, ?int $size = null): ?string {}
|
||||
public static function string(FFI\CData $ptr, ?int $size = null): string {}
|
||||
|
||||
/** @prefer-ref $ptr */
|
||||
public static function isNull(FFI\CData $ptr): bool {}
|
||||
@@ -68,8 +68,17 @@ final class FFI
|
||||
|
||||
namespace FFI {
|
||||
|
||||
final class CData {
|
||||
}
|
||||
|
||||
final class CType {
|
||||
public function getName() : string {}
|
||||
}
|
||||
|
||||
class Exception extends \Error {
|
||||
}
|
||||
|
||||
final class ParserException extends Exception {
|
||||
}
|
||||
|
||||
}
|
||||
+23
-8
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: abd3bc186ae3f71f2b7eb1d47f3b6bab84fb2bda */
|
||||
* Stub hash: b01d17eaac68e56d3f2c2c2bc86d44bcc8ea7c26 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cdef, 0, 0, FFI, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, code, IS_STRING, 0, "\"\"")
|
||||
@@ -10,7 +10,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_load, 0, 1, FFI, 1)
|
||||
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_scope, 0, 1, FFI, 1)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_scope, 0, 1, FFI, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
@@ -33,11 +33,11 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_type, 0, 1, FFI\\CType,
|
||||
ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_typeof, 0, 1, FFI\\CType, 1)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_typeof, 0, 1, FFI\\CType, 0)
|
||||
ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, ptr, FFI\\CData, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_arrayType, 0, 2, FFI\\CType, 1)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_arrayType, 0, 2, FFI\\CType, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, type, FFI\\CType, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, dimensions, IS_ARRAY, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -46,8 +46,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_addr, 0, 1, FFI\\CData,
|
||||
ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, ptr, FFI\\CData, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_sizeof, 0, 1, IS_LONG, 1)
|
||||
ZEND_ARG_TYPE_INFO(ZEND_SEND_PREFER_REF, ptr, IS_OBJECT, 0)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_sizeof, 0, 1, IS_LONG, 0)
|
||||
ZEND_ARG_OBJ_TYPE_MASK(ZEND_SEND_PREFER_REF, ptr, FFI\\CData|FFI\\CType, 0, NULL)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_class_FFI_alignof arginfo_class_FFI_sizeof
|
||||
@@ -58,7 +58,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_memcpy, 0, 3, IS_VOID,
|
||||
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_memcmp, 0, 3, IS_LONG, 1)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_memcmp, 0, 3, IS_LONG, 0)
|
||||
ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr1)
|
||||
ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr2)
|
||||
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
|
||||
@@ -70,7 +70,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_memset, 0, 3, IS_VOID,
|
||||
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_string, 0, 1, IS_STRING, 1)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_string, 0, 1, IS_STRING, 0)
|
||||
ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, ptr, FFI\\CData, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, size, IS_LONG, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -125,7 +125,22 @@ static const zend_function_entry class_FFI_methods[] = {
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_FFI_CData_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_FFI_CType_methods[] = {
|
||||
ZEND_ME(FFI_CType, getName, arginfo_class_FFI_CType_getName, ZEND_ACC_PUBLIC)
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_FFI_Exception_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_FFI_ParserException_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
@@ -215,7 +215,7 @@ PHP_FUNCTION(finfo_open)
|
||||
char resolved_path[MAXPATHLEN];
|
||||
zend_error_handling zeh;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lp", &options, &file, &file_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lp!", &options, &file, &file_len) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
class finfo
|
||||
{
|
||||
/** @alias finfo_open */
|
||||
public function __construct(int $flags = FILEINFO_NONE, string $magic_database = "") {}
|
||||
public function __construct(int $flags = FILEINFO_NONE, ?string $magic_database = null) {}
|
||||
|
||||
/**
|
||||
* @param resource|null $context
|
||||
@@ -29,7 +29,7 @@ class finfo
|
||||
}
|
||||
|
||||
/** @return resource|false */
|
||||
function finfo_open(int $flags = FILEINFO_NONE, string $magic_database = "") {}
|
||||
function finfo_open(int $flags = FILEINFO_NONE, ?string $magic_database = null) {}
|
||||
|
||||
/**
|
||||
* @param resource $finfo
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: be858509df27550b51d8a7a51a3629eceb6d0aa6 */
|
||||
* Stub hash: 648085986695281bd5a8fb536d5ec6c2a9f8c6e8 */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_open, 0, 0, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, magic_database, IS_STRING, 0, "\"\"")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, magic_database, IS_STRING, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_finfo_close, 0, 1, _IS_BOOL, 0)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
VERSION=5.37
|
||||
VERSION=5.39
|
||||
if [[ ! -d libmagic.orig ]]; then
|
||||
mkdir libmagic.orig
|
||||
wget -O - ftp://ftp.astron.com/pub/file/file-$VERSION.tar.gz \
|
||||
|
||||
+57
-50
@@ -1,6 +1,6 @@
|
||||
diff -ur libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
--- libmagic.orig/apprentice.c 2020-05-09 20:57:15.000000000 +0200
|
||||
+++ libmagic/apprentice.c 2020-08-29 19:56:29.638061530 +0200
|
||||
+++ libmagic/apprentice.c 2020-11-07 14:41:13.543842900 +0100
|
||||
@@ -29,6 +29,8 @@
|
||||
* apprentice - make one pass through /etc/magic, learning its secrets.
|
||||
*/
|
||||
@@ -927,9 +927,9 @@ diff -ur libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
m->str_range = swap4(m->str_range);
|
||||
m->str_flags = swap4(m->str_flags);
|
||||
}
|
||||
diff -ur libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
--- libmagic.orig/ascmagic.c 2020-06-15 02:01:01.000000000 +0200
|
||||
+++ libmagic/ascmagic.c 2020-08-29 02:05:56.212049441 +0200
|
||||
+++ libmagic/ascmagic.c 2020-11-07 14:41:13.543842900 +0100
|
||||
@@ -50,7 +50,7 @@
|
||||
#define ISSPC(x) ((x) == ' ' || (x) == '\t' || (x) == '\r' || (x) == '\n' \
|
||||
|| (x) == 0x85 || (x) == '\f')
|
||||
@@ -993,9 +993,9 @@ diff -ur libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
{
|
||||
size_t i;
|
||||
unsigned char *end = buf + len;
|
||||
diff -ur libmagic.orig/buffer.c libmagic/buffer.c
|
||||
diff -u libmagic.orig/buffer.c libmagic/buffer.c
|
||||
--- libmagic.orig/buffer.c 2020-02-16 16:52:49.000000000 +0100
|
||||
+++ libmagic/buffer.c 2020-08-29 02:05:56.212049441 +0200
|
||||
+++ libmagic/buffer.c 2020-11-07 14:41:13.543842900 +0100
|
||||
@@ -31,19 +31,23 @@
|
||||
#endif /* lint */
|
||||
|
||||
@@ -1049,9 +1049,9 @@ diff -ur libmagic.orig/buffer.c libmagic/buffer.c
|
||||
b->ebuf = NULL;
|
||||
goto out;
|
||||
}
|
||||
diff -ur libmagic.orig/cdf.c libmagic/cdf.c
|
||||
diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
--- libmagic.orig/cdf.c 2019-09-30 17:42:50.000000000 +0200
|
||||
+++ libmagic/cdf.c 2020-08-29 02:05:56.212049441 +0200
|
||||
+++ libmagic/cdf.c 2020-11-07 14:41:13.559464400 +0100
|
||||
@@ -43,7 +43,17 @@
|
||||
#include <err.h>
|
||||
#endif
|
||||
@@ -1284,9 +1284,9 @@ diff -ur libmagic.orig/cdf.c libmagic/cdf.c
|
||||
}
|
||||
|
||||
#endif
|
||||
diff -ur libmagic.orig/cdf.h libmagic/cdf.h
|
||||
diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
--- libmagic.orig/cdf.h 2019-09-30 17:42:50.000000000 +0200
|
||||
+++ libmagic/cdf.h 2020-07-04 12:40:36.663619335 +0200
|
||||
+++ libmagic/cdf.h 2020-10-09 14:15:33.483358900 +0200
|
||||
@@ -35,10 +35,10 @@
|
||||
#ifndef _H_CDF_
|
||||
#define _H_CDF_
|
||||
@@ -1301,9 +1301,9 @@ diff -ur libmagic.orig/cdf.h libmagic/cdf.h
|
||||
#endif
|
||||
#ifdef __DJGPP__
|
||||
#define timespec timeval
|
||||
diff -ur libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
--- libmagic.orig/cdf_time.c 2019-03-12 21:43:05.000000000 +0100
|
||||
+++ libmagic/cdf_time.c 2020-07-04 12:40:36.667619309 +0200
|
||||
+++ libmagic/cdf_time.c 2020-10-09 14:15:33.484360000 +0200
|
||||
@@ -23,6 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1330,9 +1330,9 @@ diff -ur libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
if (ptr != NULL)
|
||||
return buf;
|
||||
(void)snprintf(buf, 26, "*Bad* %#16.16" INT64_T_FORMAT "x\n",
|
||||
diff -ur libmagic.orig/compress.c libmagic/compress.c
|
||||
diff -u libmagic.orig/compress.c libmagic/compress.c
|
||||
--- libmagic.orig/compress.c 2020-05-31 02:11:06.000000000 +0200
|
||||
+++ libmagic/compress.c 2020-08-29 02:05:56.212049441 +0200
|
||||
+++ libmagic/compress.c 2020-11-07 14:41:13.559464400 +0100
|
||||
@@ -51,7 +51,7 @@
|
||||
#ifndef HAVE_SIG_T
|
||||
typedef void (*sig_t)(int);
|
||||
@@ -1467,9 +1467,9 @@ diff -ur libmagic.orig/compress.c libmagic/compress.c
|
||||
}
|
||||
#endif
|
||||
+#endif
|
||||
diff -ur libmagic.orig/der.c libmagic/der.c
|
||||
diff -u libmagic.orig/der.c libmagic/der.c
|
||||
--- libmagic.orig/der.c 2020-06-15 02:01:01.000000000 +0200
|
||||
+++ libmagic/der.c 2020-08-29 11:56:12.303522747 +0200
|
||||
+++ libmagic/der.c 2020-11-07 14:41:13.559464400 +0100
|
||||
@@ -54,7 +54,9 @@
|
||||
#include "magic.h"
|
||||
#include "der.h"
|
||||
@@ -1480,9 +1480,9 @@ diff -ur libmagic.orig/der.c libmagic/der.c
|
||||
#include <sys/stat.h>
|
||||
#include <err.h>
|
||||
#endif
|
||||
diff -ur libmagic.orig/elfclass.h libmagic/elfclass.h
|
||||
diff -u libmagic.orig/elfclass.h libmagic/elfclass.h
|
||||
--- libmagic.orig/elfclass.h 2019-02-20 02:30:19.000000000 +0100
|
||||
+++ libmagic/elfclass.h 2020-07-04 12:40:36.667619309 +0200
|
||||
+++ libmagic/elfclass.h 2020-10-09 14:15:33.488358700 +0200
|
||||
@@ -41,7 +41,7 @@
|
||||
return toomany(ms, "program headers", phnum);
|
||||
flags |= FLAGS_IS_CORE;
|
||||
@@ -1510,9 +1510,9 @@ diff -ur libmagic.orig/elfclass.h libmagic/elfclass.h
|
||||
CAST(size_t, elf_getu16(swap, elfhdr.e_shentsize)),
|
||||
fsize, elf_getu16(swap, elfhdr.e_machine),
|
||||
CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
|
||||
diff -ur libmagic.orig/encoding.c libmagic/encoding.c
|
||||
diff -u libmagic.orig/encoding.c libmagic/encoding.c
|
||||
--- libmagic.orig/encoding.c 2019-06-10 23:34:41.000000000 +0200
|
||||
+++ libmagic/encoding.c 2020-08-29 02:05:56.212049441 +0200
|
||||
+++ libmagic/encoding.c 2020-11-07 14:41:13.559464400 +0100
|
||||
@@ -43,14 +43,14 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -1700,9 +1700,9 @@ diff -ur libmagic.orig/encoding.c libmagic/encoding.c
|
||||
|
||||
if (ubf[*ulen - 1] == 0xfffe)
|
||||
return 0;
|
||||
diff -ur libmagic.orig/file.h libmagic/file.h
|
||||
diff -u libmagic.orig/file.h libmagic/file.h
|
||||
--- libmagic.orig/file.h 2020-06-15 02:01:01.000000000 +0200
|
||||
+++ libmagic/file.h 2020-09-02 17:35:51.709611515 +0200
|
||||
+++ libmagic/file.h 2020-11-24 13:44:41.506472900 +0100
|
||||
@@ -33,17 +33,13 @@
|
||||
#ifndef __file_h__
|
||||
#define __file_h__
|
||||
@@ -1725,7 +1725,7 @@ diff -ur libmagic.orig/file.h libmagic/file.h
|
||||
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS
|
||||
@@ -79,10 +75,11 @@
|
||||
@@ -79,23 +75,26 @@
|
||||
#include <stdio.h> /* Include that here, to make sure __P gets defined */
|
||||
#include <errno.h>
|
||||
#include <fcntl.h> /* For open and flags */
|
||||
@@ -1740,7 +1740,14 @@ diff -ur libmagic.orig/file.h libmagic/file.h
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
/* Do this here and now, because struct stat gets re-defined on solaris */
|
||||
@@ -95,7 +92,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
+#define abort() zend_error_noreturn(E_ERROR, "fatal libmagic error")
|
||||
+
|
||||
#define ENABLE_CONDITIONALS
|
||||
|
||||
#ifndef MAGIC
|
||||
#define MAGIC "/etc/magic"
|
||||
#endif
|
||||
|
||||
@@ -1749,7 +1756,7 @@ diff -ur libmagic.orig/file.h libmagic/file.h
|
||||
#define PATHSEP ';'
|
||||
#else
|
||||
#define PATHSEP ':'
|
||||
@@ -129,12 +126,6 @@
|
||||
@@ -129,12 +128,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1762,7 +1769,7 @@ diff -ur libmagic.orig/file.h libmagic/file.h
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
@@ -161,10 +152,10 @@
|
||||
@@ -161,10 +154,10 @@
|
||||
|
||||
struct buffer {
|
||||
int fd;
|
||||
@@ -1775,7 +1782,7 @@ diff -ur libmagic.orig/file.h libmagic/file.h
|
||||
void *ebuf;
|
||||
size_t elen;
|
||||
};
|
||||
@@ -258,7 +249,7 @@
|
||||
@@ -258,7 +251,7 @@
|
||||
#define FILE_OFFSET 50
|
||||
#define FILE_NAMES_SIZE 51 /* size of array to contain all names */
|
||||
|
||||
@@ -1784,7 +1791,7 @@ diff -ur libmagic.orig/file.h libmagic/file.h
|
||||
((t) == FILE_STRING || \
|
||||
(t) == FILE_PSTRING || \
|
||||
(t) == FILE_BESTRING16 || \
|
||||
@@ -464,21 +455,17 @@
|
||||
@@ -464,21 +457,17 @@
|
||||
};
|
||||
|
||||
/* Type for Unicode characters */
|
||||
@@ -1810,7 +1817,7 @@ diff -ur libmagic.orig/file.h libmagic/file.h
|
||||
protected int file_separator(struct magic_set *);
|
||||
protected char *file_copystr(char *, size_t, size_t, const char *);
|
||||
protected int file_checkfmt(char *, size_t, const char *);
|
||||
@@ -486,48 +473,42 @@
|
||||
@@ -486,48 +475,42 @@
|
||||
protected int file_print_guid(char *, size_t, const uint64_t *);
|
||||
protected int file_parse_guid(const char *, uint64_t *);
|
||||
protected int file_replace(struct magic_set *, const char *, const char *);
|
||||
@@ -1867,7 +1874,7 @@ diff -ur libmagic.orig/file.h libmagic/file.h
|
||||
size_t *);
|
||||
protected size_t file_pstring_length_size(struct magic_set *,
|
||||
const struct magic *);
|
||||
@@ -539,34 +520,12 @@
|
||||
@@ -539,34 +522,12 @@
|
||||
size_t);
|
||||
#endif /* __EMX__ */
|
||||
|
||||
@@ -1904,7 +1911,7 @@ diff -ur libmagic.orig/file.h libmagic/file.h
|
||||
|
||||
typedef struct {
|
||||
char *buf;
|
||||
@@ -582,23 +541,10 @@
|
||||
@@ -582,23 +543,10 @@
|
||||
extern const size_t file_nnames;
|
||||
#endif
|
||||
|
||||
@@ -1930,7 +1937,7 @@ diff -ur libmagic.orig/file.h libmagic/file.h
|
||||
size_t strlcat(char *, const char *, size_t);
|
||||
#endif
|
||||
#ifndef HAVE_STRCASESTR
|
||||
@@ -614,39 +560,6 @@
|
||||
@@ -614,39 +562,6 @@
|
||||
#ifndef HAVE_ASCTIME_R
|
||||
char *asctime_r(const struct tm *, char *);
|
||||
#endif
|
||||
@@ -1970,7 +1977,7 @@ diff -ur libmagic.orig/file.h libmagic/file.h
|
||||
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H) && !defined(QUICK)
|
||||
#define QUICK
|
||||
@@ -676,4 +589,16 @@
|
||||
@@ -676,4 +591,16 @@
|
||||
#define __RCSID(a)
|
||||
#endif
|
||||
|
||||
@@ -1987,9 +1994,9 @@ diff -ur libmagic.orig/file.h libmagic/file.h
|
||||
+#endif
|
||||
+
|
||||
#endif /* __file_h__ */
|
||||
diff -ur libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
--- libmagic.orig/fsmagic.c 2019-07-16 15:30:32.000000000 +0200
|
||||
+++ libmagic/fsmagic.c 2020-08-29 02:05:56.212049441 +0200
|
||||
+++ libmagic/fsmagic.c 2020-11-07 14:41:13.559464400 +0100
|
||||
@@ -66,26 +66,10 @@
|
||||
# define minor(dev) ((dev) & 0xff)
|
||||
#endif
|
||||
@@ -2280,9 +2287,9 @@ diff -ur libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
#ifdef S_IFSOCK
|
||||
#ifndef __COHERENT__
|
||||
case S_IFSOCK:
|
||||
diff -ur libmagic.orig/funcs.c libmagic/funcs.c
|
||||
diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
--- libmagic.orig/funcs.c 2020-02-20 16:50:20.000000000 +0100
|
||||
+++ libmagic/funcs.c 2020-08-29 11:56:12.303522747 +0200
|
||||
+++ libmagic/funcs.c 2020-11-07 14:41:13.559464400 +0100
|
||||
@@ -48,6 +48,13 @@
|
||||
#define SIZE_MAX ((size_t)~0)
|
||||
#endif
|
||||
@@ -2655,9 +2662,9 @@ diff -ur libmagic.orig/funcs.c libmagic/funcs.c
|
||||
return rbuf;
|
||||
}
|
||||
|
||||
diff -ur libmagic.orig/magic.c libmagic/magic.c
|
||||
diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
--- libmagic.orig/magic.c 2020-06-15 02:01:01.000000000 +0200
|
||||
+++ libmagic/magic.c 2020-08-29 11:56:12.303522747 +0200
|
||||
+++ libmagic/magic.c 2020-11-07 14:41:13.559464400 +0100
|
||||
@@ -25,11 +25,6 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
@@ -3131,9 +3138,9 @@ diff -ur libmagic.orig/magic.c libmagic/magic.c
|
||||
return NULL;
|
||||
}
|
||||
return file_getbuffer(ms);
|
||||
diff -ur libmagic.orig/magic.h libmagic/magic.h
|
||||
--- libmagic.orig/magic.h 2020-06-29 01:13:35.424557511 +0200
|
||||
+++ libmagic/magic.h 2020-08-29 02:05:56.212049441 +0200
|
||||
diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
--- libmagic.orig/magic.h 2020-11-24 13:45:15.355600300 +0100
|
||||
+++ libmagic/magic.h 2020-11-07 14:41:13.559464400 +0100
|
||||
@@ -126,6 +126,7 @@
|
||||
|
||||
const char *magic_getpath(const char *, int);
|
||||
@@ -3142,9 +3149,9 @@ diff -ur libmagic.orig/magic.h libmagic/magic.h
|
||||
const char *magic_descriptor(magic_t, int);
|
||||
const char *magic_buffer(magic_t, const void *, size_t);
|
||||
|
||||
diff -ur libmagic.orig/print.c libmagic/print.c
|
||||
diff -u libmagic.orig/print.c libmagic/print.c
|
||||
--- libmagic.orig/print.c 2020-05-09 20:57:15.000000000 +0200
|
||||
+++ libmagic/print.c 2020-08-29 11:56:12.303522747 +0200
|
||||
+++ libmagic/print.c 2020-11-07 14:41:13.559464400 +0100
|
||||
@@ -28,6 +28,7 @@
|
||||
/*
|
||||
* print.c - debugging printout routines
|
||||
@@ -3207,9 +3214,9 @@ diff -ur libmagic.orig/print.c libmagic/print.c
|
||||
|
||||
if (pp == NULL)
|
||||
goto out;
|
||||
diff -ur libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
--- libmagic.orig/readcdf.c 2019-09-30 17:42:50.000000000 +0200
|
||||
+++ libmagic/readcdf.c 2020-08-29 02:05:56.212049441 +0200
|
||||
+++ libmagic/readcdf.c 2020-11-07 14:41:13.559464400 +0100
|
||||
@@ -31,7 +31,11 @@
|
||||
|
||||
#include <assert.h>
|
||||
@@ -3331,9 +3338,9 @@ diff -ur libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
out0:
|
||||
/* If we handled it already, return */
|
||||
if (i != -1)
|
||||
diff -ur libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
--- libmagic.orig/softmagic.c 2020-06-15 02:01:01.000000000 +0200
|
||||
+++ libmagic/softmagic.c 2020-09-02 20:04:00.794667114 +0200
|
||||
+++ libmagic/softmagic.c 2020-11-07 14:41:13.559464400 +0100
|
||||
@@ -43,6 +43,10 @@
|
||||
#include <time.h>
|
||||
#include "der.h"
|
||||
@@ -3682,9 +3689,9 @@ diff -ur libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
break;
|
||||
}
|
||||
case FILE_INDIRECT:
|
||||
diff -ur libmagic.orig/strcasestr.c libmagic/strcasestr.c
|
||||
diff -u libmagic.orig/strcasestr.c libmagic/strcasestr.c
|
||||
--- libmagic.orig/strcasestr.c 2014-09-11 17:05:33.000000000 +0200
|
||||
+++ libmagic/strcasestr.c 2020-07-04 12:40:36.675619260 +0200
|
||||
+++ libmagic/strcasestr.c 2020-10-09 14:15:33.499288400 +0200
|
||||
@@ -39,6 +39,8 @@
|
||||
|
||||
#include "file.h"
|
||||
|
||||
@@ -86,6 +86,8 @@
|
||||
#include <sys/stat.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define abort() zend_error_noreturn(E_ERROR, "fatal libmagic error")
|
||||
|
||||
#define ENABLE_CONDITIONALS
|
||||
|
||||
#ifndef MAGIC
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
0 string 1
|
||||
>1 regex \^[0-9:,\ ]*-->[0-9:,\ ]* SubRip File
|
||||
!:mime text/x-srt
|
||||
|
||||
0 lelong 0xc3cbc6c5 RISC OS Chunk data
|
||||
>12 string OBJ_ \b, AOF object
|
||||
>12 string LIB_ \b, ALF library
|
||||
|
||||
0 name mach-o \b [
|
||||
>0 use mach-o-cpu \b
|
||||
>(8.L) indirect 8 \b:
|
||||
>0 belong x \b]
|
||||
|
||||
0 belong 0xcafed00d JAR compressed with pack200,
|
||||
>5 byte x version %d.
|
||||
>4 byte x \b%d
|
||||
!:mime application/x-java-pack200
|
||||
|
||||
# Objective-C
|
||||
0 regex \^#import Objective-C source text
|
||||
!:strength + 25
|
||||
!:mime text/x-objective-c
|
||||
|
||||
0 string \x20\x20\x20\x20\x20\x20\x20\x20-:\x20\x20\x20\ 0:Source:
|
||||
>&0 search/128 \x20\x20\x20\x20\x20\x20\x20\x20-:\x20\x20\x20\ 0:Graph:
|
||||
>>&0 search/128 \x20\x20\x20\x20\x20\x20\x20\x20-:\x20\x20\x20\ 0:Data: GCOV coverage report
|
||||
|
||||
0 name certinfo
|
||||
>0 der seq
|
||||
>>&0 der set
|
||||
>>>&0 der seq
|
||||
>>>>&0 der obj_id3=550406
|
||||
>>>>&0 der prt_str=x \b, countryName=%s
|
||||
>>&0 der set
|
||||
>>>&0 der seq
|
||||
>>>>&0 der obj_id3=550408
|
||||
>>>>&0 der utf8_str=x \b, stateOrProvinceName=%s
|
||||
>>&0 der set
|
||||
>>>&0 der seq
|
||||
>>>>&0 der obj_id3=55040a
|
||||
>>>>&0 der utf8_str=x \b, organizationName=%s
|
||||
>>&0 der set
|
||||
>>>&0 der seq
|
||||
>>>>&0 der obj_id3=550403
|
||||
>>>>&0 der utf8_str=x \b, commonName=%s
|
||||
>>&0 der seq
|
||||
|
||||
0 search/1 FONT ASCII vfont text
|
||||
0 short 0436 Berkeley vfont data
|
||||
0 short 017001 byte-swapped Berkeley vfont data
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #77961 (finfo_open crafted magic parsing SIGABRT)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('fileinfo')) die('skip fileinfo extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
finfo_open(FILEINFO_NONE, __DIR__ . '/bug77961.magic');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: finfo_open(): Expected numeric type got `indirect' in %s on line %d
|
||||
|
||||
Fatal error: fatal libmagic error in %s on line %d
|
||||
@@ -233,6 +233,9 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
p++; len--;
|
||||
if (allow_hex && (*p == 'x' || *p == 'X')) {
|
||||
p++; len--;
|
||||
if (len == 0) {
|
||||
RETURN_VALIDATION_FAILED
|
||||
}
|
||||
if (php_filter_parse_hex(p, len, &ctx_value) < 0) {
|
||||
error = 1;
|
||||
}
|
||||
@@ -553,6 +556,22 @@ void php_filter_validate_domain(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int is_userinfo_valid(zend_string *str)
|
||||
{
|
||||
const char *valid = "-._~!$&'()*+,;=:";
|
||||
const char *p = ZSTR_VAL(str);
|
||||
while (p - ZSTR_VAL(str) < ZSTR_LEN(str)) {
|
||||
if (isalpha(*p) || isdigit(*p) || strchr(valid, *p)) {
|
||||
p++;
|
||||
} else if (*p == '%' && p - ZSTR_VAL(str) <= ZSTR_LEN(str) - 3 && isdigit(*(p+1)) && isxdigit(*(p+2))) {
|
||||
p += 3;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
{
|
||||
php_url *url;
|
||||
@@ -608,6 +627,13 @@ bad_url:
|
||||
php_url_free(url);
|
||||
RETURN_VALIDATION_FAILED
|
||||
}
|
||||
|
||||
if (url->user != NULL && !is_userinfo_valid(url->user)) {
|
||||
php_url_free(url);
|
||||
RETURN_VALIDATION_FAILED
|
||||
|
||||
}
|
||||
|
||||
php_url_free(url);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #77423 (parse_url() will deliver a wrong host to user)
|
||||
--FILE--
|
||||
<?php
|
||||
$urls = array(
|
||||
"http://php.net\@aliyun.com/aaa.do",
|
||||
"https://example.com\uFF03@bing.com",
|
||||
);
|
||||
foreach ($urls as $url) {
|
||||
var_dump(filter_var($url, FILTER_VALIDATE_URL));
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #80584: "0x" and "0X" are considered valid hex numbers by filter_var()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('filter')) die('skip filter extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(filter_var('0x', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX));
|
||||
var_dump(filter_var('0X', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX));
|
||||
var_dump(filter_var('', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX));
|
||||
var_dump(filter_var('0', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
int(0)
|
||||
Loaded 100 of 609 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user