mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-26 18:35:42 +00:00
Compare commits
1190
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38a4b934ca | ||
|
|
dccbb79445 | ||
|
|
860f0ca1aa | ||
|
|
be8f557e77 | ||
|
|
6696cbcc9a | ||
|
|
0ff7fb02e1 | ||
|
|
96783bdfb7 | ||
|
|
1a50c27f99 | ||
|
|
d4cfc15514 | ||
|
|
4dc952b190 | ||
|
|
5cd607d1a7 | ||
|
|
4796204a4c | ||
|
|
9c20452ee0 | ||
|
|
638466a641 | ||
|
|
317e8058e0 | ||
|
|
1d28acb437 | ||
|
|
ce8f7cb794 | ||
|
|
4fb177b916 | ||
|
|
1ddecc9d12 | ||
|
|
a582692720 | ||
|
|
ede2963963 | ||
|
|
bc92917e73 | ||
|
|
5168611127 | ||
|
|
2044884812 | ||
|
|
ba19cc7b45 | ||
|
|
0f42656fed | ||
|
|
047a39c946 | ||
|
|
e88c8cbb7b | ||
|
|
14b9658a38 | ||
|
|
36a0950b39 | ||
|
|
70707a58c9 | ||
|
|
3eaf40c3fc | ||
|
|
6162a993dd | ||
|
|
5f79883497 | ||
|
|
5e750feb21 | ||
|
|
6e10627d54 | ||
|
|
bc2b0d8ba3 | ||
|
|
4be58a12d8 | ||
|
|
f166237626 | ||
|
|
9112c2f122 | ||
|
|
af53cc6799 | ||
|
|
abad64c50e | ||
|
|
d308724d19 | ||
|
|
582bf28311 | ||
|
|
295cec706e | ||
|
|
ef05ba6411 | ||
|
|
2fb527660d | ||
|
|
18405e9dff | ||
|
|
4d647197cf | ||
|
|
69ae149b4f | ||
|
|
10248d3b5a | ||
|
|
fa6ba0ecdb | ||
|
|
87da8f58e2 | ||
|
|
ed70f02b29 | ||
|
|
1ad45a3741 | ||
|
|
300a8df8f4 | ||
|
|
78fef11fe5 | ||
|
|
beac52a78b | ||
|
|
39fa14d089 | ||
|
|
3a66f6343c | ||
|
|
af0bc1a306 | ||
|
|
65fcde6651 | ||
|
|
be0563b5b0 | ||
|
|
5ea53dc6df | ||
|
|
3fdbb0d39f | ||
|
|
63d06ce9b0 | ||
|
|
f224455520 | ||
|
|
adbb44537a | ||
|
|
78bbfd7fac | ||
|
|
bed93450cd | ||
|
|
be9c9da186 | ||
|
|
61363d4751 | ||
|
|
8cea765858 | ||
|
|
0190e37ec6 | ||
|
|
2a2649ed0a | ||
|
|
7b8ba8e3e3 | ||
|
|
b186b2774a | ||
|
|
816e21982e | ||
|
|
43d15abf72 | ||
|
|
17a7912eff | ||
|
|
e7a92a913f | ||
|
|
e993862fb5 | ||
|
|
549b251691 | ||
|
|
16e4b43f8c | ||
|
|
7b5c1cd562 | ||
|
|
586f3a87f0 | ||
|
|
a54d442de1 | ||
|
|
e6ccba4b14 | ||
|
|
3eeda5e804 | ||
|
|
3b37fe3bde | ||
|
|
65f17d672d | ||
|
|
28dbadeb1d | ||
|
|
2d83dca7be | ||
|
|
8647f4e7f5 | ||
|
|
d753db3a81 | ||
|
|
bd9a370701 | ||
|
|
05db0cbcc0 | ||
|
|
1ccc6d0a73 | ||
|
|
b643fcddd1 | ||
|
|
94cfa3a120 | ||
|
|
734d1b8e6f | ||
|
|
90d31780c9 | ||
|
|
a4de08ea89 | ||
|
|
ff5f498f58 | ||
|
|
bb9b9d7d29 | ||
|
|
93e8fb39df | ||
|
|
befb267ddf | ||
|
|
175ab77029 | ||
|
|
eca2c0462f | ||
|
|
a30ef13ad8 | ||
|
|
465fe9f0de | ||
|
|
cd064187da | ||
|
|
4dd4f728ce | ||
|
|
463b450595 | ||
|
|
f6c611fd84 | ||
|
|
558795d02b | ||
|
|
d69911515a | ||
|
|
88ba1e9eb5 | ||
|
|
c801f53102 | ||
|
|
729079fc66 | ||
|
|
fdc8dbe9d9 | ||
|
|
98f03086bb | ||
|
|
f2f78bc053 | ||
|
|
a005010ef6 | ||
|
|
4fc459e424 | ||
|
|
23679f5a01 | ||
|
|
beb11f69f3 | ||
|
|
1648d83e6d | ||
|
|
f6b64e93dd | ||
|
|
533dab176c | ||
|
|
9a7f242f86 | ||
|
|
2fd7f7c825 | ||
|
|
b923de2a8f | ||
|
|
9a5cb51ebc | ||
|
|
8cda1af604 | ||
|
|
c9e9151bb3 | ||
|
|
c4e6c12b71 | ||
|
|
d7a5bd11e5 | ||
|
|
a30ebbdb18 | ||
|
|
e7719f949a | ||
|
|
d55c85d795 | ||
|
|
33b5108a2b | ||
|
|
d5c924750b | ||
|
|
110c17f8b8 | ||
|
|
9d972d3956 | ||
|
|
3ea59f0d51 | ||
|
|
7b7d2952a6 | ||
|
|
da452e33e7 | ||
|
|
06eff86e4d | ||
|
|
44772c2cb5 | ||
|
|
237c1bf7b5 | ||
|
|
eeea68592f | ||
|
|
7e8616620d | ||
|
|
44dcdd146d | ||
|
|
205543143f | ||
|
|
a72d90cb6d | ||
|
|
190c7772c1 | ||
|
|
bf0d383aba | ||
|
|
7d62a321c7 | ||
|
|
b35c788a62 | ||
|
|
ff390d788f | ||
|
|
c907406c79 | ||
|
|
6c1cdd0814 | ||
|
|
971a4a52e3 | ||
|
|
1f8153a533 | ||
|
|
be7934b91b | ||
|
|
60846fab58 | ||
|
|
f27eaa1578 | ||
|
|
2e8e2db82a | ||
|
|
ac42ddf586 | ||
|
|
ba32bba8c2 | ||
|
|
c98fcaafe7 | ||
|
|
798e2e75b5 | ||
|
|
c5668d1fae | ||
|
|
6fb3434592 | ||
|
|
7af9b01e26 | ||
|
|
8903518423 | ||
|
|
0e764dc657 | ||
|
|
472579280f | ||
|
|
7061c35725 | ||
|
|
6597d86389 | ||
|
|
eacab735e0 | ||
|
|
8aaec7d1c3 | ||
|
|
202dcc0f6a | ||
|
|
ee42849f8f | ||
|
|
37f4f132fc | ||
|
|
4c6816ddf2 | ||
|
|
dc02b5a1fd | ||
|
|
15896155c4 | ||
|
|
f08e8772a7 | ||
|
|
0893a13e32 | ||
|
|
f197dafd1c | ||
|
|
f65cdd0a46 | ||
|
|
39c41e6c1d | ||
|
|
247d7d7b14 | ||
|
|
d82da76d19 | ||
|
|
e56176479c | ||
|
|
31ca11d1b6 | ||
|
|
7f42e62d22 | ||
|
|
66500333cf | ||
|
|
71a82be899 | ||
|
|
45e2a557f1 | ||
|
|
d329b89a55 | ||
|
|
5ed1bdf9a5 | ||
|
|
2adf9e6235 | ||
|
|
ae850328a1 | ||
|
|
11e47b1cdc | ||
|
|
d76a6a3e4d | ||
|
|
210b444e1d | ||
|
|
ba8cdc855d | ||
|
|
0c14569584 | ||
|
|
27868a0966 | ||
|
|
c91ad8233b | ||
|
|
485e999d9c | ||
|
|
79e0c273b8 | ||
|
|
1c7f54d4f7 | ||
|
|
cbb1097770 | ||
|
|
7554d07945 | ||
|
|
9fedc08613 | ||
|
|
e2bdd42758 | ||
|
|
b281016972 | ||
|
|
e2cab1d888 | ||
|
|
236e3188db | ||
|
|
83c302840e | ||
|
|
3828b5d83d | ||
|
|
8da5217cd5 | ||
|
|
68969026fc | ||
|
|
4347713fd2 | ||
|
|
febe423643 | ||
|
|
6edc84fcdf | ||
|
|
4bc8f94b58 | ||
|
|
fb5c7cda5d | ||
|
|
3834771b2e | ||
|
|
d9078c7c8d | ||
|
|
90bce9f1e8 | ||
|
|
4b8c098f02 | ||
|
|
b1396cc7a5 | ||
|
|
82857031f0 | ||
|
|
b972c10f3c | ||
|
|
aafce7353e | ||
|
|
9f3a98b124 | ||
|
|
473cd4d6a9 | ||
|
|
586f379b88 | ||
|
|
909ef53e9d | ||
|
|
4e89151159 | ||
|
|
ceca4d2490 | ||
|
|
a0445644e0 | ||
|
|
8e08f6c28d | ||
|
|
c4259f90b1 | ||
|
|
d7c02a47fd | ||
|
|
6dd41435a3 | ||
|
|
350d9db222 | ||
|
|
4d7f63385b | ||
|
|
c2a93ba3af | ||
|
|
1eee68d3f4 | ||
|
|
2726001dd0 | ||
|
|
0f62b94971 | ||
|
|
3b61e3ec1e | ||
|
|
a791671f40 | ||
|
|
3aa6f8bfdd | ||
|
|
dc6b14149d | ||
|
|
727fac6290 | ||
|
|
9debf41bfd | ||
|
|
874a0bb7eb | ||
|
|
28e0a2129b | ||
|
|
daa34699af | ||
|
|
7072db5a6b | ||
|
|
4be5d97f3d | ||
|
|
c0e5d95ca6 | ||
|
|
ab5405e800 | ||
|
|
2741cf56a4 | ||
|
|
aa6f6ca864 | ||
|
|
2bdb887975 | ||
|
|
4904be6d94 | ||
|
|
d21056176a | ||
|
|
806e540a4f | ||
|
|
03dfe0d5e0 | ||
|
|
529060dbc9 | ||
|
|
374a796daa | ||
|
|
dcdf236467 | ||
|
|
bb45daeb75 | ||
|
|
74fff1512a | ||
|
|
36a7f48e84 | ||
|
|
ff42d2a644 | ||
|
|
8a43325b38 | ||
|
|
9cefeea860 | ||
|
|
d5f79e40e5 | ||
|
|
a40c20f764 | ||
|
|
4b7148711b | ||
|
|
676864684b | ||
|
|
807d937e91 | ||
|
|
2bf13b2042 | ||
|
|
15acd4ee50 | ||
|
|
5b83f7252a | ||
|
|
9673f66da6 | ||
|
|
a3541301eb | ||
|
|
aaad97675a | ||
|
|
89a9acea1f | ||
|
|
d501707248 | ||
|
|
5b5b9b9239 | ||
|
|
3b82a477b0 | ||
|
|
fd45f1eb78 | ||
|
|
e3cfbef33f | ||
|
|
d788a85736 | ||
|
|
9eb4bc2f84 | ||
|
|
bc7dc1913c | ||
|
|
4e5195f82c | ||
|
|
89eab884d9 | ||
|
|
84efb8fc71 | ||
|
|
f5d48e8524 | ||
|
|
86096a99ec | ||
|
|
f1fc5a5bf5 | ||
|
|
ee039d5a1a | ||
|
|
deb56c010e | ||
|
|
cfce5a4d02 | ||
|
|
a053e69991 | ||
|
|
feb4eb850d | ||
|
|
998f506b6d | ||
|
|
24850c5662 | ||
|
|
7691926bbe | ||
|
|
49c20cdfcb | ||
|
|
7b5b2b4efa | ||
|
|
511a375e60 | ||
|
|
208e580ebc | ||
|
|
61028ad45e | ||
|
|
e4f1eee6c3 | ||
|
|
a92c5b14cf | ||
|
|
ee4e5ce2cf | ||
|
|
42c134df4b | ||
|
|
3213959080 | ||
|
|
aca07343ce | ||
|
|
4f71b9022d | ||
|
|
d384422f27 | ||
|
|
25e57e702b | ||
|
|
0c04890354 | ||
|
|
5866c701a2 | ||
|
|
28c917923d | ||
|
|
614a69fe1d | ||
|
|
681e1a5ce0 | ||
|
|
d599d36d49 | ||
|
|
bbc37e78e8 | ||
|
|
73008bb5ce | ||
|
|
aeec64b7f4 | ||
|
|
f92f7f05e9 | ||
|
|
5980e987d2 | ||
|
|
7010a933d1 | ||
|
|
25dfcf4fdd | ||
|
|
de137e5a8d | ||
|
|
127eb33b84 | ||
|
|
972a6bd0f7 | ||
|
|
e15f7decd1 | ||
|
|
e141592da6 | ||
|
|
f5182741a6 | ||
|
|
3458dac342 | ||
|
|
21643019c0 | ||
|
|
bd5a5e7f7a | ||
|
|
85ff0a75e3 | ||
|
|
e5613c17fc | ||
|
|
cf9966671c | ||
|
|
01d5e28057 | ||
|
|
7957d672bc | ||
|
|
f7e5a97076 | ||
|
|
aab2e8eb7e | ||
|
|
4560d412bb | ||
|
|
2487493f83 | ||
|
|
3957288cf7 | ||
|
|
b1ea854100 | ||
|
|
fba53c888b | ||
|
|
a86e869ee8 | ||
|
|
fd09f3f059 | ||
|
|
4facc35413 | ||
|
|
5122ece265 | ||
|
|
82dfe1acc8 | ||
|
|
5fefc0ce47 | ||
|
|
aaccf60fea | ||
|
|
9aaea81cfe | ||
|
|
3572a0482d | ||
|
|
83b00bbd08 | ||
|
|
6951bea25e | ||
|
|
9dd5099566 | ||
|
|
2a468115e3 | ||
|
|
8edaa10eab | ||
|
|
e9883779a0 | ||
|
|
32d9409a24 | ||
|
|
6fe34014f0 | ||
|
|
28beaaad9c | ||
|
|
42f084c692 | ||
|
|
24cc7c0be2 | ||
|
|
47df90a765 | ||
|
|
e797e058c5 | ||
|
|
ac875f8f7e | ||
|
|
4ff4837966 | ||
|
|
19aafe43b2 | ||
|
|
250ee4c17a | ||
|
|
6e7d24dd14 | ||
|
|
b502c0a3dc | ||
|
|
b209c27302 | ||
|
|
af6c11c5f0 | ||
|
|
0f53e37494 | ||
|
|
c9f909cd42 | ||
|
|
63d390cdf9 | ||
|
|
826064410c | ||
|
|
9e4ab7c53f | ||
|
|
57a6209051 | ||
|
|
73db3cda8b | ||
|
|
79d1c70e99 | ||
|
|
056f3441fd | ||
|
|
9ac081f295 | ||
|
|
4e9b54757a | ||
|
|
d40315a09d | ||
|
|
bcfee0ada4 | ||
|
|
a3c7971f94 | ||
|
|
7844fb292c | ||
|
|
717dcdaa67 | ||
|
|
764190c1d6 | ||
|
|
6b34343479 | ||
|
|
8b72df0608 | ||
|
|
408ae9a452 | ||
|
|
b923ee32c9 | ||
|
|
1085d21693 | ||
|
|
bd3e5aab1d | ||
|
|
8785e22bca | ||
|
|
4aca887f8b | ||
|
|
10cd3f86b7 | ||
|
|
b8b4591265 | ||
|
|
e2df932ef0 | ||
|
|
50f09d8256 | ||
|
|
173bd989cd | ||
|
|
d0ab1e4ea4 | ||
|
|
fb4678f1ac | ||
|
|
c0476ff44b | ||
|
|
1a4863d560 | ||
|
|
8d0b174eea | ||
|
|
3e65d7dad0 | ||
|
|
65fd18fd88 | ||
|
|
d6713f3989 | ||
|
|
ef56cfb991 | ||
|
|
a5720b4493 | ||
|
|
c676f5b36d | ||
|
|
734c28d242 | ||
|
|
d031758b49 | ||
|
|
1dc85bfa6c | ||
|
|
bd0a8f31a4 | ||
|
|
03e36cd5b8 | ||
|
|
b3c43a1aec | ||
|
|
79eb697f48 | ||
|
|
0493099786 | ||
|
|
3af0ee0ea3 | ||
|
|
c02acf3c29 | ||
|
|
5ae8f624a1 | ||
|
|
713b69adf8 | ||
|
|
87f348a1e7 | ||
|
|
4267b15630 | ||
|
|
5aba79affa | ||
|
|
62f0ffb34e | ||
|
|
4363b38657 | ||
|
|
09e6ef3986 | ||
|
|
ca8ff0725b | ||
|
|
e07dfa96b3 | ||
|
|
ad358593a8 | ||
|
|
6daa84f199 | ||
|
|
2f77629f72 | ||
|
|
e540839c8b | ||
|
|
056f6fd895 | ||
|
|
63ea29a206 | ||
|
|
a06a89dba6 | ||
|
|
392f6830a1 | ||
|
|
389b4d411e | ||
|
|
276b9767e4 | ||
|
|
c699696c43 | ||
|
|
8d64f0ee71 | ||
|
|
67eccf8617 | ||
|
|
bd88bed670 | ||
|
|
209ec406ca | ||
|
|
ea7a70708f | ||
|
|
1c462a4e4d | ||
|
|
9c5a902106 | ||
|
|
78f2ded86a | ||
|
|
a2e77fb258 | ||
|
|
07e97f919d | ||
|
|
f9affb5ae9 | ||
|
|
aaca4ede15 | ||
|
|
f4a96983e1 | ||
|
|
62fa84a031 | ||
|
|
5bc9e006e8 | ||
|
|
6a2a2b52f9 | ||
|
|
befdd1770a | ||
|
|
523a6b50ae | ||
|
|
8ce521a6a7 | ||
|
|
621862a192 | ||
|
|
e700cbff22 | ||
|
|
85251eccaf | ||
|
|
e11fbd979f | ||
|
|
2bf271bbb0 | ||
|
|
5b1f6caaf0 | ||
|
|
94fcc9e8c7 | ||
|
|
0cc89be244 | ||
|
|
b77d6bb2b4 | ||
|
|
e2b75e5bb7 | ||
|
|
1b1b706818 | ||
|
|
3f2f1b2661 | ||
|
|
3926362d30 | ||
|
|
f500be8838 | ||
|
|
b0a551ee14 | ||
|
|
f2fc935502 | ||
|
|
98e273bb03 | ||
|
|
ba51a375ae | ||
|
|
db025b3789 | ||
|
|
e1a5edaac2 | ||
|
|
88456894b9 | ||
|
|
6125278290 | ||
|
|
6b8a78eb5f | ||
|
|
f58d0b35ed | ||
|
|
e75b967610 | ||
|
|
551569262b | ||
|
|
ce4ba54583 | ||
|
|
5d263adf4c | ||
|
|
a16217d4a4 | ||
|
|
a981798d8e | ||
|
|
cfb76d53f7 | ||
|
|
e9224fc81b | ||
|
|
5f3e76dfe5 | ||
|
|
ba5a1995bb | ||
|
|
af362b20c6 | ||
|
|
f62aa10f3e | ||
|
|
942f91ff0f | ||
|
|
8709cc6d60 | ||
|
|
0b8f946ea5 | ||
|
|
d5daea505f | ||
|
|
b1abe4ca21 | ||
|
|
6d938321ff | ||
|
|
df7db6519c | ||
|
|
b11b3d201f | ||
|
|
26096aa73f | ||
|
|
74aea4e471 | ||
|
|
8432557dcd | ||
|
|
a8a36b7d52 | ||
|
|
fcb28ea97f | ||
|
|
aed4b086ac | ||
|
|
c83598119b | ||
|
|
d02340bb39 | ||
|
|
f883d3cc7a | ||
|
|
ed5a8d510f | ||
|
|
f70f89c1b1 | ||
|
|
520d969fea | ||
|
|
432e91f112 | ||
|
|
e6b471933c | ||
|
|
bd58146ad6 | ||
|
|
2eb9bd316d | ||
|
|
d14670ccdb | ||
|
|
9576330979 | ||
|
|
4cdcbeec76 | ||
|
|
8aa7f84dd2 | ||
|
|
83edc59d13 | ||
|
|
dc45cfe401 | ||
|
|
b90cc170b6 | ||
|
|
1337ba8a62 | ||
|
|
170c4d1fe6 | ||
|
|
167fdaa0e7 | ||
|
|
3e90132341 | ||
|
|
c0f1e6946d | ||
|
|
72389dd53f | ||
|
|
a9c503bc27 | ||
|
|
ac719610f4 | ||
|
|
5613d70ee8 | ||
|
|
d7d0ceb90d | ||
|
|
a56274b3f1 | ||
|
|
68d3353e5c | ||
|
|
409498f03c | ||
|
|
d51ff1322d | ||
|
|
82d67af60d | ||
|
|
ca25f3d829 | ||
|
|
34848ccae7 | ||
|
|
48dcc43488 | ||
|
|
304d97933f | ||
|
|
897d11658a | ||
|
|
964141f781 | ||
|
|
fc4761a07c | ||
|
|
2cfb1c5bb9 | ||
|
|
e0c5db0970 | ||
|
|
4c68e81018 | ||
|
|
009528ba43 | ||
|
|
7266938012 | ||
|
|
50377b5bf2 | ||
|
|
389188df7f | ||
|
|
3c494e25e3 | ||
|
|
f4d27d83ac | ||
|
|
bb5f5e1671 | ||
|
|
4973f3a312 | ||
|
|
37594963b3 | ||
|
|
4651c74405 | ||
|
|
d2ed9b3d30 | ||
|
|
79c06bb896 | ||
|
|
e64e7e6ffc | ||
|
|
872734be58 | ||
|
|
1040cdf8fc | ||
|
|
735f930bac | ||
|
|
985d8f0436 | ||
|
|
512cbad00c | ||
|
|
316fd8aab6 | ||
|
|
931071aa97 | ||
|
|
d87dc25b71 | ||
|
|
3a8ee7800c | ||
|
|
73a7351a2c | ||
|
|
936124742b | ||
|
|
1007374254 | ||
|
|
f806f4d060 | ||
|
|
9b829c92b5 | ||
|
|
914de05bf5 | ||
|
|
e92ea13bff | ||
|
|
1433dec2d0 | ||
|
|
0fc8e6af0a | ||
|
|
4411641b1e | ||
|
|
8708b13d62 | ||
|
|
6a299514f8 | ||
|
|
0fbb421ec1 | ||
|
|
fd4a7388d7 | ||
|
|
c0e87e9bb1 | ||
|
|
bdc565e67a | ||
|
|
9d08f09e06 | ||
|
|
bc1c2b3b31 | ||
|
|
a23bcba875 | ||
|
|
8738e6d86f | ||
|
|
e0c7899ddd | ||
|
|
58b754ca4a | ||
|
|
fa2a2c88fd | ||
|
|
6d5c56367d | ||
|
|
a1803faea2 | ||
|
|
adb70b9923 | ||
|
|
05fe153f49 | ||
|
|
98d929290c | ||
|
|
fa1802381f | ||
|
|
2301e190e7 | ||
|
|
2f707bf246 | ||
|
|
d3f9debcae | ||
|
|
4670d46a42 | ||
|
|
9a5944d960 | ||
|
|
35b8f57906 | ||
|
|
19161b8d4e | ||
|
|
27990438f1 | ||
|
|
8e29235b6c | ||
|
|
34e5236836 | ||
|
|
ad4f0c7812 | ||
|
|
77d4db3957 | ||
|
|
d439b3970a | ||
|
|
a697297f5f | ||
|
|
90c5689b59 | ||
|
|
6eaf57eb3c | ||
|
|
1dafdaa31b | ||
|
|
78265a44c5 | ||
|
|
c786c30108 | ||
|
|
5acc0c0c5b | ||
|
|
b260cb92e4 | ||
|
|
da62a38244 | ||
|
|
6b6a4e466a | ||
|
|
f195339006 | ||
|
|
21fd125343 | ||
|
|
f7f8c590a5 | ||
|
|
757c93dd85 | ||
|
|
325224832b | ||
|
|
912be12432 | ||
|
|
d3acd878d0 | ||
|
|
f9816d6729 | ||
|
|
b97156113e | ||
|
|
31a4d08d37 | ||
|
|
20217b04b4 | ||
|
|
3982b3eccf | ||
|
|
0494cf46cf | ||
|
|
8b7a8aff13 | ||
|
|
9510451fb1 | ||
|
|
e3ebe995c9 | ||
|
|
d81d61fcc4 | ||
|
|
01a13bb8c1 | ||
|
|
7fdf6b51d2 | ||
|
|
c253fbda9a | ||
|
|
adb1e38468 | ||
|
|
e881537089 | ||
|
|
122805100a | ||
|
|
4d703a4225 | ||
|
|
a0622d7c68 | ||
|
|
42b1222754 | ||
|
|
de3b9bc77c | ||
|
|
fbfae33e39 | ||
|
|
0cb38a3d26 | ||
|
|
9adfcea241 | ||
|
|
ecf95a4cc5 | ||
|
|
44ff944b37 | ||
|
|
5a420c8680 | ||
|
|
406d5a5ecc | ||
|
|
7228ac190a | ||
|
|
3142989a14 | ||
|
|
3930766e79 | ||
|
|
55023a87b0 | ||
|
|
e51ddf9dc8 | ||
|
|
8f11f7f179 | ||
|
|
72e7a63485 | ||
|
|
c14d14e0d6 | ||
|
|
fbb87ace85 | ||
|
|
fd6e5766ce | ||
|
|
f0c85fab45 | ||
|
|
b0415856fd | ||
|
|
9e309a2d10 | ||
|
|
a7f0465c0b | ||
|
|
f4912e3a96 | ||
|
|
8e11fa2251 | ||
|
|
727d14b8dd | ||
|
|
b13e715581 | ||
|
|
0ee45382cd | ||
|
|
71be6bc5ec | ||
|
|
d1baf6c9d7 | ||
|
|
b3265e2108 | ||
|
|
e23b051be0 | ||
|
|
7193efebed | ||
|
|
da7d62ea8a | ||
|
|
48cc47d55a | ||
|
|
2fc14d515e | ||
|
|
f7df15ea53 | ||
|
|
8710929b78 | ||
|
|
1488acb304 | ||
|
|
a87233f98a | ||
|
|
ce6945eb55 | ||
|
|
a68477f758 | ||
|
|
c23a1f78b4 | ||
|
|
7cd702640d | ||
|
|
df484b0008 | ||
|
|
f8148a3905 | ||
|
|
86c806a36e | ||
|
|
d7827068e8 | ||
|
|
8f91e77245 | ||
|
|
7e85b12b53 | ||
|
|
b34ce97417 | ||
|
|
1acee05579 | ||
|
|
6b9396bd8e | ||
|
|
66a42402d9 | ||
|
|
ae2103ba40 | ||
|
|
eb922c6c9c | ||
|
|
d76d415f55 | ||
|
|
f3703d86f7 | ||
|
|
ef216c21fd | ||
|
|
cb9000f15e | ||
|
|
52611a2c7e | ||
|
|
508738251f | ||
|
|
004d4630b4 | ||
|
|
2e0a960e97 | ||
|
|
065c8e77e2 | ||
|
|
628135641d | ||
|
|
22779fa66b | ||
|
|
9c16a4b96d | ||
|
|
f119cd8f2d | ||
|
|
e094c64b67 | ||
|
|
9a834807bc | ||
|
|
d8fa7f4990 | ||
|
|
40f9958c08 | ||
|
|
132bd2130d | ||
|
|
eabdd0e4a5 | ||
|
|
23019318b1 | ||
|
|
3ffecac916 | ||
|
|
e6bf5ffeba | ||
|
|
f65e652f9f | ||
|
|
9f9e691c28 | ||
|
|
3659dcd98c | ||
|
|
51d78c2533 | ||
|
|
0eb519de66 | ||
|
|
57db68e03d | ||
|
|
f92eba241e | ||
|
|
77cdda452d | ||
|
|
ef54a95b71 | ||
|
|
262fca3a39 | ||
|
|
d9a036cc30 | ||
|
|
9e5c10e487 | ||
|
|
d8fbc23002 | ||
|
|
91e6fb75d5 | ||
|
|
38574614c5 | ||
|
|
5ced3db971 | ||
|
|
a7862de2db | ||
|
|
0d65cd50dd | ||
|
|
b6ef87f803 | ||
|
|
a1193b23b6 | ||
|
|
fd7d31973a | ||
|
|
609efa2623 | ||
|
|
7fa9032d0b | ||
|
|
4e2ddbc397 | ||
|
|
be5b98ef0d | ||
|
|
1e2cc15845 | ||
|
|
46448539b0 | ||
|
|
3f7522a652 | ||
|
|
de453dbef6 | ||
|
|
98f3c410d9 | ||
|
|
fe451e9a72 | ||
|
|
d135198559 | ||
|
|
2c3cc2e107 | ||
|
|
e7a6d0b163 | ||
|
|
ef52220617 | ||
|
|
45d399b96e | ||
|
|
fca64efd62 | ||
|
|
0fd48b2f48 | ||
|
|
bec270ffc8 | ||
|
|
b9c19f5d74 | ||
|
|
bc68ab8b57 | ||
|
|
a3cb536d24 | ||
|
|
42a35c9b8b | ||
|
|
8115844674 | ||
|
|
e9f2de918d | ||
|
|
3baad45b21 | ||
|
|
b64ac1faa3 | ||
|
|
9960ecc5cd | ||
|
|
0336763311 | ||
|
|
def8981190 | ||
|
|
74f9e6309c | ||
|
|
1d2150ca4f | ||
|
|
358fae9347 | ||
|
|
54797a9b15 | ||
|
|
dd7c33d0c9 | ||
|
|
4c96b94873 | ||
|
|
943ba2bf07 | ||
|
|
0d61202427 | ||
|
|
ccd1babbfc | ||
|
|
bbdcbbdba5 | ||
|
|
9c036b13f9 | ||
|
|
1d65e8f135 | ||
|
|
8b83b48e98 | ||
|
|
e5998bbda2 | ||
|
|
d508a094ae | ||
|
|
34a55790f2 | ||
|
|
f88a3e7fb9 | ||
|
|
e2f2a3fcb5 | ||
|
|
7e856fb09b | ||
|
|
854c9abcd4 | ||
|
|
b3ce714cbf | ||
|
|
a45082e78d | ||
|
|
36a3011613 | ||
|
|
8e50280163 | ||
|
|
0938a6266a | ||
|
|
704b24d048 | ||
|
|
923518fab8 | ||
|
|
5300caade1 | ||
|
|
c6adc039a1 | ||
|
|
a218f8f3a4 | ||
|
|
3198533e92 | ||
|
|
d8c7d69543 | ||
|
|
215811e3fd | ||
|
|
08bbd2b510 | ||
|
|
9cc9a10efd | ||
|
|
cbf40edf06 | ||
|
|
a73c8812a1 | ||
|
|
9238345922 | ||
|
|
4a6981433d | ||
|
|
639924fa2c | ||
|
|
db40b1c037 | ||
|
|
52afd818eb | ||
|
|
28cb72f480 | ||
|
|
7f0d637de4 | ||
|
|
e09e45eb86 | ||
|
|
f88c30507c | ||
|
|
015d179e49 | ||
|
|
607f97cefa | ||
|
|
51003463ef | ||
|
|
fb27e16f01 | ||
|
|
c63f8bdfba | ||
|
|
5e3d047a07 | ||
|
|
7156c5cb39 | ||
|
|
6a60a03859 | ||
|
|
6f2d32fd1f | ||
|
|
bccead024d | ||
|
|
b2ca20312d | ||
|
|
726d803375 | ||
|
|
e7b54a3aa7 | ||
|
|
f7bd3db224 | ||
|
|
aee386bb30 | ||
|
|
b41a2755c4 | ||
|
|
d34f4454f0 | ||
|
|
e68792dbb2 | ||
|
|
0cac40e879 | ||
|
|
c398bdd4a3 | ||
|
|
a833f7d460 | ||
|
|
365603916e | ||
|
|
383ddcde2b | ||
|
|
9e3551ba1f | ||
|
|
f046189e34 | ||
|
|
b93f8e6277 | ||
|
|
5a282136a3 | ||
|
|
3e4e173296 | ||
|
|
bfa6d8d87d | ||
|
|
ae576a4309 | ||
|
|
18e4e5b350 | ||
|
|
a37ff1fa4b | ||
|
|
6cf46f49e3 | ||
|
|
a80567a929 | ||
|
|
e93c9ae26a | ||
|
|
6b229d541a | ||
|
|
b6f76adef4 | ||
|
|
bd81a99ab3 | ||
|
|
15bb12b269 | ||
|
|
b8525baecf | ||
|
|
468b2923ca | ||
|
|
e9c7342a80 | ||
|
|
ef1c2ffaf0 | ||
|
|
ae1fb8dc4b | ||
|
|
266a428a59 | ||
|
|
f90fe17424 | ||
|
|
570b1041e9 | ||
|
|
2cbd452cfb | ||
|
|
ebc2816318 | ||
|
|
c23baba693 | ||
|
|
7e20b13d86 | ||
|
|
91cb087727 | ||
|
|
57ce464a1c | ||
|
|
094c93b6f8 | ||
|
|
b7705365a2 | ||
|
|
3069b384e1 | ||
|
|
c0b112c68d | ||
|
|
7cf68266b3 | ||
|
|
637e9fc5bb | ||
|
|
fac240b5d1 | ||
|
|
7e01935dc2 | ||
|
|
90d4ae4da8 | ||
|
|
36cbe38201 | ||
|
|
ad675f6ac2 | ||
|
|
7c5af3884a | ||
|
|
c58f9eea11 | ||
|
|
c2e228b77d | ||
|
|
27a86a4402 | ||
|
|
5615326e1f | ||
|
|
43cb6ba763 | ||
|
|
8f097fb466 | ||
|
|
6357cdaecf | ||
|
|
4c13992f0d | ||
|
|
911ba0293a | ||
|
|
11d4bcd706 | ||
|
|
df312c5ddf | ||
|
|
de99f93aa5 | ||
|
|
308edceb51 | ||
|
|
98c6e0d535 | ||
|
|
0d506131af | ||
|
|
d17b684b91 | ||
|
|
117955daf6 | ||
|
|
1d93f396bb | ||
|
|
dd360d6336 | ||
|
|
446cfd3e1c | ||
|
|
48e63da659 | ||
|
|
642a8b870a | ||
|
|
e243a26b4c | ||
|
|
1ba7ceee17 | ||
|
|
0c21ecf159 | ||
|
|
3889019638 | ||
|
|
d5e835737c | ||
|
|
20ff7a2d68 | ||
|
|
23390de0e7 | ||
|
|
4fc7dc6eae | ||
|
|
f0fdb82f83 | ||
|
|
4a5fee1b36 | ||
|
|
4b6d784962 | ||
|
|
4e537ca4ca | ||
|
|
941887359b | ||
|
|
ed36099a0b | ||
|
|
615756c8ab | ||
|
|
e6095aa4cb | ||
|
|
983db235b0 | ||
|
|
582f52c173 | ||
|
|
c47840d92b | ||
|
|
8949c825c7 | ||
|
|
68ec5a9b89 | ||
|
|
866d33e1e9 | ||
|
|
52a74bbdd6 | ||
|
|
05593baf9a | ||
|
|
457f28c354 | ||
|
|
9e4a7835c5 | ||
|
|
1f261538e8 | ||
|
|
80d8037531 | ||
|
|
659d7ca634 | ||
|
|
84e13901b0 | ||
|
|
69ea580aad | ||
|
|
af4924eaea | ||
|
|
1015a29997 | ||
|
|
889b8d75fe | ||
|
|
34818356fc | ||
|
|
dfec5cf775 | ||
|
|
a5cda49fe9 | ||
|
|
3b55e60245 | ||
|
|
4f6e709a67 | ||
|
|
b24f226e93 | ||
|
|
41e0c7b1f6 | ||
|
|
4ea8803533 | ||
|
|
f8923bb076 | ||
|
|
d3f87d0ffc | ||
|
|
179d696b35 | ||
|
|
4be4279c83 | ||
|
|
832e9653d1 | ||
|
|
469b9e44fb | ||
|
|
b7f8723065 | ||
|
|
a8959d76c8 | ||
|
|
734f9e58f9 | ||
|
|
5b6f0092f4 | ||
|
|
d7d84804e6 | ||
|
|
12951f8bbd | ||
|
|
6fc93dfa6c | ||
|
|
a61c753006 | ||
|
|
51ddf600fe | ||
|
|
df0a28baab | ||
|
|
c9280f1e1c | ||
|
|
f4c91f0aa8 | ||
|
|
5d1c130506 | ||
|
|
ec49b23a4d | ||
|
|
63cf4c45ca | ||
|
|
010b8114cc | ||
|
|
dec724e98d | ||
|
|
646b5d306c | ||
|
|
6a16702e30 | ||
|
|
f7730bd47e | ||
|
|
c10c568d0f | ||
|
|
91058553c8 | ||
|
|
631628baad | ||
|
|
f6cf006496 | ||
|
|
baf3937c37 | ||
|
|
0e3420bf8f | ||
|
|
0020a89c43 | ||
|
|
9f294bf282 | ||
|
|
5748286990 | ||
|
|
b610404004 | ||
|
|
74a68df77c | ||
|
|
42fdfacae6 | ||
|
|
98ec9fdd51 | ||
|
|
6221ea90cb | ||
|
|
86c9a6f901 | ||
|
|
dc43044ffb | ||
|
|
0d0eec58f1 | ||
|
|
a296d61c05 | ||
|
|
2f39ef6596 | ||
|
|
4f62adfb2c | ||
|
|
43e05efd3b | ||
|
|
2cf827b52a | ||
|
|
0cd95c1ee0 | ||
|
|
6484eaf77e | ||
|
|
e6f90ecc27 | ||
|
|
1d861341a0 | ||
|
|
10ff0829d4 | ||
|
|
c224e239bd | ||
|
|
59ebbf5109 | ||
|
|
04c823d287 | ||
|
|
5c50e69814 | ||
|
|
f074ad207c | ||
|
|
4d86b8b507 | ||
|
|
32a8ad32e7 | ||
|
|
814b1985bc | ||
|
|
f453122b73 | ||
|
|
66db31f5c6 | ||
|
|
388928ee24 | ||
|
|
49c9e595f6 | ||
|
|
f1a05e788c | ||
|
|
fd91996c55 | ||
|
|
f16cdc0d50 | ||
|
|
765cdb22cf | ||
|
|
7f17c8c11e | ||
|
|
cc0e733baa | ||
|
|
93b6c4f2bb | ||
|
|
e9782f3a10 | ||
|
|
6bb30e2aec | ||
|
|
a296e3d032 | ||
|
|
3df4c3eb70 | ||
|
|
2e560a331d | ||
|
|
9628ac34a6 | ||
|
|
7fcd3e2721 | ||
|
|
58606fc10d | ||
|
|
08c2e821cc | ||
|
|
5352788b44 | ||
|
|
db11ad2e94 | ||
|
|
acbfd16ddf | ||
|
|
132505cd52 | ||
|
|
f350f3c9b8 | ||
|
|
16ef7e80a8 | ||
|
|
cf22d7c06b | ||
|
|
c4edc6e277 | ||
|
|
6a2c44c811 | ||
|
|
fb03ad89ef | ||
|
|
66de4151e7 | ||
|
|
e8b7f9f011 | ||
|
|
62b0f1d0fc | ||
|
|
66dd725ac7 | ||
|
|
7f22f40541 | ||
|
|
e636bea3f7 | ||
|
|
ef30289ead | ||
|
|
b0aed8f9d3 | ||
|
|
c74f0c613d | ||
|
|
32776ad023 | ||
|
|
674fb57896 | ||
|
|
39c8f8a205 | ||
|
|
66174837ef | ||
|
|
b8213906ff | ||
|
|
4b484e0278 | ||
|
|
1b523d9c93 | ||
|
|
a0dfabed1f | ||
|
|
61a1a3e39b | ||
|
|
6e4395b586 | ||
|
|
9c81da4170 | ||
|
|
14f8e16870 | ||
|
|
07b87a2a7f | ||
|
|
1492bc1d60 | ||
|
|
2545fbbdc2 | ||
|
|
2bf8f91b87 | ||
|
|
9382c75061 | ||
|
|
644278c1a3 | ||
|
|
3d49768cc2 | ||
|
|
2a28a30c4d | ||
|
|
f2a4f31bf4 | ||
|
|
6b474bbcf6 | ||
|
|
03bee19890 | ||
|
|
ba52352363 | ||
|
|
3cbf45c510 | ||
|
|
262de5d054 | ||
|
|
ff233b591c | ||
|
|
3aed22ae8e | ||
|
|
ebd2fc6b3f | ||
|
|
427cde5da6 | ||
|
|
570adc16e7 | ||
|
|
aae79a684d | ||
|
|
0f892ce613 | ||
|
|
261938b5e0 | ||
|
|
5efaa8f7b9 | ||
|
|
320e82b603 | ||
|
|
bfb0e87e2b | ||
|
|
5351aa9ac1 | ||
|
|
569cbd2081 | ||
|
|
764054c2eb | ||
|
|
5c6428b0b9 | ||
|
|
ea56c2dcfd | ||
|
|
09c3b6c1b6 | ||
|
|
bda11c6bd2 | ||
|
|
c8fbe078a1 | ||
|
|
2d44a04a83 | ||
|
|
d6c59e1d7e | ||
|
|
e2070d1409 | ||
|
|
d871982507 | ||
|
|
c8acebe674 | ||
|
|
dc29937050 | ||
|
|
91ceb295da | ||
|
|
99442a301d | ||
|
|
6b067db5fb | ||
|
|
5c754227a7 | ||
|
|
a7a797b455 | ||
|
|
715b040f46 | ||
|
|
1e53ccdf7a | ||
|
|
221b9d44a8 | ||
|
|
0773ab461e | ||
|
|
ccf2069c18 | ||
|
|
6478088a2c | ||
|
|
a95f8dbac2 | ||
|
|
88960bba1e | ||
|
|
62c1f4127b | ||
|
|
cd955c183b | ||
|
|
dc0b9d716e | ||
|
|
03cae613f0 | ||
|
|
9f177207fc | ||
|
|
46e07a6fd7 | ||
|
|
231eaa3919 | ||
|
|
13cb1b7e4a | ||
|
|
4bcc5a87d7 | ||
|
|
0605bebdb6 | ||
|
|
ec0300ec25 | ||
|
|
8b8f7d4a5a | ||
|
|
a5302f286e | ||
|
|
d4c546b956 | ||
|
|
9703f57bd1 | ||
|
|
cc3ec2936c | ||
|
|
06fe769905 | ||
|
|
c292a18514 | ||
|
|
eb5ab08267 | ||
|
|
6bd00eda6b | ||
|
|
5ae81ec123 | ||
|
|
8f7abf4371 | ||
|
|
e17ef23c2c | ||
|
|
a9b623aa0b | ||
|
|
7331e4c9c8 | ||
|
|
42c8f29277 | ||
|
|
59d95c1537 | ||
|
|
309d3b512e | ||
|
|
03ed6fc0b1 | ||
|
|
acd85d48f0 | ||
|
|
3744ff7c18 | ||
|
|
8db3e3738c | ||
|
|
bf18c56fb7 | ||
|
|
890345eda0 | ||
|
|
ca0e018c95 | ||
|
|
f4c4fe417a | ||
|
|
3db6b5112f | ||
|
|
91abad1e1b | ||
|
|
6e008d40c2 | ||
|
|
a90a93f1a4 | ||
|
|
66845fb6a5 | ||
|
|
89aea2f103 | ||
|
|
ea58b542d6 |
No files matched your search
@@ -58,13 +58,14 @@ Type specifiers
|
||||
zend_fcall_info and zend_fcall_info_cache)
|
||||
h - array (returned as HashTable*)
|
||||
H - array or HASH_OF(object) (returned as HashTable*)
|
||||
l - long (long)
|
||||
L - long, limits out-of-range numbers to LONG_MAX/LONG_MIN (long)
|
||||
i - php_int_t (zend_int_t), platform dependent
|
||||
I - php_int_t, limits out-of-range numbers to ZEND_INT_MAX/ZEND_INT_MIN (zend_int_t),
|
||||
platform dependent
|
||||
o - object of any type (zval*)
|
||||
O - object of specific type given by class entry (zval*, zend_class_entry)
|
||||
p - valid path (string without null bytes in the middle) and its length (char*, int)
|
||||
P - valid path (string without null bytes in the middle) and its length (char*, php_size_t)
|
||||
r - resource (zval*)
|
||||
s - string (with possible null bytes) and its length (char*, int)
|
||||
S - string (with possible null bytes) and its length (char*, php_size_t)
|
||||
z - the actual zval (zval*)
|
||||
Z - the actual zval (zval**)
|
||||
* - variable arguments list (0 or more)
|
||||
@@ -79,30 +80,33 @@ Type specifiers
|
||||
! - the parameter it follows can be of specified type or NULL. If NULL is
|
||||
passed and the output for such type is a pointer, then the output
|
||||
pointer is set to a native NULL pointer.
|
||||
For 'b', 'l' and 'd', an extra argument of type zend_bool* must be
|
||||
passed after the corresponding bool*, long* or double* arguments,
|
||||
For 'b', 'i' and 'd', an extra argument of type zend_bool* must be
|
||||
passed after the corresponding bool*, php_int_t* or double* arguments,
|
||||
respectively. A non-zero value will be written to the zend_bool iif a
|
||||
PHP NULL is passed.
|
||||
|
||||
|
||||
Note on 64bit compatibility
|
||||
---------------------------
|
||||
Please do not forget that int and long are two different things on 64bit
|
||||
OSes (int is 4 bytes and long is 8 bytes), so make sure you pass longs to "l"
|
||||
and ints to strings length (i.e. for "s" you need to pass char * and int),
|
||||
not the other way round!
|
||||
Remember: "l" is the only case when you need to pass long (and that's why
|
||||
it's "l", not "i" btw).
|
||||
Please do not forget that php_int_t and php_size_t are platform dependent,
|
||||
you can consult Zend/zend_int.h for which type exactly these are mapped to.
|
||||
In previous versions, long was used for integers and int for string
|
||||
sizes. Now make sure you pass php_int_t to "i" and php_size_t to strings length
|
||||
(i.e. for "S" you need to pass char * and php_size_t), not the other way round!
|
||||
Remember: "i" is the only case when you need to pass platform depnedent integer
|
||||
(and that's why it's "i", not "l" anymore). The old formats 'l' and 's' aren't
|
||||
supported anymore. Passing int instead of php_size_t, or long instead of
|
||||
php_int_t is wrong.
|
||||
|
||||
Both mistakes cause memory corruptions and segfaults on 64bit OSes:
|
||||
1)
|
||||
char *str;
|
||||
long str_len; /* XXX THIS IS WRONG!! Use int instead. */
|
||||
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len)
|
||||
int str_len; /* XXX THIS IS WRONG!! Use php_size_t instead. */
|
||||
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len)
|
||||
|
||||
2)
|
||||
int num; /* XXX THIS IS WRONG!! Use long instead. */
|
||||
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num)
|
||||
long num; /* XXX THIS IS WRONG!! Use php_int_t instead. */
|
||||
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &num)
|
||||
|
||||
If you're in doubt, use check_parameters.php script to the parameters
|
||||
and their types (it can be found in ./scripts/dev/ directory of PHP sources):
|
||||
@@ -112,12 +116,12 @@ and their types (it can be found in ./scripts/dev/ directory of PHP sources):
|
||||
|
||||
Examples
|
||||
--------
|
||||
/* Gets a long, a string and its length, and a zval */
|
||||
long l;
|
||||
/* Gets a php_int_t, a string and its length, and a zval */
|
||||
php_int_t i;
|
||||
char *s;
|
||||
int s_len;
|
||||
php_size_t s_len;
|
||||
zval *param;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsz",
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iSz",
|
||||
&l, &s, &s_len, ¶m) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -150,8 +154,8 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!",
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get either a set of 3 longs or a string. */
|
||||
long l1, l2, l3;
|
||||
/* Get either a set of 3 php_int_t vars or a string. */
|
||||
php_int_t i1, i2, i3;
|
||||
char *s;
|
||||
/*
|
||||
* The function expects a pointer to a integer in this case, not a long
|
||||
@@ -160,13 +164,13 @@ char *s;
|
||||
* properly, leading to random crashes on platforms like
|
||||
* Tru64 or Linux/Alpha.
|
||||
*/
|
||||
int length;
|
||||
php_size_t length;
|
||||
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"lll", &l1, &l2, &l3) == SUCCESS) {
|
||||
/* manipulate longs */
|
||||
"iii", &i1, &i2, &i3) == SUCCESS) {
|
||||
/* manipulate php_int_t */
|
||||
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"s", &s, &length) == SUCCESS) {
|
||||
"S", &s, &length) == SUCCESS) {
|
||||
/* manipulate string */
|
||||
} else {
|
||||
/* output error */
|
||||
@@ -197,11 +201,11 @@ if (varargs) {
|
||||
/* Function that accepts a string, followed by varargs (1 or more) */
|
||||
|
||||
char *str;
|
||||
int str_len;
|
||||
php_size_t str_len;
|
||||
int i, num_varargs;
|
||||
zval ***varargs = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s+", &str, &str_len, &varargs, &num_varargs) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S+", &str, &str_len, &varargs, &num_varargs) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -214,13 +218,13 @@ if (varargs) {
|
||||
}
|
||||
|
||||
|
||||
/* Function that takes an array, followed by varargs, and ending with a long */
|
||||
long num;
|
||||
/* Function that takes an array, followed by varargs, and ending with a php_int_t */
|
||||
php_int_t num;
|
||||
zval *array;
|
||||
int i, num_varargs;
|
||||
zval ***varargs = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a*l", &array, &varargs, &num_varargs, &num) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a*i", &array, &varargs, &num_varargs, &num) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ typedef int ts_rsrc_id;
|
||||
|
||||
/* Define THREAD_T and MUTEX_T */
|
||||
#ifdef TSRM_WIN32
|
||||
# define THREAD_T DWORD
|
||||
# define THREAD_T UINT_PTR
|
||||
# define MUTEX_T CRITICAL_SECTION *
|
||||
#elif defined(GNUPTH)
|
||||
# define THREAD_T pth_t
|
||||
|
||||
@@ -375,6 +375,10 @@ SOURCE=.\zend_istdiostream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_int.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_parser.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ int main()
|
||||
exit(1);
|
||||
}
|
||||
], [
|
||||
AC_DEFINE([ZEND_DVAL_TO_LVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits])
|
||||
AC_DEFINE([ZEND_DVAL_TO_IVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits])
|
||||
AC_MSG_RESULT(yes)
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
@@ -405,6 +405,10 @@ SOURCE=.\zend_iterators.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_int.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_parser.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
+47
-47
@@ -46,22 +46,22 @@
|
||||
|
||||
/* true multithread-shared globals */
|
||||
ZEND_API zend_class_entry *zend_standard_class_def = NULL;
|
||||
ZEND_API int (*zend_printf)(const char *format, ...);
|
||||
ZEND_API zend_size_t (*zend_printf)(const char *format, ...);
|
||||
ZEND_API zend_write_func_t zend_write;
|
||||
ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC);
|
||||
ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
|
||||
ZEND_API void (*zend_block_interruptions)(void);
|
||||
ZEND_API void (*zend_unblock_interruptions)(void);
|
||||
ZEND_API void (*zend_ticks_function)(int ticks);
|
||||
ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
|
||||
int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
|
||||
ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const zend_size_t error_lineno, const char *format, va_list args);
|
||||
zend_size_t (*zend_vspprintf)(char **pbuf, zend_size_t max_len, const char *format, va_list ap);
|
||||
ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
|
||||
ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
|
||||
ZEND_API char *(*zend_resolve_path)(const char *filename, zend_size_t filename_len TSRMLS_DC);
|
||||
|
||||
void (*zend_on_timeout)(int seconds TSRMLS_DC);
|
||||
|
||||
static void (*zend_message_dispatcher_p)(long message, const void *data TSRMLS_DC);
|
||||
static int (*zend_get_configuration_directive_p)(const char *name, uint name_length, zval *contents);
|
||||
static void (*zend_message_dispatcher_p)(zend_int_t message, const void *data TSRMLS_DC);
|
||||
static int (*zend_get_configuration_directive_p)(const char *name, zend_size_t name_length, zval *contents);
|
||||
|
||||
static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
|
||||
{
|
||||
@@ -127,7 +127,7 @@ ZEND_API zval zval_used_for_init; /* True global variable */
|
||||
|
||||
/* version information */
|
||||
static char *zend_version_info;
|
||||
static uint zend_version_info_length;
|
||||
static zend_size_t zend_version_info_length;
|
||||
#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2014 Zend Technologies\n"
|
||||
#define PRINT_ZVAL_INDENT 4
|
||||
|
||||
@@ -136,8 +136,8 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
|
||||
zval **tmp;
|
||||
char *string_key;
|
||||
HashPosition iterator;
|
||||
ulong num_key;
|
||||
uint str_len;
|
||||
zend_uint_t num_key;
|
||||
zend_size_t str_len;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < indent; i++) {
|
||||
@@ -155,8 +155,8 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
|
||||
case HASH_KEY_IS_STRING:
|
||||
if (is_object) {
|
||||
const char *prop_name, *class_name;
|
||||
int prop_len;
|
||||
int mangled = zend_unmangle_property_name_ex(string_key, str_len - 1, &class_name, &prop_name, &prop_len);
|
||||
zend_size_t prop_len;
|
||||
zend_size_t mangled = zend_unmangle_property_name_ex(string_key, str_len - 1, &class_name, &prop_name, &prop_len);
|
||||
|
||||
ZEND_WRITE_EX(prop_name, prop_len);
|
||||
if (class_name && mangled == SUCCESS) {
|
||||
@@ -172,10 +172,10 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
|
||||
ZEND_WRITE_EX(string_key, str_len-1);
|
||||
}
|
||||
break;
|
||||
case HASH_KEY_IS_LONG:
|
||||
case HASH_KEY_IS_INT:
|
||||
{
|
||||
char key[25];
|
||||
snprintf(key, sizeof(key), "%ld", num_key);
|
||||
snprintf(key, sizeof(key), ZEND_INT_FMT, num_key);
|
||||
ZEND_PUTS_EX(key);
|
||||
}
|
||||
break;
|
||||
@@ -198,8 +198,8 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */
|
||||
zval **tmp;
|
||||
char *string_key;
|
||||
HashPosition iterator;
|
||||
ulong num_key;
|
||||
uint str_len;
|
||||
zend_uint_t num_key;
|
||||
zend_size_t str_len;
|
||||
int i = 0;
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(ht, &iterator);
|
||||
@@ -212,8 +212,8 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */
|
||||
case HASH_KEY_IS_STRING:
|
||||
ZEND_PUTS(string_key);
|
||||
break;
|
||||
case HASH_KEY_IS_LONG:
|
||||
zend_printf("%ld", num_key);
|
||||
case HASH_KEY_IS_INT:
|
||||
zend_printf(ZEND_INT_FMT, num_key);
|
||||
break;
|
||||
}
|
||||
ZEND_PUTS("] => ");
|
||||
@@ -231,26 +231,26 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
|
||||
}
|
||||
switch (Z_TYPE_P(expr)) {
|
||||
case IS_NULL:
|
||||
Z_STRLEN_P(expr_copy) = 0;
|
||||
Z_STRSIZE_P(expr_copy) = 0;
|
||||
Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC();
|
||||
break;
|
||||
case IS_BOOL:
|
||||
if (Z_LVAL_P(expr)) {
|
||||
Z_STRLEN_P(expr_copy) = 1;
|
||||
if (Z_IVAL_P(expr)) {
|
||||
Z_STRSIZE_P(expr_copy) = 1;
|
||||
Z_STRVAL_P(expr_copy) = estrndup("1", 1);
|
||||
} else {
|
||||
Z_STRLEN_P(expr_copy) = 0;
|
||||
Z_STRSIZE_P(expr_copy) = 0;
|
||||
Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC();
|
||||
}
|
||||
break;
|
||||
case IS_RESOURCE:
|
||||
Z_STRVAL_P(expr_copy) = (char *) emalloc(sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG);
|
||||
Z_STRLEN_P(expr_copy) = snprintf(Z_STRVAL_P(expr_copy), sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG, "Resource id #%ld", Z_LVAL_P(expr));
|
||||
Z_STRVAL_P(expr_copy) = (char *) emalloc(sizeof("Resource id #") - 1 + MAX_LENGTH_OF_ZEND_INT);
|
||||
Z_STRSIZE_P(expr_copy) = snprintf(Z_STRVAL_P(expr_copy), sizeof("Resource id #") - 1 + MAX_LENGTH_OF_ZEND_INT, "Resource id #" ZEND_INT_FMT, Z_IVAL_P(expr));
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
zend_error(E_NOTICE, "Array to string conversion");
|
||||
Z_STRLEN_P(expr_copy) = sizeof("Array") - 1;
|
||||
Z_STRVAL_P(expr_copy) = estrndup("Array", Z_STRLEN_P(expr_copy));
|
||||
Z_STRSIZE_P(expr_copy) = sizeof("Array") - 1;
|
||||
Z_STRVAL_P(expr_copy) = estrndup("Array", Z_STRSIZE_P(expr_copy));
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
{
|
||||
@@ -288,7 +288,7 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
|
||||
zval_ptr_dtor(&z);
|
||||
}
|
||||
zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %s could not be converted to string", Z_OBJCE_P(expr)->name);
|
||||
Z_STRLEN_P(expr_copy) = 0;
|
||||
Z_STRSIZE_P(expr_copy) = 0;
|
||||
Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC();
|
||||
}
|
||||
break;
|
||||
@@ -308,13 +308,13 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_print_zval(zval *expr, int indent) /* {{{ */
|
||||
ZEND_API zend_size_t zend_print_zval(zval *expr, int indent) /* {{{ */
|
||||
{
|
||||
return zend_print_zval_ex(zend_write, expr, indent);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent) /* {{{ */
|
||||
ZEND_API zend_size_t zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent) /* {{{ */
|
||||
{
|
||||
zval expr_copy;
|
||||
int use_copy;
|
||||
@@ -323,17 +323,17 @@ ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int in
|
||||
if (use_copy) {
|
||||
expr = &expr_copy;
|
||||
}
|
||||
if (Z_STRLEN_P(expr) == 0) { /* optimize away empty strings */
|
||||
if (Z_STRSIZE_P(expr) == 0) { /* optimize away empty strings */
|
||||
if (use_copy) {
|
||||
zval_dtor(expr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
write_func(Z_STRVAL_P(expr), Z_STRLEN_P(expr));
|
||||
write_func(Z_STRVAL_P(expr), Z_STRSIZE_P(expr));
|
||||
if (use_copy) {
|
||||
zval_dtor(expr);
|
||||
}
|
||||
return Z_STRLEN_P(expr);
|
||||
return Z_STRSIZE_P(expr);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -355,7 +355,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
HashTable *properties = NULL;
|
||||
const char *class_name = NULL;
|
||||
zend_uint clen;
|
||||
zend_size_t clen;
|
||||
|
||||
if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
|
||||
Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC);
|
||||
@@ -413,7 +413,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
|
||||
{
|
||||
HashTable *properties;
|
||||
const char *class_name = NULL;
|
||||
zend_uint clen;
|
||||
zend_size_t clen;
|
||||
int is_temp;
|
||||
|
||||
if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
|
||||
@@ -621,7 +621,7 @@ static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p
|
||||
|
||||
void zend_init_opcodes_handlers(void);
|
||||
|
||||
static zend_bool php_auto_globals_create_globals(const char *name, uint name_len TSRMLS_DC) /* {{{ */
|
||||
static zend_bool php_auto_globals_create_globals(const char *name, zend_size_t name_len TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval *globals;
|
||||
|
||||
@@ -870,7 +870,7 @@ void zenderror(const char *error) /* {{{ */
|
||||
/* }}} */
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */
|
||||
ZEND_API void _zend_bailout(char *filename, zend_size_t lineno) /* {{{ */
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
@@ -890,7 +890,7 @@ END_EXTERN_C()
|
||||
void zend_append_version_info(const zend_extension *extension) /* {{{ */
|
||||
{
|
||||
char *new_info;
|
||||
uint new_info_length;
|
||||
zend_size_t new_info_length;
|
||||
|
||||
new_info_length = sizeof(" with v, , by \n")
|
||||
+ strlen(extension->name)
|
||||
@@ -981,7 +981,7 @@ ZEND_API void zend_deactivate(TSRMLS_D) /* {{{ */
|
||||
/* }}} */
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_message_dispatcher(long message, const void *data TSRMLS_DC) /* {{{ */
|
||||
ZEND_API void zend_message_dispatcher(zend_int_t message, const void *data TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
if (zend_message_dispatcher_p) {
|
||||
zend_message_dispatcher_p(message, data TSRMLS_CC);
|
||||
@@ -990,7 +990,7 @@ ZEND_API void zend_message_dispatcher(long message, const void *data TSRMLS_DC)
|
||||
/* }}} */
|
||||
END_EXTERN_C()
|
||||
|
||||
ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents) /* {{{ */
|
||||
ZEND_API int zend_get_configuration_directive(const char *name, zend_size_t name_length, zval *contents) /* {{{ */
|
||||
{
|
||||
if (zend_get_configuration_directive_p) {
|
||||
return zend_get_configuration_directive_p(name, name_length, contents);
|
||||
@@ -1025,7 +1025,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
zval *retval;
|
||||
zval *z_error_type, *z_error_message, *z_error_filename, *z_error_lineno, *z_context;
|
||||
const char *error_filename;
|
||||
uint error_lineno;
|
||||
zend_size_t error_lineno;
|
||||
zval *orig_user_error_handler;
|
||||
zend_bool in_compilation;
|
||||
zend_class_entry *saved_class_entry;
|
||||
@@ -1150,21 +1150,21 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
# endif
|
||||
#endif
|
||||
va_copy(usr_copy, args);
|
||||
Z_STRLEN_P(z_error_message) = zend_vspprintf(&Z_STRVAL_P(z_error_message), 0, format, usr_copy);
|
||||
Z_STRSIZE_P(z_error_message) = zend_vspprintf(&Z_STRVAL_P(z_error_message), 0, format, usr_copy);
|
||||
#ifdef va_copy
|
||||
va_end(usr_copy);
|
||||
#endif
|
||||
Z_TYPE_P(z_error_message) = IS_STRING;
|
||||
|
||||
Z_LVAL_P(z_error_type) = type;
|
||||
Z_TYPE_P(z_error_type) = IS_LONG;
|
||||
Z_IVAL_P(z_error_type) = type;
|
||||
Z_TYPE_P(z_error_type) = IS_INT;
|
||||
|
||||
if (error_filename) {
|
||||
ZVAL_STRING(z_error_filename, error_filename, 1);
|
||||
}
|
||||
|
||||
Z_LVAL_P(z_error_lineno) = error_lineno;
|
||||
Z_TYPE_P(z_error_lineno) = IS_LONG;
|
||||
Z_IVAL_P(z_error_lineno) = error_lineno;
|
||||
Z_TYPE_P(z_error_lineno) = IS_INT;
|
||||
|
||||
if (!EG(active_symbol_table)) {
|
||||
zend_rebuild_symbol_table(TSRMLS_C);
|
||||
@@ -1211,7 +1211,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
|
||||
if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) {
|
||||
if (retval) {
|
||||
if (Z_TYPE_P(retval) == IS_BOOL && Z_LVAL_P(retval) == 0) {
|
||||
if (Z_TYPE_P(retval) == IS_BOOL && Z_IVAL_P(retval) == 0) {
|
||||
zend_error_cb(type, error_filename, error_lineno, format, args);
|
||||
}
|
||||
zval_ptr_dtor(&retval);
|
||||
@@ -1302,7 +1302,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
|
||||
zend_file_handle *file_handle;
|
||||
zend_op_array *orig_op_array = EG(active_op_array);
|
||||
zval **orig_retval_ptr_ptr = EG(return_value_ptr_ptr);
|
||||
long orig_interactive = CG(interactive);
|
||||
zend_int_t orig_interactive = CG(interactive);
|
||||
|
||||
va_start(files, file_count);
|
||||
for (i = 0; i < file_count; i++) {
|
||||
@@ -1378,7 +1378,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
|
||||
ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
const char *cur_filename;
|
||||
int cur_lineno;
|
||||
zend_size_t cur_lineno;
|
||||
char *compiled_string_description;
|
||||
|
||||
if (zend_is_compiling(TSRMLS_C)) {
|
||||
|
||||
+40
-40
@@ -266,14 +266,14 @@ char *alloca ();
|
||||
#define LONG_MIN (- LONG_MAX - 1)
|
||||
#endif
|
||||
|
||||
#if SIZEOF_LONG == 4
|
||||
#define MAX_LENGTH_OF_LONG 11
|
||||
static const char long_min_digits[] = "2147483648";
|
||||
#elif SIZEOF_LONG == 8
|
||||
#define MAX_LENGTH_OF_LONG 20
|
||||
static const char long_min_digits[] = "9223372036854775808";
|
||||
#if SIZEOF_ZEND_INT == 4
|
||||
#define MAX_LENGTH_OF_ZEND_INT 11
|
||||
static const char int_min_digits[] = "2147483648";
|
||||
#elif SIZEOF_ZEND_INT == 8
|
||||
#define MAX_LENGTH_OF_ZEND_INT 20
|
||||
static const char int_min_digits[] = "9223372036854775808";
|
||||
#else
|
||||
#error "Unknown SIZEOF_LONG"
|
||||
#error "Unknown SIZEOF_ZEND_INT"
|
||||
#endif
|
||||
|
||||
#define MAX_LENGTH_OF_DOUBLE 32
|
||||
@@ -320,11 +320,11 @@ typedef struct _zend_object {
|
||||
#include "zend_ast.h"
|
||||
|
||||
typedef union _zvalue_value {
|
||||
long lval; /* long value */
|
||||
zend_int_t lval; /* long value */
|
||||
double dval; /* double value */
|
||||
struct {
|
||||
char *val;
|
||||
int len;
|
||||
zend_size_t len;
|
||||
} str;
|
||||
HashTable *ht; /* hash table value */
|
||||
zend_object_value obj;
|
||||
@@ -443,12 +443,12 @@ typedef struct _zend_unserialize_data zend_unserialize_data;
|
||||
|
||||
struct _zend_trait_method_reference {
|
||||
const char* method_name;
|
||||
unsigned int mname_len;
|
||||
zend_size_t mname_len;
|
||||
|
||||
zend_class_entry *ce;
|
||||
|
||||
const char* class_name;
|
||||
unsigned int cname_len;
|
||||
zend_size_t cname_len;
|
||||
};
|
||||
typedef struct _zend_trait_method_reference zend_trait_method_reference;
|
||||
|
||||
@@ -466,7 +466,7 @@ struct _zend_trait_alias {
|
||||
* name for method to be added
|
||||
*/
|
||||
const char* alias;
|
||||
unsigned int alias_len;
|
||||
zend_size_t alias_len;
|
||||
|
||||
/**
|
||||
* modifiers to be set on trait method
|
||||
@@ -478,7 +478,7 @@ typedef struct _zend_trait_alias zend_trait_alias;
|
||||
struct _zend_class_entry {
|
||||
char type;
|
||||
const char *name;
|
||||
zend_uint name_length;
|
||||
zend_size_t name_length;
|
||||
struct _zend_class_entry *parent;
|
||||
int refcount;
|
||||
zend_uint ce_flags;
|
||||
@@ -512,11 +512,11 @@ struct _zend_class_entry {
|
||||
zend_object_value (*create_object)(zend_class_entry *class_type TSRMLS_DC);
|
||||
zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
|
||||
int (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type TSRMLS_DC); /* a class implements this interface */
|
||||
union _zend_function *(*get_static_method)(zend_class_entry *ce, char* method, int method_len TSRMLS_DC);
|
||||
union _zend_function *(*get_static_method)(zend_class_entry *ce, char* method, zend_size_t method_len TSRMLS_DC);
|
||||
|
||||
/* serializer callbacks */
|
||||
int (*serialize)(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC);
|
||||
int (*unserialize)(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);
|
||||
int (*serialize)(zval *object, unsigned char **buffer, zend_size_t *buf_len, zend_serialize_data *data TSRMLS_DC);
|
||||
int (*unserialize)(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_size_t buf_len, zend_unserialize_data *data TSRMLS_DC);
|
||||
|
||||
zend_class_entry **interfaces;
|
||||
zend_uint num_interfaces;
|
||||
@@ -529,10 +529,10 @@ struct _zend_class_entry {
|
||||
union {
|
||||
struct {
|
||||
const char *filename;
|
||||
zend_uint line_start;
|
||||
zend_uint line_end;
|
||||
zend_size_t line_start;
|
||||
zend_size_t line_end;
|
||||
const char *doc_comment;
|
||||
zend_uint doc_comment_len;
|
||||
zend_size_t doc_comment_len;
|
||||
} user;
|
||||
struct {
|
||||
const struct _zend_function_entry *builtin_functions;
|
||||
@@ -543,29 +543,29 @@ struct _zend_class_entry {
|
||||
|
||||
#include "zend_stream.h"
|
||||
typedef struct _zend_utility_functions {
|
||||
void (*error_function)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
|
||||
int (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
|
||||
int (*write_function)(const char *str, uint str_length);
|
||||
void (*error_function)(int type, const char *error_filename, const zend_size_t error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
|
||||
zend_size_t (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
|
||||
zend_size_t (*write_function)(const char *str, zend_size_t str_length);
|
||||
FILE *(*fopen_function)(const char *filename, char **opened_path TSRMLS_DC);
|
||||
void (*message_handler)(long message, const void *data TSRMLS_DC);
|
||||
void (*message_handler)(zend_int_t message, const void *data TSRMLS_DC);
|
||||
void (*block_interruptions)(void);
|
||||
void (*unblock_interruptions)(void);
|
||||
int (*get_configuration_directive)(const char *name, uint name_length, zval *contents);
|
||||
int (*get_configuration_directive)(const char *name, zend_size_t name_length, zval *contents);
|
||||
void (*ticks_function)(int ticks);
|
||||
void (*on_timeout)(int seconds TSRMLS_DC);
|
||||
int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
|
||||
int (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap);
|
||||
char *(*getenv_function)(char *name, size_t name_len TSRMLS_DC);
|
||||
char *(*resolve_path_function)(const char *filename, int filename_len TSRMLS_DC);
|
||||
zend_size_t (*vspprintf_function)(char **pbuf, zend_size_t max_len, const char *format, va_list ap);
|
||||
char *(*getenv_function)(char *name, zend_size_t name_len TSRMLS_DC);
|
||||
char *(*resolve_path_function)(const char *filename, zend_size_t filename_len TSRMLS_DC);
|
||||
} zend_utility_functions;
|
||||
|
||||
typedef struct _zend_utility_values {
|
||||
char *import_use_extension;
|
||||
uint import_use_extension_length;
|
||||
zend_size_t import_use_extension_length;
|
||||
zend_bool html_errors;
|
||||
} zend_utility_values;
|
||||
|
||||
typedef int (*zend_write_func_t)(const char *str, uint str_length);
|
||||
typedef int (*zend_write_func_t)(const char *str, zend_size_t str_length);
|
||||
|
||||
#undef MIN
|
||||
#undef MAX
|
||||
@@ -581,7 +581,7 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length);
|
||||
/* data types */
|
||||
/* All data types <= IS_BOOL have their constructor/destructors skipped */
|
||||
#define IS_NULL 0
|
||||
#define IS_LONG 1
|
||||
#define IS_INT 1
|
||||
#define IS_DOUBLE 2
|
||||
#define IS_BOOL 3
|
||||
#define IS_ARRAY 4
|
||||
@@ -612,7 +612,7 @@ void zend_post_startup(TSRMLS_D);
|
||||
void zend_set_utility_values(zend_utility_values *utility_values);
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void _zend_bailout(char *filename, uint lineno);
|
||||
ZEND_API void _zend_bailout(char *filename, zend_size_t lineno);
|
||||
END_EXTERN_C()
|
||||
|
||||
#define zend_bailout() _zend_bailout(__FILE__, __LINE__)
|
||||
@@ -646,8 +646,8 @@ END_EXTERN_C()
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API char *get_zend_version(void);
|
||||
ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy);
|
||||
ZEND_API int zend_print_zval(zval *expr, int indent);
|
||||
ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent);
|
||||
ZEND_API zend_size_t zend_print_zval(zval *expr, int indent);
|
||||
ZEND_API zend_size_t zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent);
|
||||
ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC);
|
||||
ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC);
|
||||
ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC);
|
||||
@@ -695,18 +695,18 @@ END_EXTERN_C()
|
||||
#define ZEND_PUTC(c) zend_write(&(c), 1)
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
extern ZEND_API int (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
|
||||
extern ZEND_API zend_size_t (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
|
||||
extern ZEND_API zend_write_func_t zend_write;
|
||||
extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC);
|
||||
extern ZEND_API void (*zend_block_interruptions)(void);
|
||||
extern ZEND_API void (*zend_unblock_interruptions)(void);
|
||||
extern ZEND_API void (*zend_ticks_function)(int ticks);
|
||||
extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
|
||||
extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const zend_size_t error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
|
||||
extern ZEND_API void (*zend_on_timeout)(int seconds TSRMLS_DC);
|
||||
extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
|
||||
extern int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
|
||||
extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
|
||||
extern ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
|
||||
extern zend_size_t (*zend_vspprintf)(char **pbuf, zend_size_t max_len, const char *format, va_list ap);
|
||||
extern ZEND_API char *(*zend_getenv)(char *name, zend_size_t name_len TSRMLS_DC);
|
||||
extern ZEND_API char *(*zend_resolve_path)(const char *filename, zend_size_t filename_len TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
|
||||
|
||||
@@ -733,9 +733,9 @@ END_EXTERN_C()
|
||||
#endif
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_message_dispatcher(long message, const void *data TSRMLS_DC);
|
||||
ZEND_API void zend_message_dispatcher(zend_int_t message, const void *data TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents);
|
||||
ZEND_API int zend_get_configuration_directive(const char *name, zend_size_t name_length, zval *contents);
|
||||
END_EXTERN_C()
|
||||
|
||||
/* Messages for applications of Zend */
|
||||
|
||||
+176
-169
File diff suppressed because it is too large.
Load diff
+96
-96
@@ -28,7 +28,7 @@
|
||||
#include "zend_operators.h"
|
||||
#include "zend_variables.h"
|
||||
#include "zend_execute.h"
|
||||
|
||||
#include "zend_types.h"
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
@@ -171,7 +171,7 @@ typedef struct _zend_fcall_info_cache {
|
||||
#define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, class_name_len, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \
|
||||
{ \
|
||||
const char *cl_name = class_name; \
|
||||
int _len = class_name_len; \
|
||||
zend_size_t _len = class_name_len; \
|
||||
class_container.name = zend_new_interned_string(cl_name, _len+1, 0 TSRMLS_CC); \
|
||||
if (class_container.name == cl_name) { \
|
||||
class_container.name = zend_strndup(cl_name, _len); \
|
||||
@@ -281,15 +281,15 @@ ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *cla
|
||||
ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry TSRMLS_DC);
|
||||
ZEND_API void zend_class_implements(zend_class_entry *class_entry TSRMLS_DC, int num_interfaces, ...);
|
||||
|
||||
ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_class_entry *ce TSRMLS_DC);
|
||||
ZEND_API int zend_register_class_alias_ex(const char *name, zend_size_t name_len, zend_class_entry *ce TSRMLS_DC);
|
||||
|
||||
#define zend_register_class_alias(name, ce) \
|
||||
zend_register_class_alias_ex(name, sizeof(name)-1, ce TSRMLS_CC)
|
||||
#define zend_register_ns_class_alias(ns, name, ce) \
|
||||
zend_register_class_alias_ex(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, ce TSRMLS_CC)
|
||||
|
||||
ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC);
|
||||
ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC);
|
||||
ZEND_API int zend_disable_function(char *function_name, zend_size_t function_name_length TSRMLS_DC);
|
||||
ZEND_API int zend_disable_class(char *class_name, zend_size_t class_name_length TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_wrong_param_count(TSRMLS_D);
|
||||
|
||||
@@ -300,51 +300,51 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D);
|
||||
|
||||
#define IS_CALLABLE_STRICT (IS_CALLABLE_CHECK_IS_STATIC)
|
||||
|
||||
ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint check_flags, char **callable_name, int *callable_name_len, zend_fcall_info_cache *fcc, char **error TSRMLS_DC);
|
||||
ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint check_flags, char **callable_name, zend_size_t *callable_name_len, zend_fcall_info_cache *fcc, char **error TSRMLS_DC);
|
||||
ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name TSRMLS_DC);
|
||||
ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC);
|
||||
ZEND_API const char *zend_get_module_version(const char *module_name);
|
||||
ZEND_API int zend_get_module_started(const char *module_name);
|
||||
ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, const char *doc_comment, int doc_comment_len TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, int name_length, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, int name_length, double value, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, int name_length, const char *value, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, int name_length, const char *value, int value_len, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, zend_size_t name_length, zval *property, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, zend_size_t name_length, zval *property, int access_type, const char *doc_comment, zend_size_t doc_comment_len TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, zend_size_t name_length, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, zend_size_t name_length, zend_int_t value, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_int(zend_class_entry *ce, const char *name, zend_size_t name_length, zend_int_t value, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, zend_size_t name_length, double value, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, zend_size_t name_length, const char *value, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, zend_size_t name_length, const char *value, zend_size_t value_len, int access_type TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, long value TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_bool value TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, size_t name_length, double value TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_length TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, zend_size_t name_length, zval *value TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, zend_size_t name_length TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_int(zend_class_entry *ce, const char *name, zend_size_t name_length, zend_int_t value TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, zend_size_t name_length, zend_bool value TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, zend_size_t name_length, double value TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, zend_size_t name_length, const char *value, zend_size_t value_length TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, zend_size_t name_length, const char *value TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC);
|
||||
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zval *value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, int name_length TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, int name_length, double value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, int value_length TSRMLS_DC);
|
||||
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, zend_size_t name_length, zval *value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, zend_size_t name_length TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, zend_size_t name_length, zend_int_t value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_int(zend_class_entry *scope, zval *object, const char *name, zend_size_t name_length, zend_int_t value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, zend_size_t name_length, double value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, zend_size_t name_length, const char *value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, zend_size_t name_length, const char *value, zend_size_t value_length TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, int name_length, zval *value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, int name_length TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, int name_length, double value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, int name_length, const char *value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, int name_length, const char *value, int value_length TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, zend_size_t name_length, zval *value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, zend_size_t name_length TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, zend_size_t name_length, zend_int_t value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_int(zend_class_entry *scope, const char *name, zend_size_t name_length, zend_int_t value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, zend_size_t name_length, double value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, zend_size_t name_length, const char *value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, zend_size_t name_length, const char *value, zend_size_t value_length TSRMLS_DC);
|
||||
|
||||
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_bool silent TSRMLS_DC);
|
||||
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, zend_size_t name_length, zend_bool silent TSRMLS_DC);
|
||||
|
||||
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, int name_length, zend_bool silent TSRMLS_DC);
|
||||
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, zend_size_t name_length, zend_bool silent TSRMLS_DC);
|
||||
|
||||
ZEND_API zend_class_entry *zend_get_class_entry(const zval *zobject TSRMLS_DC);
|
||||
ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_uint *class_name_len TSRMLS_DC);
|
||||
ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_size_t *class_name_len TSRMLS_DC);
|
||||
ZEND_API char *zend_get_type_by_const(int type);
|
||||
|
||||
#define getThis() (this_ptr)
|
||||
@@ -365,7 +365,7 @@ ZEND_API char *zend_get_type_by_const(int type);
|
||||
#define object_init(arg) _object_init((arg) ZEND_FILE_LINE_CC TSRMLS_CC)
|
||||
#define object_init_ex(arg, ce) _object_init_ex((arg), (ce) ZEND_FILE_LINE_CC TSRMLS_CC)
|
||||
#define object_and_properties_init(arg, ce, properties) _object_and_properties_init((arg), (ce), (properties) ZEND_FILE_LINE_CC TSRMLS_CC)
|
||||
ZEND_API int _array_init(zval *arg, uint size ZEND_FILE_LINE_DC);
|
||||
ZEND_API int _array_init(zval *arg, zend_uint_t size ZEND_FILE_LINE_DC);
|
||||
ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC);
|
||||
ZEND_API int _object_init_ex(zval *arg, zend_class_entry *ce ZEND_FILE_LINE_DC TSRMLS_DC);
|
||||
ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC);
|
||||
@@ -376,16 +376,16 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro
|
||||
/* no longer supported */
|
||||
ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS));
|
||||
|
||||
ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, long n);
|
||||
ZEND_API int add_assoc_null_ex(zval *arg, const char *key, uint key_len);
|
||||
ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b);
|
||||
ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, int r);
|
||||
ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d);
|
||||
ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate);
|
||||
ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate);
|
||||
ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value);
|
||||
ZEND_API int add_assoc_int_ex(zval *arg, const char *key, zend_size_t key_len, zend_int_t n);
|
||||
ZEND_API int add_assoc_null_ex(zval *arg, const char *key, zend_size_t key_len);
|
||||
ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, zend_size_t key_len, int b);
|
||||
ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, zend_size_t key_len, int r);
|
||||
ZEND_API int add_assoc_double_ex(zval *arg, const char *key, zend_size_t key_len, double d);
|
||||
ZEND_API int add_assoc_string_ex(zval *arg, const char *key, zend_size_t key_len, char *str, int duplicate);
|
||||
ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, zend_size_t key_len, char *str, zend_size_t length, int duplicate);
|
||||
ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, zend_size_t key_len, zval *value);
|
||||
|
||||
#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
|
||||
#define add_assoc_int(__arg, __key, __n) add_assoc_int_ex(__arg, __key, strlen(__key)+1, __n)
|
||||
#define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
|
||||
#define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b)
|
||||
#define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key)+1, __r)
|
||||
@@ -400,47 +400,47 @@ ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *v
|
||||
#define add_next_index_unset(__arg) add_next_index_null(__arg)
|
||||
#define add_property_unset(__arg, __key) add_property_null(__arg, __key)
|
||||
|
||||
ZEND_API int add_index_long(zval *arg, ulong idx, long n);
|
||||
ZEND_API int add_index_null(zval *arg, ulong idx);
|
||||
ZEND_API int add_index_bool(zval *arg, ulong idx, int b);
|
||||
ZEND_API int add_index_resource(zval *arg, ulong idx, int r);
|
||||
ZEND_API int add_index_double(zval *arg, ulong idx, double d);
|
||||
ZEND_API int add_index_string(zval *arg, ulong idx, const char *str, int duplicate);
|
||||
ZEND_API int add_index_stringl(zval *arg, ulong idx, const char *str, uint length, int duplicate);
|
||||
ZEND_API int add_index_zval(zval *arg, ulong index, zval *value);
|
||||
ZEND_API int add_index_int(zval *arg, zend_uint_t idx, zend_int_t n);
|
||||
ZEND_API int add_index_null(zval *arg, zend_uint_t idx);
|
||||
ZEND_API int add_index_bool(zval *arg, zend_uint_t idx, int b);
|
||||
ZEND_API int add_index_resource(zval *arg, zend_uint_t idx, int r);
|
||||
ZEND_API int add_index_double(zval *arg, zend_uint_t idx, double d);
|
||||
ZEND_API int add_index_string(zval *arg, zend_uint_t idx, const char *str, int duplicate);
|
||||
ZEND_API int add_index_stringl(zval *arg, zend_uint_t idx, const char *str, zend_size_t length, int duplicate);
|
||||
ZEND_API int add_index_zval(zval *arg, zend_uint_t index, zval *value);
|
||||
|
||||
ZEND_API int add_next_index_long(zval *arg, long n);
|
||||
ZEND_API int add_next_index_int(zval *arg, zend_int_t n);
|
||||
ZEND_API int add_next_index_null(zval *arg);
|
||||
ZEND_API int add_next_index_bool(zval *arg, int b);
|
||||
ZEND_API int add_next_index_resource(zval *arg, int r);
|
||||
ZEND_API int add_next_index_double(zval *arg, double d);
|
||||
ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate);
|
||||
ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate);
|
||||
ZEND_API int add_next_index_stringl(zval *arg, const char *str, zend_size_t length, int duplicate);
|
||||
ZEND_API int add_next_index_zval(zval *arg, zval *value);
|
||||
|
||||
ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, void **dest, int duplicate);
|
||||
ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, void **dest, int duplicate);
|
||||
ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, zend_size_t key_len, const char *str, void **dest, int duplicate);
|
||||
ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, zend_size_t key_len, const char *str, zend_size_t length, void **dest, int duplicate);
|
||||
|
||||
#define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate)
|
||||
#define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate)
|
||||
|
||||
ZEND_API int add_get_index_long(zval *arg, ulong idx, long l, void **dest);
|
||||
ZEND_API int add_get_index_double(zval *arg, ulong idx, double d, void **dest);
|
||||
ZEND_API int add_get_index_string(zval *arg, ulong idx, const char *str, void **dest, int duplicate);
|
||||
ZEND_API int add_get_index_stringl(zval *arg, ulong idx, const char *str, uint length, void **dest, int duplicate);
|
||||
ZEND_API int add_get_index_int(zval *arg, zend_uint_t idx, zend_int_t l, void **dest);
|
||||
ZEND_API int add_get_index_double(zval *arg, zend_uint_t idx, double d, void **dest);
|
||||
ZEND_API int add_get_index_string(zval *arg, zend_uint_t idx, const char *str, void **dest, int duplicate);
|
||||
ZEND_API int add_get_index_stringl(zval *arg, zend_uint_t idx, const char *str, zend_size_t length, void **dest, int duplicate);
|
||||
|
||||
ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value);
|
||||
|
||||
ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, long l TSRMLS_DC);
|
||||
ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRMLS_DC);
|
||||
ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int b TSRMLS_DC);
|
||||
ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, long r TSRMLS_DC);
|
||||
ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, double d TSRMLS_DC);
|
||||
ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate TSRMLS_DC);
|
||||
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate TSRMLS_DC);
|
||||
ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval *value TSRMLS_DC);
|
||||
ZEND_API int add_property_int_ex(zval *arg, const char *key, zend_size_t key_len, zend_int_t l TSRMLS_DC);
|
||||
ZEND_API int add_property_null_ex(zval *arg, const char *key, zend_size_t key_len TSRMLS_DC);
|
||||
ZEND_API int add_property_bool_ex(zval *arg, const char *key, zend_size_t key_len, int b TSRMLS_DC);
|
||||
ZEND_API int add_property_resource_ex(zval *arg, const char *key, zend_size_t key_len, zend_int_t r TSRMLS_DC);
|
||||
ZEND_API int add_property_double_ex(zval *arg, const char *key, zend_size_t key_len, double d TSRMLS_DC);
|
||||
ZEND_API int add_property_string_ex(zval *arg, const char *key, zend_size_t key_len, const char *str, int duplicate TSRMLS_DC);
|
||||
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, zend_size_t key_len, const char *str, zend_size_t length, int duplicate TSRMLS_DC);
|
||||
ZEND_API int add_property_zval_ex(zval *arg, const char *key, zend_size_t key_len, zval *value TSRMLS_DC);
|
||||
|
||||
#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n TSRMLS_CC)
|
||||
#define add_property_int(__arg, __key, __n) add_property_int_ex(__arg, __key, strlen(__key)+1, __n TSRMLS_CC)
|
||||
#define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1 TSRMLS_CC)
|
||||
#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key)+1, __b TSRMLS_CC)
|
||||
#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key)+1, __r TSRMLS_CC)
|
||||
@@ -512,19 +512,19 @@ ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *f
|
||||
|
||||
ZEND_API int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_length, zend_bool is_ref, int num_symbol_tables, ...);
|
||||
ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, zend_size_t name_length, zend_bool is_ref, int num_symbol_tables, ...);
|
||||
|
||||
ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, int name_len, ulong hash_value TSRMLS_DC);
|
||||
ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, zend_size_t name_len, zend_uint_t hash_value TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_delete_global_variable(const char *name, int name_len TSRMLS_DC);
|
||||
ZEND_API int zend_delete_global_variable(const char *name, zend_size_t name_len TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_delete_global_variable_ex(const char *name, int name_len, ulong hash_value TSRMLS_DC);
|
||||
ZEND_API int zend_delete_global_variable_ex(const char *name, zend_size_t name_len, zend_uint_t hash_value TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_rebuild_symbol_table(TSRMLS_D);
|
||||
|
||||
ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_uint len);
|
||||
ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_size_t len);
|
||||
ZEND_API const char* zend_resolve_method_name(zend_class_entry *ce, zend_function *f);
|
||||
|
||||
#define add_method(arg, key, method) add_assoc_function((arg), (key), (method))
|
||||
@@ -535,26 +535,26 @@ END_EXTERN_C()
|
||||
|
||||
#if ZEND_DEBUG
|
||||
#define CHECK_ZVAL_STRING(z) \
|
||||
if (Z_STRVAL_P(z)[ Z_STRLEN_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", Z_STRVAL_P(z)); }
|
||||
if (Z_STRVAL_P(z)[ Z_STRSIZE_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", Z_STRVAL_P(z)); }
|
||||
#define CHECK_ZVAL_STRING_REL(z) \
|
||||
if (Z_STRVAL_P(z)[ Z_STRLEN_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", Z_STRVAL_P(z) ZEND_FILE_LINE_RELAY_CC); }
|
||||
if (Z_STRVAL_P(z)[ Z_STRSIZE_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", Z_STRVAL_P(z) ZEND_FILE_LINE_RELAY_CC); }
|
||||
#else
|
||||
#define CHECK_ZVAL_STRING(z)
|
||||
#define CHECK_ZVAL_STRING_REL(z)
|
||||
#endif
|
||||
|
||||
#define CHECK_ZVAL_NULL_PATH(p) (Z_STRLEN_P(p) != strlen(Z_STRVAL_P(p)))
|
||||
#define CHECK_ZVAL_NULL_PATH(p) (Z_STRSIZE_P(p) != strlen(Z_STRVAL_P(p)))
|
||||
#define CHECK_NULL_PATH(p, l) (strlen(p) != l)
|
||||
|
||||
#define ZVAL_RESOURCE(z, l) do { \
|
||||
zval *__z = (z); \
|
||||
Z_LVAL_P(__z) = l; \
|
||||
Z_IVAL_P(__z) = l; \
|
||||
Z_TYPE_P(__z) = IS_RESOURCE;\
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_BOOL(z, b) do { \
|
||||
zval *__z = (z); \
|
||||
Z_LVAL_P(__z) = ((b) != 0); \
|
||||
Z_IVAL_P(__z) = ((b) != 0); \
|
||||
Z_TYPE_P(__z) = IS_BOOL; \
|
||||
} while (0)
|
||||
|
||||
@@ -562,10 +562,10 @@ END_EXTERN_C()
|
||||
Z_TYPE_P(z) = IS_NULL; \
|
||||
}
|
||||
|
||||
#define ZVAL_LONG(z, l) { \
|
||||
#define ZVAL_INT(z, l) { \
|
||||
zval *__z = (z); \
|
||||
Z_LVAL_P(__z) = l; \
|
||||
Z_TYPE_P(__z) = IS_LONG; \
|
||||
Z_IVAL_P(__z) = l; \
|
||||
Z_TYPE_P(__z) = IS_INT; \
|
||||
}
|
||||
|
||||
#define ZVAL_DOUBLE(z, d) { \
|
||||
@@ -577,22 +577,22 @@ END_EXTERN_C()
|
||||
#define ZVAL_STRING(z, s, duplicate) do { \
|
||||
const char *__s=(s); \
|
||||
zval *__z = (z); \
|
||||
Z_STRLEN_P(__z) = strlen(__s); \
|
||||
Z_STRVAL_P(__z) = (duplicate?estrndup(__s, Z_STRLEN_P(__z)):(char*)__s);\
|
||||
Z_STRSIZE_P(__z) = (zend_size_t) strlen(__s); \
|
||||
Z_STRVAL_P(__z) = (duplicate?estrndup(__s, Z_STRSIZE_P(__z)):(char*)__s);\
|
||||
Z_TYPE_P(__z) = IS_STRING; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_STRINGL(z, s, l, duplicate) do { \
|
||||
const char *__s=(s); int __l=l; \
|
||||
const char *__s=(s); zend_size_t __l= (zend_size_t) (l); \
|
||||
zval *__z = (z); \
|
||||
Z_STRLEN_P(__z) = __l; \
|
||||
Z_STRSIZE_P(__z) = __l; \
|
||||
Z_STRVAL_P(__z) = (duplicate?estrndup(__s, __l):(char*)__s);\
|
||||
Z_TYPE_P(__z) = IS_STRING; \
|
||||
} while (0)
|
||||
|
||||
#define ZVAL_EMPTY_STRING(z) do { \
|
||||
zval *__z = (z); \
|
||||
Z_STRLEN_P(__z) = 0; \
|
||||
Z_STRSIZE_P(__z) = 0; \
|
||||
Z_STRVAL_P(__z) = STR_EMPTY_ALLOC();\
|
||||
Z_TYPE_P(__z) = IS_STRING; \
|
||||
} while (0)
|
||||
@@ -618,7 +618,7 @@ END_EXTERN_C()
|
||||
#define RETVAL_RESOURCE(l) ZVAL_RESOURCE(return_value, l)
|
||||
#define RETVAL_BOOL(b) ZVAL_BOOL(return_value, b)
|
||||
#define RETVAL_NULL() ZVAL_NULL(return_value)
|
||||
#define RETVAL_LONG(l) ZVAL_LONG(return_value, l)
|
||||
#define RETVAL_INT(l) ZVAL_INT(return_value, l)
|
||||
#define RETVAL_DOUBLE(d) ZVAL_DOUBLE(return_value, d)
|
||||
#define RETVAL_STRING(s, duplicate) ZVAL_STRING(return_value, s, duplicate)
|
||||
#define RETVAL_STRINGL(s, l, duplicate) ZVAL_STRINGL(return_value, s, l, duplicate)
|
||||
@@ -630,7 +630,7 @@ END_EXTERN_C()
|
||||
#define RETURN_RESOURCE(l) { RETVAL_RESOURCE(l); return; }
|
||||
#define RETURN_BOOL(b) { RETVAL_BOOL(b); return; }
|
||||
#define RETURN_NULL() { RETVAL_NULL(); return;}
|
||||
#define RETURN_LONG(l) { RETVAL_LONG(l); return; }
|
||||
#define RETURN_INT(l) { RETVAL_INT(l); return; }
|
||||
#define RETURN_DOUBLE(d) { RETVAL_DOUBLE(d); return; }
|
||||
#define RETURN_STRING(s, duplicate) { RETVAL_STRING(s, duplicate); return; }
|
||||
#define RETURN_STRINGL(s, l, duplicate) { RETVAL_STRINGL(s, l, duplicate); return; }
|
||||
@@ -669,11 +669,11 @@ END_EXTERN_C()
|
||||
} \
|
||||
}
|
||||
|
||||
#define SET_VAR_LONG(n, v) { \
|
||||
#define SET_VAR_INT(n, v) { \
|
||||
{ \
|
||||
zval *var; \
|
||||
ALLOC_ZVAL(var); \
|
||||
ZVAL_LONG(var, v); \
|
||||
ZVAL_INT(var, v); \
|
||||
ZEND_SET_GLOBAL_VAR(n, var); \
|
||||
} \
|
||||
}
|
||||
@@ -729,7 +729,7 @@ END_EXTERN_C()
|
||||
#define ZEND_DEFINE_PROPERTY(class_ptr, name, value, mask) \
|
||||
{ \
|
||||
char *_name = (name); \
|
||||
int namelen = strlen(_name); \
|
||||
zend_size_t namelen = strlen(_name); \
|
||||
zend_declare_property(class_ptr, _name, namelen, value, mask TSRMLS_CC); \
|
||||
}
|
||||
|
||||
|
||||
+28
-28
@@ -433,7 +433,7 @@ struct _zend_mm_heap {
|
||||
int overflow;
|
||||
int internal;
|
||||
#if ZEND_MM_CACHE
|
||||
unsigned int cached;
|
||||
size_t cached;
|
||||
zend_mm_free_block *cache[ZEND_MM_NUM_BUCKETS];
|
||||
#endif
|
||||
zend_mm_free_block *free_buckets[ZEND_MM_NUM_BUCKETS*2];
|
||||
@@ -488,16 +488,16 @@ static unsigned int _zend_mm_cookie = 0;
|
||||
#define ZEND_MM_RESERVE_SIZE (8*1024)
|
||||
|
||||
#ifdef _WIN64
|
||||
# define ZEND_MM_LONG_CONST(x) (x##i64)
|
||||
# define ZEND_MM_INT_CONST(x) (x##i64)
|
||||
#else
|
||||
# define ZEND_MM_LONG_CONST(x) (x##L)
|
||||
# define ZEND_MM_INT_CONST(x) (x##L)
|
||||
#endif
|
||||
|
||||
#define ZEND_MM_TYPE_MASK ZEND_MM_LONG_CONST(0x3)
|
||||
#define ZEND_MM_TYPE_MASK ZEND_MM_INT_CONST(0x3)
|
||||
|
||||
#define ZEND_MM_FREE_BLOCK ZEND_MM_LONG_CONST(0x0)
|
||||
#define ZEND_MM_USED_BLOCK ZEND_MM_LONG_CONST(0x1)
|
||||
#define ZEND_MM_GUARD_BLOCK ZEND_MM_LONG_CONST(0x3)
|
||||
#define ZEND_MM_FREE_BLOCK ZEND_MM_INT_CONST(0x0)
|
||||
#define ZEND_MM_USED_BLOCK ZEND_MM_INT_CONST(0x1)
|
||||
#define ZEND_MM_GUARD_BLOCK ZEND_MM_INT_CONST(0x3)
|
||||
|
||||
#define ZEND_MM_BLOCK(b, type, size) do { \
|
||||
size_t _size = (size); \
|
||||
@@ -615,11 +615,11 @@ static unsigned int _zend_mm_cookie = 0;
|
||||
# define END_MAGIC_SIZE sizeof(unsigned int)
|
||||
|
||||
# define ZEND_MM_SET_BLOCK_SIZE(block, __size) do { \
|
||||
char *p; \
|
||||
char *__p; \
|
||||
((zend_mm_block*)(block))->debug.size = (__size); \
|
||||
p = ZEND_MM_END_MAGIC_PTR(block); \
|
||||
__p = ZEND_MM_END_MAGIC_PTR(block); \
|
||||
((zend_mm_block*)(block))->debug.start_magic = _mem_block_start_magic; \
|
||||
memcpy(p, &_mem_block_end_magic, END_MAGIC_SIZE); \
|
||||
memcpy(__p, &_mem_block_end_magic, END_MAGIC_SIZE); \
|
||||
} while (0)
|
||||
|
||||
static unsigned int _mem_block_start_magic = 0;
|
||||
@@ -742,7 +742,7 @@ static inline void zend_mm_add_to_free_list(zend_mm_heap *heap, zend_mm_free_blo
|
||||
*p = mm_block;
|
||||
mm_block->parent = p;
|
||||
mm_block->prev_free_block = mm_block->next_free_block = mm_block;
|
||||
heap->large_free_bitmap |= (ZEND_MM_LONG_CONST(1) << index);
|
||||
heap->large_free_bitmap |= (ZEND_MM_INT_CONST(1) << index);
|
||||
} else {
|
||||
size_t m;
|
||||
|
||||
@@ -775,7 +775,7 @@ static inline void zend_mm_add_to_free_list(zend_mm_heap *heap, zend_mm_free_blo
|
||||
|
||||
prev = ZEND_MM_SMALL_FREE_BUCKET(heap, index);
|
||||
if (prev->prev_free_block == prev) {
|
||||
heap->free_bitmap |= (ZEND_MM_LONG_CONST(1) << index);
|
||||
heap->free_bitmap |= (ZEND_MM_INT_CONST(1) << index);
|
||||
}
|
||||
next = prev->next_free_block;
|
||||
|
||||
@@ -809,7 +809,7 @@ static inline void zend_mm_remove_from_free_list(zend_mm_heap *heap, zend_mm_fre
|
||||
ZEND_MM_CHECK_TREE(mm_block);
|
||||
*mm_block->parent = NULL;
|
||||
if (mm_block->parent == &heap->large_free_buckets[index]) {
|
||||
heap->large_free_bitmap &= ~(ZEND_MM_LONG_CONST(1) << index);
|
||||
heap->large_free_bitmap &= ~(ZEND_MM_INT_CONST(1) << index);
|
||||
}
|
||||
} else {
|
||||
while (*(cp = &(prev->child[prev->child[1] != NULL])) != NULL) {
|
||||
@@ -847,7 +847,7 @@ subst_block:
|
||||
size_t index = ZEND_MM_BUCKET_INDEX(ZEND_MM_FREE_BLOCK_SIZE(mm_block));
|
||||
|
||||
if (EXPECTED(heap->free_buckets[index*2] == heap->free_buckets[index*2+1])) {
|
||||
heap->free_bitmap &= ~(ZEND_MM_LONG_CONST(1) << index);
|
||||
heap->free_bitmap &= ~(ZEND_MM_INT_CONST(1) << index);
|
||||
}
|
||||
}
|
||||
} else if (UNEXPECTED(mm_block->parent == ZEND_MM_REST_BLOCK)) {
|
||||
@@ -1116,7 +1116,7 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_mem_handlers *handlers,
|
||||
heap->real_size = 0;
|
||||
heap->overflow = 0;
|
||||
heap->real_peak = 0;
|
||||
heap->limit = ZEND_MM_LONG_CONST(1)<<(ZEND_MM_NUM_BUCKETS-2);
|
||||
heap->limit = ZEND_MM_INT_CONST(1)<<(ZEND_MM_NUM_BUCKETS-2);
|
||||
heap->size = 0;
|
||||
heap->peak = 0;
|
||||
heap->internal = internal;
|
||||
@@ -1231,9 +1231,9 @@ ZEND_API zend_mm_heap *zend_mm_startup(void)
|
||||
}
|
||||
|
||||
#if ZEND_DEBUG
|
||||
static long zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b)
|
||||
static zend_int_t zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b)
|
||||
{
|
||||
long leaks = 0;
|
||||
zend_int_t leaks = 0;
|
||||
zend_mm_block *p, *q;
|
||||
|
||||
p = ZEND_MM_NEXT_BLOCK(b);
|
||||
@@ -1291,7 +1291,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap TSRMLS_DC)
|
||||
}
|
||||
if (!ZEND_MM_IS_FREE_BLOCK(p)) {
|
||||
if (p->magic == MEM_BLOCK_VALID) {
|
||||
long repeated;
|
||||
zend_int_t repeated;
|
||||
zend_leak_info leak;
|
||||
|
||||
ZEND_MM_SET_MAGIC(p, MEM_BLOCK_LEAK);
|
||||
@@ -1745,7 +1745,7 @@ static void zend_mm_safe_error(zend_mm_heap *heap,
|
||||
size_t limit,
|
||||
#if ZEND_DEBUG
|
||||
const char *filename,
|
||||
uint lineno,
|
||||
zend_uint_t lineno,
|
||||
#endif
|
||||
size_t size)
|
||||
{
|
||||
@@ -1791,7 +1791,7 @@ static void zend_mm_safe_error(zend_mm_heap *heap,
|
||||
lineno,
|
||||
#endif
|
||||
size);
|
||||
fprintf(stderr, " in %s on line %d\n", error_filename, error_lineno);
|
||||
fprintf(stderr, " in %s on line " ZEND_UINT_FMT "\n", error_filename, error_lineno);
|
||||
}
|
||||
/* See http://support.microsoft.com/kb/190351 */
|
||||
#ifdef PHP_WIN32
|
||||
@@ -1831,7 +1831,7 @@ static zend_mm_free_block *zend_mm_search_large_block(zend_mm_heap *heap, size_t
|
||||
best_size = ZEND_MM_FREE_BLOCK_SIZE(p);
|
||||
best_fit = p;
|
||||
}
|
||||
if ((m & (ZEND_MM_LONG_CONST(1) << (ZEND_MM_NUM_BUCKETS-1))) == 0) {
|
||||
if ((m & (ZEND_MM_INT_CONST(1) << (ZEND_MM_NUM_BUCKETS-1))) == 0) {
|
||||
if (p->child[1]) {
|
||||
rst = p->child[1];
|
||||
}
|
||||
@@ -1973,9 +1973,9 @@ static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D
|
||||
#endif
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
#if ZEND_DEBUG
|
||||
zend_mm_safe_error(heap, "Allowed memory size of %ld bytes exhausted at %s:%d (tried to allocate %lu bytes)", heap->limit, __zend_filename, __zend_lineno, size);
|
||||
zend_mm_safe_error(heap, "Allowed memory size of " ZEND_INT_FMT " bytes exhausted at %s:%d (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, __zend_filename, __zend_lineno, size);
|
||||
#else
|
||||
zend_mm_safe_error(heap, "Allowed memory size of %ld bytes exhausted (tried to allocate %lu bytes)", heap->limit, size);
|
||||
zend_mm_safe_error(heap, "Allowed memory size of " ZEND_INT_FMT " bytes exhausted (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2286,9 +2286,9 @@ realloc_segment:
|
||||
#endif
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
#if ZEND_DEBUG
|
||||
zend_mm_safe_error(heap, "Allowed memory size of %ld bytes exhausted at %s:%d (tried to allocate %ld bytes)", heap->limit, __zend_filename, __zend_lineno, size);
|
||||
zend_mm_safe_error(heap, "Allowed memory size of " ZEND_INT_FMT " bytes exhausted at %s:%d (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, __zend_filename, __zend_lineno, size);
|
||||
#else
|
||||
zend_mm_safe_error(heap, "Allowed memory size of %ld bytes exhausted (tried to allocate %ld bytes)", heap->limit, size);
|
||||
zend_mm_safe_error(heap, "Allowed memory size of " ZEND_INT_FMT " bytes exhausted (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, size);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
@@ -2619,7 +2619,7 @@ ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LI
|
||||
|
||||
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
int length;
|
||||
zend_size_t length;
|
||||
char *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
@@ -2638,7 +2638,7 @@ ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
return p;
|
||||
}
|
||||
|
||||
ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
ZEND_API char *_estrndup(const char *s, zend_size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
char *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
@@ -2659,7 +2659,7 @@ ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *zend_strndup(const char *s, uint length)
|
||||
ZEND_API char *zend_strndup(const char *s, zend_size_t length)
|
||||
{
|
||||
char *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
|
||||
+10
-9
@@ -26,20 +26,21 @@
|
||||
|
||||
#include "../TSRM/TSRM.h"
|
||||
#include "zend.h"
|
||||
#include "zend_types.h"
|
||||
|
||||
#ifndef ZEND_MM_ALIGNMENT
|
||||
# define ZEND_MM_ALIGNMENT 8
|
||||
# define ZEND_MM_ALIGNMENT_LOG2 3
|
||||
#elif ZEND_MM_ALIGNMENT < 4
|
||||
# define ZEND_MM_ALIGNMENT Z_I(8)
|
||||
# define ZEND_MM_ALIGNMENT_LOG2 Z_I(3)
|
||||
#elif ZEND_MM_ALIGNMENT < Z_I(4)
|
||||
# undef ZEND_MM_ALIGNMENT
|
||||
# undef ZEND_MM_ALIGNMENT_LOG2
|
||||
# define ZEND_MM_ALIGNMENT 4
|
||||
# define ZEND_MM_ALIGNMENT_LOG2 2
|
||||
# define ZEND_MM_ALIGNMENT Z_I(4)
|
||||
# define ZEND_MM_ALIGNMENT_LOG2 Z_I(2)
|
||||
#endif
|
||||
|
||||
#define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT-1)
|
||||
#define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT-Z_I(1))
|
||||
|
||||
#define ZEND_MM_ALIGNED_SIZE(size) (((size) + ZEND_MM_ALIGNMENT - 1) & ZEND_MM_ALIGNMENT_MASK)
|
||||
#define ZEND_MM_ALIGNED_SIZE(size) (((size) + ZEND_MM_ALIGNMENT - Z_I(1)) & ZEND_MM_ALIGNMENT_MASK)
|
||||
|
||||
typedef struct _zend_leak_info {
|
||||
void *addr;
|
||||
@@ -52,7 +53,7 @@ typedef struct _zend_leak_info {
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
ZEND_API char *zend_strndup(const char *s, unsigned int length) ZEND_ATTRIBUTE_MALLOC;
|
||||
ZEND_API char *zend_strndup(const char *s, zend_size_t length) ZEND_ATTRIBUTE_MALLOC;
|
||||
|
||||
ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE(1);
|
||||
ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
|
||||
@@ -63,7 +64,7 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN
|
||||
ZEND_API void *_safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
ZEND_API void *_safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset);
|
||||
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
|
||||
ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
|
||||
ZEND_API char *_estrndup(const char *s, zend_size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
|
||||
ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
|
||||
/* Standard wrapper macros */
|
||||
|
||||
+3
-3
@@ -290,7 +290,7 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
|
||||
break;
|
||||
case ZEND_SELECT:
|
||||
zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
|
||||
if (zend_is_true(&op1)) {
|
||||
if (zend_is_true(&op1 TSRMLS_CC)) {
|
||||
if (!(&ast->u.child)[1]) {
|
||||
*result = op1;
|
||||
} else {
|
||||
@@ -303,13 +303,13 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
|
||||
}
|
||||
break;
|
||||
case ZEND_UNARY_PLUS:
|
||||
ZVAL_LONG(&op1, 0);
|
||||
ZVAL_INT(&op1, 0);
|
||||
zend_ast_evaluate(&op2, (&ast->u.child)[0], scope TSRMLS_CC);
|
||||
add_function(result, &op1, &op2 TSRMLS_CC);
|
||||
zval_dtor(&op2);
|
||||
break;
|
||||
case ZEND_UNARY_MINUS:
|
||||
ZVAL_LONG(&op1, 0);
|
||||
ZVAL_INT(&op1, 0);
|
||||
zend_ast_evaluate(&op2, (&ast->u.child)[0], scope TSRMLS_CC);
|
||||
sub_function(result, &op1, &op2 TSRMLS_CC);
|
||||
zval_dtor(&op2);
|
||||
|
||||
+103
-103
@@ -358,7 +358,7 @@ ZEND_FUNCTION(zend_version)
|
||||
Returns number of freed zvals */
|
||||
ZEND_FUNCTION(gc_collect_cycles)
|
||||
{
|
||||
RETURN_LONG(gc_collect_cycles(TSRMLS_C));
|
||||
RETURN_INT(gc_collect_cycles(TSRMLS_C));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -393,10 +393,10 @@ ZEND_FUNCTION(func_num_args)
|
||||
zend_execute_data *ex = EG(current_execute_data)->prev_execute_data;
|
||||
|
||||
if (ex && ex->function_state.arguments) {
|
||||
RETURN_LONG((long)(zend_uintptr_t)*(ex->function_state.arguments));
|
||||
RETURN_INT((long)(zend_uintptr_t)*(ex->function_state.arguments));
|
||||
} else {
|
||||
zend_error(E_WARNING, "func_num_args(): Called from the global scope - no function context");
|
||||
RETURN_LONG(-1);
|
||||
RETURN_INT(-1);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -409,10 +409,10 @@ ZEND_FUNCTION(func_get_arg)
|
||||
void **p;
|
||||
int arg_count;
|
||||
zval *arg;
|
||||
long requested_offset;
|
||||
zend_int_t requested_offset;
|
||||
zend_execute_data *ex = EG(current_execute_data)->prev_execute_data;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &requested_offset) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &requested_offset) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ ZEND_FUNCTION(func_get_arg)
|
||||
arg_count = (int)(zend_uintptr_t) *p; /* this is the amount of arguments passed to func_get_arg(); */
|
||||
|
||||
if (requested_offset >= arg_count) {
|
||||
zend_error(E_WARNING, "func_get_arg(): Argument %ld not passed to function", requested_offset);
|
||||
zend_error(E_WARNING, "func_get_arg(): Argument " ZEND_INT_FMT " not passed to function", requested_offset);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -481,13 +481,13 @@ ZEND_FUNCTION(func_get_args)
|
||||
ZEND_FUNCTION(strlen)
|
||||
{
|
||||
char *s1;
|
||||
int s1_len;
|
||||
zend_size_t s1_len;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s1, &s1_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &s1, &s1_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
RETVAL_LONG(s1_len);
|
||||
RETVAL_INT((zend_int_t) s1_len);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -497,13 +497,13 @@ ZEND_FUNCTION(strlen)
|
||||
ZEND_FUNCTION(strcmp)
|
||||
{
|
||||
char *s1, *s2;
|
||||
int s1_len, s2_len;
|
||||
zend_size_t s1_len, s2_len;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1_len, &s2, &s2_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &s1, &s1_len, &s2, &s2_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
RETURN_LONG(zend_binary_strcmp(s1, s1_len, s2, s2_len));
|
||||
RETURN_INT(zend_binary_strcmp(s1, s1_len, s2, s2_len));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -513,10 +513,10 @@ ZEND_FUNCTION(strcmp)
|
||||
ZEND_FUNCTION(strncmp)
|
||||
{
|
||||
char *s1, *s2;
|
||||
int s1_len, s2_len;
|
||||
long len;
|
||||
zend_size_t s1_len, s2_len;
|
||||
zend_int_t len;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl", &s1, &s1_len, &s2, &s2_len, &len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSi", &s1, &s1_len, &s2, &s2_len, &len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -525,7 +525,7 @@ ZEND_FUNCTION(strncmp)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(zend_binary_strncmp(s1, s1_len, s2, s2_len, len));
|
||||
RETURN_INT(zend_binary_strncmp(s1, s1_len, s2, s2_len, len));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -535,13 +535,13 @@ ZEND_FUNCTION(strncmp)
|
||||
ZEND_FUNCTION(strcasecmp)
|
||||
{
|
||||
char *s1, *s2;
|
||||
int s1_len, s2_len;
|
||||
zend_size_t s1_len, s2_len;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1_len, &s2, &s2_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &s1, &s1_len, &s2, &s2_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
RETURN_LONG(zend_binary_strcasecmp(s1, s1_len, s2, s2_len));
|
||||
RETURN_INT(zend_binary_strcasecmp(s1, s1_len, s2, s2_len));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -551,10 +551,10 @@ ZEND_FUNCTION(strcasecmp)
|
||||
ZEND_FUNCTION(strncasecmp)
|
||||
{
|
||||
char *s1, *s2;
|
||||
int s1_len, s2_len;
|
||||
long len;
|
||||
zend_size_t s1_len, s2_len;
|
||||
zend_int_t len;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl", &s1, &s1_len, &s2, &s2_len, &len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSi", &s1, &s1_len, &s2, &s2_len, &len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ ZEND_FUNCTION(strncasecmp)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(zend_binary_strncasecmp(s1, s1_len, s2, s2_len, len));
|
||||
RETURN_INT(zend_binary_strncasecmp(s1, s1_len, s2, s2_len, len));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -574,8 +574,8 @@ ZEND_FUNCTION(each)
|
||||
{
|
||||
zval *array, *entry, **entry_ptr, *tmp;
|
||||
char *string_key;
|
||||
uint string_key_len;
|
||||
ulong num_key;
|
||||
zend_size_t string_key_len;
|
||||
zend_uint_t num_key;
|
||||
zval **inserted_pointer;
|
||||
HashTable *target_hash;
|
||||
|
||||
@@ -613,8 +613,8 @@ ZEND_FUNCTION(each)
|
||||
case HASH_KEY_IS_STRING:
|
||||
add_get_index_stringl(return_value, 0, string_key, string_key_len-1, (void **) &inserted_pointer, !IS_INTERNED(string_key));
|
||||
break;
|
||||
case HASH_KEY_IS_LONG:
|
||||
add_get_index_long(return_value, 0, num_key, (void **) &inserted_pointer);
|
||||
case HASH_KEY_IS_INT:
|
||||
add_get_index_int(return_value, 0, num_key, (void **) &inserted_pointer);
|
||||
break;
|
||||
}
|
||||
zend_hash_update(return_value->value.ht, "key", sizeof("key"), inserted_pointer, sizeof(zval *), NULL);
|
||||
@@ -629,10 +629,10 @@ ZEND_FUNCTION(each)
|
||||
ZEND_FUNCTION(error_reporting)
|
||||
{
|
||||
char *err;
|
||||
int err_len;
|
||||
zend_size_t err_len;
|
||||
int old_error_reporting;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &err, &err_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &err, &err_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -641,7 +641,7 @@ ZEND_FUNCTION(error_reporting)
|
||||
zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), err, err_len, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
|
||||
}
|
||||
|
||||
RETVAL_LONG(old_error_reporting);
|
||||
RETVAL_INT(old_error_reporting);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -651,14 +651,14 @@ ZEND_FUNCTION(error_reporting)
|
||||
ZEND_FUNCTION(define)
|
||||
{
|
||||
char *name;
|
||||
int name_len;
|
||||
zend_size_t name_len;
|
||||
zval *val;
|
||||
zval *val_free = NULL;
|
||||
zend_bool non_cs = 0;
|
||||
int case_sensitive = CONST_CS;
|
||||
zend_constant c;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &name, &name_len, &val, &non_cs) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|b", &name, &name_len, &val, &non_cs) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -674,7 +674,7 @@ ZEND_FUNCTION(define)
|
||||
|
||||
repeat:
|
||||
switch (Z_TYPE_P(val)) {
|
||||
case IS_LONG:
|
||||
case IS_INT:
|
||||
case IS_DOUBLE:
|
||||
case IS_STRING:
|
||||
case IS_BOOL:
|
||||
@@ -729,10 +729,10 @@ repeat:
|
||||
ZEND_FUNCTION(defined)
|
||||
{
|
||||
char *name;
|
||||
int name_len;
|
||||
zend_size_t name_len;
|
||||
zval c;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -752,7 +752,7 @@ ZEND_FUNCTION(get_class)
|
||||
{
|
||||
zval *obj = NULL;
|
||||
const char *name = "";
|
||||
zend_uint name_len = 0;
|
||||
zend_size_t name_len = 0;
|
||||
int dup;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|o!", &obj) == FAILURE) {
|
||||
@@ -800,7 +800,7 @@ ZEND_FUNCTION(get_parent_class)
|
||||
zval *arg;
|
||||
zend_class_entry *ce = NULL;
|
||||
const char *name;
|
||||
zend_uint name_length;
|
||||
zend_size_t name_length;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &arg) == FAILURE) {
|
||||
return;
|
||||
@@ -825,7 +825,7 @@ ZEND_FUNCTION(get_parent_class)
|
||||
} else if (Z_TYPE_P(arg) == IS_STRING) {
|
||||
zend_class_entry **pce;
|
||||
|
||||
if (zend_lookup_class(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &pce TSRMLS_CC) == SUCCESS) {
|
||||
if (zend_lookup_class(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), &pce TSRMLS_CC) == SUCCESS) {
|
||||
ce = *pce;
|
||||
}
|
||||
}
|
||||
@@ -843,13 +843,13 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
|
||||
{
|
||||
zval *obj;
|
||||
char *class_name;
|
||||
int class_name_len;
|
||||
zend_size_t class_name_len;
|
||||
zend_class_entry *instance_ce;
|
||||
zend_class_entry **ce;
|
||||
zend_bool allow_string = only_subclass;
|
||||
zend_bool retval;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|b", &obj, &class_name, &class_name_len, &allow_string) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS|b", &obj, &class_name, &class_name_len, &allow_string) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/*
|
||||
@@ -861,7 +861,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
|
||||
|
||||
if (allow_string && Z_TYPE_P(obj) == IS_STRING) {
|
||||
zend_class_entry **the_ce;
|
||||
if (zend_lookup_class(Z_STRVAL_P(obj), Z_STRLEN_P(obj), &the_ce TSRMLS_CC) == FAILURE) {
|
||||
if (zend_lookup_class(Z_STRVAL_P(obj), Z_STRSIZE_P(obj), &the_ce TSRMLS_CC) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
instance_ce = *the_ce;
|
||||
@@ -910,8 +910,8 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
|
||||
zend_property_info *prop_info;
|
||||
zval *prop, *prop_copy;
|
||||
char *key;
|
||||
uint key_len;
|
||||
ulong num_index;
|
||||
zend_size_t key_len;
|
||||
zend_uint_t num_index;
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
|
||||
while (zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop_info, &pos) == SUCCESS) {
|
||||
@@ -961,10 +961,10 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
|
||||
ZEND_FUNCTION(get_class_vars)
|
||||
{
|
||||
char *class_name;
|
||||
int class_name_len;
|
||||
zend_size_t class_name_len;
|
||||
zend_class_entry **pce;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &class_name, &class_name_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &class_name, &class_name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -990,8 +990,8 @@ ZEND_FUNCTION(get_object_vars)
|
||||
HashPosition pos;
|
||||
char *key;
|
||||
const char *prop_name, *class_name;
|
||||
uint key_len, prop_len;
|
||||
ulong num_index;
|
||||
zend_size_t key_len, prop_len;
|
||||
zend_uint_t num_index;
|
||||
zend_object *zobj;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
|
||||
@@ -1017,7 +1017,7 @@ ZEND_FUNCTION(get_object_vars)
|
||||
while (zend_hash_get_current_data_ex(properties, (void **) &value, &pos) == SUCCESS) {
|
||||
if (zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos) == HASH_KEY_IS_STRING) {
|
||||
if (zend_check_property_access(zobj, key, key_len-1 TSRMLS_CC) == SUCCESS) {
|
||||
zend_unmangle_property_name_ex(key, key_len - 1, &class_name, &prop_name, (int*) &prop_len);
|
||||
zend_unmangle_property_name_ex(key, key_len - 1, &class_name, &prop_name, &prop_len);
|
||||
/* Not separating references */
|
||||
Z_ADDREF_PP(value);
|
||||
if (IS_INTERNED(key) && prop_name != key) {
|
||||
@@ -1035,7 +1035,7 @@ ZEND_FUNCTION(get_object_vars)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int same_name(const char *key, const char *name, zend_uint name_len)
|
||||
static int same_name(const char *key, const char *name, zend_size_t name_len)
|
||||
{
|
||||
char *lcname = zend_str_tolower_dup(name, name_len);
|
||||
int ret = memcmp(lcname, key, name_len) == 0;
|
||||
@@ -1064,7 +1064,7 @@ ZEND_FUNCTION(get_class_methods)
|
||||
}
|
||||
ce = Z_OBJCE_P(klass);
|
||||
} else if (Z_TYPE_P(klass) == IS_STRING) {
|
||||
if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRLEN_P(klass), &pce TSRMLS_CC) == SUCCESS) {
|
||||
if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRSIZE_P(klass), &pce TSRMLS_CC) == SUCCESS) {
|
||||
ce = *pce;
|
||||
}
|
||||
}
|
||||
@@ -1084,9 +1084,9 @@ ZEND_FUNCTION(get_class_methods)
|
||||
|| ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) &&
|
||||
EG(scope) == mptr->common.scope)))) {
|
||||
char *key;
|
||||
uint key_len;
|
||||
ulong num_index;
|
||||
uint len = strlen(mptr->common.function_name);
|
||||
zend_size_t key_len;
|
||||
zend_uint_t num_index;
|
||||
zend_size_t len = strlen(mptr->common.function_name);
|
||||
|
||||
/* Do not display old-style inherited constructors */
|
||||
if (zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len, &num_index, 0, &pos) != HASH_KEY_IS_STRING) {
|
||||
@@ -1123,17 +1123,17 @@ ZEND_FUNCTION(method_exists)
|
||||
{
|
||||
zval *klass;
|
||||
char *method_name;
|
||||
int method_len;
|
||||
zend_size_t method_len;
|
||||
char *lcname;
|
||||
zend_class_entry * ce, **pce;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &klass, &method_name, &method_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &klass, &method_name, &method_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (Z_TYPE_P(klass) == IS_OBJECT) {
|
||||
ce = Z_OBJCE_P(klass);
|
||||
} else if (Z_TYPE_P(klass) == IS_STRING) {
|
||||
if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRLEN_P(klass), &pce TSRMLS_CC) == FAILURE) {
|
||||
if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRSIZE_P(klass), &pce TSRMLS_CC) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ce = *pce;
|
||||
@@ -1180,13 +1180,13 @@ ZEND_FUNCTION(property_exists)
|
||||
{
|
||||
zval *object;
|
||||
char *property;
|
||||
int property_len;
|
||||
zend_size_t property_len;
|
||||
zend_class_entry *ce, **pce;
|
||||
zend_property_info *property_info;
|
||||
zval property_z;
|
||||
ulong h;
|
||||
zend_uint_t h;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &object, &property, &property_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &object, &property, &property_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1195,7 +1195,7 @@ ZEND_FUNCTION(property_exists)
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(object) == IS_STRING) {
|
||||
if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC) == FAILURE) {
|
||||
if (zend_lookup_class(Z_STRVAL_P(object), Z_STRSIZE_P(object), &pce TSRMLS_CC) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ce = *pce;
|
||||
@@ -1230,18 +1230,18 @@ ZEND_FUNCTION(class_exists)
|
||||
{
|
||||
char *class_name, *lc_name;
|
||||
zend_class_entry **ce;
|
||||
int class_name_len;
|
||||
zend_size_t class_name_len;
|
||||
int found;
|
||||
zend_bool autoload = 1;
|
||||
ALLOCA_FLAG(use_heap)
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &class_name, &class_name_len, &autoload) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &class_name, &class_name_len, &autoload) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!autoload) {
|
||||
char *name;
|
||||
int len;
|
||||
zend_size_t len;
|
||||
|
||||
lc_name = do_alloca(class_name_len + 1, use_heap);
|
||||
zend_str_tolower_copy(lc_name, class_name, class_name_len);
|
||||
@@ -1273,18 +1273,18 @@ ZEND_FUNCTION(interface_exists)
|
||||
{
|
||||
char *iface_name, *lc_name;
|
||||
zend_class_entry **ce;
|
||||
int iface_name_len;
|
||||
zend_size_t iface_name_len;
|
||||
int found;
|
||||
zend_bool autoload = 1;
|
||||
ALLOCA_FLAG(use_heap)
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &iface_name, &iface_name_len, &autoload) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &iface_name, &iface_name_len, &autoload) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!autoload) {
|
||||
char *name;
|
||||
int len;
|
||||
zend_size_t len;
|
||||
|
||||
lc_name = do_alloca(iface_name_len + 1, use_heap);
|
||||
zend_str_tolower_copy(lc_name, iface_name, iface_name_len);
|
||||
@@ -1316,18 +1316,18 @@ ZEND_FUNCTION(trait_exists)
|
||||
{
|
||||
char *trait_name, *lc_name;
|
||||
zend_class_entry **ce;
|
||||
int trait_name_len;
|
||||
zend_size_t trait_name_len;
|
||||
int found;
|
||||
zend_bool autoload = 1;
|
||||
ALLOCA_FLAG(use_heap)
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &trait_name, &trait_name_len, &autoload) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &trait_name, &trait_name_len, &autoload) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!autoload) {
|
||||
char *name;
|
||||
int len;
|
||||
zend_size_t len;
|
||||
|
||||
lc_name = do_alloca(trait_name_len + 1, use_heap);
|
||||
zend_str_tolower_copy(lc_name, trait_name, trait_name_len);
|
||||
@@ -1359,12 +1359,12 @@ ZEND_FUNCTION(trait_exists)
|
||||
ZEND_FUNCTION(function_exists)
|
||||
{
|
||||
char *name;
|
||||
int name_len;
|
||||
zend_size_t name_len;
|
||||
zend_function *func;
|
||||
char *lcname;
|
||||
zend_bool retval;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1400,11 +1400,11 @@ ZEND_FUNCTION(class_alias)
|
||||
{
|
||||
char *class_name, *alias_name;
|
||||
zend_class_entry **ce;
|
||||
int class_name_len, alias_name_len;
|
||||
zend_size_t class_name_len, alias_name_len;
|
||||
int found;
|
||||
zend_bool autoload = 1;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|b", &class_name, &class_name_len, &alias_name, &alias_name_len, &autoload) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|b", &class_name, &class_name_len, &alias_name, &alias_name_len, &autoload) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1434,9 +1434,9 @@ ZEND_FUNCTION(class_alias)
|
||||
Cause an intentional memory leak, for testing/debugging purposes */
|
||||
ZEND_FUNCTION(leak)
|
||||
{
|
||||
long leakbytes=3;
|
||||
zend_int_t leakbytes=3;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &leakbytes) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &leakbytes) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1483,7 +1483,7 @@ ZEND_FUNCTION(crash)
|
||||
ZEND_FUNCTION(get_included_files)
|
||||
{
|
||||
char *entry;
|
||||
uint entry_len;
|
||||
zend_size_t entry_len;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
@@ -1503,11 +1503,11 @@ ZEND_FUNCTION(get_included_files)
|
||||
Generates a user-level error/warning/notice message */
|
||||
ZEND_FUNCTION(trigger_error)
|
||||
{
|
||||
long error_type = E_USER_NOTICE;
|
||||
zend_int_t error_type = E_USER_NOTICE;
|
||||
char *message;
|
||||
int message_len;
|
||||
zend_size_t message_len;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &message, &message_len, &error_type) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &message, &message_len, &error_type) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1535,9 +1535,9 @@ ZEND_FUNCTION(set_error_handler)
|
||||
{
|
||||
zval *error_handler;
|
||||
char *error_handler_name = NULL;
|
||||
long error_type = E_ALL;
|
||||
zend_int_t error_type = E_ALL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &error_handler, &error_type) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &error_handler, &error_type) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1797,11 +1797,11 @@ ZEND_FUNCTION(get_defined_vars)
|
||||
ZEND_FUNCTION(create_function)
|
||||
{
|
||||
char *eval_code, *function_name, *function_args, *function_code;
|
||||
int eval_code_length, function_name_length, function_args_len, function_code_len;
|
||||
zend_size_t eval_code_length, function_name_length, function_args_len, function_code_len;
|
||||
int retval;
|
||||
char *eval_name;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &function_args, &function_args_len, &function_code, &function_code_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &function_args, &function_args_len, &function_code, &function_code_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1841,11 +1841,11 @@ ZEND_FUNCTION(create_function)
|
||||
new_function = *func;
|
||||
function_add_ref(&new_function);
|
||||
|
||||
function_name = (char *) emalloc(sizeof("0lambda_")+MAX_LENGTH_OF_LONG);
|
||||
function_name = (char *) emalloc(sizeof("0lambda_")+MAX_LENGTH_OF_ZEND_INT);
|
||||
function_name[0] = '\0';
|
||||
|
||||
do {
|
||||
function_name_length = 1 + snprintf(function_name + 1, sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count));
|
||||
function_name_length = 1 + snprintf(function_name + 1, sizeof("lambda_")+MAX_LENGTH_OF_ZEND_INT, "lambda_%d", ++EG(lambda_count));
|
||||
} while (zend_hash_add(EG(function_table), function_name, function_name_length+1, &new_function, sizeof(zend_function), NULL)==FAILURE);
|
||||
zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME));
|
||||
RETURN_STRINGL(function_name, function_name_length, 0);
|
||||
@@ -1869,7 +1869,7 @@ ZEND_FUNCTION(zend_test_func)
|
||||
#ifdef ZTS
|
||||
ZEND_FUNCTION(zend_thread_id)
|
||||
{
|
||||
RETURN_LONG((long)tsrm_thread_id());
|
||||
RETURN_INT((long)tsrm_thread_id());
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -1885,7 +1885,7 @@ ZEND_FUNCTION(get_resource_type)
|
||||
return;
|
||||
}
|
||||
|
||||
resource_type = zend_rsrc_list_get_rsrc_type(Z_LVAL_P(z_resource_type) TSRMLS_CC);
|
||||
resource_type = zend_rsrc_list_get_rsrc_type(Z_IVAL_P(z_resource_type) TSRMLS_CC);
|
||||
if (resource_type) {
|
||||
RETURN_STRING(resource_type, 1);
|
||||
} else {
|
||||
@@ -2070,7 +2070,7 @@ void debug_print_backtrace_args(zval *arg_array TSRMLS_DC)
|
||||
ZEND_FUNCTION(debug_print_backtrace)
|
||||
{
|
||||
zend_execute_data *ptr, *skip;
|
||||
int lineno, frameno = 0;
|
||||
zend_size_t lineno, frameno = 0;
|
||||
const char *function_name;
|
||||
const char *filename;
|
||||
const char *class_name = NULL;
|
||||
@@ -2078,10 +2078,10 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
const char *include_filename = NULL;
|
||||
zval *arg_array = NULL;
|
||||
int indent = 0;
|
||||
long options = 0;
|
||||
long limit = 0;
|
||||
zend_int_t options = 0;
|
||||
zend_int_t limit = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &options, &limit) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ii", &options, &limit) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2130,7 +2130,7 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
if (ptr->function_state.function->common.scope) {
|
||||
class_name = ptr->function_state.function->common.scope->name;
|
||||
} else {
|
||||
zend_uint class_name_len;
|
||||
zend_size_t class_name_len;
|
||||
int dup;
|
||||
|
||||
dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC);
|
||||
@@ -2238,7 +2238,7 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit TSRMLS_DC)
|
||||
{
|
||||
zend_execute_data *ptr, *skip;
|
||||
int lineno, frameno = 0;
|
||||
zend_size_t lineno, frameno = 0;
|
||||
const char *function_name;
|
||||
const char *filename;
|
||||
const char *class_name;
|
||||
@@ -2279,7 +2279,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
|
||||
filename = skip->op_array->filename;
|
||||
lineno = skip->opline->lineno;
|
||||
add_assoc_string_ex(stack_frame, "file", sizeof("file"), (char*)filename, 1);
|
||||
add_assoc_long_ex(stack_frame, "line", sizeof("line"), lineno);
|
||||
add_assoc_int_ex(stack_frame, "line", sizeof("line"), lineno);
|
||||
|
||||
/* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function
|
||||
* and debug_baktrace() might have been called by the error_handler. in this case we don't
|
||||
@@ -2296,7 +2296,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
|
||||
}
|
||||
if (prev->op_array) {
|
||||
add_assoc_string_ex(stack_frame, "file", sizeof("file"), (char*)prev->op_array->filename, 1);
|
||||
add_assoc_long_ex(stack_frame, "line", sizeof("line"), prev->opline->lineno);
|
||||
add_assoc_int_ex(stack_frame, "line", sizeof("line"), prev->opline->lineno);
|
||||
break;
|
||||
}
|
||||
prev = prev->prev_execute_data;
|
||||
@@ -2320,7 +2320,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
|
||||
if (ptr->function_state.function->common.scope) {
|
||||
add_assoc_string_ex(stack_frame, "class", sizeof("class"), (char*)ptr->function_state.function->common.scope->name, 1);
|
||||
} else {
|
||||
zend_uint class_name_len;
|
||||
zend_size_t class_name_len;
|
||||
int dup;
|
||||
|
||||
dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC);
|
||||
@@ -2409,10 +2409,10 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
|
||||
Return backtrace as array */
|
||||
ZEND_FUNCTION(debug_backtrace)
|
||||
{
|
||||
long options = DEBUG_BACKTRACE_PROVIDE_OBJECT;
|
||||
long limit = 0;
|
||||
zend_int_t options = DEBUG_BACKTRACE_PROVIDE_OBJECT;
|
||||
zend_int_t limit = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &options, &limit) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ii", &options, &limit) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2425,10 +2425,10 @@ ZEND_FUNCTION(debug_backtrace)
|
||||
ZEND_FUNCTION(extension_loaded)
|
||||
{
|
||||
char *extension_name;
|
||||
int extension_name_len;
|
||||
zend_size_t extension_name_len;
|
||||
char *lcname;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &extension_name, &extension_name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2448,11 +2448,11 @@ ZEND_FUNCTION(extension_loaded)
|
||||
ZEND_FUNCTION(get_extension_funcs)
|
||||
{
|
||||
char *extension_name, *lcname;
|
||||
int extension_name_len, array;
|
||||
zend_size_t extension_name_len, array;
|
||||
zend_module_entry *module;
|
||||
HashPosition iterator;
|
||||
zend_function *zif;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &extension_name, &extension_name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (strncasecmp(extension_name, "zend", sizeof("zend"))) {
|
||||
|
||||
@@ -95,19 +95,19 @@ ZEND_METHOD(Closure, bind)
|
||||
ce = NULL;
|
||||
} else {
|
||||
char *class_name;
|
||||
int class_name_len;
|
||||
zend_size_t class_name_len;
|
||||
zval tmp_zval;
|
||||
INIT_ZVAL(tmp_zval);
|
||||
|
||||
if (Z_TYPE_P(scope_arg) == IS_STRING) {
|
||||
class_name = Z_STRVAL_P(scope_arg);
|
||||
class_name_len = Z_STRLEN_P(scope_arg);
|
||||
class_name_len = Z_STRSIZE_P(scope_arg);
|
||||
} else {
|
||||
tmp_zval = *scope_arg;
|
||||
zval_copy_ctor(&tmp_zval);
|
||||
convert_to_string(&tmp_zval);
|
||||
class_name = Z_STRVAL(tmp_zval);
|
||||
class_name_len = Z_STRLEN(tmp_zval);
|
||||
class_name_len = Z_STRSIZE(tmp_zval);
|
||||
}
|
||||
|
||||
if ((class_name_len == sizeof("static") - 1) &&
|
||||
@@ -174,7 +174,7 @@ ZEND_API zval* zend_get_closure_this_ptr(zval *obj TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zend_function *zend_closure_get_method(zval **object_ptr, char *method_name, int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */
|
||||
static zend_function *zend_closure_get_method(zval **object_ptr, char *method_name, zend_size_t method_len, const zend_literal *key TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
char *lc_name;
|
||||
ALLOCA_FLAG(use_heap)
|
||||
@@ -338,14 +338,14 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_
|
||||
}
|
||||
|
||||
if (arg_info) {
|
||||
zend_uint i, required = closure->func.common.required_num_args;
|
||||
zend_size_t i, required = closure->func.common.required_num_args;
|
||||
|
||||
MAKE_STD_ZVAL(val);
|
||||
array_init(val);
|
||||
|
||||
for (i = 0; i < closure->func.common.num_args; i++) {
|
||||
char *name, *info;
|
||||
int name_len, info_len;
|
||||
zend_size_t name_len, info_len;
|
||||
if (arg_info->name) {
|
||||
name_len = zend_spprintf(&name, 0, "%s$%s",
|
||||
arg_info->pass_by_reference ? "&" : "",
|
||||
|
||||
+295
-295
File diff suppressed because it is too large.
Load diff
+40
-36
@@ -40,7 +40,7 @@
|
||||
#define INC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { (CG(context).backpatch_count++); }
|
||||
#define DEC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { (CG(context).backpatch_count--); }
|
||||
#define HANDLE_INTERACTIVE() if (CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) { execute_new_code(TSRMLS_C); }
|
||||
#define DO_TICKS() if (Z_LVAL(CG(declarables).ticks)) { zend_do_ticks(TSRMLS_C); }
|
||||
#define DO_TICKS() if (Z_IVAL(CG(declarables).ticks)) { zend_do_ticks(TSRMLS_C); }
|
||||
|
||||
#define RESET_DOC_COMMENT() \
|
||||
{ \
|
||||
@@ -68,7 +68,7 @@ typedef struct _zend_compiler_context {
|
||||
|
||||
typedef struct _zend_literal {
|
||||
zval constant;
|
||||
zend_ulong hash_value;
|
||||
zend_uint_t hash_value;
|
||||
zend_uint cache_slot;
|
||||
} zend_literal;
|
||||
|
||||
@@ -78,8 +78,8 @@ typedef struct _zend_literal {
|
||||
typedef union _znode_op {
|
||||
zend_uint constant;
|
||||
zend_uint var;
|
||||
zend_uint num;
|
||||
zend_ulong hash;
|
||||
zend_size_t num;
|
||||
zend_uint_t hash;
|
||||
zend_uint opline_num; /* Needs to be signed */
|
||||
zend_op *jmp_addr;
|
||||
zval *zv;
|
||||
@@ -113,8 +113,8 @@ struct _zend_op {
|
||||
znode_op op1;
|
||||
znode_op op2;
|
||||
znode_op result;
|
||||
ulong extended_value;
|
||||
uint lineno;
|
||||
zend_uint_t extended_value;
|
||||
zend_size_t lineno;
|
||||
zend_uchar opcode;
|
||||
zend_uchar op1_type;
|
||||
zend_uchar op2_type;
|
||||
@@ -141,8 +141,12 @@ typedef struct _zend_try_catch_element {
|
||||
zend_uint finally_end;
|
||||
} zend_try_catch_element;
|
||||
|
||||
#if SIZEOF_LONG == 8
|
||||
#define THIS_HASHVAL 210728972157UL
|
||||
#if SIZEOF_ZEND_INT == 8
|
||||
# ifdef _WIN32
|
||||
# define THIS_HASHVAL 210728972157Ui64
|
||||
# else
|
||||
# define THIS_HASHVAL 210728972157ULL
|
||||
# endif
|
||||
#else
|
||||
#define THIS_HASHVAL 275574653UL
|
||||
#endif
|
||||
@@ -223,20 +227,20 @@ char *zend_visibility_string(zend_uint fn_flags);
|
||||
typedef struct _zend_property_info {
|
||||
zend_uint flags;
|
||||
const char *name;
|
||||
int name_length;
|
||||
ulong h;
|
||||
zend_size_t name_length;
|
||||
zend_uint_t h;
|
||||
int offset;
|
||||
const char *doc_comment;
|
||||
int doc_comment_len;
|
||||
zend_size_t doc_comment_len;
|
||||
zend_class_entry *ce;
|
||||
} zend_property_info;
|
||||
|
||||
|
||||
typedef struct _zend_arg_info {
|
||||
const char *name;
|
||||
zend_uint name_len;
|
||||
zend_size_t name_len;
|
||||
const char *class_name;
|
||||
zend_uint class_name_len;
|
||||
zend_size_t class_name_len;
|
||||
zend_uchar type_hint;
|
||||
zend_uchar pass_by_reference;
|
||||
zend_bool allow_null;
|
||||
@@ -249,9 +253,9 @@ typedef struct _zend_arg_info {
|
||||
*/
|
||||
typedef struct _zend_internal_function_info {
|
||||
const char *_name;
|
||||
zend_uint _name_len;
|
||||
zend_size_t _name_len;
|
||||
const char *_class_name;
|
||||
zend_uint required_num_args;
|
||||
zend_size_t required_num_args;
|
||||
zend_uchar _type_hint;
|
||||
zend_bool return_reference;
|
||||
zend_bool _allow_null;
|
||||
@@ -260,8 +264,8 @@ typedef struct _zend_internal_function_info {
|
||||
|
||||
typedef struct _zend_compiled_variable {
|
||||
const char *name;
|
||||
int name_len;
|
||||
ulong hash_value;
|
||||
zend_size_t name_len;
|
||||
zend_uint_t hash_value;
|
||||
} zend_compiled_variable;
|
||||
|
||||
struct _zend_op_array {
|
||||
@@ -271,8 +275,8 @@ struct _zend_op_array {
|
||||
zend_class_entry *scope;
|
||||
zend_uint fn_flags;
|
||||
union _zend_function *prototype;
|
||||
zend_uint num_args;
|
||||
zend_uint required_num_args;
|
||||
zend_size_t num_args;
|
||||
zend_size_t required_num_args;
|
||||
zend_arg_info *arg_info;
|
||||
/* END of common elements */
|
||||
|
||||
@@ -302,10 +306,10 @@ struct _zend_op_array {
|
||||
zend_uint this_var;
|
||||
|
||||
const char *filename;
|
||||
zend_uint line_start;
|
||||
zend_uint line_end;
|
||||
zend_size_t line_start;
|
||||
zend_size_t line_end;
|
||||
const char *doc_comment;
|
||||
zend_uint doc_comment_len;
|
||||
zend_size_t doc_comment_len;
|
||||
zend_uint early_binding; /* the linked list of delayed declarations */
|
||||
|
||||
zend_literal *literals;
|
||||
@@ -328,8 +332,8 @@ typedef struct _zend_internal_function {
|
||||
zend_class_entry *scope;
|
||||
zend_uint fn_flags;
|
||||
union _zend_function *prototype;
|
||||
zend_uint num_args;
|
||||
zend_uint required_num_args;
|
||||
zend_size_t num_args;
|
||||
zend_size_t required_num_args;
|
||||
zend_arg_info *arg_info;
|
||||
/* END of common elements */
|
||||
|
||||
@@ -348,8 +352,8 @@ typedef union _zend_function {
|
||||
zend_class_entry *scope;
|
||||
zend_uint fn_flags;
|
||||
union _zend_function *prototype;
|
||||
zend_uint num_args;
|
||||
zend_uint required_num_args;
|
||||
zend_size_t num_args;
|
||||
zend_size_t required_num_args;
|
||||
zend_arg_info *arg_info;
|
||||
} common;
|
||||
|
||||
@@ -447,14 +451,14 @@ void shutdown_scanner(TSRMLS_D);
|
||||
ZEND_API char *zend_set_compiled_filename(const char *new_compiled_filename TSRMLS_DC);
|
||||
ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC);
|
||||
ZEND_API char *zend_get_compiled_filename(TSRMLS_D);
|
||||
ZEND_API int zend_get_compiled_lineno(TSRMLS_D);
|
||||
ZEND_API zend_uint_t zend_get_compiled_lineno(TSRMLS_D);
|
||||
ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D);
|
||||
|
||||
void zend_resolve_non_class_name(znode *element_name, zend_bool *check_namespace, zend_bool case_sensitive, HashTable *current_import_sub TSRMLS_DC);
|
||||
void zend_resolve_function_name(znode *element_name, zend_bool *check_namespace TSRMLS_DC);
|
||||
void zend_resolve_const_name(znode *element_name, zend_bool *check_namespace TSRMLS_DC);
|
||||
void zend_resolve_class_name(znode *class_name TSRMLS_DC);
|
||||
ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len);
|
||||
ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, zend_size_t* name_len);
|
||||
|
||||
#ifdef ZTS
|
||||
const char *zend_get_zendtext(TSRMLS_D);
|
||||
@@ -692,10 +696,10 @@ ZEND_API void zend_function_dtor(zend_function *function);
|
||||
ZEND_API void destroy_zend_class(zend_class_entry **pce);
|
||||
void zend_class_add_ref(zend_class_entry **ce);
|
||||
|
||||
ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, const char *src1, int src1_length, const char *src2, int src2_length, int internal);
|
||||
ZEND_API void zend_mangle_property_name(char **dest, zend_size_t *dest_length, const char *src1, zend_size_t src1_length, const char *src2, zend_size_t src2_length, int internal);
|
||||
#define zend_unmangle_property_name(mangled_property, mangled_property_len, class_name, prop_name) \
|
||||
zend_unmangle_property_name_ex(mangled_property, mangled_property_len, class_name, prop_name, NULL)
|
||||
ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int mangled_property_len, const char **class_name, const char **prop_name, int *prop_len);
|
||||
ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, zend_size_t mangled_property_len, const char **class_name, const char **prop_name, zend_size_t *prop_len);
|
||||
|
||||
#define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor
|
||||
#define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
|
||||
@@ -713,21 +717,21 @@ void zend_do_mark_last_catch(const znode *first_catch, const znode *last_additio
|
||||
ZEND_API zend_bool zend_is_compiling(TSRMLS_D);
|
||||
ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC);
|
||||
ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC);
|
||||
int zend_get_class_fetch_type(const char *class_name, uint class_name_len);
|
||||
int zend_get_class_fetch_type(const char *class_name, zend_size_t class_name_len);
|
||||
|
||||
typedef zend_bool (*zend_auto_global_callback)(const char *name, uint name_len TSRMLS_DC);
|
||||
typedef zend_bool (*zend_auto_global_callback)(const char *name, zend_size_t name_len TSRMLS_DC);
|
||||
typedef struct _zend_auto_global {
|
||||
const char *name;
|
||||
uint name_len;
|
||||
zend_size_t name_len;
|
||||
zend_auto_global_callback auto_global_callback;
|
||||
zend_bool jit;
|
||||
zend_bool armed;
|
||||
} zend_auto_global;
|
||||
|
||||
ZEND_API int zend_register_auto_global(const char *name, uint name_len, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC);
|
||||
ZEND_API int zend_register_auto_global(const char *name, zend_size_t name_len, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC);
|
||||
ZEND_API void zend_activate_auto_globals(TSRMLS_D);
|
||||
ZEND_API zend_bool zend_is_auto_global(const char *name, uint name_len TSRMLS_DC);
|
||||
ZEND_API zend_bool zend_is_auto_global_quick(const char *name, uint name_len, ulong hashval TSRMLS_DC);
|
||||
ZEND_API zend_bool zend_is_auto_global(const char *name, zend_size_t name_len TSRMLS_DC);
|
||||
ZEND_API zend_bool zend_is_auto_global_quick(const char *name, zend_size_t name_len, zend_uint_t hashval TSRMLS_DC);
|
||||
ZEND_API size_t zend_dirname(char *path, size_t len);
|
||||
|
||||
int zendlex(znode *zendlval TSRMLS_DC);
|
||||
|
||||
+44
-44
@@ -95,26 +95,26 @@ int zend_startup_constants(TSRMLS_D)
|
||||
|
||||
void zend_register_standard_constants(TSRMLS_D)
|
||||
{
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_RECOVERABLE_ERROR", E_RECOVERABLE_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_STRICT", E_STRICT, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_DEPRECATED", E_DEPRECATED, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_USER_DEPRECATED", E_USER_DEPRECATED, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_RECOVERABLE_ERROR", E_RECOVERABLE_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_STRICT", E_STRICT, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_DEPRECATED", E_DEPRECATED, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_USER_DEPRECATED", E_USER_DEPRECATED, CONST_PERSISTENT | CONST_CS);
|
||||
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS);
|
||||
|
||||
REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_PROVIDE_OBJECT", DEBUG_BACKTRACE_PROVIDE_OBJECT, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_IGNORE_ARGS", DEBUG_BACKTRACE_IGNORE_ARGS, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("DEBUG_BACKTRACE_PROVIDE_OBJECT", DEBUG_BACKTRACE_PROVIDE_OBJECT, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_INT_CONSTANT("DEBUG_BACKTRACE_IGNORE_ARGS", DEBUG_BACKTRACE_IGNORE_ARGS, CONST_PERSISTENT | CONST_CS);
|
||||
/* true/false constants */
|
||||
{
|
||||
REGISTER_MAIN_BOOL_CONSTANT("TRUE", 1, CONST_PERSISTENT | CONST_CT_SUBST);
|
||||
@@ -143,7 +143,7 @@ void clean_non_persistent_constants(TSRMLS_D)
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void zend_register_null_constant(const char *name, uint name_len, int flags, int module_number TSRMLS_DC)
|
||||
ZEND_API void zend_register_null_constant(const char *name, zend_size_t name_len, int flags, int module_number TSRMLS_DC)
|
||||
{
|
||||
zend_constant c;
|
||||
|
||||
@@ -155,7 +155,7 @@ ZEND_API void zend_register_null_constant(const char *name, uint name_len, int f
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API void zend_register_bool_constant(const char *name, uint name_len, zend_bool bval, int flags, int module_number TSRMLS_DC)
|
||||
ZEND_API void zend_register_bool_constant(const char *name, zend_size_t name_len, zend_bool bval, int flags, int module_number TSRMLS_DC)
|
||||
{
|
||||
zend_constant c;
|
||||
|
||||
@@ -167,11 +167,11 @@ ZEND_API void zend_register_bool_constant(const char *name, uint name_len, zend_
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API void zend_register_long_constant(const char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC)
|
||||
ZEND_API void zend_register_int_constant(const char *name, zend_size_t name_len, zend_int_t lval, int flags, int module_number TSRMLS_DC)
|
||||
{
|
||||
zend_constant c;
|
||||
|
||||
ZVAL_LONG(&c.value, lval);
|
||||
ZVAL_INT(&c.value, lval);
|
||||
c.flags = flags;
|
||||
c.name = zend_strndup(name, name_len-1);
|
||||
c.name_len = name_len;
|
||||
@@ -180,7 +180,7 @@ ZEND_API void zend_register_long_constant(const char *name, uint name_len, long
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_register_double_constant(const char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC)
|
||||
ZEND_API void zend_register_double_constant(const char *name, zend_size_t name_len, double dval, int flags, int module_number TSRMLS_DC)
|
||||
{
|
||||
zend_constant c;
|
||||
|
||||
@@ -193,7 +193,7 @@ ZEND_API void zend_register_double_constant(const char *name, uint name_len, dou
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC)
|
||||
ZEND_API void zend_register_stringl_constant(const char *name, zend_size_t name_len, char *strval, zend_size_t strlen, int flags, int module_number TSRMLS_DC)
|
||||
{
|
||||
zend_constant c;
|
||||
|
||||
@@ -206,12 +206,12 @@ ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, ch
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_register_string_constant(const char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC)
|
||||
ZEND_API void zend_register_string_constant(const char *name, zend_size_t name_len, char *strval, int flags, int module_number TSRMLS_DC)
|
||||
{
|
||||
zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number TSRMLS_CC);
|
||||
}
|
||||
|
||||
static int zend_get_special_constant(const char *name, uint name_len, zend_constant **c TSRMLS_DC)
|
||||
static int zend_get_special_constant(const char *name, zend_size_t name_len, zend_constant **c TSRMLS_DC)
|
||||
{
|
||||
int ret;
|
||||
static char haltoff[] = "__COMPILER_HALT_OFFSET__";
|
||||
@@ -224,7 +224,7 @@ static int zend_get_special_constant(const char *name, uint name_len, zend_const
|
||||
|
||||
/* Returned constants may be cached, so they have to be stored */
|
||||
if (EG(scope) && EG(scope)->name) {
|
||||
int const_name_len;
|
||||
zend_size_t const_name_len;
|
||||
char *const_name;
|
||||
ALLOCA_FLAG(use_heap)
|
||||
|
||||
@@ -236,7 +236,7 @@ static int zend_get_special_constant(const char *name, uint name_len, zend_const
|
||||
zend_hash_add(EG(zend_constants), const_name, const_name_len, (void*)&tmp, sizeof(zend_constant), (void**)c);
|
||||
memset(*c, 0, sizeof(zend_constant));
|
||||
Z_STRVAL((**c).value) = estrndup(EG(scope)->name, EG(scope)->name_length);
|
||||
Z_STRLEN((**c).value) = EG(scope)->name_length;
|
||||
Z_STRSIZE((**c).value) = EG(scope)->name_length;
|
||||
Z_TYPE((**c).value) = IS_STRING;
|
||||
}
|
||||
free_alloca(const_name, use_heap);
|
||||
@@ -245,7 +245,7 @@ static int zend_get_special_constant(const char *name, uint name_len, zend_const
|
||||
zend_hash_add(EG(zend_constants), "\0__CLASS__", sizeof("\0__CLASS__"), (void*)&tmp, sizeof(zend_constant), (void**)c);
|
||||
memset(*c, 0, sizeof(zend_constant));
|
||||
Z_STRVAL((**c).value) = estrndup("", 0);
|
||||
Z_STRLEN((**c).value) = 0;
|
||||
Z_STRSIZE((**c).value) = 0;
|
||||
Z_TYPE((**c).value) = IS_STRING;
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ static int zend_get_special_constant(const char *name, uint name_len, zend_const
|
||||
!memcmp(name, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1)) {
|
||||
const char *cfilename;
|
||||
char *haltname;
|
||||
int len, clen;
|
||||
zend_size_t len, clen;
|
||||
|
||||
cfilename = zend_get_executed_filename(TSRMLS_C);
|
||||
clen = strlen(cfilename);
|
||||
@@ -270,7 +270,7 @@ static int zend_get_special_constant(const char *name, uint name_len, zend_const
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_get_constant(const char *name, uint name_len, zval *result TSRMLS_DC)
|
||||
ZEND_API int zend_get_constant(const char *name, zend_size_t name_len, zval *result TSRMLS_DC)
|
||||
{
|
||||
zend_constant *c;
|
||||
int retval = 1;
|
||||
@@ -299,7 +299,7 @@ ZEND_API int zend_get_constant(const char *name, uint name_len, zval *result TSR
|
||||
return retval;
|
||||
}
|
||||
|
||||
ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC)
|
||||
ZEND_API int zend_get_constant_ex(const char *name, zend_size_t name_len, zval *result, zend_class_entry *scope, zend_uint_t flags TSRMLS_DC)
|
||||
{
|
||||
zend_constant *c;
|
||||
int retval = 1;
|
||||
@@ -317,8 +317,8 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
|
||||
|
||||
if ((colon = zend_memrchr(name, ':', name_len)) &&
|
||||
colon > name && (*(colon - 1) == ':')) {
|
||||
int class_name_len = colon - name - 1;
|
||||
int const_name_len = name_len - class_name_len - 2;
|
||||
zend_size_t class_name_len = colon - name - 1;
|
||||
zend_size_t const_name_len = name_len - class_name_len - 2;
|
||||
const char *constant_name = colon + 1;
|
||||
char *lcname;
|
||||
|
||||
@@ -380,8 +380,8 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
|
||||
/* non-class constant */
|
||||
if ((colon = zend_memrchr(name, '\\', name_len)) != NULL) {
|
||||
/* compound constant name */
|
||||
int prefix_len = colon - name;
|
||||
int const_name_len = name_len - prefix_len - 1;
|
||||
zend_size_t prefix_len = colon - name;
|
||||
zend_size_t const_name_len = name_len - prefix_len - 1;
|
||||
const char *constant_name = colon + 1;
|
||||
char *lcname;
|
||||
int found_const = 0;
|
||||
@@ -435,30 +435,30 @@ finish:
|
||||
return zend_get_constant(name, name_len, result TSRMLS_CC);
|
||||
}
|
||||
|
||||
zend_constant *zend_quick_get_constant(const zend_literal *key, ulong flags TSRMLS_DC)
|
||||
zend_constant *zend_quick_get_constant(const zend_literal *key, zend_uint_t flags TSRMLS_DC)
|
||||
{
|
||||
zend_constant *c;
|
||||
|
||||
if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) {
|
||||
if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRSIZE(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) {
|
||||
key++;
|
||||
if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE ||
|
||||
if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRSIZE(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE ||
|
||||
(c->flags & CONST_CS) != 0) {
|
||||
if ((flags & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) {
|
||||
key++;
|
||||
if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) {
|
||||
if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRSIZE(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) {
|
||||
key++;
|
||||
if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE ||
|
||||
if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRSIZE(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE ||
|
||||
(c->flags & CONST_CS) != 0) {
|
||||
|
||||
key--;
|
||||
if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRLEN(key->constant), &c TSRMLS_CC)) {
|
||||
if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRSIZE(key->constant), &c TSRMLS_CC)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
key--;
|
||||
if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRLEN(key->constant), &c TSRMLS_CC)) {
|
||||
if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRSIZE(key->constant), &c TSRMLS_CC)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -472,7 +472,7 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
|
||||
char *lowercase_name = NULL;
|
||||
char *name;
|
||||
int ret = SUCCESS;
|
||||
ulong chash;
|
||||
zend_uint_t chash;
|
||||
|
||||
#if 0
|
||||
printf("Registering constant for module %d\n", c->module_number);
|
||||
|
||||
+13
-13
@@ -34,27 +34,27 @@ typedef struct _zend_constant {
|
||||
zval value;
|
||||
int flags;
|
||||
char *name;
|
||||
uint name_len;
|
||||
zend_size_t name_len;
|
||||
int module_number;
|
||||
} zend_constant;
|
||||
|
||||
#define REGISTER_NULL_CONSTANT(name, flags) zend_register_null_constant((name), sizeof(name), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_BOOL_CONSTANT(name, bval, flags) zend_register_bool_constant((name), sizeof(name), (bval), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_INT_CONSTANT(name, lval, flags) zend_register_int_constant((name), sizeof(name), (lval), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), module_number TSRMLS_CC)
|
||||
|
||||
#define REGISTER_NS_NULL_CONSTANT(ns, name, flags) zend_register_null_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_NS_BOOL_CONSTANT(ns, name, bval, flags) zend_register_bool_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (bval), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (lval), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_NS_INT_CONSTANT(ns, name, lval, flags) zend_register_int_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (lval), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_NS_DOUBLE_CONSTANT(ns, name, dval, flags) zend_register_double_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (dval), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_NS_STRING_CONSTANT(ns, name, str, flags) zend_register_string_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (flags), module_number TSRMLS_CC)
|
||||
#define REGISTER_NS_STRINGL_CONSTANT(ns, name, str, len, flags) zend_register_stringl_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (len), (flags), module_number TSRMLS_CC)
|
||||
|
||||
#define REGISTER_MAIN_NULL_CONSTANT(name, flags) zend_register_null_constant((name), sizeof(name), (flags), 0 TSRMLS_CC)
|
||||
#define REGISTER_MAIN_BOOL_CONSTANT(name, bval, flags) zend_register_bool_constant((name), sizeof(name), (bval), (flags), 0 TSRMLS_CC)
|
||||
#define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), 0 TSRMLS_CC)
|
||||
#define REGISTER_MAIN_INT_CONSTANT(name, lval, flags) zend_register_int_constant((name), sizeof(name), (lval), (flags), 0 TSRMLS_CC)
|
||||
#define REGISTER_MAIN_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), 0 TSRMLS_CC)
|
||||
#define REGISTER_MAIN_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), 0 TSRMLS_CC)
|
||||
#define REGISTER_MAIN_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), 0 TSRMLS_CC)
|
||||
@@ -66,18 +66,18 @@ int zend_startup_constants(TSRMLS_D);
|
||||
int zend_shutdown_constants(TSRMLS_D);
|
||||
void zend_register_standard_constants(TSRMLS_D);
|
||||
void clean_non_persistent_constants(TSRMLS_D);
|
||||
ZEND_API int zend_get_constant(const char *name, uint name_len, zval *result TSRMLS_DC);
|
||||
ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC);
|
||||
ZEND_API void zend_register_bool_constant(const char *name, uint name_len, zend_bool bval, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_register_null_constant(const char *name, uint name_len, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_register_long_constant(const char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_register_double_constant(const char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_register_string_constant(const char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API int zend_get_constant(const char *name, zend_size_t name_len, zval *result TSRMLS_DC);
|
||||
ZEND_API int zend_get_constant_ex(const char *name, zend_size_t name_len, zval *result, zend_class_entry *scope, zend_uint_t flags TSRMLS_DC);
|
||||
ZEND_API void zend_register_int_constant(const char *name, zend_size_t name_len, zend_int_t lval, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_register_double_constant(const char *name, zend_size_t name_len, double dval, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_register_string_constant(const char *name, zend_size_t name_len, char *strval, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_register_stringl_constant(const char *name, zend_size_t name_len, char *strval, zend_size_t strlen, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_register_bool_constant(const char *name, zend_size_t name_len, zend_bool bval, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_register_null_constant(const char *name, zend_size_t name_len, int flags, int module_number TSRMLS_DC);
|
||||
ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC);
|
||||
void zend_copy_constants(HashTable *target, HashTable *sourc);
|
||||
void copy_zend_constant(zend_constant *c);
|
||||
zend_constant *zend_quick_get_constant(const zend_literal *key, ulong flags TSRMLS_DC);
|
||||
zend_constant *zend_quick_get_constant(const zend_literal *key, zend_uint_t flags TSRMLS_DC);
|
||||
END_EXTERN_C()
|
||||
|
||||
#define ZEND_CONSTANT_DTOR (void (*)(void *)) free_zend_constant
|
||||
|
||||
+67
-65
@@ -86,7 +86,7 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
|
||||
#ifdef HAVE_DTRACE
|
||||
if (DTRACE_EXCEPTION_THROWN_ENABLED()) {
|
||||
const char *classname;
|
||||
zend_uint name_len;
|
||||
zend_size_t name_len;
|
||||
|
||||
if (exception != NULL) {
|
||||
zend_get_object_classname(exception, &classname, &name_len TSRMLS_CC);
|
||||
@@ -161,7 +161,7 @@ static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_t
|
||||
zend_fetch_debug_backtrace(trace, skip_top_traces, 0, 0 TSRMLS_CC);
|
||||
|
||||
zend_update_property_string(default_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
|
||||
zend_update_property_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
|
||||
zend_update_property_int(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
|
||||
zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC);
|
||||
|
||||
return Z_OBJVAL(obj);
|
||||
@@ -194,11 +194,12 @@ ZEND_METHOD(exception, __clone)
|
||||
ZEND_METHOD(exception, __construct)
|
||||
{
|
||||
char *message = NULL;
|
||||
long code = 0;
|
||||
zend_int_t code = 0;
|
||||
zval *object, *previous = NULL;
|
||||
int argc = ZEND_NUM_ARGS(), message_len;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
zend_size_t message_len;
|
||||
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|slO!", &message, &message_len, &code, &previous, default_exception_ce) == FAILURE) {
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|SiO!", &message, &message_len, &code, &previous, default_exception_ce) == FAILURE) {
|
||||
zend_error(E_ERROR, "Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])");
|
||||
}
|
||||
|
||||
@@ -209,7 +210,7 @@ ZEND_METHOD(exception, __construct)
|
||||
}
|
||||
|
||||
if (code) {
|
||||
zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
|
||||
zend_update_property_int(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (previous) {
|
||||
@@ -223,11 +224,12 @@ ZEND_METHOD(exception, __construct)
|
||||
ZEND_METHOD(error_exception, __construct)
|
||||
{
|
||||
char *message = NULL, *filename = NULL;
|
||||
long code = 0, severity = E_ERROR, lineno;
|
||||
zend_int_t code = 0, severity = E_ERROR, lineno;
|
||||
zval *object, *previous = NULL;
|
||||
int argc = ZEND_NUM_ARGS(), message_len, filename_len;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
zend_size_t message_len, filename_len;
|
||||
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|sllslO!", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno, &previous, default_exception_ce) == FAILURE) {
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|SiiSiO!", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno, &previous, default_exception_ce) == FAILURE) {
|
||||
zend_error(E_ERROR, "Wrong parameters for ErrorException([string $exception [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Exception $previous = NULL]]]]]])");
|
||||
}
|
||||
|
||||
@@ -238,21 +240,21 @@ ZEND_METHOD(error_exception, __construct)
|
||||
}
|
||||
|
||||
if (code) {
|
||||
zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
|
||||
zend_update_property_int(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (previous) {
|
||||
zend_update_property(default_exception_ce, object, "previous", sizeof("previous")-1, previous TSRMLS_CC);
|
||||
}
|
||||
|
||||
zend_update_property_long(default_exception_ce, object, "severity", sizeof("severity")-1, severity TSRMLS_CC);
|
||||
zend_update_property_int(default_exception_ce, object, "severity", sizeof("severity")-1, severity TSRMLS_CC);
|
||||
|
||||
if (argc >= 4) {
|
||||
zend_update_property_string(default_exception_ce, object, "file", sizeof("file")-1, filename TSRMLS_CC);
|
||||
if (argc < 5) {
|
||||
lineno = 0; /* invalidate lineno */
|
||||
}
|
||||
zend_update_property_long(default_exception_ce, object, "line", sizeof("line")-1, lineno TSRMLS_CC);
|
||||
zend_update_property_int(default_exception_ce, object, "line", sizeof("line")-1, lineno TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -262,7 +264,7 @@ ZEND_METHOD(error_exception, __construct)
|
||||
return; \
|
||||
}
|
||||
|
||||
static void _default_exception_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) /* {{{ */
|
||||
static void _default_exception_get_entry(zval *object, char *name, zend_size_t name_len, zval *return_value TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval *value;
|
||||
|
||||
@@ -341,7 +343,7 @@ ZEND_METHOD(error_exception, getSeverity)
|
||||
|
||||
#define TRACE_APPEND_STRL(val, vallen) \
|
||||
{ \
|
||||
int l = vallen; \
|
||||
zend_size_t l = vallen; \
|
||||
*str = (char*)erealloc(*str, *len + l + 1); \
|
||||
memcpy((*str) + *len, val, l); \
|
||||
*len += l; \
|
||||
@@ -356,7 +358,7 @@ ZEND_METHOD(error_exception, getSeverity)
|
||||
zend_error(E_WARNING, "Value for %s is no string", key); \
|
||||
TRACE_APPEND_STR("[unknown]"); \
|
||||
} else { \
|
||||
TRACE_APPEND_STRL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); \
|
||||
TRACE_APPEND_STRL(Z_STRVAL_PP(tmp), Z_STRSIZE_PP(tmp)); \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -370,10 +372,10 @@ ZEND_METHOD(error_exception, getSeverity)
|
||||
static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
|
||||
{
|
||||
char **str;
|
||||
int *len;
|
||||
zend_size_t *len;
|
||||
|
||||
str = va_arg(args, char**);
|
||||
len = va_arg(args, int*);
|
||||
len = va_arg(args, zend_size_t*);
|
||||
|
||||
/* the trivial way would be to do:
|
||||
* convert_to_string_ex(arg);
|
||||
@@ -386,14 +388,14 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
|
||||
TRACE_APPEND_STR("NULL, ");
|
||||
break;
|
||||
case IS_STRING: {
|
||||
int l_added;
|
||||
zend_size_t l_added;
|
||||
TRACE_APPEND_CHR('\'');
|
||||
if (Z_STRLEN_PP(arg) > 15) {
|
||||
if (Z_STRSIZE_PP(arg) > 15) {
|
||||
TRACE_APPEND_STRL(Z_STRVAL_PP(arg), 15);
|
||||
TRACE_APPEND_STR("...', ");
|
||||
l_added = 15 + 6 + 1; /* +1 because of while (--l_added) */
|
||||
} else {
|
||||
l_added = Z_STRLEN_PP(arg);
|
||||
l_added = Z_STRSIZE_PP(arg);
|
||||
TRACE_APPEND_STRL(Z_STRVAL_PP(arg), l_added);
|
||||
TRACE_APPEND_STR("', ");
|
||||
l_added += 3 + 1;
|
||||
@@ -456,7 +458,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
|
||||
break;
|
||||
}
|
||||
case IS_BOOL:
|
||||
if (Z_LVAL_PP(arg)) {
|
||||
if (Z_IVAL_PP(arg)) {
|
||||
TRACE_APPEND_STR("true, ");
|
||||
} else {
|
||||
TRACE_APPEND_STR("false, ");
|
||||
@@ -465,10 +467,10 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
|
||||
case IS_RESOURCE:
|
||||
TRACE_APPEND_STR("Resource id #");
|
||||
/* break; */
|
||||
case IS_LONG: {
|
||||
long lval = Z_LVAL_PP(arg);
|
||||
char s_tmp[MAX_LENGTH_OF_LONG + 1];
|
||||
int l_tmp = zend_sprintf(s_tmp, "%ld", lval); /* SAFE */
|
||||
case IS_INT: {
|
||||
zend_int_t lval = Z_IVAL_PP(arg);
|
||||
char s_tmp[MAX_LENGTH_OF_ZEND_INT + 1];
|
||||
zend_size_t l_tmp = zend_sprintf(s_tmp, ZEND_INT_FMT, lval); /* SAFE */
|
||||
TRACE_APPEND_STRL(s_tmp, l_tmp);
|
||||
TRACE_APPEND_STR(", ");
|
||||
break;
|
||||
@@ -476,7 +478,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
|
||||
case IS_DOUBLE: {
|
||||
double dval = Z_DVAL_PP(arg);
|
||||
char *s_tmp;
|
||||
int l_tmp;
|
||||
zend_size_t l_tmp;
|
||||
|
||||
s_tmp = emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
|
||||
l_tmp = zend_sprintf(s_tmp, "%.*G", (int) EG(precision), dval); /* SAFE */
|
||||
@@ -491,7 +493,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
|
||||
break;
|
||||
case IS_OBJECT: {
|
||||
const char *class_name;
|
||||
zend_uint class_name_len;
|
||||
zend_size_t class_name_len;
|
||||
int dup;
|
||||
|
||||
TRACE_APPEND_STR("Object(");
|
||||
@@ -516,8 +518,8 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
|
||||
static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
|
||||
{
|
||||
char *s_tmp, **str;
|
||||
int *len, *num;
|
||||
long line;
|
||||
zend_size_t *len, *num;
|
||||
zend_int_t line;
|
||||
HashTable *ht = Z_ARRVAL_PP(frame);
|
||||
zval **file, **tmp;
|
||||
|
||||
@@ -527,11 +529,11 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg
|
||||
}
|
||||
|
||||
str = va_arg(args, char**);
|
||||
len = va_arg(args, int*);
|
||||
num = va_arg(args, int*);
|
||||
len = va_arg(args, zend_size_t*);
|
||||
num = va_arg(args, zend_size_t*);
|
||||
|
||||
s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 1 + 1);
|
||||
sprintf(s_tmp, "#%d ", (*num)++);
|
||||
s_tmp = emalloc(1 + MAX_LENGTH_OF_ZEND_INT + 1 + 1);
|
||||
sprintf(s_tmp, "#" ZEND_INT_FMT " ", (*num)++);
|
||||
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
|
||||
efree(s_tmp);
|
||||
if (zend_hash_find(ht, "file", sizeof("file"), (void**)&file) == SUCCESS) {
|
||||
@@ -540,8 +542,8 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg
|
||||
TRACE_APPEND_STR("[unknown function]");
|
||||
} else{
|
||||
if (zend_hash_find(ht, "line", sizeof("line"), (void**)&tmp) == SUCCESS) {
|
||||
if (Z_TYPE_PP(tmp) == IS_LONG) {
|
||||
line = Z_LVAL_PP(tmp);
|
||||
if (Z_TYPE_PP(tmp) == IS_INT) {
|
||||
line = Z_IVAL_PP(tmp);
|
||||
} else {
|
||||
zend_error(E_WARNING, "Line is no long");
|
||||
line = 0;
|
||||
@@ -549,8 +551,8 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg
|
||||
} else {
|
||||
line = 0;
|
||||
}
|
||||
s_tmp = emalloc(Z_STRLEN_PP(file) + MAX_LENGTH_OF_LONG + 4 + 1);
|
||||
sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_PP(file), line);
|
||||
s_tmp = emalloc(Z_STRSIZE_PP(file) + MAX_LENGTH_OF_ZEND_INT + 4 + 1);
|
||||
sprintf(s_tmp, "%s(" ZEND_INT_FMT "): ", Z_STRVAL_PP(file), line);
|
||||
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
|
||||
efree(s_tmp);
|
||||
}
|
||||
@@ -563,7 +565,7 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg
|
||||
TRACE_APPEND_CHR('(');
|
||||
if (zend_hash_find(ht, "args", sizeof("args"), (void**)&tmp) == SUCCESS) {
|
||||
if (Z_TYPE_PP(tmp) == IS_ARRAY) {
|
||||
int last_len = *len;
|
||||
zend_size_t last_len = *len;
|
||||
zend_hash_apply_with_arguments(Z_ARRVAL_PP(tmp) TSRMLS_CC, (apply_func_args_t)_build_trace_args, 2, str, len);
|
||||
if (last_len != *len) {
|
||||
*len -= 2; /* remove last ', ' */
|
||||
@@ -583,7 +585,7 @@ ZEND_METHOD(exception, getTraceAsString)
|
||||
{
|
||||
zval *trace;
|
||||
char *res, **str, *s_tmp;
|
||||
int res_len = 0, *len = &res_len, num = 0;
|
||||
zend_size_t res_len = 0, *len = &res_len, num = 0;
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
@@ -593,8 +595,8 @@ ZEND_METHOD(exception, getTraceAsString)
|
||||
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
|
||||
zend_hash_apply_with_arguments(Z_ARRVAL_P(trace) TSRMLS_CC, (apply_func_args_t)_build_trace_string, 3, str, len, &num);
|
||||
|
||||
s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 7 + 1);
|
||||
sprintf(s_tmp, "#%d {main}", num);
|
||||
s_tmp = emalloc(1 + MAX_LENGTH_OF_ZEND_INT + 7 + 1);
|
||||
sprintf(s_tmp, "#" ZEND_INT_FMT " {main}", num);
|
||||
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
|
||||
efree(s_tmp);
|
||||
|
||||
@@ -615,10 +617,10 @@ ZEND_METHOD(exception, getPrevious)
|
||||
RETURN_ZVAL(previous, 1, 0);
|
||||
}
|
||||
|
||||
int zend_spprintf(char **message, int max_len, const char *format, ...) /* {{{ */
|
||||
zend_size_t zend_spprintf(char **message, zend_size_t max_len, const char *format, ...) /* {{{ */
|
||||
{
|
||||
va_list arg;
|
||||
int len;
|
||||
zend_size_t len;
|
||||
|
||||
va_start(arg, format);
|
||||
len = zend_vspprintf(message, max_len, format, arg);
|
||||
@@ -633,7 +635,7 @@ ZEND_METHOD(exception, __toString)
|
||||
{
|
||||
zval message, file, line, *trace, *exception;
|
||||
char *str, *prev_str;
|
||||
int len = 0;
|
||||
zend_size_t len = 0;
|
||||
zend_fcall_info fci;
|
||||
zval fname;
|
||||
|
||||
@@ -652,7 +654,7 @@ ZEND_METHOD(exception, __toString)
|
||||
|
||||
convert_to_string(&message);
|
||||
convert_to_string(&file);
|
||||
convert_to_long(&line);
|
||||
convert_to_int(&line);
|
||||
|
||||
fci.size = sizeof(fci);
|
||||
fci.function_table = &Z_OBJCE_P(exception)->function_table;
|
||||
@@ -671,15 +673,15 @@ ZEND_METHOD(exception, __toString)
|
||||
trace = NULL;
|
||||
}
|
||||
|
||||
if (Z_STRLEN(message) > 0) {
|
||||
len = zend_spprintf(&str, 0, "exception '%s' with message '%s' in %s:%ld\nStack trace:\n%s%s%s",
|
||||
Z_OBJCE_P(exception)->name, Z_STRVAL(message), Z_STRVAL(file), Z_LVAL(line),
|
||||
(trace && Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n",
|
||||
if (Z_STRSIZE(message) > 0) {
|
||||
len = zend_spprintf(&str, 0, "exception '%s' with message '%s' in %s:" ZEND_INT_FMT "\nStack trace:\n%s%s%s",
|
||||
Z_OBJCE_P(exception)->name, Z_STRVAL(message), Z_STRVAL(file), Z_IVAL(line),
|
||||
(trace && Z_STRSIZE_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n",
|
||||
len ? "\n\nNext " : "", prev_str);
|
||||
} else {
|
||||
len = zend_spprintf(&str, 0, "exception '%s' in %s:%ld\nStack trace:\n%s%s%s",
|
||||
Z_OBJCE_P(exception)->name, Z_STRVAL(file), Z_LVAL(line),
|
||||
(trace && Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n",
|
||||
len = zend_spprintf(&str, 0, "exception '%s' in %s:" ZEND_INT_FMT "\nStack trace:\n%s%s%s",
|
||||
Z_OBJCE_P(exception)->name, Z_STRVAL(file), Z_IVAL(line),
|
||||
(trace && Z_STRSIZE_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n",
|
||||
len ? "\n\nNext " : "", prev_str);
|
||||
}
|
||||
efree(prev_str);
|
||||
@@ -762,7 +764,7 @@ void zend_register_default_exception(TSRMLS_D) /* {{{ */
|
||||
|
||||
zend_declare_property_string(default_exception_ce, "message", sizeof("message")-1, "", ZEND_ACC_PROTECTED TSRMLS_CC);
|
||||
zend_declare_property_string(default_exception_ce, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC);
|
||||
zend_declare_property_long(default_exception_ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC);
|
||||
zend_declare_property_int(default_exception_ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC);
|
||||
zend_declare_property_null(default_exception_ce, "file", sizeof("file")-1, ZEND_ACC_PROTECTED TSRMLS_CC);
|
||||
zend_declare_property_null(default_exception_ce, "line", sizeof("line")-1, ZEND_ACC_PROTECTED TSRMLS_CC);
|
||||
zend_declare_property_null(default_exception_ce, "trace", sizeof("trace")-1, ZEND_ACC_PRIVATE TSRMLS_CC);
|
||||
@@ -771,7 +773,7 @@ void zend_register_default_exception(TSRMLS_D) /* {{{ */
|
||||
INIT_CLASS_ENTRY(ce, "ErrorException", error_exception_functions);
|
||||
error_exception_ce = zend_register_internal_class_ex(&ce, default_exception_ce, NULL TSRMLS_CC);
|
||||
error_exception_ce->create_object = zend_error_exception_new;
|
||||
zend_declare_property_long(error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED TSRMLS_CC);
|
||||
zend_declare_property_int(error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -787,7 +789,7 @@ ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC) /* {{{ */
|
||||
ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_int_t code TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval *ex;
|
||||
|
||||
@@ -807,7 +809,7 @@ ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char
|
||||
zend_update_property_string(default_exception_ce, ex, "message", sizeof("message")-1, message TSRMLS_CC);
|
||||
}
|
||||
if (code) {
|
||||
zend_update_property_long(default_exception_ce, ex, "code", sizeof("code")-1, code TSRMLS_CC);
|
||||
zend_update_property_int(default_exception_ce, ex, "code", sizeof("code")-1, code TSRMLS_CC);
|
||||
}
|
||||
|
||||
zend_throw_exception_internal(ex TSRMLS_CC);
|
||||
@@ -815,7 +817,7 @@ ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...) /* {{{ */
|
||||
ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, zend_int_t code TSRMLS_DC, const char *format, ...) /* {{{ */
|
||||
{
|
||||
va_list arg;
|
||||
char *message;
|
||||
@@ -830,15 +832,15 @@ ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long cod
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC) /* {{{ */
|
||||
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_int_t code, int severity TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval *ex = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
|
||||
zend_update_property_long(default_exception_ce, ex, "severity", sizeof("severity")-1, severity TSRMLS_CC);
|
||||
zend_update_property_int(default_exception_ce, ex, "severity", sizeof("severity")-1, severity TSRMLS_CC);
|
||||
return ex;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void zend_error_va(int type, const char *file, uint lineno, const char *format, ...) /* {{{ */
|
||||
static void zend_error_va(int type, const char *file, zend_size_t lineno, const char *format, ...) /* {{{ */
|
||||
{
|
||||
va_list args;
|
||||
|
||||
@@ -874,13 +876,13 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {
|
||||
line = zend_read_property(default_exception_ce, EG(exception), "line", sizeof("line")-1, 1 TSRMLS_CC);
|
||||
|
||||
convert_to_string(file);
|
||||
file = (Z_STRLEN_P(file) > 0) ? file : NULL;
|
||||
line = (Z_TYPE_P(line) == IS_LONG) ? line : NULL;
|
||||
file = (Z_STRSIZE_P(file) > 0) ? file : NULL;
|
||||
line = (Z_TYPE_P(line) == IS_INT) ? line : NULL;
|
||||
} else {
|
||||
file = NULL;
|
||||
line = NULL;
|
||||
}
|
||||
zend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_LVAL_P(line) : 0, "Uncaught %s in exception handling during call to %s::__tostring()", Z_OBJCE_P(EG(exception))->name, ce_exception->name);
|
||||
zend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_IVAL_P(line) : 0, "Uncaught %s in exception handling during call to %s::__tostring()", Z_OBJCE_P(EG(exception))->name, ce_exception->name);
|
||||
}
|
||||
|
||||
str = zend_read_property(default_exception_ce, exception, "string", sizeof("string")-1, 1 TSRMLS_CC);
|
||||
@@ -889,9 +891,9 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {
|
||||
|
||||
convert_to_string(str);
|
||||
convert_to_string(file);
|
||||
convert_to_long(line);
|
||||
convert_to_int(line);
|
||||
|
||||
zend_error_va(severity, (Z_STRLEN_P(file) > 0) ? Z_STRVAL_P(file) : NULL, Z_LVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str));
|
||||
zend_error_va(severity, (Z_STRSIZE_P(file) > 0) ? Z_STRVAL_P(file) : NULL, Z_IVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str));
|
||||
} else {
|
||||
zend_error(severity, "Uncaught exception '%s'", ce_exception->name);
|
||||
}
|
||||
|
||||
@@ -40,12 +40,12 @@ ZEND_API void zend_register_default_classes(TSRMLS_D);
|
||||
|
||||
/* exception_ce NULL or zend_exception_get_default() or a derived class
|
||||
* message NULL or the message of the exception */
|
||||
ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC);
|
||||
ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...);
|
||||
ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_int_t code TSRMLS_DC);
|
||||
ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, zend_int_t code TSRMLS_DC, const char *format, ...);
|
||||
ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC);
|
||||
ZEND_API void zend_clear_exception(TSRMLS_D);
|
||||
|
||||
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC);
|
||||
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_int_t code, int severity TSRMLS_DC);
|
||||
|
||||
extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
|
||||
|
||||
@@ -53,7 +53,7 @@ extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
|
||||
ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC);
|
||||
|
||||
/* do not export, in php it's available thru spprintf directly */
|
||||
int zend_spprintf(char **message, int max_len, const char *format, ...);
|
||||
zend_size_t zend_spprintf(char **message, zend_size_t max_len, const char *format, ...);
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
|
||||
+42
-42
@@ -563,8 +563,8 @@ static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **va
|
||||
static inline void make_real_object(zval **object_ptr TSRMLS_DC)
|
||||
{
|
||||
if (Z_TYPE_PP(object_ptr) == IS_NULL
|
||||
|| (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0)
|
||||
|| (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0)
|
||||
|| (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_IVAL_PP(object_ptr) == 0)
|
||||
|| (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRSIZE_PP(object_ptr) == 0)
|
||||
) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
|
||||
zval_dtor(*object_ptr);
|
||||
@@ -573,7 +573,7 @@ static inline void make_real_object(zval **object_ptr TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ulong fetch_type, const char **class_name, zend_class_entry **pce TSRMLS_DC)
|
||||
ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, zend_uint_t fetch_type, const char **class_name, zend_class_entry **pce TSRMLS_DC)
|
||||
{
|
||||
*pce = zend_fetch_class(cur_arg_info->class_name, cur_arg_info->class_name_len, (fetch_type | ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD) TSRMLS_CC);
|
||||
|
||||
@@ -585,7 +585,7 @@ ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ul
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind TSRMLS_DC)
|
||||
ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend_size_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind TSRMLS_DC)
|
||||
{
|
||||
zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data;
|
||||
const char *fname = zf->common.function_name;
|
||||
@@ -601,14 +601,14 @@ ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend
|
||||
}
|
||||
|
||||
if (ptr && ptr->op_array) {
|
||||
zend_error(error_type, "Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d and defined", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind, ptr->op_array->filename, ptr->opline->lineno);
|
||||
zend_error(error_type, "Argument %pu passed to %s%s%s() must %s%s, %s%s given, called in %s on line %pu and defined", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind, ptr->op_array->filename, ptr->opline->lineno);
|
||||
} else {
|
||||
zend_error(error_type, "Argument %d passed to %s%s%s() must %s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind);
|
||||
zend_error(error_type, "Argument %pu passed to %s%s%s() must %s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, ulong fetch_type TSRMLS_DC)
|
||||
static inline int zend_verify_arg_type(zend_function *zf, zend_size_t arg_num, zval *arg, zend_uint_t fetch_type TSRMLS_DC)
|
||||
{
|
||||
zend_arg_info *cur_arg_info;
|
||||
char *need_msg;
|
||||
@@ -686,8 +686,8 @@ static inline void zend_assign_to_object(zval **retval, zval **object_ptr, zval
|
||||
return;
|
||||
}
|
||||
if (Z_TYPE_P(object) == IS_NULL ||
|
||||
(Z_TYPE_P(object) == IS_BOOL && Z_LVAL_P(object) == 0) ||
|
||||
(Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)) {
|
||||
(Z_TYPE_P(object) == IS_BOOL && Z_IVAL_P(object) == 0) ||
|
||||
(Z_TYPE_P(object) == IS_STRING && Z_STRSIZE_P(object) == 0)) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
|
||||
object = *object_ptr;
|
||||
Z_ADDREF_P(object);
|
||||
@@ -771,20 +771,20 @@ static inline void zend_assign_to_object(zval **retval, zval **object_ptr, zval
|
||||
static inline int zend_assign_to_string_offset(const temp_variable *T, const zval *value, int value_type TSRMLS_DC)
|
||||
{
|
||||
zval *str = T->str_offset.str;
|
||||
zend_uint offset = T->str_offset.offset;
|
||||
zend_uint_t offset = T->str_offset.offset;
|
||||
if (Z_TYPE_P(str) == IS_STRING) {
|
||||
if ((int)offset < 0) {
|
||||
if ((zend_int_t)offset < 0) {
|
||||
zend_error(E_WARNING, "Illegal string offset: %d", offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (offset >= Z_STRLEN_P(str)) {
|
||||
if (offset >= Z_STRSIZE_P(str)) {
|
||||
Z_STRVAL_P(str) = str_erealloc(Z_STRVAL_P(str), offset+1+1);
|
||||
memset(Z_STRVAL_P(str) + Z_STRLEN_P(str), ' ', offset - Z_STRLEN_P(str));
|
||||
memset(Z_STRVAL_P(str) + Z_STRSIZE_P(str), ' ', offset - Z_STRSIZE_P(str));
|
||||
Z_STRVAL_P(str)[offset+1] = 0;
|
||||
Z_STRLEN_P(str) = offset+1;
|
||||
Z_STRSIZE_P(str) = offset+1;
|
||||
} else if (IS_INTERNED(Z_STRVAL_P(str))) {
|
||||
Z_STRVAL_P(str) = estrndup(Z_STRVAL_P(str), Z_STRLEN_P(str));
|
||||
Z_STRVAL_P(str) = estrndup(Z_STRVAL_P(str), Z_STRSIZE_P(str));
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(value) != IS_STRING) {
|
||||
@@ -1017,8 +1017,8 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, const zva
|
||||
{
|
||||
zval **retval;
|
||||
char *offset_key;
|
||||
int offset_key_length;
|
||||
ulong hval;
|
||||
zend_size_t offset_key_length;
|
||||
zend_uint_t hval;
|
||||
|
||||
switch (dim->type) {
|
||||
case IS_NULL:
|
||||
@@ -1062,26 +1062,26 @@ fetch_string_dim:
|
||||
}
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
hval = zend_dval_to_lval(Z_DVAL_P(dim));
|
||||
hval = zend_dval_to_ival(Z_DVAL_P(dim));
|
||||
goto num_index;
|
||||
case IS_RESOURCE:
|
||||
zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_LVAL_P(dim), Z_LVAL_P(dim));
|
||||
zend_error(E_STRICT, "Resource ID#" ZEND_INT_FMT " used as offset, casting to integer (" ZEND_INT_FMT ")", Z_IVAL_P(dim), Z_IVAL_P(dim));
|
||||
/* Fall Through */
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
hval = Z_LVAL_P(dim);
|
||||
case IS_INT:
|
||||
hval = Z_IVAL_P(dim);
|
||||
num_index:
|
||||
if (zend_hash_index_find(ht, hval, (void **) &retval) == FAILURE) {
|
||||
switch (type) {
|
||||
case BP_VAR_R:
|
||||
zend_error(E_NOTICE,"Undefined offset: %ld", hval);
|
||||
zend_error(E_NOTICE,"Undefined offset: " ZEND_INT_FMT, hval);
|
||||
/* break missing intentionally */
|
||||
case BP_VAR_UNSET:
|
||||
case BP_VAR_IS:
|
||||
retval = &EG(uninitialized_zval_ptr);
|
||||
break;
|
||||
case BP_VAR_RW:
|
||||
zend_error(E_NOTICE,"Undefined offset: %ld", hval);
|
||||
zend_error(E_NOTICE,"Undefined offset: " ZEND_INT_FMT, hval);
|
||||
/* break missing intentionally */
|
||||
case BP_VAR_W: {
|
||||
zval *new_zval = &EG(uninitialized_zval);
|
||||
@@ -1156,7 +1156,7 @@ convert_to_array:
|
||||
case IS_STRING: {
|
||||
zval tmp;
|
||||
|
||||
if (type != BP_VAR_UNSET && Z_STRLEN_P(container)==0) {
|
||||
if (type != BP_VAR_UNSET && Z_STRSIZE_P(container)==0) {
|
||||
goto convert_to_array;
|
||||
}
|
||||
if (dim == NULL) {
|
||||
@@ -1167,12 +1167,12 @@ convert_to_array:
|
||||
SEPARATE_ZVAL_IF_NOT_REF(container_ptr);
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(dim) != IS_LONG) {
|
||||
if (Z_TYPE_P(dim) != IS_INT) {
|
||||
|
||||
switch(Z_TYPE_P(dim)) {
|
||||
/* case IS_LONG: */
|
||||
/* case IS_INT: */
|
||||
case IS_STRING:
|
||||
if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
|
||||
if (IS_INT == is_numeric_string(Z_STRVAL_P(dim), Z_STRSIZE_P(dim), NULL, NULL, -1)) {
|
||||
break;
|
||||
}
|
||||
if (type != BP_VAR_UNSET) {
|
||||
@@ -1192,13 +1192,13 @@ convert_to_array:
|
||||
|
||||
tmp = *dim;
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_long(&tmp);
|
||||
convert_to_int(&tmp);
|
||||
dim = &tmp;
|
||||
}
|
||||
container = *container_ptr;
|
||||
result->str_offset.str = container;
|
||||
PZVAL_LOCK(container);
|
||||
result->str_offset.offset = Z_LVAL_P(dim);
|
||||
result->str_offset.offset = Z_IVAL_P(dim);
|
||||
result->str_offset.ptr_ptr = NULL;
|
||||
return;
|
||||
}
|
||||
@@ -1247,7 +1247,7 @@ convert_to_array:
|
||||
break;
|
||||
|
||||
case IS_BOOL:
|
||||
if (type != BP_VAR_UNSET && Z_LVAL_P(container)==0) {
|
||||
if (type != BP_VAR_UNSET && Z_IVAL_P(container)==0) {
|
||||
goto convert_to_array;
|
||||
}
|
||||
/* break missing intentionally */
|
||||
@@ -1287,11 +1287,11 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval *conta
|
||||
zval tmp;
|
||||
zval *ptr;
|
||||
|
||||
if (Z_TYPE_P(dim) != IS_LONG) {
|
||||
if (Z_TYPE_P(dim) != IS_INT) {
|
||||
switch(Z_TYPE_P(dim)) {
|
||||
/* case IS_LONG: */
|
||||
/* case IS_INT: */
|
||||
case IS_STRING:
|
||||
if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
|
||||
if (IS_INT == is_numeric_string(Z_STRVAL_P(dim), Z_STRSIZE_P(dim), NULL, NULL, -1)) {
|
||||
break;
|
||||
}
|
||||
if (type != BP_VAR_IS) {
|
||||
@@ -1312,7 +1312,7 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval *conta
|
||||
|
||||
ZVAL_COPY_VALUE(&tmp, dim);
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_long(&tmp);
|
||||
convert_to_int(&tmp);
|
||||
dim = &tmp;
|
||||
}
|
||||
|
||||
@@ -1320,17 +1320,17 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval *conta
|
||||
INIT_PZVAL(ptr);
|
||||
Z_TYPE_P(ptr) = IS_STRING;
|
||||
|
||||
if (Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) {
|
||||
if (Z_IVAL_P(dim) < 0 || Z_STRSIZE_P(container) <= Z_IVAL_P(dim)) {
|
||||
if (type != BP_VAR_IS) {
|
||||
zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim));
|
||||
zend_error(E_NOTICE, "Uninitialized string offset: " ZEND_INT_FMT, Z_IVAL_P(dim));
|
||||
}
|
||||
Z_STRVAL_P(ptr) = STR_EMPTY_ALLOC();
|
||||
Z_STRLEN_P(ptr) = 0;
|
||||
Z_STRSIZE_P(ptr) = 0;
|
||||
} else {
|
||||
Z_STRVAL_P(ptr) = (char*)emalloc(2);
|
||||
Z_STRVAL_P(ptr)[0] = Z_STRVAL_P(container)[Z_LVAL_P(dim)];
|
||||
Z_STRVAL_P(ptr)[0] = Z_STRVAL_P(container)[Z_IVAL_P(dim)];
|
||||
Z_STRVAL_P(ptr)[1] = 0;
|
||||
Z_STRLEN_P(ptr) = 1;
|
||||
Z_STRSIZE_P(ptr) = 1;
|
||||
}
|
||||
result->var.ptr = ptr;
|
||||
return;
|
||||
@@ -1392,8 +1392,8 @@ static void zend_fetch_property_address(temp_variable *result, zval **container_
|
||||
/* this should modify object only if it's empty */
|
||||
if (type != BP_VAR_UNSET &&
|
||||
((Z_TYPE_P(container) == IS_NULL ||
|
||||
(Z_TYPE_P(container) == IS_BOOL && Z_LVAL_P(container)==0) ||
|
||||
(Z_TYPE_P(container) == IS_STRING && Z_STRLEN_P(container)==0)))) {
|
||||
(Z_TYPE_P(container) == IS_BOOL && Z_IVAL_P(container)==0) ||
|
||||
(Z_TYPE_P(container) == IS_STRING && Z_STRSIZE_P(container)==0)))) {
|
||||
if (!PZVAL_IS_REF(container)) {
|
||||
SEPARATE_ZVAL(container_ptr);
|
||||
container = *container_ptr;
|
||||
@@ -1628,7 +1628,7 @@ static zend_always_inline zend_execute_data *i_create_execute_data_from_op_array
|
||||
/* Prepend the regular stack frame with a copy of prev_execute_data
|
||||
* and the passed arguments
|
||||
*/
|
||||
int args_count = zend_vm_stack_get_args_count_ex(EG(current_execute_data));
|
||||
zend_size_t args_count = zend_vm_stack_get_args_count_ex(EG(current_execute_data));
|
||||
size_t args_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval*)) * (args_count + 1);
|
||||
|
||||
total_size += args_size + execute_data_size;
|
||||
|
||||
+27
-27
@@ -37,7 +37,7 @@ typedef union _temp_variable {
|
||||
struct {
|
||||
zval **ptr_ptr; /* shared with var.ptr_ptr */
|
||||
zval *str;
|
||||
zend_uint offset;
|
||||
zend_size_t offset;
|
||||
} str_offset;
|
||||
struct {
|
||||
zval **ptr_ptr; /* shared with var.ptr_ptr */
|
||||
@@ -61,15 +61,15 @@ ZEND_API void zend_execute(zend_op_array *op_array TSRMLS_DC);
|
||||
ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC);
|
||||
ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC);
|
||||
ZEND_API int zend_is_true(zval *op);
|
||||
ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
|
||||
ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC);
|
||||
ZEND_API int zend_lookup_class(const char *name, zend_size_t name_length, zend_class_entry ***ce TSRMLS_DC);
|
||||
ZEND_API int zend_lookup_class_ex(const char *name, zend_size_t name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC);
|
||||
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
|
||||
ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *string_name TSRMLS_DC);
|
||||
ZEND_API int zend_eval_stringl(char *str, zend_size_t str_len, zval *retval_ptr, char *string_name TSRMLS_DC);
|
||||
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
|
||||
ZEND_API int zend_eval_stringl_ex(char *str, int str_len, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
|
||||
ZEND_API int zend_eval_stringl_ex(char *str, zend_size_t str_len, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
|
||||
|
||||
ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ulong fetch_type, const char **class_name, zend_class_entry **pce TSRMLS_DC);
|
||||
ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind TSRMLS_DC);
|
||||
ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, zend_uint_t fetch_type, const char **class_name, zend_class_entry **pce TSRMLS_DC);
|
||||
ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend_size_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind TSRMLS_DC);
|
||||
|
||||
static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC)
|
||||
{
|
||||
@@ -109,17 +109,17 @@ static zend_always_inline int i_zend_is_true(zval *op)
|
||||
case IS_NULL:
|
||||
result = 0;
|
||||
break;
|
||||
case IS_LONG:
|
||||
case IS_INT:
|
||||
case IS_BOOL:
|
||||
case IS_RESOURCE:
|
||||
result = (Z_LVAL_P(op)?1:0);
|
||||
result = (Z_IVAL_P(op)?1:0);
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
result = (Z_DVAL_P(op) ? 1 : 0);
|
||||
break;
|
||||
case IS_STRING:
|
||||
if (Z_STRLEN_P(op) == 0
|
||||
|| (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) {
|
||||
if (Z_STRSIZE_P(op) == 0
|
||||
|| (Z_STRSIZE_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = 1;
|
||||
@@ -135,7 +135,7 @@ static zend_always_inline int i_zend_is_true(zval *op)
|
||||
if (Z_OBJ_HT_P(op)->cast_object) {
|
||||
zval tmp;
|
||||
if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_BOOL TSRMLS_CC) == SUCCESS) {
|
||||
result = Z_LVAL(tmp);
|
||||
result = (int)Z_IVAL(tmp);
|
||||
break;
|
||||
}
|
||||
} else if (Z_OBJ_HT_P(op)->get) {
|
||||
@@ -143,7 +143,7 @@ static zend_always_inline int i_zend_is_true(zval *op)
|
||||
if(Z_TYPE_P(tmp) != IS_OBJECT) {
|
||||
/* for safety - avoid loop */
|
||||
convert_to_boolean(tmp);
|
||||
result = Z_LVAL_P(tmp);
|
||||
result = (int)Z_IVAL_P(tmp);
|
||||
zval_ptr_dtor(&tmp);
|
||||
break;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ struct _zend_vm_stack {
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static zend_always_inline zend_vm_stack zend_vm_stack_new_page(int count) {
|
||||
static zend_always_inline zend_vm_stack zend_vm_stack_new_page(size_t count) {
|
||||
zend_vm_stack page = (zend_vm_stack)emalloc(ZEND_MM_ALIGNED_SIZE(sizeof(*page)) + sizeof(void*) * count);
|
||||
|
||||
page->top = ZEND_VM_STACK_ELEMETS(page);
|
||||
@@ -208,7 +208,7 @@ static zend_always_inline void zend_vm_stack_destroy(TSRMLS_D)
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline void zend_vm_stack_extend(int count TSRMLS_DC)
|
||||
static zend_always_inline void zend_vm_stack_extend(size_t count TSRMLS_DC)
|
||||
{
|
||||
zend_vm_stack p = zend_vm_stack_new_page(count >= ZEND_VM_STACK_PAGE_SIZE ? count : ZEND_VM_STACK_PAGE_SIZE);
|
||||
p->prev = EG(argument_stack);
|
||||
@@ -254,7 +254,7 @@ static zend_always_inline void *zend_vm_stack_alloc(size_t size TSRMLS_DC)
|
||||
EG(argument_stack)->top += ZEND_MM_ALIGNED_SIZE(sizeof(void*)) / sizeof(void*);
|
||||
}
|
||||
} else {
|
||||
ZEND_VM_STACK_GROW_IF_NEEDED((int)size);
|
||||
ZEND_VM_STACK_GROW_IF_NEEDED(size);
|
||||
}
|
||||
ret = (void*)EG(argument_stack)->top;
|
||||
EG(argument_stack)->top += size;
|
||||
@@ -300,7 +300,7 @@ static zend_always_inline void zend_vm_stack_free(void *ptr TSRMLS_DC)
|
||||
static zend_always_inline void zend_vm_stack_clear_multiple(int nested TSRMLS_DC)
|
||||
{
|
||||
void **p = EG(argument_stack)->top - 1;
|
||||
void **end = p - (int)(zend_uintptr_t)*p;
|
||||
void **end = p - (ptrdiff_t)(zend_uintptr_t)*p;
|
||||
|
||||
while (p != end) {
|
||||
zval *q = (zval *) *(--p);
|
||||
@@ -314,20 +314,20 @@ static zend_always_inline void zend_vm_stack_clear_multiple(int nested TSRMLS_DC
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline int zend_vm_stack_get_args_count_ex(zend_execute_data *ex)
|
||||
static zend_always_inline zend_size_t zend_vm_stack_get_args_count_ex(zend_execute_data *ex)
|
||||
{
|
||||
if (ex) {
|
||||
void **p = ex->function_state.arguments;
|
||||
return (int)(zend_uintptr_t) *p;
|
||||
return (zend_size_t)(zend_uintptr_t) *p;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline zval** zend_vm_stack_get_arg_ex(zend_execute_data *ex, int requested_arg)
|
||||
static zend_always_inline zval** zend_vm_stack_get_arg_ex(zend_execute_data *ex, zend_size_t requested_arg)
|
||||
{
|
||||
void **p = ex->function_state.arguments;
|
||||
int arg_count = (int)(zend_uintptr_t) *p;
|
||||
zend_int_t arg_count = (zend_int_t)(zend_uintptr_t) *p;
|
||||
|
||||
if (UNEXPECTED(requested_arg > arg_count)) {
|
||||
return NULL;
|
||||
@@ -335,12 +335,12 @@ static zend_always_inline zval** zend_vm_stack_get_arg_ex(zend_execute_data *ex,
|
||||
return (zval**)p - arg_count + requested_arg - 1;
|
||||
}
|
||||
|
||||
static zend_always_inline int zend_vm_stack_get_args_count(TSRMLS_D)
|
||||
static zend_always_inline zend_size_t zend_vm_stack_get_args_count(TSRMLS_D)
|
||||
{
|
||||
return zend_vm_stack_get_args_count_ex(EG(current_execute_data)->prev_execute_data);
|
||||
}
|
||||
|
||||
static zend_always_inline zval** zend_vm_stack_get_arg(int requested_arg TSRMLS_DC)
|
||||
static zend_always_inline zval** zend_vm_stack_get_arg(zend_size_t requested_arg TSRMLS_DC)
|
||||
{
|
||||
return zend_vm_stack_get_arg_ex(EG(current_execute_data)->prev_execute_data, requested_arg);
|
||||
}
|
||||
@@ -352,14 +352,14 @@ void execute_new_code(TSRMLS_D);
|
||||
ZEND_API const char *get_active_class_name(const char **space TSRMLS_DC);
|
||||
ZEND_API const char *get_active_function_name(TSRMLS_D);
|
||||
ZEND_API const char *zend_get_executed_filename(TSRMLS_D);
|
||||
ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
|
||||
ZEND_API zend_size_t zend_get_executed_lineno(TSRMLS_D);
|
||||
ZEND_API zend_bool zend_is_executing(TSRMLS_D);
|
||||
|
||||
ZEND_API void zend_set_timeout(long seconds, int reset_signals);
|
||||
ZEND_API void zend_set_timeout(zend_int_t seconds, int reset_signals);
|
||||
ZEND_API void zend_unset_timeout(TSRMLS_D);
|
||||
ZEND_API void zend_timeout(int dummy);
|
||||
ZEND_API zend_class_entry *zend_fetch_class(const char *class_name, uint class_name_len, int fetch_type TSRMLS_DC);
|
||||
ZEND_API zend_class_entry *zend_fetch_class_by_name(const char *class_name, uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC);
|
||||
ZEND_API zend_class_entry *zend_fetch_class(const char *class_name, zend_size_t class_name_len, int fetch_type TSRMLS_DC);
|
||||
ZEND_API zend_class_entry *zend_fetch_class_by_name(const char *class_name, zend_size_t class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC);
|
||||
void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_fetch_dimension_by_zval(zval **result, zval *container, zval *dim TSRMLS_DC);
|
||||
|
||||
+29
-28
@@ -401,7 +401,7 @@ ZEND_API const char *zend_get_executed_filename(TSRMLS_D) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API uint zend_get_executed_lineno(TSRMLS_D) /* {{{ */
|
||||
ZEND_API zend_size_t zend_get_executed_lineno(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
if(EG(exception) && EG(opline_ptr) && active_opline->opcode == ZEND_HANDLE_EXCEPTION &&
|
||||
active_opline->lineno == 0 && EG(opline_before_exception)) {
|
||||
@@ -477,11 +477,11 @@ ZEND_API int zval_update_constant_ex(zval **pp, zend_bool inline_change, zend_cl
|
||||
if (!zend_get_constant_ex(p->value.str.val, p->value.str.len, &const_value, scope, Z_REAL_TYPE_P(p) TSRMLS_CC)) {
|
||||
char *actual = Z_STRVAL_P(p);
|
||||
|
||||
if ((colon = (char*)zend_memrchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p)))) {
|
||||
if ((colon = (char*)zend_memrchr(Z_STRVAL_P(p), ':', Z_STRSIZE_P(p)))) {
|
||||
zend_error(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(p));
|
||||
Z_STRLEN_P(p) -= ((colon - Z_STRVAL_P(p)) + 1);
|
||||
Z_STRSIZE_P(p) -= ((colon - Z_STRVAL_P(p)) + 1);
|
||||
if (inline_change) {
|
||||
colon = estrndup(colon, Z_STRLEN_P(p));
|
||||
colon = estrndup(colon, Z_STRSIZE_P(p));
|
||||
str_efree(Z_STRVAL_P(p));
|
||||
Z_STRVAL_P(p) = colon;
|
||||
} else {
|
||||
@@ -489,20 +489,20 @@ ZEND_API int zval_update_constant_ex(zval **pp, zend_bool inline_change, zend_cl
|
||||
}
|
||||
} else {
|
||||
char *save = actual, *slash;
|
||||
int actual_len = Z_STRLEN_P(p);
|
||||
zend_size_t actual_len = Z_STRSIZE_P(p);
|
||||
if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) && (slash = (char *)zend_memrchr(actual, '\\', actual_len))) {
|
||||
actual = slash + 1;
|
||||
actual_len -= (actual - Z_STRVAL_P(p));
|
||||
if (inline_change) {
|
||||
actual = estrndup(actual, actual_len);
|
||||
Z_STRVAL_P(p) = actual;
|
||||
Z_STRLEN_P(p) = actual_len;
|
||||
Z_STRSIZE_P(p) = actual_len;
|
||||
}
|
||||
}
|
||||
if (actual[0] == '\\') {
|
||||
if (inline_change) {
|
||||
memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRLEN_P(p));
|
||||
--Z_STRLEN_P(p);
|
||||
memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRSIZE_P(p));
|
||||
--Z_STRSIZE_P(p);
|
||||
} else {
|
||||
++actual;
|
||||
}
|
||||
@@ -530,7 +530,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, zend_bool inline_change, zend_cl
|
||||
p->type = IS_STRING;
|
||||
if (!inline_change) {
|
||||
Z_STRVAL_P(p) = actual;
|
||||
Z_STRLEN_P(p) = actual_len;
|
||||
Z_STRSIZE_P(p) = actual_len;
|
||||
zval_copy_ctor(p);
|
||||
}
|
||||
}
|
||||
@@ -903,24 +903,25 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zend_lookup_class_ex(const char *name, zend_size_t name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval **args[1];
|
||||
zval autoload_function;
|
||||
zval *class_name_ptr;
|
||||
zval *retval_ptr = NULL;
|
||||
int retval, lc_length;
|
||||
int retval;
|
||||
zend_size_t lc_length;
|
||||
char *lc_name;
|
||||
char *lc_free;
|
||||
zend_fcall_info fcall_info;
|
||||
zend_fcall_info_cache fcall_cache;
|
||||
char dummy = 1;
|
||||
ulong hash;
|
||||
zend_uint_t hash;
|
||||
ALLOCA_FLAG(use_heap)
|
||||
|
||||
if (key) {
|
||||
lc_name = Z_STRVAL(key->constant);
|
||||
lc_length = Z_STRLEN(key->constant) + 1;
|
||||
lc_length = Z_STRSIZE(key->constant) + 1;
|
||||
hash = key->hash_value;
|
||||
} else {
|
||||
if (name == NULL || !name_length) {
|
||||
@@ -1028,13 +1029,13 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zend_lookup_class(const char *name, zend_size_t name_length, zend_class_entry ***ce TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return zend_lookup_class_ex(name, name_length, NULL, 1, ce TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *string_name TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zend_eval_stringl(char *str, zend_size_t str_len, zval *retval_ptr, char *string_name TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval pv;
|
||||
zend_op_array *new_op_array;
|
||||
@@ -1043,14 +1044,14 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
|
||||
int retval;
|
||||
|
||||
if (retval_ptr) {
|
||||
Z_STRLEN(pv) = str_len + sizeof("return ;") - 1;
|
||||
Z_STRVAL(pv) = emalloc(Z_STRLEN(pv) + 1);
|
||||
Z_STRSIZE(pv) = str_len + sizeof("return ;") - 1;
|
||||
Z_STRVAL(pv) = emalloc(Z_STRSIZE(pv) + 1);
|
||||
memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1);
|
||||
memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, str, str_len);
|
||||
Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';';
|
||||
Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0';
|
||||
Z_STRVAL(pv)[Z_STRSIZE(pv) - 1] = ';';
|
||||
Z_STRVAL(pv)[Z_STRSIZE(pv)] = '\0';
|
||||
} else {
|
||||
Z_STRLEN(pv) = str_len;
|
||||
Z_STRSIZE(pv) = str_len;
|
||||
Z_STRVAL(pv) = str;
|
||||
}
|
||||
Z_TYPE(pv) = IS_STRING;
|
||||
@@ -1120,7 +1121,7 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSR
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_eval_stringl_ex(char *str, int str_len, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zend_eval_stringl_ex(char *str, zend_size_t str_len, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
int result;
|
||||
|
||||
@@ -1174,7 +1175,7 @@ void execute_new_code(TSRMLS_D) /* {{{ */
|
||||
}
|
||||
switch (opline->opcode) {
|
||||
case ZEND_GOTO:
|
||||
if (Z_TYPE_P(opline->op2.zv) != IS_LONG) {
|
||||
if (Z_TYPE_P(opline->op2.zv) != IS_INT) {
|
||||
zend_resolve_goto_label(CG(active_op_array), opline, 1 TSRMLS_CC);
|
||||
}
|
||||
/* break omitted intentionally */
|
||||
@@ -1346,7 +1347,7 @@ void zend_shutdown_timeout_thread(void) /* {{{ */
|
||||
#define SIGPROF 27
|
||||
#endif
|
||||
|
||||
void zend_set_timeout(long seconds, int reset_signals) /* {{{ */
|
||||
void zend_set_timeout(zend_int_t seconds, int reset_signals) /* {{{ */
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
@@ -1425,7 +1426,7 @@ void zend_unset_timeout(TSRMLS_D) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
zend_class_entry *zend_fetch_class(const char *class_name, uint class_name_len, int fetch_type TSRMLS_DC) /* {{{ */
|
||||
zend_class_entry *zend_fetch_class(const char *class_name, zend_size_t class_name_len, int fetch_type TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_class_entry **pce;
|
||||
int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
|
||||
@@ -1480,7 +1481,7 @@ check_fetch_type:
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
zend_class_entry *zend_fetch_class_by_name(const char *class_name, uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC) /* {{{ */
|
||||
zend_class_entry *zend_fetch_class_by_name(const char *class_name, zend_size_t class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_class_entry **pce;
|
||||
int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
|
||||
@@ -1575,7 +1576,7 @@ ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, int name_len, ulong hash_value TSRMLS_DC) /* {{{ */
|
||||
ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, zend_size_t name_len, zend_uint_t hash_value TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
if (zend_hash_quick_del(ht, name, name_len, hash_value) == SUCCESS) {
|
||||
name_len--;
|
||||
@@ -1598,7 +1599,7 @@ ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const c
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_delete_global_variable_ex(const char *name, int name_len, ulong hash_value TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zend_delete_global_variable_ex(const char *name, zend_size_t name_len, zend_uint_t hash_value TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_execute_data *ex;
|
||||
|
||||
@@ -1623,7 +1624,7 @@ ZEND_API int zend_delete_global_variable_ex(const char *name, int name_len, ulon
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_delete_global_variable(const char *name, int name_len TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zend_delete_global_variable(const char *name, zend_size_t name_len TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return zend_delete_global_variable_ex(name, name_len, zend_inline_hash_func(name, name_len + 1) TSRMLS_CC);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ typedef struct _zend_generator {
|
||||
/* Variable to put sent value into */
|
||||
zval **send_target;
|
||||
/* Largest used integer key for auto-incrementing keys */
|
||||
long largest_used_integer_key;
|
||||
zend_int_t largest_used_integer_key;
|
||||
|
||||
/* ZEND_GENERATOR_* flags */
|
||||
zend_uchar flags;
|
||||
|
||||
+6
-6
@@ -87,7 +87,7 @@ struct _zend_compiler_globals {
|
||||
|
||||
char *compiled_filename;
|
||||
|
||||
int zend_lineno;
|
||||
zend_uint_t zend_lineno;
|
||||
|
||||
zend_op_array *active_op_array;
|
||||
|
||||
@@ -111,7 +111,7 @@ struct _zend_compiler_globals {
|
||||
|
||||
zend_llist open_files;
|
||||
|
||||
long catch_begin;
|
||||
zend_int_t catch_begin;
|
||||
|
||||
struct _zend_ini_parser_param *ini_parser_param;
|
||||
|
||||
@@ -188,8 +188,8 @@ struct _zend_executor_globals {
|
||||
|
||||
JMP_BUF *bailout;
|
||||
|
||||
int error_reporting;
|
||||
int orig_error_reporting;
|
||||
zend_int_t error_reporting;
|
||||
zend_int_t orig_error_reporting;
|
||||
int exit_status;
|
||||
|
||||
zend_op_array *active_op_array;
|
||||
@@ -203,7 +203,7 @@ struct _zend_executor_globals {
|
||||
|
||||
zval *This;
|
||||
|
||||
long precision;
|
||||
zend_int_t precision;
|
||||
|
||||
int ticks_count;
|
||||
|
||||
@@ -236,7 +236,7 @@ struct _zend_executor_globals {
|
||||
zend_class_entry *exception_class;
|
||||
|
||||
/* timeout support */
|
||||
int timeout_seconds;
|
||||
zend_int_t timeout_seconds;
|
||||
|
||||
int lambda_count;
|
||||
|
||||
|
||||
+58
-58
@@ -55,7 +55,7 @@
|
||||
#define HT_DESTROYED 2
|
||||
#define HT_CLEANING 3
|
||||
|
||||
static void _zend_is_inconsistent(const HashTable *ht, const char *file, int line)
|
||||
static void _zend_is_inconsistent(const HashTable *ht, const char *file, zend_size_t line)
|
||||
{
|
||||
if (ht->inconsistent==HT_OK) {
|
||||
return;
|
||||
@@ -104,7 +104,7 @@ static void _zend_is_inconsistent(const HashTable *ht, const char *file, int lin
|
||||
|
||||
static void zend_hash_do_resize(HashTable *ht);
|
||||
|
||||
ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength)
|
||||
ZEND_API zend_uint_t zend_hash_func(const char *arKey, zend_size_t nKeyLength)
|
||||
{
|
||||
return zend_inline_hash_func(arKey, nKeyLength);
|
||||
}
|
||||
@@ -192,20 +192,20 @@ static void zend_hash_bucket_delete(HashTable *ht, Bucket *p) {
|
||||
i_zend_hash_bucket_delete(ht, p);
|
||||
}
|
||||
|
||||
ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
|
||||
ZEND_API int _zend_hash_init(HashTable *ht, zend_uint_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
|
||||
{
|
||||
uint i = 3;
|
||||
zend_uint_t i = 3;
|
||||
|
||||
SET_INCONSISTENT(HT_OK);
|
||||
|
||||
if (nSize >= 0x80000000) {
|
||||
if (nSize >= ZEND_INT_MAX) {
|
||||
/* prevent overflow */
|
||||
ht->nTableSize = 0x80000000;
|
||||
ht->nTableSize = ZEND_INT_MAX;
|
||||
} else {
|
||||
while ((1U << i) < nSize) {
|
||||
while ((Z_UI(1) << i) < nSize) {
|
||||
i++;
|
||||
}
|
||||
ht->nTableSize = 1 << i;
|
||||
ht->nTableSize = Z_UI(1) << i;
|
||||
}
|
||||
|
||||
ht->nTableMask = 0; /* 0 means that ht->arBuckets is uninitialized */
|
||||
@@ -223,7 +223,7 @@ ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor,
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC)
|
||||
ZEND_API int _zend_hash_init_ex(HashTable *ht, zend_uint_t nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC)
|
||||
{
|
||||
int retval = _zend_hash_init(ht, nSize, pDestructor, persistent ZEND_FILE_LINE_CC);
|
||||
|
||||
@@ -239,10 +239,10 @@ ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProt
|
||||
|
||||
|
||||
|
||||
ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
|
||||
ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, zend_size_t nKeyLength, void *pData, zend_uint_t nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
|
||||
{
|
||||
ulong h;
|
||||
uint nIndex;
|
||||
zend_uint_t h;
|
||||
zend_uint_t nIndex;
|
||||
Bucket *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
@@ -305,9 +305,9 @@ ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKe
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
|
||||
ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, zend_size_t nKeyLength, zend_uint_t h, void *pData, zend_uint_t nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
|
||||
{
|
||||
uint nIndex;
|
||||
zend_uint_t nIndex;
|
||||
Bucket *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
@@ -372,7 +372,7 @@ ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, ui
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, uint nKeyLength)
|
||||
ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, zend_size_t nKeyLength)
|
||||
{
|
||||
void *dummy = (void *) 1;
|
||||
|
||||
@@ -380,9 +380,9 @@ ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, uint
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
|
||||
ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, zend_uint_t h, void *pData, zend_uint_t nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
|
||||
{
|
||||
uint nIndex;
|
||||
zend_uint_t nIndex;
|
||||
Bucket *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
@@ -432,8 +432,8 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void
|
||||
CONNECT_TO_GLOBAL_DLLIST(p, ht);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
|
||||
if ((long)h >= (long)ht->nNextFreeElement) {
|
||||
ht->nNextFreeElement = h < LONG_MAX ? h + 1 : LONG_MAX;
|
||||
if ((zend_int_t)h >= (zend_int_t)ht->nNextFreeElement) {
|
||||
ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX;
|
||||
}
|
||||
ht->nNumOfElements++;
|
||||
ZEND_HASH_IF_FULL_DO_RESIZE(ht);
|
||||
@@ -464,7 +464,7 @@ static void zend_hash_do_resize(HashTable *ht)
|
||||
ZEND_API int zend_hash_rehash(HashTable *ht)
|
||||
{
|
||||
Bucket *p;
|
||||
uint nIndex;
|
||||
zend_uint_t nIndex;
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
if (UNEXPECTED(ht->nNumOfElements == 0)) {
|
||||
@@ -482,8 +482,8 @@ ZEND_API int zend_hash_rehash(HashTable *ht)
|
||||
|
||||
ZEND_API void zend_hash_reindex(HashTable *ht, zend_bool only_integer_keys) {
|
||||
Bucket *p;
|
||||
uint nIndex;
|
||||
ulong offset = 0;
|
||||
zend_uint_t nIndex;
|
||||
zend_uint_t offset = 0;
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
if (UNEXPECTED(ht->nNumOfElements == 0)) {
|
||||
@@ -505,9 +505,9 @@ ZEND_API void zend_hash_reindex(HashTable *ht, zend_bool only_integer_keys) {
|
||||
ht->nNextFreeElement = offset;
|
||||
}
|
||||
|
||||
ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, int flag)
|
||||
ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, zend_size_t nKeyLength, zend_uint_t h, int flag)
|
||||
{
|
||||
uint nIndex;
|
||||
zend_uint_t nIndex;
|
||||
Bucket *p;
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
@@ -742,7 +742,7 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size)
|
||||
ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, zend_uint_t size)
|
||||
{
|
||||
Bucket *p;
|
||||
void *new_entry;
|
||||
@@ -773,7 +773,7 @@ ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_fun
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite ZEND_FILE_LINE_DC)
|
||||
ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, zend_uint_t size, int overwrite ZEND_FILE_LINE_DC)
|
||||
{
|
||||
Bucket *p;
|
||||
void *t;
|
||||
@@ -810,7 +810,7 @@ static zend_bool zend_hash_replace_checker_wrapper(HashTable *target, void *sour
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam)
|
||||
ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, zend_uint_t size, merge_checker_func_t pMergeSource, void *pParam)
|
||||
{
|
||||
Bucket *p;
|
||||
void *t;
|
||||
@@ -835,10 +835,10 @@ ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor
|
||||
* data is returned in pData. The reason is that there's no reason
|
||||
* someone using the hash table might not want to have NULL data
|
||||
*/
|
||||
ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData)
|
||||
ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, zend_size_t nKeyLength, void **pData)
|
||||
{
|
||||
ulong h;
|
||||
uint nIndex;
|
||||
zend_uint_t h;
|
||||
zend_uint_t nIndex;
|
||||
Bucket *p;
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
@@ -859,9 +859,9 @@ ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint nKeyLen
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void **pData)
|
||||
ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, zend_size_t nKeyLength, zend_uint_t h, void **pData)
|
||||
{
|
||||
uint nIndex;
|
||||
zend_uint_t nIndex;
|
||||
Bucket *p;
|
||||
|
||||
ZEND_ASSERT(nKeyLength != 0);
|
||||
@@ -883,10 +883,10 @@ ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, uint n
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint nKeyLength)
|
||||
ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, zend_size_t nKeyLength)
|
||||
{
|
||||
ulong h;
|
||||
uint nIndex;
|
||||
zend_uint_t h;
|
||||
zend_uint_t nIndex;
|
||||
Bucket *p;
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
@@ -906,9 +906,9 @@ ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint nKeyL
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h)
|
||||
ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, zend_size_t nKeyLength, zend_uint_t h)
|
||||
{
|
||||
uint nIndex;
|
||||
zend_uint_t nIndex;
|
||||
Bucket *p;
|
||||
|
||||
ZEND_ASSERT(nKeyLength != 0);
|
||||
@@ -930,9 +930,9 @@ ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, uint
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_hash_index_find(const HashTable *ht, ulong h, void **pData)
|
||||
ZEND_API int zend_hash_index_find(const HashTable *ht, zend_uint_t h, void **pData)
|
||||
{
|
||||
uint nIndex;
|
||||
zend_uint_t nIndex;
|
||||
Bucket *p;
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
@@ -951,9 +951,9 @@ ZEND_API int zend_hash_index_find(const HashTable *ht, ulong h, void **pData)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_hash_index_exists(const HashTable *ht, ulong h)
|
||||
ZEND_API int zend_hash_index_exists(const HashTable *ht, zend_uint_t h)
|
||||
{
|
||||
uint nIndex;
|
||||
zend_uint_t nIndex;
|
||||
Bucket *p;
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
@@ -971,7 +971,7 @@ ZEND_API int zend_hash_index_exists(const HashTable *ht, ulong h)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_hash_num_elements(const HashTable *ht)
|
||||
ZEND_API zend_uint_t zend_hash_num_elements(const HashTable *ht)
|
||||
{
|
||||
IS_CONSISTENT(ht);
|
||||
|
||||
@@ -1065,7 +1065,7 @@ ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos)
|
||||
|
||||
|
||||
/* This function should be made binary safe */
|
||||
ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos)
|
||||
ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, zend_size_t *str_length, zend_uint_t *num_index, zend_bool duplicate, HashPosition *pos)
|
||||
{
|
||||
Bucket *p;
|
||||
|
||||
@@ -1086,7 +1086,7 @@ ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index,
|
||||
return HASH_KEY_IS_STRING;
|
||||
} else {
|
||||
*num_index = p->h;
|
||||
return HASH_KEY_IS_LONG;
|
||||
return HASH_KEY_IS_INT;
|
||||
}
|
||||
}
|
||||
return HASH_KEY_NON_EXISTENT;
|
||||
@@ -1104,10 +1104,10 @@ ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key,
|
||||
} else if (p->nKeyLength) {
|
||||
Z_TYPE_P(key) = IS_STRING;
|
||||
Z_STRVAL_P(key) = IS_INTERNED(p->arKey) ? (char*)p->arKey : estrndup(p->arKey, p->nKeyLength - 1);
|
||||
Z_STRLEN_P(key) = p->nKeyLength - 1;
|
||||
Z_STRSIZE_P(key) = p->nKeyLength - 1;
|
||||
} else {
|
||||
Z_TYPE_P(key) = IS_LONG;
|
||||
Z_LVAL_P(key) = p->h;
|
||||
Z_TYPE_P(key) = IS_INT;
|
||||
Z_IVAL_P(key) = p->h;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1123,7 +1123,7 @@ ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos)
|
||||
if (p->nKeyLength) {
|
||||
return HASH_KEY_IS_STRING;
|
||||
} else {
|
||||
return HASH_KEY_IS_LONG;
|
||||
return HASH_KEY_IS_INT;
|
||||
}
|
||||
}
|
||||
return HASH_KEY_NON_EXISTENT;
|
||||
@@ -1149,10 +1149,10 @@ ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosi
|
||||
/* This function changes key of current element without changing elements'
|
||||
* order. If element with target key already exists, it will be deleted first.
|
||||
*/
|
||||
ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, uint str_length, ulong num_index, int mode, HashPosition *pos)
|
||||
ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, zend_size_t str_length, zend_uint_t num_index, int mode, HashPosition *pos)
|
||||
{
|
||||
Bucket *p, *q;
|
||||
ulong h;
|
||||
zend_uint_t h;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
@@ -1162,7 +1162,7 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
|
||||
IS_CONSISTENT(ht);
|
||||
|
||||
if (p) {
|
||||
if (key_type == HASH_KEY_IS_LONG) {
|
||||
if (key_type == HASH_KEY_IS_INT) {
|
||||
str_length = 0;
|
||||
if (!p->nKeyLength && p->h == num_index) {
|
||||
return SUCCESS;
|
||||
@@ -1267,7 +1267,7 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
|
||||
p = q;
|
||||
}
|
||||
|
||||
if (key_type == HASH_KEY_IS_LONG) {
|
||||
if (key_type == HASH_KEY_IS_INT) {
|
||||
p->h = num_index;
|
||||
} else {
|
||||
p->h = h;
|
||||
@@ -1295,9 +1295,9 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
|
||||
* are inserted in their place. The removed elements can be optionally collected into a hashtable.
|
||||
* This operation reindexes the hashtable, i.e. integer keys will be zero-based and sequential,
|
||||
* while string keys stay intact. The same applies to the elements inserted into the removed HT. */
|
||||
ZEND_API void _zend_hash_splice(HashTable *ht, uint nDataSize, copy_ctor_func_t pCopyConstructor, uint offset, uint length, void **list, uint list_count, HashTable *removed ZEND_FILE_LINE_DC) /* {{{ */
|
||||
ZEND_API void _zend_hash_splice(HashTable *ht, zend_uint_t nDataSize, copy_ctor_func_t pCopyConstructor, zend_uint_t offset, zend_size_t length, void **list, zend_size_t list_count, HashTable *removed ZEND_FILE_LINE_DC) /* {{{ */
|
||||
{
|
||||
int pos;
|
||||
zend_size_t pos;
|
||||
Bucket *p;
|
||||
|
||||
IS_CONSISTENT(ht);
|
||||
@@ -1333,7 +1333,7 @@ ZEND_API void _zend_hash_splice(HashTable *ht, uint nDataSize, copy_ctor_func_t
|
||||
}
|
||||
|
||||
if (list != NULL) {
|
||||
int i;
|
||||
zend_size_t i;
|
||||
for (i = 0; i < list_count; i++) {
|
||||
/* Add new element only to the global linked list, not the bucket list.
|
||||
* Also use key 0 for everything, as we'll reindex the hashtable anyways. */
|
||||
@@ -1414,7 +1414,7 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
|
||||
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC)
|
||||
{
|
||||
Bucket *p1, *p2 = NULL;
|
||||
int result;
|
||||
ptrdiff_t result;
|
||||
void *pData2;
|
||||
|
||||
IS_CONSISTENT(ht1);
|
||||
@@ -1524,7 +1524,7 @@ ZEND_API int zend_hash_minmax(const HashTable *ht, compare_func_t compar, int fl
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
ZEND_API ulong zend_hash_next_free_element(const HashTable *ht)
|
||||
ZEND_API zend_uint_t zend_hash_next_free_element(const HashTable *ht)
|
||||
{
|
||||
IS_CONSISTENT(ht);
|
||||
|
||||
@@ -1548,7 +1548,7 @@ void zend_hash_display_pListTail(const HashTable *ht)
|
||||
void zend_hash_display(const HashTable *ht)
|
||||
{
|
||||
Bucket *p;
|
||||
uint i;
|
||||
zend_uint_t i;
|
||||
|
||||
if (UNEXPECTED(ht->nNumOfElements == 0)) {
|
||||
zend_output_debug_string(0, "The hash is empty");
|
||||
|
||||
+47
-47
@@ -26,7 +26,7 @@
|
||||
#include "zend.h"
|
||||
|
||||
#define HASH_KEY_IS_STRING 1
|
||||
#define HASH_KEY_IS_LONG 2
|
||||
#define HASH_KEY_IS_INT 2
|
||||
#define HASH_KEY_NON_EXISTENT 3
|
||||
#define HASH_KEY_NON_EXISTANT HASH_KEY_NON_EXISTENT /* Keeping old define (with typo) for backward compatibility */
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#define HASH_UPDATE_KEY_IF_AFTER 2
|
||||
#define HASH_UPDATE_KEY_ANYWAY 3
|
||||
|
||||
typedef ulong (*hash_func_t)(const char *arKey, uint nKeyLength);
|
||||
typedef zend_uint_t (*hash_func_t)(const char *arKey, zend_size_t nKeyLength);
|
||||
typedef int (*compare_func_t)(const void *, const void * TSRMLS_DC);
|
||||
typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t TSRMLS_DC);
|
||||
typedef void (*dtor_func_t)(void *pDest);
|
||||
@@ -53,8 +53,8 @@ typedef void (*copy_ctor_param_func_t)(void *pElement, void *pParam);
|
||||
struct _hashtable;
|
||||
|
||||
typedef struct bucket {
|
||||
ulong h; /* Used for numeric indexing */
|
||||
uint nKeyLength;
|
||||
zend_uint_t h; /* Used for numeric indexing */
|
||||
zend_size_t nKeyLength;
|
||||
void *pData;
|
||||
void *pDataPtr;
|
||||
struct bucket *pListNext;
|
||||
@@ -65,10 +65,10 @@ typedef struct bucket {
|
||||
} Bucket;
|
||||
|
||||
typedef struct _hashtable {
|
||||
uint nTableSize;
|
||||
uint nTableMask;
|
||||
uint nNumOfElements;
|
||||
ulong nNextFreeElement;
|
||||
zend_uint_t nTableSize;
|
||||
zend_uint_t nTableMask;
|
||||
zend_uint_t nNumOfElements;
|
||||
zend_uint_t nNextFreeElement;
|
||||
Bucket *pInternalPointer; /* Used for element traversal */
|
||||
Bucket *pListHead;
|
||||
Bucket *pListTail;
|
||||
@@ -85,8 +85,8 @@ typedef struct _hashtable {
|
||||
|
||||
typedef struct _zend_hash_key {
|
||||
const char *arKey;
|
||||
uint nKeyLength;
|
||||
ulong h;
|
||||
zend_size_t nKeyLength;
|
||||
zend_uint_t h;
|
||||
} zend_hash_key;
|
||||
|
||||
|
||||
@@ -97,33 +97,33 @@ typedef Bucket* HashPosition;
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
/* startup/shutdown */
|
||||
ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC);
|
||||
ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC);
|
||||
ZEND_API int _zend_hash_init(HashTable *ht, zend_uint_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC);
|
||||
ZEND_API int _zend_hash_init_ex(HashTable *ht, zend_uint_t nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC);
|
||||
ZEND_API void zend_hash_destroy(HashTable *ht);
|
||||
ZEND_API void zend_hash_clean(HashTable *ht);
|
||||
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent) _zend_hash_init((ht), (nSize), (pDestructor), (persistent) ZEND_FILE_LINE_CC)
|
||||
#define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection) _zend_hash_init_ex((ht), (nSize), (pDestructor), (persistent), (bApplyProtection) ZEND_FILE_LINE_CC)
|
||||
|
||||
/* additions/updates/changes */
|
||||
ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
|
||||
ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, zend_size_t nKeyLength, void *pData, zend_uint_t nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
|
||||
#define zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
|
||||
_zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
|
||||
#define zend_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
|
||||
_zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD ZEND_FILE_LINE_CC)
|
||||
|
||||
ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
|
||||
ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, zend_size_t nKeyLength, zend_uint_t h, void *pData, zend_uint_t nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
|
||||
#define zend_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
|
||||
_zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
|
||||
#define zend_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
|
||||
_zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_ADD ZEND_FILE_LINE_CC)
|
||||
|
||||
ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
|
||||
ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, zend_uint_t h, void *pData, zend_uint_t nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
|
||||
#define zend_hash_index_update(ht, h, pData, nDataSize, pDest) \
|
||||
_zend_hash_index_update_or_next_insert(ht, h, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
|
||||
#define zend_hash_next_index_insert(ht, pData, nDataSize, pDest) \
|
||||
_zend_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT ZEND_FILE_LINE_CC)
|
||||
|
||||
ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, uint nKeyLength);
|
||||
ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, zend_size_t nKeyLength);
|
||||
|
||||
|
||||
#define ZEND_HASH_APPLY_KEEP 0
|
||||
@@ -150,7 +150,7 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR
|
||||
|
||||
|
||||
/* Deletes */
|
||||
ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, int flag);
|
||||
ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, zend_size_t nKeyLength, zend_uint_t h, int flag);
|
||||
#define zend_hash_del(ht, arKey, nKeyLength) \
|
||||
zend_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY)
|
||||
#define zend_hash_quick_del(ht, arKey, nKeyLength, h) \
|
||||
@@ -161,32 +161,32 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint n
|
||||
zend_hash_func
|
||||
|
||||
/* Data retreival */
|
||||
ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData);
|
||||
ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void **pData);
|
||||
ZEND_API int zend_hash_index_find(const HashTable *ht, ulong h, void **pData);
|
||||
ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, zend_size_t nKeyLength, void **pData);
|
||||
ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, zend_size_t nKeyLength, zend_uint_t h, void **pData);
|
||||
ZEND_API int zend_hash_index_find(const HashTable *ht, zend_uint_t h, void **pData);
|
||||
|
||||
/* Misc */
|
||||
ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint nKeyLength);
|
||||
ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h);
|
||||
ZEND_API int zend_hash_index_exists(const HashTable *ht, ulong h);
|
||||
ZEND_API ulong zend_hash_next_free_element(const HashTable *ht);
|
||||
ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, zend_size_t nKeyLength);
|
||||
ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, zend_size_t nKeyLength, zend_uint_t h);
|
||||
ZEND_API int zend_hash_index_exists(const HashTable *ht, zend_uint_t h);
|
||||
ZEND_API zend_uint_t zend_hash_next_free_element(const HashTable *ht);
|
||||
|
||||
/* traversing */
|
||||
#define zend_hash_has_more_elements_ex(ht, pos) \
|
||||
(zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTENT ? FAILURE : SUCCESS)
|
||||
ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos);
|
||||
ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, zend_size_t *str_length, zend_uint_t *num_index, zend_bool duplicate, HashPosition *pos);
|
||||
ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos);
|
||||
ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos);
|
||||
ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, uint str_length, ulong num_index, int mode, HashPosition *pos);
|
||||
ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, zend_size_t str_length, zend_uint_t num_index, int mode, HashPosition *pos);
|
||||
|
||||
typedef struct _HashPointer {
|
||||
HashPosition pos;
|
||||
ulong h;
|
||||
zend_uint_t h;
|
||||
} HashPointer;
|
||||
|
||||
ZEND_API int zend_hash_get_pointer(const HashTable *ht, HashPointer *ptr);
|
||||
@@ -214,9 +214,9 @@ ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr);
|
||||
zend_hash_update_current_key_ex(ht, key_type, str_index, str_length, num_index, HASH_UPDATE_KEY_ANYWAY, NULL)
|
||||
|
||||
/* Copying, merging and sorting */
|
||||
ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size);
|
||||
ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite ZEND_FILE_LINE_DC);
|
||||
ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam);
|
||||
ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, zend_uint_t size);
|
||||
ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, zend_uint_t size, int overwrite ZEND_FILE_LINE_DC);
|
||||
ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, zend_uint_t size, merge_checker_func_t pMergeSource, void *pParam);
|
||||
ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC);
|
||||
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC);
|
||||
ZEND_API int zend_hash_minmax(const HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC);
|
||||
@@ -224,12 +224,12 @@ ZEND_API int zend_hash_minmax(const HashTable *ht, compare_func_t compar, int fl
|
||||
#define zend_hash_merge(target, source, pCopyConstructor, tmp, size, overwrite) \
|
||||
_zend_hash_merge(target, source, pCopyConstructor, tmp, size, overwrite ZEND_FILE_LINE_CC)
|
||||
|
||||
ZEND_API int zend_hash_num_elements(const HashTable *ht);
|
||||
ZEND_API zend_uint_t zend_hash_num_elements(const HashTable *ht);
|
||||
|
||||
ZEND_API int zend_hash_rehash(HashTable *ht);
|
||||
ZEND_API void zend_hash_reindex(HashTable *ht, zend_bool only_integer_keys);
|
||||
|
||||
ZEND_API void _zend_hash_splice(HashTable *ht, uint nDataSize, copy_ctor_func_t pCopyConstructor, uint offset, uint length, void **list, uint list_count, HashTable *removed ZEND_FILE_LINE_DC);
|
||||
ZEND_API void _zend_hash_splice(HashTable *ht, zend_uint_t nDataSize, copy_ctor_func_t pCopyConstructor, zend_uint_t offset, zend_size_t length, void **list, zend_size_t list_count, HashTable *removed ZEND_FILE_LINE_DC);
|
||||
#define zend_hash_splice(ht, nDataSize, pCopyConstructor, offset, length, list, list_count, removed) \
|
||||
_zend_hash_splice(ht, nDataSize, pCopyConstructor, offset, length, list, list_count, removed ZEND_FILE_LINE_CC)
|
||||
|
||||
@@ -266,9 +266,9 @@ ZEND_API void _zend_hash_splice(HashTable *ht, uint nDataSize, copy_ctor_func_t
|
||||
* -- Ralf S. Engelschall <rse@engelschall.com>
|
||||
*/
|
||||
|
||||
static inline ulong zend_inline_hash_func(const char *arKey, uint nKeyLength)
|
||||
static inline zend_uint_t zend_inline_hash_func(const char *arKey, zend_size_t nKeyLength)
|
||||
{
|
||||
register ulong hash = 5381;
|
||||
register zend_uint_t hash = Z_UI(5381);
|
||||
|
||||
/* variant with the hash unrolled eight times */
|
||||
for (; nKeyLength >= 8; nKeyLength -= 8) {
|
||||
@@ -296,7 +296,7 @@ EMPTY_SWITCH_DEFAULT_CASE()
|
||||
}
|
||||
|
||||
|
||||
ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength);
|
||||
ZEND_API zend_uint_t zend_hash_func(const char *arKey, zend_size_t nKeyLength);
|
||||
|
||||
#if ZEND_DEBUG
|
||||
/* debug */
|
||||
@@ -323,9 +323,9 @@ END_EXTERN_C()
|
||||
\
|
||||
if ((*end != '\0') /* not a null terminated string */ \
|
||||
|| (*tmp == '0' && length > 2) /* numbers with leading zeros */ \
|
||||
|| (end - tmp > MAX_LENGTH_OF_LONG - 1) /* number too long */ \
|
||||
|| (SIZEOF_LONG == 4 && \
|
||||
end - tmp == MAX_LENGTH_OF_LONG - 1 && \
|
||||
|| (end - tmp > MAX_LENGTH_OF_ZEND_INT - 1) /* number too long */ \
|
||||
|| (SIZEOF_ZEND_INT == 4 && \
|
||||
end - tmp == MAX_LENGTH_OF_ZEND_INT - 1 && \
|
||||
*tmp > '2')) { /* overflow */ \
|
||||
break; \
|
||||
} \
|
||||
@@ -335,11 +335,11 @@ END_EXTERN_C()
|
||||
} \
|
||||
if (tmp == end) { \
|
||||
if (*key == '-') { \
|
||||
if (idx-1 > LONG_MAX) { /* overflow */ \
|
||||
if (idx-1 > ZEND_INT_MAX) { /* overflow */ \
|
||||
break; \
|
||||
} \
|
||||
idx = 0 - idx; \
|
||||
} else if (idx > LONG_MAX) { /* overflow */ \
|
||||
} else if (idx > ZEND_INT_MAX) { /* overflow */ \
|
||||
break; \
|
||||
} \
|
||||
func; \
|
||||
@@ -348,41 +348,41 @@ END_EXTERN_C()
|
||||
} while (0)
|
||||
|
||||
#define ZEND_HANDLE_NUMERIC(key, length, func) do { \
|
||||
ulong idx; \
|
||||
zend_uint_t idx; \
|
||||
\
|
||||
ZEND_HANDLE_NUMERIC_EX(key, length, idx, return func); \
|
||||
} while (0)
|
||||
|
||||
static inline int zend_symtable_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) \
|
||||
static inline int zend_symtable_update(HashTable *ht, const char *arKey, zend_size_t nKeyLength, void *pData, zend_uint_t nDataSize, void **pDest) \
|
||||
{
|
||||
ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest));
|
||||
return zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest);
|
||||
}
|
||||
|
||||
|
||||
static inline int zend_symtable_del(HashTable *ht, const char *arKey, uint nKeyLength)
|
||||
static inline int zend_symtable_del(HashTable *ht, const char *arKey, zend_size_t nKeyLength)
|
||||
{
|
||||
ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_del(ht, idx));
|
||||
return zend_hash_del(ht, arKey, nKeyLength);
|
||||
}
|
||||
|
||||
|
||||
static inline int zend_symtable_find(HashTable *ht, const char *arKey, uint nKeyLength, void **pData)
|
||||
static inline int zend_symtable_find(HashTable *ht, const char *arKey, zend_size_t nKeyLength, void **pData)
|
||||
{
|
||||
ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht, idx, pData));
|
||||
return zend_hash_find(ht, arKey, nKeyLength, pData);
|
||||
}
|
||||
|
||||
|
||||
static inline int zend_symtable_exists(HashTable *ht, const char *arKey, uint nKeyLength)
|
||||
static inline int zend_symtable_exists(HashTable *ht, const char *arKey, zend_size_t nKeyLength)
|
||||
{
|
||||
ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx));
|
||||
return zend_hash_exists(ht, arKey, nKeyLength);
|
||||
}
|
||||
|
||||
static inline int zend_symtable_update_current_key_ex(HashTable *ht, const char *arKey, uint nKeyLength, int mode, HashPosition *pos)
|
||||
static inline int zend_symtable_update_current_key_ex(HashTable *ht, const char *arKey, zend_size_t nKeyLength, int mode, HashPosition *pos)
|
||||
{
|
||||
ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key_ex(ht, HASH_KEY_IS_LONG, NULL, 0, idx, mode, pos));
|
||||
ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key_ex(ht, HASH_KEY_IS_INT, NULL, 0, idx, mode, pos));
|
||||
return zend_hash_update_current_key_ex(ht, HASH_KEY_IS_STRING, arKey, nKeyLength, 0, mode, pos);
|
||||
}
|
||||
#define zend_symtable_update_current_key(ht,arKey,nKeyLength,mode) \
|
||||
|
||||
@@ -54,7 +54,7 @@ ZEND_API void zend_html_putc(char c)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC)
|
||||
ZEND_API void zend_html_puts(const char *s, zend_size_t len TSRMLS_DC)
|
||||
{
|
||||
const unsigned char *ptr = (const unsigned char*)s, *end = ptr + len;
|
||||
unsigned char *filtered = NULL;
|
||||
|
||||
@@ -44,7 +44,7 @@ ZEND_API void zend_strip(TSRMLS_D);
|
||||
ZEND_API int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC);
|
||||
ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC);
|
||||
ZEND_API void zend_html_putc(char c);
|
||||
ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC);
|
||||
ZEND_API void zend_html_puts(const char *s, zend_size_t len TSRMLS_DC);
|
||||
END_EXTERN_C()
|
||||
|
||||
extern zend_syntax_highlighter_ini syntax_highlighter_ini;
|
||||
|
||||
+19
-18
@@ -205,9 +205,9 @@ ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int modu
|
||||
hashed_ini_entry->module_number = module_number;
|
||||
if ((zend_get_configuration_directive(p->name, p->name_length, &default_value)) == SUCCESS) {
|
||||
if (!hashed_ini_entry->on_modify
|
||||
|| hashed_ini_entry->on_modify(hashed_ini_entry, Z_STRVAL(default_value), Z_STRLEN(default_value), hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC) == SUCCESS) {
|
||||
|| hashed_ini_entry->on_modify(hashed_ini_entry, Z_STRVAL(default_value), Z_STRSIZE(default_value), hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC) == SUCCESS) {
|
||||
hashed_ini_entry->value = Z_STRVAL(default_value);
|
||||
hashed_ini_entry->value_length = Z_STRLEN(default_value);
|
||||
hashed_ini_entry->value_length = Z_STRSIZE(default_value);
|
||||
config_directive_success = 1;
|
||||
}
|
||||
}
|
||||
@@ -244,7 +244,7 @@ ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) /* {{{ */
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage) /* {{{ */
|
||||
ZEND_API int zend_alter_ini_entry(char *name, zend_size_t name_length, char *new_value, zend_size_t new_value_length, int modify_type, int stage) /* {{{ */
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
@@ -252,7 +252,7 @@ ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value,
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zend_alter_ini_entry_ex(char *name, zend_size_t name_length, char *new_value, zend_size_t new_value_length, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
char *duplicate;
|
||||
@@ -306,7 +306,7 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) /* {{{ */
|
||||
ZEND_API int zend_restore_ini_entry(char *name, zend_size_t name_length, int stage) /* {{{ */
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
TSRMLS_FETCH();
|
||||
@@ -328,7 +328,7 @@ ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) /*
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */
|
||||
ZEND_API int zend_ini_register_displayer(char *name, zend_size_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
|
||||
@@ -345,16 +345,16 @@ ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*di
|
||||
* Data retrieval
|
||||
*/
|
||||
|
||||
ZEND_API long zend_ini_long(char *name, uint name_length, int orig) /* {{{ */
|
||||
ZEND_API zend_int_t zend_ini_int(char *name, zend_size_t name_length, int orig) /* {{{ */
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == SUCCESS) {
|
||||
if (orig && ini_entry->modified) {
|
||||
return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0);
|
||||
return (ini_entry->orig_value ? ZEND_STRTOI(ini_entry->orig_value, NULL, 0) : 0);
|
||||
} else {
|
||||
return (ini_entry->value ? strtol(ini_entry->value, NULL, 0) : 0);
|
||||
return (ini_entry->value ? ZEND_STRTOI(ini_entry->value, NULL, 0) : 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ ZEND_API long zend_ini_long(char *name, uint name_length, int orig) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ */
|
||||
ZEND_API double zend_ini_double(char *name, zend_size_t name_length, int orig) /* {{{ */
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
TSRMLS_FETCH();
|
||||
@@ -379,7 +379,7 @@ ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ *
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_bool *exists) /* {{{ */
|
||||
ZEND_API char *zend_ini_string_ex(char *name, zend_size_t name_length, int orig, zend_bool *exists) /* {{{ */
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
TSRMLS_FETCH();
|
||||
@@ -403,7 +403,7 @@ ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_b
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) /* {{{ */
|
||||
ZEND_API char *zend_ini_string(char *name, zend_size_t name_length, int orig) /* {{{ */
|
||||
{
|
||||
zend_bool exists = 1;
|
||||
char *return_value;
|
||||
@@ -425,7 +425,7 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) /* {{{ */
|
||||
ini_entry->displayer(ini_entry, type);
|
||||
} else {
|
||||
char *display_string;
|
||||
uint display_string_length;
|
||||
zend_size_t display_string_length;
|
||||
|
||||
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
if (ini_entry->orig_value) {
|
||||
@@ -460,7 +460,8 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) /* {{{ */
|
||||
|
||||
ZEND_INI_DISP(zend_ini_boolean_displayer_cb) /* {{{ */
|
||||
{
|
||||
int value, tmp_value_len;
|
||||
int value;
|
||||
zend_size_t tmp_value_len;
|
||||
char *tmp_value;
|
||||
|
||||
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
@@ -577,7 +578,7 @@ ZEND_API ZEND_INI_MH(OnUpdateBool) /* {{{ */
|
||||
|
||||
ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */
|
||||
{
|
||||
long *p;
|
||||
zend_int_t *p;
|
||||
#ifndef ZTS
|
||||
char *base = (char *) mh_arg2;
|
||||
#else
|
||||
@@ -586,7 +587,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */
|
||||
base = (char *) ts_resource(*((int *) mh_arg2));
|
||||
#endif
|
||||
|
||||
p = (long *) (base+(size_t) mh_arg1);
|
||||
p = (zend_int_t *) (base+(size_t) mh_arg1);
|
||||
|
||||
*p = zend_atol(new_value, new_value_length);
|
||||
return SUCCESS;
|
||||
@@ -595,7 +596,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */
|
||||
|
||||
ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */
|
||||
{
|
||||
long *p, tmp;
|
||||
zend_int_t *p, tmp;
|
||||
#ifndef ZTS
|
||||
char *base = (char *) mh_arg2;
|
||||
#else
|
||||
@@ -609,7 +610,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
p = (long *) (base+(size_t) mh_arg1);
|
||||
p = (zend_int_t *) (base+(size_t) mh_arg1);
|
||||
*p = tmp;
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
+15
-15
@@ -45,7 +45,7 @@
|
||||
# else /* ! (CRAY || __arm) */
|
||||
|
||||
# define XtOffset(p_type, field) \
|
||||
((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
|
||||
((zend_int_t) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
|
||||
|
||||
# endif /* !CRAY */
|
||||
|
||||
@@ -57,24 +57,24 @@
|
||||
|
||||
#endif
|
||||
|
||||
#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC)
|
||||
#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, char *new_value, zend_size_t new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC)
|
||||
#define ZEND_INI_DISP(name) void name(zend_ini_entry *ini_entry, int type)
|
||||
|
||||
struct _zend_ini_entry {
|
||||
int module_number;
|
||||
int modifiable;
|
||||
char *name;
|
||||
uint name_length;
|
||||
zend_size_t name_length;
|
||||
ZEND_INI_MH((*on_modify));
|
||||
void *mh_arg1;
|
||||
void *mh_arg2;
|
||||
void *mh_arg3;
|
||||
|
||||
char *value;
|
||||
uint value_length;
|
||||
zend_size_t value_length;
|
||||
|
||||
char *orig_value;
|
||||
uint orig_value_length;
|
||||
zend_size_t orig_value_length;
|
||||
int orig_modifiable;
|
||||
int modified;
|
||||
|
||||
@@ -94,17 +94,17 @@ ZEND_API void zend_ini_sort_entries(TSRMLS_D);
|
||||
ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC);
|
||||
ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage);
|
||||
ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC);
|
||||
ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage);
|
||||
ZEND_API int zend_alter_ini_entry(char *name, zend_size_t name_length, char *new_value, zend_size_t new_value_length, int modify_type, int stage);
|
||||
ZEND_API int zend_alter_ini_entry_ex(char *name, zend_size_t name_length, char *new_value, zend_size_t new_value_length, int modify_type, int stage, int force_change TSRMLS_DC);
|
||||
ZEND_API int zend_restore_ini_entry(char *name, zend_size_t name_length, int stage);
|
||||
ZEND_API void display_ini_entries(zend_module_entry *module);
|
||||
|
||||
ZEND_API long zend_ini_long(char *name, uint name_length, int orig);
|
||||
ZEND_API double zend_ini_double(char *name, uint name_length, int orig);
|
||||
ZEND_API char *zend_ini_string(char *name, uint name_length, int orig);
|
||||
ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_bool *exists);
|
||||
ZEND_API zend_int_t zend_ini_int(char *name, zend_size_t name_length, int orig);
|
||||
ZEND_API double zend_ini_double(char *name, zend_size_t name_length, int orig);
|
||||
ZEND_API char *zend_ini_string(char *name, zend_size_t name_length, int orig);
|
||||
ZEND_API char *zend_ini_string_ex(char *name, zend_size_t name_length, int orig, zend_bool *exists);
|
||||
|
||||
ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type));
|
||||
ZEND_API int zend_ini_register_displayer(char *name, zend_size_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type));
|
||||
|
||||
ZEND_API ZEND_INI_DISP(zend_ini_boolean_displayer_cb);
|
||||
ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb);
|
||||
@@ -154,12 +154,12 @@ END_EXTERN_C()
|
||||
ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, zend_ini_boolean_displayer_cb)
|
||||
#endif
|
||||
|
||||
#define INI_INT(name) zend_ini_long((name), sizeof(name), 0)
|
||||
#define INI_INT(name) zend_ini_int((name), sizeof(name), 0)
|
||||
#define INI_FLT(name) zend_ini_double((name), sizeof(name), 0)
|
||||
#define INI_STR(name) zend_ini_string_ex((name), sizeof(name), 0, NULL)
|
||||
#define INI_BOOL(name) ((zend_bool) INI_INT(name))
|
||||
|
||||
#define INI_ORIG_INT(name) zend_ini_long((name), sizeof(name), 1)
|
||||
#define INI_ORIG_INT(name) zend_ini_int((name), sizeof(name), 1)
|
||||
#define INI_ORIG_FLT(name) zend_ini_double((name), sizeof(name), 1)
|
||||
#define INI_ORIG_STR(name) zend_ini_string((name), sizeof(name), 1)
|
||||
#define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name))
|
||||
|
||||
+19
-19
@@ -49,7 +49,7 @@ static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
|
||||
{
|
||||
int i_result;
|
||||
int i_op1, i_op2;
|
||||
char str_result[MAX_LENGTH_OF_LONG];
|
||||
char str_result[MAX_LENGTH_OF_ZEND_INT];
|
||||
|
||||
i_op1 = atoi(Z_STRVAL_P(op1));
|
||||
free(Z_STRVAL_P(op1));
|
||||
@@ -81,10 +81,10 @@ static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
|
||||
break;
|
||||
}
|
||||
|
||||
Z_STRLEN_P(result) = zend_sprintf(str_result, "%d", i_result);
|
||||
Z_STRVAL_P(result) = (char *) malloc(Z_STRLEN_P(result)+1);
|
||||
memcpy(Z_STRVAL_P(result), str_result, Z_STRLEN_P(result));
|
||||
Z_STRVAL_P(result)[Z_STRLEN_P(result)] = 0;
|
||||
Z_STRSIZE_P(result) = zend_sprintf(str_result, "%d", i_result);
|
||||
Z_STRVAL_P(result) = (char *) malloc(Z_STRSIZE_P(result)+1);
|
||||
memcpy(Z_STRVAL_P(result), str_result, Z_STRSIZE_P(result));
|
||||
Z_STRVAL_P(result)[Z_STRSIZE_P(result)] = 0;
|
||||
Z_TYPE_P(result) = IS_STRING;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -95,7 +95,7 @@ static void zend_ini_init_string(zval *result)
|
||||
{
|
||||
Z_STRVAL_P(result) = malloc(1);
|
||||
Z_STRVAL_P(result)[0] = 0;
|
||||
Z_STRLEN_P(result) = 0;
|
||||
Z_STRSIZE_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_STRING;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -104,12 +104,12 @@ static void zend_ini_init_string(zval *result)
|
||||
*/
|
||||
static void zend_ini_add_string(zval *result, zval *op1, zval *op2)
|
||||
{
|
||||
int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
|
||||
zend_size_t length = Z_STRSIZE_P(op1) + Z_STRSIZE_P(op2);
|
||||
|
||||
Z_STRVAL_P(result) = (char *) realloc(Z_STRVAL_P(op1), length+1);
|
||||
memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
|
||||
memcpy(Z_STRVAL_P(result)+Z_STRSIZE_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op2));
|
||||
Z_STRVAL_P(result)[length] = 0;
|
||||
Z_STRLEN_P(result) = length;
|
||||
Z_STRSIZE_P(result) = length;
|
||||
Z_TYPE_P(result) = IS_STRING;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -121,12 +121,12 @@ static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC)
|
||||
zval z_constant;
|
||||
|
||||
/* If name contains ':' it is not a constant. Bug #26893. */
|
||||
if (!memchr(Z_STRVAL_P(name), ':', Z_STRLEN_P(name))
|
||||
&& zend_get_constant(Z_STRVAL_P(name), Z_STRLEN_P(name), &z_constant TSRMLS_CC)) {
|
||||
if (!memchr(Z_STRVAL_P(name), ':', Z_STRSIZE_P(name))
|
||||
&& zend_get_constant(Z_STRVAL_P(name), Z_STRSIZE_P(name), &z_constant TSRMLS_CC)) {
|
||||
/* z_constant is emalloc()'d */
|
||||
convert_to_string(&z_constant);
|
||||
Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(z_constant), Z_STRLEN(z_constant));
|
||||
Z_STRLEN_P(result) = Z_STRLEN(z_constant);
|
||||
Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(z_constant), Z_STRSIZE(z_constant));
|
||||
Z_STRSIZE_P(result) = Z_STRSIZE(z_constant);
|
||||
Z_TYPE_P(result) = Z_TYPE(z_constant);
|
||||
zval_dtor(&z_constant);
|
||||
free(Z_STRVAL_P(name));
|
||||
@@ -144,14 +144,14 @@ static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC)
|
||||
char *envvar;
|
||||
|
||||
/* Fetch configuration option value */
|
||||
if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRLEN_P(name)+1, &curval) == SUCCESS) {
|
||||
Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(curval), Z_STRLEN(curval));
|
||||
Z_STRLEN_P(result) = Z_STRLEN(curval);
|
||||
if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRSIZE_P(name)+1, &curval) == SUCCESS) {
|
||||
Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(curval), Z_STRSIZE(curval));
|
||||
Z_STRSIZE_P(result) = Z_STRSIZE(curval);
|
||||
/* ..or if not found, try ENV */
|
||||
} else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name) TSRMLS_CC)) != NULL ||
|
||||
} else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRSIZE_P(name) TSRMLS_CC)) != NULL ||
|
||||
(envvar = getenv(Z_STRVAL_P(name))) != NULL) {
|
||||
Z_STRVAL_P(result) = strdup(envvar);
|
||||
Z_STRLEN_P(result) = strlen(envvar);
|
||||
Z_STRSIZE_P(result) = strlen(envvar);
|
||||
} else {
|
||||
zend_ini_init_string(result);
|
||||
}
|
||||
@@ -163,7 +163,7 @@ static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC)
|
||||
static void ini_error(char *msg)
|
||||
{
|
||||
char *error_buf;
|
||||
int error_buf_len;
|
||||
zend_size_t error_buf_len;
|
||||
char *currently_parsed_filename;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
|
||||
+4663
-4663
File diff suppressed because it is too large.
Load diff
@@ -55,7 +55,7 @@
|
||||
#define yytext ((char*)SCNG(yy_text))
|
||||
#define yyleng SCNG(yy_leng)
|
||||
#define yyless(x) do { YYCURSOR = (unsigned char*)yytext + x; \
|
||||
yyleng = (unsigned int)x; } while(0)
|
||||
yyleng = (zend_size_t)x; } while(0)
|
||||
|
||||
/* #define yymore() goto yymore_restart */
|
||||
|
||||
@@ -133,7 +133,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals;
|
||||
|
||||
#define zend_ini_copy_value(retval, str, len) { \
|
||||
Z_STRVAL_P(retval) = zend_strndup(str, len); \
|
||||
Z_STRLEN_P(retval) = len; \
|
||||
Z_STRSIZE_P(retval) = len; \
|
||||
Z_TYPE_P(retval) = IS_STRING; \
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
|
||||
|
||||
/* {{{ zend_ini_escape_string()
|
||||
*/
|
||||
static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC)
|
||||
static void zend_ini_escape_string(zval *lval, char *str, zend_size_t len, char quote_type TSRMLS_DC)
|
||||
{
|
||||
register char *s, *t;
|
||||
char *end;
|
||||
@@ -270,7 +270,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty
|
||||
|
||||
/* convert escape sequences */
|
||||
s = t = Z_STRVAL_P(lval);
|
||||
end = s + Z_STRLEN_P(lval);
|
||||
end = s + Z_STRSIZE_P(lval);
|
||||
|
||||
while (s < end) {
|
||||
if (*s == '\\') {
|
||||
@@ -289,7 +289,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty
|
||||
case '\\':
|
||||
case '$':
|
||||
*t++ = *s;
|
||||
Z_STRLEN_P(lval)--;
|
||||
Z_STRSIZE_P(lval)--;
|
||||
break;
|
||||
default:
|
||||
*t++ = '\\';
|
||||
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.zend.com/license/2_00.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Anatol Belski <ab@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
#ifndef ZEND_INT_H
|
||||
#define ZEND_INT_H
|
||||
|
||||
#ifndef ZEND_WIN32
|
||||
/* this probably needs more on non windows, like for C++ and C99*/
|
||||
# include <stdint.h>
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
/* This is the heart of the whole int64 enablement in zval. Based on this
|
||||
macros the zend_size_t datatype is handled, see zend_types.h */
|
||||
#if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
|
||||
# define ZEND_ENABLE_INT64 1
|
||||
#endif
|
||||
|
||||
/* Integer types or the old bad long. */
|
||||
#ifdef ZEND_ENABLE_INT64
|
||||
# ifdef ZEND_WIN32
|
||||
# ifdef _WIN64
|
||||
typedef __int64 zend_int_t;
|
||||
typedef unsigned __int64 zend_uint_t;
|
||||
typedef __int64 zend_off_t;
|
||||
# define ZEND_INT_MAX _I64_MAX
|
||||
# define ZEND_INT_MIN _I64_MIN
|
||||
# define ZEND_UINT_MAX _UI64_MAX
|
||||
# define Z_I(i) i##i64
|
||||
# define Z_UI(i) i##Ui64
|
||||
# else
|
||||
# error Cant enable 64 bit integers on non 64 bit platform
|
||||
# endif
|
||||
# else
|
||||
# if defined(__X86_64__) || defined(__LP64__) || defined(_LP64)
|
||||
typedef int64_t zend_int_t;
|
||||
typedef uint64_t zend_uint_t;
|
||||
typedef off_t zend_off_t;
|
||||
# define ZEND_INT_MAX INT64_MAX
|
||||
# define ZEND_INT_MIN INT64_MIN
|
||||
# define ZEND_UINT_MAX UINT64_MAX
|
||||
# define Z_I(i) i##LL
|
||||
# define Z_UI(i) i##ULL
|
||||
# else
|
||||
# error Cant enable 64 bit integers on non 64 bit platform
|
||||
# endif
|
||||
# endif
|
||||
# define SIZEOF_ZEND_INT 8
|
||||
#else
|
||||
typedef long zend_int_t;
|
||||
typedef unsigned long zend_uint_t;
|
||||
typedef long zend_off_t;
|
||||
# define ZEND_INT_MAX LONG_MAX
|
||||
# define ZEND_INT_MIN LONG_MIN
|
||||
# define ZEND_UINT_MAX ULONG_MAX
|
||||
# define Z_I(i) i##L
|
||||
# define Z_UI(i) i##UL
|
||||
# define SIZEOF_ZEND_INT SIZEOF_LONG
|
||||
#endif
|
||||
|
||||
|
||||
/* conversion macros */
|
||||
#define ZEND_ITOA_BUF_LEN 65
|
||||
|
||||
#ifdef ZEND_ENABLE_INT64
|
||||
# ifdef PHP_WIN32
|
||||
# define ZEND_ITOA(i, s, len) _i64toa_s((i), (s), (len), 10)
|
||||
# define ZEND_ATOI(i, s) i = _atoi64((s))
|
||||
# define ZEND_STRTOI(s0, s1, base) _strtoi64((s0), (s1), (base))
|
||||
# define ZEND_STRTOUI(s0, s1, base) _strtoui64((s0), (s1), (base))
|
||||
# define ZEND_INT_FMT "%I64d"
|
||||
# define ZEND_UINT_FMT "%I64u"
|
||||
# define ZEND_INT_FMT_SPEC "I64d"
|
||||
# define ZEND_UINT_FMT_SPEC "I64u"
|
||||
# define ZEND_STRTOI_PTR _strtoi64
|
||||
# define ZEND_STRTOUI_PTR _strtoui64
|
||||
# define ZEND_ABS _abs64
|
||||
# else
|
||||
# define ZEND_ITOA(i, s, len) \
|
||||
do { \
|
||||
int st = snprintf((s), (len), "%lld", (i)); \
|
||||
(s)[st] = '\0'; \
|
||||
} while (0)
|
||||
# define ZEND_ATOI(i, s) (i) = atoll((s))
|
||||
# define ZEND_STRTOI(s0, s1, base) strtoll((s0), (s1), (base))
|
||||
# define ZEND_STRTOUI(s0, s1, base) strtoull((s0), (s1), (base))
|
||||
# define ZEND_INT_FMT "%" PRId64
|
||||
# define ZEND_UINT_FMT "%" PRIu64
|
||||
# define ZEND_INT_FMT_SPEC PRId64
|
||||
# define ZEND_UINT_FMT_SPEC PRIu64
|
||||
# define ZEND_STRTOI_PTR strtoll
|
||||
# define ZEND_STRTOUI_PTR strtoull
|
||||
# define ZEND_ABS llabs
|
||||
# endif
|
||||
#else
|
||||
# define ZEND_STRTOI(s0, s1, base) strtol((s0), (s1), (base))
|
||||
# define ZEND_STRTOUI(s0, s1, base) strtoul((s0), (s1), (base))
|
||||
# ifdef PHP_WIN32
|
||||
# define ZEND_ITOA(i, s, len) _ltoa_s((i), (s), (len), 10)
|
||||
# define ZEND_ATOI(i, s) i = atol((s))
|
||||
# else
|
||||
# define ZEND_ITOA(i, s, len) \
|
||||
do { \
|
||||
int st = snprintf((s), (len), "%ld", (i)); \
|
||||
(s)[st] = '\0'; \
|
||||
} while (0)
|
||||
# define ZEND_ATOI(i, s) (i) = atol((s))
|
||||
# endif
|
||||
# define ZEND_INT_FMT "%ld"
|
||||
# define ZEND_UINT_FMT "%lu"
|
||||
# define ZEND_INT_FMT_SPEC "ld"
|
||||
# define ZEND_UINT_FMT_SPEC "lu"
|
||||
# define ZEND_STRTOI_PTR strtol
|
||||
# define ZEND_STRTOUI_PTR strtoul
|
||||
# define ZEND_ABS abs
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* ZEND_INT_H */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
*/
|
||||
@@ -31,7 +31,7 @@ ZEND_API zend_class_entry *zend_ce_serializable;
|
||||
|
||||
/* {{{ zend_call_method
|
||||
Only returns the returned zval if retval_ptr != NULL */
|
||||
ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC)
|
||||
ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, zend_size_t function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC)
|
||||
{
|
||||
int result;
|
||||
zend_fcall_info fci;
|
||||
@@ -189,7 +189,7 @@ ZEND_API void zend_user_it_get_current_data(zend_object_iterator *_iter, zval **
|
||||
static int zend_user_it_get_current_key_default(zend_object_iterator *_iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
|
||||
{
|
||||
*int_key = _iter->index;
|
||||
return HASH_KEY_IS_LONG;
|
||||
return HASH_KEY_IS_INT;
|
||||
}
|
||||
#endif
|
||||
/* }}} */
|
||||
@@ -210,7 +210,7 @@ ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *ke
|
||||
zend_error(E_WARNING, "Nothing returned from %s::key()", iter->ce->name);
|
||||
}
|
||||
|
||||
ZVAL_LONG(key, 0);
|
||||
ZVAL_INT(key, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ static int zend_implement_arrayaccess(zend_class_entry *interface, zend_class_en
|
||||
/* }}}*/
|
||||
|
||||
/* {{{ zend_user_serialize */
|
||||
ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC)
|
||||
ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_size_t *buf_len, zend_serialize_data *data TSRMLS_DC)
|
||||
{
|
||||
zend_class_entry * ce = Z_OBJCE_P(object);
|
||||
zval *retval;
|
||||
@@ -415,8 +415,8 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint
|
||||
zval_ptr_dtor(&retval);
|
||||
return FAILURE;
|
||||
case IS_STRING:
|
||||
*buffer = (unsigned char*)estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
|
||||
*buf_len = Z_STRLEN_P(retval);
|
||||
*buffer = (unsigned char*)estrndup(Z_STRVAL_P(retval), Z_STRSIZE_P(retval));
|
||||
*buf_len = Z_STRSIZE_P(retval);
|
||||
result = SUCCESS;
|
||||
break;
|
||||
default: /* failure */
|
||||
@@ -434,7 +434,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint
|
||||
/* }}} */
|
||||
|
||||
/* {{{ zend_user_unserialize */
|
||||
ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC)
|
||||
ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_size_t buf_len, zend_unserialize_data *data TSRMLS_DC)
|
||||
{
|
||||
zval * zdata;
|
||||
|
||||
@@ -455,7 +455,7 @@ ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const un
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_size_t *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_class_entry *ce = Z_OBJCE_P(object);
|
||||
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Serialization of '%s' is not allowed", ce->name);
|
||||
@@ -463,7 +463,7 @@ ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zen
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_size_t buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Unserialization of '%s' is not allowed", ce->name);
|
||||
return FAILURE;
|
||||
|
||||
@@ -38,7 +38,7 @@ typedef struct _zend_user_iterator {
|
||||
zval *value;
|
||||
} zend_user_iterator;
|
||||
|
||||
ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC);
|
||||
ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, zend_size_t function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC);
|
||||
|
||||
#define zend_call_method_with_0_params(obj, obj_ce, fn_proxy, function_name, retval) \
|
||||
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL TSRMLS_CC)
|
||||
@@ -61,11 +61,11 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c
|
||||
|
||||
ZEND_API void zend_register_interfaces(TSRMLS_D);
|
||||
|
||||
ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC);
|
||||
ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);
|
||||
ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_size_t *buf_len, zend_serialize_data *data TSRMLS_DC);
|
||||
ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_size_t buf_len, zend_unserialize_data *data TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC);
|
||||
ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);
|
||||
ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_size_t *buf_len, zend_serialize_data *data TSRMLS_DC);
|
||||
ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_size_t buf_len, zend_unserialize_data *data TSRMLS_DC);
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ typedef struct _zend_object_iterator_funcs {
|
||||
struct _zend_object_iterator {
|
||||
void *data;
|
||||
zend_object_iterator_funcs *funcs;
|
||||
ulong index; /* private to fe_reset/fe_fetch opcodes */
|
||||
zend_uint_t index; /* private to fe_reset/fe_fetch opcodes */
|
||||
};
|
||||
|
||||
typedef struct _zend_class_iterator_funcs {
|
||||
|
||||
+27
-27
@@ -578,7 +578,7 @@ optional_class_type:
|
||||
|
||||
|
||||
function_call_parameter_list:
|
||||
'(' ')' { Z_LVAL($$.u.constant) = 0; }
|
||||
'(' ')' { Z_IVAL($$.u.constant) = 0; }
|
||||
| '(' non_empty_function_call_parameter_list ')' { $$ = $2; }
|
||||
| '(' yield_expr ')' { zend_do_pass_param(&$2, ZEND_SEND_VAL TSRMLS_CC); }
|
||||
;
|
||||
@@ -625,7 +625,7 @@ class_statement_list:
|
||||
|
||||
|
||||
class_statement:
|
||||
variable_modifiers { CG(access_type) = Z_LVAL($1.u.constant); } class_variable_declaration ';'
|
||||
variable_modifiers { CG(access_type) = Z_IVAL($1.u.constant); } class_variable_declaration ';'
|
||||
| class_constant_declaration ';'
|
||||
| trait_use_statement
|
||||
| method_modifiers function is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$4, 1, $3.op_type, &$1 TSRMLS_CC); }
|
||||
@@ -686,37 +686,37 @@ trait_alias:
|
||||
;
|
||||
|
||||
trait_modifiers:
|
||||
/* empty */ { Z_LVAL($$.u.constant) = 0x0; } /* No change of methods visibility */
|
||||
/* empty */ { Z_IVAL($$.u.constant) = 0x0; } /* No change of methods visibility */
|
||||
| member_modifier { $$ = $1; } /* REM: Keep in mind, there are not only visibility modifiers */
|
||||
;
|
||||
|
||||
method_body:
|
||||
';' /* abstract method */ { Z_LVAL($$.u.constant) = ZEND_ACC_ABSTRACT; }
|
||||
| '{' inner_statement_list '}' { Z_LVAL($$.u.constant) = 0; }
|
||||
';' /* abstract method */ { Z_IVAL($$.u.constant) = ZEND_ACC_ABSTRACT; }
|
||||
| '{' inner_statement_list '}' { Z_IVAL($$.u.constant) = 0; }
|
||||
;
|
||||
|
||||
variable_modifiers:
|
||||
non_empty_member_modifiers { $$ = $1; }
|
||||
| T_VAR { Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
|
||||
| T_VAR { Z_IVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
|
||||
;
|
||||
|
||||
method_modifiers:
|
||||
/* empty */ { Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
|
||||
| non_empty_member_modifiers { $$ = $1; if (!(Z_LVAL($$.u.constant) & ZEND_ACC_PPP_MASK)) { Z_LVAL($$.u.constant) |= ZEND_ACC_PUBLIC; } }
|
||||
/* empty */ { Z_IVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
|
||||
| non_empty_member_modifiers { $$ = $1; if (!(Z_IVAL($$.u.constant) & ZEND_ACC_PPP_MASK)) { Z_IVAL($$.u.constant) |= ZEND_ACC_PUBLIC; } }
|
||||
;
|
||||
|
||||
non_empty_member_modifiers:
|
||||
member_modifier { $$ = $1; }
|
||||
| non_empty_member_modifiers member_modifier { Z_LVAL($$.u.constant) = zend_do_verify_access_types(&$1, &$2); }
|
||||
| non_empty_member_modifiers member_modifier { Z_IVAL($$.u.constant) = zend_do_verify_access_types(&$1, &$2); }
|
||||
;
|
||||
|
||||
member_modifier:
|
||||
T_PUBLIC { Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
|
||||
| T_PROTECTED { Z_LVAL($$.u.constant) = ZEND_ACC_PROTECTED; }
|
||||
| T_PRIVATE { Z_LVAL($$.u.constant) = ZEND_ACC_PRIVATE; }
|
||||
| T_STATIC { Z_LVAL($$.u.constant) = ZEND_ACC_STATIC; }
|
||||
| T_ABSTRACT { Z_LVAL($$.u.constant) = ZEND_ACC_ABSTRACT; }
|
||||
| T_FINAL { Z_LVAL($$.u.constant) = ZEND_ACC_FINAL; }
|
||||
T_PUBLIC { Z_IVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
|
||||
| T_PROTECTED { Z_IVAL($$.u.constant) = ZEND_ACC_PROTECTED; }
|
||||
| T_PRIVATE { Z_IVAL($$.u.constant) = ZEND_ACC_PRIVATE; }
|
||||
| T_STATIC { Z_IVAL($$.u.constant) = ZEND_ACC_STATIC; }
|
||||
| T_ABSTRACT { Z_IVAL($$.u.constant) = ZEND_ACC_ABSTRACT; }
|
||||
| T_FINAL { Z_IVAL($$.u.constant) = ZEND_ACC_FINAL; }
|
||||
;
|
||||
|
||||
class_variable_declaration:
|
||||
@@ -738,7 +738,7 @@ echo_expr_list:
|
||||
|
||||
|
||||
for_expr:
|
||||
/* empty */ { $$.op_type = IS_CONST; Z_TYPE($$.u.constant) = IS_BOOL; Z_LVAL($$.u.constant) = 1; }
|
||||
/* empty */ { $$.op_type = IS_CONST; Z_TYPE($$.u.constant) = IS_BOOL; Z_IVAL($$.u.constant) = 1; }
|
||||
| non_empty_for_expr { $$ = $1; }
|
||||
;
|
||||
|
||||
@@ -812,8 +812,8 @@ expr_without_variable:
|
||||
| expr '%' expr { zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr T_SL expr { zend_do_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| expr T_SR expr { zend_do_binary_op(ZEND_SR, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| '+' expr %prec T_INC { ZVAL_LONG(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { add_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); } }
|
||||
| '-' expr %prec T_INC { ZVAL_LONG(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { sub_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); } }
|
||||
| '+' expr %prec T_INC { ZVAL_INT(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { add_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); } }
|
||||
| '-' expr %prec T_INC { ZVAL_INT(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { sub_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); } }
|
||||
| '!' expr { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$2 TSRMLS_CC); }
|
||||
| '~' expr { zend_do_unary_op(ZEND_BW_NOT, &$$, &$2 TSRMLS_CC); }
|
||||
| expr T_IS_IDENTICAL expr { zend_do_binary_op(ZEND_IS_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
@@ -834,7 +834,7 @@ expr_without_variable:
|
||||
| expr '?' ':' { zend_do_jmp_set(&$1, &$2, &$3 TSRMLS_CC); }
|
||||
expr { zend_do_jmp_set_else(&$$, &$5, &$2, &$3 TSRMLS_CC); }
|
||||
| internal_functions_in_yacc { $$ = $1; }
|
||||
| T_INT_CAST expr { zend_do_cast(&$$, &$2, IS_LONG TSRMLS_CC); }
|
||||
| T_INT_CAST expr { zend_do_cast(&$$, &$2, IS_INT TSRMLS_CC); }
|
||||
| T_DOUBLE_CAST expr { zend_do_cast(&$$, &$2, IS_DOUBLE TSRMLS_CC); }
|
||||
| T_STRING_CAST expr { zend_do_cast(&$$, &$2, IS_STRING TSRMLS_CC); }
|
||||
| T_ARRAY_CAST expr { zend_do_cast(&$$, &$2, IS_ARRAY TSRMLS_CC); }
|
||||
@@ -915,13 +915,13 @@ class_name:
|
||||
T_STATIC { $$.op_type = IS_CONST; ZVAL_STRINGL(&$$.u.constant, "static", sizeof("static")-1, 1);}
|
||||
| namespace_name { $$ = $1; }
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); $$ = $2; }
|
||||
| T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRSIZE($2.u.constant); $$ = $2; }
|
||||
;
|
||||
|
||||
fully_qualified_class_name:
|
||||
namespace_name { $$ = $1; }
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); $$ = $2; }
|
||||
| T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRSIZE($2.u.constant); $$ = $2; }
|
||||
;
|
||||
|
||||
|
||||
@@ -964,7 +964,7 @@ backticks_expr:
|
||||
|
||||
|
||||
ctor_arguments:
|
||||
/* empty */ { Z_LVAL($$.u.constant) = 0; }
|
||||
/* empty */ { Z_IVAL($$.u.constant) = 0; }
|
||||
| function_call_parameter_list { $$ = $1; }
|
||||
;
|
||||
|
||||
@@ -997,7 +997,7 @@ static_scalar_value:
|
||||
| static_class_name_scalar { $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
|
||||
| namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT, 1 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
|
||||
| T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
|
||||
| T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRSIZE($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
|
||||
| T_ARRAY '(' static_array_pair_list ')' { $$ = $3; }
|
||||
| '[' static_array_pair_list ']' { $$ = $2; }
|
||||
| static_class_constant { $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
|
||||
@@ -1045,7 +1045,7 @@ general_constant:
|
||||
class_constant { $$ = $1; }
|
||||
| namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC); }
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_RT, 0 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRSIZE($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
scalar:
|
||||
@@ -1203,8 +1203,8 @@ variable_name:
|
||||
;
|
||||
|
||||
simple_indirect_reference:
|
||||
'$' { Z_LVAL($$.u.constant) = 1; }
|
||||
| simple_indirect_reference '$' { Z_LVAL($$.u.constant)++; }
|
||||
'$' { Z_IVAL($$.u.constant) = 1; }
|
||||
| simple_indirect_reference '$' { Z_IVAL($$.u.constant)++; }
|
||||
;
|
||||
|
||||
assignment_list:
|
||||
@@ -1315,7 +1315,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
|
||||
if (CG(parse_error) == 0) {
|
||||
char buffer[120];
|
||||
const unsigned char *end, *str, *tok1 = NULL, *tok2 = NULL;
|
||||
unsigned int len = 0, toklen = 0, yystr_len;
|
||||
zend_size_t len = 0, toklen = 0, yystr_len;
|
||||
|
||||
CG(parse_error) = 1;
|
||||
|
||||
|
||||
+7857
-7857
File diff suppressed because it is too large.
Load diff
@@ -563,7 +563,7 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR
|
||||
|
||||
retval_znode.op_type = IS_CONST;
|
||||
INIT_PZVAL(&retval_znode.u.constant);
|
||||
ZVAL_LONG(&retval_znode.u.constant, 1);
|
||||
ZVAL_INT(&retval_znode.u.constant, 1);
|
||||
|
||||
zend_save_lexical_state(&original_lex_state TSRMLS_CC);
|
||||
|
||||
@@ -631,7 +631,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC)
|
||||
int dummy = 1;
|
||||
|
||||
if (!file_handle.opened_path) {
|
||||
file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRLEN_P(filename));
|
||||
file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRSIZE_P(filename));
|
||||
}
|
||||
|
||||
zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL);
|
||||
@@ -654,14 +654,14 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
|
||||
size_t size;
|
||||
|
||||
/* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */
|
||||
Z_STRVAL_P(str) = str_erealloc(Z_STRVAL_P(str), Z_STRLEN_P(str) + ZEND_MMAP_AHEAD);
|
||||
memset(Z_STRVAL_P(str) + Z_STRLEN_P(str), 0, ZEND_MMAP_AHEAD);
|
||||
Z_STRVAL_P(str) = str_erealloc(Z_STRVAL_P(str), Z_STRSIZE_P(str) + ZEND_MMAP_AHEAD);
|
||||
memset(Z_STRVAL_P(str) + Z_STRSIZE_P(str), 0, ZEND_MMAP_AHEAD);
|
||||
|
||||
SCNG(yy_in) = NULL;
|
||||
SCNG(yy_start) = NULL;
|
||||
|
||||
buf = Z_STRVAL_P(str);
|
||||
size = Z_STRLEN_P(str);
|
||||
size = Z_STRSIZE_P(str);
|
||||
|
||||
if (CG(multibyte)) {
|
||||
SCNG(script_org) = (unsigned char*)buf;
|
||||
@@ -722,7 +722,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
|
||||
int compiler_result;
|
||||
zend_bool original_in_compilation = CG(in_compilation);
|
||||
|
||||
if (Z_STRLEN_P(source_string)==0) {
|
||||
if (Z_STRSIZE_P(source_string)==0) {
|
||||
efree(op_array);
|
||||
return NULL;
|
||||
}
|
||||
@@ -861,10 +861,10 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter
|
||||
if (SCNG(output_filter)) { \
|
||||
size_t sz = 0; \
|
||||
SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); \
|
||||
Z_STRLEN_P(zendlval) = sz; \
|
||||
Z_STRSIZE_P(zendlval) = sz; \
|
||||
} else { \
|
||||
Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); \
|
||||
Z_STRLEN_P(zendlval) = yyleng; \
|
||||
Z_STRSIZE_P(zendlval) = yyleng; \
|
||||
}
|
||||
|
||||
static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type TSRMLS_DC)
|
||||
@@ -876,7 +876,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
|
||||
|
||||
/* convert escape sequences */
|
||||
s = t = Z_STRVAL_P(zendlval);
|
||||
end = s+Z_STRLEN_P(zendlval);
|
||||
end = s+Z_STRSIZE_P(zendlval);
|
||||
while (s<end) {
|
||||
if (*s=='\\') {
|
||||
s++;
|
||||
@@ -888,23 +888,23 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
|
||||
switch(*s) {
|
||||
case 'n':
|
||||
*t++ = '\n';
|
||||
Z_STRLEN_P(zendlval)--;
|
||||
Z_STRSIZE_P(zendlval)--;
|
||||
break;
|
||||
case 'r':
|
||||
*t++ = '\r';
|
||||
Z_STRLEN_P(zendlval)--;
|
||||
Z_STRSIZE_P(zendlval)--;
|
||||
break;
|
||||
case 't':
|
||||
*t++ = '\t';
|
||||
Z_STRLEN_P(zendlval)--;
|
||||
Z_STRSIZE_P(zendlval)--;
|
||||
break;
|
||||
case 'f':
|
||||
*t++ = '\f';
|
||||
Z_STRLEN_P(zendlval)--;
|
||||
Z_STRSIZE_P(zendlval)--;
|
||||
break;
|
||||
case 'v':
|
||||
*t++ = '\v';
|
||||
Z_STRLEN_P(zendlval)--;
|
||||
Z_STRSIZE_P(zendlval)--;
|
||||
break;
|
||||
case 'e':
|
||||
#ifdef PHP_WIN32
|
||||
@@ -912,7 +912,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
|
||||
#else
|
||||
*t++ = '\e';
|
||||
#endif
|
||||
Z_STRLEN_P(zendlval)--;
|
||||
Z_STRSIZE_P(zendlval)--;
|
||||
break;
|
||||
case '"':
|
||||
case '`':
|
||||
@@ -924,22 +924,22 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
|
||||
case '\\':
|
||||
case '$':
|
||||
*t++ = *s;
|
||||
Z_STRLEN_P(zendlval)--;
|
||||
Z_STRSIZE_P(zendlval)--;
|
||||
break;
|
||||
case 'x':
|
||||
case 'X':
|
||||
if (ZEND_IS_HEX(*(s+1))) {
|
||||
char hex_buf[3] = { 0, 0, 0 };
|
||||
|
||||
Z_STRLEN_P(zendlval)--; /* for the 'x' */
|
||||
Z_STRSIZE_P(zendlval)--; /* for the 'x' */
|
||||
|
||||
hex_buf[0] = *(++s);
|
||||
Z_STRLEN_P(zendlval)--;
|
||||
Z_STRSIZE_P(zendlval)--;
|
||||
if (ZEND_IS_HEX(*(s+1))) {
|
||||
hex_buf[1] = *(++s);
|
||||
Z_STRLEN_P(zendlval)--;
|
||||
Z_STRSIZE_P(zendlval)--;
|
||||
}
|
||||
*t++ = (char) strtol(hex_buf, NULL, 16);
|
||||
*t++ = (char) ZEND_STRTOI(hex_buf, NULL, 16);
|
||||
} else {
|
||||
*t++ = '\\';
|
||||
*t++ = *s;
|
||||
@@ -951,16 +951,16 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
|
||||
char octal_buf[4] = { 0, 0, 0, 0 };
|
||||
|
||||
octal_buf[0] = *s;
|
||||
Z_STRLEN_P(zendlval)--;
|
||||
Z_STRSIZE_P(zendlval)--;
|
||||
if (ZEND_IS_OCT(*(s+1))) {
|
||||
octal_buf[1] = *(++s);
|
||||
Z_STRLEN_P(zendlval)--;
|
||||
Z_STRSIZE_P(zendlval)--;
|
||||
if (ZEND_IS_OCT(*(s+1))) {
|
||||
octal_buf[2] = *(++s);
|
||||
Z_STRLEN_P(zendlval)--;
|
||||
Z_STRSIZE_P(zendlval)--;
|
||||
}
|
||||
}
|
||||
*t++ = (char) strtol(octal_buf, NULL, 8);
|
||||
*t++ = (char) ZEND_STRTOI(octal_buf, NULL, 8);
|
||||
} else {
|
||||
*t++ = '\\';
|
||||
*t++ = *s;
|
||||
@@ -980,8 +980,8 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
|
||||
if (SCNG(output_filter)) {
|
||||
size_t sz = 0;
|
||||
s = Z_STRVAL_P(zendlval);
|
||||
SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC);
|
||||
Z_STRLEN_P(zendlval) = sz;
|
||||
SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)s, (size_t)Z_STRSIZE_P(zendlval) TSRMLS_CC);
|
||||
Z_STRSIZE_P(zendlval) = sz;
|
||||
efree(s);
|
||||
}
|
||||
}
|
||||
@@ -1504,13 +1504,13 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
--len;
|
||||
}
|
||||
|
||||
if (len < SIZEOF_LONG * 8) {
|
||||
if (len < SIZEOF_ZEND_INT * 8) {
|
||||
if (len == 0) {
|
||||
Z_LVAL_P(zendlval) = 0;
|
||||
Z_IVAL_P(zendlval) = 0;
|
||||
} else {
|
||||
Z_LVAL_P(zendlval) = strtol(bin, NULL, 2);
|
||||
Z_IVAL_P(zendlval) = ZEND_STRTOI(bin, NULL, 2);
|
||||
}
|
||||
zendlval->type = IS_LONG;
|
||||
zendlval->type = IS_INT;
|
||||
return T_LNUMBER;
|
||||
} else {
|
||||
ZVAL_DOUBLE(zendlval, zend_bin_strtod(bin, NULL));
|
||||
@@ -1519,11 +1519,11 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>{LNUM} {
|
||||
if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */
|
||||
Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0);
|
||||
if (yyleng < MAX_LENGTH_OF_ZEND_INT - 1) { /* Won't overflow */
|
||||
Z_IVAL_P(zendlval) = ZEND_STRTOI(yytext, NULL, 0);
|
||||
} else {
|
||||
errno = 0;
|
||||
Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0);
|
||||
Z_IVAL_P(zendlval) = ZEND_STRTOI(yytext, NULL, 0);
|
||||
if (errno == ERANGE) { /* Overflow */
|
||||
if (yytext[0] == '0') { /* octal overflow */
|
||||
Z_DVAL_P(zendlval) = zend_oct_strtod(yytext, NULL);
|
||||
@@ -1535,7 +1535,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
}
|
||||
}
|
||||
|
||||
zendlval->type = IS_LONG;
|
||||
zendlval->type = IS_INT;
|
||||
return T_LNUMBER;
|
||||
}
|
||||
|
||||
@@ -1549,13 +1549,13 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
len--;
|
||||
}
|
||||
|
||||
if (len < SIZEOF_LONG * 2 || (len == SIZEOF_LONG * 2 && *hex <= '7')) {
|
||||
if (len < SIZEOF_ZEND_INT * 2 || (len == SIZEOF_ZEND_INT * 2 && *hex <= '7')) {
|
||||
if (len == 0) {
|
||||
Z_LVAL_P(zendlval) = 0;
|
||||
Z_IVAL_P(zendlval) = 0;
|
||||
} else {
|
||||
Z_LVAL_P(zendlval) = strtol(hex, NULL, 16);
|
||||
Z_IVAL_P(zendlval) = ZEND_STRTOI(hex, NULL, 16);
|
||||
}
|
||||
zendlval->type = IS_LONG;
|
||||
zendlval->type = IS_INT;
|
||||
return T_LNUMBER;
|
||||
} else {
|
||||
ZVAL_DOUBLE(zendlval, zend_hex_strtod(hex, NULL));
|
||||
@@ -1564,8 +1564,8 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
}
|
||||
|
||||
<ST_VAR_OFFSET>[0]|([1-9][0-9]*) { /* Offset could be treated as a long */
|
||||
if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) {
|
||||
ZVAL_LONG(zendlval, strtol(yytext, NULL, 10));
|
||||
if (yyleng < MAX_LENGTH_OF_ZEND_INT - 1 || (yyleng == MAX_LENGTH_OF_ZEND_INT - 1 && strcmp(yytext, int_min_digits) < 0)) {
|
||||
ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 10));
|
||||
} else {
|
||||
ZVAL_STRINGL(zendlval, yytext, yyleng, 1);
|
||||
}
|
||||
@@ -1587,8 +1587,8 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
if (ce && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) {
|
||||
/* We create a special __CLASS__ constant that is going to be resolved
|
||||
at run-time */
|
||||
Z_STRLEN_P(zendlval) = sizeof("__CLASS__")-1;
|
||||
Z_STRVAL_P(zendlval) = estrndup("__CLASS__", Z_STRLEN_P(zendlval));
|
||||
Z_STRSIZE_P(zendlval) = sizeof("__CLASS__")-1;
|
||||
Z_STRVAL_P(zendlval) = estrndup("__CLASS__", Z_STRSIZE_P(zendlval));
|
||||
zendlval->type = IS_CONSTANT;
|
||||
} else {
|
||||
if (ce && ce->name) {
|
||||
@@ -1624,7 +1624,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
const char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL;
|
||||
const char *func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL;
|
||||
|
||||
Z_STRLEN_P(zendlval) = zend_spprintf(&Z_STRVAL_P(zendlval), 0, "%s%s%s",
|
||||
Z_STRSIZE_P(zendlval) = zend_spprintf(&Z_STRVAL_P(zendlval), 0, "%s%s%s",
|
||||
class_name ? class_name : "",
|
||||
class_name && func_name ? "::" : "",
|
||||
func_name ? func_name : ""
|
||||
@@ -1634,7 +1634,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"__LINE__" {
|
||||
ZVAL_LONG(zendlval, CG(zend_lineno));
|
||||
ZVAL_INT(zendlval, CG(zend_lineno));
|
||||
return T_LINE;
|
||||
}
|
||||
|
||||
@@ -1793,13 +1793,13 @@ inline_html:
|
||||
int readsize;
|
||||
size_t sz = 0;
|
||||
readsize = SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC);
|
||||
Z_STRLEN_P(zendlval) = sz;
|
||||
Z_STRSIZE_P(zendlval) = sz;
|
||||
if (readsize < yyleng) {
|
||||
yyless(readsize);
|
||||
}
|
||||
} else {
|
||||
Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng);
|
||||
Z_STRLEN_P(zendlval) = yyleng;
|
||||
Z_STRSIZE_P(zendlval) = yyleng;
|
||||
}
|
||||
zendlval->type = IS_STRING;
|
||||
HANDLE_NEWLINES(yytext, yyleng);
|
||||
@@ -1974,7 +1974,7 @@ inline_html:
|
||||
|
||||
/* convert escape sequences */
|
||||
s = t = Z_STRVAL_P(zendlval);
|
||||
end = s+Z_STRLEN_P(zendlval);
|
||||
end = s+Z_STRSIZE_P(zendlval);
|
||||
while (s<end) {
|
||||
if (*s=='\\') {
|
||||
s++;
|
||||
@@ -1983,7 +1983,7 @@ inline_html:
|
||||
case '\\':
|
||||
case '\'':
|
||||
*t++ = *s;
|
||||
Z_STRLEN_P(zendlval)--;
|
||||
Z_STRSIZE_P(zendlval)--;
|
||||
break;
|
||||
default:
|
||||
*t++ = '\\';
|
||||
@@ -2004,8 +2004,8 @@ inline_html:
|
||||
if (SCNG(output_filter)) {
|
||||
size_t sz = 0;
|
||||
s = Z_STRVAL_P(zendlval);
|
||||
SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC);
|
||||
Z_STRLEN_P(zendlval) = sz;
|
||||
SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)s, (size_t)Z_STRSIZE_P(zendlval) TSRMLS_CC);
|
||||
Z_STRSIZE_P(zendlval) = sz;
|
||||
efree(s);
|
||||
}
|
||||
return T_CONSTANT_ENCAPSED_STRING;
|
||||
@@ -2123,7 +2123,7 @@ inline_html:
|
||||
|
||||
|
||||
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"{$" {
|
||||
Z_LVAL_P(zendlval) = (long) '{';
|
||||
Z_IVAL_P(zendlval) = (long) '{';
|
||||
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
|
||||
yyless(1);
|
||||
return T_CURLY_OPEN;
|
||||
|
||||
+10
-10
@@ -32,9 +32,9 @@ ZEND_API int le_index_ptr;
|
||||
static HashTable list_destructors;
|
||||
|
||||
|
||||
ZEND_API int zend_list_insert(void *ptr, int type TSRMLS_DC)
|
||||
ZEND_API zend_int_t zend_list_insert(void *ptr, int type TSRMLS_DC)
|
||||
{
|
||||
int index;
|
||||
zend_int_t index;
|
||||
zend_rsrc_list_entry le;
|
||||
|
||||
le.ptr=ptr;
|
||||
@@ -47,7 +47,7 @@ ZEND_API int zend_list_insert(void *ptr, int type TSRMLS_DC)
|
||||
return index;
|
||||
}
|
||||
|
||||
ZEND_API int _zend_list_delete(int id TSRMLS_DC)
|
||||
ZEND_API int _zend_list_delete(zend_int_t id TSRMLS_DC)
|
||||
{
|
||||
zend_rsrc_list_entry *le;
|
||||
|
||||
@@ -64,7 +64,7 @@ ZEND_API int _zend_list_delete(int id TSRMLS_DC)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC)
|
||||
ZEND_API void *_zend_list_find(zend_int_t id, int *type TSRMLS_DC)
|
||||
{
|
||||
zend_rsrc_list_entry *le;
|
||||
|
||||
@@ -77,7 +77,7 @@ ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API int _zend_list_addref(int id TSRMLS_DC)
|
||||
ZEND_API int _zend_list_addref(zend_int_t id TSRMLS_DC)
|
||||
{
|
||||
zend_rsrc_list_entry *le;
|
||||
|
||||
@@ -91,9 +91,9 @@ ZEND_API int _zend_list_addref(int id TSRMLS_DC)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC)
|
||||
ZEND_API zend_int_t zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC)
|
||||
{
|
||||
int rsrc_id;
|
||||
zend_int_t rsrc_id;
|
||||
|
||||
rsrc_id = zend_list_insert(rsrc_pointer, rsrc_type TSRMLS_CC);
|
||||
|
||||
@@ -106,9 +106,9 @@ ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int r
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, const char *resource_type_name, int *found_resource_type, int num_resource_types, ...)
|
||||
ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, zend_int_t default_id, const char *resource_type_name, int *found_resource_type, int num_resource_types, ...)
|
||||
{
|
||||
int id;
|
||||
zend_int_t id;
|
||||
int actual_resource_type;
|
||||
void *resource;
|
||||
va_list resource_types;
|
||||
@@ -139,7 +139,7 @@ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, c
|
||||
if (!resource) {
|
||||
if (resource_type_name) {
|
||||
class_name = get_active_class_name(&space TSRMLS_CC);
|
||||
zend_error(E_WARNING, "%s%s%s(): %d is not a valid %s resource", class_name, space, get_active_function_name(TSRMLS_C), id, resource_type_name);
|
||||
zend_error(E_WARNING, "%s%s%s(): " ZEND_INT_FMT " is not a valid %s resource", class_name, space, get_active_function_name(TSRMLS_C), id, resource_type_name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+7
-7
@@ -33,7 +33,7 @@ BEGIN_EXTERN_C()
|
||||
typedef struct _zend_rsrc_list_entry {
|
||||
void *ptr;
|
||||
int type;
|
||||
int refcount;
|
||||
zend_int_t refcount;
|
||||
} zend_rsrc_list_entry;
|
||||
|
||||
typedef void (*rsrc_dtor_func_t)(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
@@ -70,17 +70,17 @@ void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC);
|
||||
int zend_init_rsrc_list_dtors(void);
|
||||
void zend_destroy_rsrc_list_dtors(void);
|
||||
|
||||
ZEND_API int zend_list_insert(void *ptr, int type TSRMLS_DC);
|
||||
ZEND_API int _zend_list_addref(int id TSRMLS_DC);
|
||||
ZEND_API int _zend_list_delete(int id TSRMLS_DC);
|
||||
ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC);
|
||||
ZEND_API zend_int_t zend_list_insert(void *ptr, int type TSRMLS_DC);
|
||||
ZEND_API int _zend_list_addref(zend_int_t id TSRMLS_DC);
|
||||
ZEND_API int _zend_list_delete(zend_int_t id TSRMLS_DC);
|
||||
ZEND_API void *_zend_list_find(zend_int_t id, int *type TSRMLS_DC);
|
||||
|
||||
#define zend_list_addref(id) _zend_list_addref(id TSRMLS_CC)
|
||||
#define zend_list_delete(id) _zend_list_delete(id TSRMLS_CC)
|
||||
#define zend_list_find(id, type) _zend_list_find(id, type TSRMLS_CC)
|
||||
|
||||
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
|
||||
ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, const char *resource_type_name, int *found_resource_type, int num_resource_types, ...);
|
||||
ZEND_API zend_int_t zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
|
||||
ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, zend_int_t default_id, const char *resource_type_name, int *found_resource_type, int num_resource_types, ...);
|
||||
|
||||
ZEND_API const char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC);
|
||||
ZEND_API int zend_fetch_list_dtor_id(char *type_name);
|
||||
|
||||
+1
-1
@@ -249,7 +249,7 @@ ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_ar
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_llist_count(zend_llist *l)
|
||||
ZEND_API size_t zend_llist_count(zend_llist *l)
|
||||
{
|
||||
return l->count;
|
||||
}
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC)
|
||||
ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data));
|
||||
ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC);
|
||||
ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...);
|
||||
ZEND_API int zend_llist_count(zend_llist *l);
|
||||
ZEND_API size_t zend_llist_count(zend_llist *l);
|
||||
ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC);
|
||||
|
||||
/* traversal */
|
||||
|
||||
+24
-11
@@ -21,8 +21,8 @@
|
||||
|
||||
#if defined(__i386__) && defined(__GNUC__)
|
||||
|
||||
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
|
||||
long __tmpvar; \
|
||||
#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \
|
||||
zend_int_t __tmpvar; \
|
||||
__asm__ ("imul %3,%0\n" \
|
||||
"adc $0,%1" \
|
||||
: "=r"(__tmpvar),"=r"(usedval) \
|
||||
@@ -33,8 +33,8 @@
|
||||
|
||||
#elif defined(__x86_64__) && defined(__GNUC__)
|
||||
|
||||
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
|
||||
long __tmpvar; \
|
||||
#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \
|
||||
zend_int_t __tmpvar; \
|
||||
__asm__ ("imul %3,%0\n" \
|
||||
"adc $0,%1" \
|
||||
: "=r"(__tmpvar),"=r"(usedval) \
|
||||
@@ -45,8 +45,8 @@
|
||||
|
||||
#elif defined(__arm__) && defined(__GNUC__)
|
||||
|
||||
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
|
||||
long __tmpvar; \
|
||||
#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \
|
||||
zend_int_t __tmpvar; \
|
||||
__asm__("smull %0, %1, %2, %3\n" \
|
||||
"sub %1, %1, %0, asr #31" \
|
||||
: "=r"(__tmpvar), "=r"(usedval) \
|
||||
@@ -57,8 +57,8 @@
|
||||
|
||||
#elif defined(__aarch64__) && defined(__GNUC__)
|
||||
|
||||
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
|
||||
long __tmpvar; \
|
||||
#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \
|
||||
zend_int_t __tmpvar; \
|
||||
__asm__("mul %0, %2, %3\n" \
|
||||
"smulh %1, %2, %3\n" \
|
||||
"sub %1, %1, %0, asr #63\n" \
|
||||
@@ -68,11 +68,24 @@
|
||||
else (lval) = __tmpvar; \
|
||||
} while (0)
|
||||
|
||||
#elif defined(ZEND_WIN32)
|
||||
|
||||
#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \
|
||||
zend_int_t __lres = (a) * (b); \
|
||||
long double __dres = (long double)(a) * (long double)(b); \
|
||||
long double __delta = (long double) __lres - __dres; \
|
||||
if ( ((usedval) = (( __dres + __delta ) != __dres))) { \
|
||||
(dval) = __dres; \
|
||||
} else { \
|
||||
(lval) = __lres; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#elif SIZEOF_LONG == 4 && defined(HAVE_ZEND_LONG64)
|
||||
|
||||
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
|
||||
#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \
|
||||
zend_long64 __result = (zend_long64) (a) * (zend_long64) (b); \
|
||||
if (__result > LONG_MAX || __result < LONG_MIN) { \
|
||||
if (__result > ZEND_INT_MAX || __result < ZEND_INT_MIN) { \
|
||||
(dval) = (double) __result; \
|
||||
(usedval) = 1; \
|
||||
} else { \
|
||||
@@ -83,7 +96,7 @@
|
||||
|
||||
#else
|
||||
|
||||
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
|
||||
#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \
|
||||
long __lres = (a) * (b); \
|
||||
long double __dres = (long double)(a) * (long double)(b); \
|
||||
long double __delta = (long double) __lres - __dres; \
|
||||
|
||||
+30
-29
@@ -29,6 +29,7 @@
|
||||
#include "zend_interfaces.h"
|
||||
#include "zend_closures.h"
|
||||
#include "zend_compile.h"
|
||||
#include "zend_hash.h"
|
||||
|
||||
#define DEBUG_OBJECT_HANDLERS 0
|
||||
|
||||
@@ -304,7 +305,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
|
||||
zend_property_info *property_info;
|
||||
zend_property_info *scope_property_info;
|
||||
zend_bool denied_access = 0;
|
||||
ulong h;
|
||||
zend_uint_t h;
|
||||
|
||||
if (key && (property_info = CACHED_POLYMORPHIC_PTR(key->cache_slot, ce)) != NULL) {
|
||||
return property_info;
|
||||
@@ -312,7 +313,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
|
||||
|
||||
if (UNEXPECTED(Z_STRVAL_P(member)[0] == '\0')) {
|
||||
if (!silent) {
|
||||
if (Z_STRLEN_P(member) == 0) {
|
||||
if (Z_STRSIZE_P(member) == 0) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot access empty property");
|
||||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Cannot access property started with '\\0'");
|
||||
@@ -321,8 +322,8 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
|
||||
return NULL;
|
||||
}
|
||||
property_info = NULL;
|
||||
h = key ? key->hash_value : zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1);
|
||||
if (zend_hash_quick_find(&ce->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &property_info)==SUCCESS) {
|
||||
h = key ? key->hash_value : zend_get_hash_value(Z_STRVAL_P(member), Z_STRSIZE_P(member) + 1);
|
||||
if (zend_hash_quick_find(&ce->properties_info, Z_STRVAL_P(member), Z_STRSIZE_P(member)+1, h, (void **) &property_info)==SUCCESS) {
|
||||
if (UNEXPECTED((property_info->flags & ZEND_ACC_SHADOW) != 0)) {
|
||||
/* if it's a shadow - go to access it's private */
|
||||
property_info = NULL;
|
||||
@@ -352,7 +353,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
|
||||
if (EG(scope) != ce
|
||||
&& EG(scope)
|
||||
&& is_derived_class(ce, EG(scope))
|
||||
&& zend_hash_quick_find(&EG(scope)->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &scope_property_info)==SUCCESS
|
||||
&& zend_hash_quick_find(&EG(scope)->properties_info, Z_STRVAL_P(member), Z_STRSIZE_P(member)+1, h, (void **) &scope_property_info)==SUCCESS
|
||||
&& scope_property_info->flags & ZEND_ACC_PRIVATE) {
|
||||
if (key) {
|
||||
CACHE_POLYMORPHIC_PTR(key->cache_slot, ce, scope_property_info);
|
||||
@@ -374,7 +375,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
|
||||
} else {
|
||||
EG(std_property_info).flags = ZEND_ACC_PUBLIC;
|
||||
EG(std_property_info).name = Z_STRVAL_P(member);
|
||||
EG(std_property_info).name_length = Z_STRLEN_P(member);
|
||||
EG(std_property_info).name_length = Z_STRSIZE_P(member);
|
||||
EG(std_property_info).h = h;
|
||||
EG(std_property_info).ce = ce;
|
||||
EG(std_property_info).offset = -1;
|
||||
@@ -390,12 +391,12 @@ ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, int prop_info_name_len TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, zend_size_t prop_info_name_len TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_property_info *property_info;
|
||||
const char *class_name, *prop_name;
|
||||
zval member;
|
||||
int prop_name_len;
|
||||
zend_size_t prop_name_len;
|
||||
|
||||
zend_unmangle_property_name_ex(prop_info_name, prop_info_name_len, &class_name, &prop_name, &prop_name_len);
|
||||
ZVAL_STRINGL(&member, prop_name, prop_name_len, 0);
|
||||
@@ -424,8 +425,8 @@ static int zend_get_property_guard(zend_object *zobj, zend_property_info *proper
|
||||
if (!property_info) {
|
||||
property_info = &info;
|
||||
info.name = Z_STRVAL_P(member);
|
||||
info.name_length = Z_STRLEN_P(member);
|
||||
info.h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1);
|
||||
info.name_length = Z_STRSIZE_P(member);
|
||||
info.h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRSIZE_P(member) + 1);
|
||||
} else if(property_info->name[0] == '\0'){
|
||||
const char *class_name = NULL, *prop_name = NULL;
|
||||
zend_unmangle_property_name(property_info->name, property_info->name_length, &class_name, &prop_name);
|
||||
@@ -530,7 +531,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, const zend_li
|
||||
} else {
|
||||
if (zobj->ce->__get && guard && guard->in_get == 1) {
|
||||
if (Z_STRVAL_P(member)[0] == '\0') {
|
||||
if (Z_STRLEN_P(member) == 0) {
|
||||
if (Z_STRSIZE_P(member) == 0) {
|
||||
zend_error(E_ERROR, "Cannot access empty property");
|
||||
} else {
|
||||
zend_error(E_ERROR, "Cannot access property started with '\\0'");
|
||||
@@ -648,7 +649,7 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, c
|
||||
}
|
||||
} else if (zobj->ce->__set && guard && guard->in_set == 1) {
|
||||
if (Z_STRVAL_P(member)[0] == '\0') {
|
||||
if (Z_STRLEN_P(member) == 0) {
|
||||
if (Z_STRSIZE_P(member) == 0) {
|
||||
zend_error(E_ERROR, "Cannot access empty property");
|
||||
} else {
|
||||
zend_error(E_ERROR, "Cannot access property started with '\\0'");
|
||||
@@ -866,7 +867,7 @@ static void zend_std_unset_property(zval *object, zval *member, const zend_liter
|
||||
zval_ptr_dtor(&object);
|
||||
} else if (zobj->ce->__unset && guard && guard->in_unset == 1) {
|
||||
if (Z_STRVAL_P(member)[0] == '\0') {
|
||||
if (Z_STRLEN_P(member) == 0) {
|
||||
if (Z_STRSIZE_P(member) == 0) {
|
||||
zend_error(E_ERROR, "Cannot access empty property");
|
||||
} else {
|
||||
zend_error(E_ERROR, "Cannot access property started with '\\0'");
|
||||
@@ -945,7 +946,7 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
|
||||
* Returns the function address that should be called, or NULL
|
||||
* if no such function exists.
|
||||
*/
|
||||
static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen, ulong hash_value TSRMLS_DC) /* {{{ */
|
||||
static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, zend_size_t function_name_strlen, zend_uint_t hash_value TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
if (!ce) {
|
||||
return 0;
|
||||
@@ -980,7 +981,7 @@ static inline zend_function *zend_check_private_int(zend_function *fbc, zend_cla
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, zend_size_t function_name_strlen TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return zend_check_private_int(fbc, ce, function_name_strval, function_name_strlen, zend_hash_func(function_name_strval, function_name_strlen+1) TSRMLS_CC) != NULL;
|
||||
}
|
||||
@@ -1015,7 +1016,7 @@ ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static inline union _zend_function *zend_get_user_call_function(zend_class_entry *ce, const char *method_name, int method_len) /* {{{ */
|
||||
static inline union _zend_function *zend_get_user_call_function(zend_class_entry *ce, const char *method_name, zend_size_t method_len) /* {{{ */
|
||||
{
|
||||
zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function));
|
||||
call_user_call->type = ZEND_INTERNAL_FUNCTION;
|
||||
@@ -1031,12 +1032,12 @@ static inline union _zend_function *zend_get_user_call_function(zend_class_entry
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static union _zend_function *zend_std_get_method(zval **object_ptr, char *method_name, int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */
|
||||
static union _zend_function *zend_std_get_method(zval **object_ptr, char *method_name, zend_size_t method_len, const zend_literal *key TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_function *fbc;
|
||||
zval *object = *object_ptr;
|
||||
zend_object *zobj = Z_OBJ_P(object);
|
||||
ulong hash_value;
|
||||
zend_uint_t hash_value;
|
||||
char *lc_method_name;
|
||||
ALLOCA_FLAG(use_heap)
|
||||
|
||||
@@ -1155,7 +1156,7 @@ ZEND_API void zend_std_callstatic_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static inline union _zend_function *zend_get_user_callstatic_function(zend_class_entry *ce, const char *method_name, int method_len) /* {{{ */
|
||||
static inline union _zend_function *zend_get_user_callstatic_function(zend_class_entry *ce, const char *method_name, zend_size_t method_len) /* {{{ */
|
||||
{
|
||||
zend_internal_function *callstatic_user_call = emalloc(sizeof(zend_internal_function));
|
||||
callstatic_user_call->type = ZEND_INTERNAL_FUNCTION;
|
||||
@@ -1173,11 +1174,11 @@ static inline union _zend_function *zend_get_user_callstatic_function(zend_class
|
||||
|
||||
/* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */
|
||||
|
||||
ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, int function_name_strlen, const zend_literal *key TSRMLS_DC) /* {{{ */
|
||||
ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, zend_size_t function_name_strlen, const zend_literal *key TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_function *fbc = NULL;
|
||||
char *lc_class_name, *lc_function_name = NULL;
|
||||
ulong hash_value;
|
||||
zend_uint_t hash_value;
|
||||
ALLOCA_FLAG(use_heap)
|
||||
|
||||
if (EXPECTED(key != NULL)) {
|
||||
@@ -1262,10 +1263,10 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const c
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, zend_bool silent, const zend_literal *key TSRMLS_DC) /* {{{ */
|
||||
ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, zend_size_t property_name_len, zend_bool silent, const zend_literal *key TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_property_info *property_info;
|
||||
ulong hash_value;
|
||||
zend_uint_t hash_value;
|
||||
|
||||
if (UNEXPECTED(!key) ||
|
||||
(property_info = CACHED_POLYMORPHIC_PTR(key->cache_slot, ce)) == NULL) {
|
||||
@@ -1319,7 +1320,7 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *p
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, const zend_literal *key TSRMLS_DC) /* {{{ */
|
||||
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, zend_size_t property_name_len, const zend_literal *key TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_error_noreturn(E_ERROR, "Attempt to unset static property %s::$%s", ce->name, property_name);
|
||||
return 0;
|
||||
@@ -1390,10 +1391,10 @@ static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
|
||||
Z_OBJ_UNPROTECT_RECURSION(o2);
|
||||
return 1;
|
||||
}
|
||||
if (Z_LVAL(result) != 0) {
|
||||
if (Z_IVAL(result) != 0) {
|
||||
Z_OBJ_UNPROTECT_RECURSION(o1);
|
||||
Z_OBJ_UNPROTECT_RECURSION(o2);
|
||||
return Z_LVAL(result);
|
||||
return Z_IVAL(result);
|
||||
}
|
||||
} else {
|
||||
Z_OBJ_UNPROTECT_RECURSION(o1);
|
||||
@@ -1526,7 +1527,7 @@ zend_class_entry *zend_std_object_get_class(const zval *object TSRMLS_DC) /* {{{
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
int zend_std_object_get_class_name(const zval *object, const char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC) /* {{{ */
|
||||
int zend_std_object_get_class_name(const zval *object, const char **class_name, zend_size_t *class_name_len, int parent TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_object *zobj;
|
||||
zend_class_entry *ce;
|
||||
@@ -1591,14 +1592,14 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
|
||||
INIT_PZVAL(writeobj);
|
||||
ZVAL_BOOL(writeobj, 1);
|
||||
return SUCCESS;
|
||||
case IS_LONG:
|
||||
case IS_INT:
|
||||
ce = Z_OBJCE_P(readobj);
|
||||
zend_error(E_NOTICE, "Object of class %s could not be converted to int", ce->name);
|
||||
INIT_PZVAL(writeobj);
|
||||
if (readobj == writeobj) {
|
||||
zval_dtor(readobj);
|
||||
}
|
||||
ZVAL_LONG(writeobj, 1);
|
||||
ZVAL_INT(writeobj, 1);
|
||||
return SUCCESS;
|
||||
case IS_DOUBLE:
|
||||
ce = Z_OBJCE_P(readobj);
|
||||
|
||||
@@ -88,7 +88,7 @@ typedef HashTable *(*zend_object_get_debug_info_t)(zval *object, int *is_temp TS
|
||||
/* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback for this.
|
||||
*/
|
||||
typedef int (*zend_object_call_method_t)(const char *method, INTERNAL_FUNCTION_PARAMETERS);
|
||||
typedef union _zend_function *(*zend_object_get_method_t)(zval **object_ptr, char *method, int method_len, const struct _zend_literal *key TSRMLS_DC);
|
||||
typedef union _zend_function *(*zend_object_get_method_t)(zval **object_ptr, char *method, zend_size_t method_len, const struct _zend_literal *key TSRMLS_DC);
|
||||
typedef union _zend_function *(*zend_object_get_constructor_t)(zval *object TSRMLS_DC);
|
||||
|
||||
/* Object maintenance/destruction */
|
||||
@@ -98,7 +98,7 @@ typedef void (*zend_object_delete_obj_t)(zval *object TSRMLS_DC);
|
||||
typedef zend_object_value (*zend_object_clone_obj_t)(zval *object TSRMLS_DC);
|
||||
|
||||
typedef zend_class_entry *(*zend_object_get_class_entry_t)(const zval *object TSRMLS_DC);
|
||||
typedef int (*zend_object_get_class_name_t)(const zval *object, const char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC);
|
||||
typedef int (*zend_object_get_class_name_t)(const zval *object, const char **class_name, zend_size_t *class_name_len, int parent TSRMLS_DC);
|
||||
typedef int (*zend_object_compare_t)(zval *object1, zval *object2 TSRMLS_DC);
|
||||
typedef int (*zend_object_compare_zvals_t)(zval *resul, zval *op1, zval *op2 TSRMLS_DC);
|
||||
|
||||
@@ -108,7 +108,7 @@ typedef int (*zend_object_cast_t)(zval *readobj, zval *retval, int type TSRMLS_D
|
||||
|
||||
/* updates *count to hold the number of elements present and returns SUCCESS.
|
||||
* Returns FAILURE if the object does not have any sense of overloaded dimensions */
|
||||
typedef int (*zend_object_count_elements_t)(zval *object, long *count TSRMLS_DC);
|
||||
typedef int (*zend_object_count_elements_t)(zval *object, zend_int_t *count TSRMLS_DC);
|
||||
|
||||
typedef int (*zend_object_get_closure_t)(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC);
|
||||
|
||||
@@ -155,9 +155,9 @@ extern ZEND_API zend_object_handlers std_object_handlers;
|
||||
((fbc)->common.prototype ? (fbc)->common.prototype->common.scope : (fbc)->common.scope)
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, int function_name_strlen, const struct _zend_literal *key TSRMLS_DC);
|
||||
ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, zend_bool silent, const struct _zend_literal *key TSRMLS_DC);
|
||||
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, const struct _zend_literal *key TSRMLS_DC);
|
||||
ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, zend_size_t function_name_strlen, const struct _zend_literal *key TSRMLS_DC);
|
||||
ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, zend_size_t property_name_len, zend_bool silent, const struct _zend_literal *key TSRMLS_DC);
|
||||
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, zend_size_t property_name_len, const struct _zend_literal *key TSRMLS_DC);
|
||||
ZEND_API union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC);
|
||||
ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC);
|
||||
ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC);
|
||||
@@ -170,11 +170,11 @@ ZEND_API void rebuild_object_properties(zend_object *zobj);
|
||||
#define IS_ZEND_STD_OBJECT(z) (Z_TYPE(z) == IS_OBJECT && (Z_OBJ_HT((z))->get_class_entry != NULL))
|
||||
#define HAS_CLASS_ENTRY(z) (Z_OBJ_HT(z)->get_class_entry != NULL)
|
||||
|
||||
ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC);
|
||||
ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, char *function_name_strval, zend_size_t function_name_strlen TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope);
|
||||
|
||||
ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, int prop_info_name_len TSRMLS_DC);
|
||||
ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, zend_size_t prop_info_name_len TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS);
|
||||
END_EXTERN_C()
|
||||
|
||||
+3
-3
@@ -677,7 +677,7 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
|
||||
int nest_levels, array_offset;
|
||||
zend_brk_cont_element *jmp_to;
|
||||
|
||||
nest_levels = Z_LVAL(op_array->literals[opline->op2.constant].constant);
|
||||
nest_levels = Z_IVAL(op_array->literals[opline->op2.constant].constant);
|
||||
if ((array_offset = opline->op1.opline_num) != -1) {
|
||||
do {
|
||||
jmp_to = &op_array->brk_cont_array[array_offset];
|
||||
@@ -690,7 +690,7 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
case ZEND_GOTO:
|
||||
if (Z_TYPE(op_array->literals[opline->op2.constant].constant) != IS_LONG) {
|
||||
if (Z_TYPE(op_array->literals[opline->op2.constant].constant) != IS_INT) {
|
||||
zend_uint num = opline->op2.constant;
|
||||
opline->op2.zv = &op_array->literals[opline->op2.constant].constant;
|
||||
zend_resolve_goto_label(op_array, opline, 1 TSRMLS_CC);
|
||||
@@ -753,7 +753,7 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
|
||||
}
|
||||
switch (opline->opcode) {
|
||||
case ZEND_GOTO:
|
||||
if (Z_TYPE_P(opline->op2.zv) != IS_LONG) {
|
||||
if (Z_TYPE_P(opline->op2.zv) != IS_INT) {
|
||||
zend_resolve_goto_label(op_array, opline, 1 TSRMLS_CC);
|
||||
}
|
||||
/* break omitted intentionally */
|
||||
|
||||
+364
-365
File diff suppressed because it is too large.
Load diff
+150
-145
@@ -41,7 +41,7 @@
|
||||
#include "ext/bcmath/libbcmath/src/bcmath.h"
|
||||
#endif
|
||||
|
||||
#define LONG_SIGN_MASK (1L << (8*sizeof(long)-1))
|
||||
#define LONG_SIGN_MASK (((zend_int_t)1) << (8*sizeof(zend_int_t)-1))
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
@@ -71,12 +71,12 @@ ZEND_API zend_bool instanceof_function_ex(const zend_class_entry *instance_ce, c
|
||||
ZEND_API zend_bool instanceof_function(const zend_class_entry *instance_ce, const zend_class_entry *ce TSRMLS_DC);
|
||||
END_EXTERN_C()
|
||||
|
||||
#if ZEND_DVAL_TO_LVAL_CAST_OK
|
||||
# define zend_dval_to_lval(d) ((long) (d))
|
||||
#elif SIZEOF_LONG == 4
|
||||
static zend_always_inline long zend_dval_to_lval(double d)
|
||||
#if ZEND_DVAL_TO_IVAL_CAST_OK
|
||||
# define zend_dval_to_ival(d) ((zend_int_t) (d))
|
||||
#elif SIZEOF_ZEND_INT == 4
|
||||
static zend_always_inline zend_int_t zend_dval_to_ival(double d)
|
||||
{
|
||||
if (d > LONG_MAX || d < LONG_MIN) {
|
||||
if (d > ZEND_INT_MAX || d < ZEND_INT_MIN) {
|
||||
double two_pow_32 = pow(2., 32.),
|
||||
dmod;
|
||||
|
||||
@@ -86,15 +86,15 @@ static zend_always_inline long zend_dval_to_lval(double d)
|
||||
* to simulate rounding towards 0 of the negative number */
|
||||
dmod = ceil(dmod) + two_pow_32;
|
||||
}
|
||||
return (long)(unsigned long)dmod;
|
||||
return (zend_int_t)(zend_uint_t)dmod;
|
||||
}
|
||||
return (long)d;
|
||||
return (zend_int_t)d;
|
||||
}
|
||||
#else
|
||||
static zend_always_inline long zend_dval_to_lval(double d)
|
||||
static zend_always_inline zend_int_t zend_dval_to_ival(double d)
|
||||
{
|
||||
/* >= as (double)LONG_MAX is outside signed range */
|
||||
if (d >= LONG_MAX || d < LONG_MIN) {
|
||||
if (d >= ZEND_INT_MAX || d < ZEND_INT_MIN) {
|
||||
double two_pow_64 = pow(2., 64.),
|
||||
dmod;
|
||||
|
||||
@@ -104,9 +104,9 @@ static zend_always_inline long zend_dval_to_lval(double d)
|
||||
* fractional part, hence dmod does not have one either */
|
||||
dmod += two_pow_64;
|
||||
}
|
||||
return (long)(unsigned long)dmod;
|
||||
return (zend_int_t)(zend_uint_t)dmod;
|
||||
}
|
||||
return (long)d;
|
||||
return (zend_int_t)d;
|
||||
}
|
||||
#endif
|
||||
/* }}} */
|
||||
@@ -119,7 +119,7 @@ static zend_always_inline long zend_dval_to_lval(double d)
|
||||
* of allow_errors determines whether it's required to be entirely numeric, or
|
||||
* just its prefix. Leading whitespace is allowed.
|
||||
*
|
||||
* The function returns 0 if the string did not contain a valid number; IS_LONG
|
||||
* The function returns 0 if the string did not contain a valid number; IS_INT
|
||||
* if it contained a number that fits within the range of a long; or IS_DOUBLE
|
||||
* if the number was out of long range or contained a decimal point/exponent.
|
||||
* The number's value is returned into the respective pointer, *lval or *dval,
|
||||
@@ -129,10 +129,11 @@ static zend_always_inline long zend_dval_to_lval(double d)
|
||||
* could not be represented as such due to overflow. It writes 1 to oflow_info
|
||||
* if the integer is larger than LONG_MAX and -1 if it's smaller than LONG_MIN.
|
||||
*/
|
||||
static inline zend_uchar is_numeric_string_ex(const char *str, int length, long *lval, double *dval, int allow_errors, int *oflow_info)
|
||||
static inline zend_uchar is_numeric_string_ex(const char *str, zend_size_t length, zend_int_t *lval, double *dval, int allow_errors, int *oflow_info)
|
||||
{
|
||||
const char *ptr;
|
||||
int base = 10, digits = 0, dp_or_e = 0;
|
||||
int base = 10, dp_or_e = 0;
|
||||
ptrdiff_t digits = 0;
|
||||
double local_dval = 0.0;
|
||||
zend_uchar type;
|
||||
|
||||
@@ -172,7 +173,7 @@ static inline zend_uchar is_numeric_string_ex(const char *str, int length, long
|
||||
/* Count the number of digits. If a decimal point/exponent is found,
|
||||
* it's a double. Otherwise, if there's a dval or no need to check for
|
||||
* a full match, stop when there are too many digits for a long */
|
||||
for (type = IS_LONG; !(digits >= MAX_LENGTH_OF_LONG && (dval || allow_errors == 1)); digits++, ptr++) {
|
||||
for (type = IS_INT; !(digits >= MAX_LENGTH_OF_ZEND_INT && (dval || allow_errors == 1)); digits++, ptr++) {
|
||||
check_digits:
|
||||
if (ZEND_IS_DIGIT(*ptr) || (base == 16 && ZEND_IS_XDIGIT(*ptr))) {
|
||||
continue;
|
||||
@@ -195,14 +196,14 @@ check_digits:
|
||||
}
|
||||
|
||||
if (base == 10) {
|
||||
if (digits >= MAX_LENGTH_OF_LONG) {
|
||||
if (digits >= MAX_LENGTH_OF_ZEND_INT) {
|
||||
if (oflow_info != NULL) {
|
||||
*oflow_info = *str == '-' ? -1 : 1;
|
||||
}
|
||||
dp_or_e = -1;
|
||||
goto process_double;
|
||||
}
|
||||
} else if (!(digits < SIZEOF_LONG * 2 || (digits == SIZEOF_LONG * 2 && ptr[-digits] <= '7'))) {
|
||||
} else if (!(digits < SIZEOF_ZEND_INT * 2 || (digits == SIZEOF_ZEND_INT * 2 && ptr[-digits] <= '7'))) {
|
||||
if (dval) {
|
||||
local_dval = zend_hex_strtod(str, &ptr);
|
||||
}
|
||||
@@ -236,9 +237,9 @@ process_double:
|
||||
}
|
||||
}
|
||||
|
||||
if (type == IS_LONG) {
|
||||
if (digits == MAX_LENGTH_OF_LONG - 1) {
|
||||
int cmp = strcmp(&ptr[-digits], long_min_digits);
|
||||
if (type == IS_INT) {
|
||||
if (digits == MAX_LENGTH_OF_ZEND_INT - 1) {
|
||||
int cmp = strcmp(&ptr[-digits], int_min_digits);
|
||||
|
||||
if (!(cmp < 0 || (cmp == 0 && *str == '-'))) {
|
||||
if (dval) {
|
||||
@@ -253,10 +254,10 @@ process_double:
|
||||
}
|
||||
|
||||
if (lval) {
|
||||
*lval = strtol(str, NULL, base);
|
||||
*lval = ZEND_STRTOI(str, NULL, base);
|
||||
}
|
||||
|
||||
return IS_LONG;
|
||||
return IS_INT;
|
||||
} else {
|
||||
if (dval) {
|
||||
*dval = local_dval;
|
||||
@@ -266,21 +267,25 @@ process_double:
|
||||
}
|
||||
}
|
||||
|
||||
static inline zend_uchar is_numeric_string(const char *str, int length, long *lval, double *dval, int allow_errors) {
|
||||
static inline zend_uchar is_numeric_string(const char *str, zend_size_t length, zend_int_t *lval, double *dval, int allow_errors) {
|
||||
return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL);
|
||||
}
|
||||
|
||||
static inline const char *
|
||||
zend_memnstr(const char *haystack, const char *needle, int needle_len, char *end)
|
||||
zend_memnstr(const char *haystack, const char *needle, zend_size_t needle_len, char *end)
|
||||
{
|
||||
const char *p = haystack;
|
||||
const char ne = needle[needle_len-1];
|
||||
ptrdiff_t off_p;
|
||||
zend_size_t off_s;
|
||||
|
||||
if (needle_len == 1) {
|
||||
return (char *)memchr(p, *needle, (end-p));
|
||||
}
|
||||
|
||||
if (needle_len > end-haystack) {
|
||||
off_p = end - haystack;
|
||||
off_s = (off_p > 0) ? (zend_size_t)off_p : 0;
|
||||
if (needle_len > off_s) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -303,7 +308,7 @@ zend_memnstr(const char *haystack, const char *needle, int needle_len, char *end
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline const void *zend_memrchr(const void *s, int c, size_t n)
|
||||
static inline const void *zend_memrchr(const void *s, int c, zend_size_t n)
|
||||
{
|
||||
register const unsigned char *e;
|
||||
|
||||
@@ -327,14 +332,14 @@ ZEND_API int decrement_function(zval *op2);
|
||||
ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC);
|
||||
ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC);
|
||||
ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC);
|
||||
ZEND_API void convert_to_long(zval *op);
|
||||
ZEND_API void convert_to_int(zval *op);
|
||||
ZEND_API void convert_to_double(zval *op);
|
||||
ZEND_API void convert_to_long_base(zval *op, int base);
|
||||
ZEND_API void convert_to_int_base(zval *op, int base);
|
||||
ZEND_API void convert_to_null(zval *op);
|
||||
ZEND_API void convert_to_boolean(zval *op);
|
||||
ZEND_API void convert_to_array(zval *op);
|
||||
ZEND_API void convert_to_object(zval *op);
|
||||
ZEND_API void multi_convert_to_long_ex(int argc, ...);
|
||||
ZEND_API void multi_convert_to_int_ex(int argc, ...);
|
||||
ZEND_API void multi_convert_to_double_ex(int argc, ...);
|
||||
ZEND_API void multi_convert_to_string_ex(int argc, ...);
|
||||
ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2);
|
||||
@@ -342,7 +347,7 @@ ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2
|
||||
#define convert_to_cstring(op) if ((op)->type != IS_STRING) { _convert_to_cstring((op) ZEND_FILE_LINE_CC); }
|
||||
#define convert_to_string(op) if ((op)->type != IS_STRING) { _convert_to_string((op) ZEND_FILE_LINE_CC); }
|
||||
|
||||
ZEND_API double zend_string_to_double(const char *number, zend_uint length);
|
||||
ZEND_API double zend_string_to_double(const char *number, zend_size_t length);
|
||||
|
||||
ZEND_API int zval_is_true(zval *op);
|
||||
ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
@@ -354,27 +359,27 @@ ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2 TSR
|
||||
ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
ZEND_API void zend_str_tolower(char *str, unsigned int length);
|
||||
ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned int length);
|
||||
ZEND_API char *zend_str_tolower_dup(const char *source, unsigned int length);
|
||||
ZEND_API void zend_str_tolower(char *str, zend_size_t length);
|
||||
ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, zend_size_t length);
|
||||
ZEND_API char *zend_str_tolower_dup(const char *source, zend_size_t length);
|
||||
|
||||
ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2);
|
||||
ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3);
|
||||
ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2);
|
||||
ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3);
|
||||
ZEND_API int zend_binary_strcmp(const char *s1, uint len1, const char *s2, uint len2);
|
||||
ZEND_API int zend_binary_strncmp(const char *s1, uint len1, const char *s2, uint len2, uint length);
|
||||
ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, uint len2);
|
||||
ZEND_API int zend_binary_strncasecmp(const char *s1, uint len1, const char *s2, uint len2, uint length);
|
||||
ZEND_API int zend_binary_strncasecmp_l(const char *s1, uint len1, const char *s2, uint len2, uint length);
|
||||
ZEND_API int zend_binary_strcmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2);
|
||||
ZEND_API int zend_binary_strncmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length);
|
||||
ZEND_API int zend_binary_strcasecmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2);
|
||||
ZEND_API int zend_binary_strncasecmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length);
|
||||
ZEND_API int zend_binary_strncasecmp_l(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length);
|
||||
|
||||
ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
|
||||
ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC);
|
||||
ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC);
|
||||
ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_atoi(const char *str, int str_len);
|
||||
ZEND_API long zend_atol(const char *str, int str_len);
|
||||
ZEND_API int zend_atoi(const char *str, zend_size_t str_len);
|
||||
ZEND_API zend_int_t zend_atol(const char *str, zend_size_t str_len);
|
||||
|
||||
ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC);
|
||||
END_EXTERN_C()
|
||||
@@ -391,8 +396,8 @@ END_EXTERN_C()
|
||||
case IS_NULL: \
|
||||
convert_to_null(pzv); \
|
||||
break; \
|
||||
case IS_LONG: \
|
||||
convert_to_long(pzv); \
|
||||
case IS_INT: \
|
||||
convert_to_int(pzv); \
|
||||
break; \
|
||||
case IS_DOUBLE: \
|
||||
convert_to_double(pzv); \
|
||||
@@ -422,7 +427,7 @@ END_EXTERN_C()
|
||||
}
|
||||
|
||||
#define convert_to_boolean_ex(ppzv) convert_to_ex_master(ppzv, boolean, BOOL)
|
||||
#define convert_to_long_ex(ppzv) convert_to_ex_master(ppzv, long, LONG)
|
||||
#define convert_to_int_ex(ppzv) convert_to_ex_master(ppzv, int, INT)
|
||||
#define convert_to_double_ex(ppzv) convert_to_ex_master(ppzv, double, DOUBLE)
|
||||
#define convert_to_string_ex(ppzv) convert_to_ex_master(ppzv, string, STRING)
|
||||
#define convert_to_array_ex(ppzv) convert_to_ex_master(ppzv, array, ARRAY)
|
||||
@@ -430,7 +435,7 @@ END_EXTERN_C()
|
||||
#define convert_to_null_ex(ppzv) convert_to_ex_master(ppzv, null, NULL)
|
||||
|
||||
#define convert_scalar_to_number_ex(ppzv) \
|
||||
if (Z_TYPE_PP(ppzv)!=IS_LONG && Z_TYPE_PP(ppzv)!=IS_DOUBLE) { \
|
||||
if (Z_TYPE_PP(ppzv)!=IS_INT && Z_TYPE_PP(ppzv)!=IS_DOUBLE) { \
|
||||
if (!Z_ISREF_PP(ppzv)) { \
|
||||
SEPARATE_ZVAL(ppzv); \
|
||||
} \
|
||||
@@ -438,11 +443,11 @@ END_EXTERN_C()
|
||||
}
|
||||
|
||||
|
||||
#define Z_LVAL(zval) (zval).value.lval
|
||||
#define Z_IVAL(zval) (zval).value.lval
|
||||
#define Z_BVAL(zval) ((zend_bool)(zval).value.lval)
|
||||
#define Z_DVAL(zval) (zval).value.dval
|
||||
#define Z_STRVAL(zval) (zval).value.str.val
|
||||
#define Z_STRLEN(zval) (zval).value.str.len
|
||||
#define Z_STRSIZE(zval) (zval).value.str.len
|
||||
#define Z_ARRVAL(zval) (zval).value.ht
|
||||
#define Z_AST(zval) (zval).value.ast
|
||||
#define Z_OBJVAL(zval) (zval).value.obj
|
||||
@@ -454,11 +459,11 @@ END_EXTERN_C()
|
||||
#define Z_RESVAL(zval) (zval).value.lval
|
||||
#define Z_OBJDEBUG(zval,is_tmp) (Z_OBJ_HANDLER((zval),get_debug_info)?Z_OBJ_HANDLER((zval),get_debug_info)(&(zval),&is_tmp TSRMLS_CC):(is_tmp=0,Z_OBJ_HANDLER((zval),get_properties)?Z_OBJPROP(zval):NULL))
|
||||
|
||||
#define Z_LVAL_P(zval_p) Z_LVAL(*zval_p)
|
||||
#define Z_IVAL_P(zval_p) Z_IVAL(*zval_p)
|
||||
#define Z_BVAL_P(zval_p) Z_BVAL(*zval_p)
|
||||
#define Z_DVAL_P(zval_p) Z_DVAL(*zval_p)
|
||||
#define Z_STRVAL_P(zval_p) Z_STRVAL(*zval_p)
|
||||
#define Z_STRLEN_P(zval_p) Z_STRLEN(*zval_p)
|
||||
#define Z_STRSIZE_P(zval_p) Z_STRSIZE(*zval_p)
|
||||
#define Z_ARRVAL_P(zval_p) Z_ARRVAL(*zval_p)
|
||||
#define Z_AST_P(zval_p) Z_AST(*zval_p)
|
||||
#define Z_OBJPROP_P(zval_p) Z_OBJPROP(*zval_p)
|
||||
@@ -470,11 +475,11 @@ END_EXTERN_C()
|
||||
#define Z_OBJ_HANDLER_P(zval_p, h) Z_OBJ_HANDLER(*zval_p, h)
|
||||
#define Z_OBJDEBUG_P(zval_p,is_tmp) Z_OBJDEBUG(*zval_p,is_tmp)
|
||||
|
||||
#define Z_LVAL_PP(zval_pp) Z_LVAL(**zval_pp)
|
||||
#define Z_IVAL_PP(zval_pp) Z_IVAL(**zval_pp)
|
||||
#define Z_BVAL_PP(zval_pp) Z_BVAL(**zval_pp)
|
||||
#define Z_DVAL_PP(zval_pp) Z_DVAL(**zval_pp)
|
||||
#define Z_STRVAL_PP(zval_pp) Z_STRVAL(**zval_pp)
|
||||
#define Z_STRLEN_PP(zval_pp) Z_STRLEN(**zval_pp)
|
||||
#define Z_STRSIZE_PP(zval_pp) Z_STRSIZE(**zval_pp)
|
||||
#define Z_ARRVAL_PP(zval_pp) Z_ARRVAL(**zval_pp)
|
||||
#define Z_AST_PP(zval_p) Z_AST(**zval_p)
|
||||
#define Z_OBJPROP_PP(zval_pp) Z_OBJPROP(**zval_pp)
|
||||
@@ -509,7 +514,7 @@ ZEND_API void zend_update_current_locale(void);
|
||||
|
||||
static zend_always_inline int fast_increment_function(zval *op1)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
__asm__(
|
||||
"incl (%0)\n\t"
|
||||
@@ -537,12 +542,12 @@ static zend_always_inline int fast_increment_function(zval *op1)
|
||||
"n"(ZVAL_OFFSETOF_TYPE)
|
||||
: "cc");
|
||||
#else
|
||||
if (UNEXPECTED(Z_LVAL_P(op1) == LONG_MAX)) {
|
||||
if (UNEXPECTED(Z_IVAL_P(op1) == ZEND_INT_MAX)) {
|
||||
/* switch to double */
|
||||
Z_DVAL_P(op1) = (double)LONG_MAX + 1.0;
|
||||
Z_DVAL_P(op1) = (double)ZEND_INT_MAX + 1.0;
|
||||
Z_TYPE_P(op1) = IS_DOUBLE;
|
||||
} else {
|
||||
Z_LVAL_P(op1)++;
|
||||
Z_IVAL_P(op1)++;
|
||||
}
|
||||
#endif
|
||||
return SUCCESS;
|
||||
@@ -552,7 +557,7 @@ static zend_always_inline int fast_increment_function(zval *op1)
|
||||
|
||||
static zend_always_inline int fast_decrement_function(zval *op1)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
__asm__(
|
||||
"decl (%0)\n\t"
|
||||
@@ -580,12 +585,12 @@ static zend_always_inline int fast_decrement_function(zval *op1)
|
||||
"n"(ZVAL_OFFSETOF_TYPE)
|
||||
: "cc");
|
||||
#else
|
||||
if (UNEXPECTED(Z_LVAL_P(op1) == LONG_MIN)) {
|
||||
if (UNEXPECTED(Z_IVAL_P(op1) == ZEND_INT_MIN)) {
|
||||
/* switch to double */
|
||||
Z_DVAL_P(op1) = (double)LONG_MIN - 1.0;
|
||||
Z_DVAL_P(op1) = (double)ZEND_INT_MIN - 1.0;
|
||||
Z_TYPE_P(op1) = IS_DOUBLE;
|
||||
} else {
|
||||
Z_LVAL_P(op1)--;
|
||||
Z_IVAL_P(op1)--;
|
||||
}
|
||||
#endif
|
||||
return SUCCESS;
|
||||
@@ -595,8 +600,8 @@ static zend_always_inline int fast_decrement_function(zval *op1)
|
||||
|
||||
static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
__asm__(
|
||||
"movl (%1), %%eax\n\t"
|
||||
@@ -616,7 +621,7 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
|
||||
: "r"(&result->value),
|
||||
"r"(&op1->value),
|
||||
"r"(&op2->value),
|
||||
"n"(IS_LONG),
|
||||
"n"(IS_INT),
|
||||
"n"(IS_DOUBLE),
|
||||
"n"(ZVAL_OFFSETOF_TYPE)
|
||||
: "eax","cc");
|
||||
@@ -639,7 +644,7 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
|
||||
: "r"(&result->value),
|
||||
"r"(&op1->value),
|
||||
"r"(&op2->value),
|
||||
"n"(IS_LONG),
|
||||
"n"(IS_INT),
|
||||
"n"(IS_DOUBLE),
|
||||
"n"(ZVAL_OFFSETOF_TYPE)
|
||||
: "rax","cc");
|
||||
@@ -650,18 +655,18 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
|
||||
* have read the values of op1 and op2.
|
||||
*/
|
||||
|
||||
if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK)
|
||||
&& (Z_LVAL_P(op1) & LONG_SIGN_MASK) != ((Z_LVAL_P(op1) + Z_LVAL_P(op2)) & LONG_SIGN_MASK))) {
|
||||
Z_DVAL_P(result) = (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2);
|
||||
if (UNEXPECTED((Z_IVAL_P(op1) & LONG_SIGN_MASK) == (Z_IVAL_P(op2) & LONG_SIGN_MASK)
|
||||
&& (Z_IVAL_P(op1) & LONG_SIGN_MASK) != ((Z_IVAL_P(op1) + Z_IVAL_P(op2)) & LONG_SIGN_MASK))) {
|
||||
Z_DVAL_P(result) = (double) Z_IVAL_P(op1) + (double) Z_IVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
} else {
|
||||
Z_LVAL_P(result) = Z_LVAL_P(op1) + Z_LVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
Z_IVAL_P(result) = Z_IVAL_P(op1) + Z_IVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_INT;
|
||||
}
|
||||
#endif
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2);
|
||||
Z_DVAL_P(result) = ((double)Z_IVAL_P(op1)) + Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -670,8 +675,8 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) + Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2));
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) + ((double)Z_IVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -681,8 +686,8 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
|
||||
|
||||
static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
__asm__(
|
||||
"movl (%1), %%eax\n\t"
|
||||
@@ -706,7 +711,7 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o
|
||||
: "r"(&result->value),
|
||||
"r"(&op1->value),
|
||||
"r"(&op2->value),
|
||||
"n"(IS_LONG),
|
||||
"n"(IS_INT),
|
||||
"n"(IS_DOUBLE),
|
||||
"n"(ZVAL_OFFSETOF_TYPE)
|
||||
: "eax","cc");
|
||||
@@ -733,24 +738,24 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o
|
||||
: "r"(&result->value),
|
||||
"r"(&op1->value),
|
||||
"r"(&op2->value),
|
||||
"n"(IS_LONG),
|
||||
"n"(IS_INT),
|
||||
"n"(IS_DOUBLE),
|
||||
"n"(ZVAL_OFFSETOF_TYPE)
|
||||
: "rax","cc");
|
||||
#else
|
||||
Z_LVAL_P(result) = Z_LVAL_P(op1) - Z_LVAL_P(op2);
|
||||
Z_IVAL_P(result) = Z_IVAL_P(op1) - Z_IVAL_P(op2);
|
||||
|
||||
if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK)
|
||||
&& (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(result) & LONG_SIGN_MASK))) {
|
||||
Z_DVAL_P(result) = (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2);
|
||||
if (UNEXPECTED((Z_IVAL_P(op1) & LONG_SIGN_MASK) != (Z_IVAL_P(op2) & LONG_SIGN_MASK)
|
||||
&& (Z_IVAL_P(op1) & LONG_SIGN_MASK) != (Z_IVAL_P(result) & LONG_SIGN_MASK))) {
|
||||
Z_DVAL_P(result) = (double) Z_IVAL_P(op1) - (double) Z_IVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
} else {
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
Z_TYPE_P(result) = IS_INT;
|
||||
}
|
||||
#endif
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2);
|
||||
Z_DVAL_P(result) = ((double)Z_IVAL_P(op1)) - Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -759,8 +764,8 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) - Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2));
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) - ((double)Z_IVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -770,15 +775,15 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o
|
||||
|
||||
static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
long overflow;
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
zend_int_t overflow;
|
||||
|
||||
ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1), Z_LVAL_P(op2), Z_LVAL_P(result), Z_DVAL_P(result), overflow);
|
||||
Z_TYPE_P(result) = overflow ? IS_DOUBLE : IS_LONG;
|
||||
ZEND_SIGNED_MULTIPLY_INT(Z_IVAL_P(op1), Z_IVAL_P(op2), Z_IVAL_P(result), Z_DVAL_P(result), overflow);
|
||||
Z_TYPE_P(result) = overflow ? IS_DOUBLE : IS_INT;
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2);
|
||||
Z_DVAL_P(result) = ((double)Z_IVAL_P(op1)) * Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -787,8 +792,8 @@ static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *o
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) * Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2));
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) * ((double)Z_IVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -799,34 +804,34 @@ static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *o
|
||||
static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
#if 0
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG) && 0) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_INT) && 0) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
if (UNEXPECTED(Z_IVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_IVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
return FAILURE;
|
||||
} else if (UNEXPECTED(Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == LONG_MIN)) {
|
||||
} else if (UNEXPECTED(Z_IVAL_P(op2) == -1 && Z_IVAL_P(op1) == ZEND_INT_MIN)) {
|
||||
/* Prevent overflow error/crash */
|
||||
Z_DVAL_P(result) = (double) LONG_MIN / -1;
|
||||
Z_DVAL_P(result) = (double) ZEND_INT_MIN / -1;
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
} else if (EXPECTED(Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0)) {
|
||||
} else if (EXPECTED(Z_IVAL_P(op1) % Z_IVAL_P(op2) == 0)) {
|
||||
/* integer */
|
||||
Z_LVAL_P(result) = Z_LVAL_P(op1) / Z_LVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
Z_IVAL_P(result) = Z_IVAL_P(op1) / Z_IVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_INT;
|
||||
} else {
|
||||
Z_DVAL_P(result) = ((double) Z_LVAL_P(op1)) / ((double)Z_LVAL_P(op2));
|
||||
Z_DVAL_P(result) = ((double) Z_IVAL_P(op1)) / ((double)Z_IVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
}
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
if (UNEXPECTED(Z_DVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_IVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
return FAILURE;
|
||||
}
|
||||
Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) / Z_DVAL_P(op2);
|
||||
Z_DVAL_P(result) = ((double)Z_IVAL_P(op1)) / Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -834,21 +839,21 @@ static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *o
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
if (UNEXPECTED(Z_DVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_IVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
return FAILURE;
|
||||
}
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) / Z_DVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
if (UNEXPECTED(Z_IVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_IVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
return FAILURE;
|
||||
}
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) / ((double)Z_LVAL_P(op2));
|
||||
Z_DVAL_P(result) = Z_DVAL_P(op1) / ((double)Z_IVAL_P(op2));
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -859,21 +864,21 @@ static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *o
|
||||
|
||||
static zend_always_inline int fast_mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
if (UNEXPECTED(Z_IVAL_P(op2) == 0)) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_IVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_BOOL;
|
||||
return FAILURE;
|
||||
} else if (UNEXPECTED(Z_LVAL_P(op2) == -1)) {
|
||||
} else if (UNEXPECTED(Z_IVAL_P(op2) == -1)) {
|
||||
/* Prevent overflow error/crash if op1==LONG_MIN */
|
||||
Z_LVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
Z_IVAL_P(result) = 0;
|
||||
Z_TYPE_P(result) = IS_INT;
|
||||
return SUCCESS;
|
||||
}
|
||||
Z_LVAL_P(result) = Z_LVAL_P(op1) % Z_LVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
Z_IVAL_P(result) = Z_IVAL_P(op1) % Z_IVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_INT;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -882,78 +887,78 @@ static zend_always_inline int fast_mod_function(zval *result, zval *op1, zval *o
|
||||
|
||||
static zend_always_inline int fast_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_LVAL_P(op1) == Z_LVAL_P(op2);
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
return Z_IVAL_P(op1) == Z_IVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return ((double)Z_LVAL_P(op1)) == Z_DVAL_P(op2);
|
||||
return ((double)Z_IVAL_P(op1)) == Z_DVAL_P(op2);
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return Z_DVAL_P(op1) == Z_DVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_DVAL_P(op1) == ((double)Z_LVAL_P(op2));
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
return Z_DVAL_P(op1) == ((double)Z_IVAL_P(op2));
|
||||
}
|
||||
}
|
||||
compare_function(result, op1, op2 TSRMLS_CC);
|
||||
return Z_LVAL_P(result) == 0;
|
||||
return Z_IVAL_P(result) == 0;
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_LVAL_P(op1) != Z_LVAL_P(op2);
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
return Z_IVAL_P(op1) != Z_IVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return ((double)Z_LVAL_P(op1)) != Z_DVAL_P(op2);
|
||||
return ((double)Z_IVAL_P(op1)) != Z_DVAL_P(op2);
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return Z_DVAL_P(op1) != Z_DVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_DVAL_P(op1) != ((double)Z_LVAL_P(op2));
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
return Z_DVAL_P(op1) != ((double)Z_IVAL_P(op2));
|
||||
}
|
||||
}
|
||||
compare_function(result, op1, op2 TSRMLS_CC);
|
||||
return Z_LVAL_P(result) != 0;
|
||||
return Z_IVAL_P(result) != 0;
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_LVAL_P(op1) < Z_LVAL_P(op2);
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
return Z_IVAL_P(op1) < Z_IVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return ((double)Z_LVAL_P(op1)) < Z_DVAL_P(op2);
|
||||
return ((double)Z_IVAL_P(op1)) < Z_DVAL_P(op2);
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return Z_DVAL_P(op1) < Z_DVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_DVAL_P(op1) < ((double)Z_LVAL_P(op2));
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
return Z_DVAL_P(op1) < ((double)Z_IVAL_P(op2));
|
||||
}
|
||||
}
|
||||
compare_function(result, op1, op2 TSRMLS_CC);
|
||||
return Z_LVAL_P(result) < 0;
|
||||
return Z_IVAL_P(result) < 0;
|
||||
}
|
||||
|
||||
static zend_always_inline int fast_is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_LVAL_P(op1) <= Z_LVAL_P(op2);
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
return Z_IVAL_P(op1) <= Z_IVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return ((double)Z_LVAL_P(op1)) <= Z_DVAL_P(op2);
|
||||
return ((double)Z_IVAL_P(op1)) <= Z_DVAL_P(op2);
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
|
||||
return Z_DVAL_P(op1) <= Z_DVAL_P(op2);
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
return Z_DVAL_P(op1) <= ((double)Z_LVAL_P(op2));
|
||||
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
|
||||
return Z_DVAL_P(op1) <= ((double)Z_IVAL_P(op2));
|
||||
}
|
||||
}
|
||||
compare_function(result, op1, op2 TSRMLS_CC);
|
||||
return Z_LVAL_P(result) <= 0;
|
||||
return Z_IVAL_P(result) <= 0;
|
||||
}
|
||||
|
||||
#define ZEND_TRY_BINARY_OBJECT_OPERATION(opcode) \
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#define ZEND_PTR_STACK_H
|
||||
|
||||
typedef struct _zend_ptr_stack {
|
||||
int top, max;
|
||||
ptrdiff_t top, max;
|
||||
void **elements;
|
||||
void **top_element;
|
||||
zend_bool persistent;
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ ZEND_API void zend_qsort_r(void *base, size_t nmemb, size_t siz, compare_r_func_
|
||||
end = end_stack[loop];
|
||||
|
||||
while (begin < end) {
|
||||
offset = (end - begin) >> 1;
|
||||
offset = (end - begin) >> Z_I(1);
|
||||
_zend_qsort_swap(begin, begin + (offset - (offset % siz)), siz);
|
||||
|
||||
seg1 = begin + siz;
|
||||
|
||||
+7
-7
@@ -30,7 +30,7 @@ ZEND_API int zend_stack_init(zend_stack *stack)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
ZEND_API int zend_stack_push(zend_stack *stack, const void *element, int size)
|
||||
ZEND_API zend_size_t zend_stack_push(zend_stack *stack, const void *element, zend_size_t size)
|
||||
{
|
||||
if (stack->top >= stack->max) { /* we need to allocate more memory */
|
||||
stack->elements = (void **) erealloc(stack->elements,
|
||||
@@ -90,7 +90,7 @@ ZEND_API int zend_stack_is_empty(const zend_stack *stack)
|
||||
|
||||
ZEND_API int zend_stack_destroy(zend_stack *stack)
|
||||
{
|
||||
int i;
|
||||
zend_size_t i;
|
||||
|
||||
if (stack->elements) {
|
||||
for (i = 0; i < stack->top; i++) {
|
||||
@@ -110,7 +110,7 @@ ZEND_API void **zend_stack_base(const zend_stack *stack)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_stack_count(const zend_stack *stack)
|
||||
ZEND_API zend_size_t zend_stack_count(const zend_stack *stack)
|
||||
{
|
||||
return stack->top;
|
||||
}
|
||||
@@ -118,11 +118,11 @@ ZEND_API int zend_stack_count(const zend_stack *stack)
|
||||
|
||||
ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element))
|
||||
{
|
||||
int i;
|
||||
zend_size_t i;
|
||||
|
||||
switch (type) {
|
||||
case ZEND_STACK_APPLY_TOPDOWN:
|
||||
for (i=stack->top-1; i>=0; i--) {
|
||||
for (i=stack->top-1; i < ZEND_SIZE_MAX; i--) {
|
||||
if (apply_function(stack->elements[i])) {
|
||||
break;
|
||||
}
|
||||
@@ -141,11 +141,11 @@ ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function
|
||||
|
||||
ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg)
|
||||
{
|
||||
int i;
|
||||
zend_size_t i;
|
||||
|
||||
switch (type) {
|
||||
case ZEND_STACK_APPLY_TOPDOWN:
|
||||
for (i=stack->top-1; i>=0; i--) {
|
||||
for (i = stack->top - 1; i < ZEND_SIZE_MAX; i--) {
|
||||
if (apply_function(stack->elements[i], arg)) {
|
||||
break;
|
||||
}
|
||||
|
||||
+3
-3
@@ -23,7 +23,7 @@
|
||||
#define ZEND_STACK_H
|
||||
|
||||
typedef struct _zend_stack {
|
||||
int top, max;
|
||||
zend_size_t top, max;
|
||||
void **elements;
|
||||
} zend_stack;
|
||||
|
||||
@@ -32,14 +32,14 @@ typedef struct _zend_stack {
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API int zend_stack_init(zend_stack *stack);
|
||||
ZEND_API int zend_stack_push(zend_stack *stack, const void *element, int size);
|
||||
ZEND_API zend_size_t zend_stack_push(zend_stack *stack, const void *element, zend_size_t size);
|
||||
ZEND_API int zend_stack_top(const zend_stack *stack, void **element);
|
||||
ZEND_API int zend_stack_del_top(zend_stack *stack);
|
||||
ZEND_API int zend_stack_int_top(const zend_stack *stack);
|
||||
ZEND_API int zend_stack_is_empty(const zend_stack *stack);
|
||||
ZEND_API int zend_stack_destroy(zend_stack *stack);
|
||||
ZEND_API void **zend_stack_base(const zend_stack *stack);
|
||||
ZEND_API int zend_stack_count(const zend_stack *stack);
|
||||
ZEND_API zend_size_t zend_stack_count(const zend_stack *stack);
|
||||
ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element));
|
||||
ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg);
|
||||
END_EXTERN_C()
|
||||
|
||||
+4
-5
@@ -24,9 +24,8 @@
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_compile.h"
|
||||
#include "zend_stream.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#if HAVE_MMAP
|
||||
# if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
@@ -64,8 +63,8 @@ static void zend_stream_stdio_closer(void *handle TSRMLS_DC) /* {{{ */
|
||||
|
||||
static size_t zend_stream_stdio_fsizer(void *handle TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
struct stat buf;
|
||||
if (handle && fstat(fileno((FILE*)handle), &buf) == 0) {
|
||||
zend_stat_t buf;
|
||||
if (handle && zend_fstat(fileno((FILE*)handle), &buf) == 0) {
|
||||
#ifdef S_ISREG
|
||||
if (!S_ISREG(buf.st_mode)) {
|
||||
return 0;
|
||||
@@ -237,7 +236,7 @@ ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t
|
||||
/* *buf[size] is zeroed automatically by the kernel */
|
||||
*buf = mmap(0, size + ZEND_MMAP_AHEAD, PROT_READ, MAP_PRIVATE, fileno(file_handle->handle.fp), 0);
|
||||
if (*buf != MAP_FAILED) {
|
||||
long offset = ftell(file_handle->handle.fp);
|
||||
zend_int_t offset = zend_ftell(file_handle->handle.fp);
|
||||
file_handle->handle.stream.mmap.map = *buf;
|
||||
|
||||
if (offset != -1) {
|
||||
|
||||
+22
-3
@@ -24,6 +24,9 @@
|
||||
#ifndef ZEND_STREAM_H
|
||||
#define ZEND_STREAM_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/* Lightweight stream implementation for the ZE scanners.
|
||||
* These functions are private to the engine.
|
||||
* */
|
||||
@@ -60,14 +63,14 @@ typedef struct _zend_stream {
|
||||
} zend_stream;
|
||||
|
||||
typedef struct _zend_file_handle {
|
||||
zend_stream_type type;
|
||||
const char *filename;
|
||||
char *opened_path;
|
||||
union {
|
||||
int fd;
|
||||
FILE *fp;
|
||||
zend_stream stream;
|
||||
} handle;
|
||||
const char *filename;
|
||||
char *opened_path;
|
||||
zend_stream_type type;
|
||||
zend_bool free_filename;
|
||||
} zend_file_handle;
|
||||
|
||||
@@ -78,4 +81,20 @@ ZEND_API void zend_file_handle_dtor(zend_file_handle *fh TSRMLS_DC);
|
||||
ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2);
|
||||
END_EXTERN_C()
|
||||
|
||||
#ifdef _WIN64
|
||||
# define zend_fseek _fseeki64
|
||||
# define zend_ftell _ftelli64
|
||||
# define zend_lseek _lseeki64
|
||||
# define zend_fstat _fstat64
|
||||
# define zend_stat _stat64
|
||||
typedef struct __stat64 zend_stat_t;
|
||||
#else
|
||||
# define zend_fseek fseek
|
||||
# define zend_ftell ftell
|
||||
# define zend_lseek lseek
|
||||
# define zend_fstat fstat
|
||||
# define zend_stat stat
|
||||
typedef struct stat zend_stat_t;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+4
-4
@@ -29,11 +29,11 @@
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
ZEND_API const char *(*zend_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC);
|
||||
ZEND_API const char *(*zend_new_interned_string)(const char *str, zend_size_t len, int free_src TSRMLS_DC);
|
||||
ZEND_API void (*zend_interned_strings_snapshot)(TSRMLS_D);
|
||||
ZEND_API void (*zend_interned_strings_restore)(TSRMLS_D);
|
||||
|
||||
static const char *zend_new_interned_string_int(const char *str, int len, int free_src TSRMLS_DC);
|
||||
static const char *zend_new_interned_string_int(const char *str, zend_size_t len, int free_src TSRMLS_DC);
|
||||
static void zend_interned_strings_snapshot_int(TSRMLS_D);
|
||||
static void zend_interned_strings_restore_int(TSRMLS_D);
|
||||
|
||||
@@ -81,10 +81,10 @@ void zend_interned_strings_dtor(TSRMLS_D)
|
||||
#endif
|
||||
}
|
||||
|
||||
static const char *zend_new_interned_string_int(const char *arKey, int nKeyLength, int free_src TSRMLS_DC)
|
||||
static const char *zend_new_interned_string_int(const char *arKey, zend_size_t nKeyLength, int free_src TSRMLS_DC)
|
||||
{
|
||||
#ifndef ZTS
|
||||
ulong h;
|
||||
zend_uint_t h;
|
||||
uint nIndex;
|
||||
Bucket *p;
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
#include "zend.h"
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API extern const char *(*zend_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC);
|
||||
ZEND_API extern const char *(*zend_new_interned_string)(const char *str, zend_size_t len, int free_src TSRMLS_DC);
|
||||
ZEND_API extern void (*zend_interned_strings_snapshot)(TSRMLS_D);
|
||||
ZEND_API extern void (*zend_interned_strings_restore)(TSRMLS_D);
|
||||
|
||||
|
||||
+12
-12
@@ -99,7 +99,7 @@ ZEND_API void zend_ts_hash_clean(TsHashTable *ht)
|
||||
end_write(ht);
|
||||
}
|
||||
|
||||
ZEND_API int _zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
|
||||
ZEND_API int _zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, zend_size_t nKeyLength, void *pData, zend_size_t nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@@ -110,7 +110,7 @@ ZEND_API int _zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKey
|
||||
return retval;
|
||||
}
|
||||
|
||||
ZEND_API int _zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
|
||||
ZEND_API int _zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, zend_size_t nKeyLength, zend_uint_t h, void *pData, zend_size_t nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@@ -121,7 +121,7 @@ ZEND_API int _zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uin
|
||||
return retval;
|
||||
}
|
||||
|
||||
ZEND_API int _zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
|
||||
ZEND_API int _zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, zend_uint_t h, void *pData, zend_size_t nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@@ -132,7 +132,7 @@ ZEND_API int _zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h,
|
||||
return retval;
|
||||
}
|
||||
|
||||
ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint nKeyLength)
|
||||
ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, zend_size_t nKeyLength)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@@ -187,7 +187,7 @@ ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_fun
|
||||
end_write(ht);
|
||||
}
|
||||
|
||||
ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag)
|
||||
ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, zend_size_t nKeyLength, zend_uint_t h, int flag)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@@ -198,9 +198,9 @@ ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nK
|
||||
return retval;
|
||||
}
|
||||
|
||||
ZEND_API ulong zend_ts_get_hash_value(TsHashTable *ht, char *arKey, uint nKeyLength)
|
||||
ZEND_API zend_uint_t zend_ts_get_hash_value(TsHashTable *ht, char *arKey, zend_size_t nKeyLength)
|
||||
{
|
||||
ulong retval;
|
||||
zend_uint_t retval;
|
||||
|
||||
begin_read(ht);
|
||||
retval = zend_get_hash_value(arKey, nKeyLength);
|
||||
@@ -209,7 +209,7 @@ ZEND_API ulong zend_ts_get_hash_value(TsHashTable *ht, char *arKey, uint nKeyLen
|
||||
return retval;
|
||||
}
|
||||
|
||||
ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData)
|
||||
ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, zend_size_t nKeyLength, void **pData)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@@ -220,7 +220,7 @@ ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, uint nKeyLength, vo
|
||||
return retval;
|
||||
}
|
||||
|
||||
ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData)
|
||||
ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, zend_size_t nKeyLength, zend_uint_t h, void **pData)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@@ -231,7 +231,7 @@ ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, uint nKeyLeng
|
||||
return retval;
|
||||
}
|
||||
|
||||
ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, ulong h, void **pData)
|
||||
ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, zend_uint_t h, void **pData)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@@ -242,7 +242,7 @@ ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, ulong h, void **pData)
|
||||
return retval;
|
||||
}
|
||||
|
||||
ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, uint nKeyLength)
|
||||
ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, zend_size_t nKeyLength)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@@ -253,7 +253,7 @@ ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, uint nKeyLength)
|
||||
return retval;
|
||||
}
|
||||
|
||||
ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, ulong h)
|
||||
ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, zend_uint_t h)
|
||||
{
|
||||
int retval;
|
||||
|
||||
|
||||
+12
-12
@@ -49,25 +49,25 @@ ZEND_API void zend_ts_hash_clean(TsHashTable *ht);
|
||||
|
||||
|
||||
/* additions/updates/changes */
|
||||
ZEND_API int _zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
|
||||
ZEND_API int _zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, zend_size_t nKeyLength, void *pData, zend_size_t nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
|
||||
#define zend_ts_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
|
||||
_zend_ts_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
|
||||
#define zend_ts_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
|
||||
_zend_ts_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD ZEND_FILE_LINE_CC)
|
||||
|
||||
ZEND_API int _zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
|
||||
ZEND_API int _zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, zend_size_t nKeyLength, zend_uint_t h, void *pData, zend_size_t nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
|
||||
#define zend_ts_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
|
||||
_zend_ts_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
|
||||
#define zend_ts_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
|
||||
_zend_ts_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_ADD ZEND_FILE_LINE_CC)
|
||||
|
||||
ZEND_API int _zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
|
||||
ZEND_API int _zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, zend_uint_t h, void *pData, zend_size_t nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
|
||||
#define zend_ts_hash_index_update(ht, h, pData, nDataSize, pDest) \
|
||||
_zend_ts_hash_index_update_or_next_insert(ht, h, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
|
||||
#define zend_ts_hash_next_index_insert(ht, pData, nDataSize, pDest) \
|
||||
_zend_ts_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT ZEND_FILE_LINE_CC)
|
||||
|
||||
ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint nKeyLength);
|
||||
ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, zend_size_t nKeyLength);
|
||||
|
||||
ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht);
|
||||
ZEND_API void zend_ts_hash_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC);
|
||||
@@ -78,22 +78,22 @@ ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_fun
|
||||
|
||||
|
||||
/* Deletes */
|
||||
ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag);
|
||||
ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, zend_size_t nKeyLength, zend_uint_t h, int flag);
|
||||
#define zend_ts_hash_del(ht, arKey, nKeyLength) \
|
||||
zend_ts_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY)
|
||||
#define zend_ts_hash_index_del(ht, h) \
|
||||
zend_ts_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX)
|
||||
|
||||
ZEND_API ulong zend_ts_get_hash_value(TsHashTable *ht, char *arKey, uint nKeyLength);
|
||||
ZEND_API zend_uint_t zend_ts_get_hash_value(TsHashTable *ht, char *arKey, zend_size_t nKeyLength);
|
||||
|
||||
/* Data retreival */
|
||||
ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData);
|
||||
ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData);
|
||||
ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, ulong h, void **pData);
|
||||
ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, zend_size_t nKeyLength, void **pData);
|
||||
ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, zend_size_t nKeyLength, zend_uint_t h, void **pData);
|
||||
ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, zend_uint_t h, void **pData);
|
||||
|
||||
/* Misc */
|
||||
ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, uint nKeyLength);
|
||||
ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, ulong h);
|
||||
ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, zend_size_t nKeyLength);
|
||||
ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, zend_uint_t h);
|
||||
|
||||
/* Copying, merging and sorting */
|
||||
ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size);
|
||||
@@ -108,7 +108,7 @@ ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht);
|
||||
|
||||
ZEND_API int zend_ts_hash_rehash(TsHashTable *ht);
|
||||
|
||||
ZEND_API ulong zend_ts_hash_func(char *arKey, uint nKeyLength);
|
||||
ZEND_API zend_uint_t zend_ts_hash_func(char *arKey, uint nKeyLength);
|
||||
|
||||
#if ZEND_DEBUG
|
||||
/* debug */
|
||||
|
||||
@@ -22,12 +22,29 @@
|
||||
#ifndef ZEND_TYPES_H
|
||||
#define ZEND_TYPES_H
|
||||
|
||||
#include "zend_int.h"
|
||||
|
||||
typedef unsigned char zend_bool;
|
||||
typedef unsigned char zend_uchar;
|
||||
typedef unsigned int zend_uint;
|
||||
typedef unsigned long zend_ulong;
|
||||
typedef unsigned short zend_ushort;
|
||||
|
||||
#ifdef ZEND_ENABLE_INT64
|
||||
# ifdef ZEND_WIN32
|
||||
# define ZEND_SIZE_MAX _UI64_MAX
|
||||
# else
|
||||
# define ZEND_SIZE_MAX SIZE_MAX
|
||||
# endif
|
||||
#else
|
||||
# if defined(ZEND_WIN32)
|
||||
# define ZEND_SIZE_MAX _UI32_MAX
|
||||
# else
|
||||
# define ZEND_SIZE_MAX SIZE_MAX
|
||||
# endif
|
||||
#endif
|
||||
typedef size_t zend_size_t;
|
||||
|
||||
#define HAVE_ZEND_LONG64
|
||||
#ifdef ZEND_WIN32
|
||||
typedef __int64 zend_long64;
|
||||
|
||||
@@ -65,7 +65,7 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
zend_list_delete(zvalue->value.lval);
|
||||
}
|
||||
break;
|
||||
case IS_LONG:
|
||||
case IS_INT:
|
||||
case IS_DOUBLE:
|
||||
case IS_BOOL:
|
||||
case IS_NULL:
|
||||
@@ -90,7 +90,7 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
case IS_RESOURCE:
|
||||
zend_error(E_CORE_ERROR, "Internal zval's can't be arrays, objects or resources");
|
||||
break;
|
||||
case IS_LONG:
|
||||
case IS_INT:
|
||||
case IS_DOUBLE:
|
||||
case IS_BOOL:
|
||||
case IS_NULL:
|
||||
@@ -116,7 +116,7 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
}
|
||||
break;
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
case IS_INT:
|
||||
case IS_NULL:
|
||||
break;
|
||||
case IS_CONSTANT:
|
||||
@@ -154,7 +154,7 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_print_variable(zval *var)
|
||||
ZEND_API zend_size_t zend_print_variable(zval *var)
|
||||
{
|
||||
return zend_print_zval(var, 0);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ static zend_always_inline void _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
|
||||
ZEND_API int zval_copy_static_var(zval **p TSRMLS_DC, int num_args, va_list args, zend_hash_key *key);
|
||||
|
||||
ZEND_API int zend_print_variable(zval *var);
|
||||
ZEND_API zend_size_t zend_print_variable(zval *var);
|
||||
ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC);
|
||||
ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC);
|
||||
ZEND_API void _zval_internal_ptr_dtor(zval **zvalue ZEND_FILE_LINE_DC);
|
||||
|
||||
+25
-25
@@ -291,7 +291,7 @@ CWD_API int php_sys_readlink(const char *link, char *target, size_t target_len){
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{{ */
|
||||
CWD_API int php_sys_stat_ex(const char *path, zend_stat_t *buf, int lstat) /* {{{ */
|
||||
{
|
||||
WIN32_FILE_ATTRIBUTE_DATA data;
|
||||
__int64 t;
|
||||
@@ -299,7 +299,7 @@ CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{
|
||||
ALLOCA_FLAG(use_heap_large);
|
||||
|
||||
if (!GetFileAttributesEx(path, GetFileExInfoStandard, &data)) {
|
||||
return stat(path, buf);
|
||||
return zend_stat(path, buf);
|
||||
}
|
||||
|
||||
if (path_len >= 1 && path[1] == ':') {
|
||||
@@ -407,7 +407,7 @@ CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{
|
||||
|
||||
static int php_is_dir_ok(const cwd_state *state) /* {{{ */
|
||||
{
|
||||
struct stat buf;
|
||||
zend_stat_t buf;
|
||||
|
||||
if (php_sys_stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode))
|
||||
return (0);
|
||||
@@ -418,7 +418,7 @@ static int php_is_dir_ok(const cwd_state *state) /* {{{ */
|
||||
|
||||
static int php_is_file_ok(const cwd_state *state) /* {{{ */
|
||||
{
|
||||
struct stat buf;
|
||||
zend_stat_t buf;
|
||||
|
||||
if (php_sys_stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode))
|
||||
return (0);
|
||||
@@ -582,9 +582,9 @@ CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC) /* {{{ */
|
||||
/* }}} */
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
static inline unsigned long realpath_cache_key(const char *path, int path_len TSRMLS_DC) /* {{{ */
|
||||
static inline zend_uint_t realpath_cache_key(const char *path, zend_size_t path_len TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
register unsigned long h;
|
||||
register zend_uint_t h;
|
||||
char *bucket_key_start = tsrm_win32_get_path_sid_key(path TSRMLS_CC);
|
||||
char *bucket_key = (char *)bucket_key_start;
|
||||
const char *e = bucket_key + strlen(bucket_key);
|
||||
@@ -602,9 +602,9 @@ static inline unsigned long realpath_cache_key(const char *path, int path_len TS
|
||||
}
|
||||
/* }}} */
|
||||
#else
|
||||
static inline unsigned long realpath_cache_key(const char *path, int path_len) /* {{{ */
|
||||
static inline zend_uint_t realpath_cache_key(const char *path, zend_size_t path_len) /* {{{ */
|
||||
{
|
||||
register unsigned long h;
|
||||
register zend_uint_t h;
|
||||
const char *e = path + path_len;
|
||||
|
||||
for (h = 2166136261U; path < e;) {
|
||||
@@ -634,14 +634,14 @@ CWD_API void realpath_cache_clean(TSRMLS_D) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{ */
|
||||
CWD_API void realpath_cache_del(const char *path, zend_size_t path_len TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
#ifdef PHP_WIN32
|
||||
unsigned long key = realpath_cache_key(path, path_len TSRMLS_CC);
|
||||
zend_uint_t key = realpath_cache_key(path, path_len TSRMLS_CC);
|
||||
#else
|
||||
unsigned long key = realpath_cache_key(path, path_len);
|
||||
zend_uint_t key = realpath_cache_key(path, path_len);
|
||||
#endif
|
||||
unsigned long n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
|
||||
zend_uint_t n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
|
||||
realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n];
|
||||
|
||||
while (*bucket != NULL) {
|
||||
@@ -666,9 +666,9 @@ CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static inline void realpath_cache_add(const char *path, int path_len, const char *realpath, int realpath_len, int is_dir, time_t t TSRMLS_DC) /* {{{ */
|
||||
static inline void realpath_cache_add(const char *path, zend_size_t path_len, const char *realpath, zend_size_t realpath_len, int is_dir, time_t t TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
long size = sizeof(realpath_cache_bucket) + path_len + 1;
|
||||
zend_int_t size = sizeof(realpath_cache_bucket) + path_len + 1;
|
||||
int same = 1;
|
||||
|
||||
if (realpath_len != path_len ||
|
||||
@@ -679,7 +679,7 @@ static inline void realpath_cache_add(const char *path, int path_len, const char
|
||||
|
||||
if (CWDG(realpath_cache_size) + size <= CWDG(realpath_cache_size_limit)) {
|
||||
realpath_cache_bucket *bucket = malloc(size);
|
||||
unsigned long n;
|
||||
zend_uint_t n;
|
||||
|
||||
if (bucket == NULL) {
|
||||
return;
|
||||
@@ -716,15 +716,15 @@ static inline void realpath_cache_add(const char *path, int path_len, const char
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static inline realpath_cache_bucket* realpath_cache_find(const char *path, int path_len, time_t t TSRMLS_DC) /* {{{ */
|
||||
static inline realpath_cache_bucket* realpath_cache_find(const char *path, zend_size_t path_len, time_t t TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
#ifdef PHP_WIN32
|
||||
unsigned long key = realpath_cache_key(path, path_len TSRMLS_CC);
|
||||
zend_uint_t key = realpath_cache_key(path, path_len TSRMLS_CC);
|
||||
#else
|
||||
unsigned long key = realpath_cache_key(path, path_len);
|
||||
zend_uint_t key = realpath_cache_key(path, path_len);
|
||||
#endif
|
||||
|
||||
unsigned long n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
|
||||
zend_uint_t n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
|
||||
realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n];
|
||||
|
||||
while (*bucket != NULL) {
|
||||
@@ -750,18 +750,18 @@ static inline realpath_cache_bucket* realpath_cache_find(const char *path, int p
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t TSRMLS_DC) /* {{{ */
|
||||
CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, zend_size_t path_len, time_t t TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return realpath_cache_find(path, path_len, t TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
CWD_API int realpath_cache_size(TSRMLS_D)
|
||||
CWD_API zend_int_t realpath_cache_size(TSRMLS_D)
|
||||
{
|
||||
return CWDG(realpath_cache_size);
|
||||
}
|
||||
|
||||
CWD_API int realpath_cache_max_buckets(TSRMLS_D)
|
||||
CWD_API zend_int_t realpath_cache_max_buckets(TSRMLS_D)
|
||||
{
|
||||
return (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
|
||||
}
|
||||
@@ -784,7 +784,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
HANDLE hFind;
|
||||
ALLOCA_FLAG(use_heap_large)
|
||||
#else
|
||||
struct stat st;
|
||||
zend_stat_t st;
|
||||
#endif
|
||||
realpath_cache_bucket *bucket;
|
||||
char *tmp;
|
||||
@@ -1739,7 +1739,7 @@ CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC) /
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */
|
||||
CWD_API int virtual_stat(const char *path, zend_stat_t *buf TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
@@ -1757,7 +1757,7 @@ CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */
|
||||
CWD_API int virtual_lstat(const char *path, zend_stat_t *buf TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
+11
-11
@@ -130,7 +130,7 @@ typedef unsigned short mode_t;
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat);
|
||||
CWD_API int php_sys_stat_ex(const char *path, zend_stat_t *buf, int lstat);
|
||||
# define php_sys_stat(path, buf) php_sys_stat_ex(path, buf, 0)
|
||||
# define php_sys_lstat(path, buf) php_sys_stat_ex(path, buf, 1)
|
||||
CWD_API int php_sys_readlink(const char *link, char *target, size_t target_len);
|
||||
@@ -164,8 +164,8 @@ CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC);
|
||||
CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...);
|
||||
CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC);
|
||||
CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC);
|
||||
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC);
|
||||
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC);
|
||||
CWD_API int virtual_stat(const char *path, zend_stat_t *buf TSRMLS_DC);
|
||||
CWD_API int virtual_lstat(const char *path, zend_stat_t *buf TSRMLS_DC);
|
||||
CWD_API int virtual_unlink(const char *path TSRMLS_DC);
|
||||
CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC);
|
||||
CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC);
|
||||
@@ -211,7 +211,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC);
|
||||
#define REALPATH_CACHE_SIZE 0 /* disabled while php.ini isn't loaded */
|
||||
|
||||
typedef struct _realpath_cache_bucket {
|
||||
unsigned long key;
|
||||
zend_uint_t key;
|
||||
char *path;
|
||||
int path_len;
|
||||
char *realpath;
|
||||
@@ -229,9 +229,9 @@ typedef struct _realpath_cache_bucket {
|
||||
|
||||
typedef struct _virtual_cwd_globals {
|
||||
cwd_state cwd;
|
||||
long realpath_cache_size;
|
||||
long realpath_cache_size_limit;
|
||||
long realpath_cache_ttl;
|
||||
zend_int_t realpath_cache_size;
|
||||
zend_int_t realpath_cache_size_limit;
|
||||
zend_int_t realpath_cache_ttl;
|
||||
realpath_cache_bucket *realpath_cache[1024];
|
||||
} virtual_cwd_globals;
|
||||
|
||||
@@ -244,10 +244,10 @@ extern virtual_cwd_globals cwd_globals;
|
||||
#endif
|
||||
|
||||
CWD_API void realpath_cache_clean(TSRMLS_D);
|
||||
CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC);
|
||||
CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t TSRMLS_DC);
|
||||
CWD_API int realpath_cache_size(TSRMLS_D);
|
||||
CWD_API int realpath_cache_max_buckets(TSRMLS_D);
|
||||
CWD_API void realpath_cache_del(const char *path, zend_size_t path_len TSRMLS_DC);
|
||||
CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, zend_size_t path_len, time_t t TSRMLS_DC);
|
||||
CWD_API zend_int_t realpath_cache_size(TSRMLS_D);
|
||||
CWD_API zend_int_t realpath_cache_max_buckets(TSRMLS_D);
|
||||
CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D);
|
||||
|
||||
/* The actual macros to be used in programs using TSRM
|
||||
|
||||
+126
-126
@@ -170,7 +170,7 @@ ZEND_VM_HANDLER(16, ZEND_IS_NOT_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
|
||||
is_identical_function(result,
|
||||
GET_OP1_ZVAL_PTR(BP_VAR_R),
|
||||
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
|
||||
Z_LVAL_P(result) = !Z_LVAL_P(result);
|
||||
Z_IVAL_P(result) = !Z_IVAL_P(result);
|
||||
FREE_OP1();
|
||||
FREE_OP2();
|
||||
CHECK_EXCEPTION();
|
||||
@@ -989,7 +989,7 @@ ZEND_VM_HANDLER(41, ZEND_PRINT, CONST|TMP|VAR|CV, ANY)
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
ZVAL_LONG(&EX_T(opline->result.var).tmp_var, 1);
|
||||
ZVAL_INT(&EX_T(opline->result.var).tmp_var, 1);
|
||||
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_ECHO);
|
||||
}
|
||||
|
||||
@@ -1001,7 +1001,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
|
||||
zval **retval;
|
||||
zval tmp_varname;
|
||||
HashTable *target_symbol_table;
|
||||
ulong hash_value;
|
||||
zend_uint_t hash_value;
|
||||
|
||||
SAVE_OPLINE();
|
||||
varname = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
@@ -1022,7 +1022,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
|
||||
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
|
||||
ce = CACHED_PTR(opline->op2.literal->cache_slot);
|
||||
} else {
|
||||
ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
|
||||
ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
if (OP1_TYPE != IS_CONST && varname == &tmp_varname) {
|
||||
zval_dtor(&tmp_varname);
|
||||
@@ -1036,7 +1036,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
|
||||
} else {
|
||||
ce = EX_T(opline->op2.var).class_entry;
|
||||
}
|
||||
retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
|
||||
retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
|
||||
FREE_OP1();
|
||||
} else {
|
||||
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
|
||||
@@ -1049,10 +1049,10 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
|
||||
if (OP1_TYPE == IS_CONST) {
|
||||
hash_value = Z_HASH_P(varname);
|
||||
} else {
|
||||
hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname));
|
||||
hash_value = str_hash(Z_STRVAL_P(varname), Z_STRSIZE_P(varname));
|
||||
}
|
||||
|
||||
if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
|
||||
if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
|
||||
switch (type) {
|
||||
case BP_VAR_R:
|
||||
case BP_VAR_UNSET:
|
||||
@@ -1066,7 +1066,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
|
||||
/* break missing intentionally */
|
||||
case BP_VAR_W:
|
||||
Z_ADDREF_P(&EG(uninitialized_zval));
|
||||
zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
|
||||
zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
|
||||
break;
|
||||
EMPTY_SWITCH_DEFAULT_CASE()
|
||||
}
|
||||
@@ -2102,7 +2102,7 @@ ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMP|VAR|CV, ANY)
|
||||
val = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
|
||||
ret = Z_LVAL_P(val);
|
||||
ret = Z_IVAL_P(val);
|
||||
} else {
|
||||
ret = i_zend_is_true(val);
|
||||
FREE_OP1();
|
||||
@@ -2132,7 +2132,7 @@ ZEND_VM_HANDLER(44, ZEND_JMPNZ, CONST|TMP|VAR|CV, ANY)
|
||||
val = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
|
||||
ret = Z_LVAL_P(val);
|
||||
ret = Z_IVAL_P(val);
|
||||
} else {
|
||||
ret = i_zend_is_true(val);
|
||||
FREE_OP1();
|
||||
@@ -2162,7 +2162,7 @@ ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMP|VAR|CV, ANY)
|
||||
val = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
|
||||
retval = Z_LVAL_P(val);
|
||||
retval = Z_IVAL_P(val);
|
||||
} else {
|
||||
retval = i_zend_is_true(val);
|
||||
FREE_OP1();
|
||||
@@ -2196,7 +2196,7 @@ ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMP|VAR|CV, ANY)
|
||||
val = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
|
||||
retval = Z_LVAL_P(val);
|
||||
retval = Z_IVAL_P(val);
|
||||
} else {
|
||||
retval = i_zend_is_true(val);
|
||||
FREE_OP1();
|
||||
@@ -2204,7 +2204,7 @@ ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMP|VAR|CV, ANY)
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
}
|
||||
Z_LVAL(EX_T(opline->result.var).tmp_var) = retval;
|
||||
Z_IVAL(EX_T(opline->result.var).tmp_var) = retval;
|
||||
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
|
||||
if (!retval) {
|
||||
#if DEBUG_ZEND>=2
|
||||
@@ -2227,7 +2227,7 @@ ZEND_VM_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMP|VAR|CV, ANY)
|
||||
val = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) {
|
||||
retval = Z_LVAL_P(val);
|
||||
retval = Z_IVAL_P(val);
|
||||
} else {
|
||||
retval = i_zend_is_true(val);
|
||||
FREE_OP1();
|
||||
@@ -2235,7 +2235,7 @@ ZEND_VM_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMP|VAR|CV, ANY)
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
}
|
||||
Z_LVAL(EX_T(opline->result.var).tmp_var) = retval;
|
||||
Z_IVAL(EX_T(opline->result.var).tmp_var) = retval;
|
||||
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
|
||||
if (retval) {
|
||||
#if DEBUG_ZEND>=2
|
||||
@@ -2287,7 +2287,7 @@ ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP|UNUSED, CONST)
|
||||
if (OP1_TYPE == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_char_to_string */
|
||||
Z_STRVAL_P(str) = NULL;
|
||||
Z_STRLEN_P(str) = 0;
|
||||
Z_STRSIZE_P(str) = 0;
|
||||
Z_TYPE_P(str) = IS_STRING;
|
||||
|
||||
INIT_PZVAL(str);
|
||||
@@ -2310,7 +2310,7 @@ ZEND_VM_HANDLER(55, ZEND_ADD_STRING, TMP|UNUSED, CONST)
|
||||
if (OP1_TYPE == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_string_to_string */
|
||||
Z_STRVAL_P(str) = NULL;
|
||||
Z_STRLEN_P(str) = 0;
|
||||
Z_STRSIZE_P(str) = 0;
|
||||
Z_TYPE_P(str) = IS_STRING;
|
||||
|
||||
INIT_PZVAL(str);
|
||||
@@ -2338,7 +2338,7 @@ ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|CV)
|
||||
if (OP1_TYPE == IS_UNUSED) {
|
||||
/* Initialize for erealloc in add_string_to_string */
|
||||
Z_STRVAL_P(str) = NULL;
|
||||
Z_STRLEN_P(str) = 0;
|
||||
Z_STRSIZE_P(str) = 0;
|
||||
Z_TYPE_P(str) = IS_STRING;
|
||||
|
||||
INIT_PZVAL(str);
|
||||
@@ -2388,13 +2388,13 @@ ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV)
|
||||
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
|
||||
EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot);
|
||||
} else {
|
||||
EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
|
||||
EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
|
||||
CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry);
|
||||
}
|
||||
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
|
||||
EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name);
|
||||
} else if (Z_TYPE_P(class_name) == IS_STRING) {
|
||||
EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC);
|
||||
EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC);
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
HANDLE_EXCEPTION();
|
||||
@@ -2413,7 +2413,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
USE_OPLINE
|
||||
zval *function_name;
|
||||
char *function_name_strval;
|
||||
int function_name_strlen;
|
||||
zend_size_t function_name_strlen;
|
||||
zend_free_op free_op1, free_op2;
|
||||
call_slot *call = EX(call_slots) + opline->result.num;
|
||||
|
||||
@@ -2430,7 +2430,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
}
|
||||
|
||||
function_name_strval = Z_STRVAL_P(function_name);
|
||||
function_name_strlen = Z_STRLEN_P(function_name);
|
||||
function_name_strlen = Z_STRSIZE_P(function_name);
|
||||
|
||||
call->object = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
@@ -2505,7 +2505,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
|
||||
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
|
||||
ce = CACHED_PTR(opline->op1.literal->cache_slot);
|
||||
} else {
|
||||
ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
|
||||
ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
@@ -2535,12 +2535,12 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
|
||||
/* do nothing */
|
||||
} else if (OP2_TYPE != IS_UNUSED) {
|
||||
char *function_name_strval = NULL;
|
||||
int function_name_strlen = 0;
|
||||
zend_size_t function_name_strlen = 0;
|
||||
zend_free_op free_op2;
|
||||
|
||||
if (OP2_TYPE == IS_CONST) {
|
||||
function_name_strval = Z_STRVAL_P(opline->op2.zv);
|
||||
function_name_strlen = Z_STRLEN_P(opline->op2.zv);
|
||||
function_name_strlen = Z_STRSIZE_P(opline->op2.zv);
|
||||
} else {
|
||||
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
@@ -2551,7 +2551,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
|
||||
zend_error_noreturn(E_ERROR, "Function name must be a string");
|
||||
} else {
|
||||
function_name_strval = Z_STRVAL_P(function_name);
|
||||
function_name_strlen = Z_STRLEN_P(function_name);
|
||||
function_name_strlen = Z_STRSIZE_P(function_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2626,7 +2626,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
|
||||
function_name = (zval*)(opline->op2.literal+1);
|
||||
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
|
||||
call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
|
||||
} else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) {
|
||||
} else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) {
|
||||
SAVE_OPLINE();
|
||||
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
|
||||
} else {
|
||||
@@ -2643,7 +2643,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else {
|
||||
char *function_name_strval, *lcname;
|
||||
int function_name_strlen;
|
||||
zend_size_t function_name_strlen;
|
||||
zend_free_op free_op2;
|
||||
|
||||
SAVE_OPLINE();
|
||||
@@ -2651,7 +2651,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
|
||||
|
||||
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
|
||||
function_name_strval = Z_STRVAL_P(function_name);
|
||||
function_name_strlen = Z_STRLEN_P(function_name);
|
||||
function_name_strlen = Z_STRSIZE_P(function_name);
|
||||
if (function_name_strval[0] == '\\') {
|
||||
function_name_strlen -= 1;
|
||||
lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen);
|
||||
@@ -2716,7 +2716,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
|
||||
}
|
||||
|
||||
if (Z_TYPE_PP(obj) == IS_STRING) {
|
||||
ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC);
|
||||
ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC);
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
@@ -2725,15 +2725,15 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
|
||||
call->object = NULL;
|
||||
|
||||
if (ce->get_static_method) {
|
||||
call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC);
|
||||
call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC);
|
||||
} else {
|
||||
call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC);
|
||||
call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC);
|
||||
}
|
||||
} else {
|
||||
call->object = *obj;
|
||||
ce = call->called_scope = Z_OBJCE_PP(obj);
|
||||
|
||||
call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC);
|
||||
call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC);
|
||||
if (UNEXPECTED(call->fbc == NULL)) {
|
||||
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method));
|
||||
}
|
||||
@@ -2784,9 +2784,9 @@ ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST)
|
||||
func_name = opline->op2.literal + 1;
|
||||
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
|
||||
call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
|
||||
} else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) {
|
||||
} else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRSIZE(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) {
|
||||
func_name++;
|
||||
if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) {
|
||||
if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRSIZE(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) {
|
||||
SAVE_OPLINE();
|
||||
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
|
||||
} else {
|
||||
@@ -2820,7 +2820,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY)
|
||||
|
||||
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
|
||||
EX(function_state).function = CACHED_PTR(opline->op1.literal->cache_slot);
|
||||
} else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRLEN_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) {
|
||||
} else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRSIZE_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) {
|
||||
SAVE_OPLINE();
|
||||
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", fname->value.str.val);
|
||||
} else {
|
||||
@@ -3013,7 +3013,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
|
||||
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
|
||||
catch_ce = CACHED_PTR(opline->op1.literal->cache_slot);
|
||||
} else {
|
||||
catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC);
|
||||
catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC);
|
||||
|
||||
CACHE_PTR(opline->op1.literal->cache_slot, catch_ce);
|
||||
}
|
||||
@@ -3223,7 +3223,7 @@ ZEND_VM_HANDLER(165, ZEND_SEND_UNPACK, ANY, ANY)
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval *args;
|
||||
int arg_num;
|
||||
zend_size_t arg_num;
|
||||
SAVE_OPLINE();
|
||||
|
||||
args = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
@@ -3242,8 +3242,8 @@ ZEND_VM_HANDLER(165, ZEND_SEND_UNPACK, ANY, ANY)
|
||||
zend_hash_move_forward_ex(ht, &pos), ++arg_num
|
||||
) {
|
||||
char *name;
|
||||
zend_uint name_len;
|
||||
zend_ulong index;
|
||||
zend_size_t name_len;
|
||||
zend_uint_t index;
|
||||
|
||||
if (zend_hash_get_current_key_ex(ht, &name, &name_len, &index, 0, &pos) == HASH_KEY_IS_STRING) {
|
||||
zend_error(E_RECOVERABLE_ERROR, "Cannot unpack array with string keys");
|
||||
@@ -3327,7 +3327,7 @@ ZEND_VM_HANDLER(165, ZEND_SEND_UNPACK, ANY, ANY)
|
||||
|
||||
if (ARG_MUST_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
|
||||
zend_error(
|
||||
E_WARNING, "Cannot pass by-reference argument %d of %s%s%s()"
|
||||
E_WARNING, "Cannot pass by-reference argument %pu of %s%s%s()"
|
||||
" by unpacking a Traversable, passing by-value instead", arg_num,
|
||||
EX(call)->fbc->common.scope ? EX(call)->fbc->common.scope->name : "",
|
||||
EX(call)->fbc->common.scope ? "::" : "",
|
||||
@@ -3369,7 +3369,7 @@ ZEND_VM_C_LABEL(unpack_iter_dtor):
|
||||
ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_uint arg_num = opline->op1.num;
|
||||
zend_size_t arg_num = opline->op1.num;
|
||||
zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
|
||||
|
||||
SAVE_OPLINE();
|
||||
@@ -3388,7 +3388,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
|
||||
ptr = EX(prev_execute_data);
|
||||
|
||||
if(ptr && ptr->op_array) {
|
||||
zend_error(E_WARNING, "Missing argument %u for %s%s%s(), called in %s on line %d and defined", opline->op1.num, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno);
|
||||
zend_error(E_WARNING, "Missing argument %u for %s%s%s(), called in %s on line %pu and defined", opline->op1.num, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno);
|
||||
} else {
|
||||
zend_error(E_WARNING, "Missing argument %u for %s%s%s()", opline->op1.num, class_name, space, get_active_function_name(TSRMLS_C));
|
||||
}
|
||||
@@ -3411,7 +3411,7 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *assignment_value;
|
||||
zend_uint arg_num = opline->op1.num;
|
||||
zend_size_t arg_num = opline->op1.num;
|
||||
zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
|
||||
zval **var_ptr;
|
||||
|
||||
@@ -3450,8 +3450,8 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
|
||||
ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, ANY, ANY)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_uint arg_num = opline->op1.num;
|
||||
zend_uint arg_count = zend_vm_stack_get_args_count(TSRMLS_C);
|
||||
zend_size_t arg_num = opline->op1.num;
|
||||
zend_size_t arg_count = zend_vm_stack_get_args_count(TSRMLS_C);
|
||||
zval **var_ptr, *params;
|
||||
|
||||
SAVE_OPLINE();
|
||||
@@ -3499,7 +3499,7 @@ ZEND_VM_HANDLER(50, ZEND_BRK, ANY, CONST)
|
||||
zend_brk_cont_element *el;
|
||||
|
||||
SAVE_OPLINE();
|
||||
el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num,
|
||||
el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->op1.opline_num,
|
||||
EX(op_array), execute_data TSRMLS_CC);
|
||||
ZEND_VM_JMP(EX(op_array)->opcodes + el->brk);
|
||||
}
|
||||
@@ -3510,7 +3510,7 @@ ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST)
|
||||
zend_brk_cont_element *el;
|
||||
|
||||
SAVE_OPLINE();
|
||||
el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num,
|
||||
el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->op1.opline_num,
|
||||
EX(op_array), execute_data TSRMLS_CC);
|
||||
ZEND_VM_JMP(EX(op_array)->opcodes + el->cont);
|
||||
}
|
||||
@@ -3522,7 +3522,7 @@ ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST)
|
||||
zend_brk_cont_element *el;
|
||||
|
||||
SAVE_OPLINE();
|
||||
el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->extended_value,
|
||||
el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->extended_value,
|
||||
EX(op_array), execute_data TSRMLS_CC);
|
||||
|
||||
brk_opline = EX(op_array)->opcodes + el->brk;
|
||||
@@ -3697,7 +3697,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
|
||||
c = CACHED_PTR(opline->op2.literal->cache_slot);
|
||||
} else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) {
|
||||
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
|
||||
char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv));
|
||||
char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv));
|
||||
if(!actual) {
|
||||
actual = Z_STRVAL_P(opline->op2.zv);
|
||||
} else {
|
||||
@@ -3705,7 +3705,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
|
||||
}
|
||||
/* non-qualified constant - allow text substitution */
|
||||
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
|
||||
ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1);
|
||||
ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1);
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else {
|
||||
@@ -3731,7 +3731,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
|
||||
} else if (CACHED_PTR(opline->op1.literal->cache_slot)) {
|
||||
ce = CACHED_PTR(opline->op1.literal->cache_slot);
|
||||
} else {
|
||||
ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
|
||||
ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
@@ -3749,7 +3749,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
|
||||
}
|
||||
}
|
||||
|
||||
if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) {
|
||||
if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) {
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_PP(value))) {
|
||||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
@@ -3764,7 +3764,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
|
||||
}
|
||||
ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value);
|
||||
zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
|
||||
} else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
|
||||
} else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
|
||||
/* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
|
||||
ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1);
|
||||
} else {
|
||||
@@ -3816,15 +3816,15 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUS
|
||||
if (OP2_TYPE != IS_UNUSED) {
|
||||
zend_free_op free_op2;
|
||||
zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
ulong hval;
|
||||
zend_uint_t hval;
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
hval = zend_dval_to_lval(Z_DVAL_P(offset));
|
||||
hval = zend_dval_to_ival(Z_DVAL_P(offset));
|
||||
ZEND_VM_C_GOTO(num_index);
|
||||
case IS_LONG:
|
||||
case IS_INT:
|
||||
case IS_BOOL:
|
||||
hval = Z_LVAL_P(offset);
|
||||
hval = Z_IVAL_P(offset);
|
||||
ZEND_VM_C_LABEL(num_index):
|
||||
zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
|
||||
break;
|
||||
@@ -3832,10 +3832,10 @@ ZEND_VM_C_LABEL(num_index):
|
||||
if (OP2_TYPE == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index));
|
||||
hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index));
|
||||
hval = str_hash(Z_STRVAL_P(offset), Z_STRSIZE_P(offset));
|
||||
}
|
||||
zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
|
||||
zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
|
||||
break;
|
||||
case IS_NULL:
|
||||
zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
|
||||
@@ -3894,8 +3894,8 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
|
||||
case IS_BOOL:
|
||||
convert_to_boolean(result);
|
||||
break;
|
||||
case IS_LONG:
|
||||
convert_to_long(result);
|
||||
case IS_INT:
|
||||
convert_to_int(result);
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
convert_to_double(result);
|
||||
@@ -3950,7 +3950,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
|
||||
inc_filename = tmp_inc_filename;
|
||||
}
|
||||
|
||||
if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) {
|
||||
if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) {
|
||||
if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) {
|
||||
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
|
||||
} else {
|
||||
@@ -3963,7 +3963,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
|
||||
zend_file_handle file_handle;
|
||||
char *resolved_path;
|
||||
|
||||
resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC);
|
||||
resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC);
|
||||
if (resolved_path) {
|
||||
failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
|
||||
} else {
|
||||
@@ -4105,7 +4105,7 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
|
||||
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
|
||||
ce = CACHED_PTR(opline->op2.literal->cache_slot);
|
||||
} else {
|
||||
ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
|
||||
ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
if (OP1_TYPE != IS_CONST && varname == &tmp) {
|
||||
zval_dtor(&tmp);
|
||||
@@ -4123,9 +4123,9 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
|
||||
} else {
|
||||
ce = EX_T(opline->op2.var).class_entry;
|
||||
}
|
||||
zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
|
||||
zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
|
||||
zend_uint_t hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
|
||||
|
||||
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
|
||||
zend_delete_variable(execute_data, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC);
|
||||
@@ -4147,7 +4147,7 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
zval *offset;
|
||||
ulong hval;
|
||||
zend_uint_t hval;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET);
|
||||
@@ -4163,13 +4163,13 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
hval = zend_dval_to_lval(Z_DVAL_P(offset));
|
||||
hval = zend_dval_to_ival(Z_DVAL_P(offset));
|
||||
zend_hash_index_del(ht, hval);
|
||||
break;
|
||||
case IS_RESOURCE:
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
hval = Z_LVAL_P(offset);
|
||||
case IS_INT:
|
||||
hval = Z_IVAL_P(offset);
|
||||
zend_hash_index_del(ht, hval);
|
||||
break;
|
||||
case IS_STRING:
|
||||
@@ -4179,13 +4179,13 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
if (OP2_TYPE == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_dim));
|
||||
hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_dim));
|
||||
hval = str_hash(Z_STRVAL_P(offset), Z_STRSIZE_P(offset));
|
||||
}
|
||||
if (ht == &EG(symbol_table)) {
|
||||
zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC);
|
||||
} else {
|
||||
zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval);
|
||||
zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval);
|
||||
}
|
||||
if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) {
|
||||
zval_ptr_dtor(&offset);
|
||||
@@ -4409,13 +4409,13 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
|
||||
zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC);
|
||||
while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
|
||||
char *str_key;
|
||||
uint str_key_len;
|
||||
ulong int_key;
|
||||
zend_size_t str_key_len;
|
||||
zend_uint_t int_key;
|
||||
zend_uchar key_type;
|
||||
|
||||
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
|
||||
if (key_type != HASH_KEY_NON_EXISTENT &&
|
||||
(key_type == HASH_KEY_IS_LONG ||
|
||||
(key_type == HASH_KEY_IS_INT ||
|
||||
zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS)) {
|
||||
break;
|
||||
}
|
||||
@@ -4466,8 +4466,8 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
||||
zend_object *zobj = zend_objects_get_address(array TSRMLS_CC);
|
||||
int key_type;
|
||||
char *str_key;
|
||||
zend_uint str_key_len;
|
||||
zend_ulong int_key;
|
||||
zend_size_t str_key_len;
|
||||
zend_uint_t int_key;
|
||||
|
||||
fe_ht = Z_OBJPROP_P(array);
|
||||
zend_hash_set_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
|
||||
@@ -4479,15 +4479,15 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
||||
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
|
||||
|
||||
zend_hash_move_forward(fe_ht);
|
||||
} while (key_type != HASH_KEY_IS_LONG &&
|
||||
} while (key_type != HASH_KEY_IS_INT &&
|
||||
zend_check_property_access(zobj, str_key, str_key_len - 1 TSRMLS_CC) != SUCCESS);
|
||||
|
||||
if (key) {
|
||||
if (key_type == HASH_KEY_IS_LONG) {
|
||||
ZVAL_LONG(key, int_key);
|
||||
if (key_type == HASH_KEY_IS_INT) {
|
||||
ZVAL_INT(key, int_key);
|
||||
} else {
|
||||
const char *class_name, *prop_name;
|
||||
int prop_name_len;
|
||||
zend_size_t prop_name_len;
|
||||
zend_unmangle_property_name_ex(
|
||||
str_key, str_key_len - 1, &class_name, &prop_name, &prop_name_len
|
||||
);
|
||||
@@ -4550,7 +4550,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
} else {
|
||||
ZVAL_LONG(key, iter->index);
|
||||
ZVAL_INT(key, iter->index);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -4611,7 +4611,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
|
||||
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
|
||||
ce = CACHED_PTR(opline->op2.literal->cache_slot);
|
||||
} else {
|
||||
ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
|
||||
ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
@@ -4621,7 +4621,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
|
||||
} else {
|
||||
ce = EX_T(opline->op2.var).class_entry;
|
||||
}
|
||||
value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
|
||||
value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
|
||||
if (!value) {
|
||||
isset = 0;
|
||||
}
|
||||
@@ -4663,7 +4663,7 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|
|
||||
zval *container;
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
zend_uint_t hval;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
@@ -4678,12 +4678,12 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
hval = zend_dval_to_lval(Z_DVAL_P(offset));
|
||||
hval = zend_dval_to_ival(Z_DVAL_P(offset));
|
||||
ZEND_VM_C_GOTO(num_index_prop);
|
||||
case IS_RESOURCE:
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
hval = Z_LVAL_P(offset);
|
||||
case IS_INT:
|
||||
hval = Z_IVAL_P(offset);
|
||||
ZEND_VM_C_LABEL(num_index_prop):
|
||||
if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
|
||||
isset = 1;
|
||||
@@ -4693,10 +4693,10 @@ ZEND_VM_C_LABEL(num_index_prop):
|
||||
if (OP2_TYPE == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop));
|
||||
hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop));
|
||||
hval = str_hash(Z_STRVAL_P(offset), Z_STRSIZE_P(offset));
|
||||
}
|
||||
if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
|
||||
if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) {
|
||||
isset = 1;
|
||||
}
|
||||
break;
|
||||
@@ -4751,26 +4751,26 @@ ZEND_VM_C_LABEL(num_index_prop):
|
||||
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
if (Z_TYPE_P(offset) != IS_INT) {
|
||||
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|
||||
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
|
||||
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
|
||||
&& IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) {
|
||||
ZVAL_COPY_VALUE(&tmp, offset);
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_long(&tmp);
|
||||
convert_to_int(&tmp);
|
||||
offset = &tmp;
|
||||
} else {
|
||||
/* can not be converted to proper offset, return "not set" */
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (Z_TYPE_P(offset) == IS_INT) {
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) {
|
||||
result = 1;
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
@@ -4782,9 +4782,9 @@ ZEND_VM_C_LABEL(num_index_prop):
|
||||
|
||||
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
Z_LVAL(EX_T(opline->result.var).tmp_var) = result;
|
||||
Z_IVAL(EX_T(opline->result.var).tmp_var) = result;
|
||||
} else {
|
||||
Z_LVAL(EX_T(opline->result.var).tmp_var) = !result;
|
||||
Z_IVAL(EX_T(opline->result.var).tmp_var) = !result;
|
||||
}
|
||||
|
||||
FREE_OP1_IF_VAR();
|
||||
@@ -4813,8 +4813,8 @@ ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV, ANY)
|
||||
zend_free_op free_op1;
|
||||
zval *ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
if (Z_TYPE_P(ptr) == IS_LONG) {
|
||||
EG(exit_status) = Z_LVAL_P(ptr);
|
||||
if (Z_TYPE_P(ptr) == IS_INT) {
|
||||
EG(exit_status) = Z_IVAL_P(ptr);
|
||||
} else {
|
||||
zend_print_variable(ptr);
|
||||
}
|
||||
@@ -4830,8 +4830,8 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY)
|
||||
USE_OPLINE
|
||||
|
||||
SAVE_OPLINE();
|
||||
Z_LVAL(EX_T(opline->result.var).tmp_var) = EG(error_reporting);
|
||||
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_LONG; /* shouldn't be necessary */
|
||||
Z_IVAL(EX_T(opline->result.var).tmp_var) = EG(error_reporting);
|
||||
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_INT; /* shouldn't be necessary */
|
||||
if (EX(old_error_reporting) == NULL) {
|
||||
EX(old_error_reporting) = &EX_T(opline->result.var).tmp_var;
|
||||
}
|
||||
@@ -4879,10 +4879,10 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
|
||||
zval restored_error_reporting;
|
||||
|
||||
SAVE_OPLINE();
|
||||
if (!EG(error_reporting) && Z_LVAL(EX_T(opline->op1.var).tmp_var) != 0) {
|
||||
Z_TYPE(restored_error_reporting) = IS_LONG;
|
||||
Z_LVAL(restored_error_reporting) = Z_LVAL(EX_T(opline->op1.var).tmp_var);
|
||||
EG(error_reporting) = Z_LVAL(restored_error_reporting);
|
||||
if (!EG(error_reporting) && Z_IVAL(EX_T(opline->op1.var).tmp_var) != 0) {
|
||||
Z_TYPE(restored_error_reporting) = IS_INT;
|
||||
Z_IVAL(restored_error_reporting) = Z_IVAL(EX_T(opline->op1.var).tmp_var);
|
||||
EG(error_reporting) = Z_IVAL(restored_error_reporting);
|
||||
convert_to_string(&restored_error_reporting);
|
||||
if (EXPECTED(EG(error_reporting_ini_entry) != NULL)) {
|
||||
if (EXPECTED(EG(error_reporting_ini_entry)->modified &&
|
||||
@@ -4890,7 +4890,7 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
|
||||
efree(EG(error_reporting_ini_entry)->value);
|
||||
}
|
||||
EG(error_reporting_ini_entry)->value = Z_STRVAL(restored_error_reporting);
|
||||
EG(error_reporting_ini_entry)->value_length = Z_STRLEN(restored_error_reporting);
|
||||
EG(error_reporting_ini_entry)->value_length = Z_STRSIZE(restored_error_reporting);
|
||||
} else {
|
||||
zendi_zval_dtor(restored_error_reporting);
|
||||
}
|
||||
@@ -5065,8 +5065,8 @@ ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, ANY, ANY)
|
||||
zend_class_entry **pce, **pce_orig;
|
||||
|
||||
SAVE_OPLINE();
|
||||
if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE ||
|
||||
(zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS &&
|
||||
if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE ||
|
||||
(zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS &&
|
||||
*pce != *pce_orig)) {
|
||||
do_bind_inherited_class(EX(op_array), opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC);
|
||||
}
|
||||
@@ -5140,7 +5140,7 @@ ZEND_VM_HANDLER(144, ZEND_ADD_INTERFACE, ANY, CONST)
|
||||
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
|
||||
iface = CACHED_PTR(opline->op2.literal->cache_slot);
|
||||
} else {
|
||||
iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
|
||||
iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
|
||||
if (UNEXPECTED(iface == NULL)) {
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
@@ -5168,7 +5168,7 @@ ZEND_VM_HANDLER(154, ZEND_ADD_TRAIT, ANY, ANY)
|
||||
trait = CACHED_PTR(opline->op2.literal->cache_slot);
|
||||
} else {
|
||||
trait = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv),
|
||||
Z_STRLEN_P(opline->op2.zv),
|
||||
Z_STRSIZE_P(opline->op2.zv),
|
||||
opline->op2.literal + 1,
|
||||
opline->extended_value TSRMLS_CC);
|
||||
if (UNEXPECTED(trait == NULL)) {
|
||||
@@ -5280,13 +5280,13 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
|
||||
}
|
||||
|
||||
/* restore previous error_reporting value */
|
||||
if (!EG(error_reporting) && EX(old_error_reporting) != NULL && Z_LVAL_P(EX(old_error_reporting)) != 0) {
|
||||
if (!EG(error_reporting) && EX(old_error_reporting) != NULL && Z_IVAL_P(EX(old_error_reporting)) != 0) {
|
||||
zval restored_error_reporting;
|
||||
|
||||
Z_TYPE(restored_error_reporting) = IS_LONG;
|
||||
Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting));
|
||||
Z_TYPE(restored_error_reporting) = IS_INT;
|
||||
Z_IVAL(restored_error_reporting) = Z_IVAL_P(EX(old_error_reporting));
|
||||
convert_to_string(&restored_error_reporting);
|
||||
zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC);
|
||||
zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRSIZE(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC);
|
||||
zendi_zval_dtor(restored_error_reporting);
|
||||
}
|
||||
EX(old_error_reporting) = NULL;
|
||||
@@ -5396,8 +5396,8 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
|
||||
}
|
||||
}
|
||||
c.flags = CONST_CS; /* non persistent, case sensetive */
|
||||
c.name = str_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name));
|
||||
c.name_len = Z_STRLEN_P(name)+1;
|
||||
c.name = str_strndup(Z_STRVAL_P(name), Z_STRSIZE_P(name));
|
||||
c.name_len = Z_STRSIZE_P(name)+1;
|
||||
c.module_number = PHP_USER_CONSTANT;
|
||||
|
||||
if (zend_register_constant(&c TSRMLS_CC) == FAILURE) {
|
||||
@@ -5417,7 +5417,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) ||
|
||||
if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) ||
|
||||
UNEXPECTED(op_array->type != ZEND_USER_FUNCTION)) {
|
||||
zend_error_noreturn(E_ERROR, "Base lambda function for closure not found");
|
||||
}
|
||||
@@ -5580,10 +5580,10 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
|
||||
generator->key = key;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(generator->key) == IS_LONG
|
||||
&& Z_LVAL_P(generator->key) > generator->largest_used_integer_key
|
||||
if (Z_TYPE_P(generator->key) == IS_INT
|
||||
&& Z_IVAL_P(generator->key) > generator->largest_used_integer_key
|
||||
) {
|
||||
generator->largest_used_integer_key = Z_LVAL_P(generator->key);
|
||||
generator->largest_used_integer_key = Z_IVAL_P(generator->key);
|
||||
}
|
||||
|
||||
FREE_OP2_IF_VAR();
|
||||
@@ -5592,7 +5592,7 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
|
||||
generator->largest_used_integer_key++;
|
||||
|
||||
ALLOC_INIT_ZVAL(generator->key);
|
||||
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
|
||||
ZVAL_INT(generator->key, generator->largest_used_integer_key);
|
||||
}
|
||||
|
||||
if (RETURN_VALUE_USED(opline)) {
|
||||
|
||||
+898
-898
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,352 @@
|
||||
This document describes the way to port the PECL extensions for <str_size_and_int64>.
|
||||
After undertaking the steps suggested, the same PECL extension source should be
|
||||
compatible with both older and <str_size_and_int64> codebase.
|
||||
|
||||
I. Basic changes in <str_size_and_int64>
|
||||
i. String length
|
||||
ii. Integer types
|
||||
iii. Other datatypes
|
||||
iv. Macros
|
||||
v. Functions
|
||||
II. Porting steps
|
||||
i. Automatic replacements
|
||||
ii. Compatibility header
|
||||
iii. zend_parse_parameters()
|
||||
iv. Manual code fixes
|
||||
v. Library dependencies
|
||||
vi. spprintf() formats
|
||||
vii. Array API
|
||||
viii. Explicit compilation enablement
|
||||
ix. Misccellaneous porting steps
|
||||
x. Follow the white rabbit
|
||||
III. Pitfalls
|
||||
i. size_t usage
|
||||
ii. zend_parse_parameters()
|
||||
iii. Pointer difference
|
||||
iv. RETURN_STRINGL, RETVAL_STRINGL
|
||||
v. Bitwise operations
|
||||
|
||||
|
||||
========================================
|
||||
I. Basic changes in <str_size_and_int64>
|
||||
========================================
|
||||
|
||||
For extended information, please look at the compat.h header and the wiki RFC page
|
||||
https://wiki.php.net/rfc/size_t_and_int64
|
||||
|
||||
i. String length
|
||||
|
||||
String lengths do no more depend on the firm 'int' datatype. The replacement
|
||||
is a platform dependent size_t datatype. The string length in zval is no more
|
||||
int but php_size_t.
|
||||
|
||||
String length is defined as zend_size_t inside Zend and aliased as php_size_t
|
||||
anywhere else. The inclusion of php.h is necessary.
|
||||
|
||||
ii. Integer types
|
||||
|
||||
Integers do no more depend on the firm 'long' type. Instead a platform
|
||||
dependent integer type is used. That datatype is defined dynamically to
|
||||
guarantee the consistent 64 bit support. The zval field representing user
|
||||
land integer it bound to php_int_t.
|
||||
|
||||
Signed integer is defined as zend_int_t, unsigned integer as zend_uint_t
|
||||
inside Zend. Both are aliased as php_int_t and php_uint_t anywhere else,
|
||||
respectively. The inclusion of php.h is necessary.
|
||||
|
||||
iii. Other datatypes
|
||||
zend_off_t - portable off_t analogue
|
||||
zend_stat_t - portable 'struct stat' analogue
|
||||
|
||||
These datatypes are declared to be portable across platforms. Thus, direct
|
||||
usage of the functions like fseek, stat, etc. as well as direct usage of
|
||||
off_t and struct stat is strongly not recommended. Instead the portable
|
||||
macros should be used.
|
||||
|
||||
zend_fseek - portable fseek equivalent
|
||||
zend_ftell - portable ftell equivalent
|
||||
zend_lseek - portable lseek equivalent
|
||||
zend_fstat - portable fstat equivalent
|
||||
zend_stat - portable stat equivalent
|
||||
|
||||
iv. Macros
|
||||
Z_STRSIZE - replacement for Z_STRLEN family
|
||||
Z_IVAL - replacement for Z_LVAL family
|
||||
Z_I - initialize signed integer constant
|
||||
Z_UI - initialize unsigned integer constant
|
||||
ZEND_INT_MAX, ZEND_INT_MIN, ZEND_UINT_MAX, ZEND_SIZE_MAX
|
||||
IS_INT - replacement for IS_LONG
|
||||
ZVAL_INT - replacement for ZVAL_LONG
|
||||
RETVAL_INT - RETVAL_LONG
|
||||
RETURN_INT - RETURN_LONG
|
||||
ZEND_STRTOI - portable strtol version
|
||||
ZEND_STRTOUI - portable strtoul version
|
||||
ZEND_ITOA - portable itoa version
|
||||
ZEND_ATOI - portable atol version
|
||||
ZEND_ABS - portable abs version
|
||||
|
||||
This macros are safe to use with php_int_t
|
||||
|
||||
SIZEOF_ZEND_INT should be used Instead of SIZEOF_LONG with php_int_t
|
||||
while checking the size.
|
||||
|
||||
v. Functions
|
||||
|
||||
Various functions became syntactic renames, it concerns functions containing
|
||||
the 'long' keyword. The new portable aliases also was added.
|
||||
|
||||
convert_to_int, add_assoc_int, zend_ini_int, etc.
|
||||
|
||||
=================
|
||||
II. Porting steps
|
||||
=================
|
||||
|
||||
i. Automatic replacements
|
||||
|
||||
The tool replace.php will automatically replace a number of syntactic changes
|
||||
in the old style extension. Note, that only simple cases are processed, for
|
||||
complicated cases the manual intrusion is unavoidable. Still, this tool will
|
||||
save a lot of time while porting.
|
||||
|
||||
To mention are also the following options
|
||||
--macros replace old vs. new macro/function names
|
||||
--zpp replace "lLsp" with "iISP" at appropriate places only
|
||||
--zpp-compat replace things like
|
||||
"slO" with ZPP_FMT_COMPAT("slO", "SiO")
|
||||
--zpp-vars replace datatypes for vars passed to zpp calls. Dont expect this
|
||||
this option to be the swiss knife! Verify after it!
|
||||
|
||||
The macro and zpp options are separated and don't have to be used together.
|
||||
|
||||
The PHP_NEED_STRSIZE_COMPAT is defined in the compat.h for versions lower than
|
||||
<str_size_and_int64>.
|
||||
|
||||
You can also use --reverse if you want to have all the changes back to old. One
|
||||
exception though is when --zpp-compat or --zpp-vars is used - this case isn't
|
||||
yet implemented. For instance, if some used a custom macros name instead of
|
||||
ZPP_FMT_COMPAT or some other custom #ifdef, it will be hard to catch.
|
||||
|
||||
The replacements with --zpp-vars might go totally insane depending on code
|
||||
formatting, so revert might be too complex. However one var daclaration per
|
||||
line should be very good replaceable. Also, --zpp-vars will give you some
|
||||
warnings where it couldn't replace the corresponding var type, despite it could
|
||||
be parsed, you should go through those.
|
||||
|
||||
ii. Compatibility header
|
||||
|
||||
The compat.h header, once copied into the extension source and included, will
|
||||
compensate many of the syntactic differences. The right place for the
|
||||
inclusion might depend on the concrete extension code, while in general it
|
||||
might make sense to include it after all the other headers.
|
||||
|
||||
The header itself might of course need some customization for concrete code. The
|
||||
basic version provides macros PHP_NEED_STRSIZE_COMPAT, which will evaluate to
|
||||
true when compiling with versions lover than <str_size_and_int64>.
|
||||
|
||||
iii. zend_parse_parameters()
|
||||
|
||||
The arg specs 'l', 'L', 's' and 'p' are not available anymore. As their
|
||||
replacements 'i', 'I', 'S' and 'P' was invented. The integer specs expect a
|
||||
variable of type php_int_t to be passed. The string/path lengths are expected
|
||||
to be of type php_size_t.
|
||||
|
||||
A possible way to declare the argument specs were using the ternary operator,
|
||||
eq.
|
||||
|
||||
#define COMP (PHP_MAJOR_VERSION < 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 6)
|
||||
|
||||
php_int_t i0, i1;
|
||||
char *s0, p0;
|
||||
php_size_t s0_len, p0_len;
|
||||
|
||||
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, (COMP ? "lLsp" : "iISP"), &i0, &i1, &s0, &s0_len, &p0, &p0_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
Another way implemented when using the standard compat.h and replace.php --zpp-compat
|
||||
will automatically replace the old specs with the macros like
|
||||
|
||||
ZPP_FMT_COMPAT("lSsp", "iISP")
|
||||
|
||||
|
||||
iv. Manual code fixes
|
||||
|
||||
While for many extensions the mechanic replacements will do the big job to
|
||||
retain the compatibility, the manual code fixes might be necessary. Here are
|
||||
especially to mention array API, filesystem API, unsigned string lengths. Also
|
||||
this is likely the case for extensions with library dependencies, see also the
|
||||
pitfalls section.
|
||||
|
||||
After adjusting the variable types in zpp, the first places you automatically should
|
||||
look for are the functions where you pass the parameters. Especially those accepting
|
||||
integers by reference might be broken. If those functions are your own implementations,
|
||||
it might make sense you to adapt the function signatures. In case of some library
|
||||
functions an intermediate variable of an appropriate type can be used.
|
||||
|
||||
v. Library dependencies
|
||||
|
||||
Libraries using incompatible data types for string sizes and integers require
|
||||
additional checks to ensure the correct value range. This is easy done as in the
|
||||
example below (assumed the function argument is of type php_int_t and the
|
||||
dependency library expects a value in integer range)
|
||||
|
||||
if (INT_MAX < input_arg || INT_MIN > input_arg) {
|
||||
return;
|
||||
}
|
||||
|
||||
vi. spprintf() formats
|
||||
|
||||
New printf modifier 'p' was implemented to platform independently output php_int_t,
|
||||
php_uint_t and php_size_t datatypes. That modifier can be used with'd', 'u', 'x' and 'o'
|
||||
printf format specs with spprintf, snprintf and the wrapping printf implementations.
|
||||
%pu is sufficient for both php_uint_t and php_size_t.
|
||||
|
||||
To ensure compatibility, the macros ZEND_INT_FMT and ZEND_UINT_FMT should be
|
||||
used
|
||||
|
||||
php_int_t i0, i1;
|
||||
char *s0, p0;
|
||||
php_size_t s0_len, p0_len;
|
||||
|
||||
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, (COMPAT ? "lLsp" : "iISP"), &i0, &i1, &s0, &s0_len, &p0, &p0_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (INT_MAX < i0 || INT_MIN > i0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Value '" ZEND_INT_FMT "' is out of range", i0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Please note, that replace.php will not do automatic replacements for the %ld
|
||||
and other specs. It's up to the porter where such replacement were appropriate.
|
||||
To ease the process, some automatic still could be used, like here how it could
|
||||
be done in vim
|
||||
|
||||
:%s,%ld," ZEND_INT_FMT ",g
|
||||
|
||||
With this in mind, the code using %p spec to output pointer address might
|
||||
need to be enclosed into #ifdef when it unlickily followed by 'd', 'u', 'x' or 'o'.
|
||||
|
||||
vii. Array API
|
||||
|
||||
Datatype for array indexes was changed to php_uint_t, for key lengths to php_size_t.
|
||||
As many places in the array API expect such kind of variables to be passed as
|
||||
pointers, it's important them to be of the correct datatype.
|
||||
|
||||
viii. Explicit compilation enablement
|
||||
|
||||
This is not implemented yet, the build system has to be tweaked for this to happen.
|
||||
The idea is, that an extension has to define some macros like PHP_64BIT_COMP to
|
||||
be allowed to compile.
|
||||
|
||||
ix. Misccellaneous porting steps
|
||||
|
||||
In general, any code dealing with string or object size should use php_size_t, any
|
||||
code dealing with integer available in the userspace should use php_int_t. The
|
||||
other relevant units are
|
||||
|
||||
- socket APIs
|
||||
- INI settings
|
||||
- global constants, class constants and properties
|
||||
- resources
|
||||
- Zend list and llist API
|
||||
- local extension specific helper functions
|
||||
- local extension specific datatypes
|
||||
|
||||
x. Follow the white rabbit
|
||||
|
||||
While this document and the porting tools are being developed to the best of one's
|
||||
knowledge and belief, it's indispensable to follow the warnings of your compiler.
|
||||
While porting, debug mode should be always enabled and care should be taken
|
||||
specifically about the warnings like
|
||||
|
||||
- signed/unsigned mismatch
|
||||
- incompatible pointer types
|
||||
- precision loss, like
|
||||
- assignment to variables of smaller type (say like int64_t to int)
|
||||
- passing of function args of bigger type (same as above)
|
||||
- erroneous printf formats
|
||||
|
||||
Having any kind of improvement ideas, please don't hesitate sharing them!
|
||||
|
||||
=============
|
||||
III. Pitfalls
|
||||
=============
|
||||
|
||||
i. size_t usage
|
||||
|
||||
php_size_t is mapped to the platform dependent size_t datatype, which is unsigned.
|
||||
The following code will not work as maybe expected, when max_len is negative
|
||||
|
||||
char *s0;
|
||||
php_size_t s0_len;
|
||||
php_int_t max_len;
|
||||
|
||||
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, (COMPAT ? "sl" : "iS"), &s0, &s0_len, &max_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (s0_len > max_len) {
|
||||
return;
|
||||
}
|
||||
|
||||
The reason is, that for the comparsion max_len will be converted to an unsigned value
|
||||
which most likely will be PHP_SIZE_MAX. The correct check could look like
|
||||
|
||||
if (max_len >= 0 && s0_len > max_len) {
|
||||
return;
|
||||
}
|
||||
|
||||
Please note, that php_size_t is used not only for string length with zpp, but also
|
||||
widely for array keys and at many other places. Please check the corresponding APIs
|
||||
to ensure the datatype needed. Predominantly string size uses php_size_t now.
|
||||
|
||||
ii. zend_parse_parameters()
|
||||
|
||||
The new integer and string format specs are strictly bound to the php_int_t and
|
||||
php_size_t datatypes. Those datatypes have variable sizes on different
|
||||
platforms. Especially usage of the old 'long' and 'int' datatypes can lead to
|
||||
memory errors and crashes on 64 bit platforms.
|
||||
|
||||
iii. Pointer difference
|
||||
|
||||
When working with pointer arithmetic, the ptrdiff_t type should be used to tell the
|
||||
difference between two pointers.
|
||||
|
||||
char *s0 = "hello"
|
||||
char *s1 = s0;
|
||||
ptrdiff_t d;
|
||||
|
||||
s1++;
|
||||
|
||||
d = s1 - s0; /* Correct datatype to hold the result */
|
||||
|
||||
Should the example happen to scale, like for instance working the bigger strings,
|
||||
using a wrong datatype will lead to an overflow. Though be aware that ptrdiff_t is
|
||||
signed, so can be negative.
|
||||
|
||||
iv. RETURN_STRINGL, RETVAL_STRINGL
|
||||
|
||||
RETURN_STRINGL, RETVAL_STRINGL macros now expect php_size_t for the string length.
|
||||
While it's theoretically possible to use any other datatype with those macros, the
|
||||
explicit attention should be paid that the values arn't negative.
|
||||
|
||||
v. Bitwise operations
|
||||
|
||||
Especialy some bitshift operations might bring unexpected results when mixing 32 and
|
||||
64 bit variables or constants. Here's the example snippet
|
||||
|
||||
php_int_t var = 1 << 31;
|
||||
|
||||
While a 32 bit variable can hold bits from 0 to 31, a 64 bit variable can hold bits
|
||||
from 0 to 63. So with the snippet above the result the max negative value of 32 bit
|
||||
integer. To have it working correct way on 64 bit, an explicit cast
|
||||
|
||||
php_int_t var = (php_int_t)1 << 31;
|
||||
|
||||
or the special macros in case of a constant
|
||||
|
||||
php_int_t var = Z_I(1) << 31;
|
||||
|
||||
can be used.
|
||||
|
||||
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Anatol Belski <ab@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef PHP_SIZE_INT_COMPAT_H
|
||||
#define PHP_SIZE_INT_COMPAT_H
|
||||
|
||||
/* XXX change the check accordingly to the vote results */
|
||||
#define PHP_NEED_STRSIZE_COMPAT (PHP_MAJOR_VERSION < 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 6) || defined(PHP_FORCE_STRSIZE_COMPAT)
|
||||
|
||||
#if PHP_NEED_STRSIZE_COMPAT
|
||||
|
||||
typedef long zend_int_t;
|
||||
typedef unsigned long zend_uint_t;
|
||||
typedef long zend_off_t;
|
||||
typedef int zend_size_t;
|
||||
typedef struct stat zend_stat_t;
|
||||
# define ZEND_INT_MAX LONG_MAX
|
||||
# define ZEND_INT_MIN LONG_MIN
|
||||
# define ZEND_UINT_MAX ULONG_MAX
|
||||
# define ZEND_SIZE_MAX SIZE_MAX
|
||||
# define Z_I(i) i
|
||||
# define Z_UI(i) i
|
||||
# define SIZEOF_ZEND_INT SIZEOF_LONG
|
||||
# define ZEND_STRTOI(s0, s1, base) strtol((s0), (s1), (base))
|
||||
# define ZEND_STRTOUI(s0, s1, base) strtoul((s0), (s1), (base))
|
||||
# ifdef PHP_WIN32
|
||||
# define ZEND_ITOA(i, s, len) _ltoa_s((i), (s), (len), 10)
|
||||
# define ZEND_ATOI(i, s) i = atol((s))
|
||||
# else
|
||||
# define ZEND_ITOA(i, s, len) \
|
||||
do { \
|
||||
int st = snprintf((s), (len), "%ld", (i)); \
|
||||
(s)[st] = '\0'; \
|
||||
} while (0)
|
||||
# define ZEND_ATOI(i, s) (i) = atol((s))
|
||||
# endif
|
||||
# define ZEND_INT_FMT "%ld"
|
||||
# define ZEND_UINT_FMT "%lu"
|
||||
# define ZEND_INT_FMT_SPEC "ld"
|
||||
# define ZEND_UINT_FMT_SPEC "lu"
|
||||
# define ZEND_STRTOI_PTR strtol
|
||||
# define ZEND_STRTOUI_PTR strtoul
|
||||
# define ZEND_ABS abs
|
||||
# define zend_fseek fseek
|
||||
# define zend_ftell ftell
|
||||
# define zend_lseek lseek
|
||||
# define zend_fstat fstat
|
||||
# define zend_stat stat
|
||||
# define php_fstat fstat
|
||||
# define php_stat_fn stat
|
||||
|
||||
#define php_size_t zend_size_t
|
||||
#define php_int_t zend_int_t
|
||||
#define php_uint_t zend_uint_t
|
||||
#define php_stat_t zend_stat_t
|
||||
#define PHP_INT_MAX ZEND_INT_MAX
|
||||
#define PHP_INT_MIN ZEND_INT_MIN
|
||||
#define PHP_UINT_MAX ZEND_UINT_MAX
|
||||
#define PHP_SIZE_MAX ZEND_SIZE_MAX
|
||||
|
||||
# define MAX_LENGTH_OF_ZEND_INT MAX_LENGTH_OF_LONG
|
||||
# define Z_STRSIZE Z_STRLEN
|
||||
# define Z_STRSIZE_P Z_STRLEN_P
|
||||
# define Z_STRSIZE_PP Z_STRLEN_PP
|
||||
# define Z_IVAL Z_LVAL
|
||||
# define Z_IVAL_P Z_LVAL_P
|
||||
# define Z_IVAL_PP Z_LVAL_PP
|
||||
# define IS_INT IS_LONG
|
||||
# define ZVAL_INT ZVAL_LONG
|
||||
# define RETVAL_INT RETVAL_LONG
|
||||
# define RETURN_INT RETURN_LONG
|
||||
# define LITERAL_INT LITERAL_LONG
|
||||
# define REGISTER_INT_CONSTANT REGISTER_LONG_CONSTANT
|
||||
# define REGISTER_NS_INT_CONSTANT REGISTER_NS_LONG_CONSTANT
|
||||
# define REGISTER_MAIN_INT_CONSTANT REGISTER_MAIN_LONG_CONSTANT
|
||||
# define HASH_KEY_IS_INT HASH_KEY_IS_LONG
|
||||
# define convert_to_int convert_to_long
|
||||
# define convert_to_int_ex convert_to_long_ex
|
||||
# define add_assoc_int add_assoc_long
|
||||
# define add_property_int add_property_long
|
||||
# define zendi_convert_to_int zendi_convert_to_long
|
||||
# define zend_ini_int zend_ini_long
|
||||
# define ZEND_SIGNED_MULTIPLY_INT ZEND_SIGNED_MULTIPLY_LONG
|
||||
# define zend_update_property_int zend_update_property_long
|
||||
# define SET_VAR_INT SET_VAR_LONG
|
||||
# define zend_declare_class_constant_int zend_declare_class_constant_long
|
||||
# define add_get_index_int add_get_index_long
|
||||
# define add_next_index_int add_next_index_long
|
||||
# define zend_update_static_property_int zend_update_static_property_long
|
||||
# define zend_register_int_constant zend_register_long_constant
|
||||
# define add_index_int add_index_long
|
||||
# define zend_declare_property_int zend_declare_property_long
|
||||
# define ZEND_MM_INT_CONST ZEND_MM_LONG_CONST
|
||||
# define REGISTER_PDO_CLASS_CONST_INT REGISTER_PDO_CLASS_CONST_LONG
|
||||
# define PDO_INT_PARAM_CHECK PDO_LONG_PARAM_CHECK
|
||||
# define REGISTER_XMLREADER_CLASS_CONST_INT REGISTER_XMLREADER_CLASS_CONST_LONG
|
||||
# define CALENDAR_DECL_INT_CONST CALENDAR_DECL_LONG_CONST
|
||||
# define TIMEZONE_DECL_INT_CONST TIMEZONE_DECL_LONG_CONST
|
||||
# define BREAKITER_DECL_INT_CONST BREAKITER_DECL_LONG_CONST
|
||||
# define REGISTER_SPL_CLASS_CONST_INT REGISTER_SPL_CLASS_CONST_LONG
|
||||
# define REGISTER_REFLECTION_CLASS_CONST_INT REGISTER_REFLECTION_CLASS_CONST_LONG
|
||||
# define REGISTER_PHAR_CLASS_CONST_INT REGISTER_PHAR_CLASS_CONST_LONG
|
||||
# define MAKE_INT_ZVAL_INCREF MAKE_LONG_ZVAL_INCREF
|
||||
# define MYSQLI_RETURN_INT_INT MYSQLI_RETURN_INT_LONG
|
||||
# define MYSQLI_MAP_PROPERTY_FUNC_INT MYSQLI_MAP_PROPERTY_FUNC_LONG
|
||||
# define REGISTER_ZIP_CLASS_CONST_INT REGISTER_ZIP_CLASS_CONST_LONG
|
||||
# define REGISTER_SNMP_CLASS_CONST_INT REGISTER_SNMP_CLASS_CONST_LONG
|
||||
# define PHP_SNMP_INT_PROPERTY_READER_FUNCTION PHP_SNMP_LONG_PROPERTY_READER_FUNCTION
|
||||
# define ISC_INT_MIN ISC_LONG_MIN
|
||||
# define ISC_INT_MAX ISC_LONG_MAX
|
||||
# define int_min_digits long_min_digits
|
||||
# define zend_dval_to_ival zend_dval_to_lval
|
||||
# define ZEND_DVAL_TO_IVAL_CAST_OK ZEND_DVAL_TO_LVAL_CAST_OK
|
||||
# define smart_str_append_int smart_str_append_long
|
||||
# define cfg_get_int cfg_get_long
|
||||
# define pdo_attr_ival pdo_attr_lval
|
||||
|
||||
# define ZPP_FMT_COMPAT(old_fmt, new_fmt) old_fmt
|
||||
|
||||
#else
|
||||
|
||||
# define ZPP_FMT_COMPAT(old_fmt, new_fmt) new_fmt
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* PHP_SIZE_INT_COMPAT_H */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
*/
|
||||
@@ -0,0 +1,333 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Tool for syntactic replacements for <str_size_and_int64>
|
||||
Autor: ab@php.net
|
||||
*/
|
||||
|
||||
/* Options stuff*/
|
||||
$shortopts = NULL;
|
||||
$longopts = array('type:', 'custom:', 'help::', 'reverse', 'zpp', 'zpp-compat', 'macros', 'zpp-vars');
|
||||
|
||||
$options = getopt($shortopts, $longopts);
|
||||
|
||||
$repl_type = isset($options['type']) ? $options['type'] : 'ext';
|
||||
$custom_defs_fname = isset($options['custom']) ? $options['custom'] : NULL;
|
||||
$fname = (count($argv) < 2) ? NULL : $argv[count($argv)-1];
|
||||
$reverse_replace = isset($options['reverse']);
|
||||
$replace_zpp = isset($options['zpp']);
|
||||
$replace_zpp_compat = isset($options['zpp-compat']);
|
||||
$replace_macros = isset($options['macros']);
|
||||
$replace_zpp_vars = isset($options['zpp-vars']);
|
||||
|
||||
/* Options validation */
|
||||
if (isset($options['help'])) {
|
||||
print_usage(0);
|
||||
} else if (!in_array($repl_type, array('ext', 'zend_ext'))) {
|
||||
print_error("Invalid replacement type '$repl_type'");
|
||||
} else if (!$replace_macros && !($replace_zpp || $replace_zpp_compat) && ! $replace_zpp_vars) {
|
||||
echo "No replacement options specified, nothing to do." . PHP_EOL . PHP_EOL;
|
||||
print_usage(3);
|
||||
} else if ($replace_zpp && $replace_zpp_compat) {
|
||||
print_error("--zpp and --zpp-compat cannot be used at the same time");
|
||||
} else if (!$fname || !file_exists($fname)) {
|
||||
print_error("Invalid filename '$fname'");
|
||||
/*} else if (!is_null($custom_defs_fname) && !file_exists($custom_defs_fname)) {
|
||||
print_error("Invalid custom replacement definitions file");*/
|
||||
} else if (!is_null($custom_defs_fname)) {
|
||||
/* XXX uncomment the above when it's implemented */
|
||||
print_error("Processing of custom replacement definitions is not implemented yet, feel free to supply a patch");
|
||||
}
|
||||
|
||||
|
||||
/* Process file */
|
||||
$file_contents = file_get_contents($fname);
|
||||
|
||||
/* replace zpp variable types */
|
||||
/* XXX handle more complicated cases */
|
||||
if ($replace_zpp_vars && !$reverse_replace) {
|
||||
$ptr = array(
|
||||
"/zend_parse_parameters\(.*\s+TSRMLS_CC,\s*\"([a-zA-Z\*+\|\/!]+)\"\s*,\s*(.*)\)/msxU",
|
||||
"/zend_parse_parameters_ex\(.*,\s*.*\s+TSRMLS_CC,\s*\"([a-zA-Z\*+\|\/!]+)\"\s*,\s*(.*)\)/msxU",
|
||||
"/zend_parse_method_parameters\(.*\s+TSRMLS_CC,\s*.*,\s*\"([a-zA-Z\*+\|\/!]+)\"\s*,\s*(.*)\)/msxU",
|
||||
"/zend_parse_method_parameters_ex\(.*,\s*.*\s+TSRMLS_CC,\s*.*,\s*\"([a-zA-Z\*+\|\/!]+)\"\s*,\s*(.*)\)/msxU",
|
||||
);
|
||||
|
||||
$vars = array();
|
||||
|
||||
foreach ($ptr as $p) {
|
||||
/* XXX Warn about the cases we could find even if we don't replace them */
|
||||
if (0 < preg_match_all($p, $file_contents, $m)) {
|
||||
/* get specs and var names in one array */
|
||||
for ($i = 0; $i < count($m[0]); $i++) {
|
||||
$vars[$m[1][$i]] = array();
|
||||
|
||||
$tmp = explode(',', str_replace(' ', '', $m[2][$i]));
|
||||
if (!is_array($tmp)) {
|
||||
echo "WARNING: parse error, zpp spec exist but var names couldn't be parsed" . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($tmp as $it) {
|
||||
while ($it && !preg_match(',^[a-z0-9_]+$,i', $it)) {
|
||||
$it = substr($it, 1);
|
||||
}
|
||||
$vars[$m[1][$i]][] = $it;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* compute var ingexes */
|
||||
$var_idx = array();
|
||||
/* XXX this loop might need to be fixed at some places! */
|
||||
foreach ($vars as $spec => $var) {
|
||||
$var_idx[$spec] = array();
|
||||
$var_idx[$spec]['php_int_t'] = array();
|
||||
$var_idx[$spec]['php_size_t'] = array();
|
||||
for ($i = 0, $pos = 0; $i < strlen($spec); $i++, $pos++) {
|
||||
switch($spec[$i]) {
|
||||
case 'l':
|
||||
case 'L':
|
||||
$var_idx[$spec]['php_int_t'][] = $pos;
|
||||
break;
|
||||
case 's':
|
||||
case 'p':
|
||||
$pos++;
|
||||
$var_idx[$spec]['php_size_t'][] = $pos;
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
case 'A':
|
||||
case 'b':
|
||||
case 'C':
|
||||
case 'd':
|
||||
case 'h':
|
||||
case 'H':
|
||||
case 'o':
|
||||
case 'r':
|
||||
case 'Z':
|
||||
case 'z':
|
||||
case '*':
|
||||
case '+':
|
||||
break;
|
||||
case '|':
|
||||
case '/':
|
||||
case '!':
|
||||
$pos--;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
case 'O':
|
||||
$pos++;
|
||||
break;
|
||||
|
||||
default:
|
||||
echo "WARNING: unknown zpp spec '" . $spec[$i] . "'" . PHP_EOL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty($var_idx)) {
|
||||
unset($var_idx);
|
||||
}
|
||||
}
|
||||
|
||||
/* got indexes and got vars, 1st simple case to match */
|
||||
$search_replace = array();
|
||||
foreach ($var_idx as $spec => $data) {
|
||||
/* handle direct matches with single variable declaration */
|
||||
foreach ($data['php_int_t'] as $idx) {
|
||||
$var = $vars[$spec][$idx];
|
||||
$cnt = preg_match(",(long\s+$var.*;),msxU", $file_contents, $m);
|
||||
if (1 == $cnt) {
|
||||
/* XXX probably better to use preg_replace instead of str_replace here */
|
||||
$search_replace[$m[1]] = str_replace('long', 'php_int_t', $m[1]);
|
||||
} else {
|
||||
echo "WARNING: variable $var needs to be php_int_t but couldn't be automatically replaced" . PHP_EOL;
|
||||
}
|
||||
}
|
||||
foreach ($data['php_size_t'] as $idx) {
|
||||
$var = $vars[$spec][$idx];
|
||||
$cnt = preg_match(",(int\s+$var.*;),msxU", $file_contents, $m);
|
||||
if (1 == $cnt) {
|
||||
/* XXX probably better to use preg_replace instead of str_replace here */
|
||||
$search_replace[$m[1]] = str_replace('int', 'php_size_t', $m[1]);;
|
||||
} else {
|
||||
echo "WARNING: variable $var needs to be php_size_t but couldn't be automatically replaced" . PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
$file_contents = str_replace(array_keys($search_replace), array_values($search_replace), $file_contents);
|
||||
|
||||
/* XXX more cases here to go, var_dump($vars, var_idx); to see what data does already exist at this point */
|
||||
|
||||
} else if ($reverse_replace) {
|
||||
echo "WARNING: reverse replace for zpp vars isn't implemented, feel free to supply patch" . PHP_EOL;
|
||||
}
|
||||
|
||||
|
||||
/* simple macro replacements */
|
||||
if ($replace_macros) {
|
||||
$replacements = array(
|
||||
/*'ZEND_SIZE_MAX_LONG' => 'ZEND_SIZE_MAX',
|
||||
'ZEND_SIZE_MAX_INT' => 'ZEND_SIZE_MAX',*/
|
||||
'MAX_LENGTH_OF_LONG' => 'MAX_LENGTH_OF_ZEND_INT',
|
||||
'Z_STRLEN' => 'Z_STRSIZE',
|
||||
'Z_LVAL' => 'Z_IVAL',
|
||||
'IS_LONG' => 'IS_INT',
|
||||
'ZVAL_LONG' => 'ZVAL_INT',
|
||||
'RETVAL_LONG' => 'RETVAL_INT',
|
||||
'RETURN_LONG' => 'RETURN_INT',
|
||||
'LITERAL_LONG' => 'LITERAL_INT',
|
||||
'REGISTER_LONG_CONSTANT' => 'REGISTER_INT_CONSTANT',
|
||||
'REGISTER_NS_LONG_CONSTANT' => 'REGISTER_NS_INT_CONSTANT',
|
||||
'REGISTER_MAIN_LONG_CONSTANT' => 'REGISTER_MAIN_INT_CONSTANT',
|
||||
'HASH_KEY_IS_LONG' => 'HASH_KEY_IS_INT',
|
||||
'convert_to_long' => 'convert_to_int',
|
||||
'add_assoc_long' => 'add_assoc_int',
|
||||
'add_property_long' => 'add_property_int',
|
||||
'zendi_convert_to_long' => 'zendi_convert_to_int',
|
||||
'zend_ini_long' => 'zend_ini_int',
|
||||
'ZEND_SIGNED_MULTIPLY_LONG' => 'ZEND_SIGNED_MULTIPLY_INT',
|
||||
'zend_update_property_long' => 'zend_update_property_int',
|
||||
'SET_VAR_LONG' => 'SET_VAR_INT',
|
||||
'zend_declare_class_constant_long' => 'zend_declare_class_constant_int',
|
||||
'add_get_index_long' => 'add_get_index_int',
|
||||
'add_next_index_long' => 'add_next_index_int',
|
||||
'zend_declare_class_constant_long' => 'zend_declare_class_constant_int',
|
||||
'zend_update_static_property_long' => 'zend_update_static_property_int',
|
||||
'zend_register_long_constant' => 'zend_register_int_constant',
|
||||
'add_index_long' => 'add_index_int',
|
||||
'zend_declare_property_long' => 'zend_declare_property_int',
|
||||
'ZEND_MM_LONG_CONST' => 'ZEND_MM_INT_CONST',
|
||||
'REGISTER_PDO_CLASS_CONST_LONG' => 'REGISTER_PDO_CLASS_CONST_INT',
|
||||
'PDO_LONG_PARAM_CHECK' => 'PDO_INT_PARAM_CHECK',
|
||||
'REGISTER_XMLREADER_CLASS_CONST_LONG' => 'REGISTER_XMLREADER_CLASS_CONST_INT',
|
||||
'CALENDAR_DECL_LONG_CONST' => 'CALENDAR_DECL_INT_CONST',
|
||||
'TIMEZONE_DECL_LONG_CONST' => 'TIMEZONE_DECL_INT_CONST',
|
||||
'BREAKITER_DECL_LONG_CONST' => 'BREAKITER_DECL_INT_CONST',
|
||||
'REGISTER_SPL_CLASS_CONST_LONG' => 'REGISTER_SPL_CLASS_CONST_INT',
|
||||
'REGISTER_REFLECTION_CLASS_CONST_LONG' => 'REGISTER_REFLECTION_CLASS_CONST_INT',
|
||||
'REGISTER_PHAR_CLASS_CONST_LONG' => 'REGISTER_PHAR_CLASS_CONST_INT',
|
||||
'MAKE_LONG_ZVAL_INCREF' => 'MAKE_INT_ZVAL_INCREF',
|
||||
'MYSQLI_RETURN_INT_LONG' => 'MYSQLI_RETURN_INT_INT',
|
||||
'MYSQLI_MAP_PROPERTY_FUNC_LONG' => 'MYSQLI_MAP_PROPERTY_FUNC_INT',
|
||||
'REGISTER_ZIP_CLASS_CONST_LONG' => 'REGISTER_ZIP_CLASS_CONST_INT',
|
||||
'REGISTER_SNMP_CLASS_CONST_LONG' => 'REGISTER_SNMP_CLASS_CONST_INT',
|
||||
'PHP_SNMP_LONG_PROPERTY_READER_FUNCTION' => 'PHP_SNMP_INT_PROPERTY_READER_FUNCTION',
|
||||
'ISC_LONG_MIN' => 'ISC_INT_MIN',
|
||||
'ISC_LONG_MAX' => 'ISC_INT_MAX',
|
||||
'long_min_digits' => 'int_min_digits',
|
||||
'zend_dval_to_lval' => 'zend_dval_to_ival',
|
||||
'ZEND_DVAL_TO_LVAL_CAST_OK' => 'ZEND_DVAL_TO_IVAL_CAST_OK',
|
||||
'smart_str_append_long' => 'smart_str_append_int',
|
||||
'cfg_get_long' => 'cfg_get_int',
|
||||
'pdo_attr_lval' => 'pdo_attr_ival',
|
||||
);
|
||||
|
||||
if ($reverse_replace) {
|
||||
/* cleanup also mess when convering back and forth */
|
||||
$replacements['INTERNAL'] = 'LONGERNAL';
|
||||
$replacements['INTERACTIVE'] = 'LONGERACTIVE';
|
||||
$replacements['INTEGER'] = 'LONGEGER';
|
||||
$file_contents = str_replace(array_values($replacements), array_keys($replacements), $file_contents);
|
||||
} else {
|
||||
$file_contents = str_replace(array_keys($replacements), array_values($replacements), $file_contents);
|
||||
}
|
||||
}
|
||||
|
||||
/* zpp spec replacements */
|
||||
if ($replace_zpp || $replace_zpp_compat) {
|
||||
$zpp_map = array(
|
||||
'l' => 'i',
|
||||
'L' => 'I',
|
||||
'p' => 'P',
|
||||
's' => 'S',
|
||||
);
|
||||
|
||||
$ptr = array(
|
||||
"/zend_parse_parameters\(.*\s+TSRMLS_CC,\s*\"([a-zA-Z\*+\|\/!]+)\"/msxU",
|
||||
"/zend_parse_parameters_ex\(.*,\s*.*\s+TSRMLS_CC,\s*\"([a-zA-Z\*+\|\/!]+)\"/msxU",
|
||||
"/zend_parse_method_parameters\(.*\s+TSRMLS_CC,\s*.*,\s*\"([a-zA-Z\*+\|\/!]+)\"/msxU",
|
||||
"/zend_parse_method_parameters_ex\(.*,\s*.*\s+TSRMLS_CC,\s*.*,\s*\"([a-zA-Z\*+\|\/!]+)\"/msxU",
|
||||
);
|
||||
|
||||
$raw_specs = $specs = array();
|
||||
|
||||
foreach ($ptr as $p) {
|
||||
if (0 < preg_match_all($p, $file_contents, $m)) {
|
||||
$raw_specs = array_merge($raw_specs, $m[1]);
|
||||
}
|
||||
}
|
||||
|
||||
$raw_specs = array_unique($raw_specs);
|
||||
|
||||
foreach ($raw_specs as $item) {
|
||||
if ($reverse_replace) {
|
||||
$rep = str_replace(array_values($zpp_map), array_keys($zpp_map), $item);
|
||||
if ($rep != $item) {
|
||||
$specs['"' . $rep . '"'] = '"' . $item .'"';
|
||||
}
|
||||
} else {
|
||||
$rep = str_replace(array_keys($zpp_map), array_values($zpp_map), $item);
|
||||
if ($rep != $item) {
|
||||
$specs['"' . $item . '"'] = '"' . $rep .'"';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($replace_zpp_compat) {
|
||||
if ($reverse_replace) {
|
||||
echo "WARNING: reverse replace with --zpp-compat is ommited";
|
||||
} else {
|
||||
foreach ($specs as $spec0 => $spec1) {
|
||||
$specs[$spec0] = "ZPP_FMT_COMPAT($spec0, $spec1)";
|
||||
}
|
||||
$file_contents = str_replace(array_keys($specs), array_values($specs), $file_contents);
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($reverse_replace) {
|
||||
$file_contents = str_replace(array_values($specs), array_keys($specs), $file_contents);
|
||||
} else {
|
||||
$file_contents = str_replace(array_keys($specs), array_values($specs), $file_contents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (false === file_put_contents($fname, $file_contents)) {
|
||||
print_error("couldnt write into '$fname'");
|
||||
}
|
||||
|
||||
/* Helpers */
|
||||
function print_usage($code = 0)
|
||||
{
|
||||
echo "Replacement tool for old vs. new macro names and more." . PHP_EOL;
|
||||
echo "Usage: replace.php [OPTIONS] file" . PHP_EOL;
|
||||
echo " --custom Path to custom replacement definitions file, optional." . PHP_EOL;
|
||||
echo " --reverse Replace the new names with the old ones, so reverse, optional." . PHP_EOL;
|
||||
echo " --macros Replace old vs. new macro names, optional." . PHP_EOL;
|
||||
echo " --zpp Replace the zpp format specs, optional." . PHP_EOL;
|
||||
echo " --zpp-compat Same as --zpp but will add both old and new specs for compat, optional." . PHP_EOL;
|
||||
echo " --zpp-vars Do the best and replace the datatypes on zpp vars, might go insane, optional." . PHP_EOL;
|
||||
echo " --help This help." . PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
echo "Example: " . PHP_EOL;
|
||||
echo " php replace.php --zpp --macros path/to/file" . PHP_EOL;
|
||||
echo " php replace.php --zpp --macros --reverse path/to/file" . PHP_EOL;
|
||||
echo " php replace.php --zpp--compat --macros path/to/file" . PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
|
||||
exit($code);
|
||||
}
|
||||
|
||||
function print_error($str)
|
||||
{
|
||||
echo "ERROR: " . $str . PHP_EOL;
|
||||
exit(3);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ AH_BOTTOM([
|
||||
#endif
|
||||
|
||||
#if ZEND_BROKEN_SPRINTF
|
||||
int zend_sprintf(char *buffer, const char *format, ...);
|
||||
zend_size_t zend_sprintf(char *buffer, const char *format, ...);
|
||||
#else
|
||||
# define zend_sprintf sprintf
|
||||
#endif
|
||||
|
||||
+52
-45
@@ -206,12 +206,13 @@ static void php_str2num(bc_num *num, char *str TSRMLS_DC)
|
||||
PHP_FUNCTION(bcadd)
|
||||
{
|
||||
char *left, *right;
|
||||
long scale_param = 0;
|
||||
php_int_t scale_param = 0;
|
||||
bc_num first, second, result;
|
||||
int left_len, right_len;
|
||||
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
||||
php_size_t left_len, right_len;
|
||||
php_int_t scale = BCG(bc_precision);
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "SS|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -231,7 +232,7 @@ PHP_FUNCTION(bcadd)
|
||||
}
|
||||
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_STRSIZE_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
@@ -245,12 +246,13 @@ PHP_FUNCTION(bcadd)
|
||||
PHP_FUNCTION(bcsub)
|
||||
{
|
||||
char *left, *right;
|
||||
int left_len, right_len;
|
||||
long scale_param = 0;
|
||||
php_size_t left_len, right_len;
|
||||
php_int_t scale_param = 0;
|
||||
bc_num first, second, result;
|
||||
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
||||
php_int_t scale = BCG(bc_precision);
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "SS|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -270,7 +272,7 @@ PHP_FUNCTION(bcsub)
|
||||
}
|
||||
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_STRSIZE_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
@@ -284,12 +286,13 @@ PHP_FUNCTION(bcsub)
|
||||
PHP_FUNCTION(bcmul)
|
||||
{
|
||||
char *left, *right;
|
||||
int left_len, right_len;
|
||||
long scale_param = 0;
|
||||
php_size_t left_len, right_len;
|
||||
php_int_t scale_param = 0;
|
||||
bc_num first, second, result;
|
||||
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
||||
php_int_t scale = BCG(bc_precision);
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "SS|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -309,7 +312,7 @@ PHP_FUNCTION(bcmul)
|
||||
}
|
||||
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_STRSIZE_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
@@ -323,12 +326,13 @@ PHP_FUNCTION(bcmul)
|
||||
PHP_FUNCTION(bcdiv)
|
||||
{
|
||||
char *left, *right;
|
||||
int left_len, right_len;
|
||||
long scale_param = 0;
|
||||
php_size_t left_len, right_len;
|
||||
php_int_t scale_param = 0;
|
||||
bc_num first, second, result;
|
||||
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
||||
php_int_t scale = BCG(bc_precision);
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "SS|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -348,7 +352,7 @@ PHP_FUNCTION(bcdiv)
|
||||
result->n_scale = scale;
|
||||
}
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_STRSIZE_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
break;
|
||||
case -1: /* division by zero */
|
||||
@@ -368,10 +372,10 @@ PHP_FUNCTION(bcdiv)
|
||||
PHP_FUNCTION(bcmod)
|
||||
{
|
||||
char *left, *right;
|
||||
int left_len, right_len;
|
||||
php_size_t left_len, right_len;
|
||||
bc_num first, second, result;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &left, &left_len, &right, &right_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &left, &left_len, &right, &right_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -384,7 +388,7 @@ PHP_FUNCTION(bcmod)
|
||||
switch (bc_modulo(first, second, &result, 0 TSRMLS_CC)) {
|
||||
case 0:
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_STRSIZE_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
break;
|
||||
case -1:
|
||||
@@ -404,12 +408,12 @@ PHP_FUNCTION(bcmod)
|
||||
PHP_FUNCTION(bcpowmod)
|
||||
{
|
||||
char *left, *right, *modulous;
|
||||
int left_len, right_len, modulous_len;
|
||||
php_size_t left_len, right_len, modulous_len;
|
||||
bc_num first, second, mod, result;
|
||||
long scale = BCG(bc_precision);
|
||||
php_int_t scale = BCG(bc_precision);
|
||||
int scale_int;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|l", &left, &left_len, &right, &right_len, &modulous, &modulous_len, &scale) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSS|i", &left, &left_len, &right, &right_len, &modulous, &modulous_len, &scale) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -428,7 +432,7 @@ PHP_FUNCTION(bcpowmod)
|
||||
result->n_scale = scale;
|
||||
}
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_STRSIZE_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
@@ -447,12 +451,13 @@ PHP_FUNCTION(bcpowmod)
|
||||
PHP_FUNCTION(bcpow)
|
||||
{
|
||||
char *left, *right;
|
||||
int left_len, right_len;
|
||||
long scale_param = 0;
|
||||
php_size_t left_len, right_len;
|
||||
php_int_t scale_param = 0;
|
||||
bc_num first, second, result;
|
||||
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
||||
php_int_t scale = BCG(bc_precision);
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "SS|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -472,7 +477,7 @@ PHP_FUNCTION(bcpow)
|
||||
}
|
||||
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_STRSIZE_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
@@ -486,12 +491,13 @@ PHP_FUNCTION(bcpow)
|
||||
PHP_FUNCTION(bcsqrt)
|
||||
{
|
||||
char *left;
|
||||
int left_len;
|
||||
long scale_param = 0;
|
||||
php_size_t left_len;
|
||||
php_int_t scale_param = 0;
|
||||
bc_num result;
|
||||
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
||||
php_int_t scale = BCG(bc_precision);
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "s|l", &left, &left_len, &scale_param) == FAILURE) {
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "S|i", &left, &left_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -507,7 +513,7 @@ PHP_FUNCTION(bcsqrt)
|
||||
result->n_scale = scale;
|
||||
}
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_STRSIZE_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Square root of negative number");
|
||||
@@ -523,12 +529,13 @@ PHP_FUNCTION(bcsqrt)
|
||||
PHP_FUNCTION(bccomp)
|
||||
{
|
||||
char *left, *right;
|
||||
int left_len, right_len;
|
||||
long scale_param = 0;
|
||||
php_size_t left_len, right_len;
|
||||
php_int_t scale_param = 0;
|
||||
bc_num first, second;
|
||||
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
||||
php_int_t scale = BCG(bc_precision);
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "SS|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -541,8 +548,8 @@ PHP_FUNCTION(bccomp)
|
||||
|
||||
bc_str2num(&first, left, scale TSRMLS_CC);
|
||||
bc_str2num(&second, right, scale TSRMLS_CC);
|
||||
Z_LVAL_P(return_value) = bc_compare(first, second);
|
||||
Z_TYPE_P(return_value) = IS_LONG;
|
||||
Z_IVAL_P(return_value) = bc_compare(first, second);
|
||||
Z_TYPE_P(return_value) = IS_INT;
|
||||
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
@@ -554,9 +561,9 @@ PHP_FUNCTION(bccomp)
|
||||
Sets default scale parameter for all bc math functions */
|
||||
PHP_FUNCTION(bcscale)
|
||||
{
|
||||
long new_scale;
|
||||
php_int_t new_scale;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_scale) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &new_scale) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ ZEND_BEGIN_MODULE_GLOBALS(bcmath)
|
||||
bc_num _zero_;
|
||||
bc_num _one_;
|
||||
bc_num _two_;
|
||||
long bc_precision;
|
||||
php_int_t bc_precision;
|
||||
ZEND_END_MODULE_GLOBALS(bcmath)
|
||||
|
||||
#ifdef ZTS
|
||||
|
||||
+39
-23
@@ -335,10 +335,10 @@ static PHP_MINFO_FUNCTION(bz2)
|
||||
static PHP_FUNCTION(bzread)
|
||||
{
|
||||
zval *bz;
|
||||
long len = 1024;
|
||||
php_int_t len = 1024;
|
||||
php_stream *stream;
|
||||
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &bz, &len)) {
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &bz, &len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -350,15 +350,14 @@ static PHP_FUNCTION(bzread)
|
||||
}
|
||||
|
||||
Z_STRVAL_P(return_value) = emalloc(len + 1);
|
||||
Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);
|
||||
Z_STRSIZE_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);
|
||||
|
||||
if (Z_STRLEN_P(return_value) < 0) {
|
||||
if (Z_STRSIZE_P(return_value) == 0) {
|
||||
efree(Z_STRVAL_P(return_value));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not read valid bz2 data from stream");
|
||||
RETURN_FALSE;
|
||||
RETURN_STRINGL("", 0, 1);
|
||||
}
|
||||
|
||||
Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
|
||||
Z_STRVAL_P(return_value)[Z_STRSIZE_P(return_value)] = 0;
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -369,12 +368,12 @@ static PHP_FUNCTION(bzopen)
|
||||
{
|
||||
zval **file; /* The file to open */
|
||||
char *mode; /* The mode to open the stream with */
|
||||
int mode_len;
|
||||
php_size_t mode_len;
|
||||
|
||||
BZFILE *bz; /* The compressed file stream */
|
||||
php_stream *stream = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zs", &file, &mode, &mode_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZS", &file, &mode, &mode_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -385,7 +384,7 @@ static PHP_FUNCTION(bzopen)
|
||||
|
||||
/* If it's not a resource its a string containing the filename to open */
|
||||
if (Z_TYPE_PP(file) == IS_STRING) {
|
||||
if (Z_STRLEN_PP(file) == 0) {
|
||||
if (Z_STRSIZE_PP(file) == 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "filename cannot be empty");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -402,7 +401,7 @@ static PHP_FUNCTION(bzopen)
|
||||
} else if (Z_TYPE_PP(file) == IS_RESOURCE) {
|
||||
/* If it is a resource, than its a stream resource */
|
||||
php_socket_t fd;
|
||||
int stream_mode_len;
|
||||
php_size_t stream_mode_len;
|
||||
|
||||
php_stream_from_zval(stream, file);
|
||||
stream_mode_len = strlen(stream->mode);
|
||||
@@ -486,22 +485,33 @@ static PHP_FUNCTION(bzerror)
|
||||
static PHP_FUNCTION(bzcompress)
|
||||
{
|
||||
char *source; /* Source data to compress */
|
||||
long zblock_size = 0; /* Optional block size to use */
|
||||
long zwork_factor = 0;/* Optional work factor to use */
|
||||
php_int_t zblock_size = 0; /* Optional block size to use */
|
||||
php_int_t zwork_factor = 0;/* Optional work factor to use */
|
||||
char *dest = NULL; /* Destination to place the compressed data into */
|
||||
int error, /* Error Container */
|
||||
block_size = 4, /* Block size for compression algorithm */
|
||||
work_factor = 0, /* Work factor for compression algorithm */
|
||||
argc; /* Argument count */
|
||||
int source_len; /* Length of the source data */
|
||||
php_size_t source_len; /* Length of the source data */
|
||||
unsigned int dest_len; /* Length of the destination buffer */
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ii", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (source_len > UINT_MAX) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The string to compress is too large");
|
||||
RETURN_INT(BZ_PARAM_ERROR);
|
||||
} else if (argc > 1 && zblock_size > INT_MAX) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid block size");
|
||||
RETURN_INT(BZ_PARAM_ERROR);
|
||||
} else if (argc > 2 && zwork_factor > INT_MAX) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid work factor");
|
||||
RETURN_INT(BZ_PARAM_ERROR);
|
||||
}
|
||||
|
||||
/* Assign them to easy to use variables, dest_len is initially the length of the data
|
||||
+ .01 x length of data + 600 which is the largest size the results of the compression
|
||||
could possibly be, at least that's what the libbz2 docs say (thanks to jeremy@nirvani.net
|
||||
@@ -523,7 +533,7 @@ static PHP_FUNCTION(bzcompress)
|
||||
error = BZ2_bzBuffToBuffCompress(dest, &dest_len, source, source_len, block_size, 0, work_factor);
|
||||
if (error != BZ_OK) {
|
||||
efree(dest);
|
||||
RETURN_LONG(error);
|
||||
RETURN_INT(error);
|
||||
} else {
|
||||
/* Copy the buffer, we have perhaps allocate a lot more than we need,
|
||||
so we erealloc() the buffer to the proper size */
|
||||
@@ -539,8 +549,9 @@ static PHP_FUNCTION(bzcompress)
|
||||
static PHP_FUNCTION(bzdecompress)
|
||||
{
|
||||
char *source, *dest;
|
||||
int source_len, error;
|
||||
long small = 0;
|
||||
php_size_t source_len;
|
||||
int error;
|
||||
php_int_t small = 0;
|
||||
#if defined(PHP_WIN32)
|
||||
unsigned __int64 size = 0;
|
||||
#else
|
||||
@@ -548,14 +559,19 @@ static PHP_FUNCTION(bzdecompress)
|
||||
#endif
|
||||
bz_stream bzs;
|
||||
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &small)) {
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &source, &source_len, &small)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (source_len > UINT_MAX/2) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The string to decompress is too large");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
bzs.bzalloc = NULL;
|
||||
bzs.bzfree = NULL;
|
||||
|
||||
if (BZ2_bzDecompressInit(&bzs, 0, small) != BZ_OK) {
|
||||
if (BZ2_bzDecompressInit(&bzs, 0, (int)small) != BZ_OK) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -581,7 +597,7 @@ static PHP_FUNCTION(bzdecompress)
|
||||
RETVAL_STRINGL(dest, (int) size, 0);
|
||||
} else { /* real error */
|
||||
efree(dest);
|
||||
RETVAL_LONG(error);
|
||||
RETVAL_INT(error);
|
||||
}
|
||||
|
||||
BZ2_bzDecompressEnd(&bzs);
|
||||
@@ -616,7 +632,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
|
||||
/* Determine what to return */
|
||||
switch (opt) {
|
||||
case PHP_BZ_ERRNO:
|
||||
RETURN_LONG(errnum);
|
||||
RETURN_INT(errnum);
|
||||
break;
|
||||
case PHP_BZ_ERRSTR:
|
||||
RETURN_STRING((char*)errstr, 1);
|
||||
@@ -624,7 +640,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
|
||||
case PHP_BZ_ERRBOTH:
|
||||
array_init(return_value);
|
||||
|
||||
add_assoc_long (return_value, "errno", errnum);
|
||||
add_assoc_int (return_value, "errno", errnum);
|
||||
add_assoc_string(return_value, "errstr", (char*)errstr, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
+10
-10
@@ -358,7 +358,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
|
||||
zval_copy_ctor(&tmp);
|
||||
tmp2 = &tmp;
|
||||
convert_to_boolean_ex(&tmp2);
|
||||
data->expect_concatenated = Z_LVAL(tmp);
|
||||
data->expect_concatenated = Z_IVAL(tmp);
|
||||
tmpzval = NULL;
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
|
||||
zval_copy_ctor(&tmp);
|
||||
tmp2 = &tmp;
|
||||
convert_to_boolean_ex(&tmp2);
|
||||
data->small_footprint = Z_LVAL(tmp);
|
||||
data->small_footprint = Z_IVAL(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,11 +394,11 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
|
||||
|
||||
tmp = **tmpzval;
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_long(&tmp);
|
||||
if (Z_LVAL(tmp) < 1 || Z_LVAL(tmp) > 9) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%ld)", Z_LVAL_PP(tmpzval));
|
||||
convert_to_int(&tmp);
|
||||
if (Z_IVAL(tmp) < 1 || Z_IVAL(tmp) > 9) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%ld)", Z_IVAL_PP(tmpzval));
|
||||
} else {
|
||||
blockSize100k = Z_LVAL(tmp);
|
||||
blockSize100k = Z_IVAL(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,12 +408,12 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
|
||||
|
||||
tmp = **tmpzval;
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_long(&tmp);
|
||||
convert_to_int(&tmp);
|
||||
|
||||
if (Z_LVAL(tmp) < 0 || Z_LVAL(tmp) > 250) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%ld)", Z_LVAL(tmp));
|
||||
if (Z_IVAL(tmp) < 0 || Z_IVAL(tmp) > 250) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%ld)", Z_IVAL(tmp));
|
||||
} else {
|
||||
workFactor = Z_LVAL(tmp);
|
||||
workFactor = Z_IVAL(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ PHP_FUNCTION(unixtojd)
|
||||
time_t ts = 0;
|
||||
struct tm *ta, tmbuf;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &ts) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &ts) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ PHP_FUNCTION(unixtojd)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1, ta->tm_mday));
|
||||
RETURN_INT(GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1, ta->tm_mday));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -53,9 +53,9 @@ PHP_FUNCTION(unixtojd)
|
||||
Convert Julian Day to UNIX timestamp */
|
||||
PHP_FUNCTION(jdtounix)
|
||||
{
|
||||
long uday;
|
||||
php_int_t uday;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &uday) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &uday) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
uday -= 2440588 /* J.D. of 1.1.1970 */;
|
||||
@@ -64,7 +64,7 @@ PHP_FUNCTION(jdtounix)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(uday * 24 * 3600);
|
||||
RETURN_INT(uday * 24 * 3600);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+68
-68
@@ -178,8 +178,8 @@ enum cal_name_type_t {
|
||||
CAL_NUM_CALS
|
||||
};
|
||||
|
||||
typedef long int (*cal_to_jd_func_t) (int month, int day, int year);
|
||||
typedef void (*cal_from_jd_func_t) (long int jd, int *year, int *month, int *day);
|
||||
typedef php_int_t (*cal_to_jd_func_t) (int month, int day, int year);
|
||||
typedef void (*cal_from_jd_func_t) (php_int_t jd, int *year, int *month, int *day);
|
||||
typedef char *(*cal_as_string_func_t) (int year, int month, int day);
|
||||
|
||||
struct cal_entry_t {
|
||||
@@ -225,31 +225,31 @@ static char alef_bet[25] = "0
|
||||
|
||||
PHP_MINIT_FUNCTION(calendar)
|
||||
{
|
||||
REGISTER_LONG_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_NUM_CALS", CAL_NUM_CALS, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_NUM_CALS", CAL_NUM_CALS, CONST_CS | CONST_PERSISTENT);
|
||||
/* constants for jddayofweek */
|
||||
REGISTER_LONG_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_DOW_SHORT", CAL_DOW_SHORT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_DOW_LONG", CAL_DOW_LONG, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_DOW_SHORT", CAL_DOW_SHORT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_DOW_LONG", CAL_DOW_LONG, CONST_CS | CONST_PERSISTENT);
|
||||
/* constants for jdmonthname */
|
||||
REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_LONG", CAL_MONTH_GREGORIAN_LONG, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_SHORT", CAL_MONTH_JULIAN_SHORT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_MONTH_GREGORIAN_LONG", CAL_MONTH_GREGORIAN_LONG, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_MONTH_JULIAN_SHORT", CAL_MONTH_JULIAN_SHORT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS | CONST_PERSISTENT);
|
||||
/* constants for easter calculation */
|
||||
REGISTER_LONG_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT);
|
||||
/* constants for Jewish date formatting */
|
||||
REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM_GERESH", CAL_JEWISH_ADD_ALAFIM_GERESH, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM", CAL_JEWISH_ADD_ALAFIM, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_GERESHAYIM", CAL_JEWISH_ADD_GERESHAYIM, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_ALAFIM_GERESH", CAL_JEWISH_ADD_ALAFIM_GERESH, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_ALAFIM", CAL_JEWISH_ADD_ALAFIM, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_GERESHAYIM", CAL_JEWISH_ADD_GERESHAYIM, CONST_CS | CONST_PERSISTENT);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ static void _php_cal_info(int cal, zval **ret)
|
||||
}
|
||||
add_assoc_zval(*ret, "months", months);
|
||||
add_assoc_zval(*ret, "abbrevmonths", smonths);
|
||||
add_assoc_long(*ret, "maxdaysinmonth", calendar->max_days_in_month);
|
||||
add_assoc_int(*ret, "maxdaysinmonth", calendar->max_days_in_month);
|
||||
add_assoc_string(*ret, "calname", calendar->name, 1);
|
||||
add_assoc_string(*ret, "calsymbol", calendar->symbol, 1);
|
||||
|
||||
@@ -290,10 +290,10 @@ static void _php_cal_info(int cal, zval **ret)
|
||||
Returns information about a particular calendar */
|
||||
PHP_FUNCTION(cal_info)
|
||||
{
|
||||
long cal = -1;
|
||||
php_int_t cal = -1;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &cal) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &cal) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ PHP_FUNCTION(cal_info)
|
||||
|
||||
|
||||
if (cal != -1 && (cal < 0 || cal >= CAL_NUM_CALS)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld.", cal);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %pd.", cal);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -326,16 +326,16 @@ PHP_FUNCTION(cal_info)
|
||||
Returns the number of days in a month for a given year and calendar */
|
||||
PHP_FUNCTION(cal_days_in_month)
|
||||
{
|
||||
long cal, month, year;
|
||||
php_int_t cal, month, year;
|
||||
struct cal_entry_t *calendar;
|
||||
long sdn_start, sdn_next;
|
||||
php_int_t sdn_start, sdn_next;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &cal, &month, &year) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &cal, &month, &year) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (cal < 0 || cal >= CAL_NUM_CALS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld.", cal);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %pd.", cal);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ PHP_FUNCTION(cal_days_in_month)
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_LONG(sdn_next - sdn_start);
|
||||
RETURN_INT(sdn_next - sdn_start);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -370,18 +370,18 @@ PHP_FUNCTION(cal_days_in_month)
|
||||
Converts from a supported calendar to Julian Day Count */
|
||||
PHP_FUNCTION(cal_to_jd)
|
||||
{
|
||||
long cal, month, day, year;
|
||||
php_int_t cal, month, day, year;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &cal, &month, &day, &year) != SUCCESS) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iiii", &cal, &month, &day, &year) != SUCCESS) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (cal < 0 || cal >= CAL_NUM_CALS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld.", cal);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %pd.", cal);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(cal_conversion_table[cal].to_jd(year, month, day));
|
||||
RETURN_INT(cal_conversion_table[cal].to_jd(year, month, day));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -389,17 +389,17 @@ PHP_FUNCTION(cal_to_jd)
|
||||
Converts from Julian Day Count to a supported calendar and return extended information */
|
||||
PHP_FUNCTION(cal_from_jd)
|
||||
{
|
||||
long jd, cal;
|
||||
php_int_t jd, cal;
|
||||
int month, day, year, dow;
|
||||
char date[16];
|
||||
struct cal_entry_t *calendar;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS()TSRMLS_CC, "ll", &jd, &cal) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS()TSRMLS_CC, "ii", &jd, &cal) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (cal < 0 || cal >= CAL_NUM_CALS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld", cal);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %pd", cal);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
calendar = &cal_conversion_table[cal];
|
||||
@@ -411,13 +411,13 @@ PHP_FUNCTION(cal_from_jd)
|
||||
snprintf(date, sizeof(date), "%i/%i/%i", month, day, year);
|
||||
add_assoc_string(return_value, "date", date, 1);
|
||||
|
||||
add_assoc_long(return_value, "month", month);
|
||||
add_assoc_long(return_value, "day", day);
|
||||
add_assoc_long(return_value, "year", year);
|
||||
add_assoc_int(return_value, "month", month);
|
||||
add_assoc_int(return_value, "day", day);
|
||||
add_assoc_int(return_value, "year", year);
|
||||
|
||||
/* day of week */
|
||||
dow = DayOfWeek(jd);
|
||||
add_assoc_long(return_value, "dow", dow);
|
||||
add_assoc_int(return_value, "dow", dow);
|
||||
add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow], 1);
|
||||
add_assoc_string(return_value, "dayname", DayNameLong[dow], 1);
|
||||
/* month name */
|
||||
@@ -436,11 +436,11 @@ PHP_FUNCTION(cal_from_jd)
|
||||
Converts a julian day count to a gregorian calendar date */
|
||||
PHP_FUNCTION(jdtogregorian)
|
||||
{
|
||||
long julday;
|
||||
php_int_t julday;
|
||||
int year, month, day;
|
||||
char date[16];
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &julday) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -455,13 +455,13 @@ PHP_FUNCTION(jdtogregorian)
|
||||
Converts a gregorian calendar date to julian day count */
|
||||
PHP_FUNCTION(gregoriantojd)
|
||||
{
|
||||
long year, month, day;
|
||||
php_int_t year, month, day;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(GregorianToSdn(year, month, day));
|
||||
RETURN_INT(GregorianToSdn(year, month, day));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -469,11 +469,11 @@ PHP_FUNCTION(gregoriantojd)
|
||||
Convert a julian day count to a julian calendar date */
|
||||
PHP_FUNCTION(jdtojulian)
|
||||
{
|
||||
long julday;
|
||||
php_int_t julday;
|
||||
int year, month, day;
|
||||
char date[16];
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &julday) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -488,13 +488,13 @@ PHP_FUNCTION(jdtojulian)
|
||||
Converts a julian calendar date to julian day count */
|
||||
PHP_FUNCTION(juliantojd)
|
||||
{
|
||||
long year, month, day;
|
||||
php_int_t year, month, day;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(JulianToSdn(year, month, day));
|
||||
RETURN_INT(JulianToSdn(year, month, day));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -597,13 +597,13 @@ static char *heb_number_to_chars(int n, int fl, char **ret)
|
||||
Converts a julian day count to a jewish calendar date */
|
||||
PHP_FUNCTION(jdtojewish)
|
||||
{
|
||||
long julday, fl = 0;
|
||||
php_int_t julday, fl = 0;
|
||||
zend_bool heb = 0;
|
||||
int year, month, day;
|
||||
char date[16], hebdate[32];
|
||||
char *dayp, *yearp;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|bl", &julday, &heb, &fl) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|bi", &julday, &heb, &fl) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -636,13 +636,13 @@ PHP_FUNCTION(jdtojewish)
|
||||
Converts a jewish calendar date to a julian day count */
|
||||
PHP_FUNCTION(jewishtojd)
|
||||
{
|
||||
long year, month, day;
|
||||
php_int_t year, month, day;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(JewishToSdn(year, month, day));
|
||||
RETURN_INT(JewishToSdn(year, month, day));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -650,11 +650,11 @@ PHP_FUNCTION(jewishtojd)
|
||||
Converts a julian day count to a french republic calendar date */
|
||||
PHP_FUNCTION(jdtofrench)
|
||||
{
|
||||
long julday;
|
||||
php_int_t julday;
|
||||
int year, month, day;
|
||||
char date[16];
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &julday) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -669,13 +669,13 @@ PHP_FUNCTION(jdtofrench)
|
||||
Converts a french republic calendar date to julian day count */
|
||||
PHP_FUNCTION(frenchtojd)
|
||||
{
|
||||
long year, month, day;
|
||||
php_int_t year, month, day;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(FrenchToSdn(year, month, day));
|
||||
RETURN_INT(FrenchToSdn(year, month, day));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -683,11 +683,11 @@ PHP_FUNCTION(frenchtojd)
|
||||
Returns name or number of day of week from julian day count */
|
||||
PHP_FUNCTION(jddayofweek)
|
||||
{
|
||||
long julday, mode = CAL_DOW_DAYNO;
|
||||
php_int_t julday, mode = CAL_DOW_DAYNO;
|
||||
int day;
|
||||
char *daynamel, *daynames;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &julday, &mode) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &julday, &mode) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -704,7 +704,7 @@ PHP_FUNCTION(jddayofweek)
|
||||
break;
|
||||
case CAL_DOW_DAYNO:
|
||||
default:
|
||||
RETURN_LONG(day);
|
||||
RETURN_INT(day);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -714,11 +714,11 @@ PHP_FUNCTION(jddayofweek)
|
||||
Returns name of month for julian day count */
|
||||
PHP_FUNCTION(jdmonthname)
|
||||
{
|
||||
long julday, mode;
|
||||
php_int_t julday, mode;
|
||||
char *monthname = NULL;
|
||||
int month, day, year;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &julday, &mode) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &julday, &mode) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@
|
||||
*
|
||||
* int
|
||||
* DayOfWeek(
|
||||
* long int sdn);
|
||||
* php_int_t sdn);
|
||||
*
|
||||
* Convert a SDN to a day-of-week number (0 to 6). Where 0 stands for
|
||||
* Sunday, 1 for Monday, etc. and 6 stands for Saturday.
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "sdncal.h"
|
||||
|
||||
int DayOfWeek(
|
||||
long int sdn)
|
||||
php_int_t sdn)
|
||||
{
|
||||
int dow;
|
||||
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
#include "sdncal.h"
|
||||
#include <time.h>
|
||||
|
||||
static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, php_int_t gm)
|
||||
{
|
||||
|
||||
/* based on code by Simon Kershaw, <webmaster@ely.anglican.org> */
|
||||
|
||||
struct tm te;
|
||||
long year, golden, solar, lunar, pfm, dom, tmp, easter;
|
||||
long method = CAL_EASTER_DEFAULT;
|
||||
php_int_t year, golden, solar, lunar, pfm, dom, tmp, easter;
|
||||
php_int_t method = CAL_EASTER_DEFAULT;
|
||||
|
||||
/* Default to the current year if year parameter is not given */
|
||||
{
|
||||
@@ -47,7 +47,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"|ll", &year, &method) == FAILURE) {
|
||||
"|ii", &year, &method) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -112,12 +112,12 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
te.tm_mday = easter-10;
|
||||
}
|
||||
|
||||
Z_LVAL_P(return_value) = mktime(&te);
|
||||
Z_IVAL_P(return_value) = mktime(&te);
|
||||
} else { /* return the days after March 21 */
|
||||
Z_LVAL_P(return_value) = easter;
|
||||
Z_IVAL_P(return_value) = easter;
|
||||
}
|
||||
|
||||
Z_TYPE_P(return_value) = IS_LONG;
|
||||
Z_TYPE_P(return_value) = IS_INT;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
* void
|
||||
* SdnToFrench(
|
||||
* long int sdn,
|
||||
* php_int_t sdn,
|
||||
* int *pYear,
|
||||
* int *pMonth,
|
||||
* int *pDay);
|
||||
@@ -24,7 +24,7 @@
|
||||
* 13, the SDN represents one of the holidays at the end of the year and
|
||||
* *pDay will be in the range 1 to 6 inclusive.
|
||||
*
|
||||
* long int
|
||||
* php_int_t
|
||||
* FrenchToSdn(
|
||||
* int year,
|
||||
* int month,
|
||||
@@ -93,12 +93,12 @@
|
||||
#define LAST_VALID 2380952
|
||||
|
||||
void SdnToFrench(
|
||||
long int sdn,
|
||||
php_int_t sdn,
|
||||
int *pYear,
|
||||
int *pMonth,
|
||||
int *pDay)
|
||||
{
|
||||
long int temp;
|
||||
php_int_t temp;
|
||||
int dayOfYear;
|
||||
|
||||
if (sdn < FIRST_VALID || sdn > LAST_VALID) {
|
||||
@@ -114,7 +114,7 @@ void SdnToFrench(
|
||||
*pDay = dayOfYear % DAYS_PER_MONTH + 1;
|
||||
}
|
||||
|
||||
long int FrenchToSdn(
|
||||
php_int_t FrenchToSdn(
|
||||
int year,
|
||||
int month,
|
||||
int day)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
* void
|
||||
* SdnToGregorian(
|
||||
* long int sdn,
|
||||
* php_int_t sdn,
|
||||
* int *pYear,
|
||||
* int *pMonth,
|
||||
* int *pDay);
|
||||
@@ -21,7 +21,7 @@
|
||||
* *pYear will be >= -4714 and != 0; *pMonth will be in the range 1 to 12
|
||||
* inclusive; *pDay will be in the range 1 to 31 inclusive.
|
||||
*
|
||||
* long int
|
||||
* php_int_t
|
||||
* GregorianToSdn(
|
||||
* int inputYear,
|
||||
* int inputMonth,
|
||||
@@ -135,7 +135,7 @@
|
||||
#define DAYS_PER_400_YEARS 146097
|
||||
|
||||
void SdnToGregorian(
|
||||
long int sdn,
|
||||
php_int_t sdn,
|
||||
int *pYear,
|
||||
int *pMonth,
|
||||
int *pDay)
|
||||
@@ -144,7 +144,7 @@ void SdnToGregorian(
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
long int temp;
|
||||
php_int_t temp;
|
||||
int dayOfYear;
|
||||
|
||||
if (sdn <= 0 ||
|
||||
@@ -190,7 +190,7 @@ fail:
|
||||
*pDay = 0;
|
||||
}
|
||||
|
||||
long int GregorianToSdn(
|
||||
php_int_t GregorianToSdn(
|
||||
int inputYear,
|
||||
int inputMonth,
|
||||
int inputDay)
|
||||
|
||||
+24
-24
@@ -11,7 +11,7 @@
|
||||
*
|
||||
* void
|
||||
* SdnToJewish(
|
||||
* long int sdn,
|
||||
* php_int_t sdn,
|
||||
* int *pYear,
|
||||
* int *pMonth,
|
||||
* int *pDay);
|
||||
@@ -22,7 +22,7 @@
|
||||
* inclusive; *pDay will be in the range 1 to 30 inclusive. Note that Adar
|
||||
* II is assigned the month number 7 and Elul is always 13.
|
||||
*
|
||||
* long int
|
||||
* php_int_t
|
||||
* JewishToSdn(
|
||||
* int year,
|
||||
* int month,
|
||||
@@ -382,12 +382,12 @@ char *JewishMonthHebName[14] =
|
||||
* (called dehiyyot) delays it. These 4 rules can delay the start of the
|
||||
* year by as much as 2 days.
|
||||
*/
|
||||
static long int Tishri1(
|
||||
static php_int_t Tishri1(
|
||||
int metonicYear,
|
||||
long int moladDay,
|
||||
long int moladHalakim)
|
||||
php_int_t moladDay,
|
||||
php_int_t moladHalakim)
|
||||
{
|
||||
long int tishri1;
|
||||
php_int_t tishri1;
|
||||
int dow;
|
||||
int leapYear;
|
||||
int lastWasLeapYear;
|
||||
@@ -429,10 +429,10 @@ static long int Tishri1(
|
||||
*/
|
||||
static void MoladOfMetonicCycle(
|
||||
int metonicCycle,
|
||||
long int *pMoladDay,
|
||||
long int *pMoladHalakim)
|
||||
php_int_t *pMoladDay,
|
||||
php_int_t *pMoladHalakim)
|
||||
{
|
||||
register unsigned long int r1, r2, d1, d2;
|
||||
register php_uint_t r1, r2, d1, d2;
|
||||
|
||||
/* Start with the time of the first molad after creation. */
|
||||
r1 = NEW_MOON_OF_CREATION;
|
||||
@@ -468,14 +468,14 @@ static void MoladOfMetonicCycle(
|
||||
* us to avoid calculating the length of the year in most cases.
|
||||
*/
|
||||
static void FindTishriMolad(
|
||||
long int inputDay,
|
||||
php_int_t inputDay,
|
||||
int *pMetonicCycle,
|
||||
int *pMetonicYear,
|
||||
long int *pMoladDay,
|
||||
long int *pMoladHalakim)
|
||||
php_int_t *pMoladDay,
|
||||
php_int_t *pMoladHalakim)
|
||||
{
|
||||
long int moladDay;
|
||||
long int moladHalakim;
|
||||
php_int_t moladDay;
|
||||
php_int_t moladHalakim;
|
||||
int metonicCycle;
|
||||
int metonicYear;
|
||||
|
||||
@@ -523,8 +523,8 @@ static void FindStartOfYear(
|
||||
int year,
|
||||
int *pMetonicCycle,
|
||||
int *pMetonicYear,
|
||||
long int *pMoladDay,
|
||||
long int *pMoladHalakim,
|
||||
php_int_t *pMoladDay,
|
||||
php_int_t *pMoladHalakim,
|
||||
int *pTishri1)
|
||||
{
|
||||
*pMetonicCycle = (year - 1) / 19;
|
||||
@@ -546,14 +546,14 @@ static void FindStartOfYear(
|
||||
* range 1 to 13 inclusive; *pDay will be in the range 1 to 30 inclusive.
|
||||
*/
|
||||
void SdnToJewish(
|
||||
long int sdn,
|
||||
php_int_t sdn,
|
||||
int *pYear,
|
||||
int *pMonth,
|
||||
int *pDay)
|
||||
{
|
||||
long int inputDay;
|
||||
long int day;
|
||||
long int halakim;
|
||||
php_int_t inputDay;
|
||||
php_int_t day;
|
||||
php_int_t halakim;
|
||||
int metonicCycle;
|
||||
int metonicYear;
|
||||
int tishri1;
|
||||
@@ -684,18 +684,18 @@ void SdnToJewish(
|
||||
* value. To verify that a date is valid, convert it to SDN and then back
|
||||
* and compare with the original.
|
||||
*/
|
||||
long int JewishToSdn(
|
||||
php_int_t JewishToSdn(
|
||||
int year,
|
||||
int month,
|
||||
int day)
|
||||
{
|
||||
long int sdn;
|
||||
php_int_t sdn;
|
||||
int metonicCycle;
|
||||
int metonicYear;
|
||||
int tishri1;
|
||||
int tishri1After;
|
||||
long int moladDay;
|
||||
long int moladHalakim;
|
||||
php_int_t moladDay;
|
||||
php_int_t moladHalakim;
|
||||
int yearLength;
|
||||
int lengthOfAdarIAndII;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
* void
|
||||
* SdnToJulian(
|
||||
* long int sdn,
|
||||
* php_int_t sdn,
|
||||
* int *pYear,
|
||||
* int *pMonth,
|
||||
* int *pDay);
|
||||
@@ -21,7 +21,7 @@
|
||||
* will be >= -4713 and != 0; *pMonth will be in the range 1 to 12
|
||||
* inclusive; *pDay will be in the range 1 to 31 inclusive.
|
||||
*
|
||||
* long int
|
||||
* php_int_t
|
||||
* JulianToSdn(
|
||||
* int inputYear,
|
||||
* int inputMonth,
|
||||
@@ -153,7 +153,7 @@
|
||||
#define DAYS_PER_4_YEARS 1461
|
||||
|
||||
void SdnToJulian(
|
||||
long int sdn,
|
||||
php_int_t sdn,
|
||||
int *pYear,
|
||||
int *pMonth,
|
||||
int *pDay)
|
||||
@@ -161,7 +161,7 @@ void SdnToJulian(
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
long int temp;
|
||||
php_int_t temp;
|
||||
int dayOfYear;
|
||||
|
||||
if (sdn <= 0) {
|
||||
@@ -212,7 +212,7 @@ fail:
|
||||
*pDay = 0;
|
||||
}
|
||||
|
||||
long int JulianToSdn(
|
||||
php_int_t JulianToSdn(
|
||||
int inputYear,
|
||||
int inputMonth,
|
||||
int inputDay)
|
||||
|
||||
+13
-11
@@ -32,7 +32,7 @@
|
||||
* calculating the number of days between two dates.
|
||||
*
|
||||
* When using this software on 16 bit systems, be careful to store SDNs in
|
||||
* a long int, because it will not fit in the 16 bits that some systems
|
||||
* a php_int_t, because it will not fit in the 16 bits that some systems
|
||||
* allocate to an int.
|
||||
*
|
||||
* For each calendar, there are two routines provided. One converts dates
|
||||
@@ -53,7 +53,7 @@
|
||||
*
|
||||
* int y1, m1, d1;
|
||||
* int y2, m2, d2;
|
||||
* long int sdn;
|
||||
* php_int_t sdn;
|
||||
* ...
|
||||
* sdn = GregorianToSdn(y1, m1, d1);
|
||||
* if (sdn > 0) {
|
||||
@@ -65,19 +65,21 @@
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include "php.h"
|
||||
|
||||
/* Gregorian calendar conversions. */
|
||||
void SdnToGregorian(long int sdn, int *pYear, int *pMonth, int *pDay);
|
||||
long int GregorianToSdn(int year, int month, int day);
|
||||
void SdnToGregorian(php_int_t sdn, int *pYear, int *pMonth, int *pDay);
|
||||
php_int_t GregorianToSdn(int year, int month, int day);
|
||||
extern char *MonthNameShort[13];
|
||||
extern char *MonthNameLong[13];
|
||||
|
||||
/* Julian calendar conversions. */
|
||||
void SdnToJulian(long int sdn, int *pYear, int *pMonth, int *pDay);
|
||||
long int JulianToSdn(int year, int month, int day);
|
||||
void SdnToJulian(php_int_t sdn, int *pYear, int *pMonth, int *pDay);
|
||||
php_int_t JulianToSdn(int year, int month, int day);
|
||||
|
||||
/* Jewish calendar conversions. */
|
||||
void SdnToJewish(long int sdn, int *pYear, int *pMonth, int *pDay);
|
||||
long int JewishToSdn(int year, int month, int day);
|
||||
void SdnToJewish(php_int_t sdn, int *pYear, int *pMonth, int *pDay);
|
||||
php_int_t JewishToSdn(int year, int month, int day);
|
||||
extern char *JewishMonthName[14];
|
||||
extern char *JewishMonthNameLeap[14];
|
||||
extern char *JewishMonthHebName[14];
|
||||
@@ -85,15 +87,15 @@ extern char *JewishMonthHebNameLeap[14];
|
||||
extern int monthsPerYear[19];
|
||||
|
||||
/* French republic calendar conversions. */
|
||||
void SdnToFrench(long int sdn, int *pYear, int *pMonth, int *pDay);
|
||||
long int FrenchToSdn(int inputYear, int inputMonth, int inputDay);
|
||||
void SdnToFrench(php_int_t sdn, int *pYear, int *pMonth, int *pDay);
|
||||
php_int_t FrenchToSdn(int inputYear, int inputMonth, int inputDay);
|
||||
extern char *FrenchMonthName[14];
|
||||
|
||||
/* Islamic calendar conversions. */
|
||||
/* Not implemented yet. */
|
||||
|
||||
/* Day of week conversion. 0=Sunday, 6=Saturday */
|
||||
int DayOfWeek(long int sdn);
|
||||
int DayOfWeek(php_int_t sdn);
|
||||
extern char *DayNameShort[7];
|
||||
extern char *DayNameLong[7];
|
||||
|
||||
|
||||
@@ -56,22 +56,22 @@ string(0) ""
|
||||
Notice: Array to string conversion in %sjdtomonthname.php on line %d
|
||||
Array
|
||||
|
||||
Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d
|
||||
Warning: jdmonthname() expects parameter 1 to be integer, array given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d
|
||||
Warning: jdmonthname() expects parameter 1 to be integer, array given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d
|
||||
Warning: jdmonthname() expects parameter 1 to be integer, array given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d
|
||||
Warning: jdmonthname() expects parameter 1 to be integer, array given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d
|
||||
Warning: jdmonthname() expects parameter 1 to be integer, array given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d
|
||||
Warning: jdmonthname() expects parameter 1 to be integer, array given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
=== 10000000
|
||||
|
||||
+24
-24
@@ -37,7 +37,7 @@ PHP_FUNCTION(com_create_instance)
|
||||
php_com_dotnet_object *obj;
|
||||
char *module_name, *typelib_name = NULL, *server_name = NULL;
|
||||
char *user_name = NULL, *domain_name = NULL, *password = NULL;
|
||||
int module_name_len, typelib_name_len, server_name_len,
|
||||
php_size_t module_name_len, typelib_name_len, server_name_len,
|
||||
user_name_len, domain_name_len, password_len;
|
||||
OLECHAR *moniker;
|
||||
CLSID clsid;
|
||||
@@ -57,11 +57,11 @@ PHP_FUNCTION(com_create_instance)
|
||||
obj = CDNO_FETCH(object);
|
||||
|
||||
if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
|
||||
ZEND_NUM_ARGS() TSRMLS_CC, "s|s!ls",
|
||||
ZEND_NUM_ARGS() TSRMLS_CC, "S|S!iS",
|
||||
&module_name, &module_name_len, &server_name, &server_name_len,
|
||||
&obj->code_page, &typelib_name, &typelib_name_len) &&
|
||||
FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
|
||||
ZEND_NUM_ARGS() TSRMLS_CC, "sa|ls",
|
||||
ZEND_NUM_ARGS() TSRMLS_CC, "Sa|iS",
|
||||
&module_name, &module_name_len, &server_params, &obj->code_page,
|
||||
&typelib_name, &typelib_name_len)) {
|
||||
|
||||
@@ -81,7 +81,7 @@ PHP_FUNCTION(com_create_instance)
|
||||
"Server", sizeof("Server"), (void**)&tmp)) {
|
||||
convert_to_string_ex(tmp);
|
||||
server_name = Z_STRVAL_PP(tmp);
|
||||
server_name_len = Z_STRLEN_PP(tmp);
|
||||
server_name_len = Z_STRSIZE_PP(tmp);
|
||||
ctx = CLSCTX_REMOTE_SERVER;
|
||||
}
|
||||
|
||||
@@ -89,27 +89,27 @@ PHP_FUNCTION(com_create_instance)
|
||||
"Username", sizeof("Username"), (void**)&tmp)) {
|
||||
convert_to_string_ex(tmp);
|
||||
user_name = Z_STRVAL_PP(tmp);
|
||||
user_name_len = Z_STRLEN_PP(tmp);
|
||||
user_name_len = Z_STRSIZE_PP(tmp);
|
||||
}
|
||||
|
||||
if (SUCCESS == zend_hash_find(HASH_OF(server_params),
|
||||
"Password", sizeof("Password"), (void**)&tmp)) {
|
||||
convert_to_string_ex(tmp);
|
||||
password = Z_STRVAL_PP(tmp);
|
||||
password_len = Z_STRLEN_PP(tmp);
|
||||
password_len = Z_STRSIZE_PP(tmp);
|
||||
}
|
||||
|
||||
if (SUCCESS == zend_hash_find(HASH_OF(server_params),
|
||||
"Domain", sizeof("Domain"), (void**)&tmp)) {
|
||||
convert_to_string_ex(tmp);
|
||||
domain_name = Z_STRVAL_PP(tmp);
|
||||
domain_name_len = Z_STRLEN_PP(tmp);
|
||||
domain_name_len = Z_STRSIZE_PP(tmp);
|
||||
}
|
||||
|
||||
if (SUCCESS == zend_hash_find(HASH_OF(server_params),
|
||||
"Flags", sizeof("Flags"), (void**)&tmp)) {
|
||||
convert_to_long_ex(tmp);
|
||||
ctx = (CLSCTX)Z_LVAL_PP(tmp);
|
||||
convert_to_int_ex(tmp);
|
||||
ctx = (CLSCTX)Z_IVAL_PP(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,15 +288,15 @@ PHP_FUNCTION(com_get_active_object)
|
||||
{
|
||||
CLSID clsid;
|
||||
char *module_name;
|
||||
int module_name_len;
|
||||
long code_page = COMG(code_page);
|
||||
php_size_t module_name_len;
|
||||
php_int_t code_page = COMG(code_page);
|
||||
IUnknown *unk = NULL;
|
||||
IDispatch *obj = NULL;
|
||||
HRESULT res;
|
||||
OLECHAR *module = NULL;
|
||||
|
||||
php_com_initialize(TSRMLS_C);
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l",
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i",
|
||||
&module_name, &module_name_len, &code_page)) {
|
||||
php_com_throw_exception(E_INVALIDARG, "Invalid arguments!" TSRMLS_CC);
|
||||
return;
|
||||
@@ -349,7 +349,7 @@ HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
|
||||
|
||||
if (silent == 0 && FAILED(hr)) {
|
||||
char *source = NULL, *desc = NULL, *msg = NULL;
|
||||
int source_len, desc_len;
|
||||
php_size_t source_len, desc_len;
|
||||
|
||||
switch (hr) {
|
||||
case DISP_E_EXCEPTION:
|
||||
@@ -416,7 +416,7 @@ HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
|
||||
|
||||
/* map an ID to a name */
|
||||
HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
|
||||
int namelen, DISPID *dispid TSRMLS_DC)
|
||||
php_size_t namelen, DISPID *dispid TSRMLS_DC)
|
||||
{
|
||||
OLECHAR *olename;
|
||||
HRESULT hr;
|
||||
@@ -461,7 +461,7 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
|
||||
}
|
||||
|
||||
/* the core of COM */
|
||||
int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
|
||||
int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, php_size_t namelen,
|
||||
WORD flags, VARIANT *v, int nargs, zval ***args TSRMLS_DC)
|
||||
{
|
||||
DISPID dispid, altdispid;
|
||||
@@ -629,7 +629,7 @@ int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
|
||||
return SUCCEEDED(hr) ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
|
||||
int php_com_do_invoke(php_com_dotnet_object *obj, char *name, php_size_t namelen,
|
||||
WORD flags, VARIANT *v, int nargs, zval **args, int allow_noarg TSRMLS_DC)
|
||||
{
|
||||
DISPID dispid;
|
||||
@@ -665,7 +665,7 @@ PHP_FUNCTION(com_create_guid)
|
||||
php_com_initialize(TSRMLS_C);
|
||||
if (CoCreateGuid(&retval) == S_OK && StringFromCLSID(&retval, &guid_string) == S_OK) {
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
Z_STRVAL_P(return_value) = php_com_olestring_to_string(guid_string, &Z_STRLEN_P(return_value), CP_ACP TSRMLS_CC);
|
||||
Z_STRVAL_P(return_value) = php_com_olestring_to_string(guid_string, &Z_STRSIZE_P(return_value), CP_ACP TSRMLS_CC);
|
||||
|
||||
CoTaskMemFree(guid_string);
|
||||
} else {
|
||||
@@ -742,12 +742,12 @@ PHP_FUNCTION(com_print_typeinfo)
|
||||
zval *arg1;
|
||||
char *ifacename = NULL;
|
||||
char *typelibname = NULL;
|
||||
int ifacelen;
|
||||
php_size_t ifacelen;
|
||||
zend_bool wantsink = 0;
|
||||
php_com_dotnet_object *obj = NULL;
|
||||
ITypeInfo *typeinfo;
|
||||
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|s!b", &arg1, &ifacename,
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|S!b", &arg1, &ifacename,
|
||||
&ifacelen, &wantsink)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -776,11 +776,11 @@ PHP_FUNCTION(com_print_typeinfo)
|
||||
Process COM messages, sleeping for up to timeoutms milliseconds */
|
||||
PHP_FUNCTION(com_message_pump)
|
||||
{
|
||||
long timeoutms = 0;
|
||||
php_int_t timeoutms = 0;
|
||||
MSG msg;
|
||||
DWORD result;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &timeoutms) == FAILURE)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &timeoutms) == FAILURE)
|
||||
RETURN_FALSE;
|
||||
|
||||
php_com_initialize(TSRMLS_C);
|
||||
@@ -805,13 +805,13 @@ PHP_FUNCTION(com_message_pump)
|
||||
PHP_FUNCTION(com_load_typelib)
|
||||
{
|
||||
char *name;
|
||||
int namelen;
|
||||
php_size_t namelen;
|
||||
ITypeLib *pTL = NULL;
|
||||
zend_bool cs = TRUE;
|
||||
int codepage = COMG(code_page);
|
||||
php_int_t codepage = COMG(code_page);
|
||||
int cached = 0;
|
||||
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &name, &namelen, &cs)) {
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &name, &namelen, &cs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
|
||||
zval *object = getThis();
|
||||
php_com_dotnet_object *obj;
|
||||
char *assembly_name, *datatype_name;
|
||||
int assembly_name_len, datatype_name_len;
|
||||
php_size_t assembly_name_len, datatype_name_len;
|
||||
struct dotnet_runtime_stuff *stuff;
|
||||
OLECHAR *oleassembly, *oletype;
|
||||
BSTR oleassembly_sys, oletype_sys;
|
||||
@@ -216,7 +216,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
|
||||
|
||||
obj = CDNO_FETCH(object);
|
||||
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l",
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|i",
|
||||
&assembly_name, &assembly_name_len,
|
||||
&datatype_name, &datatype_name_len,
|
||||
&obj->code_page)) {
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <intsafe.h>
|
||||
|
||||
#include "php.h"
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/info.h"
|
||||
@@ -381,7 +383,13 @@ PHP_MINIT_FUNCTION(com_dotnet)
|
||||
|
||||
REGISTER_INI_ENTRIES();
|
||||
|
||||
#define COM_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT)
|
||||
#define COM_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT)
|
||||
|
||||
#define COM_ERR_CONST(x) { \
|
||||
php_int_t __tmp; \
|
||||
ULongToUIntPtr(x, &__tmp); \
|
||||
REGISTER_INT_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \
|
||||
}
|
||||
|
||||
COM_CONST(CLSCTX_INPROC_SERVER);
|
||||
COM_CONST(CLSCTX_INPROC_HANDLER);
|
||||
@@ -441,10 +449,10 @@ PHP_MINIT_FUNCTION(com_dotnet)
|
||||
#ifdef NORM_IGNOREKASHIDA
|
||||
COM_CONST(NORM_IGNOREKASHIDA);
|
||||
#endif
|
||||
COM_CONST(DISP_E_DIVBYZERO);
|
||||
COM_CONST(DISP_E_OVERFLOW);
|
||||
COM_CONST(DISP_E_BADINDEX);
|
||||
COM_CONST(MK_E_UNAVAILABLE);
|
||||
COM_ERR_CONST(DISP_E_DIVBYZERO);
|
||||
COM_ERR_CONST(DISP_E_OVERFLOW);
|
||||
COM_ERR_CONST(DISP_E_BADINDEX);
|
||||
COM_ERR_CONST(MK_E_UNAVAILABLE);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ static zval *com_property_read(zval *object, zval *member, int type, const zend_
|
||||
|
||||
convert_to_string_ex(&member);
|
||||
|
||||
res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
|
||||
res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member),
|
||||
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1 TSRMLS_CC);
|
||||
|
||||
if (res == SUCCESS) {
|
||||
@@ -75,7 +75,7 @@ static void com_property_write(zval *object, zval *member, zval *value, const ze
|
||||
VariantInit(&v);
|
||||
|
||||
convert_to_string_ex(&member);
|
||||
if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
|
||||
if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member),
|
||||
DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF, &v, 1, &value, 0 TSRMLS_CC)) {
|
||||
VariantClear(&v);
|
||||
}
|
||||
@@ -106,10 +106,10 @@ static zval *com_read_dimension(zval *object, zval *offset, int type TSRMLS_DC)
|
||||
VariantClear(&v);
|
||||
}
|
||||
} else if (V_ISARRAY(&obj->v)) {
|
||||
convert_to_long(offset);
|
||||
convert_to_int(offset);
|
||||
|
||||
if (SafeArrayGetDim(V_ARRAY(&obj->v)) == 1) {
|
||||
if (php_com_safearray_get_elem(&obj->v, &v, Z_LVAL_P(offset) TSRMLS_CC)) {
|
||||
if (php_com_safearray_get_elem(&obj->v, &v, Z_IVAL_P(offset) TSRMLS_CC)) {
|
||||
php_com_wrap_variant(return_value, &v, obj->code_page TSRMLS_CC);
|
||||
VariantClear(&v);
|
||||
}
|
||||
@@ -152,8 +152,8 @@ static void com_write_dimension(zval *object, zval *offset, zval *value TSRMLS_D
|
||||
vt = V_VT(&obj->v) & ~VT_ARRAY;
|
||||
}
|
||||
|
||||
convert_to_long(offset);
|
||||
indices = Z_LVAL_P(offset);
|
||||
convert_to_int(offset);
|
||||
indices = Z_IVAL_P(offset);
|
||||
|
||||
VariantInit(&v);
|
||||
php_com_variant_from_zval(&v, value, obj->code_page TSRMLS_CC);
|
||||
@@ -205,7 +205,7 @@ static int com_property_exists(zval *object, zval *member, int check_empty, cons
|
||||
|
||||
if (V_VT(&obj->v) == VT_DISPATCH) {
|
||||
convert_to_string_ex(&member);
|
||||
if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), &dispid TSRMLS_CC))) {
|
||||
if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member), &dispid TSRMLS_CC))) {
|
||||
/* TODO: distinguish between property and method! */
|
||||
return 1;
|
||||
}
|
||||
@@ -259,7 +259,7 @@ static PHP_FUNCTION(com_method_handler)
|
||||
INTERNAL_FUNCTION_PARAM_PASSTHRU);
|
||||
}
|
||||
|
||||
static union _zend_function *com_method_get(zval **object_ptr, char *name, int len, const zend_literal *key TSRMLS_DC)
|
||||
static union _zend_function *com_method_get(zval **object_ptr, char *name, php_size_t len, const zend_literal *key TSRMLS_DC)
|
||||
{
|
||||
zend_internal_function f, *fptr = NULL;
|
||||
php_com_dotnet_object *obj;
|
||||
@@ -442,7 +442,7 @@ static zend_class_entry *com_class_entry_get(const zval *object TSRMLS_DC)
|
||||
return obj->ce;
|
||||
}
|
||||
|
||||
static int com_class_name_get(const zval *object, const char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
|
||||
static int com_class_name_get(const zval *object, const char **class_name, php_size_t *class_name_len, int parent TSRMLS_DC)
|
||||
{
|
||||
php_com_dotnet_object *obj;
|
||||
obj = CDNO_FETCH(object);
|
||||
@@ -507,7 +507,7 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC)
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
case IS_LONG:
|
||||
case IS_INT:
|
||||
vt = VT_INT;
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
@@ -540,7 +540,7 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC)
|
||||
return zend_std_cast_object_tostring(readobj, writeobj, type TSRMLS_CC);
|
||||
}
|
||||
|
||||
static int com_object_count(zval *object, long *count TSRMLS_DC)
|
||||
static int com_object_count(zval *object, php_int_t *count TSRMLS_DC)
|
||||
{
|
||||
php_com_dotnet_object *obj;
|
||||
LONG ubound = 0, lbound = 0;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
struct php_com_iterator {
|
||||
zend_object_iterator iter;
|
||||
IEnumVARIANT *ev;
|
||||
ulong key;
|
||||
php_uint_t key;
|
||||
VARIANT v; /* cached element */
|
||||
int code_page;
|
||||
VARIANT safe_array;
|
||||
@@ -78,10 +78,10 @@ static void com_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_DC)
|
||||
{
|
||||
struct php_com_iterator *I = (struct php_com_iterator*)iter->data;
|
||||
|
||||
if (I->key == (ulong)-1) {
|
||||
if (I->key == (php_uint_t)-1) {
|
||||
ZVAL_NULL(key);
|
||||
} else {
|
||||
ZVAL_LONG(key, I->key);
|
||||
ZVAL_INT(key, I->key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <intsafe.h>
|
||||
|
||||
#include "php.h"
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/info.h"
|
||||
@@ -32,18 +34,20 @@
|
||||
void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC)
|
||||
{
|
||||
int free_msg = 0;
|
||||
php_uint_t cd;
|
||||
if (message == NULL) {
|
||||
message = php_win32_error_to_msg(code);
|
||||
free_msg = 1;
|
||||
}
|
||||
zend_throw_exception(php_com_exception_class_entry, message, (long)code TSRMLS_CC);
|
||||
ULongToUIntPtr(code, &cd);
|
||||
zend_throw_exception(php_com_exception_class_entry, message, (php_int_t)cd TSRMLS_CC);
|
||||
if (free_msg) {
|
||||
LocalFree(message);
|
||||
}
|
||||
}
|
||||
|
||||
PHP_COM_DOTNET_API void php_com_wrap_dispatch(zval *z, IDispatch *disp,
|
||||
int codepage TSRMLS_DC)
|
||||
php_int_t codepage TSRMLS_DC)
|
||||
{
|
||||
php_com_dotnet_object *obj;
|
||||
|
||||
@@ -66,7 +70,7 @@ PHP_COM_DOTNET_API void php_com_wrap_dispatch(zval *z, IDispatch *disp,
|
||||
}
|
||||
|
||||
PHP_COM_DOTNET_API void php_com_wrap_variant(zval *z, VARIANT *v,
|
||||
int codepage TSRMLS_DC)
|
||||
php_int_t codepage TSRMLS_DC)
|
||||
{
|
||||
php_com_dotnet_object *obj;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "php_com_dotnet_internal.h"
|
||||
|
||||
|
||||
PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string, uint string_len, int codepage TSRMLS_DC)
|
||||
PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string, php_size_t string_len, php_int_t codepage TSRMLS_DC)
|
||||
{
|
||||
OLECHAR *olestring = NULL;
|
||||
DWORD flags = codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED | MB_ERR_INVALID_CHARS;
|
||||
@@ -71,7 +71,7 @@ PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string, uint strin
|
||||
return olestring;
|
||||
}
|
||||
|
||||
PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring, uint *string_len, int codepage TSRMLS_DC)
|
||||
PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring, php_size_t *string_len, php_int_t codepage TSRMLS_DC)
|
||||
{
|
||||
char *string;
|
||||
uint length = 0;
|
||||
|
||||
@@ -349,7 +349,7 @@ CPH_METHOD(GetCurFileName)
|
||||
if (res == S_OK) {
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
Z_STRVAL_P(return_value) = php_com_olestring_to_string(olename,
|
||||
&Z_STRLEN_P(return_value), helper->codepage TSRMLS_CC);
|
||||
&Z_STRSIZE_P(return_value), helper->codepage TSRMLS_CC);
|
||||
CoTaskMemFree(olename);
|
||||
return;
|
||||
} else if (res == S_FALSE) {
|
||||
@@ -370,7 +370,7 @@ CPH_METHOD(SaveToFile)
|
||||
{
|
||||
HRESULT res;
|
||||
char *filename, *fullpath = NULL;
|
||||
int filename_len;
|
||||
php_size_t filename_len;
|
||||
zend_bool remember = TRUE;
|
||||
OLECHAR *olefilename = NULL;
|
||||
CPH_FETCH();
|
||||
@@ -379,7 +379,7 @@ CPH_METHOD(SaveToFile)
|
||||
|
||||
res = get_persist_file(helper);
|
||||
if (helper->ipf) {
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p!|b",
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P!|b",
|
||||
&filename, &filename_len, &remember)) {
|
||||
php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC);
|
||||
return;
|
||||
@@ -433,8 +433,8 @@ CPH_METHOD(LoadFromFile)
|
||||
{
|
||||
HRESULT res;
|
||||
char *filename, *fullpath;
|
||||
int filename_len;
|
||||
long flags = 0;
|
||||
php_size_t filename_len;
|
||||
php_int_t flags = 0;
|
||||
OLECHAR *olefilename;
|
||||
CPH_FETCH();
|
||||
|
||||
@@ -443,7 +443,7 @@ CPH_METHOD(LoadFromFile)
|
||||
res = get_persist_file(helper);
|
||||
if (helper->ipf) {
|
||||
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l",
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|i",
|
||||
&filename, &filename_len, &flags)) {
|
||||
php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC);
|
||||
return;
|
||||
@@ -501,7 +501,7 @@ CPH_METHOD(GetMaxStreamSize)
|
||||
php_com_throw_exception(res, NULL TSRMLS_CC);
|
||||
} else {
|
||||
/* TODO: handle 64 bit properly */
|
||||
RETURN_LONG((LONG)size.QuadPart);
|
||||
RETURN_INT((php_int_t)size.QuadPart);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -118,7 +118,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type TSRMLS_
|
||||
VariantInit(&v);
|
||||
|
||||
res = php_com_do_invoke(proxy->obj, Z_STRVAL_P(proxy->indices[0]),
|
||||
Z_STRLEN_P(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v,
|
||||
Z_STRSIZE_P(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v,
|
||||
proxy->dimensions, args, 0 TSRMLS_CC);
|
||||
|
||||
if (res == SUCCESS) {
|
||||
@@ -139,7 +139,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type TSRMLS_
|
||||
/* the SafeArray case */
|
||||
|
||||
/* offset/index must be an integer */
|
||||
convert_to_long(offset);
|
||||
convert_to_int(offset);
|
||||
|
||||
sa = V_ARRAY(&proxy->obj->v);
|
||||
dims = SafeArrayGetDim(sa);
|
||||
@@ -154,7 +154,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type TSRMLS_
|
||||
SafeArrayGetLBound(sa, proxy->dimensions, &lbound);
|
||||
SafeArrayGetUBound(sa, proxy->dimensions, &ubound);
|
||||
|
||||
if (Z_LVAL_P(offset) < lbound || Z_LVAL_P(offset) > ubound) {
|
||||
if (Z_IVAL_P(offset) < lbound || Z_IVAL_P(offset) > ubound) {
|
||||
php_com_throw_exception(DISP_E_BADINDEX, "index out of bounds" TSRMLS_CC);
|
||||
return return_value;
|
||||
}
|
||||
@@ -171,12 +171,12 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type TSRMLS_
|
||||
|
||||
/* copy indices from proxy */
|
||||
for (i = 0; i < dims; i++) {
|
||||
convert_to_long(proxy->indices[i]);
|
||||
indices[i] = Z_LVAL_P(proxy->indices[i]);
|
||||
convert_to_int(proxy->indices[i]);
|
||||
indices[i] = Z_IVAL_P(proxy->indices[i]);
|
||||
}
|
||||
|
||||
/* add user-supplied index */
|
||||
indices[dims-1] = Z_LVAL_P(offset);
|
||||
indices[dims-1] = Z_IVAL_P(offset);
|
||||
|
||||
/* now fetch the value */
|
||||
if (FAILED(SafeArrayGetVartype(sa, &vt)) || vt == VT_EMPTY) {
|
||||
@@ -230,7 +230,7 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM
|
||||
convert_to_string(proxy->indices[0]);
|
||||
VariantInit(&v);
|
||||
if (SUCCESS == php_com_do_invoke(proxy->obj, Z_STRVAL_P(proxy->indices[0]),
|
||||
Z_STRLEN_P(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1,
|
||||
Z_STRSIZE_P(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1,
|
||||
args, 0 TSRMLS_CC)) {
|
||||
VariantClear(&v);
|
||||
}
|
||||
@@ -245,13 +245,13 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM
|
||||
indices = safe_emalloc(dims, sizeof(LONG), 0);
|
||||
/* copy indices from proxy */
|
||||
for (i = 0; i < dims; i++) {
|
||||
convert_to_long(proxy->indices[i]);
|
||||
indices[i] = Z_LVAL_P(proxy->indices[i]);
|
||||
convert_to_int(proxy->indices[i]);
|
||||
indices[i] = Z_IVAL_P(proxy->indices[i]);
|
||||
}
|
||||
|
||||
/* add user-supplied index */
|
||||
convert_to_long(offset);
|
||||
indices[dims-1] = Z_LVAL_P(offset);
|
||||
convert_to_int(offset);
|
||||
indices[dims-1] = Z_IVAL_P(offset);
|
||||
|
||||
if (FAILED(SafeArrayGetVartype(V_ARRAY(&proxy->obj->v), &vt)) || vt == VT_EMPTY) {
|
||||
vt = V_VT(&proxy->obj->v) & ~VT_ARRAY;
|
||||
@@ -321,7 +321,7 @@ static HashTable *saproxy_properties_get(zval *object TSRMLS_DC)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static union _zend_function *saproxy_method_get(zval **object, const char *name, int len, const zend_literal *key TSRMLS_DC)
|
||||
static union _zend_function *saproxy_method_get(zval **object, const char *name, php_size_t len, const zend_literal *key TSRMLS_DC)
|
||||
{
|
||||
/* no methods */
|
||||
return NULL;
|
||||
@@ -343,7 +343,7 @@ static zend_class_entry *saproxy_class_entry_get(const zval *object TSRMLS_DC)
|
||||
return php_com_saproxy_class_entry;
|
||||
}
|
||||
|
||||
static int saproxy_class_name_get(const zval *object, const char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
|
||||
static int saproxy_class_name_get(const zval *object, const char **class_name, php_size_t *class_name_len, int parent TSRMLS_DC)
|
||||
{
|
||||
*class_name = estrndup(php_com_saproxy_class_entry->name, php_com_saproxy_class_entry->name_length);
|
||||
*class_name_len = php_com_saproxy_class_entry->name_length;
|
||||
@@ -360,7 +360,7 @@ static int saproxy_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
static int saproxy_count_elements(zval *object, long *count TSRMLS_DC)
|
||||
static int saproxy_count_elements(zval *object, php_int_t *count TSRMLS_DC)
|
||||
{
|
||||
php_com_saproxy *proxy = SA_FETCH(object);
|
||||
LONG ubound, lbound;
|
||||
@@ -526,7 +526,7 @@ static void saproxy_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_DC
|
||||
if (I->key == -1) {
|
||||
ZVAL_NULL(key);
|
||||
} else {
|
||||
ZVAL_LONG(key, I->key);
|
||||
ZVAL_INT(key, I->key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -571,8 +571,8 @@ zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *objec
|
||||
|
||||
I->indices = safe_emalloc(proxy->dimensions + 1, sizeof(LONG), 0);
|
||||
for (i = 0; i < proxy->dimensions; i++) {
|
||||
convert_to_long(proxy->indices[i]);
|
||||
I->indices[i] = Z_LVAL_P(proxy->indices[i]);
|
||||
convert_to_int(proxy->indices[i]);
|
||||
I->indices[i] = Z_IVAL_P(proxy->indices[i]);
|
||||
}
|
||||
|
||||
SafeArrayGetLBound(V_ARRAY(&proxy->obj->v), proxy->dimensions, &I->imin);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
* b) a CLSID, major, minor e.g. "{00000200-0000-0010-8000-00AA006D2EA4},2,0"
|
||||
* c) a Type Library name e.g. "Microsoft OLE DB ActiveX Data Objects 1.0 Library"
|
||||
*/
|
||||
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codepage TSRMLS_DC)
|
||||
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, php_int_t codepage TSRMLS_DC)
|
||||
{
|
||||
ITypeLib *TL = NULL;
|
||||
char *strtok_buf, *major, *minor;
|
||||
@@ -153,7 +153,7 @@ PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codep
|
||||
}
|
||||
|
||||
/* Given a type-library, merge it into the current engine state */
|
||||
PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepage TSRMLS_DC)
|
||||
PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, php_int_t codepage TSRMLS_DC)
|
||||
{
|
||||
int i, j, interfaces;
|
||||
TYPEKIND pTKind;
|
||||
@@ -206,10 +206,10 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa
|
||||
|
||||
/* register the constant */
|
||||
php_com_zval_from_variant(&value, pVarDesc->lpvarValue, codepage TSRMLS_CC);
|
||||
if (Z_TYPE(value) == IS_LONG) {
|
||||
if (Z_TYPE(value) == IS_INT) {
|
||||
c.flags = mode;
|
||||
c.value.type = IS_LONG;
|
||||
c.value.value.lval = Z_LVAL(value);
|
||||
c.value.type = IS_INT;
|
||||
c.value.value.lval = Z_IVAL(value);
|
||||
c.module_number = 0;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
}
|
||||
@@ -229,12 +229,12 @@ void php_com_typelibrary_dtor(void *pDest)
|
||||
}
|
||||
|
||||
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string,
|
||||
int codepage, int *cached TSRMLS_DC)
|
||||
php_int_t codepage, int *cached TSRMLS_DC)
|
||||
{
|
||||
ITypeLib **TLp;
|
||||
ITypeLib *TL;
|
||||
char *name_dup;
|
||||
int l;
|
||||
php_size_t l;
|
||||
|
||||
l = strlen(search_string);
|
||||
|
||||
@@ -431,14 +431,14 @@ static char *php_com_string_from_clsid(const CLSID *clsid, int codepage TSRMLS_D
|
||||
}
|
||||
|
||||
|
||||
int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid, int codepage TSRMLS_DC)
|
||||
int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid, php_int_t codepage TSRMLS_DC)
|
||||
{
|
||||
TYPEATTR *attr;
|
||||
FUNCDESC *func;
|
||||
int i;
|
||||
OLECHAR *olename;
|
||||
char *ansiname = NULL;
|
||||
unsigned int ansinamelen;
|
||||
php_size_t ansinamelen;
|
||||
int ret = 0;
|
||||
|
||||
if (FAILED(ITypeInfo_GetTypeAttr(typeinfo, &attr))) {
|
||||
@@ -492,7 +492,8 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
|
||||
if (printdef) {
|
||||
int j;
|
||||
char *funcdesc;
|
||||
unsigned int funcdesclen, cnames = 0;
|
||||
php_size_t funcdesclen;
|
||||
UINT cnames = 0;
|
||||
BSTR *names;
|
||||
|
||||
names = (BSTR*)safe_emalloc((func->cParams + 1), sizeof(BSTR), 0);
|
||||
|
||||
@@ -32,16 +32,16 @@
|
||||
* Only creates a single-dimensional array of variants.
|
||||
* The keys of the PHP hash MUST be numeric. If the array
|
||||
* is sparse, then the gaps will be filled with NULL variants */
|
||||
static void safe_array_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC)
|
||||
static void safe_array_from_zval(VARIANT *v, zval *z, php_int_t codepage TSRMLS_DC)
|
||||
{
|
||||
SAFEARRAY *sa = NULL;
|
||||
SAFEARRAYBOUND bound;
|
||||
HashPosition pos;
|
||||
int keytype;
|
||||
char *strindex;
|
||||
int strindexlen;
|
||||
long intindex = -1;
|
||||
long max_index = 0;
|
||||
php_size_t strindexlen;
|
||||
php_int_t intindex = -1;
|
||||
php_int_t max_index = 0;
|
||||
VARIANT *va;
|
||||
zval **item;
|
||||
|
||||
@@ -98,7 +98,7 @@ bogus:
|
||||
}
|
||||
}
|
||||
|
||||
PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC)
|
||||
PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, php_int_t codepage TSRMLS_DC)
|
||||
{
|
||||
OLECHAR *olestring;
|
||||
php_com_dotnet_object *obj;
|
||||
@@ -141,9 +141,9 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep
|
||||
safe_array_from_zval(v, z, codepage TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case IS_LONG:
|
||||
case IS_INT:
|
||||
V_VT(v) = VT_I4;
|
||||
V_I4(v) = Z_LVAL_P(z);
|
||||
V_I4(v) = Z_IVAL_P(z);
|
||||
break;
|
||||
|
||||
case IS_DOUBLE:
|
||||
@@ -153,11 +153,11 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep
|
||||
|
||||
case IS_STRING:
|
||||
V_VT(v) = VT_BSTR;
|
||||
olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRLEN_P(z), codepage TSRMLS_CC);
|
||||
olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRSIZE_P(z), codepage TSRMLS_CC);
|
||||
if (CP_UTF8 == codepage) {
|
||||
V_BSTR(v) = SysAllocStringByteLen((char*)olestring, wcslen(olestring) * sizeof(OLECHAR));
|
||||
} else {
|
||||
V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRLEN_P(z) * sizeof(OLECHAR));
|
||||
V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRSIZE_P(z) * sizeof(OLECHAR));
|
||||
}
|
||||
efree(olestring);
|
||||
break;
|
||||
@@ -171,7 +171,7 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep
|
||||
}
|
||||
}
|
||||
|
||||
PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC)
|
||||
PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, php_int_t codepage TSRMLS_DC)
|
||||
{
|
||||
OLECHAR *olestring = NULL;
|
||||
int ret = SUCCESS;
|
||||
@@ -183,28 +183,28 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa
|
||||
ZVAL_NULL(z);
|
||||
break;
|
||||
case VT_UI1:
|
||||
ZVAL_LONG(z, (long)V_UI1(v));
|
||||
ZVAL_INT(z, (php_int_t)V_UI1(v));
|
||||
break;
|
||||
case VT_I1:
|
||||
ZVAL_LONG(z, (long)V_I1(v));
|
||||
ZVAL_INT(z, (php_int_t)V_I1(v));
|
||||
break;
|
||||
case VT_UI2:
|
||||
ZVAL_LONG(z, (long)V_UI2(v));
|
||||
ZVAL_INT(z, (php_int_t)V_UI2(v));
|
||||
break;
|
||||
case VT_I2:
|
||||
ZVAL_LONG(z, (long)V_I2(v));
|
||||
ZVAL_INT(z, (php_int_t)V_I2(v));
|
||||
break;
|
||||
case VT_UI4: /* TODO: promote to double if large? */
|
||||
ZVAL_LONG(z, (long)V_UI4(v));
|
||||
ZVAL_INT(z, (php_int_t)V_UI4(v));
|
||||
break;
|
||||
case VT_I4:
|
||||
ZVAL_LONG(z, (long)V_I4(v));
|
||||
ZVAL_INT(z, (php_int_t)V_I4(v));
|
||||
break;
|
||||
case VT_INT:
|
||||
ZVAL_LONG(z, V_INT(v));
|
||||
ZVAL_INT(z, V_INT(v));
|
||||
break;
|
||||
case VT_UINT: /* TODO: promote to double if large? */
|
||||
ZVAL_LONG(z, (long)V_UINT(v));
|
||||
ZVAL_INT(z, (php_int_t)V_UINT(v));
|
||||
break;
|
||||
case VT_R4:
|
||||
ZVAL_DOUBLE(z, (double)V_R4(v));
|
||||
@@ -220,7 +220,7 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa
|
||||
if (olestring) {
|
||||
Z_TYPE_P(z) = IS_STRING;
|
||||
Z_STRVAL_P(z) = php_com_olestring_to_string(olestring,
|
||||
&Z_STRLEN_P(z), codepage TSRMLS_CC);
|
||||
&Z_STRSIZE_P(z), codepage TSRMLS_CC);
|
||||
olestring = NULL;
|
||||
}
|
||||
break;
|
||||
@@ -399,8 +399,8 @@ PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar TSR
|
||||
/* {{{ com_variant_create_instance - ctor for new VARIANT() */
|
||||
PHP_FUNCTION(com_variant_create_instance)
|
||||
{
|
||||
/* VARTYPE == unsigned short */ long vt = VT_EMPTY;
|
||||
long codepage = CP_ACP;
|
||||
/* VARTYPE == unsigned short */ php_int_t vt = VT_EMPTY;
|
||||
php_int_t codepage = CP_ACP;
|
||||
zval *object = getThis();
|
||||
php_com_dotnet_object *obj;
|
||||
zval *zvalue = NULL;
|
||||
@@ -414,7 +414,7 @@ PHP_FUNCTION(com_variant_create_instance)
|
||||
obj = CDNO_FETCH(object);
|
||||
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"z!|ll", &zvalue, &vt, &codepage)) {
|
||||
"z!|ii", &zvalue, &vt, &codepage)) {
|
||||
php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
@@ -437,7 +437,7 @@ PHP_FUNCTION(com_variant_create_instance)
|
||||
but will probably fail (original behavior)
|
||||
*/
|
||||
if ((vt & VT_ARRAY) && (V_VT(&obj->v) & VT_ARRAY)) {
|
||||
long orig_vt = vt;
|
||||
php_int_t orig_vt = vt;
|
||||
|
||||
vt &= ~VT_ARRAY;
|
||||
if (vt) {
|
||||
@@ -519,7 +519,7 @@ static void variant_binary_operation(enum variant_binary_opcode op, INTERNAL_FUN
|
||||
zval *zleft = NULL, *zright = NULL;
|
||||
php_com_dotnet_object *obj;
|
||||
HRESULT result;
|
||||
int codepage = CP_ACP;
|
||||
php_int_t codepage = CP_ACP;
|
||||
|
||||
VariantInit(&left_val);
|
||||
VariantInit(&right_val);
|
||||
@@ -727,7 +727,7 @@ static void variant_unary_operation(enum variant_unary_opcode op, INTERNAL_FUNCT
|
||||
zval *zleft = NULL;
|
||||
php_com_dotnet_object *obj;
|
||||
HRESULT result;
|
||||
int codepage = CP_ACP;
|
||||
php_int_t codepage = CP_ACP;
|
||||
|
||||
VariantInit(&left_val);
|
||||
VariantInit(&vres);
|
||||
@@ -824,18 +824,18 @@ PHP_FUNCTION(variant_round)
|
||||
VARIANT *vleft = NULL;
|
||||
zval *zleft = NULL;
|
||||
php_com_dotnet_object *obj;
|
||||
int codepage = CP_ACP;
|
||||
long decimals = 0;
|
||||
php_int_t codepage = CP_ACP;
|
||||
php_int_t decimals = 0;
|
||||
|
||||
VariantInit(&left_val);
|
||||
VariantInit(&vres);
|
||||
|
||||
if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
|
||||
ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &zleft, php_com_variant_class_entry, &decimals)) {
|
||||
ZEND_NUM_ARGS() TSRMLS_CC, "Oi", &zleft, php_com_variant_class_entry, &decimals)) {
|
||||
obj = CDNO_FETCH(zleft);
|
||||
vleft = &obj->v;
|
||||
} else if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"z!l", &zleft, &decimals)) {
|
||||
"z!i", &zleft, &decimals)) {
|
||||
vleft = &left_val;
|
||||
php_com_variant_from_zval(vleft, zleft, codepage TSRMLS_CC);
|
||||
} else {
|
||||
@@ -859,9 +859,9 @@ PHP_FUNCTION(variant_cmp)
|
||||
VARIANT *vleft = NULL, *vright = NULL;
|
||||
zval *zleft = NULL, *zright = NULL;
|
||||
php_com_dotnet_object *obj;
|
||||
int codepage = CP_ACP;
|
||||
long lcid = LOCALE_SYSTEM_DEFAULT;
|
||||
long flags = 0;
|
||||
php_int_t codepage = CP_ACP;
|
||||
php_int_t lcid = LOCALE_SYSTEM_DEFAULT;
|
||||
php_int_t flags = 0;
|
||||
/* it is safe to ignore the warning for this line; see the comments in com_handlers.c */
|
||||
STDAPI VarCmp(LPVARIANT pvarLeft, LPVARIANT pvarRight, LCID lcid, DWORD flags);
|
||||
|
||||
@@ -869,28 +869,28 @@ PHP_FUNCTION(variant_cmp)
|
||||
VariantInit(&right_val);
|
||||
|
||||
if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
|
||||
ZEND_NUM_ARGS() TSRMLS_CC, "OO|ll", &zleft, php_com_variant_class_entry,
|
||||
ZEND_NUM_ARGS() TSRMLS_CC, "OO|ii", &zleft, php_com_variant_class_entry,
|
||||
&zright, php_com_variant_class_entry, &lcid, &flags)) {
|
||||
obj = CDNO_FETCH(zleft);
|
||||
vleft = &obj->v;
|
||||
obj = CDNO_FETCH(zright);
|
||||
vright = &obj->v;
|
||||
} else if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
|
||||
ZEND_NUM_ARGS() TSRMLS_CC, "Oz!|ll", &zleft, php_com_variant_class_entry,
|
||||
ZEND_NUM_ARGS() TSRMLS_CC, "Oz!|ii", &zleft, php_com_variant_class_entry,
|
||||
&zright, &lcid, &flags)) {
|
||||
obj = CDNO_FETCH(zleft);
|
||||
vleft = &obj->v;
|
||||
vright = &right_val;
|
||||
php_com_variant_from_zval(vright, zright, codepage TSRMLS_CC);
|
||||
} else if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
|
||||
ZEND_NUM_ARGS() TSRMLS_CC, "z!O|ll", &zleft, &zright, php_com_variant_class_entry,
|
||||
ZEND_NUM_ARGS() TSRMLS_CC, "z!O|ii", &zleft, &zright, php_com_variant_class_entry,
|
||||
&lcid, &flags)) {
|
||||
obj = CDNO_FETCH(zright);
|
||||
vright = &obj->v;
|
||||
vleft = &left_val;
|
||||
php_com_variant_from_zval(vleft, zleft, codepage TSRMLS_CC);
|
||||
} else if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"z!z!|ll", &zleft, &zright, &lcid, &flags)) {
|
||||
"z!z!|ii", &zleft, &zright, &lcid, &flags)) {
|
||||
|
||||
vleft = &left_val;
|
||||
php_com_variant_from_zval(vleft, zleft, codepage TSRMLS_CC);
|
||||
@@ -902,7 +902,7 @@ PHP_FUNCTION(variant_cmp)
|
||||
return;
|
||||
}
|
||||
|
||||
ZVAL_LONG(return_value, VarCmp(vleft, vright, lcid, flags));
|
||||
ZVAL_INT(return_value, VarCmp(vleft, vright, lcid, flags));
|
||||
|
||||
VariantClear(&left_val);
|
||||
VariantClear(&right_val);
|
||||
@@ -941,7 +941,7 @@ PHP_FUNCTION(variant_date_to_timestamp)
|
||||
tmv.tm_isdst = -1;
|
||||
|
||||
tzset();
|
||||
RETVAL_LONG(mktime(&tmv));
|
||||
RETVAL_INT(mktime(&tmv));
|
||||
}
|
||||
|
||||
VariantClear(&vres);
|
||||
@@ -952,13 +952,13 @@ PHP_FUNCTION(variant_date_to_timestamp)
|
||||
Returns a variant date representation of a unix timestamp */
|
||||
PHP_FUNCTION(variant_date_from_timestamp)
|
||||
{
|
||||
long timestamp;
|
||||
php_int_t timestamp;
|
||||
time_t ttstamp;
|
||||
SYSTEMTIME systime;
|
||||
struct tm *tmv;
|
||||
VARIANT res;
|
||||
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l",
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i",
|
||||
×tamp)) {
|
||||
return;
|
||||
}
|
||||
@@ -1003,7 +1003,7 @@ PHP_FUNCTION(variant_get_type)
|
||||
}
|
||||
obj = CDNO_FETCH(zobj);
|
||||
|
||||
RETURN_LONG(V_VT(&obj->v));
|
||||
RETURN_INT(V_VT(&obj->v));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1013,11 +1013,11 @@ PHP_FUNCTION(variant_set_type)
|
||||
{
|
||||
zval *zobj;
|
||||
php_com_dotnet_object *obj;
|
||||
/* VARTYPE == unsigned short */ long vt;
|
||||
/* VARTYPE == unsigned short */ php_int_t vt;
|
||||
HRESULT res;
|
||||
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"Ol", &zobj, php_com_variant_class_entry, &vt)) {
|
||||
"Oi", &zobj, php_com_variant_class_entry, &vt)) {
|
||||
return;
|
||||
}
|
||||
obj = CDNO_FETCH(zobj);
|
||||
@@ -1048,12 +1048,12 @@ PHP_FUNCTION(variant_cast)
|
||||
{
|
||||
zval *zobj;
|
||||
php_com_dotnet_object *obj;
|
||||
/* VARTYPE == unsigned short */ long vt;
|
||||
/* VARTYPE == unsigned short */ php_int_t vt;
|
||||
VARIANT vres;
|
||||
HRESULT res;
|
||||
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"Ol", &zobj, php_com_variant_class_entry, &vt)) {
|
||||
"Oi", &zobj, php_com_variant_class_entry, &vt)) {
|
||||
return;
|
||||
}
|
||||
obj = CDNO_FETCH(zobj);
|
||||
|
||||
@@ -176,7 +176,7 @@ static HRESULT STDMETHODCALLTYPE disp_getidsofnames(
|
||||
|
||||
for (i = 0; i < cNames; i++) {
|
||||
char *name;
|
||||
unsigned int namelen;
|
||||
php_size_t namelen;
|
||||
zval **tmp;
|
||||
|
||||
name = php_com_olestring_to_string(rgszNames[i], &namelen, COMG(code_page) TSRMLS_CC);
|
||||
@@ -186,7 +186,7 @@ static HRESULT STDMETHODCALLTYPE disp_getidsofnames(
|
||||
ret = DISP_E_UNKNOWNNAME;
|
||||
rgDispId[i] = 0;
|
||||
} else {
|
||||
rgDispId[i] = Z_LVAL_PP(tmp);
|
||||
rgDispId[i] = Z_IVAL_PP(tmp);
|
||||
}
|
||||
|
||||
efree(name);
|
||||
@@ -220,7 +220,7 @@ static HRESULT STDMETHODCALLTYPE disp_getdispid(
|
||||
{
|
||||
HRESULT ret = DISP_E_UNKNOWNNAME;
|
||||
char *name;
|
||||
unsigned int namelen;
|
||||
php_size_t namelen;
|
||||
zval **tmp;
|
||||
FETCH_DISP("GetDispID");
|
||||
|
||||
@@ -231,7 +231,7 @@ static HRESULT STDMETHODCALLTYPE disp_getdispid(
|
||||
/* Lookup the name in the hash */
|
||||
if (zend_hash_find(disp->name_to_dispid, name, namelen+1, (void**)&tmp) == SUCCESS) {
|
||||
trace("found it\n");
|
||||
*pid = Z_LVAL_PP(tmp);
|
||||
*pid = Z_IVAL_PP(tmp);
|
||||
ret = S_OK;
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex(
|
||||
if (SUCCESS == zend_hash_index_find(disp->dispid_to_name, id, (void**)&name)) {
|
||||
/* TODO: add support for overloaded objects */
|
||||
|
||||
trace("-- Invoke: %d %20s [%d] flags=%08x args=%d\n", id, Z_STRVAL_PP(name), Z_STRLEN_PP(name), wFlags, pdp->cArgs);
|
||||
trace("-- Invoke: %d %20s [%d] flags=%08x args=%d\n", id, Z_STRVAL_PP(name), Z_STRSIZE_PP(name), wFlags, pdp->cArgs);
|
||||
|
||||
/* convert args into zvals.
|
||||
* Args are in reverse order */
|
||||
@@ -287,9 +287,9 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex(
|
||||
* and expose it as a COM exception */
|
||||
|
||||
if (wFlags & DISPATCH_PROPERTYGET) {
|
||||
retval = zend_read_property(Z_OBJCE_P(disp->object), disp->object, Z_STRVAL_PP(name), Z_STRLEN_PP(name)+1, 1 TSRMLS_CC);
|
||||
retval = zend_read_property(Z_OBJCE_P(disp->object), disp->object, Z_STRVAL_PP(name), Z_STRSIZE_PP(name)+1, 1 TSRMLS_CC);
|
||||
} else if (wFlags & DISPATCH_PROPERTYPUT) {
|
||||
zend_update_property(Z_OBJCE_P(disp->object), disp->object, Z_STRVAL_PP(name), Z_STRLEN_PP(name)+1, *params[0] TSRMLS_CC);
|
||||
zend_update_property(Z_OBJCE_P(disp->object), disp->object, Z_STRVAL_PP(name), Z_STRSIZE_PP(name)+1, *params[0] TSRMLS_CC);
|
||||
} else if (wFlags & DISPATCH_METHOD) {
|
||||
zend_try {
|
||||
if (SUCCESS == call_user_function_ex(EG(function_table), &disp->object, *name,
|
||||
@@ -389,7 +389,7 @@ static HRESULT STDMETHODCALLTYPE disp_getmembername(
|
||||
FETCH_DISP("GetMemberName");
|
||||
|
||||
if (SUCCESS == zend_hash_index_find(disp->dispid_to_name, id, (void**)&name)) {
|
||||
OLECHAR *olestr = php_com_string_to_olestring(Z_STRVAL_P(name), Z_STRLEN_P(name), COMG(code_page) TSRMLS_CC);
|
||||
OLECHAR *olestr = php_com_string_to_olestring(Z_STRVAL_P(name), Z_STRSIZE_P(name), COMG(code_page) TSRMLS_CC);
|
||||
*pbstrName = SysAllocString(olestr);
|
||||
efree(olestr);
|
||||
return S_OK;
|
||||
@@ -453,9 +453,9 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
|
||||
HashPosition pos;
|
||||
char *name = NULL;
|
||||
zval *tmp;
|
||||
int namelen;
|
||||
php_size_t namelen;
|
||||
int keytype;
|
||||
ulong pid;
|
||||
php_uint_t pid;
|
||||
|
||||
if (disp->dispid_to_name == NULL) {
|
||||
ALLOC_HASHTABLE(disp->dispid_to_name);
|
||||
@@ -471,8 +471,8 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
|
||||
zend_hash_get_current_key_ex(Z_OBJPROP_P(disp->object), &name,
|
||||
&namelen, &pid, 0, &pos))) {
|
||||
char namebuf[32];
|
||||
if (keytype == HASH_KEY_IS_LONG) {
|
||||
snprintf(namebuf, sizeof(namebuf), "%d", pid);
|
||||
if (keytype == HASH_KEY_IS_INT) {
|
||||
snprintf(namebuf, sizeof(namebuf), ZEND_UINT_FMT, pid);
|
||||
name = namebuf;
|
||||
namelen = strlen(namebuf)+1;
|
||||
}
|
||||
@@ -490,7 +490,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
|
||||
zend_hash_index_update(disp->dispid_to_name, pid, (void*)&tmp, sizeof(zval *), NULL);
|
||||
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_LONG(tmp, pid);
|
||||
ZVAL_INT(tmp, pid);
|
||||
zend_hash_update(disp->name_to_dispid, name, namelen, (void*)&tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
}
|
||||
@@ -503,7 +503,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
|
||||
&name, &namelen, &pid, 0, &pos))) {
|
||||
|
||||
char namebuf[32];
|
||||
if (keytype == HASH_KEY_IS_LONG) {
|
||||
if (keytype == HASH_KEY_IS_INT) {
|
||||
snprintf(namebuf, sizeof(namebuf), "%d", pid);
|
||||
name = namebuf;
|
||||
namelen = strlen(namebuf) + 1;
|
||||
@@ -522,7 +522,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
|
||||
zend_hash_index_update(disp->dispid_to_name, pid, (void*)&tmp, sizeof(zval *), NULL);
|
||||
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_LONG(tmp, pid);
|
||||
ZVAL_INT(tmp, pid);
|
||||
zend_hash_update(disp->name_to_dispid, name, namelen, (void*)&tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
}
|
||||
@@ -585,9 +585,9 @@ PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *si
|
||||
HashPosition pos;
|
||||
char *name = NULL;
|
||||
zval *tmp, **ntmp;
|
||||
int namelen;
|
||||
php_size_t namelen;
|
||||
int keytype;
|
||||
ulong pid;
|
||||
php_uint_t pid;
|
||||
|
||||
disp->dispid_to_name = id_to_name;
|
||||
|
||||
@@ -601,14 +601,14 @@ PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *si
|
||||
while (HASH_KEY_NON_EXISTENT != (keytype =
|
||||
zend_hash_get_current_key_ex(id_to_name, &name, &namelen, &pid, 0, &pos))) {
|
||||
|
||||
if (keytype == HASH_KEY_IS_LONG) {
|
||||
if (keytype == HASH_KEY_IS_INT) {
|
||||
|
||||
zend_hash_get_current_data_ex(id_to_name, (void**)&ntmp, &pos);
|
||||
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_LONG(tmp, pid);
|
||||
ZVAL_INT(tmp, pid);
|
||||
zend_hash_update(disp->name_to_dispid, Z_STRVAL_PP(ntmp),
|
||||
Z_STRLEN_PP(ntmp)+1, (void*)&tmp, sizeof(zval *), NULL);
|
||||
Z_STRSIZE_PP(ntmp)+1, (void*)&tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
zend_hash_move_forward_ex(id_to_name, &pos);
|
||||
|
||||
@@ -48,7 +48,7 @@ ZEND_BEGIN_MODULE_GLOBALS(com_dotnet)
|
||||
zend_bool autoreg_on;
|
||||
zend_bool autoreg_case_sensitive;
|
||||
void *dotnet_runtime_stuff; /* opaque to avoid cluttering up other modules */
|
||||
int code_page; /* default code_page if left unspecified */
|
||||
php_int_t code_page; /* default code_page if left unspecified */
|
||||
zend_bool rshutdown_started;
|
||||
ZEND_END_MODULE_GLOBALS(com_dotnet)
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ typedef struct _php_com_dotnet_object {
|
||||
int modified;
|
||||
|
||||
ITypeInfo *typeinfo;
|
||||
long code_page;
|
||||
php_int_t code_page;
|
||||
|
||||
zend_class_entry *ce;
|
||||
|
||||
@@ -85,9 +85,9 @@ int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index TSRMLS
|
||||
|
||||
/* com_olechar.c */
|
||||
PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring,
|
||||
uint *string_len, int codepage TSRMLS_DC);
|
||||
php_size_t *string_len, php_int_t codepage TSRMLS_DC);
|
||||
PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string,
|
||||
uint string_len, int codepage TSRMLS_DC);
|
||||
php_size_t string_len, php_int_t codepage TSRMLS_DC);
|
||||
|
||||
|
||||
/* com_com.c */
|
||||
@@ -102,12 +102,12 @@ PHP_FUNCTION(com_get_active_object);
|
||||
HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
|
||||
WORD flags, DISPPARAMS *disp_params, VARIANT *v, int silent, int allow_noarg TSRMLS_DC);
|
||||
HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
|
||||
int namelen, DISPID *dispid TSRMLS_DC);
|
||||
php_size_t namelen, DISPID *dispid TSRMLS_DC);
|
||||
int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
|
||||
WORD flags, VARIANT *v, int nargs, zval **args, int silent, int allow_noarg TSRMLS_DC);
|
||||
int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
|
||||
int php_com_do_invoke(php_com_dotnet_object *obj, char *name, php_size_t namelen,
|
||||
WORD flags, VARIANT *v, int nargs, zval **args, int allow_noarg TSRMLS_DC);
|
||||
int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
|
||||
int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, php_size_t namelen,
|
||||
WORD flags, VARIANT *v, int nargs, zval ***args TSRMLS_DC);
|
||||
|
||||
/* com_wrapper.c */
|
||||
@@ -147,9 +147,9 @@ PHP_FUNCTION(variant_get_type);
|
||||
PHP_FUNCTION(variant_set_type);
|
||||
PHP_FUNCTION(variant_cast);
|
||||
|
||||
PHP_COM_DOTNET_API void php_com_variant_from_zval_with_type(VARIANT *v, zval *z, VARTYPE type, int codepage TSRMLS_DC);
|
||||
PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC);
|
||||
PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC);
|
||||
PHP_COM_DOTNET_API void php_com_variant_from_zval_with_type(VARIANT *v, zval *z, VARTYPE type, php_int_t codepage TSRMLS_DC);
|
||||
PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, php_int_t codepage TSRMLS_DC);
|
||||
PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, php_int_t codepage TSRMLS_DC);
|
||||
PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dst, VARIANT *src TSRMLS_DC);
|
||||
|
||||
/* com_dotnet.c */
|
||||
@@ -160,20 +160,20 @@ void php_com_dotnet_mshutdown(TSRMLS_D);
|
||||
/* com_misc.c */
|
||||
void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC);
|
||||
PHP_COM_DOTNET_API void php_com_wrap_dispatch(zval *z, IDispatch *disp,
|
||||
int codepage TSRMLS_DC);
|
||||
php_int_t codepage TSRMLS_DC);
|
||||
PHP_COM_DOTNET_API void php_com_wrap_variant(zval *z, VARIANT *v,
|
||||
int codepage TSRMLS_DC);
|
||||
php_int_t codepage TSRMLS_DC);
|
||||
PHP_COM_DOTNET_API int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, LONG dim1 TSRMLS_DC);
|
||||
|
||||
/* com_typeinfo.c */
|
||||
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string,
|
||||
int codepage, int *cached TSRMLS_DC);
|
||||
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codepage TSRMLS_DC);
|
||||
php_int_t codepage, int *cached TSRMLS_DC);
|
||||
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, php_int_t codepage TSRMLS_DC);
|
||||
PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode,
|
||||
int codepage TSRMLS_DC);
|
||||
php_int_t codepage TSRMLS_DC);
|
||||
void php_com_typelibrary_dtor(void *pDest);
|
||||
ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj, char *dispname, int sink TSRMLS_DC);
|
||||
int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid, int codepage TSRMLS_DC);
|
||||
int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid, php_int_t codepage TSRMLS_DC);
|
||||
|
||||
/* com_iterator.c */
|
||||
zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
|
||||
|
||||
Loaded 100 of 1006 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user