mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-12 11:40:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0778c40868 | ||
|
|
3566fe4afd | ||
|
|
fc4614d1d2 | ||
|
|
ca2efe468d | ||
|
|
7775550245 | ||
|
|
bbda630ed9 | ||
|
|
af11e1d592 | ||
|
|
d18cd00657 | ||
|
|
0a38d6bd8c | ||
|
|
896a5216d7 | ||
|
|
b1de3647cf | ||
|
|
90b3dadc4e | ||
|
|
1c02dff74a | ||
|
|
5b973c86ee | ||
|
|
c86e96db11 | ||
|
|
033c07972f | ||
|
|
a1bbdf831c | ||
|
|
b81e20f8e8 | ||
|
|
658b22ad6e | ||
|
|
2765fdfa46 | ||
|
|
ea53739d30 | ||
|
|
8663f1644d | ||
|
|
64de59d9a7 | ||
|
|
ee103a7c39 | ||
|
|
32872b157e | ||
|
|
50e1a51e5c | ||
|
|
f7a6327728 | ||
|
|
bdef85af21 | ||
|
|
09dec62672 | ||
|
|
227ca46fb7 | ||
|
|
974dc0f5b4 | ||
|
|
68906dbe62 | ||
|
|
9ea8d8dbf6 | ||
|
|
7315288591 | ||
|
|
1c0d8a536a | ||
|
|
349bcd7443 | ||
|
|
d19c105819 | ||
|
|
73e4913cca | ||
|
|
101d925baa | ||
|
|
76419e13aa | ||
|
|
5fd0994495 | ||
|
|
92da3229d4 | ||
|
|
3ef88178e8 | ||
|
|
cfaf6406d7 | ||
|
|
7330c32329 | ||
|
|
74672b86b4 | ||
|
|
79d8f014da | ||
|
|
29254a477d | ||
|
|
f233299f96 | ||
|
|
522a5e128f | ||
|
|
011266f7e1 | ||
|
|
7c42ddb8e0 | ||
|
|
874a22101f | ||
|
|
67abcb58c3 | ||
|
|
af429910ef | ||
|
|
65fcbcbdc0 | ||
|
|
f897cff480 | ||
|
|
851801a795 | ||
|
|
46e0ede425 | ||
|
|
9047558fe3 | ||
|
|
5751903b1b | ||
|
|
2d2f1cf0c6 | ||
|
|
2e461783d0 | ||
|
|
a6e4f11cb1 | ||
|
|
195271dd23 | ||
|
|
bac1fda336 | ||
|
|
d23c1d763b | ||
|
|
f23d01ad4d | ||
|
|
6e762e648c | ||
|
|
6a4faee367 | ||
|
|
47cb31b7df | ||
|
|
4043f77e36 | ||
|
|
4bab5226b2 | ||
|
|
45b64e7a99 | ||
|
|
6ea747d8e4 | ||
|
|
6c89fd2d63 | ||
|
|
8bbf3a00dc | ||
|
|
3438469b84 | ||
|
|
07d7750487 | ||
|
|
fabd954200 | ||
|
|
64e7be9b5a | ||
|
|
12346d64eb | ||
|
|
276171f871 | ||
|
|
22a8c3113b | ||
|
|
8cd558757f | ||
|
|
c261351a97 | ||
|
|
3110d15a00 | ||
|
|
5241090585 | ||
|
|
06ef71fe3d | ||
|
|
1e33c4cc85 | ||
|
|
8afc859b55 | ||
|
|
f83cfb77bf | ||
|
|
b9f85f37cc | ||
|
|
687e6ffc58 | ||
|
|
bb5f3aa012 | ||
|
|
0f4137fbd9 | ||
|
|
9e5655387a | ||
|
|
e8270edf9d | ||
|
|
5151efc2aa | ||
|
|
3511649498 | ||
|
|
e9d452b9a9 | ||
|
|
79b3d79a95 | ||
|
|
670ed5d93f | ||
|
|
8c40d605e4 | ||
|
|
ead7652457 | ||
|
|
6624682dff | ||
|
|
8625b42162 | ||
|
|
4033bfbda0 | ||
|
|
3d7abc2931 | ||
|
|
d288f66c7c | ||
|
|
ad7768ee63 | ||
|
|
8f7319a49f | ||
|
|
40e25b5ad7 | ||
|
|
52296072e0 | ||
|
|
783dd9f0ff | ||
|
|
7522fb7272 | ||
|
|
569ce842f1 | ||
|
|
c0592d17e9 | ||
|
|
793d0ab719 | ||
|
|
0944a47107 | ||
|
|
e25a1dccac | ||
|
|
f0cf877a81 | ||
|
|
c58e1fa5be | ||
|
|
5ccfa591b7 | ||
|
|
0f510a6a95 | ||
|
|
3edb5a8b6d | ||
|
|
bace0def1e | ||
|
|
b97b088800 | ||
|
|
46ba651680 | ||
|
|
f8e6ffee30 | ||
|
|
9a59df13cc | ||
|
|
8ccdceb4db | ||
|
|
ea9487249b | ||
|
|
193ae05edd | ||
|
|
0fab5aacce | ||
|
|
7fbb54f55c | ||
|
|
b6c9363f73 | ||
|
|
14aef92b2f | ||
|
|
7385433f34 | ||
|
|
0e07f0b117 | ||
|
|
4aece8077c | ||
|
|
867f89e575 | ||
|
|
62ce6717ad | ||
|
|
ad746130ad | ||
|
|
59b8592c8c | ||
|
|
697c652001 | ||
|
|
eab2f690fd | ||
|
|
1fa58ec003 | ||
|
|
08e6fded56 | ||
|
|
cfbcb43d63 | ||
|
|
6387d83a05 | ||
|
|
77acc692fd | ||
|
|
ea22696fb9 | ||
|
|
6dc42ef117 | ||
|
|
cdbe8b4fd8 | ||
|
|
4ca3df56d3 | ||
|
|
a93bd9d493 | ||
|
|
c5df14364b | ||
|
|
fb7d5bd780 | ||
|
|
2030a7a2ed | ||
|
|
cde55c9223 | ||
|
|
0dded18b33 | ||
|
|
82376269fd | ||
|
|
0b02327267 | ||
|
|
dfd5b4fbf4 | ||
|
|
a33d64e7b6 | ||
|
|
a824bcf41d | ||
|
|
7b70ca475f | ||
|
|
bf4ae10c36 | ||
|
|
d085b37f66 | ||
|
|
65d704cb7c | ||
|
|
bf3a7e12e1 | ||
|
|
f8183e2e97 | ||
|
|
b3a437fcc4 | ||
|
|
9e26f6c213 | ||
|
|
ed43fd9b3b | ||
|
|
fe1c2cfc0f | ||
|
|
1ad4dd8795 | ||
|
|
3b1cb0e500 | ||
|
|
5f80bcaf26 | ||
|
|
e40df39518 | ||
|
|
041e7470b1 | ||
|
|
1440bb5c7b | ||
|
|
4b4d61952f | ||
|
|
660956b514 | ||
|
|
87ae2460d1 | ||
|
|
dbe881d9c2 | ||
|
|
cb3a53db83 | ||
|
|
0c1b4f45eb | ||
|
|
c4db88563f | ||
|
|
1ce8546cd1 | ||
|
|
09fcf3162c | ||
|
|
f7ce1d6260 | ||
|
|
32f611097f | ||
|
|
8a58105f42 | ||
|
|
6c101d6400 | ||
|
|
7b7717d196 | ||
|
|
f9835c3786 | ||
|
|
d76e149f0e | ||
|
|
7019b978a0 | ||
|
|
1122f647d2 | ||
|
|
bafba669ad | ||
|
|
658ac96cfa | ||
|
|
e8d320dd77 | ||
|
|
8d012d041f | ||
|
|
85019bf450 | ||
|
|
fa3173bec3 | ||
|
|
6912dab9eb | ||
|
|
79e7432c97 | ||
|
|
b2bbaca8e8 | ||
|
|
f789f0e384 | ||
|
|
3309d14af2 | ||
|
|
edbfb9c2c7 | ||
|
|
6aaf510bf0 | ||
|
|
608c3207a6 | ||
|
|
b5001f5383 | ||
|
|
afd781a09a | ||
|
|
110021f4c7 | ||
|
|
d355704998 | ||
|
|
ef1f36e2c1 | ||
|
|
90d7fbe798 | ||
|
|
4651f79ed5 | ||
|
|
4ccd89d147 | ||
|
|
5a49926c38 | ||
|
|
cf01cff2e5 | ||
|
|
23b8ce3876 | ||
|
|
91f4b380d6 | ||
|
|
5c7c11c41d | ||
|
|
4e75cd5548 | ||
|
|
fa922fb51c | ||
|
|
2ea6d46e4f | ||
|
|
aaec067578 | ||
|
|
7731dc9421 | ||
|
|
63b3f5c041 | ||
|
|
652d77eca4 | ||
|
|
76a7240d70 | ||
|
|
55159796b0 | ||
|
|
d82462485e | ||
|
|
c31c984365 | ||
|
|
6fd71dbbe9 | ||
|
|
7c14d86dc3 | ||
|
|
eacb27d2da | ||
|
|
92ba7cccad | ||
|
|
79983ce0ce | ||
|
|
6f76b17079 | ||
|
|
7865dfb5b8 | ||
|
|
056bea6de7 | ||
|
|
c6b8c26cdf | ||
|
|
829642a0b7 | ||
|
|
98bacb0e21 | ||
|
|
ef3d879315 | ||
|
|
0a076b11df | ||
|
|
9d6e4964a1 | ||
|
|
161ae714ae | ||
|
|
a8dbb0ded6 | ||
|
|
0bcd459300 | ||
|
|
a371a8c153 | ||
|
|
01479757e3 | ||
|
|
80ea07d30c | ||
|
|
c69f100d0e | ||
|
|
ad10a538ee | ||
|
|
d21669fc80 | ||
|
|
9e90d5b3c0 | ||
|
|
0add197ec8 | ||
|
|
1c340d515d | ||
|
|
e7f6a3fab2 | ||
|
|
e16bba12b1 | ||
|
|
2e3ae2f5c2 | ||
|
|
06d235fbf1 | ||
|
|
941d86a204 | ||
|
|
b80f9567d5 | ||
|
|
e13e2fe9ba | ||
|
|
79a968b21e | ||
|
|
6c4e9d30b9 | ||
|
|
0ebab9d495 | ||
|
|
61f7dc1396 | ||
|
|
7ffc24b9f3 | ||
|
|
97f463c156 | ||
|
|
6dff869c51 | ||
|
|
fe13b8ef69 | ||
|
|
b04ecd08d2 | ||
|
|
e1d9cf07cd | ||
|
|
6dcb27d35c | ||
|
|
74868fae47 | ||
|
|
4a5dd30201 | ||
|
|
0aa24dc0a1 | ||
|
|
b8d26da1be | ||
|
|
5dea328391 | ||
|
|
4e6245978b | ||
|
|
f84c9acc77 | ||
|
|
8dffbf217d | ||
|
|
6ce1f43902 | ||
|
|
3563191049 | ||
|
|
b8be6d3664 | ||
|
|
a325d22cd1 | ||
|
|
1b688da7ac | ||
|
|
89a4054106 | ||
|
|
5bfe560cab | ||
|
|
d36a88bdda | ||
|
|
e70571c251 | ||
|
|
dc8221c154 | ||
|
|
94165e41a7 | ||
|
|
f08316b525 | ||
|
|
6e93f3eb8f | ||
|
|
ade3995a79 | ||
|
|
e795f8f427 | ||
|
|
7fd337f955 | ||
|
|
f87e7b8bab | ||
|
|
7d73045415 | ||
|
|
90ae21f310 | ||
|
|
7dc322754a | ||
|
|
41de805a9d | ||
|
|
e43a77d84c | ||
|
|
35ce5db25e | ||
|
|
a9080d38f4 | ||
|
|
0b12f7307e | ||
|
|
65211cddcc | ||
|
|
a1024ce679 | ||
|
|
54adfc6fcf | ||
|
|
d46b474e1e | ||
|
|
b32a78c4fa | ||
|
|
622347bd8c | ||
|
|
5c1dbf51af | ||
|
|
22c501b016 | ||
|
|
ea86f819a3 | ||
|
|
65cca0dc20 | ||
|
|
7addae5089 | ||
|
|
e2218515d2 | ||
|
|
1aa1c535b5 | ||
|
|
3840e428bb | ||
|
|
f128dff1ff | ||
|
|
84ad62553d | ||
|
|
3022080d84 | ||
|
|
477f503b9e | ||
|
|
c4b81d8720 | ||
|
|
728493ca37 | ||
|
|
2e37e86366 | ||
|
|
2e91228d15 | ||
|
|
e3ea152fee | ||
|
|
c5d70528d7 | ||
|
|
44d4ba478f | ||
|
|
d4ba0a9fc3 | ||
|
|
cde6f6e0cc | ||
|
|
3e056bc13c | ||
|
|
0b300dac3a | ||
|
|
4d442447f1 | ||
|
|
2d4b399fe1 | ||
|
|
2d02bedd9c | ||
|
|
5a69b29082 | ||
|
|
84fc80064b | ||
|
|
8fe5bc7010 | ||
|
|
bf213a2c7b | ||
|
|
941b0651dc | ||
|
|
611a6dece9 | ||
|
|
027abfd702 | ||
|
|
016dbe414e | ||
|
|
6520ff9afc | ||
|
|
521502f416 | ||
|
|
6d494f9725 | ||
|
|
c009a4f361 | ||
|
|
9f53c8e313 | ||
|
|
07e7092729 | ||
|
|
7409ed6403 | ||
|
|
f5241f165f | ||
|
|
c6cb1598be | ||
|
|
289f45c279 | ||
|
|
4ea898b79f | ||
|
|
089f1283ad | ||
|
|
59fa57d232 | ||
|
|
4b23428d9d | ||
|
|
f0d9ae46c3 | ||
|
|
afd8f0b608 | ||
|
|
78516c7905 | ||
|
|
92ac0940d3 | ||
|
|
bab48a0906 | ||
|
|
f10bab6f97 | ||
|
|
a8be85ce7e | ||
|
|
1e8aad5075 | ||
|
|
ce9dfedc69 | ||
|
|
2108714a2b | ||
|
|
f2ac3274d7 | ||
|
|
96843fe434 | ||
|
|
a790d6ed3d | ||
|
|
716d22a8f6 | ||
|
|
82b6ccbc30 | ||
|
|
8068342483 | ||
|
|
d43d090362 | ||
|
|
3608dd4c11 | ||
|
|
c65d61a301 | ||
|
|
1a170a3de2 | ||
|
|
1e05eec591 | ||
|
|
11187a40e0 | ||
|
|
9c614f8f8f | ||
|
|
4b2b9461d4 | ||
|
|
535a2e6092 | ||
|
|
5fb8810c76 | ||
|
|
e8d38828cd | ||
|
|
08c4c9c202 | ||
|
|
6cc9f92d16 | ||
|
|
8fe545aab7 | ||
|
|
044d24a23c | ||
|
|
c09237ffce | ||
|
|
8600417c79 | ||
|
|
f541b63e1f | ||
|
|
b0f0192f0c | ||
|
|
991c753bc5 | ||
|
|
1f8b320679 | ||
|
|
39a4a46ae4 | ||
|
|
0a6b074034 | ||
|
|
7deff63e3c | ||
|
|
3bafa8cead | ||
|
|
9167991f69 | ||
|
|
73605400e8 | ||
|
|
7831900882 | ||
|
|
5f83d7ce90 | ||
|
|
da30791861 | ||
|
|
0473a11ca2 | ||
|
|
f3e11a705c | ||
|
|
a3b941642c | ||
|
|
beea63529c | ||
|
|
6c180238fd | ||
|
|
a0d912490d | ||
|
|
a7c845ffcb | ||
|
|
38409e944c | ||
|
|
bccf4bd9e7 | ||
|
|
8911fac653 | ||
|
|
c353a52a11 | ||
|
|
4a179933b6 | ||
|
|
f2772ecc0d | ||
|
|
ff4ee6f043 | ||
|
|
aa920b8e00 | ||
|
|
64972c02de | ||
|
|
647eafcb5d | ||
|
|
3c1b981a28 | ||
|
|
3f68c2164b | ||
|
|
6f632a77c3 | ||
|
|
56db3290e2 | ||
|
|
39d71e375c | ||
|
|
5e673e0639 | ||
|
|
c3c092bba6 | ||
|
|
a78a0b460c | ||
|
|
aa1142eded | ||
|
|
52232a7f7a | ||
|
|
b179e081ab | ||
|
|
a31f337c24 | ||
|
|
db7195ee0c | ||
|
|
a266261eb6 | ||
|
|
3a4a0e3cef | ||
|
|
0c972edce4 | ||
|
|
0655132e2c | ||
|
|
ff30daae6e | ||
|
|
0506d1a9f5 | ||
|
|
7dc9be77fc | ||
|
|
6a176fa7b3 | ||
|
|
7e7fcc3a07 | ||
|
|
9774b6d3e6 | ||
|
|
d115747a24 | ||
|
|
8c55d477d8 | ||
|
|
b90d985a23 | ||
|
|
823b39b698 | ||
|
|
b73349dbe4 | ||
|
|
0249f6b6b6 | ||
|
|
526bc44ff7 | ||
|
|
3a800fe146 | ||
|
|
eb91dfc69e | ||
|
|
6f66a63cda | ||
|
|
657d5f086f | ||
|
|
b22ab5b5d3 | ||
|
|
f80f58168c | ||
|
|
9b0f4a6234 | ||
|
|
af56d9f1d4 | ||
|
|
e44b9f08f6 | ||
|
|
80cc4867e3 | ||
|
|
329198a955 | ||
|
|
f16b8429da | ||
|
|
2bfe34e06d | ||
|
|
fe52312f59 | ||
|
|
a146043c25 | ||
|
|
9494521055 | ||
|
|
26127e510f | ||
|
|
b12f8e6811 | ||
|
|
1b546b9f77 | ||
|
|
c5ef24bfee | ||
|
|
9eda552c75 | ||
|
|
ed58b573a1 | ||
|
|
84554b0364 | ||
|
|
c53b926a35 | ||
|
|
cb4bb6e389 | ||
|
|
77915bc208 | ||
|
|
ec605ac2ad | ||
|
|
8fde2249c3 | ||
|
|
9cb7d29f84 | ||
|
|
5f25d80d10 | ||
|
|
d0e1a4fdca | ||
|
|
ff438f1139 | ||
|
|
9cbc3ae264 | ||
|
|
2d1d476391 | ||
|
|
1d461a6bcc | ||
|
|
b1cebf32e4 | ||
|
|
cb27823e82 | ||
|
|
813a5651c1 | ||
|
|
4803abf07c | ||
|
|
e4295ed864 | ||
|
|
ffe84c11a7 | ||
|
|
90bb16db5a | ||
|
|
1070dec09a | ||
|
|
4697099ab0 | ||
|
|
5fb6e0703f | ||
|
|
0621bcc9e1 | ||
|
|
c447acf863 | ||
|
|
82d5901664 | ||
|
|
864004d4d7 | ||
|
|
01e8d313c8 | ||
|
|
26ef74f867 | ||
|
|
f0a60af876 | ||
|
|
fb7608a006 | ||
|
|
1d72f55e7d | ||
|
|
56242031aa | ||
|
|
4278ffd3b4 | ||
|
|
5a6a07467f | ||
|
|
b6cb9d3ce5 | ||
|
|
52933fc89d | ||
|
|
5ea4c827c9 | ||
|
|
e736bfc8b6 | ||
|
|
afa77062d1 | ||
|
|
328c294569 | ||
|
|
0f4302b872 | ||
|
|
5f9dde24d8 | ||
|
|
694042e527 | ||
|
|
ac1ec7914c | ||
|
|
3062348c75 | ||
|
|
bc410c3863 | ||
|
|
b8360c376b | ||
|
|
4b1791a767 | ||
|
|
71d4d4a91f | ||
|
|
3d80bd0cdf | ||
|
|
d059b92fea | ||
|
|
8488861e12 | ||
|
|
1edc8eec88 | ||
|
|
66cfc793a2 | ||
|
|
97086b2bc6 | ||
|
|
add3c79a23 | ||
|
|
a408c539cf | ||
|
|
5854cf10c7 | ||
|
|
04ac1f7fd1 | ||
|
|
fecfb80a00 | ||
|
|
c061fc6c37 | ||
|
|
1cdaf5d7b1 | ||
|
|
575e6b6e7c | ||
|
|
c863542dc1 | ||
|
|
754b747637 | ||
|
|
64447a29aa | ||
|
|
0851c649d1 | ||
|
|
e6f4c2bce2 | ||
|
|
db2697aae0 | ||
|
|
6c509aa837 | ||
|
|
f113090832 | ||
|
|
e731da3653 | ||
|
|
1cfcdf6612 | ||
|
|
8f5005e4b6 | ||
|
|
6ba295f311 |
No files matched your search
@@ -1,8 +1,7 @@
|
||||
set $zts = 0
|
||||
|
||||
define ____executor_globals
|
||||
if $zts
|
||||
set $eg = ((zend_executor_globals) (*((void ***) tsrm_ls))[executor_globals_id-1])
|
||||
if basic_functions_module.zts
|
||||
set $tsrm_ls = ts_resource_ex(0, 0)
|
||||
set $eg = ((zend_executor_globals) (*((void ***) $tsrm_ls))[executor_globals_id-1])
|
||||
else
|
||||
set $eg = executor_globals
|
||||
end
|
||||
@@ -10,7 +9,7 @@ end
|
||||
|
||||
document ____executor_globals
|
||||
portable way of accessing executor_globals
|
||||
type "set $zts = 1" if you use --enable-maintainer-zts on your configure line
|
||||
ZTS detection is automatically based on ext/standard module struct
|
||||
end
|
||||
|
||||
define dump_bt
|
||||
@@ -44,55 +43,33 @@ document printzv
|
||||
end
|
||||
|
||||
define ____printzv_contents
|
||||
____executor_globals
|
||||
set $zvalue = $arg0
|
||||
set $type = $zvalue->type
|
||||
|
||||
if $zvalue.type == 0
|
||||
set $typename = "NULL"
|
||||
printf "(refcount=%d) ", $zvalue->refcount
|
||||
if $type == 0
|
||||
printf "NULL"
|
||||
end
|
||||
if $zvalue.type == 1
|
||||
set $typename = "long"
|
||||
if $type == 1
|
||||
printf "long: %ld", $zvalue->value.lval
|
||||
end
|
||||
if $zvalue.type == 2
|
||||
set $typename = "double"
|
||||
if $type == 2
|
||||
printf "double: %lf", $zvalue->value.dval
|
||||
end
|
||||
if $zvalue.type == 3
|
||||
set $typename = "string"
|
||||
if $type == 3
|
||||
printf "bool: "
|
||||
if $zvalue->value.lval
|
||||
printf "true"
|
||||
else
|
||||
printf "false"
|
||||
end
|
||||
end
|
||||
if $zvalue.type == 4
|
||||
set $typename = "array"
|
||||
end
|
||||
if $zvalue.type == 5
|
||||
set $typename = "object"
|
||||
end
|
||||
if $zvalue.type == 6
|
||||
set $typename = "bool"
|
||||
end
|
||||
if $zvalue.type == 7
|
||||
set $typename = "resource"
|
||||
end
|
||||
if $zvalue.type == 8
|
||||
set $typename = "constant"
|
||||
end
|
||||
if $zvalue.type == 9
|
||||
set $typename = "const_array"
|
||||
end
|
||||
|
||||
printf "(refcount=%d) %s: ", $zvalue.refcount, $typename
|
||||
if $zvalue.type == 1
|
||||
printf "%ld", $zvalue.value.lval
|
||||
end
|
||||
if $zvalue->type == 2
|
||||
printf "%lf", $zvalue.value.dval
|
||||
end
|
||||
if $zvalue.type == 3
|
||||
printf "\"%s\"(%d)", $zvalue.value.str.val, $zvalue.value.str.len
|
||||
end
|
||||
if $zvalue.type == 4
|
||||
if $type == 4
|
||||
printf "array(%d): ", $zvalue->value.ht->nNumOfElements
|
||||
if ! $arg1
|
||||
printf "{\n"
|
||||
set $ind = $ind + 1
|
||||
____print_ht $zvalue.value.ht
|
||||
____print_ht $zvalue->value.ht
|
||||
set $ind = $ind - 1
|
||||
set $i = $ind
|
||||
while $i > 0
|
||||
@@ -101,34 +78,60 @@ define ____printzv_contents
|
||||
end
|
||||
printf "}"
|
||||
end
|
||||
set $type = 0
|
||||
end
|
||||
if $zvalue.type == 5
|
||||
if $type == 5
|
||||
printf "object"
|
||||
____executor_globals
|
||||
set $handle = $zvalue->value.obj.handle
|
||||
set $handlers = $zvalue->value.obj.handlers
|
||||
if basic_functions_module.zts
|
||||
set $zobj = zend_objects_get_address($zvalue, $tsrm_ls)
|
||||
else
|
||||
set $zobj = zend_objects_get_address($zvalue)
|
||||
end
|
||||
if $handlers->get_class_entry == &zend_std_object_get_class
|
||||
set $cname = $zobj->ce.name
|
||||
else
|
||||
set $cname = "Unknown"
|
||||
end
|
||||
printf "(%s) #%d", $cname, $handle
|
||||
if ! $arg1
|
||||
printf "(prop examination disabled due to a gdb bug)"
|
||||
if $zvalue.value.obj.handlers->get_properties
|
||||
# set $ht = $zvalue->value.obj.handlers->get_properties($zvalue)
|
||||
# printf "{\n"
|
||||
# set $ind = $ind + 1
|
||||
# ____print_ht $ht
|
||||
# set $ind = $ind - 1
|
||||
# set $i = $ind
|
||||
# while $i > 0
|
||||
# printf " "
|
||||
# set $i = $i - 1
|
||||
# end
|
||||
# printf "}"
|
||||
if $handlers->get_properties == &zend_std_get_properties
|
||||
set $ht = $zobj->properties
|
||||
if $ht
|
||||
printf "(%d): ", $ht->nNumOfElements
|
||||
printf "{\n"
|
||||
set $ind = $ind + 1
|
||||
____print_ht $ht
|
||||
set $ind = $ind - 1
|
||||
set $i = $ind
|
||||
while $i > 0
|
||||
printf " "
|
||||
set $i = $i - 1
|
||||
end
|
||||
printf "}"
|
||||
else
|
||||
echo "no properties found"
|
||||
end
|
||||
end
|
||||
end
|
||||
set $type = 0
|
||||
end
|
||||
if $zvalue.type == 6
|
||||
if $zvalue.value.lval
|
||||
printf "true"
|
||||
else
|
||||
printf "false"
|
||||
end
|
||||
if $type == 6
|
||||
printf "string(%d): \"%s\"", $zvalue->value.str.len, $zvalue->value.str.val
|
||||
end
|
||||
if $zvalue.type == 7
|
||||
printf "#%d", $zvalue.value.lval
|
||||
if $type == 7
|
||||
printf "resource: #%d", $zvalue->value.lval
|
||||
end
|
||||
if $type == 8
|
||||
printf "constant"
|
||||
end
|
||||
if $type == 9
|
||||
printf "const_array"
|
||||
end
|
||||
if $type > 9
|
||||
printf "unknown type %d", $type
|
||||
end
|
||||
printf "\n"
|
||||
end
|
||||
@@ -143,7 +146,7 @@ define ____printzv
|
||||
printf "*uninitialized* "
|
||||
end
|
||||
|
||||
set $zcontents = *(struct _zval_struct *) $zvalue
|
||||
set $zcontents = (zval*) $zvalue
|
||||
if $arg1
|
||||
____printzv_contents $zcontents $arg1
|
||||
else
|
||||
@@ -156,7 +159,7 @@ define ____print_const_table
|
||||
set $p = $ht->pListHead
|
||||
|
||||
while $p != 0
|
||||
set $const = *(zend_constant *) $p->pData
|
||||
set $const = (zend_constant *) $p->pData
|
||||
|
||||
set $i = $ind
|
||||
while $i > 0
|
||||
@@ -170,7 +173,7 @@ define ____print_const_table
|
||||
printf "%d => ", $p->h
|
||||
end
|
||||
|
||||
____printzv_contents $const.value 0
|
||||
____printzv_contents &$const->value 0
|
||||
set $p = $p->pListNext
|
||||
end
|
||||
end
|
||||
@@ -187,7 +190,7 @@ define ____print_ht
|
||||
set $p = $ht->pListHead
|
||||
|
||||
while $p != 0
|
||||
set $zval = *(struct _zval_struct **)$p->pData
|
||||
set $zval = *(zval **)$p->pData
|
||||
|
||||
set $i = $ind
|
||||
while $i > 0
|
||||
@@ -217,6 +220,41 @@ document print_ht
|
||||
dumps elements of HashTable made of zval
|
||||
end
|
||||
|
||||
define ____print_ft
|
||||
set $ht = $arg0
|
||||
set $p = $ht->pListHead
|
||||
|
||||
while $p != 0
|
||||
set $func = (zend_function*)$p->pData
|
||||
|
||||
set $i = $ind
|
||||
while $i > 0
|
||||
printf " "
|
||||
set $i = $i - 1
|
||||
end
|
||||
|
||||
if $p->nKeyLength > 0
|
||||
printf "\"%s\" => ", (char*)$p->arKey
|
||||
else
|
||||
printf "%d => ", $p->h
|
||||
end
|
||||
|
||||
printf "\"%s\"\n", $func->common.function_name
|
||||
set $p = $p->pListNext
|
||||
end
|
||||
end
|
||||
|
||||
define print_ft
|
||||
set $ind = 1
|
||||
printf "[0x%08x] {\n", $arg0
|
||||
____print_ft $arg0
|
||||
printf "}\n"
|
||||
end
|
||||
|
||||
document print_ft
|
||||
dumps a function table (HashTable)
|
||||
end
|
||||
|
||||
define printzn
|
||||
____executor_globals
|
||||
set $ind = 0
|
||||
|
||||
+5
-5
@@ -68,11 +68,6 @@ PRIMARY MAINTAINER: Alex Leigh <aleigh@php.net>
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: date
|
||||
PRIMARY MAINTAINER: Derick Rethans <derick@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: embed
|
||||
PRIMARY MAINTAINER: Edin Kadribasic <edink@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
@@ -307,6 +302,11 @@ MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: date
|
||||
PRIMARY MAINTAINER: Derick Rethans <derick@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: exif
|
||||
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ php_lcov.info: lcov-test
|
||||
|
||||
lcov-html: php_lcov.info
|
||||
@echo "Generating lcov HTML"
|
||||
@$(LTP_GENHTML) --legend --no-prefix --output-directory lcov_html/ --title "PHP Code Coverage" --show-details php_lcov.info
|
||||
@$(LTP_GENHTML) --legend --output-directory lcov_html/ --title "PHP Code Coverage" --show-details php_lcov.info
|
||||
|
||||
lcov-clean:
|
||||
rm -f php_lcov.info
|
||||
|
||||
+5
-5
@@ -25,10 +25,10 @@ install: $(all_targets) $(install_targets)
|
||||
install-sapi: $(OVERALL_TARGET)
|
||||
@echo "Installing PHP SAPI module: $(PHP_SAPI)"
|
||||
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
|
||||
-@if test ! -r $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME); then \
|
||||
-@if test ! -r $(phptempdir)/libphp5.$(SHLIB_DL_SUFFIX_NAME); then \
|
||||
for i in 0.0.0 0.0 0; do \
|
||||
if test -r $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME).$$i; then \
|
||||
$(LN_S) $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME).$$i $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME); \
|
||||
if test -r $(phptempdir)/libphp5.$(SHLIB_DL_SUFFIX_NAME).$$i; then \
|
||||
$(LN_S) $(phptempdir)/libphp5.$(SHLIB_DL_SUFFIX_NAME).$$i $(phptempdir)/libphp5.$(SHLIB_DL_SUFFIX_NAME); \
|
||||
break; \
|
||||
fi; \
|
||||
done; \
|
||||
@@ -44,13 +44,13 @@ install-modules: build-modules
|
||||
|
||||
install-headers:
|
||||
-@if test "$(INSTALL_HEADERS)"; then \
|
||||
for i in $(INSTALL_HEADERS); do \
|
||||
for i in `echo $(INSTALL_HEADERS)`; do \
|
||||
i=`$(top_srcdir)/build/shtool path -d $$i`; \
|
||||
paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
|
||||
done; \
|
||||
$(mkinstalldirs) $$paths && \
|
||||
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
|
||||
for i in $(INSTALL_HEADERS); do \
|
||||
for i in `echo $(INSTALL_HEADERS)`; do \
|
||||
if test "$(PHP_PECL_EXTENSION)"; then \
|
||||
src=`echo $$i | $(SED) -e "s#ext/$(PHP_PECL_EXTENSION)/##g"`; \
|
||||
else \
|
||||
|
||||
@@ -1,5 +1,261 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
27 Apr 2006, PHP 5.1.3
|
||||
- Updated bundled PCRE library to version 6.6. (Andrei)
|
||||
- Moved extensions to PECL:
|
||||
. ext/msession (Derick)
|
||||
- Reimplemented FastCGI interface. (Dmitry)
|
||||
- Improved SPL: (Marcus)
|
||||
- Fixed issues with not/double calling of constructors of SPL iterators.
|
||||
- Fixed issues with info-class/file-class in SPL directory handling classes.
|
||||
- Fixed ArrayIterator::seek().
|
||||
- Added SimpleXMLIterator::count().
|
||||
- Dropped erroneous RecursiveDirectoryIterator::getSubPathInfo().
|
||||
- Improved SimpleXML: (Marcus, Rob)
|
||||
. Added SimpleXMLElement::getName() to retrieve name of element.
|
||||
. Added ability to create elements on the fly.
|
||||
. Added addChild() method for element creation supporting namespaces.
|
||||
. Added addAttribute() method for attribute creation supporting namespaces.
|
||||
. Added ability to delete specific elements and attributes by offset.
|
||||
- Improved Reflection API: (Marcus)
|
||||
. Added ReflectionClass::newInstanceArgs($args).
|
||||
. Added ability to analyze extension dependency.
|
||||
. Added ReflectionFunction::isDeprecated() and constant IS_DEPRECATED.
|
||||
. Added ReflectionParameter::getDeclaringClass().
|
||||
. Changed reflection constants to be prefixed with IS_. (Johannes)
|
||||
- Improved cURL extension: (Ilia)
|
||||
. Added curl_setopt_array() function that allows setting of multiple
|
||||
options via an associated array.
|
||||
. Added the ability to retrieve the request message sent to the server.
|
||||
- Improved GD extension: (Pierre)
|
||||
. Added a weak/tolerant mode to the JPEG loader.
|
||||
. Added filtering mode option to imagepng() to allow reducing file size.
|
||||
. Fixed imagecolorallocate() and imagecolorallocatelapha() to return FALSE
|
||||
on error.
|
||||
- Changed get_headers() to retrieve headers also from non-200 responses.
|
||||
(Ilia)
|
||||
- Changed get_headers() to use the default context. (Ilia)
|
||||
- Added lchown() and lchgrp() to change user/group ownership of symlinks.
|
||||
(Derick)
|
||||
- Added support for exif date format in strtotime(). (Derick)
|
||||
- Added a check for special characters in the session name. (Ilia)
|
||||
- Added "consumed" stream filter. (Marcus)
|
||||
- Added new mysqli constants for BIT and NEW_DECIMAL field types:
|
||||
MYSQLI_TYPE_NEWDECIMAL and MYSQLI_TYPE_BIT. FR #36007. (Georg)
|
||||
- Added imap_savebody() that allows message body to be written to a
|
||||
file. (Mike)
|
||||
- Added overflow checks to wordwrap() function. (Ilia)
|
||||
- Added support for BINARY_DOUBLE and BINARY_FLOAT to PDO_OCI and OCI8
|
||||
(also fixes bug #36764). (Tony)
|
||||
- Eliminated run-time constant fetching for TRUE, FALSE and NULL. (Dmitry)
|
||||
- Removed the E_STRICT deprecation notice from "var". (Ilia)
|
||||
- Fixed reading stream filters never notified about EOF. (Mike)
|
||||
- Fixed tempnam() 2nd parameter to be checked against path components. (Ilia)
|
||||
- Fixed a bug that would not fill in the fifth argument to preg_replace()
|
||||
properly, if the variable was not declared previously. (Andrei)
|
||||
- Fixed safe_mode check for source argument of the copy() function. (Ilia)
|
||||
- Fixed mysqli bigint conversion under Windows (Georg)
|
||||
- Fixed XSS inside phpinfo() with long inputs. (Ilia)
|
||||
- Fixed Apache2 SAPIs header handler modifying header strings. (Mike)
|
||||
- Fixed 'auto_globals_jit' to work together with 'register_argc_argv'. (Dmitry)
|
||||
- Fixed offset/length parameter validation in substr_compare() function. (Ilia)
|
||||
- Fixed debug_zval_dump() to support private and protected members. (Dmitry)
|
||||
- Fixed SoapFault::getMessage(). (Dmitry)
|
||||
- Fixed issue with iconv_mime_decode where the "encoding" would only allow
|
||||
upper case specifiers. (Derick)
|
||||
- Fixed tiger hash algorithm generating wrong results on big endian platforms.
|
||||
(Mike)
|
||||
- Fixed crash with DOMImplementation::createDocumentType("name:"). (Mike)
|
||||
- Fixed bug #37205 (Serving binary content/images fails with "comm with server
|
||||
aborted" FastCGI err). (Dmitry)
|
||||
- Fixed bug #37192 (cc may complain about non-constant initializers in
|
||||
hash_adler.c). (Mike)
|
||||
- Fixed bug #37191 (chmod takes off sticky bit when safe_mode is On). (Tony)
|
||||
- Fixed bug #37167 (PDO segfaults when throwing exception from the
|
||||
fetch handler). (Tony)
|
||||
- Fixed bug #37162 (wddx does not build as a shared extension).
|
||||
(jdolecek at NetBSD dot org, Ilia)
|
||||
- Fixed bug #37158 (fread behavior changes after calling
|
||||
stream_wrapper_register). (Wez)
|
||||
- Fixed bug #37138 (__autoload tries to load callback'ed self and parent).
|
||||
(Dmitry)
|
||||
- Fixed bug #37103 (libmbfl headers not installed). (Jani)
|
||||
- Fixed bug #37062 (compile failure on ARM architecture). (Tony)
|
||||
- Fixed bug #37061 (curl_exec() doesn't zero-terminate binary strings). (Tony)
|
||||
- Fixed bug #37060 (Type of retval of Countable::count() is not checked).
|
||||
(Johannes)
|
||||
- Fixed bug #37059 (oci_bind_by_name() doesn't support RAW and LONG RAW
|
||||
fields). (Tony)
|
||||
- Fixed bug #37057 (xmlrpc_decode() may produce arrays with numeric strings,
|
||||
which are unaccessible). (Tony)
|
||||
- Fixed bug #37055 (incorrect reference counting for persistent OCI8
|
||||
connections). (Tony)
|
||||
- Fixed bug #37054 (SoapClient Error Fetching http headers). (Dmitry)
|
||||
- Fixed bug #37053 (html_errors with internal classes produces wrong links).
|
||||
(Tony)
|
||||
- Fixed bug #37046 (foreach breaks static scope). (Dmitry)
|
||||
- Fixed bug #37045 (Fixed check for special chars for http redirects). (Ilia)
|
||||
- Fixed bug #37017 (strtotime fails before 13:00:00 with some time zones
|
||||
identifiers). (Derick)
|
||||
- Fixed bug #37002 (Have to quote literals in INI when concatenating with
|
||||
vars). (Dmitry)z
|
||||
- Fixed bug #36988 (mktime freezes on long numbers). (Derick)
|
||||
- Fixed bug #36981 (SplFileObject->fgets() ignores max_length). (Tony)
|
||||
- Fixed bug #36957 (serialize() does not handle recursion). (Ilia)
|
||||
- Fixed bug #36944 (strncmp & strncasecmp do not return false on negative
|
||||
string length). (Tony)
|
||||
- Fixed bug #36941 (ArrayIterator does not clone itself). (Marcus)
|
||||
- Fixed bug #36934 (OCILob->read() doesn't move internal pointer when
|
||||
reading 0's). (Tony)
|
||||
- Fixed bug #36908 (wsdl default value overrides value in soap request).
|
||||
(Dmitry)
|
||||
- Fixed bug #36898 (__set() leaks in classes extending internal ones).
|
||||
(Tony, Dmitry)
|
||||
- Fixed bug #36886 (User filters can leak buckets in some situations). (Ilia)
|
||||
- Fixed bug #36878 (error messages are printed even though an exception has
|
||||
been thrown). (Tony)
|
||||
- Fixed bug #36875 (is_*() functions do not account for open_basedir). (Ilia)
|
||||
- Fixed bug #36872 (session_destroy() fails after call to
|
||||
session_regenerate_id(true)). (Ilia)
|
||||
- Fixed bug #36869 (memory leak in output buffering when using chunked
|
||||
output). (Tony)
|
||||
- Fixed bug #36859 (DOMElement crashes when calling __construct when
|
||||
cloning). (Tony)
|
||||
- Fixed bug #36857 (Added support for partial content fetching to the
|
||||
HTTP streams wrapper). (Ilia)
|
||||
- Fixed bug #36851 (Documentation and code discrepancies for NULL
|
||||
data in oci_fetch_*() functions). (Tony)
|
||||
- Fixed bug #36825 (Exceptions thrown in ArrayObject::offsetGet cause
|
||||
segfault). (Tony)
|
||||
- Fixed bug #36820 (Privileged connection with an Oracle password file
|
||||
fails). (Tony)
|
||||
- Fixed bug #36809 (__FILE__ behavior changed). (Dmitry)
|
||||
- Fixed bug #36808 (syslog ident becomes garbage between requests). (Tony)
|
||||
- Fixed bug #36802 (mysqli_set_charset() crash with a non-open connection).
|
||||
(Ilia)
|
||||
- Fixed bug #36756 (DOMDocument::removeChild corrupts node). (Rob)
|
||||
- Fixed bug #36749 (SOAP: 'Error Fetching http body' when using HTTP Proxy).
|
||||
(Dmitry)
|
||||
- Fixed bug #36745 (No error message when load data local file isn't found).
|
||||
(Georg)
|
||||
- Fixed bug #36743 (In a class extending XMLReader array properties are not
|
||||
writable). (Tony)
|
||||
- Fixed bug #36727 (segfault in pdo_pgsql bindValue() when no parameters are
|
||||
defined). (Tony)
|
||||
- Fixed bug #36721 (The SoapServer is not able to send a header that it didn't
|
||||
receive). (Dmitry)
|
||||
- Fixed bug #36697 (Transparency is lost when using imagecreatetruecolor).
|
||||
(Pierre)
|
||||
- Fixed bug #36689 (Removed arbitrary limit on the length of syslog messages).
|
||||
(Ilia)
|
||||
- Fixed bug #36656 (http_build_query generates invalid URIs due to use of
|
||||
square brackets). (Mike)
|
||||
- Fixed bug #36638 (strtotime() returns false when 2nd argument < 1). (Derick)
|
||||
- Fixed bug #36629 (SoapServer::handle() exits on SOAP faults). (Dmitry)
|
||||
- Fixed bug #36625 (pg_trace() does not work). (iakio at mono-space dot net)
|
||||
- Fixed bug #36614 (Segfault when using Soap). (Dmitry)
|
||||
- Fixed bug #36611 (assignment to SimpleXML object attribute changes argument
|
||||
type to string). (Tony)
|
||||
- Fixed bug #36606 (pg_query_params() changes arguments type to string). (Tony)
|
||||
- Fixed bug #36599 (DATE_W3C format constant incorrect). (Derick)
|
||||
- Fixed bug #36575 (SOAP: Incorrect complex type instantiation with
|
||||
hierarchies). (Dmitry)
|
||||
- Fixed bug #36572 (Added PDO::MYSQL_ATTR_DIRECT_QUERY constant that should
|
||||
be set when executing internal queries like "show master status" via MySQL).
|
||||
(Ilia)
|
||||
- Fixed bug #36568 (memory_limit setting on win32 has no effect). (Dmitry)
|
||||
- Fixed bug #36513 (comment will be outputted in last line). (Dmitry)
|
||||
- Fixed bug #36510 (strtotime() fails to parse date strings with tabs).
|
||||
(Ilia, Derick)
|
||||
- Fixed bug #36459 (Incorrect adding PHPSESSID to links, which contains \r\n).
|
||||
(Ilia)
|
||||
- Fixed bug #36458 (sleep() accepts negative values). (Ilia)
|
||||
- Fixed bug #36436 (DBA problem with Berkeley DB4). (Marcus)
|
||||
- Fixed bug #36434 (Improper resolution of declaring class name of an
|
||||
inherited property). (Ilia)
|
||||
- Fixed bug #36420 (segfault when access result->num_rows after calling
|
||||
result->close()). (Ilia,Tony)
|
||||
- Fixed bug #36403 (oci_execute() no longer supports OCI_DESCRIBE_ONLY). (Tony)
|
||||
- Fixed bug #36400 (Custom 5xx error does not return correct HTTP response error
|
||||
code). (Tony)
|
||||
- Fixed bug #36396 (strtotime() fails to parse dates in dd-mm-yyyy format).
|
||||
(Derick)
|
||||
- Fixed bug #36388 (ext/soap crashes when throwing exception and session
|
||||
persistence). (David)
|
||||
- Fixed bug #36382 (PDO/PgSQL's getColumnMeta() crashes). (Derick)
|
||||
- Fixed bug #36359 (splFileObject::fwrite() doesn't write when no data
|
||||
length specified). (Tony)
|
||||
- Fixed bug #36351 (parse_url() does not parse numeric paths properly). (Ilia)
|
||||
- Fixed bug #36345 (PDO/MySQL problem loading BLOB over 1MB). (Ilia)
|
||||
- Fixed bug #36337 (ReflectionProperty fails to return correct visibility).
|
||||
(Ilia)
|
||||
- Fixed bug #36334 (Added missing documentation about realpath cache INI
|
||||
settings). (Ilia)
|
||||
- Fixed bug #36308 (ReflectionProperty::getDocComment() does not reflect
|
||||
extended class commentary). (Ilia)
|
||||
- Fixed bug #36306 (crc32() differ on 32-bit and 64-bit platforms)
|
||||
(anight@eyelinkmedia dot com, Pierre)
|
||||
- Fixed bug #36303 (foreach on error_zval produces segfault). (Dmitry)
|
||||
- Fixed bug #36295 (typo in SplFileObject::flock() parameter name). (Tony)
|
||||
- Fixed bug #36287 (Segfault with SplFileInfo conversion). (Marcus)
|
||||
- Fixed bug #36283 (SOAPClient Compression Broken). (Dmitry)
|
||||
- Fixed bug #36268 (Object destructors called even after fatal errors). (Dmitry)
|
||||
- Fixed bug #36258 (SplFileObject::getPath() may lead to segfault). (Tony)
|
||||
- Fixed bug #36250 (PHP causes ORA-07445 core dump in Oracle server 9.2.x).
|
||||
(Tony)
|
||||
- Fixed bug #36242 (Possible memory corruption in stream_select()). (Tony)
|
||||
- Fixed bug #36235 (ocicolumnname returns false before a successful fetch).
|
||||
(Tony)
|
||||
- Fixed bug #36226 (Inconsistent handling when passing potential arrays).
|
||||
(Dmitry)
|
||||
- Fixed bug #36224 (date(DATE_ATOM) gives wrong results).
|
||||
(Derick, Hannes Magnusson)
|
||||
- Fixed bug #36222 (errorInfo in PDOException is always NULL). (Ilia)
|
||||
- Fixed bug #36208 (symbol namespace conflicts using bundled gd). (Jakub Moc)
|
||||
- Fixed bug #36205 (Memory leaks on duplicate cookies). (Dmitry)
|
||||
- Fixed bug #36185 (str_rot13() crash on non-string parameter). (Pierre)
|
||||
- Fixed bug #36176 (PDO_PGSQL - PDO::exec() does not return number of rows
|
||||
affected by the operation). (Ilia)
|
||||
- Fixed bug #36158 (SIGTERM is not handled correctly when running as a
|
||||
FastCGI server). (Dmitry)
|
||||
- Fixed bug #36152 (problems with curl+ssl and pgsql+ssl in same PHP). (Mike)
|
||||
- Fixed bug #36148 (unpack("H*hex", $data) is adding an extra character to
|
||||
the end of the string). (Ilia)
|
||||
- Fixed bug #36134 (DirectoryIterator constructor failed to detect empty
|
||||
directory names). (Ilia)
|
||||
- Fixed bug #36113 (Reading records of unsupported type causes segfault).
|
||||
(Tony)
|
||||
- Fixed bug #36096 (oci_result() returns garbage after oci_fetch() failed).
|
||||
(Tony)
|
||||
- Fixed bug #36083 (SoapClient waits for responses on one-way operations).
|
||||
(Dmitry)
|
||||
- Fixed bug #36071 (Engine Crash related with 'clone'). (Dmitry)
|
||||
- Fixed bug #36055 (possible OCI8 crash in multi-threaded environment). (Tony)
|
||||
- Fixed bug #36046 (parse_ini_file() miscounts lines in multi-line values).
|
||||
(Ilia)
|
||||
- Fixed bug #36038 (ext/hash compile failure on Mac OSX). (Tony)
|
||||
- Fixed bug #36037 (heredoc adds extra line number). (Dmitry)
|
||||
- Fixed bug #36016 (realpath cache memleaks). (Dmitry, Nuno)
|
||||
- Fixed bug #36011 (Strict errormsg wrong for call_user_func() and the likes).
|
||||
(Marcus)
|
||||
- Fixed bug #36010 (Segfault when re-creating and re-executing statements with
|
||||
bound parameters). (Tony)
|
||||
- Fixed bug #36006 (Problem with $this in __destruct()). (Dmitry)
|
||||
- Fixed bug #35999 (recursive mkdir() does not work with relative path
|
||||
like "foo/bar"). (Tony)
|
||||
- Fixed bug #35998 (SplFileInfo::getPathname() returns unix style filenames
|
||||
in win32). (Marcus)
|
||||
- Fixed bug #35988 (Unknown persistent list entry type in module shutdown).
|
||||
(Dmitry)
|
||||
- Fixed bug #35954 (Fatal com_exception casting object). (Rob)
|
||||
- Fixed bug #35900 (stream_select() should warning when tv_sec is negative).
|
||||
(Ilia)
|
||||
- Fixed bug #35785 (SimpleXML causes memory read error zend engine). (Marcus)
|
||||
- Fixed bug #34272 (empty array onto COM object blows up). (Rob)
|
||||
- Fixed bug #33292 (apache_get_modules() crashes on Windows). (Edin)
|
||||
- Fixed bug #29476 (sqlite_fetch_column_types() locks the database forever).
|
||||
(Ilia)
|
||||
|
||||
12 Jan 2006, PHP 5.1.2
|
||||
- Updated libsqlite in ext/sqlite to 2.8.17. (Ilia)
|
||||
- Updated libsqlite in ext/pdo_sqlite to 3.2.8. (Ilia)
|
||||
|
||||
+46
@@ -480,6 +480,52 @@ void ts_free_thread(void)
|
||||
}
|
||||
|
||||
|
||||
/* frees all resources allocated for all threads except current */
|
||||
void ts_free_worker_threads(void)
|
||||
{
|
||||
tsrm_tls_entry *thread_resources;
|
||||
int i;
|
||||
THREAD_T thread_id = tsrm_thread_id();
|
||||
int hash_value;
|
||||
tsrm_tls_entry *last=NULL;
|
||||
|
||||
tsrm_mutex_lock(tsmm_mutex);
|
||||
hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
|
||||
thread_resources = tsrm_tls_table[hash_value];
|
||||
|
||||
while (thread_resources) {
|
||||
if (thread_resources->thread_id != thread_id) {
|
||||
for (i=0; i<thread_resources->count; i++) {
|
||||
if (resource_types_table[i].dtor) {
|
||||
resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
|
||||
}
|
||||
}
|
||||
for (i=0; i<thread_resources->count; i++) {
|
||||
free(thread_resources->storage[i]);
|
||||
}
|
||||
free(thread_resources->storage);
|
||||
if (last) {
|
||||
last->next = thread_resources->next;
|
||||
} else {
|
||||
tsrm_tls_table[hash_value] = thread_resources->next;
|
||||
}
|
||||
free(thread_resources);
|
||||
if (last) {
|
||||
thread_resources = last->next;
|
||||
} else {
|
||||
thread_resources = tsrm_tls_table[hash_value];
|
||||
}
|
||||
} else {
|
||||
if (thread_resources->next) {
|
||||
last = thread_resources;
|
||||
}
|
||||
thread_resources = thread_resources->next;
|
||||
}
|
||||
}
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
}
|
||||
|
||||
|
||||
/* deallocates all occurrences of a given id */
|
||||
void ts_free_id(ts_rsrc_id id)
|
||||
{
|
||||
|
||||
@@ -106,6 +106,9 @@ TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id);
|
||||
/* frees all resources allocated for the current thread */
|
||||
TSRM_API void ts_free_thread(void);
|
||||
|
||||
/* frees all resources allocated for all threads except current */
|
||||
void ts_free_worker_threads(void);
|
||||
|
||||
/* deallocates all occurrences of a given id */
|
||||
TSRM_API void ts_free_id(ts_rsrc_id id);
|
||||
|
||||
|
||||
+36
-20
@@ -163,18 +163,15 @@ static int php_is_file_ok(const cwd_state *state)
|
||||
static void cwd_globals_ctor(virtual_cwd_globals *cwd_globals TSRMLS_DC)
|
||||
{
|
||||
CWD_STATE_COPY(&cwd_globals->cwd, &main_cwd_state);
|
||||
#ifdef REALPATH_CACHE
|
||||
cwd_globals->realpath_cache_size = 0;
|
||||
cwd_globals->realpath_cache_size_limit = REALPATH_CACHE_SIZE;
|
||||
cwd_globals->realpath_cache_ttl = REALPATH_CACHE_TTL;
|
||||
memset(cwd_globals->realpath_cache, 0, sizeof(cwd_globals->realpath_cache));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cwd_globals_dtor(virtual_cwd_globals *cwd_globals TSRMLS_DC)
|
||||
{
|
||||
CWD_STATE_FREE(&cwd_globals->cwd);
|
||||
#ifdef REALPATH_CACHE
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -187,7 +184,6 @@ static void cwd_globals_dtor(virtual_cwd_globals *cwd_globals TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static char *tsrm_strndup(const char *s, size_t length)
|
||||
@@ -308,7 +304,6 @@ CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC)
|
||||
return buf;
|
||||
}
|
||||
|
||||
#ifdef REALPATH_CACHE
|
||||
static inline unsigned long realpath_cache_key(const char *path, int path_len)
|
||||
{
|
||||
register unsigned long h;
|
||||
@@ -352,19 +347,18 @@ static inline realpath_cache_bucket* realpath_cache_find(const char *path, int p
|
||||
while (*bucket != NULL) {
|
||||
if (CWDG(realpath_cache_ttl) && (*bucket)->expires < t) {
|
||||
realpath_cache_bucket *r = *bucket;
|
||||
*bucket = (*bucket)->next;
|
||||
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
|
||||
free(r);
|
||||
*bucket = (*bucket)->next;
|
||||
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
|
||||
free(r);
|
||||
} else if (key == (*bucket)->key && path_len == (*bucket)->path_len &&
|
||||
memcmp(path, (*bucket)->path, path_len) == 0) {
|
||||
return *bucket;
|
||||
} else {
|
||||
*bucket = (*bucket)->next;
|
||||
bucket = &(*bucket)->next;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Resolve path relatively to state and put the real path into state */
|
||||
@@ -385,20 +379,17 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
#else
|
||||
char *new_path;
|
||||
#endif
|
||||
#ifdef REALPATH_CACHE
|
||||
char orig_path[MAXPATHLEN];
|
||||
int orig_path_len;
|
||||
int orig_path_len = 0;
|
||||
realpath_cache_bucket *bucket;
|
||||
time_t t;
|
||||
time_t t = 0;
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
if (path_length == 0)
|
||||
return (0);
|
||||
if (path_length >= MAXPATHLEN)
|
||||
return (1);
|
||||
|
||||
#ifdef REALPATH_CACHE
|
||||
if (use_realpath && CWDG(realpath_cache_size_limit)) {
|
||||
if (IS_ABSOLUTE_PATH(path, path_length) || (state->cwd_length < 1)) {
|
||||
memcpy(orig_path, path, path_length+1);
|
||||
@@ -430,7 +421,6 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
/* cwd_length can be 0 when getcwd() fails.
|
||||
* This can happen under solaris when a dir does not have read permissions
|
||||
@@ -609,11 +599,9 @@ php_failed_getlongpath:
|
||||
#endif
|
||||
free(free_path);
|
||||
|
||||
#ifdef REALPATH_CACHE
|
||||
if (use_realpath && CWDG(realpath_cache_size_limit)) {
|
||||
realpath_cache_add(orig_path, orig_path_len, state->cwd, state->cwd_length, t TSRMLS_CC);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (verify_path && verify_path(state)) {
|
||||
CWD_STATE_FREE(state);
|
||||
@@ -777,7 +765,7 @@ CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC)
|
||||
}
|
||||
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC)
|
||||
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int link TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int ret;
|
||||
@@ -785,7 +773,15 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, filename, NULL, 0);
|
||||
|
||||
ret = chown(new_state.cwd, owner, group);
|
||||
if (link) {
|
||||
#if HAVE_LCHOWN
|
||||
ret = lchown(new_state.cwd, owner, group);
|
||||
#else
|
||||
ret = -1;
|
||||
#endif
|
||||
} else {
|
||||
ret = chown(new_state.cwd, owner, group);
|
||||
}
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return ret;
|
||||
@@ -1047,6 +1043,26 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
|
||||
|
||||
#endif
|
||||
|
||||
/* On AIX & Tru64 when a file does not exist realpath() returns
|
||||
* NULL, and sets errno to ENOENT. Unlike in other libc implementations
|
||||
* the destination is not filled and remains undefined. Therefor, we
|
||||
* must populate it manually using strcpy as done on systems with no
|
||||
* realpath() function.
|
||||
*/
|
||||
#if defined(__osf__) || defined(_AIX)
|
||||
char *php_realpath_hack(char *src, char *dest)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
if ((ret = realpath(src, dest)) == NULL && errno == ENOENT) {
|
||||
return strcpy(dest, src);
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
|
||||
+9
-23
@@ -166,23 +166,8 @@ CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* On AIX & Tru64 when a file does not exist realpath() returns
|
||||
* NULL, and sets errno to ENOENT. Unlike in other libc implementations
|
||||
* the destination is not filled and remains undefined. Therefor, we
|
||||
* must populate it manually using strcpy as done on systems with no
|
||||
* realpath() function.
|
||||
*/
|
||||
#if defined(__osf__) || defined(_AIX)
|
||||
static char *php_realpath_hack(char *src, char *dest)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
if ((ret = realpath(src, dest)) == NULL && errno == ENOENT) {
|
||||
return strcpy(dest, src);
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
char *php_realpath_hack(char *src, char *dest);
|
||||
#endif
|
||||
|
||||
#if HAVE_UTIME
|
||||
@@ -190,16 +175,14 @@ CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC);
|
||||
#endif
|
||||
CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC);
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC);
|
||||
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int link TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath);
|
||||
|
||||
#define REALPATH_CACHE
|
||||
#define REALPATH_CACHE_TTL (2*60) /* 2 minutes */
|
||||
#define REALPATH_CACHE_SIZE 0 /* disabled while php.ini isn't loaded */
|
||||
|
||||
#ifdef REALPATH_CACHE
|
||||
typedef struct _realpath_cache_bucket {
|
||||
unsigned long key;
|
||||
char *path;
|
||||
@@ -209,16 +192,13 @@ typedef struct _realpath_cache_bucket {
|
||||
time_t expires;
|
||||
struct _realpath_cache_bucket *next;
|
||||
} realpath_cache_bucket;
|
||||
#endif
|
||||
|
||||
typedef struct _virtual_cwd_globals {
|
||||
cwd_state cwd;
|
||||
#ifdef REALPATH_CACHE
|
||||
long realpath_cache_size;
|
||||
long realpath_cache_size_limit;
|
||||
long realpath_cache_ttl;
|
||||
realpath_cache_bucket *realpath_cache[1024];
|
||||
#endif
|
||||
} virtual_cwd_globals;
|
||||
|
||||
#ifdef ZTS
|
||||
@@ -262,7 +242,10 @@ extern virtual_cwd_globals cwd_globals;
|
||||
#endif
|
||||
#define VCWD_CHMOD(path, mode) virtual_chmod(path, mode TSRMLS_CC)
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group TSRMLS_CC)
|
||||
#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group, 0 TSRMLS_CC)
|
||||
#if HAVE_LCHOWN
|
||||
#define VCWD_LCHOWN(path, owner, group) virtual_chown(path, owner, group, 1 TSRMLS_CC)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
@@ -305,6 +288,9 @@ extern virtual_cwd_globals cwd_globals;
|
||||
#define VCWD_CHMOD(path, mode) chmod(path, mode)
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
#define VCWD_CHOWN(path, owner, group) chown(path, owner, group)
|
||||
#if HAVE_LCHOWN
|
||||
#define VCWD_LCHOWN(path, owner, group) lchown(path, owner, group)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+3
-3
@@ -179,7 +179,7 @@ function fibo($n) {
|
||||
|
||||
/****/
|
||||
|
||||
function hash($n) {
|
||||
function hash1($n) {
|
||||
for ($i = 1; $i <= $n; $i++) {
|
||||
$X[dechex($i)] = $i;
|
||||
}
|
||||
@@ -401,8 +401,8 @@ ary3(2000);
|
||||
$t = end_test($t, "ary3(2000)");
|
||||
fibo(30);
|
||||
$t = end_test($t, "fibo(30)");
|
||||
hash(50000);
|
||||
$t = end_test($t, "hash(50000)");
|
||||
hash1(50000);
|
||||
$t = end_test($t, "hash1(50000)");
|
||||
hash2(500);
|
||||
$t = end_test($t, "hash2(500)");
|
||||
heapsort(20000);
|
||||
|
||||
@@ -92,11 +92,7 @@ $object->test();
|
||||
--EXPECTF--
|
||||
test_func1
|
||||
test_func2
|
||||
|
||||
Strict Standards: Non-static method test_class::test_func3() cannot be called statically, assuming $this from compatible context test_class in %sbug29210.php on line %d
|
||||
test_func3
|
||||
|
||||
Strict Standards: Non-static method test_class::test_func4() cannot be called statically, assuming $this from compatible context test_class in %sbug29210.php on line %d
|
||||
test_func4
|
||||
test_func1 isn't callable from outside
|
||||
test_func2 isn't callable from outside
|
||||
@@ -104,9 +100,5 @@ test_func3 isn't callable from outside
|
||||
test_func4 isn't callable from outside
|
||||
test_func1 isn't callable from child
|
||||
test_func2
|
||||
|
||||
Strict Standards: Non-static method test_class::test_func3() cannot be called statically, assuming $this from compatible context foo in %sbug29210.php on line %d
|
||||
test_func3 isn't callable from child
|
||||
|
||||
Strict Standards: Non-static method test_class::test_func4() cannot be called statically, assuming $this from compatible context foo in %sbug29210.php on line %d
|
||||
test_func4
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
bug #34873 (Segmentation Fault on foreach in object)
|
||||
Bug #34873 (Segmentation Fault on foreach in object)
|
||||
--FILE--
|
||||
<?php
|
||||
class pwa {
|
||||
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Bug #36006 (Problem with $this in __destruct())
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Person {
|
||||
public $dad;
|
||||
public function __destruct() {
|
||||
$this->dad = null; /* no segfault if this is commented out */
|
||||
}
|
||||
}
|
||||
|
||||
class Dad extends Person {
|
||||
public $son;
|
||||
public function __construct() {
|
||||
$this->son = new Person;
|
||||
$this->son->dad = $this; /* no segfault if this is commented out */
|
||||
}
|
||||
public function __destruct() {
|
||||
$this->son = null;
|
||||
parent::__destruct(); /* segfault here */
|
||||
}
|
||||
}
|
||||
|
||||
$o = new Dad;
|
||||
unset($o);
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #36037 (heredoc adds extra line number)
|
||||
--FILE--
|
||||
<?php
|
||||
echo __LINE__, "\n";
|
||||
$x=<<<XXX
|
||||
123
|
||||
YYY;
|
||||
XXX;
|
||||
echo __LINE__, "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
2
|
||||
7
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #36071 (Engine Crash related with 'clone')
|
||||
--INI--
|
||||
error_reporting=4095
|
||||
--FILE--
|
||||
<?php
|
||||
$a = clone 0;
|
||||
$a[0]->b = 0;
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: __clone method called on non-object in %sbug36071.php on line 2
|
||||
ok
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #36268 (Object destructors called even after fatal errors)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
function __destruct() {
|
||||
echo "Ha!\n";
|
||||
}
|
||||
}
|
||||
$x = new Foo();
|
||||
bar();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Call to undefined function bar() in %sbug36268.php on line 8
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #36303 (foreach on error_zval produces segfault)
|
||||
--FILE--
|
||||
<?php
|
||||
$x="test";
|
||||
foreach($x->a->b as &$v) {
|
||||
}
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Invalid argument supplied for foreach() in %sbug36303.php on line 3
|
||||
ok
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #36513 (comment will be outputed in last line)
|
||||
--FILE--
|
||||
<?php
|
||||
function test($s) {
|
||||
echo "'".trim(str_replace(" ", " ", htmlspecialchars_decode(strip_tags(highlight_string($s,1)))))."'\n";
|
||||
}
|
||||
|
||||
eval('echo "1";//2');
|
||||
eval('echo 3; //{ 4?>5');
|
||||
echo "\n";
|
||||
|
||||
//test('<?php echo "1";//');
|
||||
test('<?php echo "1";//2');
|
||||
test('<?php echo "1";//22');
|
||||
test('<?php echo 3; // 4 ?>5');
|
||||
?>
|
||||
--EXPECT--
|
||||
135
|
||||
'<?php echo "1";//2'
|
||||
'<?php echo "1";//22'
|
||||
'<?php echo 3; // 4 ?>5'
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #36568 (memory_limit has no effect)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!function_exists('memory_get_usage')) die('skip PHP is configured without memory_limit');
|
||||
?>
|
||||
--INI--
|
||||
memory_limit=16M
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("memory_limit", "32M");
|
||||
echo ini_get("memory_limit");
|
||||
?>
|
||||
--EXPECT--
|
||||
32M
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #37046 (foreach breaks static scope)
|
||||
--FILE--
|
||||
<?php
|
||||
function s() {
|
||||
static $storage = array(array('x', 'y'));
|
||||
return $storage[0];
|
||||
}
|
||||
|
||||
foreach (s() as $k => $function) {
|
||||
echo "op1 $k\n";
|
||||
if ($k == 0) {
|
||||
foreach (s() as $k => $function) {
|
||||
echo "op2 $k\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
op1 0
|
||||
op2 0
|
||||
op2 1
|
||||
op1 1
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #37138 (__autoload tries to load callback'ed self and parent)
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload ($CN) {var_dump ($CN);}
|
||||
class st {
|
||||
public static function e () {echo ("EHLO\n");}
|
||||
public static function e2 () {call_user_func (array ('self', 'e'));}
|
||||
}
|
||||
class stch extends st {
|
||||
public static function g () {call_user_func (array ('parent', 'e'));}
|
||||
}
|
||||
st::e ();
|
||||
st::e2 ();
|
||||
stch::g ();
|
||||
?>
|
||||
--EXPECT--
|
||||
EHLO
|
||||
EHLO
|
||||
EHLO
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
zend_strtod() leaks on big doubles
|
||||
--INI--
|
||||
precision=14
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump("1139932690.21688500" - "1139932790.21688500");
|
||||
var_dump("1139932690000.21688500" - "331139932790.21688500");
|
||||
var_dump("339932690.21688500" - "4564645646456463461139932790.21688500");
|
||||
var_dump("123123139932690.21688500" - "11399327900000000.21688500");
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
float(-100)
|
||||
float(808792757210)
|
||||
float(-4.5646456464565E+27)
|
||||
float(-11276204760067000)
|
||||
Done
|
||||
+12
-4
@@ -237,11 +237,19 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
|
||||
} else {
|
||||
if(Z_OBJ_HANDLER_P(expr, get)) {
|
||||
zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC);
|
||||
|
||||
z->refcount++;
|
||||
if(Z_TYPE_P(z) != IS_OBJECT) {
|
||||
zend_make_printable_zval(z, expr_copy, use_copy);
|
||||
FREE_ZVAL(z);
|
||||
if (*use_copy) {
|
||||
zval_ptr_dtor(&z);
|
||||
} else {
|
||||
ZVAL_ZVAL(expr_copy, z, 0, 1);
|
||||
*use_copy = 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
zval_ptr_dtor(&z);
|
||||
}
|
||||
}
|
||||
if (EG(exception)) {
|
||||
@@ -869,7 +877,7 @@ static int exec_done_cb(zend_module_entry *module TSRMLS_DC)
|
||||
void zend_post_deactivate_modules(TSRMLS_D)
|
||||
{
|
||||
zend_hash_apply(&module_registry, (apply_func_t) exec_done_cb TSRMLS_CC);
|
||||
zend_hash_apply(&module_registry, (apply_func_t) module_registry_unload_temp TSRMLS_CC);
|
||||
zend_hash_reverse_apply(&module_registry, (apply_func_t) module_registry_unload_temp TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
@@ -1017,7 +1025,7 @@ ZEND_API void zend_error(int type, const char *format, ...)
|
||||
}
|
||||
zval_ptr_dtor(&retval);
|
||||
}
|
||||
} else {
|
||||
} else if (!EG(exception)) {
|
||||
/* The user error handler failed, use built-in error handler */
|
||||
zend_error_cb(type, error_filename, error_lineno, format, args);
|
||||
}
|
||||
@@ -1046,7 +1054,7 @@ ZEND_API void zend_error(int type, const char *format, ...)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux)
|
||||
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX)
|
||||
void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((alias("zend_error"),noreturn));
|
||||
#endif
|
||||
|
||||
|
||||
+2
-2
@@ -91,7 +91,7 @@ const char *zend_mh_bundle_error(void);
|
||||
|
||||
#endif /* HAVE_MACH_O_DYLD_H */
|
||||
|
||||
#if defined(HAVE_LIBDL) && !defined(HAVE_MACH_O_DYLD_H)
|
||||
#if defined(HAVE_LIBDL) && !defined(HAVE_MACH_O_DYLD_H) && !defined(ZEND_WIN32)
|
||||
|
||||
# ifndef RTLD_LAZY
|
||||
# define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
|
||||
@@ -250,7 +250,7 @@ char *alloca ();
|
||||
#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval **return_value_ptr, zval *this_ptr, int return_value_used TSRMLS_DC
|
||||
#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, return_value_ptr, this_ptr, return_value_used TSRMLS_CC
|
||||
|
||||
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux)
|
||||
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX)
|
||||
# define ZEND_VM_ALWAYS_INLINE __attribute__ ((always_inline))
|
||||
void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((noreturn));
|
||||
#else
|
||||
|
||||
+105
-43
@@ -271,7 +271,7 @@ ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uin
|
||||
}
|
||||
|
||||
|
||||
static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
|
||||
static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **spec TSRMLS_DC)
|
||||
{
|
||||
char *spec_walk = *spec;
|
||||
char c = *spec_walk++;
|
||||
@@ -445,6 +445,21 @@ static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
|
||||
}
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
{
|
||||
HashTable **p = va_arg(*va, HashTable **);
|
||||
if (Z_TYPE_PP(arg) != IS_ARRAY) {
|
||||
if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
|
||||
*p = NULL;
|
||||
} else {
|
||||
return "array";
|
||||
}
|
||||
} else {
|
||||
*p = Z_ARRVAL_PP(arg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
{
|
||||
zval **p = va_arg(*va, zval **);
|
||||
@@ -477,6 +492,41 @@ static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
|
||||
}
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
{
|
||||
zend_class_entry **lookup, **pce = va_arg(*va, zend_class_entry **);
|
||||
zend_class_entry *ce_base = *pce;
|
||||
|
||||
convert_to_string_ex(arg);
|
||||
if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &lookup TSRMLS_CC) == FAILURE) {
|
||||
*pce = NULL;
|
||||
} else {
|
||||
*pce = *lookup;
|
||||
}
|
||||
if (ce_base) {
|
||||
if ((!*pce || !instanceof_function(*pce, ce_base TSRMLS_CC)) && !return_null) {
|
||||
char *space;
|
||||
char *class_name = get_active_class_name(&space TSRMLS_CC);
|
||||
zend_error(E_WARNING, "%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given",
|
||||
class_name, space, get_active_function_name(TSRMLS_C),
|
||||
arg_num, ce_base->name, Z_STRVAL_PP(arg));
|
||||
*pce = NULL;
|
||||
return "";
|
||||
}
|
||||
}
|
||||
if (!*pce && !return_null) {
|
||||
char *space;
|
||||
char *class_name = get_active_class_name(&space TSRMLS_CC);
|
||||
zend_error(E_WARNING, "%s%s%s() expects parameter %d to be a valid class name, '%s' given",
|
||||
class_name, space, get_active_function_name(TSRMLS_C),
|
||||
arg_num, Z_STRVAL_PP(arg));
|
||||
return "";
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
{
|
||||
zval **p = va_arg(*va, zval **);
|
||||
@@ -510,7 +560,7 @@ static int zend_parse_arg(int arg_num, zval **arg, va_list *va, char **spec, int
|
||||
{
|
||||
char *expected_type = NULL;
|
||||
|
||||
expected_type = zend_parse_arg_impl(arg, va, spec TSRMLS_CC);
|
||||
expected_type = zend_parse_arg_impl(arg_num, arg, va, spec TSRMLS_CC);
|
||||
if (expected_type) {
|
||||
if (!quiet) {
|
||||
char *space;
|
||||
@@ -545,6 +595,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl
|
||||
case 'r': case 'a':
|
||||
case 'o': case 'O':
|
||||
case 'z': case 'Z':
|
||||
case 'C': case 'h':
|
||||
max_num_args++;
|
||||
break;
|
||||
|
||||
@@ -760,6 +811,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
|
||||
zend_class_entry *old_scope = *scope;
|
||||
|
||||
*scope = class_type;
|
||||
zend_hash_apply_with_argument(&class_type->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
|
||||
zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
|
||||
if (!CE_STATIC_MEMBERS(class_type)) {
|
||||
@@ -1494,8 +1546,8 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL;
|
||||
char *lowercase_name;
|
||||
int fname_len;
|
||||
char *lc_class_name;
|
||||
int class_name_len;
|
||||
char *lc_class_name = NULL;
|
||||
int class_name_len = 0;
|
||||
|
||||
if (type==MODULE_PERSISTENT) {
|
||||
error_type = E_CORE_WARNING;
|
||||
@@ -1538,8 +1590,10 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
}
|
||||
if (ptr->flags) {
|
||||
if (!(ptr->flags & ZEND_ACC_PPP_MASK)) {
|
||||
zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
|
||||
internal_function->fn_flags = ZEND_ACC_PUBLIC;
|
||||
if (ptr->flags != ZEND_ACC_DEPRECATED || scope) {
|
||||
zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
|
||||
}
|
||||
internal_function->fn_flags = ZEND_ACC_PUBLIC | ptr->flags;
|
||||
} else {
|
||||
internal_function->fn_flags = ptr->flags;
|
||||
}
|
||||
@@ -1801,11 +1855,7 @@ int module_registry_cleanup(zend_module_entry *module TSRMLS_DC)
|
||||
|
||||
int module_registry_unload_temp(zend_module_entry *module TSRMLS_DC)
|
||||
{
|
||||
switch (module->type) {
|
||||
case MODULE_TEMPORARY:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
return (module->type == MODULE_TEMPORARY) ? ZEND_HASH_APPLY_REMOVE : ZEND_HASH_APPLY_STOP;
|
||||
}
|
||||
|
||||
|
||||
@@ -1974,7 +2024,7 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int zend_is_callable_check_func(int check_flags, zval **zobj_ptr, zend_class_entry *ce_org, zval *callable, zend_class_entry **ce_ptr, zend_function **fptr_ptr TSRMLS_DC)
|
||||
static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, zend_class_entry *ce_org, zval *callable, zend_class_entry **ce_ptr, zend_function **fptr_ptr TSRMLS_DC)
|
||||
{
|
||||
int retval;
|
||||
char *lcname, *lmname, *colon;
|
||||
@@ -1989,18 +2039,16 @@ static int zend_is_callable_check_func(int check_flags, zval **zobj_ptr, zend_cl
|
||||
if ((colon = strstr(Z_STRVAL_P(callable), "::")) != NULL) {
|
||||
clen = colon - Z_STRVAL_P(callable);
|
||||
mlen = Z_STRLEN_P(callable) - clen - 2;
|
||||
if (zend_lookup_class(Z_STRVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) {
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), clen);
|
||||
/* caution: lcname is not '\0' terminated */
|
||||
if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) {
|
||||
*ce_ptr = EG(scope);
|
||||
} else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
|
||||
*ce_ptr = EG(scope) ? EG(scope)->parent : NULL;
|
||||
} else if (zend_lookup_class(Z_STRVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) {
|
||||
*ce_ptr = *pce;
|
||||
} else {
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), clen);
|
||||
/* caution: lcname is not '\0' terminated */
|
||||
if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) {
|
||||
*ce_ptr = EG(scope);
|
||||
} else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
|
||||
*ce_ptr = EG(scope) ? EG(scope)->parent : NULL;
|
||||
}
|
||||
efree(lcname);
|
||||
}
|
||||
efree(lcname);
|
||||
if (!*ce_ptr) {
|
||||
return 0;
|
||||
}
|
||||
@@ -2023,23 +2071,28 @@ static int zend_is_callable_check_func(int check_flags, zval **zobj_ptr, zend_cl
|
||||
retval = zend_hash_find(ftable, lmname, mlen+1, (void**)&fptr) == SUCCESS ? 1 : 0;
|
||||
|
||||
if (!retval) {
|
||||
if (zobj_ptr && *ce_ptr && (*ce_ptr)->__call != 0) {
|
||||
if (*zobj_ptr_ptr && *ce_ptr && (*ce_ptr)->__call != 0) {
|
||||
retval = (*ce_ptr)->__call != NULL;
|
||||
*fptr_ptr = (*ce_ptr)->__call;
|
||||
}
|
||||
} else {
|
||||
*fptr_ptr = fptr;
|
||||
if (*ce_ptr) {
|
||||
if (!zobj_ptr && !(fptr->common.fn_flags & ZEND_ACC_STATIC)) {
|
||||
if (!*zobj_ptr_ptr && !(fptr->common.fn_flags & ZEND_ACC_STATIC)) {
|
||||
if ((check_flags & IS_CALLABLE_CHECK_IS_STATIC) != 0) {
|
||||
retval = 0;
|
||||
} else {
|
||||
zend_error(E_STRICT, "Non-static method %s::%s() cannot be called statically", (*ce_ptr)->name, fptr->common.function_name);
|
||||
if (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), *ce_ptr TSRMLS_CC)) {
|
||||
*zobj_ptr_ptr = &EG(This);
|
||||
zend_error(E_STRICT, "Non-static method %s::%s() cannot be called statically, assuming $this from compatible context %s", (*ce_ptr)->name, fptr->common.function_name, Z_OBJCE_P(EG(This))->name);
|
||||
} else {
|
||||
zend_error(E_STRICT, "Non-static method %s::%s() cannot be called statically", (*ce_ptr)->name, fptr->common.function_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (retval && (check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0) {
|
||||
if (fptr->op_array.fn_flags & ZEND_ACC_PRIVATE) {
|
||||
if (!zend_check_private(fptr, zobj_ptr ? Z_OBJCE_PP(zobj_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) {
|
||||
if (!zend_check_private(fptr, *zobj_ptr_ptr ? Z_OBJCE_PP(*zobj_ptr_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) {
|
||||
retval = 0;
|
||||
}
|
||||
} else if ((fptr->common.fn_flags & ZEND_ACC_PROTECTED)) {
|
||||
@@ -2063,6 +2116,9 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
|
||||
zend_function *fptr_local;
|
||||
zval **zobj_ptr_local;
|
||||
|
||||
if (callable_name) {
|
||||
*callable_name = NULL;
|
||||
}
|
||||
if (callable_name_len == NULL) {
|
||||
callable_name_len = &callable_name_len_local;
|
||||
}
|
||||
@@ -2089,7 +2145,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
|
||||
return 1;
|
||||
}
|
||||
|
||||
retval = zend_is_callable_check_func(check_flags|IS_CALLABLE_CHECK_IS_STATIC, NULL, NULL, callable, ce_ptr, fptr_ptr TSRMLS_CC);
|
||||
retval = zend_is_callable_check_func(check_flags|IS_CALLABLE_CHECK_IS_STATIC, zobj_ptr_ptr, NULL, callable, ce_ptr, fptr_ptr TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case IS_ARRAY:
|
||||
@@ -2121,23 +2177,15 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
|
||||
if (Z_STRLEN_PP(obj) == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self")) == 0) {
|
||||
ce = EG(active_op_array)->scope;
|
||||
} else if (Z_STRLEN_PP(obj) == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent")) == 0 && EG(active_op_array)->scope) {
|
||||
ce = EG(active_op_array)->scope->parent;
|
||||
} else if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
|
||||
ce = *pce;
|
||||
} else if (EG(active_op_array)) {
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
|
||||
if (Z_STRLEN_PP(obj) == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self")) == 0) {
|
||||
ce = EG(active_op_array)->scope;
|
||||
} else if (Z_STRLEN_PP(obj) == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent")) == 0 && EG(active_op_array)->scope) {
|
||||
ce = EG(active_op_array)->scope->parent;
|
||||
}
|
||||
efree(lcname);
|
||||
}
|
||||
if (EG(This)) {
|
||||
if (instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
|
||||
*zobj_ptr_ptr = &EG(This);
|
||||
zend_error(E_STRICT, "Non-static method %s::%s() cannot be called statically, assuming $this from compatible context %s", ce->name, Z_STRVAL_PP(method), Z_OBJCE_P(EG(This))->name);
|
||||
}
|
||||
}
|
||||
efree(lcname);
|
||||
} else {
|
||||
ce = Z_OBJCE_PP(obj); /* TBFixed: what if it's overloaded? */
|
||||
|
||||
@@ -2162,7 +2210,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
|
||||
}
|
||||
|
||||
if (ce) {
|
||||
retval = zend_is_callable_check_func(check_flags, *zobj_ptr_ptr, ce, *method, ce_ptr, fptr_ptr TSRMLS_CC);
|
||||
retval = zend_is_callable_check_func(check_flags, zobj_ptr_ptr, ce, *method, ce_ptr, fptr_ptr TSRMLS_CC);
|
||||
}
|
||||
} else if (callable_name) {
|
||||
*callable_name = estrndup("Array", sizeof("Array")-1);
|
||||
@@ -2395,6 +2443,20 @@ ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_
|
||||
return zend_hash_update(&ce->constants_table, name, name_length+1, &value, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, char *name, size_t name_length TSRMLS_DC)
|
||||
{
|
||||
zval *constant;
|
||||
|
||||
if (ce->type & ZEND_INTERNAL_CLASS) {
|
||||
constant = malloc(sizeof(zval));
|
||||
} else {
|
||||
ALLOC_ZVAL(constant);
|
||||
}
|
||||
ZVAL_NULL(constant);
|
||||
INIT_PZVAL(constant);
|
||||
return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC)
|
||||
{
|
||||
zval *constant;
|
||||
|
||||
@@ -50,7 +50,9 @@ typedef struct _zend_function_entry {
|
||||
|
||||
#define ZEND_NAMED_FE(zend_name, name, arg_info) ZEND_FENTRY(zend_name, name, arg_info, 0)
|
||||
#define ZEND_FE(name, arg_info) ZEND_FENTRY(name, ZEND_FN(name), arg_info, 0)
|
||||
#define ZEND_DEP_FE(name, arg_info) ZEND_FENTRY(name, ZEND_FN(name), arg_info, ZEND_ACC_DEPRECATED)
|
||||
#define ZEND_FALIAS(name, alias, arg_info) ZEND_FENTRY(name, ZEND_FN(alias), arg_info, 0)
|
||||
#define ZEND_DEP_FALIAS(name, alias, arg_info) ZEND_FENTRY(name, ZEND_FN(alias), arg_info, ZEND_ACC_DEPRECATED)
|
||||
#define ZEND_ME(classname, name, arg_info, flags) ZEND_FENTRY(name, ZEND_FN(classname##_##name), arg_info, flags)
|
||||
#define ZEND_ABSTRACT_ME(classname, name, arg_info) ZEND_FENTRY(name, NULL, arg_info, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
|
||||
#define ZEND_MALIAS(classname, name, alias, arg_info, flags) \
|
||||
@@ -221,6 +223,7 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int
|
||||
ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, char *value, int value_len, int access_type TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_t name_length, zval *value TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, char *name, size_t name_length TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, char *name, size_t name_length, zend_bool value TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, char *name, size_t name_length, double value TSRMLS_DC);
|
||||
|
||||
@@ -40,6 +40,14 @@ ZEND_BEGIN_ARG_INFO(fourth_arg_force_ref, 0)
|
||||
ZEND_ARG_PASS_INFO(1)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(fifth_arg_force_ref, 0)
|
||||
ZEND_ARG_PASS_INFO(0)
|
||||
ZEND_ARG_PASS_INFO(0)
|
||||
ZEND_ARG_PASS_INFO(0)
|
||||
ZEND_ARG_PASS_INFO(0)
|
||||
ZEND_ARG_PASS_INFO(1)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(all_args_by_ref, 1)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
@@ -314,6 +314,12 @@ ZEND_FUNCTION(strncmp)
|
||||
convert_to_string_ex(s1);
|
||||
convert_to_string_ex(s2);
|
||||
convert_to_long_ex(s3);
|
||||
|
||||
if (Z_LVAL_PP(s3) < 0) {
|
||||
zend_error(E_WARNING, "Length must be greater than or equal to 0");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(zend_binary_zval_strncmp(*s1, *s2, *s3));
|
||||
}
|
||||
/* }}} */
|
||||
@@ -347,6 +353,12 @@ ZEND_FUNCTION(strncasecmp)
|
||||
convert_to_string_ex(s1);
|
||||
convert_to_string_ex(s2);
|
||||
convert_to_long_ex(s3);
|
||||
|
||||
if (Z_LVAL_PP(s3) < 0) {
|
||||
zend_error(E_WARNING, "Length must be greater than or equal to 0");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(zend_binary_zval_strncasecmp(*s1, *s2, *s3));
|
||||
}
|
||||
/* }}} */
|
||||
@@ -768,11 +780,16 @@ ZEND_FUNCTION(get_object_vars)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
properties = Z_OBJ_HT_PP(obj)->get_properties(*obj TSRMLS_CC);
|
||||
|
||||
if (properties == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
instanceof = EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), Z_OBJCE_PP(obj) TSRMLS_CC);
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
properties = Z_OBJ_HT_PP(obj)->get_properties(*obj TSRMLS_CC);
|
||||
zend_hash_internal_pointer_reset_ex(properties, &pos);
|
||||
|
||||
while (zend_hash_get_current_data_ex(properties, (void **) &value, &pos) == SUCCESS) {
|
||||
@@ -1693,8 +1710,6 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
}
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
while (ptr) {
|
||||
char *free_class_name = NULL;
|
||||
|
||||
@@ -1801,7 +1816,11 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
debug_print_backtrace_args(arg_array TSRMLS_CC);
|
||||
zval_ptr_dtor(&arg_array);
|
||||
}
|
||||
zend_printf(") called at [%s:%d]\n", filename, lineno);
|
||||
if (filename) {
|
||||
zend_printf(") called at [%s:%d]\n", filename, lineno);
|
||||
} else {
|
||||
ZEND_PUTS(")\n");
|
||||
}
|
||||
include_filename = filename;
|
||||
ptr = skip->prev_execute_data;
|
||||
++indent;
|
||||
|
||||
+38
-10
@@ -2940,13 +2940,7 @@ void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC)
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(property);
|
||||
|
||||
if (value) {
|
||||
*property = value->u.constant;
|
||||
} else {
|
||||
INIT_PZVAL(property);
|
||||
property->type = IS_NULL;
|
||||
}
|
||||
*property = value->u.constant;
|
||||
|
||||
if (zend_hash_add(&CG(active_class_entry)->constants_table, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL)==FAILURE) {
|
||||
FREE_ZVAL(property);
|
||||
@@ -3095,6 +3089,33 @@ void zend_do_end_new_object(znode *result, znode *new_token, znode *argument_lis
|
||||
*result = CG(active_op_array)->opcodes[new_token->u.opline_num].result;
|
||||
}
|
||||
|
||||
static int zend_constant_ct_subst(znode *result, zval *const_name TSRMLS_DC)
|
||||
{
|
||||
zend_constant *c = NULL;
|
||||
|
||||
if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name), Z_STRLEN_P(const_name)+1, (void **) &c) == FAILURE) {
|
||||
char *lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name), Z_STRLEN_P(const_name));
|
||||
|
||||
if (zend_hash_find(EG(zend_constants), lookup_name, Z_STRLEN_P(const_name)+1, (void **) &c)==SUCCESS) {
|
||||
if ((c->flags & CONST_CS) && memcmp(c->name, Z_STRVAL_P(const_name), Z_STRLEN_P(const_name))!=0) {
|
||||
c = NULL;
|
||||
}
|
||||
} else {
|
||||
c = NULL;
|
||||
}
|
||||
efree(lookup_name);
|
||||
}
|
||||
if (c && (c->flags & CONST_CT_SUBST)) {
|
||||
zval_dtor(const_name);
|
||||
result->op_type = IS_CONST;
|
||||
result->u.constant = c->value;
|
||||
zval_copy_ctor(&result->u.constant);
|
||||
INIT_PZVAL(&result->u.constant);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode TSRMLS_DC)
|
||||
{
|
||||
switch (mode) {
|
||||
@@ -3102,13 +3123,15 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
|
||||
if (constant_container) {
|
||||
zend_do_fetch_class_name(NULL, constant_container, constant_name TSRMLS_CC);
|
||||
*result = *constant_container;
|
||||
} else {
|
||||
result->u.constant.type = IS_CONSTANT;
|
||||
} else if (!zend_constant_ct_subst(result, &constant_name->u.constant TSRMLS_CC)) {
|
||||
*result = *constant_name;
|
||||
result->u.constant.type = IS_CONSTANT;
|
||||
}
|
||||
result->u.constant.type = IS_CONSTANT;
|
||||
break;
|
||||
case ZEND_RT:
|
||||
{
|
||||
if (constant_container ||
|
||||
!zend_constant_ct_subst(result, &constant_name->u.constant TSRMLS_CC)) {
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
opline->opcode = ZEND_FETCH_CONSTANT;
|
||||
@@ -3227,6 +3250,9 @@ void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr)
|
||||
case IS_DOUBLE:
|
||||
zend_hash_index_update(result->u.constant.value.ht, (long)offset->u.constant.value.dval, &element, sizeof(zval *), NULL);
|
||||
break;
|
||||
case IS_CONSTANT_ARRAY:
|
||||
zend_error(E_ERROR, "Illegal offset type");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
zend_hash_next_index_insert(result->u.constant.value.ht, &element, sizeof(zval *), NULL);
|
||||
@@ -3755,6 +3781,8 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC)
|
||||
}
|
||||
efree(val->u.constant.value.str.val);
|
||||
#endif /* ZEND_MULTIBYTE */
|
||||
} else {
|
||||
zval_dtor(&val->u.constant);
|
||||
}
|
||||
zval_dtor(&var->u.constant);
|
||||
}
|
||||
|
||||
@@ -136,6 +136,9 @@ typedef struct _zend_try_catch_element {
|
||||
/* shadow of parent's private method/property */
|
||||
#define ZEND_ACC_SHADOW 0x20000
|
||||
|
||||
/* deprecation flag */
|
||||
#define ZEND_ACC_DEPRECATED 0x40000
|
||||
|
||||
char *zend_visibility_string(zend_uint fn_flags);
|
||||
|
||||
|
||||
@@ -514,6 +517,7 @@ ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC);
|
||||
ZEND_API void zend_file_handle_dtor(zend_file_handle *fh);
|
||||
ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC);
|
||||
ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC);
|
||||
|
||||
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
|
||||
ZEND_API void zend_function_dtor(zend_function *function);
|
||||
|
||||
+5
-14
@@ -5,7 +5,7 @@
|
||||
| Copyright (c) 1998-2006 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 |
|
||||
| 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 |
|
||||
@@ -23,8 +23,9 @@
|
||||
#define ZEND_CONFIG_W32_H
|
||||
|
||||
#define USE_ZEND_ALLOC 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
#include <../main/config.w32.h>
|
||||
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
|
||||
#include <malloc.h>
|
||||
@@ -44,19 +45,9 @@
|
||||
typedef unsigned long ulong;
|
||||
typedef unsigned int uint;
|
||||
|
||||
#undef HAVE_KILL
|
||||
#define HAVE_GETPID 1
|
||||
/* #define HAVE_ALLOCA_H 1 */
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIOSTR_H 1
|
||||
#define HAVE_CLASS_ISTDIOSTREAM
|
||||
#define istdiostream stdiostream
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_STRCOLL 1
|
||||
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
@@ -87,7 +78,7 @@ typedef unsigned int uint;
|
||||
#define ZEND_DLEXPORT __declspec(dllexport)
|
||||
#define ZEND_DLIMPORT __declspec(dllimport)
|
||||
|
||||
/* 0x00200000L is MB_SERVICE_NOTIFICATION, which is only supported under Windows NT
|
||||
/* 0x00200000L is MB_SERVICE_NOTIFICATION, which is only supported under Windows NT
|
||||
* (and requires _WIN32_WINNT to be defined, which prevents the resulting executable
|
||||
* from running under Windows 9x
|
||||
* Windows 9x should silently ignore it, so it's being used here directly
|
||||
|
||||
+18
-15
@@ -55,11 +55,13 @@ void zend_copy_constants(HashTable *target, HashTable *source)
|
||||
|
||||
static int clean_non_persistent_constant(zend_constant *c TSRMLS_DC)
|
||||
{
|
||||
if (c->flags & CONST_PERSISTENT) {
|
||||
return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
|
||||
} else {
|
||||
return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
return (c->flags & CONST_PERSISTENT) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
|
||||
|
||||
static int clean_non_persistent_constant_full(zend_constant *c TSRMLS_DC)
|
||||
{
|
||||
return (c->flags & CONST_PERSISTENT) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,8 +114,7 @@ void zend_register_standard_constants(TSRMLS_D)
|
||||
{
|
||||
zend_constant c;
|
||||
|
||||
c.value.type = IS_BOOL;
|
||||
c.flags = CONST_PERSISTENT;
|
||||
c.flags = CONST_PERSISTENT | CONST_CT_SUBST;
|
||||
c.module_number = 0;
|
||||
|
||||
c.name = zend_strndup(ZEND_STRL("TRUE"));
|
||||
@@ -128,16 +129,18 @@ void zend_register_standard_constants(TSRMLS_D)
|
||||
c.value.type = IS_BOOL;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
|
||||
c.name = zend_strndup(ZEND_STRL("NULL"));
|
||||
c.name_len = sizeof("NULL");
|
||||
c.value.type = IS_NULL;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
|
||||
c.flags = CONST_PERSISTENT;
|
||||
|
||||
c.name = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE"));
|
||||
c.name_len = sizeof("ZEND_THREAD_SAFE");
|
||||
c.value.value.lval = ZTS_V;
|
||||
c.value.type = IS_BOOL;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
|
||||
c.name = zend_strndup(ZEND_STRL("NULL"));
|
||||
c.name_len = sizeof("NULL");
|
||||
c.value.type = IS_NULL;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +156,7 @@ int zend_shutdown_constants(TSRMLS_D)
|
||||
void clean_non_persistent_constants(TSRMLS_D)
|
||||
{
|
||||
if (EG(full_tables_cleanup)) {
|
||||
zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC);
|
||||
zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant_full TSRMLS_CC);
|
||||
} else {
|
||||
zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC);
|
||||
}
|
||||
@@ -309,8 +312,8 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
|
||||
|
||||
if (!(c->flags & CONST_CS)) {
|
||||
/* keep in mind that c->name_len already contains the '\0' */
|
||||
lowercase_name = estrndup(c->name, c->name_len);
|
||||
zend_str_tolower(lowercase_name, c->name_len);
|
||||
lowercase_name = estrndup(c->name, c->name_len-1);
|
||||
zend_str_tolower(lowercase_name, c->name_len-1);
|
||||
name = lowercase_name;
|
||||
} else {
|
||||
name = c->name;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#define CONST_CS (1<<0) /* Case Sensitive */
|
||||
#define CONST_PERSISTENT (1<<1) /* Persistent */
|
||||
#define CONST_CT_SUBST (2<<1) /* Allow compile-time substitution */
|
||||
|
||||
#define PHP_USER_CONSTANT INT_MAX /* a constant defined in user space */
|
||||
|
||||
|
||||
+13
-3
@@ -177,8 +177,8 @@ static inline zval *_get_zval_ptr_var(znode *node, temp_variable *Ts, zend_free_
|
||||
should_free->var = ptr;
|
||||
|
||||
if (T->str_offset.str->type != IS_STRING
|
||||
|| ((int)T->str_offset.offset<0)
|
||||
|| (T->str_offset.str->value.str.len <= T->str_offset.offset)) {
|
||||
|| ((int)T->str_offset.offset < 0)
|
||||
|| (T->str_offset.str->value.str.len <= (int)T->str_offset.offset)) {
|
||||
zend_error(E_NOTICE, "Uninitialized string offset: %d", T->str_offset.offset);
|
||||
ptr->value.str.val = STR_EMPTY_ALLOC();
|
||||
ptr->value.str.len = 0;
|
||||
@@ -545,6 +545,16 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode
|
||||
zval *value = get_zval_ptr(value_op, Ts, &free_value, BP_VAR_R);
|
||||
zval **retval = &T(result->u.var).var.ptr;
|
||||
|
||||
if (*object_ptr == EG(error_zval_ptr)) {
|
||||
FREE_OP(free_op2);
|
||||
if (!RETURN_VALUE_UNUSED(result)) {
|
||||
*retval = EG(uninitialized_zval_ptr);
|
||||
PZVAL_LOCK(*retval);
|
||||
}
|
||||
FREE_OP(free_value);
|
||||
return;
|
||||
}
|
||||
|
||||
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
|
||||
object = *object_ptr;
|
||||
|
||||
@@ -648,7 +658,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
|
||||
zend_error(E_WARNING, "Illegal string offset: %d", T->str_offset.offset);
|
||||
break;
|
||||
}
|
||||
if (T->str_offset.offset >= T->str_offset.str->value.str.len) {
|
||||
if ((int)T->str_offset.offset >= T->str_offset.str->value.str.len) {
|
||||
zend_uint i;
|
||||
|
||||
if (T->str_offset.str->value.str.len==0) {
|
||||
|
||||
+60
-29
@@ -51,7 +51,7 @@ static DWORD timeout_thread_id;
|
||||
static int timeout_thread_initialized=0;
|
||||
#endif
|
||||
|
||||
#if ZEND_DEBUG
|
||||
#if 0&&ZEND_DEBUG
|
||||
static void (*original_sigsegv_handler)(int);
|
||||
static void zend_handle_sigsegv(int dummy)
|
||||
{
|
||||
@@ -95,23 +95,27 @@ static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC)
|
||||
}
|
||||
|
||||
|
||||
static int is_not_internal_function(zend_function *function TSRMLS_DC)
|
||||
static int clean_non_persistent_function(zend_function *function TSRMLS_DC)
|
||||
{
|
||||
if (function->type == ZEND_INTERNAL_FUNCTION) {
|
||||
return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
|
||||
} else {
|
||||
return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
|
||||
|
||||
static int is_not_internal_class(zend_class_entry **ce TSRMLS_DC)
|
||||
static int clean_non_persistent_function_full(zend_function *function TSRMLS_DC)
|
||||
{
|
||||
if ((*ce)->type == ZEND_INTERNAL_CLASS) {
|
||||
return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
|
||||
} else {
|
||||
return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
return (function->type != ZEND_INTERNAL_FUNCTION);
|
||||
}
|
||||
|
||||
|
||||
static int clean_non_persistent_class(zend_class_entry **ce TSRMLS_DC)
|
||||
{
|
||||
return ((*ce)->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
|
||||
|
||||
static int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC)
|
||||
{
|
||||
return ((*ce)->type != ZEND_INTERNAL_CLASS);
|
||||
}
|
||||
|
||||
|
||||
@@ -251,18 +255,22 @@ void shutdown_executor(TSRMLS_D)
|
||||
So we want first of all to clean up all data and then move to tables destruction.
|
||||
Note that only run-time accessed data need to be cleaned up, pre-defined data can
|
||||
not contain objects and thus are not probelmatic */
|
||||
zend_hash_apply(EG(function_table), (apply_func_t) zend_cleanup_function_data TSRMLS_CC);
|
||||
if (EG(full_tables_cleanup)) {
|
||||
zend_hash_apply(EG(function_table), (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
|
||||
} else {
|
||||
zend_hash_reverse_apply(EG(function_table), (apply_func_t) zend_cleanup_function_data TSRMLS_CC);
|
||||
}
|
||||
zend_hash_apply(EG(class_table), (apply_func_t) zend_cleanup_class_data TSRMLS_CC);
|
||||
|
||||
zend_ptr_stack_destroy(&EG(argument_stack));
|
||||
|
||||
/* Destroy all op arrays */
|
||||
if (EG(full_tables_cleanup)) {
|
||||
zend_hash_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC);
|
||||
zend_hash_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC);
|
||||
zend_hash_apply(EG(function_table), (apply_func_t) clean_non_persistent_function_full TSRMLS_CC);
|
||||
zend_hash_apply(EG(class_table), (apply_func_t) clean_non_persistent_class_full TSRMLS_CC);
|
||||
} else {
|
||||
zend_hash_reverse_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(function_table), (apply_func_t) clean_non_persistent_function TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(class_table), (apply_func_t) clean_non_persistent_class TSRMLS_CC);
|
||||
}
|
||||
|
||||
while (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
|
||||
@@ -278,7 +286,7 @@ void shutdown_executor(TSRMLS_D)
|
||||
} zend_end_try();
|
||||
|
||||
zend_try {
|
||||
#if ZEND_DEBUG
|
||||
#if 0&&ZEND_DEBUG
|
||||
signal(SIGSEGV, original_sigsegv_handler);
|
||||
#endif
|
||||
|
||||
@@ -482,7 +490,7 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (const_value.type == IS_STRING && const_value.value.str.len == str_index_len-1 &&
|
||||
if (const_value.type == IS_STRING && const_value.value.str.len == (int)str_index_len-1 &&
|
||||
!strncmp(const_value.value.str.val, str_index, str_index_len)) {
|
||||
/* constant value is the same as its name */
|
||||
zval_dtor(&const_value);
|
||||
@@ -582,6 +590,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
zend_op **original_opline_ptr;
|
||||
zend_class_entry *current_scope;
|
||||
zend_class_entry *calling_scope = NULL;
|
||||
zend_class_entry *check_scope_or_static = NULL;
|
||||
zval *current_this;
|
||||
zend_execute_data execute_data;
|
||||
zval *method_name;
|
||||
@@ -607,6 +616,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
execute_data = *EG(current_execute_data);
|
||||
EX(op_array) = NULL;
|
||||
EX(opline) = NULL;
|
||||
EX(object) = NULL;
|
||||
} else {
|
||||
/* This only happens when we're called outside any execute()'s
|
||||
* It shouldn't be strictly necessary to NULL execute_data out,
|
||||
@@ -662,6 +672,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
ce = &(EG(active_op_array)->scope);
|
||||
found = (*ce != NULL?SUCCESS:FAILURE);
|
||||
fci->object_pp = EG(This)?&EG(This):NULL;
|
||||
EX(object) = EG(This);
|
||||
} else if (strcmp(Z_STRVAL_PP(fci->object_pp), "parent") == 0 && EG(active_op_array)) {
|
||||
|
||||
if (!EG(active_op_array)->scope) {
|
||||
@@ -673,6 +684,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
ce = &(EG(active_op_array)->scope->parent);
|
||||
found = (*ce != NULL?SUCCESS:FAILURE);
|
||||
fci->object_pp = EG(This)?&EG(This):NULL;
|
||||
EX(object) = EG(This);
|
||||
} else {
|
||||
zend_class_entry *scope;
|
||||
scope = EG(active_op_array) ? EG(active_op_array)->scope : NULL;
|
||||
@@ -685,6 +697,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
instanceof_function(Z_OBJCE_P(EG(This)), scope TSRMLS_CC) &&
|
||||
instanceof_function(scope, *ce TSRMLS_CC)) {
|
||||
fci->object_pp = &EG(This);
|
||||
EX(object) = EG(This);
|
||||
} else {
|
||||
fci->object_pp = NULL;
|
||||
}
|
||||
@@ -713,16 +726,18 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
if (calling_scope && (colon = strstr(fname, "::")) != NULL) {
|
||||
int clen = colon - fname;
|
||||
int mlen = fname_len - clen - 2;
|
||||
zend_class_entry **pce, *ce_child;
|
||||
zend_class_entry **pce, *ce_child = NULL;
|
||||
if (zend_lookup_class(fname, clen, &pce TSRMLS_CC) == SUCCESS) {
|
||||
ce_child = *pce;
|
||||
} else {
|
||||
char *lcname = zend_str_tolower_dup(fname, clen);
|
||||
/* caution: lcname is not '\0' terminated */
|
||||
if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) {
|
||||
ce_child = EG(active_op_array) ? EG(active_op_array)->scope : NULL;
|
||||
} else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
|
||||
ce_child = EG(active_op_array) && EG(active_op_array)->scope ? EG(scope)->parent : NULL;
|
||||
if (calling_scope) {
|
||||
if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) {
|
||||
ce_child = EG(active_op_array) ? EG(active_op_array)->scope : NULL;
|
||||
} else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
|
||||
ce_child = EG(active_op_array) && EG(active_op_array)->scope ? EG(scope)->parent : NULL;
|
||||
}
|
||||
}
|
||||
efree(lcname);
|
||||
}
|
||||
@@ -730,10 +745,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
zend_error(E_ERROR, "Cannot call method %s() or method does not exist", fname);
|
||||
return FAILURE;
|
||||
}
|
||||
if (!instanceof_function(calling_scope, ce_child TSRMLS_CC)) {
|
||||
zend_error(E_ERROR, "Cannot call method %s() of class %s which is not a derived from %s", fname, ce_child->name, calling_scope->name);
|
||||
return 0;
|
||||
}
|
||||
check_scope_or_static = calling_scope;
|
||||
fci->function_table = &ce_child->function_table;
|
||||
calling_scope = ce_child;
|
||||
fname = fname + clen + 2;
|
||||
@@ -760,6 +772,12 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
EX(function_state).function =
|
||||
zend_std_get_static_method(calling_scope, function_name_lc, fname_len TSRMLS_CC);
|
||||
efree(function_name_lc);
|
||||
if (check_scope_or_static && EX(function_state).function
|
||||
&& !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)
|
||||
&& !instanceof_function(check_scope_or_static, calling_scope TSRMLS_CC)) {
|
||||
zend_error(E_ERROR, "Cannot call method %s() of class %s which is not a derived from %s", fname, calling_scope->name, check_scope_or_static->name);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
char *function_name_lc = zend_str_tolower_dup(fname, fname_len);
|
||||
|
||||
@@ -796,6 +814,19 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
EX(function_state).function = fci_cache->function_handler;
|
||||
calling_scope = fci_cache->calling_scope;
|
||||
fci->object_pp = fci_cache->object_pp;
|
||||
EX(object) = fci->object_pp ? *fci->object_pp : NULL;
|
||||
}
|
||||
|
||||
if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) {
|
||||
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
|
||||
}
|
||||
if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
|
||||
zend_error(E_STRICT, "Function %s%s%s() is deprecated",
|
||||
EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
|
||||
EX(function_state).function->common.scope ? "::" : "",
|
||||
EX(function_state).function->common.function_name);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<fci->param_count; i++) {
|
||||
|
||||
+16
-18
@@ -102,14 +102,14 @@ ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength)
|
||||
|
||||
#define UPDATE_DATA(ht, p, pData, nDataSize) \
|
||||
if (nDataSize == sizeof(void*)) { \
|
||||
if (!(p)->pDataPtr) { \
|
||||
pefree_rel((p)->pData, (ht)->persistent); \
|
||||
if ((p)->pData != &(p)->pDataPtr) { \
|
||||
pefree_rel((p)->pData, (ht)->persistent); \
|
||||
} \
|
||||
memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
|
||||
(p)->pData = &(p)->pDataPtr; \
|
||||
} else { \
|
||||
if ((p)->pDataPtr) { \
|
||||
(p)->pData = (void *) pemalloc_rel(nDataSize, (ht)->persistent); \
|
||||
if ((p)->pData == &(p)->pDataPtr) { \
|
||||
(p)->pData = (void *) pemalloc_rel(nDataSize, (ht)->persistent); \
|
||||
(p)->pDataPtr=NULL; \
|
||||
} else { \
|
||||
(p)->pData = (void *) perealloc_rel((p)->pData, nDataSize, (ht)->persistent); \
|
||||
@@ -123,9 +123,9 @@ ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength)
|
||||
memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
|
||||
(p)->pData = &(p)->pDataPtr; \
|
||||
} else { \
|
||||
(p)->pData = (void *) pemalloc_rel(nDataSize, (ht)->persistent); \
|
||||
(p)->pData = (void *) pemalloc_rel(nDataSize, (ht)->persistent);\
|
||||
if (!(p)->pData) { \
|
||||
pefree_rel(p, (ht)->persistent); \
|
||||
pefree_rel(p, (ht)->persistent); \
|
||||
return FAILURE; \
|
||||
} \
|
||||
memcpy((p)->pData, pData, nDataSize); \
|
||||
@@ -461,8 +461,10 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLen
|
||||
|
||||
p = ht->arBuckets[nIndex];
|
||||
while (p != NULL) {
|
||||
if ((p->h == h) && ((p->nKeyLength == 0) || /* Numeric index */
|
||||
((p->nKeyLength == nKeyLength) && (!memcmp(p->arKey, arKey, nKeyLength))))) {
|
||||
if ((p->h == h)
|
||||
&& (p->nKeyLength == nKeyLength)
|
||||
&& ((p->nKeyLength == 0) /* Numeric index (short circuits the memcmp() check) */
|
||||
|| !memcmp(p->arKey, arKey, nKeyLength))) { /* String index */
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
if (p == ht->arBuckets[nIndex]) {
|
||||
ht->arBuckets[nIndex] = p->pNext;
|
||||
@@ -489,7 +491,7 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLen
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(p->pData);
|
||||
}
|
||||
if (!p->pDataPtr) {
|
||||
if (p->pData != &p->pDataPtr) {
|
||||
pefree(p->pData, ht->persistent);
|
||||
}
|
||||
pefree(p, ht->persistent);
|
||||
@@ -518,7 +520,7 @@ ZEND_API void zend_hash_destroy(HashTable *ht)
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(q->pData);
|
||||
}
|
||||
if (!q->pDataPtr && q->pData) {
|
||||
if (q->pData != &q->pDataPtr) {
|
||||
pefree(q->pData, ht->persistent);
|
||||
}
|
||||
pefree(q, ht->persistent);
|
||||
@@ -544,7 +546,7 @@ ZEND_API void zend_hash_clean(HashTable *ht)
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(q->pData);
|
||||
}
|
||||
if (!q->pDataPtr && q->pData) {
|
||||
if (q->pData != &q->pDataPtr) {
|
||||
pefree(q->pData, ht->persistent);
|
||||
}
|
||||
pefree(q, ht->persistent);
|
||||
@@ -573,7 +575,7 @@ static Bucket *zend_hash_apply_deleter(HashTable *ht, Bucket *p)
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(p->pData);
|
||||
}
|
||||
if (!p->pDataPtr) {
|
||||
if (p->pData != &p->pDataPtr) {
|
||||
pefree(p->pData, ht->persistent);
|
||||
}
|
||||
retval = p->pListNext;
|
||||
@@ -732,11 +734,7 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR
|
||||
q = p;
|
||||
p = p->pListLast;
|
||||
if (result & ZEND_HASH_APPLY_REMOVE) {
|
||||
if (q->nKeyLength>0) {
|
||||
zend_hash_del(ht, q->arKey, q->nKeyLength);
|
||||
} else {
|
||||
zend_hash_index_del(ht, q->h);
|
||||
}
|
||||
zend_hash_apply_deleter(ht, q);
|
||||
}
|
||||
if (result & ZEND_HASH_APPLY_STOP) {
|
||||
break;
|
||||
@@ -1259,7 +1257,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;
|
||||
Bucket *p1, *p2 = NULL;
|
||||
int result;
|
||||
void *pData2;
|
||||
|
||||
|
||||
@@ -249,25 +249,26 @@ string_or_value:
|
||||
expr { $$ = $1; }
|
||||
| CFG_TRUE { $$ = $1; }
|
||||
| CFG_FALSE { $$ = $1; }
|
||||
| var_string_list { $$ = $1; }
|
||||
| '\n' { zend_ini_init_string(&$$); }
|
||||
| /* empty */ { zend_ini_init_string(&$$); }
|
||||
;
|
||||
|
||||
|
||||
var_string_list:
|
||||
var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
|
||||
cfg_var_ref { $$ = $1; }
|
||||
| TC_ENCAPSULATED_STRING { $$ = $1; }
|
||||
| constant_string { $$ = $1; }
|
||||
| var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
|
||||
| var_string_list TC_ENCAPSULATED_STRING { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
|
||||
| var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); }
|
||||
| /* empty */ { zend_ini_init_string(&$$); }
|
||||
| var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
|
||||
;
|
||||
|
||||
cfg_var_ref:
|
||||
TC_DOLLAR_CURLY TC_STRING '}' { zend_ini_get_var(&$$, &$2); }
|
||||
TC_DOLLAR_CURLY TC_STRING '}' { zend_ini_get_var(&$$, &$2); free($2.value.str.val); }
|
||||
;
|
||||
|
||||
expr:
|
||||
constant_string { $$ = $1; }
|
||||
var_string_list { $$ = $1; }
|
||||
| expr '|' expr { zend_ini_do_op('|', &$$, &$1, &$3); }
|
||||
| expr '&' expr { zend_ini_do_op('&', &$$, &$1, &$3); }
|
||||
| '~' expr { zend_ini_do_op('~', &$$, &$2, NULL); }
|
||||
|
||||
@@ -139,8 +139,18 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
|
||||
|
||||
<INITIAL>["][^"]*["] {
|
||||
char *p = yytext;
|
||||
|
||||
/* ENCAPSULATED TC_STRING */
|
||||
|
||||
while ((p = strpbrk(p, "\r\n"))) {
|
||||
if (*p == '\r' && *(p + 1) == '\n') {
|
||||
p++;
|
||||
}
|
||||
SCNG(lineno)++;
|
||||
p++;
|
||||
}
|
||||
|
||||
/* eat trailing " */
|
||||
yytext[yyleng-1]=0;
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ static zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce,
|
||||
if (!ce || !ce_it || !ce_it->get_iterator || (ce_it->get_iterator == zend_user_it_get_new_iterator && iterator == object)) {
|
||||
if (!EG(exception))
|
||||
{
|
||||
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce->name);
|
||||
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce ? ce->name : Z_OBJCE_P(object)->name);
|
||||
}
|
||||
if (iterator)
|
||||
{
|
||||
@@ -336,7 +336,7 @@ static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entr
|
||||
} else if (class_type->get_iterator != zend_user_it_get_new_iterator) {
|
||||
/* c-level get_iterator cannot be changed (exception being only Traversable is implmented) */
|
||||
if (class_type->num_interfaces) {
|
||||
for (i = 0; i < class_type->num_interfaces; i++) {
|
||||
for (i = 0; i < (int)class_type->num_interfaces; i++) {
|
||||
if (class_type->interfaces[i] == zend_ce_iterator) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ method_body:
|
||||
|
||||
variable_modifiers:
|
||||
non_empty_member_modifiers { $$ = $1; }
|
||||
| T_VAR { zend_error(E_STRICT, "var: Deprecated. Please use the public/private/protected modifiers"); $$.u.constant.value.lval = ZEND_ACC_PUBLIC; }
|
||||
| T_VAR { $$.u.constant.value.lval = ZEND_ACC_PUBLIC; }
|
||||
;
|
||||
|
||||
method_modifiers:
|
||||
|
||||
@@ -1461,7 +1461,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
yymore();
|
||||
}
|
||||
|
||||
<ST_ONE_LINE_COMMENT>[^\n\r?%>]+{ANY_CHAR} {
|
||||
<ST_ONE_LINE_COMMENT>[^\n\r?%>]*{ANY_CHAR} {
|
||||
switch (yytext[yyleng-1]) {
|
||||
case '?': case '%': case '>':
|
||||
yyless(yyleng-1);
|
||||
@@ -1491,7 +1491,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
<ST_ONE_LINE_COMMENT>"?>"|"%>" {
|
||||
if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */
|
||||
zendlval->value.str.val = yytext; /* no copying - intentional */
|
||||
zendlval->value.str.len = yyleng;
|
||||
zendlval->value.str.len = yyleng-2;
|
||||
zendlval->type = IS_STRING;
|
||||
yyless(yyleng-2);
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
@@ -1734,7 +1734,6 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
<ST_HEREDOC>^{LABEL}(";")?{NEWLINE} {
|
||||
int label_len;
|
||||
|
||||
CG(zend_lineno)++;
|
||||
if (yytext[yyleng-2]=='\r') {
|
||||
label_len = yyleng-2;
|
||||
} else {
|
||||
@@ -1755,6 +1754,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
return T_END_HEREDOC;
|
||||
} else {
|
||||
CG(zend_lineno)++;
|
||||
zend_copy_value(zendlval, yytext, yyleng);
|
||||
zendlval->type = IS_STRING;
|
||||
return T_STRING;
|
||||
|
||||
@@ -36,6 +36,7 @@ extern struct _zend_arg_info first_arg_force_ref[2];
|
||||
extern struct _zend_arg_info second_arg_force_ref[3];
|
||||
extern struct _zend_arg_info third_arg_force_ref[4];
|
||||
extern struct _zend_arg_info fourth_arg_force_ref[5];
|
||||
extern struct _zend_arg_info fifth_arg_force_ref[6];
|
||||
extern struct _zend_arg_info all_args_by_ref[1];
|
||||
|
||||
#define ZEND_MODULE_API_NO 20050922
|
||||
|
||||
+21
-6
@@ -25,6 +25,26 @@
|
||||
#include "zend_API.h"
|
||||
#include "zend_interfaces.h"
|
||||
|
||||
ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC)
|
||||
{
|
||||
ALLOC_HASHTABLE(object->properties);
|
||||
zend_hash_init(object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
|
||||
object->ce = ce;
|
||||
object->guards = NULL;
|
||||
}
|
||||
|
||||
ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC)
|
||||
{
|
||||
if (object->guards) {
|
||||
zend_hash_destroy(object->guards);
|
||||
FREE_HASHTABLE(object->guards);
|
||||
}
|
||||
if (object->properties) {
|
||||
zend_hash_destroy(object->properties);
|
||||
FREE_HASHTABLE(object->properties);
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC)
|
||||
{
|
||||
@@ -88,12 +108,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
|
||||
|
||||
ZEND_API void zend_objects_free_object_storage(zend_object *object TSRMLS_DC)
|
||||
{
|
||||
if (object->guards) {
|
||||
zend_hash_destroy(object->guards);
|
||||
FREE_HASHTABLE(object->guards);
|
||||
}
|
||||
zend_hash_destroy(object->properties);
|
||||
FREE_HASHTABLE(object->properties);
|
||||
zend_object_std_dtor(object TSRMLS_CC);
|
||||
efree(object);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "zend.h"
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC);
|
||||
ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC);
|
||||
ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class_type TSRMLS_DC);
|
||||
ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC);
|
||||
ZEND_API zend_object *zend_objects_get_address(zval *object TSRMLS_DC);
|
||||
|
||||
@@ -33,6 +33,7 @@ ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint ini
|
||||
objects->top = 1; /* Skip 0 so that handles are true */
|
||||
objects->size = init_size;
|
||||
objects->free_list_head = -1;
|
||||
memset(&objects->object_buckets[0], 0, sizeof(zend_object_store_bucket));
|
||||
}
|
||||
|
||||
ZEND_API void zend_objects_store_destroy(zend_objects_store *objects)
|
||||
@@ -52,7 +53,9 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
|
||||
if (!objects->object_buckets[i].destructor_called) {
|
||||
objects->object_buckets[i].destructor_called = 1;
|
||||
if (obj->dtor && obj->object) {
|
||||
obj->refcount++;
|
||||
obj->dtor(obj->object, i TSRMLS_CC);
|
||||
obj->refcount--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
-4
@@ -132,7 +132,17 @@ ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC)
|
||||
{
|
||||
if (function->type == ZEND_USER_FUNCTION) {
|
||||
zend_cleanup_op_array_data((zend_op_array *) function);
|
||||
}
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
} else {
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC)
|
||||
{
|
||||
if (function->type == ZEND_USER_FUNCTION) {
|
||||
zend_cleanup_op_array_data((zend_op_array *) function);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -142,7 +152,7 @@ ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC)
|
||||
/* Clean all parts that can contain run-time data */
|
||||
/* Note that only run-time accessed data need to be cleaned up, pre-defined data can
|
||||
not contain objects and thus are not probelmatic */
|
||||
zend_hash_apply(&(*pce)->function_table, (apply_func_t) zend_cleanup_function_data TSRMLS_CC);
|
||||
zend_hash_apply(&(*pce)->function_table, (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
|
||||
(*pce)->static_members = NULL;
|
||||
} else if (CE_STATIC_MEMBERS(*pce)) {
|
||||
zend_hash_destroy(CE_STATIC_MEMBERS(*pce));
|
||||
@@ -357,8 +367,10 @@ int pass_two(zend_op_array *op_array TSRMLS_DC)
|
||||
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array TSRMLS_CC);
|
||||
}
|
||||
|
||||
op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last);
|
||||
op_array->size = op_array->last;
|
||||
if (!CG(interactive) && op_array->size != op_array->last) {
|
||||
op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last);
|
||||
op_array->size = op_array->last;
|
||||
}
|
||||
|
||||
opline = op_array->opcodes;
|
||||
end = opline + op_array->last;
|
||||
|
||||
+38
-14
@@ -1267,9 +1267,9 @@ ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_
|
||||
}
|
||||
|
||||
|
||||
static inline void zend_free_obj_get_result(zval *op, int free_op)
|
||||
static inline void zend_free_obj_get_result(zval *op)
|
||||
{
|
||||
if (free_op) {
|
||||
if (op) {
|
||||
if (op->refcount == 0) {
|
||||
zval_dtor(op);
|
||||
FREE_ZVAL(op);
|
||||
@@ -1280,26 +1280,50 @@ static inline void zend_free_obj_get_result(zval *op, int free_op)
|
||||
}
|
||||
|
||||
#define COMPARE_RETURN_AND_FREE(retval) \
|
||||
zend_free_obj_get_result(op1_orig, free_op1); \
|
||||
zend_free_obj_get_result(op2_orig, free_op2); \
|
||||
zend_free_obj_get_result(op1_free); \
|
||||
zend_free_obj_get_result(op2_free); \
|
||||
return retval;
|
||||
|
||||
ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
zval op1_copy, op2_copy;
|
||||
zend_bool free_op1 = 0, free_op2 = 0;
|
||||
zval *op1_orig, *op2_orig;
|
||||
zval *op1_free, *op2_free;
|
||||
int op1_obj = op1->type == IS_OBJECT;
|
||||
int op2_obj = op2->type == IS_OBJECT;
|
||||
|
||||
if (op1->type == IS_OBJECT && Z_OBJ_HT_P(op1)->get) {
|
||||
op1 = Z_OBJ_HT_P(op1)->get(op1 TSRMLS_CC);
|
||||
free_op1 = 1;
|
||||
if (op1_obj) {
|
||||
if (Z_OBJ_HT_P(op1)->get) {
|
||||
op1 = op1_free = Z_OBJ_HT_P(op1)->get(op1 TSRMLS_CC);
|
||||
} else if (!op2_obj && Z_OBJ_HT_P(op1)->cast_object) {
|
||||
ALLOC_INIT_ZVAL(op1_free);
|
||||
if (Z_OBJ_HT_P(op1)->cast_object(op1, op1_free, Z_TYPE_P(op2), 0 TSRMLS_CC) == FAILURE) {
|
||||
op2_free = NULL;
|
||||
ZVAL_BOOL(result, 0);
|
||||
COMPARE_RETURN_AND_FREE(FAILURE);
|
||||
}
|
||||
op1 = op1_free;
|
||||
} else {
|
||||
op1_free = NULL;
|
||||
}
|
||||
} else {
|
||||
op1_free = NULL;
|
||||
}
|
||||
op1_orig = op1;
|
||||
if (op2->type == IS_OBJECT && Z_OBJ_HT_P(op2)->get) {
|
||||
op2 = Z_OBJ_HT_P(op2)->get(op2 TSRMLS_CC);
|
||||
free_op2 = 1;
|
||||
if (op2_obj) {
|
||||
if (Z_OBJ_HT_P(op2)->get) {
|
||||
op2 = op2_free = Z_OBJ_HT_P(op2)->get(op2 TSRMLS_CC);
|
||||
} else if (!op1_obj && Z_OBJ_HT_P(op2)->cast_object) {
|
||||
ALLOC_INIT_ZVAL(op2_free);
|
||||
if (Z_OBJ_HT_P(op2)->cast_object(op2, op2_free, Z_TYPE_P(op1), 0 TSRMLS_CC) == FAILURE) {
|
||||
ZVAL_BOOL(result, 0);
|
||||
COMPARE_RETURN_AND_FREE(FAILURE);
|
||||
}
|
||||
op2 = op2_free;
|
||||
} else {
|
||||
op2_free = NULL;
|
||||
}
|
||||
} else {
|
||||
op2_free = NULL;
|
||||
}
|
||||
op2_orig = op2;
|
||||
|
||||
if ((op1->type == IS_NULL && op2->type == IS_STRING)
|
||||
|| (op2->type == IS_NULL && op1->type == IS_STRING)) {
|
||||
|
||||
+18
-1
@@ -130,6 +130,7 @@ typedef unsigned long int uint32_t;
|
||||
* but the word order is big endian.
|
||||
*/
|
||||
#define IEEE_BIG_ENDIAN
|
||||
#undef IEEE_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __vax__
|
||||
@@ -1250,7 +1251,7 @@ zend_strtod
|
||||
_double rv, rv0;
|
||||
Long L;
|
||||
ULong y, z;
|
||||
Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
|
||||
Bigint *bb, *bb1, *bd, *bd0, *bs, *delta, *tmp;
|
||||
double result;
|
||||
|
||||
CONST char decimal_point = '.';
|
||||
@@ -1776,5 +1777,21 @@ zend_strtod
|
||||
if (se)
|
||||
*se = (char *)s;
|
||||
result = sign ? -value(rv) : value(rv);
|
||||
|
||||
for (i = 0; i <= Kmax; i++) {
|
||||
Bigint **listp = &freelist[i];
|
||||
while ((tmp = *listp) != NULL) {
|
||||
*listp = tmp->next;
|
||||
free(tmp);
|
||||
}
|
||||
freelist[i] = NULL;
|
||||
}
|
||||
|
||||
while (p5s) {
|
||||
tmp = p5s;
|
||||
p5s = p5s->next;
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
+42
-8
@@ -1723,6 +1723,15 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV)
|
||||
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
EX(object) = NULL;
|
||||
} else {
|
||||
if (OP2_TYPE != IS_UNUSED &&
|
||||
EG(This) &&
|
||||
Z_OBJ_HT_P(EG(This))->get_class_entry &&
|
||||
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
|
||||
/* We are calling method of the other (incompatible) class,
|
||||
but passing $this. This is done for compatibility with php-4. */
|
||||
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
|
||||
|
||||
}
|
||||
if ((EX(object) = EG(This))) {
|
||||
EX(object)->refcount++;
|
||||
}
|
||||
@@ -1784,9 +1793,17 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
zend_bool should_change_scope;
|
||||
zend_op *ctor_opline;
|
||||
|
||||
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
|
||||
ZEND_VM_NEXT_OPCODE(); /* Never reached */
|
||||
if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) {
|
||||
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
|
||||
ZEND_VM_NEXT_OPCODE(); /* Never reached */
|
||||
}
|
||||
if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
|
||||
zend_error(E_STRICT, "Function %s%s%s() is deprecated",
|
||||
EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
|
||||
EX(function_state).function->common.scope ? "::" : "",
|
||||
EX(function_state).function->common.function_name);
|
||||
};
|
||||
}
|
||||
|
||||
zend_ptr_stack_2_push(&EG(argument_stack), (void *) opline->extended_value, NULL);
|
||||
@@ -2983,7 +3000,9 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
|
||||
}
|
||||
array_ptr = *array_ptr_ptr;
|
||||
} else {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
|
||||
if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
|
||||
}
|
||||
array_ptr = *array_ptr_ptr;
|
||||
array_ptr->refcount++;
|
||||
}
|
||||
@@ -2998,7 +3017,20 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
|
||||
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
|
||||
ce = Z_OBJCE_P(array_ptr);
|
||||
} else {
|
||||
array_ptr->refcount++;
|
||||
if (OP1_TYPE == IS_VAR &&
|
||||
free_op1.var == NULL &&
|
||||
!array_ptr->is_ref &&
|
||||
array_ptr->refcount > 1) {
|
||||
/* non-separated return value from function */
|
||||
zval *tmp;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
INIT_PZVAL_COPY(tmp, array_ptr);
|
||||
zval_copy_ctor(tmp);
|
||||
array_ptr = tmp;
|
||||
} else {
|
||||
array_ptr->refcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3086,7 +3118,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
||||
HashTable *fe_ht;
|
||||
zend_object_iterator *iter = NULL;
|
||||
int key_type;
|
||||
zend_bool use_key = opline->extended_value & ZEND_FE_FETCH_WITH_KEY;
|
||||
zend_bool use_key = (zend_bool)(opline->extended_value & ZEND_FE_FETCH_WITH_KEY);
|
||||
|
||||
PZVAL_LOCK(array);
|
||||
|
||||
@@ -3204,7 +3236,9 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
||||
key->value.lval = int_key;
|
||||
key->type = IS_LONG;
|
||||
break;
|
||||
EMPTY_SWITCH_DEFAULT_CASE()
|
||||
default:
|
||||
ZVAL_NULL(key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3404,8 +3438,8 @@ ZEND_VM_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|C
|
||||
|
||||
ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV, ANY)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
if (OP1_TYPE != IS_UNUSED) {
|
||||
zend_op *opline = EX(opline);
|
||||
zend_free_op free_op1;
|
||||
zval *ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
|
||||
+135
-20
@@ -132,9 +132,17 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
|
||||
zend_bool should_change_scope;
|
||||
zend_op *ctor_opline;
|
||||
|
||||
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
|
||||
ZEND_VM_NEXT_OPCODE(); /* Never reached */
|
||||
if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) {
|
||||
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
|
||||
ZEND_VM_NEXT_OPCODE(); /* Never reached */
|
||||
}
|
||||
if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
|
||||
zend_error(E_STRICT, "Function %s%s%s() is deprecated",
|
||||
EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
|
||||
EX(function_state).function->common.scope ? "::" : "",
|
||||
EX(function_state).function->common.function_name);
|
||||
};
|
||||
}
|
||||
|
||||
zend_ptr_stack_2_push(&EG(argument_stack), (void *) opline->extended_value, NULL);
|
||||
@@ -670,6 +678,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
|
||||
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
EX(object) = NULL;
|
||||
} else {
|
||||
if (IS_CONST != IS_UNUSED &&
|
||||
EG(This) &&
|
||||
Z_OBJ_HT_P(EG(This))->get_class_entry &&
|
||||
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
|
||||
/* We are calling method of the other (incompatible) class,
|
||||
but passing $this. This is done for compatibility with php-4. */
|
||||
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
|
||||
|
||||
}
|
||||
if ((EX(object) = EG(This))) {
|
||||
EX(object)->refcount++;
|
||||
}
|
||||
@@ -862,6 +879,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
||||
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
EX(object) = NULL;
|
||||
} else {
|
||||
if (IS_TMP_VAR != IS_UNUSED &&
|
||||
EG(This) &&
|
||||
Z_OBJ_HT_P(EG(This))->get_class_entry &&
|
||||
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
|
||||
/* We are calling method of the other (incompatible) class,
|
||||
but passing $this. This is done for compatibility with php-4. */
|
||||
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
|
||||
|
||||
}
|
||||
if ((EX(object) = EG(This))) {
|
||||
EX(object)->refcount++;
|
||||
}
|
||||
@@ -1011,6 +1037,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
||||
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
EX(object) = NULL;
|
||||
} else {
|
||||
if (IS_VAR != IS_UNUSED &&
|
||||
EG(This) &&
|
||||
Z_OBJ_HT_P(EG(This))->get_class_entry &&
|
||||
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
|
||||
/* We are calling method of the other (incompatible) class,
|
||||
but passing $this. This is done for compatibility with php-4. */
|
||||
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
|
||||
|
||||
}
|
||||
if ((EX(object) = EG(This))) {
|
||||
EX(object)->refcount++;
|
||||
}
|
||||
@@ -1159,6 +1194,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
|
||||
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
EX(object) = NULL;
|
||||
} else {
|
||||
if (IS_UNUSED != IS_UNUSED &&
|
||||
EG(This) &&
|
||||
Z_OBJ_HT_P(EG(This))->get_class_entry &&
|
||||
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
|
||||
/* We are calling method of the other (incompatible) class,
|
||||
but passing $this. This is done for compatibility with php-4. */
|
||||
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
|
||||
|
||||
}
|
||||
if ((EX(object) = EG(This))) {
|
||||
EX(object)->refcount++;
|
||||
}
|
||||
@@ -1240,6 +1284,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
|
||||
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
EX(object) = NULL;
|
||||
} else {
|
||||
if (IS_CV != IS_UNUSED &&
|
||||
EG(This) &&
|
||||
Z_OBJ_HT_P(EG(This))->get_class_entry &&
|
||||
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
|
||||
/* We are calling method of the other (incompatible) class,
|
||||
but passing $this. This is done for compatibility with php-4. */
|
||||
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
|
||||
|
||||
}
|
||||
if ((EX(object) = EG(This))) {
|
||||
EX(object)->refcount++;
|
||||
}
|
||||
@@ -2006,7 +2059,7 @@ static int ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
|
||||
zend_free_op free_op1;
|
||||
zval *array_ptr, **array_ptr_ptr;
|
||||
HashTable *fe_ht;
|
||||
zend_object_iterator *iter = NULL;
|
||||
@@ -2030,7 +2083,9 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
}
|
||||
array_ptr = *array_ptr_ptr;
|
||||
} else {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
|
||||
if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
|
||||
}
|
||||
array_ptr = *array_ptr_ptr;
|
||||
array_ptr->refcount++;
|
||||
}
|
||||
@@ -2045,7 +2100,20 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
|
||||
ce = Z_OBJCE_P(array_ptr);
|
||||
} else {
|
||||
array_ptr->refcount++;
|
||||
if (IS_CONST == IS_VAR &&
|
||||
free_op1.var == NULL &&
|
||||
!array_ptr->is_ref &&
|
||||
array_ptr->refcount > 1) {
|
||||
/* non-separated return value from function */
|
||||
zval *tmp;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
INIT_PZVAL_COPY(tmp, array_ptr);
|
||||
zval_copy_ctor(tmp);
|
||||
array_ptr = tmp;
|
||||
} else {
|
||||
array_ptr->refcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2177,8 +2245,8 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
|
||||
static int ZEND_EXIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
if (IS_CONST != IS_UNUSED) {
|
||||
zend_op *opline = EX(opline);
|
||||
|
||||
zval *ptr = &opline->op1.u.constant;
|
||||
|
||||
@@ -4446,7 +4514,9 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
}
|
||||
array_ptr = *array_ptr_ptr;
|
||||
} else {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
|
||||
if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
|
||||
}
|
||||
array_ptr = *array_ptr_ptr;
|
||||
array_ptr->refcount++;
|
||||
}
|
||||
@@ -4461,7 +4531,20 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
|
||||
ce = Z_OBJCE_P(array_ptr);
|
||||
} else {
|
||||
array_ptr->refcount++;
|
||||
if (IS_TMP_VAR == IS_VAR &&
|
||||
free_op1.var == NULL &&
|
||||
!array_ptr->is_ref &&
|
||||
array_ptr->refcount > 1) {
|
||||
/* non-separated return value from function */
|
||||
zval *tmp;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
INIT_PZVAL_COPY(tmp, array_ptr);
|
||||
zval_copy_ctor(tmp);
|
||||
array_ptr = tmp;
|
||||
} else {
|
||||
array_ptr->refcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4594,8 +4677,8 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
|
||||
static int ZEND_EXIT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
if (IS_TMP_VAR != IS_UNUSED) {
|
||||
zend_op *opline = EX(opline);
|
||||
zend_free_op free_op1;
|
||||
zval *ptr = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
|
||||
|
||||
@@ -7444,7 +7527,9 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
}
|
||||
array_ptr = *array_ptr_ptr;
|
||||
} else {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
|
||||
if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
|
||||
}
|
||||
array_ptr = *array_ptr_ptr;
|
||||
array_ptr->refcount++;
|
||||
}
|
||||
@@ -7459,7 +7544,20 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
|
||||
ce = Z_OBJCE_P(array_ptr);
|
||||
} else {
|
||||
array_ptr->refcount++;
|
||||
if (IS_VAR == IS_VAR &&
|
||||
free_op1.var == NULL &&
|
||||
!array_ptr->is_ref &&
|
||||
array_ptr->refcount > 1) {
|
||||
/* non-separated return value from function */
|
||||
zval *tmp;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
INIT_PZVAL_COPY(tmp, array_ptr);
|
||||
zval_copy_ctor(tmp);
|
||||
array_ptr = tmp;
|
||||
} else {
|
||||
array_ptr->refcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7547,7 +7645,7 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
HashTable *fe_ht;
|
||||
zend_object_iterator *iter = NULL;
|
||||
int key_type;
|
||||
zend_bool use_key = opline->extended_value & ZEND_FE_FETCH_WITH_KEY;
|
||||
zend_bool use_key = (zend_bool)(opline->extended_value & ZEND_FE_FETCH_WITH_KEY);
|
||||
|
||||
PZVAL_LOCK(array);
|
||||
|
||||
@@ -7665,7 +7763,9 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
key->value.lval = int_key;
|
||||
key->type = IS_LONG;
|
||||
break;
|
||||
EMPTY_SWITCH_DEFAULT_CASE()
|
||||
default:
|
||||
ZVAL_NULL(key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7730,8 +7830,8 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
|
||||
static int ZEND_EXIT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
if (IS_VAR != IS_UNUSED) {
|
||||
zend_op *opline = EX(opline);
|
||||
zend_free_op free_op1;
|
||||
zval *ptr = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
|
||||
|
||||
@@ -14017,8 +14117,8 @@ static int ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
|
||||
static int ZEND_EXIT_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
if (IS_UNUSED != IS_UNUSED) {
|
||||
zend_op *opline = EX(opline);
|
||||
|
||||
zval *ptr = NULL;
|
||||
|
||||
@@ -19515,7 +19615,7 @@ static int ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
|
||||
zend_free_op free_op1;
|
||||
zval *array_ptr, **array_ptr_ptr;
|
||||
HashTable *fe_ht;
|
||||
zend_object_iterator *iter = NULL;
|
||||
@@ -19539,7 +19639,9 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
}
|
||||
array_ptr = *array_ptr_ptr;
|
||||
} else {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
|
||||
if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
|
||||
}
|
||||
array_ptr = *array_ptr_ptr;
|
||||
array_ptr->refcount++;
|
||||
}
|
||||
@@ -19554,7 +19656,20 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
|
||||
ce = Z_OBJCE_P(array_ptr);
|
||||
} else {
|
||||
array_ptr->refcount++;
|
||||
if (IS_CV == IS_VAR &&
|
||||
free_op1.var == NULL &&
|
||||
!array_ptr->is_ref &&
|
||||
array_ptr->refcount > 1) {
|
||||
/* non-separated return value from function */
|
||||
zval *tmp;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
INIT_PZVAL_COPY(tmp, array_ptr);
|
||||
zval_copy_ctor(tmp);
|
||||
array_ptr = tmp;
|
||||
} else {
|
||||
array_ptr->refcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19686,8 +19801,8 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
|
||||
static int ZEND_EXIT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
if (IS_CV != IS_UNUSED) {
|
||||
zend_op *opline = EX(opline);
|
||||
|
||||
zval *ptr = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC);
|
||||
|
||||
|
||||
@@ -1200,13 +1200,13 @@ function gen_vm($def, $skel) {
|
||||
if ($kind == "handler") {
|
||||
$op = $opcodes[$opnames[$name]];
|
||||
if (isset($op['op1']["ANY"]) && isset($op['op2']["ANY"])) {
|
||||
out($f, "{\n\treturn ".$name."_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
|
||||
out($f, "{\n\treturn ".$name.(ZEND_VM_SPEC?"_SPEC":"")."_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
|
||||
$done = 1;
|
||||
}
|
||||
} else if ($helpers[$name]["param"] == null) {
|
||||
$h = $helpers[$name];
|
||||
if (isset($h['op1']["ANY"]) && isset($h['op2']["ANY"])) {
|
||||
out($f, "{\n\treturn ".$name."_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
|
||||
out($f, "{\n\treturn ".$name.(ZEND_VM_SPEC?"_SPEC":"")."(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
|
||||
$done = 1;
|
||||
}
|
||||
}
|
||||
|
||||
+25
-18
@@ -1000,8 +1000,7 @@ AC_DEFUN([PHP_WITH_SHARED],[
|
||||
dnl
|
||||
dnl PHP_ADD_EXTENSION_DEP(extname, depends [, depconf])
|
||||
dnl
|
||||
dnl This macro is currently a placeholder in the config.m4 file
|
||||
dnl it is scanned by genif.sh when it builds the internal functions
|
||||
dnl This macro is scanned by genif.sh when it builds the internal functions
|
||||
dnl list, so that modules can be init'd in the correct order
|
||||
dnl $1 = name of extension, $2 = extension upon which it depends
|
||||
dnl $3 = optional: if true, it's ok for $2 to have not been configured
|
||||
@@ -1013,6 +1012,7 @@ dnl
|
||||
AC_DEFUN([PHP_ADD_EXTENSION_DEP], [
|
||||
am_i_shared=$[PHP_]translit($1,a-z_-,A-Z__)[_SHARED]
|
||||
is_it_shared=$[PHP_]translit($2,a-z_-,A-Z__)[_SHARED]
|
||||
is_it_enabled=$[PHP_]translit($2,a-z_-,A-Z__)
|
||||
if test "$am_i_shared" = "no" && test "$is_it_shared" = "yes" ; then
|
||||
AC_MSG_ERROR([
|
||||
You've configured extension $1 to build statically, but it
|
||||
@@ -1021,7 +1021,7 @@ You either need to build $1 shared or build $2 statically for the
|
||||
build to be successful.
|
||||
])
|
||||
fi
|
||||
if test "x$is_it_shared" = "x" && test "x$3" != "xtrue"; then
|
||||
if test "x$is_it_enabled" = "xno" && test "x$3" != "xtrue"; then
|
||||
AC_MSG_ERROR([
|
||||
You've configured extension $1, which depends on extension $2,
|
||||
but you've either not enabled $2, or have disabled it.
|
||||
@@ -1877,23 +1877,30 @@ dnl Platform characteristics checks
|
||||
dnl -------------------------------------------------------------------------
|
||||
|
||||
dnl
|
||||
dnl PHP_SHLIB_SUFFIX_NAME
|
||||
dnl PHP_SHLIB_SUFFIX_NAMES
|
||||
dnl
|
||||
dnl Determines shared library suffix
|
||||
dnl suffix can be: .so, .sl or .dylib
|
||||
dnl Determines link library suffix SHLIB_SUFFIX_NAME
|
||||
dnl which can be: .so, .sl or .dylib
|
||||
dnl
|
||||
AC_DEFUN([PHP_SHLIB_SUFFIX_NAME],[
|
||||
AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnl
|
||||
PHP_SUBST(SHLIB_SUFFIX_NAME)
|
||||
SHLIB_SUFFIX_NAME=so
|
||||
case $host_alias in
|
||||
*hpux*[)]
|
||||
SHLIB_SUFFIX_NAME=sl
|
||||
;;
|
||||
*darwin*[)]
|
||||
SHLIB_SUFFIX_NAME=dylib
|
||||
;;
|
||||
esac
|
||||
dnl Determines shared library suffix SHLIB_DL_SUFFIX_NAME
|
||||
dnl suffix can be: .so or .sl
|
||||
dnl
|
||||
AC_DEFUN([PHP_SHLIB_SUFFIX_NAMES],[
|
||||
AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnl
|
||||
PHP_SUBST_OLD(SHLIB_SUFFIX_NAME)
|
||||
PHP_SUBST_OLD(SHLIB_DL_SUFFIX_NAME)
|
||||
SHLIB_SUFFIX_NAME=so
|
||||
SHLIB_DL_SUFFIX_NAME=$SHLIB_SUFFIX_NAME
|
||||
case $host_alias in
|
||||
*hpux*[)]
|
||||
SHLIB_SUFFIX_NAME=sl
|
||||
SHLIB_DL_SUFFIX_NAME=sl
|
||||
;;
|
||||
*darwin*[)]
|
||||
SHLIB_SUFFIX_NAME=dylib
|
||||
SHLIB_DL_SUFFIX_NAME=so
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
dnl
|
||||
|
||||
+5
-4
@@ -41,7 +41,7 @@ AC_CONFIG_HEADER(main/php_config.h)
|
||||
|
||||
MAJOR_VERSION=5
|
||||
MINOR_VERSION=1
|
||||
RELEASE_VERSION=2
|
||||
RELEASE_VERSION=3
|
||||
EXTRA_VERSION=""
|
||||
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
|
||||
|
||||
@@ -224,7 +224,7 @@ dnl -------------------------------------------------------------------------
|
||||
|
||||
PTHREADS_CHECK
|
||||
PHP_HELP_SEPARATOR([SAPI modules:])
|
||||
PHP_SHLIB_SUFFIX_NAME
|
||||
PHP_SHLIB_SUFFIX_NAMES
|
||||
PHP_SAPI=default
|
||||
PHP_BUILD_PROGRAM
|
||||
|
||||
@@ -233,7 +233,7 @@ dnl SAPI configuration.
|
||||
dnl -------------------------------------------------------------------------
|
||||
|
||||
dnl paths to the targets are relative to the build directory
|
||||
SAPI_SHARED=libs/libphp5.$SHLIB_SUFFIX_NAME
|
||||
SAPI_SHARED=libs/libphp5.$SHLIB_DL_SUFFIX_NAME
|
||||
SAPI_STATIC=libs/libphp5.a
|
||||
SAPI_LIBTOOL=libphp5.la
|
||||
|
||||
@@ -466,6 +466,7 @@ ftok \
|
||||
funopen \
|
||||
gai_strerror \
|
||||
gcvt \
|
||||
getloadavg \
|
||||
getlogin \
|
||||
getprotobyname \
|
||||
getprotobynumber \
|
||||
@@ -482,6 +483,7 @@ isascii \
|
||||
link \
|
||||
localtime_r \
|
||||
lockf \
|
||||
lchown \
|
||||
lrand48 \
|
||||
memcpy \
|
||||
memmove \
|
||||
@@ -1195,7 +1197,6 @@ PHP_SUBST(SHARED_LIBTOOL)
|
||||
PHP_SUBST(WARNING_LEVEL)
|
||||
PHP_SUBST(PHP_FRAMEWORKS)
|
||||
PHP_SUBST(PHP_FRAMEWORKPATH)
|
||||
PHP_SUBST_OLD(SHLIB_SUFFIX_NAME)
|
||||
PHP_SUBST(INSTALL_HEADERS)
|
||||
|
||||
old_CC=$CC
|
||||
|
||||
@@ -336,7 +336,7 @@ PHP_FUNCTION(com_get_active_object)
|
||||
/* Performs an Invoke on the given com object.
|
||||
* returns a failure code and creates an exception if there was an error */
|
||||
HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
|
||||
WORD flags, DISPPARAMS *disp_params, VARIANT *v TSRMLS_DC)
|
||||
WORD flags, DISPPARAMS *disp_params, VARIANT *v, int silent TSRMLS_DC)
|
||||
{
|
||||
HRESULT hr;
|
||||
unsigned int arg_err;
|
||||
@@ -345,7 +345,7 @@ HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
|
||||
hr = IDispatch_Invoke(V_DISPATCH(&obj->v), id_member,
|
||||
&IID_NULL, LOCALE_SYSTEM_DEFAULT, flags, disp_params, v, &e, &arg_err);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
if (silent == 0 && FAILED(hr)) {
|
||||
char *source = NULL, *desc = NULL, *msg = NULL;
|
||||
int source_len, desc_len;
|
||||
|
||||
@@ -543,7 +543,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
|
||||
}
|
||||
|
||||
/* this will create an exception if needed */
|
||||
hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v TSRMLS_CC);
|
||||
hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v, 0 TSRMLS_CC);
|
||||
|
||||
/* release variants */
|
||||
if (vargs) {
|
||||
@@ -581,7 +581,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
|
||||
|
||||
|
||||
int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
|
||||
WORD flags, VARIANT *v, int nargs, zval **args TSRMLS_DC)
|
||||
WORD flags, VARIANT *v, int nargs, zval **args, int silent TSRMLS_DC)
|
||||
{
|
||||
DISPID altdispid;
|
||||
DISPPARAMS disp_params;
|
||||
@@ -610,7 +610,7 @@ int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
|
||||
}
|
||||
|
||||
/* this will create an exception if needed */
|
||||
hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v TSRMLS_CC);
|
||||
hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v, silent TSRMLS_CC);
|
||||
|
||||
/* release variants */
|
||||
if (vargs) {
|
||||
@@ -646,7 +646,7 @@ int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
return php_com_do_invoke_by_id(obj, dispid, flags, v, nargs, args TSRMLS_CC);
|
||||
return php_com_do_invoke_by_id(obj, dispid, flags, v, nargs, args, 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
/* {{{ proto string com_create_guid()
|
||||
|
||||
@@ -101,7 +101,7 @@ static zval *com_read_dimension(zval *object, zval *offset, int type TSRMLS_DC)
|
||||
VariantInit(&v);
|
||||
|
||||
if (SUCCESS == php_com_do_invoke_by_id(obj, DISPID_VALUE,
|
||||
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 1, &offset TSRMLS_CC)) {
|
||||
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 1, &offset, 0 TSRMLS_CC)) {
|
||||
php_com_zval_from_variant(return_value, &v, obj->code_page TSRMLS_CC);
|
||||
VariantClear(&v);
|
||||
}
|
||||
@@ -140,7 +140,7 @@ static void com_write_dimension(zval *object, zval *offset, zval *value TSRMLS_D
|
||||
VariantInit(&v);
|
||||
|
||||
if (SUCCESS == php_com_do_invoke_by_id(obj, DISPID_VALUE,
|
||||
DISPATCH_METHOD|DISPATCH_PROPERTYPUT, &v, 2, args TSRMLS_CC)) {
|
||||
DISPATCH_METHOD|DISPATCH_PROPERTYPUT, &v, 2, args, 0 TSRMLS_CC)) {
|
||||
VariantClear(&v);
|
||||
}
|
||||
} else if (V_ISARRAY(&obj->v)) {
|
||||
@@ -503,9 +503,9 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type, int should_f
|
||||
VariantInit(&v);
|
||||
|
||||
if (V_VT(&obj->v) == VT_DISPATCH) {
|
||||
if (FAILURE == php_com_do_invoke_by_id(obj, DISPID_VALUE,
|
||||
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL TSRMLS_CC)) {
|
||||
return FAILURE;
|
||||
if (SUCCESS != php_com_do_invoke_by_id(obj, DISPID_VALUE,
|
||||
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1 TSRMLS_CC)) {
|
||||
VariantCopy(&v, &obj->v);
|
||||
}
|
||||
} else {
|
||||
VariantCopy(&v, &obj->v);
|
||||
@@ -634,9 +634,11 @@ void php_com_object_free_storage(void *object TSRMLS_DC)
|
||||
VariantClear(&obj->v);
|
||||
|
||||
if (obj->method_cache) {
|
||||
zend_hash_destroy(obj->method_cache);
|
||||
FREE_HASHTABLE(obj->method_cache);
|
||||
}
|
||||
if (obj->id_of_name_cache) {
|
||||
zend_hash_destroy(obj->id_of_name_cache);
|
||||
FREE_HASHTABLE(obj->id_of_name_cache);
|
||||
}
|
||||
efree(obj);
|
||||
|
||||
@@ -38,6 +38,7 @@ struct php_com_iterator {
|
||||
VARIANT safe_array;
|
||||
VARTYPE sa_type;
|
||||
LONG sa_max;
|
||||
zval *zdata;
|
||||
};
|
||||
|
||||
static void com_iter_dtor(zend_object_iterator *iter TSRMLS_DC)
|
||||
@@ -49,6 +50,9 @@ static void com_iter_dtor(zend_object_iterator *iter TSRMLS_DC)
|
||||
}
|
||||
VariantClear(&I->v);
|
||||
VariantClear(&I->safe_array);
|
||||
if (I->zdata) {
|
||||
zval_ptr_dtor((zval**)&I->zdata);
|
||||
}
|
||||
efree(I);
|
||||
}
|
||||
|
||||
@@ -56,32 +60,18 @@ static int com_iter_valid(zend_object_iterator *iter TSRMLS_DC)
|
||||
{
|
||||
struct php_com_iterator *I = (struct php_com_iterator*)iter->data;
|
||||
|
||||
if (I->key == (ulong)-1) {
|
||||
return FAILURE;
|
||||
if (I->zdata) {
|
||||
return SUCCESS;
|
||||
}
|
||||
return SUCCESS;
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
static void com_iter_get_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
|
||||
{
|
||||
struct php_com_iterator *I = (struct php_com_iterator*)iter->data;
|
||||
zval **ptr_ptr;
|
||||
zval *ptr;
|
||||
|
||||
/* sanity */
|
||||
if (I->key == (ulong)-1) {
|
||||
*data = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
MAKE_STD_ZVAL(ptr);
|
||||
php_com_zval_from_variant(ptr, &I->v, I->code_page TSRMLS_CC);
|
||||
/* php_com_wrap_variant(ptr, &I->v, I->code_page TSRMLS_CC); */
|
||||
ptr_ptr = emalloc(sizeof(*ptr_ptr));
|
||||
*ptr_ptr = ptr;
|
||||
*data = ptr_ptr;
|
||||
|
||||
return;
|
||||
*data = &I->zdata;
|
||||
}
|
||||
|
||||
static int com_iter_get_key(zend_object_iterator *iter, char **str_key, uint *str_key_len,
|
||||
@@ -100,15 +90,20 @@ static int com_iter_move_forwards(zend_object_iterator *iter TSRMLS_DC)
|
||||
{
|
||||
struct php_com_iterator *I = (struct php_com_iterator*)iter->data;
|
||||
unsigned long n_fetched;
|
||||
zval *ptr;
|
||||
|
||||
/* release current cached element */
|
||||
VariantClear(&I->v);
|
||||
|
||||
if (I->zdata) {
|
||||
zval_ptr_dtor((zval**)&I->zdata);
|
||||
I->zdata = NULL;
|
||||
}
|
||||
|
||||
if (I->ev) {
|
||||
/* Get the next element */
|
||||
if (SUCCEEDED(IEnumVARIANT_Next(I->ev, 1, &I->v, &n_fetched)) && n_fetched > 0) {
|
||||
I->key++;
|
||||
return SUCCESS;
|
||||
} else {
|
||||
/* indicate that there are no more items */
|
||||
I->key = (ulong)-1;
|
||||
@@ -121,13 +116,17 @@ static int com_iter_move_forwards(zend_object_iterator *iter TSRMLS_DC)
|
||||
return FAILURE;
|
||||
}
|
||||
I->key++;
|
||||
if (php_com_safearray_get_elem(&I->safe_array, &I->v, (LONG)I->key TSRMLS_CC)) {
|
||||
return SUCCESS;
|
||||
} else {
|
||||
if (php_com_safearray_get_elem(&I->safe_array, &I->v, (LONG)I->key TSRMLS_CC) == 0) {
|
||||
I->key = (ulong)-1;
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
MAKE_STD_ZVAL(ptr);
|
||||
php_com_zval_from_variant(ptr, &I->v, I->code_page TSRMLS_CC);
|
||||
/* php_com_wrap_variant(ptr, &I->v, I->code_page TSRMLS_CC); */
|
||||
I->zdata = ptr;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -148,6 +147,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object TSRMLS
|
||||
DISPPARAMS dp;
|
||||
VARIANT v;
|
||||
unsigned long n_fetched;
|
||||
zval *ptr;
|
||||
|
||||
obj = CDNO_FETCH(object);
|
||||
|
||||
@@ -163,6 +163,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object TSRMLS
|
||||
I->iter.funcs = &com_iter_funcs;
|
||||
I->iter.data = I;
|
||||
I->code_page = obj->code_page;
|
||||
I->zdata = NULL;
|
||||
VariantInit(&I->safe_array);
|
||||
VariantInit(&I->v);
|
||||
|
||||
@@ -189,6 +190,9 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object TSRMLS
|
||||
/* pre-fetch the element */
|
||||
if (php_com_safearray_get_elem(&I->safe_array, &I->v, bound TSRMLS_CC)) {
|
||||
I->key = bound;
|
||||
MAKE_STD_ZVAL(ptr);
|
||||
php_com_zval_from_variant(ptr, &I->v, I->code_page TSRMLS_CC);
|
||||
I->zdata = ptr;
|
||||
} else {
|
||||
I->key = (ulong)-1;
|
||||
}
|
||||
@@ -220,6 +224,9 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object TSRMLS
|
||||
if (SUCCEEDED(IEnumVARIANT_Next(I->ev, 1, &I->v, &n_fetched)) && n_fetched > 0) {
|
||||
/* indicate that we have element 0 */
|
||||
I->key = 0;
|
||||
MAKE_STD_ZVAL(ptr);
|
||||
php_com_zval_from_variant(ptr, &I->v, I->code_page TSRMLS_CC);
|
||||
I->zdata = ptr;
|
||||
} else {
|
||||
/* indicate that there are no more items */
|
||||
I->key = (ulong)-1;
|
||||
|
||||
@@ -708,8 +708,7 @@ static void helper_free_storage(void *obj TSRMLS_DC)
|
||||
if (object->unk) {
|
||||
IUnknown_Release(object->unk);
|
||||
}
|
||||
zend_hash_destroy(object->std.properties);
|
||||
FREE_HASHTABLE(object->std.properties);
|
||||
zend_object_std_dtor(&object->std TSRMLS_CC);
|
||||
efree(object);
|
||||
}
|
||||
|
||||
@@ -722,9 +721,8 @@ static void helper_clone(void *obj, void **clone_ptr TSRMLS_DC)
|
||||
memcpy(clone, object, sizeof(*object));
|
||||
*clone_ptr = clone;
|
||||
|
||||
ALLOC_HASHTABLE(clone->std.properties);
|
||||
zend_hash_init(clone->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
|
||||
zend_object_std_init(&clone->std, object->std.ce TSRMLS_CC);
|
||||
|
||||
if (clone->ipf) {
|
||||
IPersistFile_AddRef(clone->ipf);
|
||||
}
|
||||
@@ -747,9 +745,7 @@ static zend_object_value helper_new(zend_class_entry *ce TSRMLS_DC)
|
||||
helper = emalloc(sizeof(*helper));
|
||||
memset(helper, 0, sizeof(*helper));
|
||||
|
||||
ALLOC_HASHTABLE(helper->std.properties);
|
||||
zend_hash_init(helper->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
helper->std.ce = helper_ce;
|
||||
zend_object_std_init(&helper->std, helper_ce TSRMLS_CC);
|
||||
|
||||
retval.handle = zend_objects_store_put(helper, NULL, helper_free_storage, helper_clone TSRMLS_CC);
|
||||
retval.handlers = &helper_handlers;
|
||||
|
||||
@@ -40,7 +40,7 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC)
|
||||
int keytype;
|
||||
char *strindex;
|
||||
int strindexlen;
|
||||
long intindex;
|
||||
long intindex = -1;
|
||||
long max_index = 0;
|
||||
VARIANT *va;
|
||||
zval **item;
|
||||
|
||||
@@ -102,11 +102,11 @@ PHP_FUNCTION(com_load_typelib);
|
||||
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 TSRMLS_DC);
|
||||
WORD flags, DISPPARAMS *disp_params, VARIANT *v, int silent TSRMLS_DC);
|
||||
HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
|
||||
int 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 TSRMLS_DC);
|
||||
WORD flags, VARIANT *v, int nargs, zval **args, int silent TSRMLS_DC);
|
||||
int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
|
||||
WORD flags, VARIANT *v, int nargs, zval **args TSRMLS_DC);
|
||||
int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #34272 (empty array onto COM object blows up)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
try {
|
||||
$dict = new COM("Scripting.Dictionary");
|
||||
$dict->add('foo', array());
|
||||
print sizeof($dict['foo'])."\n";
|
||||
$dict->add('bar', array(23));
|
||||
print sizeof($dict['bar'])." \n";
|
||||
} catch (Exception $e) {
|
||||
print $e;
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
0
|
||||
1
|
||||
+204
-132
@@ -47,13 +47,11 @@
|
||||
/* {{{ cruft for thread safe SSL crypto locks */
|
||||
#if defined(ZTS) && defined(HAVE_CURL_SSL)
|
||||
# ifdef PHP_WIN32
|
||||
# define PHP_CURL_NEED_SSL_TSL
|
||||
# define PHP_CURL_NEED_OPENSSL_TSL
|
||||
# include <openssl/crypto.h>
|
||||
# else /* !PHP_WIN32 */
|
||||
# if defined(HAVE_CURL_OPENSSL)
|
||||
# if defined(HAVE_OPENSSL_CRYPTO_H)
|
||||
# define PHP_CURL_NEED_SSL_TSL
|
||||
# define PHP_CURL_NEED_OPENSSL_TSL
|
||||
# include <openssl/crypto.h>
|
||||
# else
|
||||
@@ -64,7 +62,6 @@
|
||||
# endif
|
||||
# elif defined(HAVE_CURL_GNUTLS)
|
||||
# if defined(HAVE_GCRYPT_H)
|
||||
# define PHP_CURL_NEED_SSL_TSL
|
||||
# define PHP_CURL_NEED_GNUTLS_TSL
|
||||
# include <gcrypt.h>
|
||||
# else
|
||||
@@ -94,10 +91,61 @@
|
||||
int le_curl;
|
||||
int le_curl_multi_handle;
|
||||
|
||||
#ifdef PHP_CURL_NEED_SSL_TSL
|
||||
static inline void php_curl_ssl_init(void);
|
||||
static inline void php_curl_ssl_cleanup(void);
|
||||
#ifdef PHP_CURL_NEED_OPENSSL_TSL /* {{{ */
|
||||
static MUTEX_T *php_curl_openssl_tsl = NULL;
|
||||
|
||||
static void php_curl_ssl_lock(int mode, int n, const char * file, int line)
|
||||
{
|
||||
if (mode & CRYPTO_LOCK) {
|
||||
tsrm_mutex_lock(php_curl_openssl_tsl[n]);
|
||||
} else {
|
||||
tsrm_mutex_unlock(php_curl_openssl_tsl[n]);
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned long php_curl_ssl_id(void)
|
||||
{
|
||||
return (unsigned long) tsrm_thread_id();
|
||||
}
|
||||
#endif
|
||||
/* }}} */
|
||||
|
||||
#ifdef PHP_CURL_NEED_GNUTLS_TSL /* {{{ */
|
||||
static int php_curl_ssl_mutex_create(void **m)
|
||||
{
|
||||
if (*((MUTEX_T *) m) = tsrm_mutex_alloc()) {
|
||||
return SUCCESS;
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
static int php_curl_ssl_mutex_destroy(void **m)
|
||||
{
|
||||
tsrm_mutex_free(*((MUTEX_T *) m));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static int php_curl_ssl_mutex_lock(void **m)
|
||||
{
|
||||
return tsrm_mutex_lock(*((MUTEX_T *) m));
|
||||
}
|
||||
|
||||
static int php_curl_ssl_mutex_unlock(void **m)
|
||||
{
|
||||
return tsrm_mutex_unlock(*((MUTEX_T *) m));
|
||||
}
|
||||
|
||||
static struct gcry_thread_cbs php_curl_gnutls_tsl = {
|
||||
GCRY_THREAD_OPTION_USER,
|
||||
NULL,
|
||||
php_curl_ssl_mutex_create,
|
||||
php_curl_ssl_mutex_destroy,
|
||||
php_curl_ssl_mutex_lock,
|
||||
php_curl_ssl_mutex_unlock
|
||||
};
|
||||
#endif
|
||||
/* }}} */
|
||||
|
||||
static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
|
||||
@@ -135,6 +183,7 @@ zend_function_entry curl_functions[] = {
|
||||
PHP_FE(curl_copy_handle, NULL)
|
||||
PHP_FE(curl_version, NULL)
|
||||
PHP_FE(curl_setopt, NULL)
|
||||
PHP_FE(curl_setopt_array, NULL)
|
||||
PHP_FE(curl_exec, NULL)
|
||||
PHP_FE(curl_getinfo, NULL)
|
||||
PHP_FE(curl_error, NULL)
|
||||
@@ -337,6 +386,7 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_CONTENT_TYPE);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_REDIRECT_TIME);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_REDIRECT_COUNT);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_HEADER_OUT);
|
||||
|
||||
/* cURL protocol constants (curl_version) */
|
||||
REGISTER_CURL_CONSTANT(CURL_VERSION_IPV6);
|
||||
@@ -447,9 +497,24 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLFTPAUTH_TLS);
|
||||
#endif
|
||||
|
||||
#ifdef PHP_CURL_NEED_SSL_TSL
|
||||
php_curl_ssl_init();
|
||||
#ifdef PHP_CURL_NEED_OPENSSL_TSL
|
||||
{
|
||||
int i, c = CRYPTO_num_locks();
|
||||
|
||||
php_curl_openssl_tsl = malloc(c * sizeof(MUTEX_T));
|
||||
|
||||
for (i = 0; i < c; ++i) {
|
||||
php_curl_openssl_tsl[i] = tsrm_mutex_alloc();
|
||||
}
|
||||
|
||||
CRYPTO_set_id_callback(php_curl_ssl_id);
|
||||
CRYPTO_set_locking_callback(php_curl_ssl_lock);
|
||||
}
|
||||
#endif
|
||||
#ifdef PHP_CURL_NEED_GNUTLS_TSL
|
||||
gcry_control(GCRYCTL_SET_THREAD_CBS, &php_curl_gnutls_tsl);
|
||||
#endif
|
||||
|
||||
if (curl_global_init(CURL_GLOBAL_SSL) != CURLE_OK) {
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -485,10 +550,27 @@ PHP_MSHUTDOWN_FUNCTION(curl)
|
||||
php_unregister_url_stream_wrapper("https" TSRMLS_CC);
|
||||
php_unregister_url_stream_wrapper("ftp" TSRMLS_CC);
|
||||
php_unregister_url_stream_wrapper("ldap" TSRMLS_CC);
|
||||
#endif
|
||||
#ifdef PHP_CURL_NEED_OPENSSL_TSL
|
||||
/* ensure there are valid callbacks set */
|
||||
CRYPTO_set_id_callback(php_curl_ssl_id);
|
||||
CRYPTO_set_locking_callback(php_curl_ssl_lock);
|
||||
#endif
|
||||
curl_global_cleanup();
|
||||
#ifdef PHP_CURL_NEED_SSL_TSL
|
||||
php_curl_ssl_cleanup();
|
||||
#ifdef PHP_CURL_NEED_OPENSSL_TSL
|
||||
if (php_curl_openssl_tsl) {
|
||||
int i, c = CRYPTO_num_locks();
|
||||
|
||||
CRYPTO_set_id_callback(NULL);
|
||||
CRYPTO_set_locking_callback(NULL);
|
||||
|
||||
for (i = 0; i < c; ++i) {
|
||||
tsrm_mutex_free(php_curl_openssl_tsl[i]);
|
||||
}
|
||||
|
||||
free(php_curl_openssl_tsl);
|
||||
php_curl_openssl_tsl = NULL;
|
||||
}
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -719,6 +801,23 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int curl_debug(CURL *cp, curl_infotype type, char *buf, size_t buf_len, void *ctx)
|
||||
{
|
||||
php_curl *ch = (php_curl *) ctx;
|
||||
|
||||
if (type == CURLINFO_HEADER_OUT) {
|
||||
if (ch->header.str_len) {
|
||||
efree(ch->header.str);
|
||||
}
|
||||
if (buf_len > 0) {
|
||||
ch->header.str = estrndup(buf, buf_len);
|
||||
ch->header.str_len = buf_len;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CURLOPT_PASSWDFUNCTION != 0
|
||||
/* {{{ curl_passwd
|
||||
*/
|
||||
@@ -841,6 +940,7 @@ static void alloc_curl_handle(php_curl **ch)
|
||||
(*ch)->handlers->read = ecalloc(1, sizeof(php_curl_read));
|
||||
|
||||
(*ch)->in_callback = 0;
|
||||
(*ch)->header.str_len = 0;
|
||||
|
||||
memset(&(*ch)->err, 0, sizeof((*ch)->err));
|
||||
|
||||
@@ -949,24 +1049,10 @@ PHP_FUNCTION(curl_copy_handle)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool curl_setopt(resource ch, int option, mixed value)
|
||||
Set an option for a CURL transfer */
|
||||
PHP_FUNCTION(curl_setopt)
|
||||
static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *return_value TSRMLS_DC)
|
||||
{
|
||||
zval **zid, **zoption, **zvalue;
|
||||
php_curl *ch;
|
||||
CURLcode error=CURLE_OK;
|
||||
int option;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &zid, &zoption, &zvalue) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
|
||||
|
||||
convert_to_long_ex(zoption);
|
||||
|
||||
option = Z_LVAL_PP(zoption);
|
||||
switch (option) {
|
||||
case CURLOPT_INFILESIZE:
|
||||
case CURLOPT_VERBOSE:
|
||||
@@ -1122,6 +1208,8 @@ PHP_FUNCTION(curl_setopt)
|
||||
|
||||
if (Z_LVAL_PP(zvalue)) {
|
||||
ch->handlers->write->type = PHP_CURL_BINARY;
|
||||
} else {
|
||||
ch->handlers->write->type = PHP_CURL_ASCII;
|
||||
}
|
||||
break;
|
||||
case CURLOPT_WRITEFUNCTION:
|
||||
@@ -1294,15 +1382,81 @@ PHP_FUNCTION(curl_setopt)
|
||||
|
||||
break;
|
||||
}
|
||||
case CURLINFO_HEADER_OUT:
|
||||
convert_to_long_ex(zvalue);
|
||||
if (Z_LVAL_PP(zvalue) == 1) {
|
||||
curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, curl_debug);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, (void *)ch);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1);
|
||||
} else {
|
||||
curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, NULL);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, NULL);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
SAVE_CURL_ERROR(ch, error);
|
||||
if (error != CURLE_OK) {
|
||||
RETURN_FALSE;
|
||||
return 1;
|
||||
} else {
|
||||
RETURN_TRUE;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* {{{ proto bool curl_setopt(resource ch, int option, mixed value)
|
||||
Set an option for a CURL transfer */
|
||||
PHP_FUNCTION(curl_setopt)
|
||||
{
|
||||
zval **zid, **zoption, **zvalue;
|
||||
php_curl *ch;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &zid, &zoption, &zvalue) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
|
||||
|
||||
convert_to_long_ex(zoption);
|
||||
|
||||
if (!_php_curl_setopt(ch, Z_LVAL_PP(zoption), zvalue, return_value TSRMLS_CC)) {
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool curl_setopt_array(resource ch, array options)
|
||||
Set an array of option for a CURL transfer */
|
||||
PHP_FUNCTION(curl_setopt_array)
|
||||
{
|
||||
zval *zid, *arr, **entry;
|
||||
php_curl *ch;
|
||||
long option;
|
||||
HashPosition pos;
|
||||
char *string_key;
|
||||
int str_key_len;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "za", &zid, &arr) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ch, php_curl *, &zid, -1, le_curl_name, le_curl);
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos);
|
||||
while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **)&entry, &pos) == SUCCESS) {
|
||||
if (zend_hash_get_current_key_ex(Z_ARRVAL_P(arr), &string_key, &str_key_len, &option, 0, &pos) == HASH_KEY_IS_STRING) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array keys must be CURLOPT constants or equivalent interger values.");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (_php_curl_setopt(ch, option, entry, return_value TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
zend_hash_move_forward_ex(Z_ARRVAL_P(arr), &pos);
|
||||
}
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ _php_curl_cleanup_handle(ch)
|
||||
@@ -1310,7 +1464,11 @@ PHP_FUNCTION(curl_setopt)
|
||||
void _php_curl_cleanup_handle(php_curl *ch)
|
||||
{
|
||||
if (ch->handlers->write->buf.len > 0) {
|
||||
memset(&ch->handlers->write->buf, 0, sizeof(smart_str));
|
||||
smart_str_free(&ch->handlers->write->buf);
|
||||
}
|
||||
if (ch->header.str_len) {
|
||||
efree(ch->header.str);
|
||||
ch->header.str_len = 0;
|
||||
}
|
||||
|
||||
memset(ch->err.str, 0, CURL_ERROR_SIZE + 1);
|
||||
@@ -1341,7 +1499,6 @@ PHP_FUNCTION(curl_exec)
|
||||
if (ch->handlers->write->buf.len > 0) {
|
||||
smart_str_free(&ch->handlers->write->buf);
|
||||
}
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1349,10 +1506,8 @@ PHP_FUNCTION(curl_exec)
|
||||
|
||||
if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.len > 0) {
|
||||
--ch->uses;
|
||||
if (ch->handlers->write->type != PHP_CURL_BINARY) {
|
||||
smart_str_0(&ch->handlers->write->buf);
|
||||
}
|
||||
RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 0);
|
||||
smart_str_0(&ch->handlers->write->buf);
|
||||
RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 1);
|
||||
}
|
||||
--ch->uses;
|
||||
RETURN_TRUE;
|
||||
@@ -1443,6 +1598,9 @@ PHP_FUNCTION(curl_getinfo)
|
||||
if (curl_easy_getinfo(ch->cp, CURLINFO_REDIRECT_TIME, &d_code) == CURLE_OK) {
|
||||
CAAD("redirect_time", d_code);
|
||||
}
|
||||
if (ch->header.str_len > 0) {
|
||||
CAAS("request_header", ch->header.str);
|
||||
}
|
||||
} else {
|
||||
option = Z_LVAL_PP(zoption);
|
||||
switch (option) {
|
||||
@@ -1493,6 +1651,12 @@ PHP_FUNCTION(curl_getinfo)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CURLINFO_HEADER_OUT:
|
||||
if (ch->header.str_len > 0) {
|
||||
RETURN_STRINGL(ch->header.str, ch->header.str_len, 1);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1574,6 +1738,9 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
zend_llist_clean(&ch->to_free.slist);
|
||||
zend_llist_clean(&ch->to_free.post);
|
||||
|
||||
if (ch->handlers->write->buf.len > 0) {
|
||||
smart_str_free(&ch->handlers->write->buf);
|
||||
}
|
||||
if (ch->handlers->write->func_name) {
|
||||
zval_ptr_dtor(&ch->handlers->write->func_name);
|
||||
}
|
||||
@@ -1586,6 +1753,10 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
if (ch->handlers->passwd) {
|
||||
zval_ptr_dtor(&ch->handlers->passwd);
|
||||
}
|
||||
if (ch->header.str_len > 0) {
|
||||
efree(ch->header.str);
|
||||
}
|
||||
|
||||
efree(ch->handlers->write);
|
||||
efree(ch->handlers->write_header);
|
||||
efree(ch->handlers->read);
|
||||
@@ -1594,105 +1765,6 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#ifdef PHP_CURL_NEED_OPENSSL_TSL
|
||||
/* {{{ */
|
||||
static MUTEX_T *php_curl_openssl_tsl = NULL;
|
||||
|
||||
static void php_curl_ssl_lock(int mode, int n, const char * file, int line)
|
||||
{
|
||||
if (mode & CRYPTO_LOCK) {
|
||||
tsrm_mutex_lock(php_curl_openssl_tsl[n]);
|
||||
} else {
|
||||
tsrm_mutex_unlock(php_curl_openssl_tsl[n]);
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned long php_curl_ssl_id(void)
|
||||
{
|
||||
return (unsigned long) tsrm_thread_id();
|
||||
}
|
||||
|
||||
static inline void php_curl_ssl_init(void)
|
||||
{
|
||||
int i, c = CRYPTO_num_locks();
|
||||
|
||||
php_curl_openssl_tsl = malloc(c * sizeof(MUTEX_T));
|
||||
|
||||
for (i = 0; i < c; ++i) {
|
||||
php_curl_openssl_tsl[i] = tsrm_mutex_alloc();
|
||||
}
|
||||
|
||||
CRYPTO_set_id_callback(php_curl_ssl_id);
|
||||
CRYPTO_set_locking_callback(php_curl_ssl_lock);
|
||||
}
|
||||
|
||||
static inline void php_curl_ssl_cleanup(void)
|
||||
{
|
||||
if (php_curl_openssl_tsl) {
|
||||
int i, c = CRYPTO_num_locks();
|
||||
|
||||
CRYPTO_set_id_callback(NULL);
|
||||
CRYPTO_set_locking_callback(NULL);
|
||||
|
||||
for (i = 0; i < c; ++i) {
|
||||
tsrm_mutex_free(php_curl_openssl_tsl[i]);
|
||||
}
|
||||
|
||||
free(php_curl_openssl_tsl);
|
||||
php_curl_openssl_tsl = NULL;
|
||||
}
|
||||
}
|
||||
#endif /* PHP_CURL_NEED_OPENSSL_TSL */
|
||||
/* }}} */
|
||||
|
||||
#ifdef PHP_CURL_NEED_GNUTLS_TSL
|
||||
/* {{{ */
|
||||
static int php_curl_ssl_mutex_create(void **m)
|
||||
{
|
||||
if (*((MUTEX_T *) m) = tsrm_mutex_alloc()) {
|
||||
return SUCCESS;
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
static int php_curl_ssl_mutex_destroy(void **m)
|
||||
{
|
||||
tsrm_mutex_free(*((MUTEX_T *) m));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static int php_curl_ssl_mutex_lock(void **m)
|
||||
{
|
||||
return tsrm_mutex_lock(*((MUTEX_T *) m));
|
||||
}
|
||||
|
||||
static int php_curl_ssl_mutex_unlock(void **m)
|
||||
{
|
||||
return tsrm_mutex_unlock(*((MUTEX_T *) m));
|
||||
}
|
||||
|
||||
static struct gcry_thread_cbs php_curl_gnutls_tsl = {
|
||||
GCRY_THREAD_OPTION_USER,
|
||||
NULL,
|
||||
php_curl_ssl_mutex_create,
|
||||
php_curl_ssl_mutex_destroy,
|
||||
php_curl_ssl_mutex_lock,
|
||||
php_curl_ssl_mutex_unlock
|
||||
};
|
||||
|
||||
static inline void php_curl_ssl_init(void)
|
||||
{
|
||||
gcry_control(GCRYCTL_SET_THREAD_CBS, &php_curl_gnutls_tsl);
|
||||
}
|
||||
|
||||
static inline void php_curl_ssl_cleanup(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif /* PHP_CURL_NEED_GNUTLS_TSL */
|
||||
/* }}} */
|
||||
|
||||
#endif /* HAVE_CURL */
|
||||
|
||||
/*
|
||||
|
||||
+2
-5
@@ -195,11 +195,8 @@ PHP_FUNCTION(curl_multi_getcontent)
|
||||
ZEND_FETCH_RESOURCE(ch, php_curl *, &z_ch, -1, le_curl_name, le_curl);
|
||||
|
||||
if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.len > 0) {
|
||||
if (ch->handlers->write->type != PHP_CURL_BINARY) {
|
||||
smart_str_0(&ch->handlers->write->buf);
|
||||
}
|
||||
|
||||
RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 0);
|
||||
smart_str_0(&ch->handlers->write->buf);
|
||||
RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ PHP_FUNCTION(curl_version);
|
||||
PHP_FUNCTION(curl_init);
|
||||
PHP_FUNCTION(curl_copy_handle);
|
||||
PHP_FUNCTION(curl_setopt);
|
||||
PHP_FUNCTION(curl_setopt_array);
|
||||
PHP_FUNCTION(curl_exec);
|
||||
PHP_FUNCTION(curl_getinfo);
|
||||
PHP_FUNCTION(curl_error);
|
||||
@@ -107,6 +108,11 @@ struct _php_curl_error {
|
||||
int no;
|
||||
};
|
||||
|
||||
struct _php_curl_send_headers {
|
||||
char *str;
|
||||
size_t str_len;
|
||||
};
|
||||
|
||||
struct _php_curl_free {
|
||||
zend_llist str;
|
||||
zend_llist post;
|
||||
@@ -116,6 +122,7 @@ struct _php_curl_free {
|
||||
typedef struct {
|
||||
struct _php_curl_error err;
|
||||
struct _php_curl_free to_free;
|
||||
struct _php_curl_send_headers header;
|
||||
void ***thread_ctx;
|
||||
CURL *cp;
|
||||
php_curl_handlers *handlers;
|
||||
|
||||
+13929
-8907
File diff suppressed because it is too large.
Load diff
+96
-48
@@ -97,13 +97,13 @@ typedef unsigned char uchar;
|
||||
|
||||
#define timelib_string_free free
|
||||
|
||||
#define TIMELIB_HAVE_TIME() { if (s->time->have_time) { return TIMELIB_ERROR; } else { s->time->have_time = 1; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; } }
|
||||
#define TIMELIB_HAVE_TIME() { if (s->time->have_time) { add_error(s, "Double time specification"); timelib_string_free(str); return TIMELIB_ERROR; } else { s->time->have_time = 1; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; } }
|
||||
#define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; }
|
||||
#define TIMELIB_HAVE_DATE() { if (s->time->have_date) { return TIMELIB_ERROR; } else { s->time->have_date = 1; } }
|
||||
#define TIMELIB_HAVE_DATE() { if (s->time->have_date) { add_error(s, "Double date specification"); timelib_string_free(str); return TIMELIB_ERROR; } else { s->time->have_date = 1; } }
|
||||
#define TIMELIB_UNHAVE_DATE() { s->time->have_date = 0; s->time->d = 0; s->time->m = 0; s->time->y = 0; }
|
||||
#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; s->time->relative.weekday_behavior = 0; }
|
||||
#define TIMELIB_HAVE_WEEKDAY_RELATIVE() { s->time->have_weekday_relative = 1; }
|
||||
#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) { return TIMELIB_ERROR; } else { s->time.have_zone = 1; } }
|
||||
#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) { add_warning(s, "Double timezone specification"); timelib_string_free(str); return TIMELIB_ERROR; } else { s->time->have_zone = 1; } }
|
||||
|
||||
#define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
|
||||
#define TIMELIB_DEINIT timelib_string_free(str)
|
||||
@@ -140,7 +140,7 @@ typedef struct Scanner {
|
||||
int fd;
|
||||
uchar *lim, *str, *ptr, *cur, *tok, *pos;
|
||||
unsigned int line, len;
|
||||
int errors;
|
||||
struct timelib_error_container *errors;
|
||||
|
||||
struct timelib_time *time;
|
||||
timelib_tzdb *tzdb;
|
||||
@@ -285,7 +285,7 @@ static timelib_lookup_table const timelib_month_lookup[] = {
|
||||
static char* timelib_ltrim(char *s)
|
||||
{
|
||||
char *ptr = s;
|
||||
while (ptr[0] == ' ') {
|
||||
while (ptr[0] == ' ' || ptr[0] == '\t') {
|
||||
ptr++;
|
||||
}
|
||||
return ptr;
|
||||
@@ -325,6 +325,24 @@ uchar *fill(Scanner *s, uchar *cursor){
|
||||
}
|
||||
#endif
|
||||
|
||||
static void add_warning(Scanner *s, char *error)
|
||||
{
|
||||
s->errors->warning_count++;
|
||||
s->errors->warning_messages = realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].position = s->tok ? s->tok - s->str : 0;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].character = s->tok ? *s->tok : 0;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].message = strdup(error);
|
||||
}
|
||||
|
||||
static void add_error(Scanner *s, char *error)
|
||||
{
|
||||
s->errors->error_count++;
|
||||
s->errors->error_messages = realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
|
||||
s->errors->error_messages[s->errors->error_count - 1].position = s->tok ? s->tok - s->str : 0;
|
||||
s->errors->error_messages[s->errors->error_count - 1].character = s->tok ? *s->tok : 0;
|
||||
s->errors->error_messages[s->errors->error_count - 1].message = strdup(error);
|
||||
}
|
||||
|
||||
static timelib_sll timelib_meridian(char **ptr, timelib_sll h)
|
||||
{
|
||||
timelib_sll retval = 0;
|
||||
@@ -495,7 +513,7 @@ static timelib_sll timelib_lookup_relative_text(char **ptr, int *behavior)
|
||||
|
||||
static timelib_sll timelib_get_relative_text(char **ptr, int *behavior)
|
||||
{
|
||||
while (**ptr == ' ' || **ptr == '-' || **ptr == '/') {
|
||||
while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '/') {
|
||||
++*ptr;
|
||||
}
|
||||
return timelib_lookup_relative_text(ptr, behavior);
|
||||
@@ -527,7 +545,7 @@ static long timelib_lookup_month(char **ptr)
|
||||
|
||||
static long timelib_get_month(char **ptr)
|
||||
{
|
||||
while (**ptr == ' ' || **ptr == '-' || **ptr == '.' || **ptr == '/') {
|
||||
while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '.' || **ptr == '/') {
|
||||
++*ptr;
|
||||
}
|
||||
return timelib_lookup_month(ptr);
|
||||
@@ -535,7 +553,7 @@ static long timelib_get_month(char **ptr)
|
||||
|
||||
static void timelib_eat_spaces(char **ptr)
|
||||
{
|
||||
while (**ptr == ' ') {
|
||||
while (**ptr == ' ' || **ptr == '\t') {
|
||||
++*ptr;
|
||||
}
|
||||
}
|
||||
@@ -546,7 +564,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
|
||||
char *begin = *ptr, *end;
|
||||
const timelib_relunit *tp, *value = NULL;
|
||||
|
||||
while (**ptr != '\0' && **ptr != ' ') {
|
||||
while (**ptr != '\0' && **ptr != ' ' && **ptr != '\t') {
|
||||
++*ptr;
|
||||
}
|
||||
end = *ptr;
|
||||
@@ -590,7 +608,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
|
||||
static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, int isdst)
|
||||
{
|
||||
int first_found = 0;
|
||||
timelib_tz_lookup_table *tp, *first_found_elem;
|
||||
timelib_tz_lookup_table *tp, *first_found_elem = NULL;
|
||||
timelib_tz_lookup_table *fmp;
|
||||
|
||||
if (strcasecmp("utc", word) == 0 || strcasecmp("gmt", word) == 0) {
|
||||
@@ -659,7 +677,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
|
||||
|
||||
*tz_not_found = 0;
|
||||
|
||||
while (**ptr == ' ' || **ptr == '(') {
|
||||
while (**ptr == ' ' || **ptr == '\t' || **ptr == '(') {
|
||||
++*ptr;
|
||||
}
|
||||
if (**ptr == '+') {
|
||||
@@ -684,9 +702,11 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
|
||||
char *tz_abbr;
|
||||
|
||||
t->is_localtime = 1;
|
||||
t->zone_type = TIMELIB_ZONETYPE_ABBR;
|
||||
|
||||
offset = timelib_lookup_zone(ptr, dst, &tz_abbr, &found);
|
||||
if (found) {
|
||||
t->zone_type = TIMELIB_ZONETYPE_ABBR;
|
||||
}
|
||||
#if 0
|
||||
/* If we found a TimeZone identifier, use it */
|
||||
if (tz_name) {
|
||||
@@ -702,7 +722,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
|
||||
found++;
|
||||
}
|
||||
}
|
||||
if (t->zone_type != TIMELIB_ZONETYPE_ID) {
|
||||
if (found && t->zone_type != TIMELIB_ZONETYPE_ID) {
|
||||
timelib_time_tz_abbr_update(t, tz_abbr);
|
||||
}
|
||||
free(tz_abbr);
|
||||
@@ -736,7 +756,7 @@ std:
|
||||
/*!re2c
|
||||
any = [\000-\377];
|
||||
|
||||
space = [ ]+;
|
||||
space = [ \t]+;
|
||||
frac = "."[0-9]+;
|
||||
|
||||
ago = 'ago';
|
||||
@@ -748,8 +768,8 @@ minute = [0-5]?[0-9];
|
||||
minutelz = [0-5][0-9];
|
||||
second = minute | "60";
|
||||
secondlz = minutelz | "60";
|
||||
meridian = [AaPp] "."? [Mm] "."?;
|
||||
tz = "("? [A-Za-z]{1,4} ")"? | [A-Z][a-z]+([_/][A-Z][a-z]+)+;
|
||||
meridian = ([AaPp] "."? [Mm] "."?) [\000\t ];
|
||||
tz = "("? [A-Za-z]{1,6} ")"? | [A-Z][a-z]+([_/][A-Z][a-z]+)+;
|
||||
tzcorrection = [+-] hour24 ":"? minute?;
|
||||
|
||||
daysuf = "st" | "nd" | "rd" | "th";
|
||||
@@ -780,17 +800,17 @@ timetiny12 = hour12 space? meridian;
|
||||
timeshort12 = hour12[:.]minutelz space? meridian;
|
||||
timelong12 = hour12[:.]minute[:.]secondlz space? meridian;
|
||||
|
||||
timeshort24 = hour24[:.]minute;
|
||||
timelong24 = hour24[:.]minute[:.]second;
|
||||
iso8601long = hour24 [:.] minute [:.] second frac;
|
||||
timeshort24 = 't'? hour24[:.]minute;
|
||||
timelong24 = 't'? hour24[:.]minute[:.]second;
|
||||
iso8601long = 't'? hour24 [:.] minute [:.] second frac;
|
||||
|
||||
/* iso8601shorttz = hour24 [:] minutelz space? (tzcorrection | tz); */
|
||||
iso8601normtz = hour24 [:.] minute [:.] secondlz space? (tzcorrection | tz);
|
||||
iso8601normtz = 't'? hour24 [:.] minute [:.] secondlz space? (tzcorrection | tz);
|
||||
/* iso8601longtz = hour24 [:] minute [:] secondlz frac space? (tzcorrection | tz); */
|
||||
|
||||
gnunocolon = hour24lz minutelz;
|
||||
gnunocolon = 't'? hour24lz minutelz;
|
||||
/* gnunocolontz = hour24lz minutelz space? (tzcorrection | tz); */
|
||||
iso8601nocolon = hour24lz minutelz secondlz;
|
||||
iso8601nocolon = 't'? hour24lz minutelz secondlz;
|
||||
/* iso8601nocolontz = hour24lz minutelz secondlz space? (tzcorrection | tz); */
|
||||
|
||||
/* Date formats */
|
||||
@@ -800,13 +820,13 @@ iso8601dateslash = year4 "/" monthlz "/" daylz "/"?;
|
||||
dateslash = year4 "/" month "/" day;
|
||||
gnudateshort = year "-" month "-" day;
|
||||
iso8601date = year4 "-" monthlz "-" daylz;
|
||||
pointeddate = day "." month "." year;
|
||||
datefull = day ([ -.])* monthtext ([ -.])* year;
|
||||
datenoday = monthtext ([ -.])* year4;
|
||||
datenodayrev = year4 ([ -.])* monthtext;
|
||||
datetextual = monthtext ([ -.])* day [,.stndrh ]* year;
|
||||
datenoyear = monthtext ([ -.])* day [,.stndrh ]*;
|
||||
datenoyearrev = day ([ -.])* monthtext;
|
||||
pointeddate = day [.\t-] month [.-] year;
|
||||
datefull = day ([ \t.-])* monthtext ([ \t.-])* year;
|
||||
datenoday = monthtext ([ .\t-])* year4;
|
||||
datenodayrev = year4 ([ .\t-])* monthtext;
|
||||
datetextual = monthtext ([ .\t-])* day [,.stndrh\t ]* year;
|
||||
datenoyear = monthtext ([ .\t-])* day [,.stndrh\t ]*;
|
||||
datenoyearrev = day ([ .\t-])* monthtext;
|
||||
datenocolon = year4 monthlz daylz;
|
||||
|
||||
/* Special formats */
|
||||
@@ -819,12 +839,13 @@ pgtextshort = monthabbr "-" daylz "-" year;
|
||||
pgtextreverse = year "-" monthabbr "-" daylz;
|
||||
isoweekday = year4 "W" weekofyear [0-7];
|
||||
isoweek = year4 "W" weekofyear;
|
||||
exif = year4 ":" monthlz ":" daylz " " hour24lz ":" minutelz ":" secondlz;
|
||||
|
||||
/* Common Log Format: 10/Oct/2000:13:55:36 -0700 */
|
||||
clf = day "/" monthabbr "/" year4 ":" hour24lz ":" minutelz ":" secondlz space tzcorrection;
|
||||
|
||||
/* Timestamp format: @1126396800 */
|
||||
timestamp = "@" "-"? [1-9] [0-9]*;
|
||||
timestamp = "@" "-"? [0-9]+;
|
||||
|
||||
/* To fix some ambiguities */
|
||||
dateshortwithtimeshort = datenoyear timeshort24;
|
||||
@@ -837,7 +858,7 @@ dateshortwithtimelongtz = datenoyear iso8601normtz;
|
||||
reltextnumber = 'first'|'next'|'second'|'third'|'fourth'|'fifth'|'sixth'|'seventh'|'eight'|'ninth'|'tenth'|'eleventh'|'twelfth'|'last'|'previous'|'this';
|
||||
reltextunit = (('sec'|'second'|'min'|'minute'|'hour'|'day'|'week'|'fortnight'|'forthnight'|'month'|'year') 's'?) | daytext;
|
||||
|
||||
relnumber = ([+-]?[ ]*[0-9]+);
|
||||
relnumber = ([+-]?[ \t]*[0-9]+);
|
||||
relative = relnumber space? reltextunit;
|
||||
relativetext = reltextnumber space? reltextunit;
|
||||
|
||||
@@ -959,7 +980,9 @@ relativetext = reltextnumber space? reltextunit;
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME24_WITH_ZONE;
|
||||
@@ -980,6 +1003,7 @@ relativetext = reltextnumber space? reltextunit;
|
||||
break;
|
||||
default:
|
||||
TIMELIB_DEINIT;
|
||||
add_error(s, "Double time specification");
|
||||
return TIMELIB_ERROR;
|
||||
}
|
||||
s->time->have_time++;
|
||||
@@ -1022,7 +1046,9 @@ relativetext = reltextnumber space? reltextunit;
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_NOCOLON;
|
||||
@@ -1158,10 +1184,10 @@ relativetext = reltextnumber space? reltextunit;
|
||||
return TIMELIB_DATE_NOCOLON;
|
||||
}
|
||||
|
||||
xmlrpc | xmlrpcnocolon | soap | wddx
|
||||
xmlrpc | xmlrpcnocolon | soap | wddx | exif
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx");
|
||||
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_TIME();
|
||||
TIMELIB_HAVE_DATE();
|
||||
@@ -1175,7 +1201,9 @@ relativetext = reltextnumber space? reltextunit;
|
||||
s->time->f = timelib_get_frac_nr((char **) &ptr, 9);
|
||||
if (*ptr) { /* timezone is optional */
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
}
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
@@ -1273,7 +1301,9 @@ relativetext = reltextnumber space? reltextunit;
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
}
|
||||
@@ -1321,7 +1351,7 @@ relativetext = reltextnumber space? reltextunit;
|
||||
relativetext
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior;
|
||||
int behavior = 0;
|
||||
DEBUG_OUTPUT("relativetext");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
@@ -1340,8 +1370,11 @@ relativetext = reltextnumber space? reltextunit;
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_TZ();
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIMEZONE;
|
||||
}
|
||||
@@ -1368,7 +1401,9 @@ relativetext = reltextnumber space? reltextunit;
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_SHORTDATE_WITH_TIME;
|
||||
@@ -1390,7 +1425,7 @@ relativetext = reltextnumber space? reltextunit;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
|
||||
[ .,]
|
||||
[ .,\t]
|
||||
{
|
||||
goto std;
|
||||
}
|
||||
@@ -1403,8 +1438,7 @@ relativetext = reltextnumber space? reltextunit;
|
||||
|
||||
any
|
||||
{
|
||||
/* printf("unexpected character: #%d, %c ", *s->tok, *s->tok); */
|
||||
s->errors++;
|
||||
add_error(s, "Unexpected character");
|
||||
goto std;
|
||||
}
|
||||
*/
|
||||
@@ -1412,12 +1446,19 @@ relativetext = reltextnumber space? reltextunit;
|
||||
|
||||
/*!max:re2c */
|
||||
|
||||
timelib_time* timelib_strtotime(char *s, int len, int *errors, timelib_tzdb *tzdb)
|
||||
timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container **errors, timelib_tzdb *tzdb)
|
||||
{
|
||||
Scanner in;
|
||||
int t;
|
||||
char *e = s + len - 1;
|
||||
|
||||
memset(&in, 0, sizeof(in));
|
||||
in.errors = malloc(sizeof(struct timelib_error_container));
|
||||
in.errors->warning_count = 0;
|
||||
in.errors->warning_messages = NULL;
|
||||
in.errors->error_count = 0;
|
||||
in.errors->error_messages = NULL;
|
||||
|
||||
while (isspace(*s) && s < e) {
|
||||
s++;
|
||||
}
|
||||
@@ -1425,15 +1466,19 @@ timelib_time* timelib_strtotime(char *s, int len, int *errors, timelib_tzdb *tzd
|
||||
e--;
|
||||
}
|
||||
if (e - s < 1) {
|
||||
*errors = 1;
|
||||
in.time = timelib_time_ctor();
|
||||
add_error(&in, "Empty string");
|
||||
if (errors) {
|
||||
*errors = in.errors;
|
||||
} else {
|
||||
timelib_error_container_dtor(in.errors);
|
||||
}
|
||||
in.time->y = in.time->d = in.time->m = in.time->h = in.time->i = in.time->s = in.time->f = in.time->z = in.time->dst = -1;
|
||||
in.time->is_localtime = in.time->zone_type = 0;
|
||||
return in.time;
|
||||
}
|
||||
e++;
|
||||
|
||||
memset(&in, 0, sizeof(in));
|
||||
in.str = malloc((e - s) + YYMAXFILL);
|
||||
memset(in.str, 0, (e - s) + YYMAXFILL);
|
||||
memcpy(in.str, s, (e - s));
|
||||
@@ -1449,7 +1494,6 @@ timelib_time* timelib_strtotime(char *s, int len, int *errors, timelib_tzdb *tzd
|
||||
in.time->f = -1;
|
||||
in.time->z = -1;
|
||||
in.time->dst = -1;
|
||||
in.errors = 0;
|
||||
in.tzdb = tzdb;
|
||||
in.time->is_localtime = 0;
|
||||
in.time->zone_type = 0;
|
||||
@@ -1462,7 +1506,11 @@ timelib_time* timelib_strtotime(char *s, int len, int *errors, timelib_tzdb *tzd
|
||||
} while(t != EOI);
|
||||
|
||||
free(in.str);
|
||||
*errors = in.errors;
|
||||
if (errors) {
|
||||
*errors = in.errors;
|
||||
} else {
|
||||
timelib_error_container_dtor(in.errors);
|
||||
}
|
||||
return in.time;
|
||||
}
|
||||
|
||||
|
||||
@@ -368,6 +368,7 @@ timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *
|
||||
timelib_sll timelib_get_current_offset(timelib_time *t)
|
||||
{
|
||||
timelib_time_offset *gmt_offset;
|
||||
timelib_sll retval;
|
||||
|
||||
switch (t->zone_type) {
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
@@ -376,7 +377,9 @@ timelib_sll timelib_get_current_offset(timelib_time *t)
|
||||
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
gmt_offset = timelib_get_time_zone_info(t->sse, t->tz_info);
|
||||
return gmt_offset->offset;
|
||||
retval = gmt_offset->offset;
|
||||
timelib_time_offset_dtor(gmt_offset);
|
||||
return retval;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
|
||||
@@ -122,6 +122,21 @@ char *timelib_get_tz_abbr_ptr(timelib_time *t)
|
||||
return t->tz_abbr;
|
||||
}
|
||||
|
||||
void timelib_error_container_dtor(timelib_error_container *errors)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < errors->warning_count; i++) {
|
||||
free(errors->warning_messages[i].message);
|
||||
}
|
||||
free(errors->warning_messages);
|
||||
for (i = 0; i < errors->error_count; i++) {
|
||||
free(errors->error_messages[i].message);
|
||||
}
|
||||
free(errors->error_messages);
|
||||
free(errors);
|
||||
}
|
||||
|
||||
signed long timelib_date_to_int(timelib_time *d, int *error)
|
||||
{
|
||||
timelib_sll ts;
|
||||
|
||||
@@ -51,7 +51,7 @@ timelib_sll timelib_days_in_month(timelib_sll y, timelib_sll m);
|
||||
void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iw, timelib_sll *iy);
|
||||
|
||||
/* From parse_date.re */
|
||||
timelib_time *timelib_strtotime(char *s, int len, int *errors, timelib_tzdb *tzdb);
|
||||
timelib_time *timelib_strtotime(char *s, int len, timelib_error_container **errors, timelib_tzdb *tzdb);
|
||||
void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options);
|
||||
char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst);
|
||||
timelib_tz_lookup_table *timelib_timezone_abbreviations_list(void);
|
||||
@@ -90,6 +90,8 @@ void timelib_time_dtor(timelib_time* t);
|
||||
timelib_time_offset* timelib_time_offset_ctor();
|
||||
void timelib_time_offset_dtor(timelib_time_offset* t);
|
||||
|
||||
void timelib_error_container_dtor(timelib_error_container *errors);
|
||||
|
||||
signed long timelib_date_to_int(timelib_time *d, int *error);
|
||||
void timelib_dump_date(timelib_time *d, int options);
|
||||
|
||||
|
||||
@@ -147,6 +147,19 @@ typedef struct timelib_time {
|
||||
* 2 TimeZone abbreviation */
|
||||
} timelib_time;
|
||||
|
||||
typedef struct timelib_error_message {
|
||||
int position;
|
||||
char character;
|
||||
char *message;
|
||||
} timelib_error_message;
|
||||
|
||||
typedef struct timelib_error_container {
|
||||
int warning_count;
|
||||
struct timelib_error_message *warning_messages;
|
||||
int error_count;
|
||||
struct timelib_error_message *error_messages;
|
||||
} timelib_error_container;
|
||||
|
||||
typedef struct _timelib_tz_lookup_table {
|
||||
char *name;
|
||||
int type;
|
||||
@@ -170,9 +183,10 @@ typedef struct _timelib_tzdb {
|
||||
#define TIMELIB_ZONETYPE_ABBR 2
|
||||
#define TIMELIB_ZONETYPE_ID 3
|
||||
|
||||
#define SECS_PER_DAY 86400
|
||||
#define DAYS_PER_YEAR 365
|
||||
#define DAYS_PER_LYEAR 366
|
||||
#define SECS_PER_ERA 12622780800L
|
||||
#define SECS_PER_DAY 86400
|
||||
#define DAYS_PER_YEAR 365
|
||||
#define DAYS_PER_LYEAR 366
|
||||
|
||||
#define timelib_is_leap(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
|
||||
|
||||
|
||||
+676
-517
File diff suppressed because it is too large.
Load diff
@@ -13,6 +13,7 @@
|
||||
{ "adt", 1, -10800, "America/Glace_Bay" },
|
||||
{ "adt", 1, -10800, "America/Goose_Bay" },
|
||||
{ "adt", 1, -10800, "America/Martinique" },
|
||||
{ "adt", 1, -10800, "America/Moncton" },
|
||||
{ "adt", 1, -10800, "America/Pangnirtung" },
|
||||
{ "adt", 1, -10800, "America/Thule" },
|
||||
{ "adt", 1, -10800, "Atlantic/Bermuda" },
|
||||
@@ -70,6 +71,7 @@
|
||||
{ "ant", 0, -16200, "America/Aruba" },
|
||||
{ "apt", 1, -10800, "America/Halifax" },
|
||||
{ "apt", 1, -10800, "America/Glace_Bay" },
|
||||
{ "apt", 1, -10800, "America/Moncton" },
|
||||
{ "apt", 1, -10800, "America/Pangnirtung" },
|
||||
{ "apt", 1, -10800, "Canada/Atlantic" },
|
||||
{ "aqtst", 1, 18000, "Asia/Aqtau" },
|
||||
@@ -172,6 +174,7 @@
|
||||
{ "ast", 0, -14400, "America/Halifax" },
|
||||
{ "ast", 0, -14400, "America/Martinique" },
|
||||
{ "ast", 0, -14400, "America/Miquelon" },
|
||||
{ "ast", 0, -14400, "America/Moncton" },
|
||||
{ "ast", 0, -14400, "America/Montserrat" },
|
||||
{ "ast", 0, -14400, "America/Pangnirtung" },
|
||||
{ "ast", 0, -14400, "America/Port_of_Spain" },
|
||||
@@ -193,6 +196,7 @@
|
||||
{ "ast", 0, 10800, "Asia/Qatar" },
|
||||
{ "awt", 1, -10800, "America/Halifax" },
|
||||
{ "awt", 1, -10800, "America/Glace_Bay" },
|
||||
{ "awt", 1, -10800, "America/Moncton" },
|
||||
{ "awt", 1, -10800, "America/Pangnirtung" },
|
||||
{ "awt", 1, -10800, "America/Puerto_Rico" },
|
||||
{ "awt", 1, -10800, "Canada/Atlantic" },
|
||||
@@ -309,7 +313,9 @@
|
||||
{ "cdt", 1, -18000, "America/Indiana/Indianapolis" },
|
||||
{ "cdt", 1, -18000, "America/Indiana/Knox" },
|
||||
{ "cdt", 1, -18000, "America/Indiana/Marengo" },
|
||||
{ "cdt", 1, -18000, "America/Indiana/Petersburg" },
|
||||
{ "cdt", 1, -18000, "America/Indiana/Vevay" },
|
||||
{ "cdt", 1, -18000, "America/Indiana/Vincennes" },
|
||||
{ "cdt", 1, -18000, "America/Indianapolis" },
|
||||
{ "cdt", 1, -18000, "America/Iqaluit" },
|
||||
{ "cdt", 1, -18000, "America/Kentucky/Louisville" },
|
||||
@@ -490,7 +496,9 @@
|
||||
{ "cpt", 1, -18000, "America/Indiana/Indianapolis" },
|
||||
{ "cpt", 1, -18000, "America/Indiana/Knox" },
|
||||
{ "cpt", 1, -18000, "America/Indiana/Marengo" },
|
||||
{ "cpt", 1, -18000, "America/Indiana/Petersburg" },
|
||||
{ "cpt", 1, -18000, "America/Indiana/Vevay" },
|
||||
{ "cpt", 1, -18000, "America/Indiana/Vincennes" },
|
||||
{ "cpt", 1, -18000, "America/Indianapolis" },
|
||||
{ "cpt", 1, -18000, "America/Kentucky/Louisville" },
|
||||
{ "cpt", 1, -18000, "America/Kentucky/Monticello" },
|
||||
@@ -521,7 +529,9 @@
|
||||
{ "cst", 0, -21600, "America/Indiana/Indianapolis" },
|
||||
{ "cst", 0, -21600, "America/Indiana/Knox" },
|
||||
{ "cst", 0, -21600, "America/Indiana/Marengo" },
|
||||
{ "cst", 0, -21600, "America/Indiana/Petersburg" },
|
||||
{ "cst", 0, -21600, "America/Indiana/Vevay" },
|
||||
{ "cst", 0, -21600, "America/Indiana/Vincennes" },
|
||||
{ "cst", 0, -21600, "America/Indianapolis" },
|
||||
{ "cst", 0, -21600, "America/Iqaluit" },
|
||||
{ "cst", 0, -21600, "America/Kentucky/Louisville" },
|
||||
@@ -584,7 +594,9 @@
|
||||
{ "cwt", 1, -18000, "America/Indiana/Indianapolis" },
|
||||
{ "cwt", 1, -18000, "America/Indiana/Knox" },
|
||||
{ "cwt", 1, -18000, "America/Indiana/Marengo" },
|
||||
{ "cwt", 1, -18000, "America/Indiana/Petersburg" },
|
||||
{ "cwt", 1, -18000, "America/Indiana/Vevay" },
|
||||
{ "cwt", 1, -18000, "America/Indiana/Vincennes" },
|
||||
{ "cwt", 1, -18000, "America/Indianapolis" },
|
||||
{ "cwt", 1, -18000, "America/Kentucky/Louisville" },
|
||||
{ "cwt", 1, -18000, "America/Kentucky/Monticello" },
|
||||
@@ -641,15 +653,14 @@
|
||||
{ "edt", 1, -14400, "America/Fort_Wayne" },
|
||||
{ "edt", 1, -14400, "America/Grand_Turk" },
|
||||
{ "edt", 1, -14400, "America/Indiana/Indianapolis" },
|
||||
{ "edt", 1, -14400, "America/Indiana/Knox" },
|
||||
{ "edt", 1, -14400, "America/Indiana/Marengo" },
|
||||
{ "edt", 1, -14400, "America/Indiana/Vevay" },
|
||||
{ "edt", 1, -14400, "America/Indiana/Vincennes" },
|
||||
{ "edt", 1, -14400, "America/Indianapolis" },
|
||||
{ "edt", 1, -14400, "America/Iqaluit" },
|
||||
{ "edt", 1, -14400, "America/Jamaica" },
|
||||
{ "edt", 1, -14400, "America/Kentucky/Louisville" },
|
||||
{ "edt", 1, -14400, "America/Kentucky/Monticello" },
|
||||
{ "edt", 1, -14400, "America/Knox_IN" },
|
||||
{ "edt", 1, -14400, "America/Louisville" },
|
||||
{ "edt", 1, -14400, "America/Montreal" },
|
||||
{ "edt", 1, -14400, "America/Nassau" },
|
||||
@@ -665,7 +676,6 @@
|
||||
{ "edt", 1, -14400, "Jamaica" },
|
||||
{ "edt", 1, -14400, "US/East-Indiana" },
|
||||
{ "edt", 1, -14400, "US/Eastern" },
|
||||
{ "edt", 1, -14400, "US/Indiana-Starke" },
|
||||
{ "edt", 1, -14400, "US/Michigan" },
|
||||
{ "eest", 1, 10800, "Europe/Helsinki" },
|
||||
{ "eest", 1, 10800, "Africa/Cairo" },
|
||||
@@ -764,7 +774,9 @@
|
||||
{ "est", 0, -18000, "America/Indiana/Indianapolis" },
|
||||
{ "est", 0, -18000, "America/Indiana/Knox" },
|
||||
{ "est", 0, -18000, "America/Indiana/Marengo" },
|
||||
{ "est", 0, -18000, "America/Indiana/Petersburg" },
|
||||
{ "est", 0, -18000, "America/Indiana/Vevay" },
|
||||
{ "est", 0, -18000, "America/Indiana/Vincennes" },
|
||||
{ "est", 0, -18000, "America/Indianapolis" },
|
||||
{ "est", 0, -18000, "America/Iqaluit" },
|
||||
{ "est", 0, -18000, "America/Jamaica" },
|
||||
@@ -883,7 +895,6 @@
|
||||
{ "gmt", 0, 0, "Europe/London" },
|
||||
{ "gmt", 0, 0, "GB" },
|
||||
{ "gmt", 0, 0, "GB-Eire" },
|
||||
{ "gmt", 0, 0, "GMT" },
|
||||
{ "gmt", 0, 0, "Iceland" },
|
||||
{ "gst", 0, 14400, "Asia/Dubai" },
|
||||
{ "gst", 0, 14400, "Asia/Bahrain" },
|
||||
|
||||
@@ -135,6 +135,13 @@ static timelib_sll do_years(timelib_sll year)
|
||||
{
|
||||
timelib_sll i;
|
||||
timelib_sll res = 0;
|
||||
timelib_sll eras;
|
||||
|
||||
eras = (year - 1970) / 400;
|
||||
if (eras != 0) {
|
||||
year = year - (eras * 400);
|
||||
res += (SECS_PER_ERA * eras);
|
||||
}
|
||||
|
||||
if (year >= 1970) {
|
||||
for (i = year - 1; i >= 1970; i--) {
|
||||
|
||||
+149
-36
@@ -51,6 +51,7 @@ zend_function_entry date_functions[] = {
|
||||
#ifdef EXPERIMENTAL_DATE_SUPPORT
|
||||
/* Advanced Interface */
|
||||
PHP_FE(date_create, NULL)
|
||||
PHP_FE(date_parse, NULL)
|
||||
PHP_FE(date_format, NULL)
|
||||
PHP_FE(date_modify, NULL)
|
||||
PHP_FE(date_timezone_get, NULL)
|
||||
@@ -63,6 +64,7 @@ zend_function_entry date_functions[] = {
|
||||
|
||||
PHP_FE(timezone_open, NULL)
|
||||
PHP_FE(timezone_name_get, NULL)
|
||||
PHP_FE(timezone_name_from_abbr, NULL)
|
||||
PHP_FE(timezone_offset_get, NULL)
|
||||
PHP_FE(timezone_transistions_get, NULL)
|
||||
PHP_FE(timezone_identifiers_list, NULL)
|
||||
@@ -76,7 +78,7 @@ zend_function_entry date_functions[] = {
|
||||
/* Astronomical functions */
|
||||
PHP_FE(date_sunrise, NULL)
|
||||
PHP_FE(date_sunset, NULL)
|
||||
/* PHP_FE(date_sun_info, NULL) */
|
||||
PHP_FE(date_sun_info, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -235,6 +237,7 @@ PHP_RSHUTDOWN_FUNCTION(date)
|
||||
|
||||
#define DATE_TIMEZONEDB php_date_global_timezone_db ? php_date_global_timezone_db : timelib_builtin_db()
|
||||
|
||||
#define DATE_FORMAT_RFC3339 "Y-m-d\\TH:i:sP"
|
||||
#define DATE_FORMAT_ISO8601 "Y-m-d\\TH:i:sO"
|
||||
#define DATE_FORMAT_RFC1036 "l, d-M-y H:i:s T"
|
||||
#define DATE_FORMAT_RFC1123 "D, d M Y H:i:s T"
|
||||
@@ -260,7 +263,7 @@ PHP_MINIT_FUNCTION(date)
|
||||
#ifdef EXPERIMENTAL_DATE_SUPPORT
|
||||
date_register_classes(TSRMLS_C);
|
||||
#endif
|
||||
REGISTER_STRING_CONSTANT("DATE_ATOM", DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_STRING_CONSTANT("DATE_ATOM", DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_STRING_CONSTANT("DATE_COOKIE", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_STRING_CONSTANT("DATE_ISO8601", DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_STRING_CONSTANT("DATE_RFC822", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -268,8 +271,9 @@ PHP_MINIT_FUNCTION(date)
|
||||
REGISTER_STRING_CONSTANT("DATE_RFC1036", DATE_FORMAT_RFC1036, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_STRING_CONSTANT("DATE_RFC1123", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_STRING_CONSTANT("DATE_RFC2822", DATE_FORMAT_RFC2822, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_STRING_CONSTANT("DATE_RFC3339", DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_STRING_CONSTANT("DATE_RSS", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_STRING_CONSTANT("DATE_W3C", DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_STRING_CONSTANT("DATE_W3C", DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
REGISTER_LONG_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -459,6 +463,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
|
||||
char buffer[33];
|
||||
timelib_time_offset *offset;
|
||||
timelib_sll isoweek, isoyear;
|
||||
int rfc_colon = 0;
|
||||
|
||||
if (!format_len) {
|
||||
return estrdup("");
|
||||
@@ -537,9 +542,11 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
|
||||
|
||||
/* timezone */
|
||||
case 'I': snprintf(buffer, 32, "%d", localtime ? offset->is_dst : 0); break;
|
||||
case 'O': snprintf(buffer, 32, "%c%02d%02d",
|
||||
case 'P': rfc_colon = 1; /* break intentionally missing */
|
||||
case 'O': snprintf(buffer, 32, "%c%02d%s%02d",
|
||||
localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
|
||||
localtime ? abs(offset->offset / 3600) : 0,
|
||||
rfc_colon ? ":" : "",
|
||||
localtime ? abs((offset->offset % 3600) / 60) : 0
|
||||
);
|
||||
break;
|
||||
@@ -786,17 +793,17 @@ PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_parse_date: Backwards compability function */
|
||||
signed long php_parse_date(char *string, signed long *now)
|
||||
PHPAPI signed long php_parse_date(char *string, signed long *now)
|
||||
{
|
||||
timelib_time *parsed_time;
|
||||
int error1, error2;
|
||||
int error2;
|
||||
signed long retval;
|
||||
|
||||
parsed_time = timelib_strtotime(string, strlen(string), &error1, DATE_TIMEZONEDB);
|
||||
parsed_time = timelib_strtotime(string, strlen(string), NULL, DATE_TIMEZONEDB);
|
||||
timelib_update_ts(parsed_time, NULL);
|
||||
retval = timelib_date_to_int(parsed_time, &error2);
|
||||
timelib_time_dtor(parsed_time);
|
||||
if (error1 || error2) {
|
||||
if (error2) {
|
||||
return -1;
|
||||
}
|
||||
return retval;
|
||||
@@ -804,12 +811,13 @@ signed long php_parse_date(char *string, signed long *now)
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto int strtotime(string time, int now)
|
||||
/* {{{ proto int strtotime(string time [, int now ])
|
||||
Convert string representation of date and time to a timestamp */
|
||||
PHP_FUNCTION(strtotime)
|
||||
{
|
||||
char *times, *initial_ts;
|
||||
int time_len, error1, error2;
|
||||
struct timelib_error_container *error;
|
||||
long preset_ts, ts;
|
||||
|
||||
timelib_time *t, *now;
|
||||
@@ -822,8 +830,8 @@ PHP_FUNCTION(strtotime)
|
||||
now = timelib_time_ctor();
|
||||
|
||||
initial_ts = emalloc(25);
|
||||
snprintf(initial_ts, 24, "@%lu", preset_ts);
|
||||
t = timelib_strtotime(initial_ts, strlen(initial_ts), &error1, DATE_TIMEZONEDB); /* we ignore the error here, as this should never fail */
|
||||
snprintf(initial_ts, 24, "@%ld", preset_ts);
|
||||
t = timelib_strtotime(initial_ts, strlen(initial_ts), NULL, DATE_TIMEZONEDB); /* we ignore the error here, as this should never fail */
|
||||
timelib_update_ts(t, tzi);
|
||||
now->tz_info = tzi;
|
||||
now->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
@@ -840,7 +848,9 @@ PHP_FUNCTION(strtotime)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
t = timelib_strtotime(times, time_len, &error1, DATE_TIMEZONEDB);
|
||||
t = timelib_strtotime(times, time_len, &error, DATE_TIMEZONEDB);
|
||||
error1 = error->error_count;
|
||||
timelib_error_container_dtor(error);
|
||||
timelib_fill_holes(t, now, 0);
|
||||
timelib_update_ts(t, tzi);
|
||||
ts = timelib_date_to_int(t, &error2);
|
||||
@@ -1198,7 +1208,7 @@ static void date_register_classes(TSRMLS_D)
|
||||
#define REGISTER_DATE_CLASS_CONST_STRING(const_name, value) \
|
||||
zend_declare_class_constant_stringl(date_ce_date, const_name, sizeof(const_name)-1, value, sizeof(value)-1 TSRMLS_CC);
|
||||
|
||||
REGISTER_DATE_CLASS_CONST_STRING("ATOM", DATE_FORMAT_ISO8601);
|
||||
REGISTER_DATE_CLASS_CONST_STRING("ATOM", DATE_FORMAT_RFC3339);
|
||||
REGISTER_DATE_CLASS_CONST_STRING("COOKIE", DATE_FORMAT_RFC1123);
|
||||
REGISTER_DATE_CLASS_CONST_STRING("ISO8601", DATE_FORMAT_ISO8601);
|
||||
REGISTER_DATE_CLASS_CONST_STRING("RFC822", DATE_FORMAT_RFC1123);
|
||||
@@ -1206,6 +1216,7 @@ static void date_register_classes(TSRMLS_D)
|
||||
REGISTER_DATE_CLASS_CONST_STRING("RFC1036", DATE_FORMAT_RFC1036);
|
||||
REGISTER_DATE_CLASS_CONST_STRING("RFC1123", DATE_FORMAT_RFC1123);
|
||||
REGISTER_DATE_CLASS_CONST_STRING("RFC2822", DATE_FORMAT_RFC2822);
|
||||
REGISTER_DATE_CLASS_CONST_STRING("RFC3339", DATE_FORMAT_RFC3339);
|
||||
REGISTER_DATE_CLASS_CONST_STRING("RSS", DATE_FORMAT_RFC1123);
|
||||
REGISTER_DATE_CLASS_CONST_STRING("W3C", DATE_FORMAT_ISO8601);
|
||||
|
||||
@@ -1225,10 +1236,8 @@ static zend_object_value date_object_new_date(zend_class_entry *class_type TSRML
|
||||
|
||||
intern = emalloc(sizeof(php_date_obj));
|
||||
memset(intern, 0, sizeof(php_date_obj));
|
||||
intern->std.ce = class_type;
|
||||
|
||||
ALLOC_HASHTABLE(intern->std.properties);
|
||||
zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_date, NULL TSRMLS_CC);
|
||||
@@ -1245,10 +1254,8 @@ static zend_object_value date_object_new_timezone(zend_class_entry *class_type T
|
||||
|
||||
intern = emalloc(sizeof(php_timezone_obj));
|
||||
memset(intern, 0, sizeof(php_timezone_obj));
|
||||
intern->std.ce = class_type;
|
||||
|
||||
ALLOC_HASHTABLE(intern->std.properties);
|
||||
zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_timezone, NULL TSRMLS_CC);
|
||||
@@ -1268,12 +1275,7 @@ static void date_object_free_storage_date(void *object TSRMLS_DC)
|
||||
timelib_time_dtor(intern->time);
|
||||
}
|
||||
|
||||
if (intern->std.properties) {
|
||||
zend_hash_destroy(intern->std.properties);
|
||||
efree(intern->std.properties);
|
||||
intern->std.properties = NULL;
|
||||
}
|
||||
|
||||
zend_object_std_dtor(&intern->std TSRMLS_CC);
|
||||
efree(object);
|
||||
}
|
||||
|
||||
@@ -1281,12 +1283,7 @@ static void date_object_free_storage_timezone(void *object TSRMLS_DC)
|
||||
{
|
||||
php_timezone_obj *intern = (php_timezone_obj *)object;
|
||||
|
||||
if (intern->std.properties) {
|
||||
zend_hash_destroy(intern->std.properties);
|
||||
efree(intern->std.properties);
|
||||
intern->std.properties = NULL;
|
||||
}
|
||||
|
||||
zend_object_std_dtor(&intern->std TSRMLS_CC);
|
||||
efree(object);
|
||||
}
|
||||
|
||||
@@ -1308,7 +1305,6 @@ PHP_FUNCTION(date_create)
|
||||
{
|
||||
php_date_obj *dateobj;
|
||||
zval *timezone_object = NULL;
|
||||
int error;
|
||||
timelib_time *now;
|
||||
timelib_tzinfo *tzi;
|
||||
char *time_str;
|
||||
@@ -1320,7 +1316,7 @@ PHP_FUNCTION(date_create)
|
||||
|
||||
date_instanciate(date_ce_date, return_value TSRMLS_CC);
|
||||
dateobj = (php_date_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
dateobj->time = timelib_strtotime(time_str_len ? time_str : "now", time_str_len ? time_str_len : sizeof("now") -1, &error, DATE_TIMEZONEDB);
|
||||
dateobj->time = timelib_strtotime(time_str_len ? time_str : "now", time_str_len ? time_str_len : sizeof("now") -1, NULL, DATE_TIMEZONEDB);
|
||||
|
||||
if (timezone_object) {
|
||||
php_timezone_obj *tzobj;
|
||||
@@ -1352,6 +1348,101 @@ PHP_FUNCTION(date_create)
|
||||
timelib_time_dtor(now);
|
||||
}
|
||||
|
||||
PHP_FUNCTION(date_parse)
|
||||
{
|
||||
char *date;
|
||||
int date_len, i;
|
||||
struct timelib_error_container *error;
|
||||
timelib_time *parsed_time;
|
||||
zval *element;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &date, &date_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
parsed_time = timelib_strtotime(date, date_len, &error, DATE_TIMEZONEDB);
|
||||
array_init(return_value);
|
||||
#define PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(name, elem) \
|
||||
if (parsed_time->elem == -1) { \
|
||||
add_assoc_bool(return_value, #name, 0); \
|
||||
} else { \
|
||||
add_assoc_long(return_value, #name, parsed_time->elem); \
|
||||
}
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(year, y);
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(month, m);
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(day, d);
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(hour, h);
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(minute, i);
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(second, s);
|
||||
|
||||
if (parsed_time->f == -1) {
|
||||
add_assoc_bool(return_value, "fraction", 0);
|
||||
} else {
|
||||
add_assoc_double(return_value, "fraction", parsed_time->f);
|
||||
}
|
||||
|
||||
add_assoc_long(return_value, "warning_count", error->warning_count);
|
||||
MAKE_STD_ZVAL(element);
|
||||
array_init(element);
|
||||
for (i = 0; i < error->warning_count; i++) {
|
||||
add_index_string(element, error->warning_messages[i].position, error->warning_messages[i].message, 1);
|
||||
}
|
||||
add_assoc_zval(return_value, "warnings", element);
|
||||
|
||||
add_assoc_long(return_value, "error_count", error->error_count);
|
||||
MAKE_STD_ZVAL(element);
|
||||
array_init(element);
|
||||
for (i = 0; i < error->error_count; i++) {
|
||||
add_index_string(element, error->error_messages[i].position, error->error_messages[i].message, 1);
|
||||
}
|
||||
add_assoc_zval(return_value, "errors", element);
|
||||
timelib_error_container_dtor(error);
|
||||
|
||||
add_assoc_bool(return_value, "is_localtime", parsed_time->is_localtime);
|
||||
|
||||
if (parsed_time->is_localtime) {
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(zone_type, zone_type);
|
||||
switch (parsed_time->zone_type) {
|
||||
case TIMELIB_ZONETYPE_OFFSET:
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(zone, z);
|
||||
add_assoc_bool(return_value, "is_dst", parsed_time->dst);
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
if (parsed_time->tz_abbr) {
|
||||
add_assoc_string(return_value, "tz_abbr", parsed_time->tz_abbr, 1);
|
||||
}
|
||||
if (parsed_time->tz_info) {
|
||||
add_assoc_string(return_value, "tz_id", parsed_time->tz_info->name, 1);
|
||||
}
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(zone, z);
|
||||
add_assoc_bool(return_value, "is_dst", parsed_time->dst);
|
||||
add_assoc_string(return_value, "tz_abbr", parsed_time->tz_abbr, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (parsed_time->have_relative || parsed_time->have_weekday_relative) {
|
||||
MAKE_STD_ZVAL(element);
|
||||
array_init(element);
|
||||
}
|
||||
if (parsed_time->have_relative) {
|
||||
add_assoc_long(element, "year", parsed_time->relative.y);
|
||||
add_assoc_long(element, "month", parsed_time->relative.m);
|
||||
add_assoc_long(element, "day", parsed_time->relative.d);
|
||||
add_assoc_long(element, "hour", parsed_time->relative.h);
|
||||
add_assoc_long(element, "minute", parsed_time->relative.i);
|
||||
add_assoc_long(element, "second", parsed_time->relative.s);
|
||||
}
|
||||
if (parsed_time->have_weekday_relative) {
|
||||
add_assoc_long(element, "weekday", parsed_time->relative.weekday);
|
||||
}
|
||||
if (parsed_time->have_relative || parsed_time->have_weekday_relative) {
|
||||
add_assoc_zval(return_value, "relative", element);
|
||||
}
|
||||
timelib_time_dtor(parsed_time);
|
||||
}
|
||||
|
||||
PHP_FUNCTION(date_format)
|
||||
{
|
||||
zval *object;
|
||||
@@ -1372,7 +1463,6 @@ PHP_FUNCTION(date_modify)
|
||||
php_date_obj *dateobj;
|
||||
char *modify;
|
||||
int modify_len;
|
||||
int error;
|
||||
timelib_time *tmp_time;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_date, &modify, &modify_len) == FAILURE) {
|
||||
@@ -1380,7 +1470,7 @@ PHP_FUNCTION(date_modify)
|
||||
}
|
||||
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
|
||||
|
||||
tmp_time = timelib_strtotime(modify, modify_len, &error, DATE_TIMEZONEDB);
|
||||
tmp_time = timelib_strtotime(modify, modify_len, NULL, DATE_TIMEZONEDB);
|
||||
dateobj->time->relative.y = tmp_time->relative.y;
|
||||
dateobj->time->relative.m = tmp_time->relative.m;
|
||||
dateobj->time->relative.d = tmp_time->relative.d;
|
||||
@@ -1553,6 +1643,26 @@ PHP_FUNCTION(timezone_name_get)
|
||||
RETURN_STRING(tzobj->tz->name, 1);
|
||||
}
|
||||
|
||||
PHP_FUNCTION(timezone_name_from_abbr)
|
||||
{
|
||||
char *abbr;
|
||||
char *tzname;
|
||||
int abbr_len;
|
||||
long gmtoffset = -1;
|
||||
long isdst = -1;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &abbr, &abbr_len, &gmtoffset, &isdst) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
tzname = timelib_timezone_id_from_abbr(abbr, gmtoffset, isdst);
|
||||
|
||||
if (tzname) {
|
||||
RETURN_STRING(tzname, 1);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
PHP_FUNCTION(timezone_offset_get)
|
||||
{
|
||||
zval *object, *dateobject;
|
||||
@@ -1741,7 +1851,8 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
|
||||
|
||||
timelib_unixtime2local(t, time);
|
||||
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, altitude, altitude > -1 ? 1 : 0, &h_rise, &h_set, &rise, &set, &transit);
|
||||
|
||||
timelib_time_dtor(t);
|
||||
|
||||
if (rs != 0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1884,6 +1995,8 @@ PHP_FUNCTION(date_sun_info)
|
||||
t2->sse = set;
|
||||
add_assoc_long(return_value, "astronomical_twilight_end", timelib_date_to_int(t2, &dummy));
|
||||
}
|
||||
timelib_time_dtor(t);
|
||||
timelib_time_dtor(t2);
|
||||
}
|
||||
/* }}} */
|
||||
/*
|
||||
|
||||
+3
-1
@@ -49,6 +49,7 @@ PHP_FUNCTION(getdate);
|
||||
#ifdef EXPERIMENTAL_DATE_SUPPORT
|
||||
/* Advanced Interface */
|
||||
PHP_FUNCTION(date_create);
|
||||
PHP_FUNCTION(date_parse);
|
||||
PHP_FUNCTION(date_format);
|
||||
PHP_FUNCTION(date_modify);
|
||||
PHP_FUNCTION(date_timezone_get);
|
||||
@@ -61,6 +62,7 @@ PHP_FUNCTION(date_isodate_set);
|
||||
|
||||
PHP_FUNCTION(timezone_open);
|
||||
PHP_FUNCTION(timezone_name_get);
|
||||
PHP_FUNCTION(timezone_name_from_abbr);
|
||||
PHP_FUNCTION(timezone_offset_get);
|
||||
PHP_FUNCTION(timezone_transistions_get);
|
||||
PHP_FUNCTION(timezone_identifiers_list);
|
||||
@@ -95,7 +97,7 @@ ZEND_END_MODULE_GLOBALS(date)
|
||||
#endif
|
||||
|
||||
/* Backwards compability wrapper */
|
||||
signed long php_parse_date(char *string, signed long *now);
|
||||
PHPAPI signed long php_parse_date(char *string, signed long *now);
|
||||
PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
|
||||
PHPAPI int php_idate(char format, time_t ts, int localtime);
|
||||
#if HAVE_STRFTIME
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--TEST--
|
||||
Bug #26317 (military timezone offset signedness)
|
||||
--SKIP--
|
||||
--SKIPIF--
|
||||
if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
|
||||
die("skip unable to change TZ enviroment variable\n");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--TEST--
|
||||
Bug #26320 (strtotime handling of XML Schema/ISO 8601 format)
|
||||
--SKIP--
|
||||
--SKIPIF--
|
||||
if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
|
||||
die("skip unable to change TZ enviroment variable\n");
|
||||
}
|
||||
@@ -12,4 +12,4 @@ if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
|
||||
?>
|
||||
--EXPECT--
|
||||
2003-11-19 12:30:42
|
||||
2003-11-19 12:30:42
|
||||
2003-11-19 12:30:42
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #36224 (date(DATE_ATOM) gives wrong resulsts)
|
||||
--FILE--
|
||||
<?php
|
||||
date_default_timezone_set("Europe/Oslo");
|
||||
|
||||
echo date(DATE_ATOM, strtotime('2006-01-31T19:23:56Z')) . "\n";
|
||||
echo date(DATE_ATOM, strtotime('2006-01-31T19:23:56')) . "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
2006-01-31T20:23:56+01:00
|
||||
2006-01-31T19:23:56+01:00
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #36510 (strtotime() fails to parse date strings with tabs)
|
||||
--FILE--
|
||||
<?php
|
||||
date_default_timezone_set("UTC");
|
||||
|
||||
$t = 1140973388;
|
||||
|
||||
var_dump(strtotime("-2 hours", $t));
|
||||
var_dump(strtotime("-2\thours", $t));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1140966188)
|
||||
int(1140966188)
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #36599 (DATE_W3C format constant incorrect).
|
||||
--FILE--
|
||||
<?php
|
||||
date_default_timezone_set("UTC");
|
||||
|
||||
echo date( DATE_ATOM, strtotime( "2006-03-03 08:47:55" ) ), "\n";
|
||||
echo date( DATE_W3C, strtotime( "2006-03-03 08:47:55" ) ), "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
2006-03-03T08:47:55+00:00
|
||||
2006-03-03T08:47:55+00:00
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #36988 (mktime freezes on long numbers)
|
||||
--INI--
|
||||
date.timezone=GMT
|
||||
--FILE--
|
||||
<?php
|
||||
$start = microtime(true);
|
||||
$a = mktime(1, 1, 1, 1, 1, 11111111111);
|
||||
echo (microtime(true) - $start) < 1 ? "smaller than one second" : "more than a second";
|
||||
?>
|
||||
--EXPECT--
|
||||
smaller than one second
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #37017 (strtotime fails before 13:00:00 with some time zones identifiers).
|
||||
--INI--
|
||||
date.timezone=GMT
|
||||
--FILE--
|
||||
<?php
|
||||
echo strtotime("2006-05-12 13:00:01 America/New_York"), "\n";
|
||||
echo strtotime("2006-05-12 13:00:00 America/New_York"), "\n";
|
||||
echo strtotime("2006-05-12 12:59:59 America/New_York"), "\n";
|
||||
echo strtotime("2006-05-12 12:59:59 GMT"), "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
1147453201
|
||||
1147453200
|
||||
1147453199
|
||||
1147438799
|
||||
@@ -139,9 +139,15 @@ DBA_FETCH_FUNC(db4)
|
||||
DB4_GKEY;
|
||||
|
||||
memset(&gval, 0, sizeof(gval));
|
||||
if (info->flags & DBA_PERSISTENT) {
|
||||
gval.flags |= DB_DBT_MALLOC;
|
||||
}
|
||||
if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
|
||||
if (newlen) *newlen = gval.size;
|
||||
new = estrndup(gval.data, gval.size);
|
||||
if (info->flags & DBA_PERSISTENT) {
|
||||
free(gval.data);
|
||||
}
|
||||
}
|
||||
return new;
|
||||
}
|
||||
@@ -210,11 +216,23 @@ DBA_NEXTKEY_FUNC(db4)
|
||||
memset(&gkey, 0, sizeof(gkey));
|
||||
memset(&gval, 0, sizeof(gval));
|
||||
|
||||
if (info->flags & DBA_PERSISTENT) {
|
||||
gkey.flags |= DB_DBT_MALLOC;
|
||||
gval.flags |= DB_DBT_MALLOC;
|
||||
}
|
||||
if (dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT) == 0) {
|
||||
if (gkey.data) {
|
||||
nkey = estrndup(gkey.data, gkey.size);
|
||||
if (newlen) *newlen = gkey.size;
|
||||
}
|
||||
if (info->flags & DBA_PERSISTENT) {
|
||||
if (gkey.data) {
|
||||
free(gkey.data);
|
||||
}
|
||||
if (gval.data) {
|
||||
free(gval.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nkey;
|
||||
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
--TEST--
|
||||
Bug #36436 DBA problem with Berkeley DB4
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$handler = 'db4';
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$handler = 'db4';
|
||||
require_once('test.inc');
|
||||
|
||||
$db = dba_popen($db_filename, 'c', 'db4');
|
||||
|
||||
dba_insert('X', 'XYZ', $db);
|
||||
dba_insert('Y', '123', $db);
|
||||
|
||||
var_dump($db, dba_fetch('X', $db));
|
||||
|
||||
var_dump(dba_firstkey($db));
|
||||
var_dump(dba_nextkey($db));
|
||||
|
||||
dba_close($db);
|
||||
unlink($db_filename);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
resource(%d) of type (dba persistent)
|
||||
string(3) "XYZ"
|
||||
string(1) "X"
|
||||
string(1) "Y"
|
||||
===DONE===
|
||||
@@ -24,7 +24,7 @@ dbhead_t *get_dbf_head(int fd)
|
||||
dbfield_t *dbf, *cur_f, *tdbf;
|
||||
int ret, nfields, offset, gf_retval;
|
||||
|
||||
if ((dbh = (dbhead_t *)malloc(sizeof(dbhead_t))) == NULL)
|
||||
if ((dbh = (dbhead_t *)calloc(1, sizeof(dbhead_t))) == NULL)
|
||||
return NULL;
|
||||
if (lseek(fd, 0, 0) < 0)
|
||||
return NULL;
|
||||
@@ -44,7 +44,7 @@ dbhead_t *get_dbf_head(int fd)
|
||||
|
||||
/* malloc enough memory for the maximum number of fields:
|
||||
32 * 1024 = 32K dBase5 (for Win) seems to allow that many */
|
||||
tdbf = (dbfield_t *)malloc(sizeof(dbfield_t)*1024);
|
||||
tdbf = (dbfield_t *)calloc(1, sizeof(dbfield_t)*1024);
|
||||
|
||||
offset = 1;
|
||||
nfields = 0;
|
||||
@@ -157,7 +157,8 @@ int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
|
||||
}
|
||||
|
||||
if ((dbf->db_format = get_dbf_f_fmt(dbf)) == NULL) {
|
||||
return 1;
|
||||
/* something went wrong, most likely this fieldtype is not supported */
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -235,6 +236,8 @@ char *get_dbf_f_fmt(dbfield_t *dbf)
|
||||
case 'M':
|
||||
strcpy(format, "%s");
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
return (char *)strdup(format);
|
||||
}
|
||||
@@ -256,7 +259,7 @@ dbhead_t *dbf_open(char *dp, int o_flags TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
if ((dbh = get_dbf_head(fd)) == 0) {
|
||||
if ((dbh = get_dbf_head(fd)) == NULL) {
|
||||
fprintf(stderr, "Unable to get header\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+15
-7
@@ -200,7 +200,8 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
|
||||
curobj = iterator->curobj;
|
||||
intern = (dom_object *)zend_object_store_get_object(curobj TSRMLS_CC);
|
||||
if (intern != NULL && intern->ptr != NULL) {
|
||||
if (objmap->ht == NULL) {
|
||||
if (objmap->nodetype != XML_ENTITY_NODE &&
|
||||
objmap->nodetype != XML_NOTATION_NODE) {
|
||||
if (objmap->nodetype == DOM_NODESET) {
|
||||
nodeht = HASH_OF(objmap->baseobjptr);
|
||||
zend_hash_move_forward(nodeht);
|
||||
@@ -210,12 +211,14 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
|
||||
}
|
||||
} else {
|
||||
curnode = (xmlNodePtr)((php_libxml_node_ptr *)intern->ptr)->node;
|
||||
if (objmap->nodetype == XML_ATTRIBUTE_NODE || objmap->nodetype == XML_ELEMENT_NODE) {
|
||||
if (objmap->nodetype == XML_ATTRIBUTE_NODE ||
|
||||
objmap->nodetype == XML_ELEMENT_NODE) {
|
||||
curnode = curnode->next;
|
||||
} else {
|
||||
/* Nav the tree evey time as this is LIVE */
|
||||
basenode = dom_object_get_node(objmap->baseobj);
|
||||
if (basenode && (basenode->type == XML_DOCUMENT_NODE || basenode->type == XML_HTML_DOCUMENT_NODE)) {
|
||||
if (basenode && (basenode->type == XML_DOCUMENT_NODE ||
|
||||
basenode->type == XML_HTML_DOCUMENT_NODE)) {
|
||||
basenode = xmlDocGetRootElement((xmlDoc *) basenode);
|
||||
} else {
|
||||
basenode = basenode->children;
|
||||
@@ -225,9 +228,9 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
|
||||
}
|
||||
} else {
|
||||
if (objmap->nodetype == XML_ENTITY_NODE) {
|
||||
curnode = php_dom_libxml_hash_iter(objmap->ht, iter->index);
|
||||
curnode = php_dom_libxml_hash_iter(objmap->ht, iter->index - 1);
|
||||
} else {
|
||||
curnode = php_dom_libxml_notation_iter(objmap->ht, iter->index);
|
||||
curnode = php_dom_libxml_notation_iter(objmap->ht, iter->index - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,7 +272,8 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object TS
|
||||
intern = (dom_object *)zend_object_store_get_object(object TSRMLS_CC);
|
||||
objmap = (dom_nnodemap_object *)intern->ptr;
|
||||
if (objmap != NULL) {
|
||||
if (objmap->ht == NULL) {
|
||||
if (objmap->nodetype != XML_ENTITY_NODE &&
|
||||
objmap->nodetype != XML_NOTATION_NODE) {
|
||||
if (objmap->nodetype == DOM_NODESET) {
|
||||
nodeht = HASH_OF(objmap->baseobjptr);
|
||||
zend_hash_internal_pointer_reset(nodeht);
|
||||
@@ -295,7 +299,11 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object TS
|
||||
}
|
||||
}
|
||||
} else {
|
||||
curnode = php_dom_libxml_hash_iter(objmap->ht, 0);
|
||||
if (objmap->nodetype == XML_ENTITY_NODE) {
|
||||
curnode = php_dom_libxml_hash_iter(objmap->ht, 0);
|
||||
} else {
|
||||
curnode = php_dom_libxml_notation_iter(objmap->ht, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ PHP_METHOD(domimplementation, createDocumentType)
|
||||
pch2 = systemid;
|
||||
|
||||
uri = xmlParseURI(name);
|
||||
if (uri->opaque != NULL) {
|
||||
if (uri != NULL && uri->opaque != NULL) {
|
||||
localname = xmlStrdup(uri->opaque);
|
||||
if (xmlStrchr(localname, (xmlChar) ':') != NULL) {
|
||||
php_dom_throw_error(NAMESPACE_ERR, 1 TSRMLS_CC);
|
||||
@@ -108,7 +108,9 @@ PHP_METHOD(domimplementation, createDocumentType)
|
||||
php_dom_throw_error(INVALID_CHARACTER_ERR, TSRMLS_CC);
|
||||
*/
|
||||
|
||||
xmlFreeURI(uri);
|
||||
if (uri) {
|
||||
xmlFreeURI(uri);
|
||||
}
|
||||
|
||||
doctype = xmlCreateIntSubset(NULL, localname, pch1, pch2);
|
||||
xmlFree(localname);
|
||||
|
||||
+35
-19
@@ -61,8 +61,11 @@ int dom_namednodemap_length_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
objmap = (dom_nnodemap_object *)obj->ptr;
|
||||
|
||||
if (objmap != NULL) {
|
||||
if (objmap->ht) {
|
||||
count = xmlHashSize(objmap->ht);
|
||||
if ((objmap->nodetype == XML_NOTATION_NODE) ||
|
||||
objmap->nodetype == XML_ENTITY_NODE) {
|
||||
if (objmap->ht) {
|
||||
count = xmlHashSize(objmap->ht);
|
||||
}
|
||||
} else {
|
||||
nodep = dom_object_get_node(objmap->baseobj);
|
||||
if (nodep) {
|
||||
@@ -113,12 +116,17 @@ PHP_FUNCTION(dom_namednodemap_get_named_item)
|
||||
objmap = (dom_nnodemap_object *)intern->ptr;
|
||||
|
||||
if (objmap != NULL) {
|
||||
if (objmap->ht) {
|
||||
if (objmap->nodetype == XML_ENTITY_NODE) {
|
||||
itemnode = (xmlNodePtr)xmlHashLookup(objmap->ht, named);
|
||||
} else {
|
||||
notep = (xmlNotation *)xmlHashLookup(objmap->ht, named);
|
||||
itemnode = create_notation(notep->name, notep->PublicID, notep->SystemID);
|
||||
if ((objmap->nodetype == XML_NOTATION_NODE) ||
|
||||
objmap->nodetype == XML_ENTITY_NODE) {
|
||||
if (objmap->ht) {
|
||||
if (objmap->nodetype == XML_ENTITY_NODE) {
|
||||
itemnode = (xmlNodePtr)xmlHashLookup(objmap->ht, named);
|
||||
} else {
|
||||
notep = (xmlNotation *)xmlHashLookup(objmap->ht, named);
|
||||
if (notep) {
|
||||
itemnode = create_notation(notep->name, notep->PublicID, notep->SystemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nodep = dom_object_get_node(objmap->baseobj);
|
||||
@@ -185,11 +193,14 @@ PHP_FUNCTION(dom_namednodemap_item)
|
||||
objmap = (dom_nnodemap_object *)intern->ptr;
|
||||
|
||||
if (objmap != NULL) {
|
||||
if (objmap->ht) {
|
||||
if (objmap->nodetype == XML_ENTITY_NODE) {
|
||||
itemnode = php_dom_libxml_hash_iter(objmap->ht, index);
|
||||
} else {
|
||||
itemnode = php_dom_libxml_notation_iter(objmap->ht, index);
|
||||
if ((objmap->nodetype == XML_NOTATION_NODE) ||
|
||||
objmap->nodetype == XML_ENTITY_NODE) {
|
||||
if (objmap->ht) {
|
||||
if (objmap->nodetype == XML_ENTITY_NODE) {
|
||||
itemnode = php_dom_libxml_hash_iter(objmap->ht, index);
|
||||
} else {
|
||||
itemnode = php_dom_libxml_notation_iter(objmap->ht, index);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nodep = dom_object_get_node(objmap->baseobj);
|
||||
@@ -241,12 +252,17 @@ PHP_FUNCTION(dom_namednodemap_get_named_item_ns)
|
||||
objmap = (dom_nnodemap_object *)intern->ptr;
|
||||
|
||||
if (objmap != NULL) {
|
||||
if (objmap->ht) {
|
||||
if (objmap->nodetype == XML_ENTITY_NODE) {
|
||||
itemnode = (xmlNodePtr)xmlHashLookup(objmap->ht, named);
|
||||
} else {
|
||||
notep = (xmlNotation *)xmlHashLookup(objmap->ht, named);
|
||||
itemnode = create_notation(notep->name, notep->PublicID, notep->SystemID);
|
||||
if ((objmap->nodetype == XML_NOTATION_NODE) ||
|
||||
objmap->nodetype == XML_ENTITY_NODE) {
|
||||
if (objmap->ht) {
|
||||
if (objmap->nodetype == XML_ENTITY_NODE) {
|
||||
itemnode = (xmlNodePtr)xmlHashLookup(objmap->ht, named);
|
||||
} else {
|
||||
notep = (xmlNotation *)xmlHashLookup(objmap->ht, named);
|
||||
if (notep) {
|
||||
itemnode = create_notation(notep->name, notep->PublicID, notep->SystemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nodep = dom_object_get_node(objmap->baseobj);
|
||||
|
||||
+1
-1
@@ -840,10 +840,10 @@ int dom_node_text_content_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
if(str != NULL) {
|
||||
ZVAL_STRING(*retval, str, 1);
|
||||
xmlFree(str);
|
||||
} else {
|
||||
ZVAL_EMPTY_STRING(*retval);
|
||||
}
|
||||
xmlFree(str);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
+7
-7
@@ -48,9 +48,9 @@ Since:
|
||||
*/
|
||||
int dom_notation_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
{
|
||||
xmlNotationPtr nodep;
|
||||
xmlEntityPtr nodep;
|
||||
|
||||
nodep = (xmlNotationPtr) dom_object_get_node(obj);
|
||||
nodep = (xmlEntityPtr) dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
@@ -58,8 +58,8 @@ int dom_notation_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
if (nodep->PublicID) {
|
||||
ZVAL_STRING(*retval, (char *) (nodep->PublicID), 1);
|
||||
if (nodep->ExternalID) {
|
||||
ZVAL_STRING(*retval, (char *) (nodep->ExternalID), 1);
|
||||
} else {
|
||||
ZVAL_EMPTY_STRING(*retval);
|
||||
}
|
||||
@@ -78,9 +78,9 @@ Since:
|
||||
*/
|
||||
int dom_notation_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
{
|
||||
xmlNotationPtr nodep;
|
||||
xmlEntityPtr nodep;
|
||||
|
||||
nodep = (xmlNotationPtr) dom_object_get_node(obj);
|
||||
nodep = (xmlEntityPtr) dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
@@ -89,7 +89,7 @@ int dom_notation_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
if (nodep->SystemID) {
|
||||
ZVAL_STRING(*retval, (char *) (nodep->PublicID), 1);
|
||||
ZVAL_STRING(*retval, (char *) (nodep->SystemID), 1);
|
||||
} else {
|
||||
ZVAL_EMPTY_STRING(*retval);
|
||||
}
|
||||
|
||||
+7
-10
@@ -289,6 +289,8 @@ zval *dom_read_property(zval *object, zval *member, int type TSRMLS_DC)
|
||||
|
||||
if (obj->prop_handler != NULL) {
|
||||
ret = zend_hash_find(obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd);
|
||||
} else if (instanceof_function(obj->std.ce, dom_node_class_entry TSRMLS_CC)) {
|
||||
php_error(E_WARNING, "Couldn't fetch %s. Node no longer exists", obj->std.ce->name);
|
||||
}
|
||||
if (ret == SUCCESS) {
|
||||
ret = hnd->read_func(obj, &retval TSRMLS_CC);
|
||||
@@ -441,6 +443,7 @@ zend_object_value dom_objects_store_clone_obj(zval *zobject TSRMLS_DC)
|
||||
retval.handle = zend_objects_store_put(new_object, obj->dtor, obj->free_storage, obj->clone TSRMLS_CC);
|
||||
intern = (dom_object *) new_object;
|
||||
intern->handle = retval.handle;
|
||||
intern->ptr = NULL;
|
||||
retval.handlers = Z_OBJ_HT_P(zobject);
|
||||
|
||||
old_object = (dom_object *) obj->object;
|
||||
@@ -903,8 +906,7 @@ void dom_xpath_objects_free_storage(void *object TSRMLS_DC)
|
||||
{
|
||||
dom_object *intern = (dom_object *)object;
|
||||
|
||||
zend_hash_destroy(intern->std.properties);
|
||||
FREE_HASHTABLE(intern->std.properties);
|
||||
zend_object_std_dtor(&intern->std TSRMLS_CC);
|
||||
|
||||
if (intern->ptr != NULL) {
|
||||
xmlXPathFreeContext((xmlXPathContextPtr) intern->ptr);
|
||||
@@ -923,8 +925,7 @@ void dom_objects_free_storage(void *object TSRMLS_DC)
|
||||
dom_object *intern = (dom_object *)object;
|
||||
int retcount;
|
||||
|
||||
zend_hash_destroy(intern->std.properties);
|
||||
FREE_HASHTABLE(intern->std.properties);
|
||||
zend_object_std_dtor(&intern->std TSRMLS_CC);
|
||||
|
||||
if (intern->ptr != NULL && ((php_libxml_node_ptr *)intern->ptr)->node != NULL) {
|
||||
if (((xmlNodePtr) ((php_libxml_node_ptr *)intern->ptr)->node)->type != XML_DOCUMENT_NODE && ((xmlNodePtr) ((php_libxml_node_ptr *)intern->ptr)->node)->type != XML_HTML_DOCUMENT_NODE) {
|
||||
@@ -970,8 +971,6 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool
|
||||
dom_object *intern;
|
||||
|
||||
intern = emalloc(sizeof(dom_object));
|
||||
intern->std.ce = class_type;
|
||||
intern->std.guards = NULL;
|
||||
intern->ptr = NULL;
|
||||
intern->prop_handler = NULL;
|
||||
intern->document = NULL;
|
||||
@@ -983,8 +982,7 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool
|
||||
|
||||
zend_hash_find(&classes, base_class->name, base_class->name_length + 1, (void **) &intern->prop_handler);
|
||||
|
||||
ALLOC_HASHTABLE(intern->std.properties);
|
||||
zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
if (hash_copy) {
|
||||
zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
}
|
||||
@@ -1089,8 +1087,7 @@ void dom_nnodemap_objects_free_storage(void *object TSRMLS_DC)
|
||||
|
||||
php_libxml_decrement_doc_ref((php_libxml_node_object *)intern TSRMLS_CC);
|
||||
|
||||
zend_hash_destroy(intern->std.properties);
|
||||
FREE_HASHTABLE(intern->std.properties);
|
||||
zend_object_std_dtor(&intern->std TSRMLS_CC);
|
||||
|
||||
efree(object);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
Bug #36756: (DOMDocument::removeChild corrupts node)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/* Node is preserved from removeChild */
|
||||
$dom = new DOMDocument();
|
||||
$dom->loadXML('<root><child/></root>');
|
||||
$xpath = new DOMXpath($dom);
|
||||
$node = $xpath->query('/root')->item(0);
|
||||
echo $node->nodeName . "\n";
|
||||
$dom->removeChild($GLOBALS['dom']->firstChild);
|
||||
echo "nodeType: " . $node->nodeType . "\n";
|
||||
|
||||
/* Node gets destroyed during removeChild */
|
||||
$dom->loadXML('<root><child/></root>');
|
||||
$xpath = new DOMXpath($dom);
|
||||
$node = $xpath->query('//child')->item(0);
|
||||
echo $node->nodeName . "\n";
|
||||
$GLOBALS['dom']->removeChild($GLOBALS['dom']->firstChild);
|
||||
|
||||
echo "nodeType: " . $node->nodeType . "\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
root
|
||||
nodeType: 1
|
||||
child
|
||||
|
||||
Warning: Couldn't fetch DOMElement. Node no longer exists in %sbug36756.php on line %d
|
||||
|
||||
Notice: Undefined property: DOMElement::$nodeType in %sbug36756.php on line %d
|
||||
nodeType:
|
||||
@@ -0,0 +1,99 @@
|
||||
--TEST--
|
||||
Test 7: DTD tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xml = <<< EOXML
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE courses [
|
||||
<!ELEMENT courses (course+)>
|
||||
<!ELEMENT course (title, description, temp*)>
|
||||
<!ATTLIST course cid ID #REQUIRED>
|
||||
<!ELEMENT title (#PCDATA)>
|
||||
<!ELEMENT description (#PCDATA)>
|
||||
<!ELEMENT temp (#PCDATA)>
|
||||
<!ATTLIST temp vid ID #REQUIRED>
|
||||
<!ENTITY test 'http://www.hpl.hp.com/semweb/2003/query_tester#'>
|
||||
<!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
|
||||
<!NOTATION GIF PUBLIC "-" "image/gif">
|
||||
<!ENTITY myimage PUBLIC "-" "mypicture.gif" NDATA GIF>
|
||||
]>
|
||||
<courses>
|
||||
<course cid="c1">
|
||||
<title>Basic Languages</title>
|
||||
<description>Introduction to Languages</description>
|
||||
</course>
|
||||
<course cid="c6">
|
||||
<title>French I</title>
|
||||
<description>Introduction to French</description>
|
||||
<temp vid="c7">
|
||||
</temp>
|
||||
</course>
|
||||
</courses>
|
||||
EOXML;
|
||||
|
||||
$dom = new DOMDocument();
|
||||
$dom->loadXML($xml);
|
||||
|
||||
$dtd = $dom->doctype;
|
||||
|
||||
/* Notation Tests */
|
||||
$nots = $dtd->notations;
|
||||
|
||||
$length = $nots->length;
|
||||
echo "Length: ".$length."\n";
|
||||
|
||||
foreach ($nots AS $key=>$node) {
|
||||
echo "Key $key: ".$node->nodeName." (".$node->systemId.") (".$node->publicId.")\n";
|
||||
}
|
||||
print "\n";
|
||||
for($x=0; $x < $length; $x++) {
|
||||
echo "Index $x: ".$nots->item($x)->nodeName." (".$nots->item($x)->systemId.") (".$nots->item($x)->publicId.")\n";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
$node = $nots->getNamedItem('xxx');
|
||||
var_dump($node);
|
||||
|
||||
echo "\n";
|
||||
/* Entity Decl Tests */
|
||||
$ents = $dtd->entities;
|
||||
$length = $ents->length;
|
||||
echo "Length: ".$length."\n";
|
||||
foreach ($ents AS $key=>$node) {
|
||||
echo "Key: $key Name: ".$node->nodeName."\n";
|
||||
}
|
||||
echo "\n";
|
||||
for($x=0; $x < $length; $x++) {
|
||||
echo "Index $x: ".$ents->item($x)->nodeName."\n";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
$node = $ents->item(3);
|
||||
var_dump($node);
|
||||
$node = $ents->getNamedItem('xxx');
|
||||
var_dump($node);
|
||||
|
||||
|
||||
--EXPECT--
|
||||
Length: 1
|
||||
Key GIF: GIF (image/gif) (-)
|
||||
|
||||
Index 0: GIF (image/gif) (-)
|
||||
|
||||
NULL
|
||||
|
||||
Length: 3
|
||||
Key: test Name: test
|
||||
Key: rdf Name: rdf
|
||||
Key: myimage Name: myimage
|
||||
|
||||
Index 0: test
|
||||
Index 1: rdf
|
||||
Index 2: myimage
|
||||
|
||||
NULL
|
||||
NULL
|
||||
+1
-1
@@ -355,7 +355,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
|
||||
new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
|
||||
walk = replace;
|
||||
while (*walk) {
|
||||
if ('\\' == *walk && isdigit((unsigned char)walk[1]) && ((unsigned char)walk[1]) - '0' <= re.re_nsub) {
|
||||
if ('\\' == *walk && isdigit((unsigned char)walk[1]) && ((unsigned char)walk[1]) - '0' <= (int)re.re_nsub) {
|
||||
if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) {
|
||||
new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1560,7 +1560,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
|
||||
image_info_data *info_data;
|
||||
image_info_data *list;
|
||||
|
||||
if (length >= LONG_MAX) {
|
||||
if (length < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -810,7 +810,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
|
||||
|
||||
if (resumepos > 0) {
|
||||
if (resumepos > 2147483647) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater then 2147483647 bytes.");
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater than 2147483647 bytes.");
|
||||
goto bail;
|
||||
}
|
||||
sprintf(arg, "%u", resumepos);
|
||||
@@ -907,7 +907,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, i
|
||||
|
||||
if (startpos > 0) {
|
||||
if (startpos > 2147483647) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater then 2147483647 bytes.");
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater than 2147483647 bytes.");
|
||||
goto bail;
|
||||
}
|
||||
sprintf(arg, "%u", startpos);
|
||||
@@ -1706,7 +1706,7 @@ ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t typ
|
||||
* since php is 32 bit by design, we bail out with warning
|
||||
*/
|
||||
if (resumepos > 2147483647) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater then 2147483648 bytes.");
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater than 2147483648 bytes.");
|
||||
goto bail;
|
||||
}
|
||||
sprintf(arg, "%u", resumepos);
|
||||
@@ -1824,7 +1824,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
|
||||
}
|
||||
if (startpos > 0) {
|
||||
if (startpos > 2147483647) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater then 2147483647 bytes.");
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater than 2147483647 bytes.");
|
||||
goto bail;
|
||||
}
|
||||
sprintf(arg, "%u", startpos);
|
||||
|
||||
+67
-4
@@ -29,7 +29,13 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GD_PNG
|
||||
/* needs to be first */
|
||||
#include <png.h>
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/head.h"
|
||||
#include <math.h>
|
||||
#include "SAPI.h"
|
||||
@@ -352,6 +358,12 @@ zend_module_entry gd_module_entry = {
|
||||
ZEND_GET_MODULE(gd)
|
||||
#endif
|
||||
|
||||
/* {{{ PHP_INI_BEGIN */
|
||||
PHP_INI_BEGIN()
|
||||
PHP_INI_ENTRY("gd.jpeg_ignore_warning", "0", PHP_INI_ALL, NULL)
|
||||
PHP_INI_END()
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_free_gd_image
|
||||
*/
|
||||
static void php_free_gd_image(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
@@ -400,6 +412,8 @@ PHP_MINIT_FUNCTION(gd)
|
||||
le_ps_enc = zend_register_list_destructors_ex(php_free_ps_enc, NULL, "gd PS encoding", module_number);
|
||||
#endif
|
||||
|
||||
REGISTER_INI_ENTRIES();
|
||||
|
||||
REGISTER_LONG_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("IMG_JPG", 2, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -451,6 +465,22 @@ PHP_MINIT_FUNCTION(gd)
|
||||
#else
|
||||
REGISTER_LONG_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GD_PNG
|
||||
|
||||
/*
|
||||
* cannot include #include "png.h"
|
||||
* /usr/include/pngconf.h:310:2: error: #error png.h already includes setjmp.h with some additional fixup.
|
||||
* as error, use the values for now...
|
||||
*/
|
||||
REGISTER_LONG_CONSTANT("PNG_NO_FILTER", 0x00, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PNG_FILTER_NONE", 0x08, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PNG_FILTER_SUB", 0x10, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PNG_FILTER_UP", 0x20, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PNG_FILTER_AVG", 0x40, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PNG_FILTER_PAETH", 0x80, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PNG_ALL_FILTERS", 0x08 | 0x10 | 0x20 | 0x40 | 0x80, CONST_CS | CONST_PERSISTENT);
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1064,6 +1094,7 @@ PHP_FUNCTION(imagesavealpha)
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
#if HAVE_GD_BUNDLED
|
||||
@@ -1095,6 +1126,7 @@ PHP_FUNCTION(imagecolorallocatealpha)
|
||||
zval *IM;
|
||||
long red, green, blue, alpha;
|
||||
gdImagePtr im;
|
||||
int ct = (-1);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
@@ -1102,7 +1134,12 @@ PHP_FUNCTION(imagecolorallocatealpha)
|
||||
|
||||
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
|
||||
|
||||
RETURN_LONG(gdImageColorAllocateAlpha(im, red, green, blue, alpha));
|
||||
ct = gdImageColorAllocateAlpha(im, red, green, blue, alpha);
|
||||
if (ct < 0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG((long)ct);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1513,6 +1550,8 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
php_stream *stream;
|
||||
FILE * fp = NULL;
|
||||
int argc=ZEND_NUM_ARGS();
|
||||
long ignore_warning;
|
||||
|
||||
|
||||
if ((image_type == PHP_GDIMG_TYPE_GD2PART && argc != 5) ||
|
||||
(image_type != PHP_GDIMG_TYPE_GD2PART && argc != 1) ||
|
||||
@@ -1593,6 +1632,18 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
im = gdImageCreateFromXpm(fn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GD_JPG
|
||||
case PHP_GDIMG_TYPE_JPG:
|
||||
ignore_warning = INI_INT("gd.jpeg_ignore_warning");
|
||||
#ifdef HAVE_GD_BUNDLED
|
||||
im = gdImageCreateFromJpeg(fp, ignore_warning);
|
||||
#else
|
||||
im = gdImageCreateFromJpeg(fp);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
im = (*func_p)(fp);
|
||||
break;
|
||||
@@ -1960,6 +2011,7 @@ PHP_FUNCTION(imagecolorallocate)
|
||||
{
|
||||
zval **IM, **red, **green, **blue;
|
||||
gdImagePtr im;
|
||||
int ct = (-1);
|
||||
|
||||
if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
@@ -1970,8 +2022,11 @@ PHP_FUNCTION(imagecolorallocate)
|
||||
convert_to_long_ex(red);
|
||||
convert_to_long_ex(green);
|
||||
convert_to_long_ex(blue);
|
||||
|
||||
RETURN_LONG(gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
|
||||
ct = gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue));
|
||||
if (ct < 0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_LONG(ct);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -3191,6 +3246,8 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
|
||||
fontname = (unsigned char *) fontname;
|
||||
#endif
|
||||
|
||||
PHP_GD_CHECK_OPEN_BASEDIR(fontname, "Invalid font filename");
|
||||
|
||||
#ifdef USE_GD_IMGSTRTTF
|
||||
# if HAVE_GD_STRINGFTEX
|
||||
if (extended) {
|
||||
@@ -3808,7 +3865,8 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
|
||||
int int_threshold;
|
||||
int x, y;
|
||||
float x_ratio, y_ratio;
|
||||
|
||||
long ignore_warning;
|
||||
|
||||
if (argc != 5 || zend_get_parameters_ex(argc, &f_org, &f_dest, &height, &width, &threshold) == FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
@@ -3864,7 +3922,12 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
|
||||
|
||||
#ifdef HAVE_GD_JPG
|
||||
case PHP_GDIMG_TYPE_JPG:
|
||||
ignore_warning = INI_INT("gd.jpeg_ignore_warning");
|
||||
#ifdef HAVE_GD_BUNDLED
|
||||
im_org = gdImageCreateFromJpeg(org, ignore_warning);
|
||||
#else
|
||||
im_org = gdImageCreateFromJpeg(org);
|
||||
#endif
|
||||
if (im_org == NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open '%s' Not a valid JPEG file", fn_dest);
|
||||
RETURN_FALSE;
|
||||
|
||||
+12
-4
@@ -49,12 +49,13 @@ static void _php_image_output_ctxfree(struct gdIOCtx *ctx)
|
||||
/* {{{ _php_image_output_ctx */
|
||||
static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)())
|
||||
{
|
||||
zval **imgind, **file, **quality;
|
||||
zval **imgind, **file, **quality, **basefilter;
|
||||
gdImagePtr im;
|
||||
char *fn = NULL;
|
||||
FILE *fp = NULL;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
int q = -1, i;
|
||||
int f = -1;
|
||||
gdIOCtx *ctx;
|
||||
|
||||
/* The third (quality) parameter for Wbmp stands for the threshold when called from image2wbmp().
|
||||
@@ -65,7 +66,8 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
if (argc < 2 && image_type == PHP_GDIMG_TYPE_XBM) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
if (argc < 1 || argc > 3 || zend_get_parameters_ex(argc, &imgind, &file, &quality) == FAILURE)
|
||||
|
||||
if (argc < 1 || argc > 4 || zend_get_parameters_ex(argc, &imgind, &file, &quality, &basefilter) == FAILURE)
|
||||
{
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
@@ -75,9 +77,13 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
if (argc > 1) {
|
||||
convert_to_string_ex(file);
|
||||
fn = Z_STRVAL_PP(file);
|
||||
if (argc == 3) {
|
||||
if (argc >= 3) {
|
||||
convert_to_long_ex(quality);
|
||||
q = Z_LVAL_PP(quality);/* or colorindex for foreground of BW images (defaults to black) */
|
||||
if (argc == 4) {
|
||||
convert_to_long_ex(basefilter);
|
||||
f = Z_LVAL_PP(basefilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,9 +121,11 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
|
||||
}
|
||||
case PHP_GDIMG_TYPE_JPG:
|
||||
case PHP_GDIMG_TYPE_PNG:
|
||||
(*func_p)(im, ctx, q);
|
||||
break;
|
||||
case PHP_GDIMG_TYPE_PNG:
|
||||
(*func_p)(im, ctx, q, f);
|
||||
break;
|
||||
case PHP_GDIMG_TYPE_XBM:
|
||||
case PHP_GDIMG_TYPE_WBM:
|
||||
if (argc < 3) {
|
||||
|
||||
+5
-5
@@ -237,8 +237,8 @@ gdImagePtr gdImageCreateFromPng(FILE *fd);
|
||||
gdImagePtr gdImageCreateFromPngCtx(gdIOCtxPtr in);
|
||||
gdImagePtr gdImageCreateFromWBMP(FILE *inFile);
|
||||
gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile);
|
||||
gdImagePtr gdImageCreateFromJpeg(FILE *infile);
|
||||
gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile);
|
||||
gdImagePtr gdImageCreateFromJpeg(FILE *infile, int ignore_warning);
|
||||
gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile, int ignore_warning);
|
||||
|
||||
/* A custom data source. */
|
||||
/* The source function must return -1 on error, otherwise the number
|
||||
@@ -444,8 +444,8 @@ void gdImageGifCtx(gdImagePtr im, gdIOCtx *out);
|
||||
* compression (smallest files) but takes a long time to compress, and
|
||||
* -1 selects the default compiled into the zlib library.
|
||||
*/
|
||||
void gdImagePngEx(gdImagePtr im, FILE * out, int level);
|
||||
void gdImagePngCtxEx(gdImagePtr im, gdIOCtx * out, int level);
|
||||
void gdImagePngEx(gdImagePtr im, FILE * out, int level, int basefilter);
|
||||
void gdImagePngCtxEx(gdImagePtr im, gdIOCtx * out, int level, int basefilter);
|
||||
|
||||
void gdImageWBMP(gdImagePtr image, int fg, FILE *out);
|
||||
void gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out);
|
||||
@@ -489,7 +489,7 @@ void* gdImagePngPtr(gdImagePtr im, int *size);
|
||||
|
||||
/* Best to free this memory with gdFree(), not free() */
|
||||
void* gdImageGdPtr(gdImagePtr im, int *size);
|
||||
void *gdImagePngPtrEx(gdImagePtr im, int *size, int level);
|
||||
void *gdImagePngPtrEx(gdImagePtr im, int *size, int level, int basefilter);
|
||||
|
||||
/* Best to free this memory with gdFree(), not free() */
|
||||
void* gdImageGd2Ptr(gdImagePtr im, int cs, int fmt, int *size);
|
||||
|
||||
@@ -133,7 +133,7 @@ void gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
|
||||
BitsPerPixel = colorstobpp(tim->colorsTotal);
|
||||
/* All set, let's do it. */
|
||||
GIFEncode(
|
||||
out, tim->sx, tim->sy, interlace, 0, transparent, BitsPerPixel,
|
||||
out, tim->sx, tim->sy, tim->interlace, 0, tim->transparent, BitsPerPixel,
|
||||
tim->red, tim->green, tim->blue, tim);
|
||||
if (pim) {
|
||||
/* Destroy palette based temporary image. */
|
||||
|
||||
+52
-10
@@ -43,8 +43,44 @@ static const char *const GD_JPEG_VERSION = "1.0";
|
||||
typedef struct _jmpbuf_wrapper
|
||||
{
|
||||
jmp_buf jmpbuf;
|
||||
int ignore_warning;
|
||||
} jmpbuf_wrapper;
|
||||
|
||||
static long php_jpeg_emit_message(j_common_ptr jpeg_info, int level)
|
||||
{
|
||||
char message[JMSG_LENGTH_MAX];
|
||||
jmpbuf_wrapper *jmpbufw;
|
||||
int ignore_warning = 0;
|
||||
|
||||
jmpbufw = (jmpbuf_wrapper *) jpeg_info->client_data;
|
||||
|
||||
if (jmpbufw != 0) {
|
||||
ignore_warning = jmpbufw->ignore_warning;
|
||||
}
|
||||
|
||||
(jpeg_info->err->format_message)(jpeg_info,message);
|
||||
|
||||
/* It is a warning message */
|
||||
if (level < 0) {
|
||||
/* display only the 1st warning, as would do a default libjpeg
|
||||
* unless strace_level >= 3
|
||||
*/
|
||||
if ((jpeg_info->err->num_warnings == 0) || (jpeg_info->err->trace_level >= 3)) {
|
||||
php_gd_error_ex(ignore_warning ? E_NOTICE : E_WARNING, "gd-jpeg, libjpeg: recoverable error: %s\n", message);
|
||||
}
|
||||
|
||||
jpeg_info->err->num_warnings++;
|
||||
} else {
|
||||
/* strace msg, Show it if trace_level >= level. */
|
||||
if (jpeg_info->err->trace_level >= level) {
|
||||
php_gd_error_ex(E_NOTICE, "gd-jpeg, libjpeg: strace message: %s\n", message);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Called by the IJG JPEG library upon encountering a fatal error */
|
||||
static void fatal_jpeg_error (j_common_ptr cinfo)
|
||||
{
|
||||
@@ -207,21 +243,21 @@ void gdImageJpegCtx (gdImagePtr im, gdIOCtx * outfile, int quality)
|
||||
gdFree (row);
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromJpeg (FILE * inFile)
|
||||
gdImagePtr gdImageCreateFromJpeg (FILE * inFile, int ignore_warning)
|
||||
{
|
||||
gdImagePtr im;
|
||||
gdIOCtx *in = gdNewFileCtx(inFile);
|
||||
im = gdImageCreateFromJpegCtx(in);
|
||||
im = gdImageCreateFromJpegCtx(in, ignore_warning);
|
||||
in->gd_free (in);
|
||||
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromJpegPtr (int size, void *data)
|
||||
gdImagePtr gdImageCreateFromJpegPtr (int size, void *data, int ignore_warning)
|
||||
{
|
||||
gdImagePtr im;
|
||||
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
|
||||
im = gdImageCreateFromJpegCtx(in);
|
||||
im = gdImageCreateFromJpegCtx(in, ignore_warning);
|
||||
in->gd_free(in);
|
||||
|
||||
return im;
|
||||
@@ -231,11 +267,12 @@ void jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile);
|
||||
|
||||
static int CMYKToRGB(int c, int m, int y, int k, int inverted);
|
||||
|
||||
|
||||
/*
|
||||
* Create a gd-format image from the JPEG-format INFILE. Returns the
|
||||
* image, or NULL upon error.
|
||||
*/
|
||||
gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
|
||||
gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile, int ignore_warning)
|
||||
{
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
@@ -253,8 +290,13 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
|
||||
memset (&cinfo, 0, sizeof (cinfo));
|
||||
memset (&jerr, 0, sizeof (jerr));
|
||||
|
||||
jmpbufw.ignore_warning = ignore_warning;
|
||||
|
||||
cinfo.err = jpeg_std_error (&jerr);
|
||||
cinfo.client_data = &jmpbufw;
|
||||
|
||||
cinfo.err->emit_message = (void (*)(j_common_ptr,int)) php_jpeg_emit_message;
|
||||
|
||||
if (setjmp (jmpbufw.jmpbuf) != 0) {
|
||||
/* we're here courtesy of longjmp */
|
||||
if (row) {
|
||||
@@ -386,12 +428,12 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
|
||||
if (jpeg_finish_decompress (&cinfo) != TRUE) {
|
||||
php_gd_error("gd-jpeg: warning: jpeg_finish_decompress reports suspended data source");
|
||||
}
|
||||
|
||||
/* Thanks to Truxton Fulton */
|
||||
if (cinfo.err->num_warnings > 0) {
|
||||
goto error;
|
||||
if (!ignore_warning) {
|
||||
if (cinfo.err->num_warnings > 0) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
jpeg_destroy_decompress (&cinfo);
|
||||
gdFree (row);
|
||||
|
||||
|
||||
Loaded 100 of 552 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user