mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-21 07:56:37 +00:00
Compare commits
570
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3642203fa0 | ||
|
|
721fec251b | ||
|
|
b05b949a47 | ||
|
|
e9de9f3aeb | ||
|
|
a3cb94abff | ||
|
|
fa406902d5 | ||
|
|
36a14076a8 | ||
|
|
3815b367d5 | ||
|
|
844cb82c45 | ||
|
|
2e8f773eee | ||
|
|
a9cac89541 | ||
|
|
8212034254 | ||
|
|
9ffefbc74e | ||
|
|
7c01510b95 | ||
|
|
3a9cdbfd41 | ||
|
|
bac9ab777e | ||
|
|
ced39e3168 | ||
|
|
dcd7879556 | ||
|
|
97ec02ce81 | ||
|
|
4c98758328 | ||
|
|
5b502880b6 | ||
|
|
51d8950b53 | ||
|
|
b122cd4b08 | ||
|
|
143d1c8011 | ||
|
|
f987de46b4 | ||
|
|
936b1e56c3 | ||
|
|
2486b846cc | ||
|
|
af888a4807 | ||
|
|
a329ecd8c4 | ||
|
|
2af3190a3d | ||
|
|
e13d51cea3 | ||
|
|
2c5c8c161c | ||
|
|
3bbd4b17a9 | ||
|
|
e415260868 | ||
|
|
4d3c8240d5 | ||
|
|
60efdff75f | ||
|
|
9490f1c847 | ||
|
|
a0c8d5d80a | ||
|
|
6b46a441cd | ||
|
|
dda1f722e2 | ||
|
|
57b520541b | ||
|
|
5460d2dad6 | ||
|
|
a0dd931d85 | ||
|
|
f9fb94ff00 | ||
|
|
0a7b720094 | ||
|
|
76ad7425ad | ||
|
|
ea544cf38f | ||
|
|
ecca329c14 | ||
|
|
890f7f46b4 | ||
|
|
23d3ddea25 | ||
|
|
75a548a7e9 | ||
|
|
b260064bbf | ||
|
|
187b6cc583 | ||
|
|
af0adbed39 | ||
|
|
7c3bdf444d | ||
|
|
863bf8a574 | ||
|
|
d4696abdb9 | ||
|
|
e7925c9767 | ||
|
|
159bae3d99 | ||
|
|
5fdeb391f3 | ||
|
|
b0c0b79136 | ||
|
|
ad1f706fda | ||
|
|
a8c338aa65 | ||
|
|
c326593c1a | ||
|
|
03cb8e959b | ||
|
|
d32c6512e1 | ||
|
|
c095e20ca8 | ||
|
|
9269f58477 | ||
|
|
3446a75a36 | ||
|
|
5bb29235dc | ||
|
|
719e78c78f | ||
|
|
382bc9d0e4 | ||
|
|
4d0439e487 | ||
|
|
5916b8dd04 | ||
|
|
5fd4035194 | ||
|
|
e264b8a4d3 | ||
|
|
5ec19bb68c | ||
|
|
4a6faadcce | ||
|
|
6aed41421e | ||
|
|
e5928942ac | ||
|
|
24046edbbb | ||
|
|
cbb928b8eb | ||
|
|
3e46adb183 | ||
|
|
fb57a8363e | ||
|
|
12ff2532c9 | ||
|
|
62ca4594f8 | ||
|
|
bddc4e6c1d | ||
|
|
d8e5ee075f | ||
|
|
e89500cdfb | ||
|
|
5a7596591f | ||
|
|
8b91c8f32e | ||
|
|
03418c1d36 | ||
|
|
5a29be9b7d | ||
|
|
d467331307 | ||
|
|
cdbf1938f2 | ||
|
|
f133b09907 | ||
|
|
fbda9ce9f4 | ||
|
|
197142b3e0 | ||
|
|
8f4112bfdd | ||
|
|
b0f1719ee5 | ||
|
|
cc50a96139 | ||
|
|
8d476ded8e | ||
|
|
e7bd6769df | ||
|
|
8ac5b549e0 | ||
|
|
0893e10ac3 | ||
|
|
33921efc44 | ||
|
|
b343aa9945 | ||
|
|
3c042299e6 | ||
|
|
eb28594aa5 | ||
|
|
a218299d6a | ||
|
|
e6566d9477 | ||
|
|
1017c44f4a | ||
|
|
a03039bade | ||
|
|
d18cdaf6dd | ||
|
|
709f73aea7 | ||
|
|
646500bfe9 | ||
|
|
1e0494a714 | ||
|
|
001f506533 | ||
|
|
4c8afd895a | ||
|
|
7e2bccf776 | ||
|
|
491674bea6 | ||
|
|
c47fb30b5b | ||
|
|
81b8096ea8 | ||
|
|
3fbee80f35 | ||
|
|
428006f54d | ||
|
|
d67821cd02 | ||
|
|
f4371b9cc6 | ||
|
|
4acffedc6b | ||
|
|
cd90395cb6 | ||
|
|
49678f0908 | ||
|
|
25a82d8a5c | ||
|
|
67f27b0aef | ||
|
|
305e946358 | ||
|
|
2580744813 | ||
|
|
2bc716c131 | ||
|
|
0615bf6cb4 | ||
|
|
855f7dfd95 | ||
|
|
28a0aef13e | ||
|
|
c0ec353655 | ||
|
|
ea4734926e | ||
|
|
cc034dcb38 | ||
|
|
ad73bdcbe0 | ||
|
|
bb8e5de181 | ||
|
|
631da59b50 | ||
|
|
062626d03e | ||
|
|
a5cea052e8 | ||
|
|
44205dc58a | ||
|
|
9d79a201f1 | ||
|
|
c61c3dd422 | ||
|
|
a5fe9808aa | ||
|
|
df71093dd8 | ||
|
|
58a0906bf9 | ||
|
|
8152c64c02 | ||
|
|
410e106aae | ||
|
|
3019a1c6a3 | ||
|
|
b94970a3bd | ||
|
|
eef799a6ec | ||
|
|
c797466259 | ||
|
|
ad28ef81c0 | ||
|
|
d41c6dc6d6 | ||
|
|
45794ee259 | ||
|
|
656f02fada | ||
|
|
036f28f115 | ||
|
|
60d70459f3 | ||
|
|
b551a55bca | ||
|
|
b1d0f9bb43 | ||
|
|
0fefec1a35 | ||
|
|
e403b15ebb | ||
|
|
412a28d124 | ||
|
|
24af08eb80 | ||
|
|
91682f88e4 | ||
|
|
a8c5828ce0 | ||
|
|
de03dd6387 | ||
|
|
bc81f55541 | ||
|
|
303a642a0d | ||
|
|
5dd9ad8f53 | ||
|
|
5ef3e0c57b | ||
|
|
94238838cf | ||
|
|
11f0ff9c1a | ||
|
|
7357ac0b96 | ||
|
|
e3c8bd51de | ||
|
|
470da4e960 | ||
|
|
5e46f636a5 | ||
|
|
faf80a4035 | ||
|
|
1f7c9e197c | ||
|
|
6df3e40977 | ||
|
|
2cbe63513c | ||
|
|
e011229598 | ||
|
|
969f05a709 | ||
|
|
595ee08653 | ||
|
|
6b0de601be | ||
|
|
d8bb2766a8 | ||
|
|
fa3394eccb | ||
|
|
dec65f584b | ||
|
|
abe0e61801 | ||
|
|
35c82a75eb | ||
|
|
e58513c4d0 | ||
|
|
71bd44ac02 | ||
|
|
d3dc0a39bc | ||
|
|
e1791bedd5 | ||
|
|
6eaf1671b5 | ||
|
|
f42742f796 | ||
|
|
cb83e27b02 | ||
|
|
93ffc14028 | ||
|
|
b33c2d9b17 | ||
|
|
8a929e054e | ||
|
|
b29b16af2e | ||
|
|
3ced246dfc | ||
|
|
3282497f82 | ||
|
|
bcf354a97a | ||
|
|
3abc925a8a | ||
|
|
e1661efced | ||
|
|
1f6debba12 | ||
|
|
33a91ad309 | ||
|
|
c3678550a3 | ||
|
|
6cbe6d7d52 | ||
|
|
f2ed06347b | ||
|
|
1b8ecbcf54 | ||
|
|
e0e9b5ac39 | ||
|
|
3d8dc4d3b1 | ||
|
|
0a50368580 | ||
|
|
4d631ec31b | ||
|
|
6df490d0ca | ||
|
|
262cbbe8d0 | ||
|
|
ffe605f2ed | ||
|
|
1c667a88e7 | ||
|
|
061ff97f69 | ||
|
|
308a64bc08 | ||
|
|
42728f947c | ||
|
|
0a2e6f723e | ||
|
|
8a5bd01a44 | ||
|
|
31f8d7dc20 | ||
|
|
48d9adc3f0 | ||
|
|
e117d540d1 | ||
|
|
afccca77dd | ||
|
|
d09fbaa495 | ||
|
|
184309c2e9 | ||
|
|
594fd87ca7 | ||
|
|
728acc3785 | ||
|
|
9a0bed9863 | ||
|
|
612dab64ee | ||
|
|
b76dcd68ee | ||
|
|
a750f195cd | ||
|
|
991a29cfd6 | ||
|
|
ca9dd7d826 | ||
|
|
0ea0e1615f | ||
|
|
224e1f50ae | ||
|
|
6333f71ea3 | ||
|
|
c19322869b | ||
|
|
ba3862b369 | ||
|
|
13dc73940d | ||
|
|
69722777a0 | ||
|
|
08b5c498ce | ||
|
|
932346c00f | ||
|
|
56f006a998 | ||
|
|
4c4b955dce | ||
|
|
655743c4e7 | ||
|
|
91e31d0243 | ||
|
|
dfc8044098 | ||
|
|
69f0675a35 | ||
|
|
b47525e508 | ||
|
|
941ac55d2f | ||
|
|
09540ee965 | ||
|
|
e2599c3dbf | ||
|
|
1a04335ec2 | ||
|
|
ba5f66777e | ||
|
|
386a3b9305 | ||
|
|
4329db25a1 | ||
|
|
72857b6dbb | ||
|
|
c0cb5a83bf | ||
|
|
006922ba18 | ||
|
|
ef04eea493 | ||
|
|
846b0826ab | ||
|
|
15c9f414a6 | ||
|
|
c508b5e66a | ||
|
|
9daaedc125 | ||
|
|
049882f29c | ||
|
|
f4a15e4fb8 | ||
|
|
d696f11814 | ||
|
|
57641c166f | ||
|
|
fdd42afa6c | ||
|
|
fab0baa274 | ||
|
|
06550ce8e0 | ||
|
|
2352850c52 | ||
|
|
1536082186 | ||
|
|
a349428685 | ||
|
|
4fb5b322ee | ||
|
|
3905ce46d9 | ||
|
|
4f7d14f8d9 | ||
|
|
6cc5e191d0 | ||
|
|
0d9bc3a679 | ||
|
|
ba8a8d9f25 | ||
|
|
4566f48777 | ||
|
|
c81c189198 | ||
|
|
a952406eb3 | ||
|
|
35b7ad00a6 | ||
|
|
6cf5be04d6 | ||
|
|
a3a2fe37af | ||
|
|
09f0161160 | ||
|
|
e3a1bf1e62 | ||
|
|
5ece2f6369 | ||
|
|
d38a901189 | ||
|
|
5337c02684 | ||
|
|
b5017bd725 | ||
|
|
d6c7d9630b | ||
|
|
0dce979bfc | ||
|
|
eef28dacec | ||
|
|
8524b33feb | ||
|
|
f8e8c5534b | ||
|
|
0823526afe | ||
|
|
f0c27e68b2 | ||
|
|
cd63787e9a | ||
|
|
8bba75f0f8 | ||
|
|
f3c44f6065 | ||
|
|
a72a517e2f | ||
|
|
0988162649 | ||
|
|
3d41ebf595 | ||
|
|
20c3266588 | ||
|
|
999a7acd71 | ||
|
|
967413c58c | ||
|
|
5e33a09f20 | ||
|
|
a51fc50b6e | ||
|
|
ddf3f9b068 | ||
|
|
529263d680 | ||
|
|
de6b4c0091 | ||
|
|
4dff36f6b4 | ||
|
|
bcb70109d2 | ||
|
|
462940cbb0 | ||
|
|
08a6122f54 | ||
|
|
fe9db9ab0a | ||
|
|
bfe844e41e | ||
|
|
9986219353 | ||
|
|
33d913d9da | ||
|
|
5eb6b78c90 | ||
|
|
e26ae04d5f | ||
|
|
9d3ac92729 | ||
|
|
0ce7487110 | ||
|
|
46488c8bb4 | ||
|
|
116584297a | ||
|
|
9a1c6c55b8 | ||
|
|
c3a79b5990 | ||
|
|
8acd34d6d8 | ||
|
|
d1ee4b407c | ||
|
|
7d918fae4c | ||
|
|
7e762989e7 | ||
|
|
87071cf1d6 | ||
|
|
3eb6167902 | ||
|
|
21e809b7be | ||
|
|
3fd2e85458 | ||
|
|
4b9b5505f0 | ||
|
|
f43767b249 | ||
|
|
27763b3666 | ||
|
|
e4a4ab60c7 | ||
|
|
8cf678c306 | ||
|
|
1bf64add7b | ||
|
|
595e93be27 | ||
|
|
69edc17192 | ||
|
|
ae281c372a | ||
|
|
7199bc5f86 | ||
|
|
c0ffebcee6 | ||
|
|
eb7e9b6bfc | ||
|
|
5ca5efcdda | ||
|
|
ca8596ab83 | ||
|
|
3fab7a3ed6 | ||
|
|
a29501195f | ||
|
|
b4dd030782 | ||
|
|
a5f0cbed44 | ||
|
|
650b76e542 | ||
|
|
d5809b85f9 | ||
|
|
dc929d011c | ||
|
|
766e4b3c15 | ||
|
|
bab59278d7 | ||
|
|
c221e148d7 | ||
|
|
d3f03cc468 | ||
|
|
bd7a277d48 | ||
|
|
196e54fc43 | ||
|
|
09f89c8cb0 | ||
|
|
2a7bd2b823 | ||
|
|
9d1f2f30d3 | ||
|
|
9a74c68a4c | ||
|
|
21698c12fe | ||
|
|
90236679e9 | ||
|
|
5682438549 | ||
|
|
8dc3e7b147 | ||
|
|
9e9f413aeb | ||
|
|
af01525d1e | ||
|
|
be945f9fe2 | ||
|
|
81151a5dbf | ||
|
|
497c7714e6 | ||
|
|
77d3a41f8a | ||
|
|
1e37cc7b82 | ||
|
|
a55c4799aa | ||
|
|
e53f6428ac | ||
|
|
f4007c8f6b | ||
|
|
edc39221c0 | ||
|
|
5f47b4178e | ||
|
|
e9c81e4983 | ||
|
|
9c252b4b07 | ||
|
|
2d16ed7706 | ||
|
|
efe24c0205 | ||
|
|
6b0d0f7ceb | ||
|
|
7262ccfac9 | ||
|
|
0730fa2af9 | ||
|
|
9305339d94 | ||
|
|
26bf79a15e | ||
|
|
b5e2cc5197 | ||
|
|
06e3607102 | ||
|
|
6818826bbd | ||
|
|
25c6fbe515 | ||
|
|
42fb30298c | ||
|
|
46783871e3 | ||
|
|
6ed7a799af | ||
|
|
38a52c5b0d | ||
|
|
8a39d704c4 | ||
|
|
7f293b91b4 | ||
|
|
caa9702a5a | ||
|
|
a022e10c2d | ||
|
|
a3c168239d | ||
|
|
27df981727 | ||
|
|
020f1ba949 | ||
|
|
1ee421ff66 | ||
|
|
635d65ab4e | ||
|
|
084ab84411 | ||
|
|
222900c4b0 | ||
|
|
d1be6c8152 | ||
|
|
b6be0f9817 | ||
|
|
60b1f64cc7 | ||
|
|
4e1b287b82 | ||
|
|
38317bb3bd | ||
|
|
6bc126681c | ||
|
|
bd30309d65 | ||
|
|
0eabbc9f89 | ||
|
|
a8355965bb | ||
|
|
2b32ff53cd | ||
|
|
abcfcd3f2e | ||
|
|
1890173d8c | ||
|
|
8c4d1f6657 | ||
|
|
bb35f045df | ||
|
|
00566c3949 | ||
|
|
321732227f | ||
|
|
170ef60d6f | ||
|
|
96873fecef | ||
|
|
6319efa013 | ||
|
|
44840ace8e | ||
|
|
a4673bd7b7 | ||
|
|
5f8809907a | ||
|
|
64cfbf539f | ||
|
|
248c30dad7 | ||
|
|
1978e9109f | ||
|
|
41901d127c | ||
|
|
4f161fe289 | ||
|
|
7fda1750f1 | ||
|
|
9057102e6e | ||
|
|
e615889d6b | ||
|
|
5253ea11de | ||
|
|
40f971b5b6 | ||
|
|
248345d920 | ||
|
|
655cb3aaf7 | ||
|
|
156a899e4a | ||
|
|
28796e9aa6 | ||
|
|
ab78a63357 | ||
|
|
2ec2739c19 | ||
|
|
b08c3d880e | ||
|
|
307ec8ece4 | ||
|
|
9230473cd3 | ||
|
|
d1a4819c09 | ||
|
|
7c37c2c37e | ||
|
|
b247dc3418 | ||
|
|
43f63e4753 | ||
|
|
99baa01aac | ||
|
|
0e2491f553 | ||
|
|
cf39bec447 | ||
|
|
7230be4951 | ||
|
|
ba38b8a9c9 | ||
|
|
5fc9d15692 | ||
|
|
805ca9c51f | ||
|
|
f02aa075cb | ||
|
|
c6aae12cc1 | ||
|
|
3a21310f37 | ||
|
|
1b02f3ec31 | ||
|
|
2b53e96832 | ||
|
|
11eeb0c3ac | ||
|
|
0c4867144a | ||
|
|
5dd6467bd0 | ||
|
|
a596d53131 | ||
|
|
b842d8e3d8 | ||
|
|
980b9be4b4 | ||
|
|
293beeb74a | ||
|
|
2e4c7dbb03 | ||
|
|
ce6abe492c | ||
|
|
4f89b2e0cb | ||
|
|
d3326d5b26 | ||
|
|
30b14ee8e9 | ||
|
|
e96c51a175 | ||
|
|
164b4ad4dd | ||
|
|
da4096c210 | ||
|
|
19dc0411f7 | ||
|
|
9e0ed1cb67 | ||
|
|
82d8cfb681 | ||
|
|
31dcd92f46 | ||
|
|
ae8a3a0f9e | ||
|
|
de247c88cd | ||
|
|
e5c570997e | ||
|
|
b8cc3a9c32 | ||
|
|
33df597531 | ||
|
|
daa209297d | ||
|
|
f4eb5095a6 | ||
|
|
f7ef84c32d | ||
|
|
b31ff96be9 | ||
|
|
3b329a9926 | ||
|
|
4e798f6e02 | ||
|
|
9477097564 | ||
|
|
75d362225c | ||
|
|
286d53397a | ||
|
|
a23aec662c | ||
|
|
e134382a71 | ||
|
|
94c7fd0603 | ||
|
|
1dd48ca039 | ||
|
|
f286018dd0 | ||
|
|
617716b171 | ||
|
|
690f2ab5ed | ||
|
|
976edd47e2 | ||
|
|
5516735c88 | ||
|
|
cf1b4cf673 | ||
|
|
e8b05734be | ||
|
|
5610ad29e3 | ||
|
|
23d4f9882f | ||
|
|
ca24e21972 | ||
|
|
2c6d0f8c48 | ||
|
|
496bc9fce3 | ||
|
|
d327027ea9 | ||
|
|
81b6d3e725 | ||
|
|
9711fbace9 | ||
|
|
a47eec0754 | ||
|
|
8bdc4285aa | ||
|
|
bbd37d99e1 | ||
|
|
0d993d2172 | ||
|
|
812c1e0475 | ||
|
|
e46cd60d89 | ||
|
|
a0d479994f | ||
|
|
b31f168184 | ||
|
|
54df2c9d36 | ||
|
|
4ddaf76efc | ||
|
|
417f113940 | ||
|
|
0941045fcc | ||
|
|
e274f52bbf | ||
|
|
2f594ec2b3 | ||
|
|
6c87db9e99 | ||
|
|
974adb419a | ||
|
|
565c7708ca | ||
|
|
256e6e3350 | ||
|
|
c792839d8f | ||
|
|
9aa81a786b | ||
|
|
ba8cfb4a93 | ||
|
|
2a37a0c495 | ||
|
|
daba35fead | ||
|
|
ebd4ab4d78 | ||
|
|
779e6d203e | ||
|
|
3bc9bc5de8 | ||
|
|
54931f5259 | ||
|
|
96d755978c | ||
|
|
f0f1557998 | ||
|
|
1a29376c07 | ||
|
|
995c3002aa | ||
|
|
1c7eb15eea | ||
|
|
d55f456497 | ||
|
|
96dfe589fe | ||
|
|
eeecc8a015 | ||
|
|
01d8e59d3b | ||
|
|
4571221d8e |
No files matched your search
+1
-1
@@ -452,7 +452,7 @@ STATUS: Working
|
||||
EXTENSION: pspell
|
||||
PRIMARY MAINTAINER: Vlad Krupin <phpdevel@echospace.com>
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
STATUS: Working
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: readline
|
||||
|
||||
+4
-4
@@ -7,17 +7,17 @@ $(builddir)/zend_language_scanner.lo: $(builddir)/zend_language_parser.h
|
||||
$(builddir)/zend_ini_scanner.lo: $(builddir)/zend_ini_parser.h
|
||||
|
||||
$(builddir)/zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
|
||||
$(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
|
||||
@$(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
|
||||
|
||||
$(builddir)/zend_language_parser.h: $(builddir)/zend_language_parser.c
|
||||
$(builddir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
|
||||
$(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o $@
|
||||
@$(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o $@
|
||||
|
||||
$(builddir)/zend_ini_parser.h: $(builddir)/zend_ini_parser.c
|
||||
$(builddir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
|
||||
$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
|
||||
@$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
|
||||
|
||||
$(builddir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
|
||||
$(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
|
||||
@$(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
|
||||
|
||||
$(builddir)/zend_indent.lo $(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(builddir)/zend_language_parser.h
|
||||
+2
-2
@@ -48,12 +48,12 @@ install-modules: build-modules
|
||||
install-su: install-pear
|
||||
|
||||
test: all
|
||||
-@if test ! -z $(PHP_EXECUTABLE) && test -x $(PHP_EXECUTABLE); then \
|
||||
-@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
|
||||
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
|
||||
TEST_PHP_SRCDIR=$(top_srcdir) \
|
||||
CC="$(CC)" \
|
||||
$(PHP_EXECUTABLE) -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' -d 'memory_limit=-1' $(top_srcdir)/run-tests.php -d 'extension_dir=modules/' -d `( . $(PHP_MODULES) ; echo extension=$$dlname)` tests/; \
|
||||
elif test ! -z $(SAPI_CLI_PATH) && test -x $(SAPI_CLI_PATH); then \
|
||||
elif test ! -z "$(SAPI_CLI_PATH)" && test -x "$(SAPI_CLI_PATH)"; then \
|
||||
TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
|
||||
TEST_PHP_SRCDIR=$(top_srcdir) \
|
||||
CC="$(CC)" \
|
||||
|
||||
@@ -1,26 +1,215 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2005, PHP 5.1
|
||||
- Updated bundled libraries in Windows distribution. (Edin)
|
||||
?? Nov 2005, PHP 5.1
|
||||
|
||||
28 Oct 2005, PHP 5.1 Release Candidate 4
|
||||
- Fixed fgetcsv() and fputcsv() inconsistency. (Dmitry)
|
||||
- Fixed bug #34996 (ImageTrueColorToPalette() crashes when ncolors is
|
||||
zero). (Tony)
|
||||
- Fixed bug #34982 (array_walk_recursive() modifies elements outside function
|
||||
scope). (Dmitry)
|
||||
- Fixed bug #34977 (Compile failure on MacOSX due to use of varargs.h). (Tony)
|
||||
- Fixed bug #34968 (bz2 extension fails on to build on some win32 setups).
|
||||
(Ilia)
|
||||
- Fixed bug #34965 (tidy is not binary safe). (Mike)
|
||||
- Fixed bug #34957 (PHP doesn't respect ACLs for access checks). (Wez)
|
||||
- Fixed bug #34950 (Unable to get WSDL through proxy). (Dmitry)
|
||||
- Fixed bug #34938 (dns_get_record() doesn't resolve long hostnames and
|
||||
leaks). (Tony)
|
||||
- Fixed bug #34905 (Digest authentication does not work with Apache 1). (Ilia)
|
||||
- Fixed bug #34902 (mysqli::character_set_name() - undefined method). (Tony)
|
||||
- Fixed bug #34893 (PHP5.1 overloading, Cannot access private property).
|
||||
(Dmitry)
|
||||
- Fixed bug #34899 (Fixed sqlite extension compile failure). (Ilia)
|
||||
- Fixed bug #34879 (str_replace, array_map corrupt negative array indexes on
|
||||
64-bit platforms). (Dmitry)
|
||||
- Fixed bug #34821 (zlib encoders fail on widely varying binary data on windows)
|
||||
(Mike, Ilia)
|
||||
- Fixed bug #34782 (token_get_all() gives wrong result). (Dmitry)
|
||||
- Fixed bug #34767 (Zend Engine 1 Compatibility not copying objects correctly).
|
||||
(Dmitry)
|
||||
- Fixed bug #34725 (CLI segmentation faults during cleanup). (Dmitry)
|
||||
- Fixed bug #34712 (zend.ze1_compatibility_mode = on segfault). (Dmitry)
|
||||
- Fixed bug #34623 (Crash in pdo_mysql on longtext fields). (Ilia)
|
||||
- Fixed bug #33829 (mime_content_type() returns text/plain for gzip and bzip
|
||||
files). (Derick)
|
||||
- Fixed bug #33760 (cURL needs to implement CRYPTO_callback functions to prevent
|
||||
locking). (Mike, Ilia)
|
||||
- Fixed bug #31341 (escape on curly inconsistent). (Dmitry)
|
||||
- Fixed bug #31177 (menory leaks and corruption because of incorrect
|
||||
refcounting). (Dmitry)
|
||||
- Fixed bug #29983 (PHP does not explicitly set mime type & charset). (Ilia)
|
||||
- Fixed bug #29268 (__autoload() not called with Reflection->getClass()).
|
||||
(Dmitry)
|
||||
|
||||
17 Oct 2005, PHP 5.1 Release Candidate 3
|
||||
- Fixed bug #34884 (Possible crash in ext/sqlite when sqlite.assoc_case is
|
||||
being used). (Tony, Ilia)
|
||||
- Fixed bug #34873 (Segmentation Fault on foreach in object). (Dmitry)
|
||||
- Fixed bug #29361 (var_export() producing invalid code). (Derick)
|
||||
|
||||
14 Oct 2005, PHP 5.1 Release Candidate 2
|
||||
- Changed SQLite extension to be a shared module in Windows distribution.
|
||||
(Edin)
|
||||
- Changed "instanceof" and "catch" operators, is_a() and is_subclass_of()
|
||||
functions to not call __autoload(). (Dmitry)
|
||||
- Improved SPL extension. (Marcus)
|
||||
. Moved RecursiveArrayIterator from examples into extension
|
||||
. Moved RecursiveFilterIterator from examples into extension
|
||||
. Added SplObjectStorage
|
||||
. Made all SPL constants class constants
|
||||
. Renamed CachingRecursiveIterator to RecursiveCachingIterator to follow
|
||||
Recursive<*>Iterator naming scheme.
|
||||
- Upgraded bundled libraries:
|
||||
. PCRE library to version 6.2. (Andrei)
|
||||
. SQLite 3 library in ext/pdo_sqlite to 3.2.7. (Ilia)
|
||||
. SQLite 2 library in ext/sqlite to 2.8.16. (Ilia)
|
||||
- Upgraded bundled libraries in Windows distribution. (Edin)
|
||||
. zlib 1.2.3
|
||||
. curl 7.14.0
|
||||
. openssl 0.9.8
|
||||
. ming 0.3b
|
||||
. libpq (PostgreSQL) 8.0.1
|
||||
- Moved extensions to PECL:
|
||||
. ext/mcve (Jani, Derick, Pierre)
|
||||
. ext/oracle (Jani, Derick)
|
||||
. ext/ovrimos (Jani, Derick, Pierre)
|
||||
. ext/pfpro (Jani, Derick, Pierre)
|
||||
- Added support for class constants and static members for internal classes.
|
||||
(Dmitry, Michael Wallner)
|
||||
- Added "new_link" parameter to mssql_connect() (Bug #34369). (Frank)
|
||||
- Added missing safe_mode checks for image* functions and cURL. (Ilia)
|
||||
- Added missing safe_mode/open_basedir checks for file uploads. (Ilia)
|
||||
- Fixed an error in mysqli_fetch_fields (returned NULL instead of an
|
||||
array when row number > field_count). (Georg)
|
||||
- Fixed possible INI setting leak via virtual() in Apache 2 sapi. (Ilia)
|
||||
- Fixed potential GLOBALS overwrite via import_request_variables() and
|
||||
possible crash and/or memory corruption. (Ilia)
|
||||
- Fixed possible GLOBALS variable override when register_globals are ON.
|
||||
(Ilia, Stefan)
|
||||
- Fixed possible register_globals toggle via parse_str(). (Ilia, Stefan)
|
||||
- Fixed a bug where stream_get_meta_data() did not return the "uri" element for
|
||||
files opened with tmpname(). (Derick)
|
||||
- Fixed "make test" to work for phpized extensions. (Hartmut, Jani)
|
||||
- Fixed failing queries (FALSE returned) with mysqli_query() on 64 bit systems.
|
||||
(Andrey)
|
||||
- Fixed bug #34856 (configure fails to detect libiconv's type). (Tony)
|
||||
- Fixed bug #34855 (ibase_service_attach() segfault on AMD64).
|
||||
(irie at gmx dot de, Tony)
|
||||
- Fixed bug #34850 (--program-suffix and --program-prefix not included in
|
||||
man page names). (Jani)
|
||||
- Fixed bug #34818 (several functions crash when invalid mysqli_link object
|
||||
is passed). (Tony)
|
||||
- Fixed bug #34810 (mysqli::init() and others use wrong $this pointer
|
||||
without checks). (Tony)
|
||||
- Fixed bug #34809 (FETCH_INTO in PDO crashes without a destination object).
|
||||
(Ilia)
|
||||
- Fixed bug #34802 (Fixed crash on object instantiation failure). (Ilia)
|
||||
- Fixed bug #34796 (missing SSL linking in ext/ftp when configured as shared).
|
||||
(Jani)
|
||||
- Fixed bug #34790 (preg_match_all(), named capturing groups, variable
|
||||
assignment/return => crash). (Dmitry)
|
||||
- Fixed bug #34788 (SOAP Client not applying correct namespace to generated
|
||||
values). (Dmitry)
|
||||
- Fixed bug #34787 (SOAP Client not handling boolean types correctly). (Dmitry)
|
||||
- Fixed bug #34786 (2 @ results in change to error_reporting() to random value)
|
||||
(Dmitry, Tony)
|
||||
- Fixed bug #34785 (subclassing of mysqli_stmt does not work). (Georg)
|
||||
- Fixed bug #34777 (Crash in dblib when fetching non-existent error info). (Ilia)
|
||||
- Fixed bug #34771 (strtotime() fails with 1-12am/pm). (Derick)
|
||||
- Fixed bug #34758 (PDO_DBLIB did not implement rowCount()). (Ilia)
|
||||
- Fixed bug #34757 (iconv_substr() gives "Unknown error" when offset > string
|
||||
length). (Tony)
|
||||
- Fixed bug #34742 (ftp wrapper failures caused from segmented command
|
||||
transfer). (Ilia)
|
||||
- Fixed bug #34723 (array_count_values() strips leading zeroes). (Tony)
|
||||
- Fixed bug #34704 (Infinite recursion due to corrupt JPEG). (Marcus)
|
||||
- Fixed bug #34678 (__call(), is_callable() and static methods). (Dmitry)
|
||||
- Fixed bug #34676: missing support for strtotime("midnight") and
|
||||
strtotime("noon"). (Derick)
|
||||
- Fixed bug #34645 (ctype corrupts memory when validating large numbers). (Ilia)
|
||||
- Fixed bug #34643 (wsdl default value has no effect). (Dmitry)
|
||||
- Fixed bug #34617 (zend_deactivate: objects_store used after
|
||||
zend_objects_store_destroy is called). (Dmitry)
|
||||
- Fixed bug #34590 (User defined PDOStatement class can't implement methods).
|
||||
(Marcus)
|
||||
- Fixed bug #34584 (Segfault with SPL autoload handler). (Marcus)
|
||||
- Fixed bug #34581 (crash with mod_rewrite). (Tony, Ilia)
|
||||
- Fixed bug #34565 (mb_send_mail does not fetch mail.force_extra_parameters).
|
||||
(Marco, Ilia)
|
||||
- Fixed bug #34557 (php -m exits with "error" 1). (Johannes)
|
||||
- Fixed bug #34518 (Unset doesn't separate container in CV). (Dmitry)
|
||||
- Fixed bug #34505 (Possible memory corruption when unmangling properties
|
||||
with empty names). (Tony)
|
||||
- Fixed bug #34478 (Incorrect parsing of url's fragment (#...)). (Dmitry)
|
||||
- Fixed bug #34467 (foreach + __get + __set incosistency). (Dmitry)
|
||||
- Fixed bug #34456 (Possible crash inside pspell extension). (Ilia)
|
||||
- Fixed bug #34453 (parsing http://www.w3.org/2001/xml.xsd exception). (Dmitry)
|
||||
- Fixed bug #34450 (Segfault when calling mysqli_close() in destructor). (Tony)
|
||||
- Fixed bug #34449 (ext/soap: XSD_ANYXML functionality not exposed). (Dmitry)
|
||||
- Fixed bug #34420 (Possible crash inside curl_multi_remove_handle()). (Ilia)
|
||||
- Fixed bug #34358 (Fatal error: Cannot re-assign $this). (Dmitry)
|
||||
- Fixed bug #34331 (php crashes when variables_order is empty). (Ilia)
|
||||
- Fixed bug #34321 (Possible crash in filter code). (Ilia)
|
||||
- Fixed bug #34311 (unserialize() crashes with chars above 191 dec). (Nuno)
|
||||
- Fixed bug #34310 (foreach($arr as $c->d => $x) crashes). (Dmitry)
|
||||
- Fixed bug #34307 (on_modify handler not called to set the default value if
|
||||
setting from php.ini was invalid). (Andrei)
|
||||
- Fixed bug #34306 (wddx_serialize_value() crashes with long array keys). (Jani)
|
||||
- Fixed bug #34304 (date() doesn't have a modifier for ISO Week Day). (Derick)
|
||||
- Fixed bug #34302 (date('W') do not return leading zeros for week 1 to 9).
|
||||
(Derick)
|
||||
- Fixed bug #34299 (ReflectionClass::isInstantiable() returns true for abstract
|
||||
classes). (Marcus)
|
||||
- Fixed bug #34284 (CLI phpinfo showing html on _SERVER["argv"]). (Jani)
|
||||
- Fixed bug #34277 (array_filter() crashes with references and objects).
|
||||
(Dmitry)
|
||||
- Fixed bug #34276 (setAttributeNS doesn't work with default namespace). (Rob)
|
||||
- Fixed bug #34260 (Segfault with callbacks (array_map) + overloading).
|
||||
(Dmitry)
|
||||
- Fixed bug #34257 (lib64 not handled correctly in ming extension). (Marcus)
|
||||
- Fixed bug #34221 (Compiling xmlrpc as shared fails other parts). (Jani)
|
||||
- Fixed bug #34216 (Segfault with autoload). (Marcus)
|
||||
- Fixed bug #34199 (if($obj)/if(!$obj) inconsistency because of cast handler).
|
||||
(Dmitry, Alex)
|
||||
- Fixed bug #34191 (ob_gzhandler does not enforce trailing \0). (Ilia)
|
||||
- Fixed bug #33167 (Possible crash inside pg_fetch_array()). (Ilia)
|
||||
- Fixed bug #34156 (memory usage remains elevated after memory limit is
|
||||
reached). (Ilia)
|
||||
- Fixed bug #34148 (+,- and . not supported as parts of scheme). (Ilia)
|
||||
- Fixed bug #34137 (assigning array element by reference causes binary mess).
|
||||
(Dmitry)
|
||||
- Fixed bug #34103 (line numbering not maintained in dom document). (Rob)
|
||||
- Fixed bug #34078 (Reflection API problems in methods with boolean or
|
||||
null default values). (Tony)
|
||||
- Fixed bug #34068 (Numeric string as array key not cast to integer in
|
||||
wddx_deserialize()). (Ilia)
|
||||
- Fixed bug #34064 (arr[] as param to function in class gives invalid opcode).
|
||||
(Dmitry)
|
||||
- Fixed bug #34062 (Crash in catch block when many arguments are used).
|
||||
(Dmitry)
|
||||
- Fixed bug #34052 (date('U') returns %ld not unix timestamp). (Nuno)
|
||||
- Fixed bug #34045 (Buffer overflow with serialized object). (Dmitry)
|
||||
- Fixed bug #34001 (pdo_mysql truncates numberic fields at 4 chars). (Ilia)
|
||||
- Fixed bug #33999 (object remains object when cast to int). (Dmitry)
|
||||
- Fixed bug #33996 (No information given for fatal error on passing invalid
|
||||
value to typed argument). (Dmitry)
|
||||
- Fixed bug #33989 (extract($GLOBALS,EXTR_REFS) crashes PHP). (Dmitry)
|
||||
- Fixed bug #33987 (php script as ErrorDocument causes crash in Apache 2).
|
||||
(Ilia)
|
||||
- Fixed bug #33967 (misuse of Exception constructor doesn't display errorfile).
|
||||
(Jani)
|
||||
- Fixed bug #33966 (Wrong use of reflectionproperty causes a segfault). (Tony)
|
||||
- Fixed bug #33958 (duplicate cookies and magic_quotes=off may cause a crash).
|
||||
(Ilia)
|
||||
- Fixed bug #33957 (gmdate('W')/date('W') sometimes returns wrong week number).
|
||||
(Derick)
|
||||
- Fixed bug #33940 (array_map() fails to pass by reference when called
|
||||
recursively). (Dmitry)
|
||||
- Fixed bug #33917 (number_format() output with > 1 char separators). (Jani)
|
||||
- Fixed bug #33904 (input array keys being escaped when magic quotes is off).
|
||||
(Ilia)
|
||||
- Fixed bug #33903 (spl_autoload_register class method). (Marcus)
|
||||
- Fixed bug #33899 (CLI: setting extension_dir=some/path extension=foobar.so
|
||||
does not work). (Jani)
|
||||
- Fixed bug #33882 (CLI was looking for php.ini in wrong path). (Hartmut)
|
||||
@@ -29,15 +218,35 @@ PHP NEWS
|
||||
on execution of prepared statments). (Ilia)
|
||||
- Fixed bug #33837 (Informix ESQL version numbering schema changed). (Jani)
|
||||
- Fixed bug #33802 (throw Exception in error handler causes crash). (Dmitry)
|
||||
- Fixed bug #33771 (error_reporting falls to 0 when @ was used inside
|
||||
try/catch block). (Tony)
|
||||
- Fixed bug #33723 (php_value overrides php_admin_value). (Dmitry)
|
||||
- Fixed bug #33710 (ArrayAccess objects doen't initialize $this). (Dmitry)
|
||||
- Fixed bug #33690 (Crash setting some ini directives in httpd.conf). (Rasmus)
|
||||
- Fixed bug #33578 (strtotime() problem with "Oct17" format). (Derick)
|
||||
- Fixed bug #33558 (warning with nested calls to functions returning by
|
||||
reference). (Dmitry)
|
||||
- Fixed bug #33414 (Comprehensive list of incorrect days returned after
|
||||
strtotime() / date() tests). (Derick)
|
||||
- Fixed bug #33383 (crash when retrieving empty LOBs). (Tony)
|
||||
- Fixed bug #33326 (Cannot build extensions with phpize on Macosx). (Jani)
|
||||
- Fixed bug #33125 (imagecopymergegray() produces mosaic rainbow effect).
|
||||
(Pierre)
|
||||
- Fixed bug #32981 (ReflectionMethod::getStaticVariables() causes apache2.0.54
|
||||
seg fault). (Dmitry)
|
||||
- Fixed bug #32937 (open_basedir looses trailing / in the limiter). (Adam Conrad)
|
||||
- Fixed bug #32589 (possible crash inside imap_mail_compose() function). (Ilia)
|
||||
- Fixed bug #32455 (wrong setting property to unset value). (Dmitry)
|
||||
- Fixed bug #32179 (xmlrpc_encode() segfaults with recursive references). (Tony)
|
||||
- Fixed bug #32139 (SOAP client does not auto-handle base64 encoding). (Ilia)
|
||||
- Fixed bug #32010 (Memory leak in mssql_fetch_batch). (fmk)
|
||||
- Fixed bug #29334 (win32 mail() provides incorrect Date: header). (Jani)
|
||||
- Fixed bug #29253 (array_diff with $GLOBALS argument fails). (Dmitry)
|
||||
- Fixed bug #27908 (xml default_handlers not being called). (Rob)
|
||||
- Fixed bug #25359 (array_multisort() doesn't work in a function if array is
|
||||
global or reference). (Dmitry)
|
||||
- Fixed bug #21306 (ext/sesssion: catch bailouts of write handler during
|
||||
RSHUTDOWN). (Jani, Xuefer at 21cn dot com)
|
||||
|
||||
14 Jul 2005, PHP 5.1 Beta 3
|
||||
- Upgraded bundled SQLite library for PDO:SQLite to 3.2.2 (Ilia)
|
||||
@@ -261,7 +470,6 @@ PHP NEWS
|
||||
- Added MDTM support to ftp_url_stat. (Sara)
|
||||
- Added zlib stream filter support. (Sara)
|
||||
- Added bz2 stream filter support. (Sara)
|
||||
- Added HTTP/1.1 and chunked encoding support to http:// wrapper. (Sara)
|
||||
- Added max_redirects context option that specifies how many HTTP
|
||||
redirects to follow. (Ilia)
|
||||
- Added support of parameter=>value arrays to xsl_xsltprocessor_set_parameter().
|
||||
|
||||
@@ -64,14 +64,6 @@ documentation
|
||||
* Add developer documentation.
|
||||
* Add detailed documentation for Java extension.
|
||||
|
||||
ext/bz2
|
||||
-------
|
||||
* Add an ini directive to specify the size of decompression buffer.
|
||||
The default 4k is too small for large files and also requires much time
|
||||
for decompression. 40k is suitable for such files, however it may be too
|
||||
much under certain environments. There should be appropriate default
|
||||
settings for the various SAPI modules (e.g. apache and cli).
|
||||
|
||||
ext/curl
|
||||
--------
|
||||
* Have a warning scheme for when people use unsupported features.
|
||||
|
||||
@@ -430,7 +430,6 @@ void *tsrm_new_interpreter_context(void)
|
||||
|
||||
current = tsrm_tls_get();
|
||||
|
||||
new_ctx = malloc(sizeof(*new_ctx));
|
||||
allocate_new_resource(&new_ctx, thread_id);
|
||||
|
||||
/* switch back to the context that was in use prior to our creation
|
||||
|
||||
+13
-10
@@ -9,23 +9,26 @@ AC_DEFUN([LIBZEND_BISON_CHECK],[
|
||||
# for standalone build of Zend Engine
|
||||
test -z "$SED" && SED=sed
|
||||
|
||||
bison_version=none
|
||||
if test "$YACC"; then
|
||||
AC_CACHE_CHECK([for bison version], php_cv_bison_version, [
|
||||
set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /'|tr -d a-z`
|
||||
bison_version="${1}.${2}"
|
||||
bison_version_vars=`bison --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /' | tr -d a-z`
|
||||
php_cv_bison_version=invalid
|
||||
for bison_check_version in $bison_version_list; do
|
||||
if test "$bison_version" = "$bison_check_version"; then
|
||||
php_cv_bison_version="$bison_check_version (ok)"
|
||||
fi
|
||||
done
|
||||
if test -n "$bison_version_vars"; then
|
||||
set $bison_version_vars
|
||||
bison_version="${1}.${2}"
|
||||
for bison_check_version in $bison_version_list; do
|
||||
if test "$bison_version" = "$bison_check_version"; then
|
||||
php_cv_bison_version="$bison_check_version (ok)"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
else
|
||||
bison_version=none
|
||||
fi
|
||||
case $php_cv_bison_version in
|
||||
""|invalid[)]
|
||||
bison_msg="bison versions supported for regeneration of the Zend/PHP parsers: $bison_version_list (found: $bison_version)."
|
||||
bison_msg="bison versions supported for regeneration of the Zend/PHP parsers: $bison_version_list (found: $bison_version)."
|
||||
AC_MSG_WARN([$bison_msg])
|
||||
YACC="exit 0;"
|
||||
;;
|
||||
|
||||
@@ -12,4 +12,4 @@ foo(123);
|
||||
--EXPECTF--
|
||||
3
|
||||
|
||||
Fatal error: Argument 1 must be an array, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php on line 2
|
||||
Fatal error: Argument 1 passed to foo() must be an array, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php on line 2
|
||||
@@ -39,5 +39,5 @@ echo "Done\n";
|
||||
2
|
||||
3
|
||||
Done
|
||||
test::__destruct
|
||||
test::destructor
|
||||
test::__destruct
|
||||
@@ -34,6 +34,3 @@ $c->viewMom();
|
||||
--EXPECT--
|
||||
protected method
|
||||
protected property
|
||||
--EXPECT--
|
||||
protected method
|
||||
protected property
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #31177 (menory corruption because of incorrect refcounting)
|
||||
--FILE--
|
||||
<?php
|
||||
class foo {
|
||||
function foo($n=0) {
|
||||
if($n) throw new Exception("new");
|
||||
}
|
||||
}
|
||||
$x = new foo();
|
||||
try {
|
||||
$y=$x->foo(1);
|
||||
} catch (Exception $e) {
|
||||
var_dump($x);
|
||||
}
|
||||
--EXPECT--
|
||||
object(foo)#1 (0) {
|
||||
}
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #31341 (escape on curly inconsistent)
|
||||
--FILE--
|
||||
<?php
|
||||
$a = array(
|
||||
"$ \{ ",
|
||||
" \{ $",
|
||||
" \{$ ",
|
||||
" $\{ ",
|
||||
" \$\{ ",
|
||||
" \{\$ ",
|
||||
"\$ \{ ",
|
||||
" \{ \$",
|
||||
"% \{ ");
|
||||
|
||||
foreach ($a as $v) {
|
||||
echo("'$v'\n");
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
'$ \{ '
|
||||
' \{ $'
|
||||
' {$ '
|
||||
' $\{ '
|
||||
' $\{ '
|
||||
' \{$ '
|
||||
'$ \{ '
|
||||
' \{ $'
|
||||
'% \{ '
|
||||
@@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Bug #33257 array_splice() inconsistent when passed function instead of variable
|
||||
--INI--
|
||||
error_reporting=4095
|
||||
--FILE--
|
||||
<?php
|
||||
class X {
|
||||
@@ -14,4 +16,10 @@ array_splice(X::getArr(), 1, 1);
|
||||
print_r(X::getArr());
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Only variables can be passed by reference in %sbug33257.php on line 10
|
||||
Strict Standards: Only variables should be passed by reference in %sbug33257.php on line 10
|
||||
Array
|
||||
(
|
||||
[0] => a
|
||||
[1] => b
|
||||
[2] => c
|
||||
)
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
--TEST--
|
||||
Bug #33512 (unset() overloaded properties doesn't work)
|
||||
--FILE--
|
||||
<?php
|
||||
class TheObj {
|
||||
public $RealVar1, $RealVar2, $RealVar3, $RealVar4;
|
||||
public $Var = array();
|
||||
|
||||
function __set($var, $val) {
|
||||
$this->Var[$var] = $val;
|
||||
}
|
||||
function __get($var) {
|
||||
if(isset($this->Var[$var])) return $this->Var[$var];
|
||||
else return -1;
|
||||
}
|
||||
function __unset($var) {
|
||||
unset($this->Var[$var]);
|
||||
}
|
||||
}
|
||||
|
||||
$SomeObj = new TheObj;
|
||||
|
||||
// this will fine
|
||||
$SomeObj->RealVar1 = 'somevalue';
|
||||
$SomeObj->{'RealVar2'} = 'othervalue';
|
||||
$SomeObj->{'RealVar'.(3)} = 'othervaluetoo';
|
||||
$SomeObj->{'RealVar'.'4'} = 'anothervalue';
|
||||
|
||||
// this will fine too
|
||||
$SomeObj->Virtual1 = 'somevalue';
|
||||
$SomeObj->{'Virtual2'} = 'othervalue';
|
||||
|
||||
// it's can't be used since this will encounter error
|
||||
$SomeObj->{'Virtual'.(3)} = 'othervaluetoo';
|
||||
$SomeObj->{'Virtual'.'4'} = 'anothervalue';
|
||||
|
||||
// but this will fine, ofcourse
|
||||
$SomeObj->Var['Virtual'.(3)] = 'othervaluetoo';
|
||||
$SomeObj->Var['Virtual'.'4'] = 'anothervalue';
|
||||
|
||||
|
||||
var_dump($SomeObj->RealVar1);
|
||||
print $SomeObj->{'RealVar'.(3)}."\n";
|
||||
|
||||
unset($SomeObj->RealVar1);
|
||||
unset($SomeObj->{'RealVar'.(3)});
|
||||
|
||||
//the lines below will catch by '__get' magic method since these variables are unavailable anymore
|
||||
var_dump($SomeObj->RealVar1);
|
||||
print $SomeObj->{'RealVar'.(3)}."\n";
|
||||
|
||||
// now we will try to unset these variables
|
||||
unset($SomeObj->Virtual1);
|
||||
unset($SomeObj->{'Virtual'.(3)});
|
||||
|
||||
//but, these variables are still available??? eventhough they're "unset"-ed
|
||||
print $SomeObj->Virtual1."\n";
|
||||
print $SomeObj->{'Virtual'.(3)}."\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
string(9) "somevalue"
|
||||
othervaluetoo
|
||||
int(-1)
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
bug #33771 (error_reporting falls to 0 when @ was used inside try/catch block)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
function make_exception()
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
function make_exception_and_change_err_reporting()
|
||||
{
|
||||
error_reporting(E_ALL);
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
@make_exception();
|
||||
} catch (Exception $e) {}
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
try {
|
||||
@make_exception_and_change_err_reporting();
|
||||
} catch (Exception $e) {}
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(4095)
|
||||
int(4095)
|
||||
int(2047)
|
||||
Done
|
||||
@@ -26,4 +26,4 @@ FooTest(new Foo());
|
||||
--EXPECTF--
|
||||
Warning: Missing argument 1 for NormalTest(), called in %sbug33996.php on line 17 and defined in %sbug33996.php on line 12
|
||||
Hi!
|
||||
Fatal error: Argument 1 must be an object of class Foo, called in %sbug33996.php on line 18 and defined in %sbug33996.php on line 7
|
||||
Fatal error: Argument 1 passed to FooTest() must be an object of class Foo, called in %sbug33996.php on line 18 and defined in %sbug33996.php on line 7
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #34045 (Buffer overflow with serialized object)
|
||||
--FILE--
|
||||
<?php
|
||||
class BasicSingleton
|
||||
{
|
||||
private static $instance;
|
||||
|
||||
public function __wakeup() {
|
||||
self::$instance = $this;
|
||||
}
|
||||
|
||||
public static function singleton() {
|
||||
if (!(self::$instance instanceof BasicSingleton)) {
|
||||
$c = __CLASS__;
|
||||
self::$instance = new $c;
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
}
|
||||
|
||||
$db = BasicSingleton::singleton();
|
||||
$db_str = serialize($db);
|
||||
$db2 = unserialize($db_str);
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #34062 (Crash in catch block when many arguments are used)
|
||||
--FILE--
|
||||
<?php
|
||||
function f1() { throw new Exception; }
|
||||
function f2() { echo "here\n"; }
|
||||
|
||||
try {
|
||||
// Currently it's the minimum required number of zeros
|
||||
// If you remove one, it won't crash
|
||||
max(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, f1());
|
||||
} catch (Exception $e) {
|
||||
echo "(((\n";
|
||||
f2(0, 0, 0); // Won't crash if less than 3 zeros here
|
||||
echo ")))\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
(((
|
||||
here
|
||||
)))
|
||||
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
Bug #34064 (arr[] as param to function in class gives invalid opcode)
|
||||
--FILE--
|
||||
<?php
|
||||
class XmlTest {
|
||||
|
||||
function test_ref(&$test)
|
||||
{
|
||||
$test = "ok";
|
||||
}
|
||||
|
||||
function test($test)
|
||||
{
|
||||
}
|
||||
|
||||
function run()
|
||||
{
|
||||
$ar = array();
|
||||
$this->test_ref($ar[]);
|
||||
var_dump($ar);
|
||||
$this->test($ar[]);
|
||||
}
|
||||
}
|
||||
|
||||
$o = new XmlTest();
|
||||
$o->run();
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(2) "ok"
|
||||
}
|
||||
|
||||
Fatal error: Cannot use [] for reading in %sbug34064.php on line 18
|
||||
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Bug #34137 (assigning array element by reference causes binary mess)
|
||||
--FILE--
|
||||
<?php
|
||||
$arr1 = array('a1' => array('alfa' => 'ok'));
|
||||
$arr1 =& $arr1['a1'];
|
||||
echo '-'.$arr1['alfa']."-\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
-ok-
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #34199 (if($obj)/if(!$obj) inconsistency because of cast handler)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xml = "<root></root>";
|
||||
$xml = simplexml_load_string($xml);
|
||||
$kids = $xml->children();
|
||||
var_dump((bool)$kids);
|
||||
if($kids) echo "bug\n"; else echo "ok\n";
|
||||
if(!$kids) echo "ok\n"; else echo "bug\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
ok
|
||||
ok
|
||||
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Bug #34260 (Segfault with callbacks (array_map) + overloading)
|
||||
--FILE--
|
||||
<?php
|
||||
class Faulty
|
||||
{
|
||||
function __call($Method,$Args)
|
||||
{
|
||||
switch($Method)
|
||||
{
|
||||
case 'seg':
|
||||
echo "I hate me\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function NormalMethod($Args)
|
||||
{
|
||||
echo "I heart me\n";
|
||||
}
|
||||
}
|
||||
|
||||
$Faulty = new Faulty();
|
||||
$Array = array('Some junk','Some other junk');
|
||||
|
||||
// This causes a seg fault.
|
||||
$Failure = array_map(array($Faulty,'seg'),$Array);
|
||||
|
||||
// This does not.
|
||||
$Failure = array_map(array($Faulty,'NormalMethod'),$Array);
|
||||
?>
|
||||
--EXPECT--
|
||||
I hate me
|
||||
I hate me
|
||||
I heart me
|
||||
I heart me
|
||||
@@ -0,0 +1,34 @@
|
||||
--TEST--
|
||||
Bug #34310 (foreach($arr as $c->d => $x) crashes)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C
|
||||
{
|
||||
public $d;
|
||||
}
|
||||
|
||||
$c = new C();
|
||||
|
||||
$arr = array (1 => 'a', 2 => 'b', 3 => 'c');
|
||||
|
||||
// Works fine:
|
||||
foreach($arr as $x => $c->d)
|
||||
{
|
||||
echo "{$x} => {$c->d}\n";
|
||||
}
|
||||
|
||||
// Crashes:
|
||||
foreach($arr as $c->d => $x)
|
||||
{
|
||||
echo "{$c->d} => {$x}\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
1 => a
|
||||
2 => b
|
||||
3 => c
|
||||
1 => a
|
||||
2 => b
|
||||
3 => c
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #34358 (Fatal error: Cannot re-assign $this(again))
|
||||
--FILE--
|
||||
<?php
|
||||
class foo {
|
||||
function bar() {
|
||||
$ref = &$this;
|
||||
}
|
||||
}
|
||||
$x = new foo();
|
||||
$x->bar();
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #34467 (foreach + __get + __set incosistency)
|
||||
--FILE--
|
||||
<?php
|
||||
class abc {
|
||||
private $arr;
|
||||
|
||||
function __set ($key, $value) {
|
||||
$this->arr[$key] = $value;
|
||||
}
|
||||
|
||||
function __get ($key) {
|
||||
return $this->arr[$key];
|
||||
}
|
||||
}
|
||||
$abc = new abc();
|
||||
foreach (array (1,2,3) as $abc->k => $abc->v) {
|
||||
var_dump($abc->k,$abc->v);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
int(1)
|
||||
int(1)
|
||||
int(2)
|
||||
int(2)
|
||||
int(3)
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Bug #34518 (Unset doesn't separate container in CV)
|
||||
--FILE--
|
||||
<?php
|
||||
$arr = array(1,2,3);
|
||||
$arr["foo"] = array(4,5,6);
|
||||
$copy = $arr;
|
||||
|
||||
unset($copy["foo"][0]);
|
||||
print_r($arr);
|
||||
print_r($copy);
|
||||
?>
|
||||
--EXPECT--
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[1] => 2
|
||||
[2] => 3
|
||||
[foo] => Array
|
||||
(
|
||||
[0] => 4
|
||||
[1] => 5
|
||||
[2] => 6
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[1] => 2
|
||||
[2] => 3
|
||||
[foo] => Array
|
||||
(
|
||||
[1] => 5
|
||||
[2] => 6
|
||||
)
|
||||
|
||||
)
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #34617 (zend_deactivate: objects_store used after zend_objects_store_destroy is called)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("xml")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
class Thing {}
|
||||
function boom()
|
||||
{
|
||||
$reader = xml_parser_create();
|
||||
xml_set_object($reader, new Thing());
|
||||
die("ok\n");
|
||||
xml_parser_free($reader);
|
||||
}
|
||||
boom();
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #34678 (__call(), is_callable() and static methods)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
public function __call($m, $a) {
|
||||
echo "__call\n";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
public static function foo() {
|
||||
echo "foo\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (is_callable(array('B', 'foo'))) {
|
||||
call_user_func(array('B', 'foo'));
|
||||
}
|
||||
if (is_callable(array('A', 'foo'))) {
|
||||
call_user_func(array('A', 'foo'));
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
foo
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #34712 zend.ze1_compatibility_mode = on segfault
|
||||
--INI--
|
||||
zend.ze1_compatibility_mode=1
|
||||
error_reporting=4095
|
||||
--FILE--
|
||||
<?php
|
||||
class foo {
|
||||
function foo(&$obj_ref) {
|
||||
$this->bar = &$obj_ref;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class bar {
|
||||
function bar() {
|
||||
$this->foo = new foo($this);
|
||||
}
|
||||
}
|
||||
|
||||
$test = new bar;
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Strict Standards: Implicit cloning object of class 'foo' because of 'zend.ze1_compatibility_mode' in %sbug34712.php on line 11
|
||||
|
||||
Strict Standards: Implicit cloning object of class 'bar' because of 'zend.ze1_compatibility_mode' in %sbug34712.php on line 15
|
||||
ok
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Bug #34767 (Zend Engine 1 Compatibility not copying objects correctly)
|
||||
--INI--
|
||||
zend.ze1_compatibility_mode=1
|
||||
error_reporting=4095
|
||||
--FILE--
|
||||
<?php
|
||||
$a->y = &new stdClass();
|
||||
print_r($a);
|
||||
$b = $a;
|
||||
$a->y->z = 1;
|
||||
print_r($b);
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Strict Standards: Assigning the return value of new by reference is deprecated in %sbug34767.php on line 2
|
||||
stdClass Object
|
||||
(
|
||||
[y] => stdClass Object
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug34767.php on line 4
|
||||
stdClass Object
|
||||
(
|
||||
[y] => stdClass Object
|
||||
(
|
||||
[z] => 1
|
||||
)
|
||||
|
||||
)
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #34786 (2 @ results in change to error_reporting() to random value)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo($a,$b,$c) {
|
||||
echo "foo: ".error_reporting()."\n";
|
||||
}
|
||||
|
||||
function bar() {
|
||||
echo "bar: ".error_reporting()."\n";
|
||||
}
|
||||
|
||||
error_reporting(1);
|
||||
echo "before: ".error_reporting()."\n";
|
||||
@foo(1,@bar(),3);
|
||||
echo "after: ".error_reporting()."\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
before: 1
|
||||
bar: 0
|
||||
foo: 0
|
||||
after: 1
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
bug #34873 (Segmentation Fault on foreach in object)
|
||||
--FILE--
|
||||
<?php
|
||||
class pwa {
|
||||
public $var;
|
||||
|
||||
function __construct(){
|
||||
$this->var = array();
|
||||
}
|
||||
|
||||
function test (){
|
||||
$cont = array();
|
||||
$cont["mykey"] = "myvalue";
|
||||
|
||||
foreach ($cont as $this->var['key'] => $this->var['value'])
|
||||
var_dump($this->var['value']);
|
||||
}
|
||||
}
|
||||
$myPwa = new Pwa();
|
||||
$myPwa->test();
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
string(7) "myvalue"
|
||||
Done
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #34879 (str_replace, array_map corrupt negative array indexes on 64-bit platforms)
|
||||
--FILE--
|
||||
<?php
|
||||
print_r(str_replace('a', 'b', array(-1 =>-1)));
|
||||
?>
|
||||
--EXPECT--
|
||||
Array
|
||||
(
|
||||
[-1] => -1
|
||||
)
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Bug #34893 (PHP5.1 overloading, Cannot access private property)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
private $p;
|
||||
function __get($name){
|
||||
return $this->$name;
|
||||
}
|
||||
function __set($name, $value) {
|
||||
$this->$name = $value;
|
||||
}
|
||||
}
|
||||
class B {
|
||||
private $t;
|
||||
function __get($name){
|
||||
return $this->$name;
|
||||
}
|
||||
function __set($name, $value) {
|
||||
$this->$name = $value;
|
||||
}
|
||||
}
|
||||
$a = new A;
|
||||
$b = new B;
|
||||
$a->p = $b;
|
||||
$b->t = "foo";
|
||||
|
||||
echo $a->p->t;
|
||||
$a->p->t = "bar";
|
||||
echo $a->p->t;
|
||||
?>
|
||||
--EXPECT--
|
||||
foobar
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
catch shouldn't call __autoload
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name) {
|
||||
echo("AUTOLOAD '$name'\n");
|
||||
eval("class $name {}");
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
} catch (A $e) {
|
||||
}
|
||||
|
||||
try {
|
||||
throw new Exception();
|
||||
} catch (B $e) {
|
||||
} catch (Exception $e) {
|
||||
echo "ok\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
testing @ and error_reporting - 1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
function foo($arg) {
|
||||
}
|
||||
|
||||
function bar() {
|
||||
throw new Exception("test");
|
||||
}
|
||||
|
||||
try {
|
||||
@foo(@bar());
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2047)
|
||||
Done
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
testing @ and error_reporting - 2
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
function foo($arg) {
|
||||
}
|
||||
|
||||
function bar() {
|
||||
error_reporting(E_ALL|E_STRICT);
|
||||
throw new Exception("test");
|
||||
}
|
||||
|
||||
try {
|
||||
@foo(@bar());
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
int(4095)
|
||||
Done
|
||||
@@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
testing @ and error_reporting - 3
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
function foo($arg) {
|
||||
echo @$nonex_foo;
|
||||
}
|
||||
|
||||
function bar() {
|
||||
echo @$nonex_bar;
|
||||
throw new Exception("test");
|
||||
}
|
||||
|
||||
function foo1() {
|
||||
echo $undef1;
|
||||
error_reporting(E_ALL|E_STRICT);
|
||||
echo $undef2;
|
||||
}
|
||||
|
||||
try {
|
||||
@foo(@bar(@foo1()));
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: undef2 in %s on line %d
|
||||
int(4095)
|
||||
Done
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
testing @ and error_reporting - 4
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
function foo() {
|
||||
echo $undef;
|
||||
error_reporting(E_ALL|E_STRICT);
|
||||
}
|
||||
|
||||
|
||||
foo(@$var);
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: undef in %s on line %d
|
||||
int(4095)
|
||||
Done
|
||||
@@ -0,0 +1,34 @@
|
||||
--TEST--
|
||||
testing @ and error_reporting - 5
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
class test {
|
||||
function __get($name) {
|
||||
return $undef_name;
|
||||
}
|
||||
function __set($name, $value) {
|
||||
return $undef_value;
|
||||
}
|
||||
}
|
||||
|
||||
$test = new test;
|
||||
|
||||
$test->abc = 123;
|
||||
echo $test->bcd;
|
||||
|
||||
@$test->qwe = 123;
|
||||
echo @$test->wer;
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: undef_value in %s on line %d
|
||||
|
||||
Notice: Undefined variable: undef_name in %s on line %d
|
||||
int(2047)
|
||||
Done
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
testing @ and error_reporting - 6
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
function foo1($arg) {
|
||||
}
|
||||
|
||||
function foo2($arg) {
|
||||
}
|
||||
|
||||
function foo3($arg) {
|
||||
echo $undef3;
|
||||
throw new Exception("test");
|
||||
}
|
||||
|
||||
try {
|
||||
@foo1(@foo2(@foo3()));
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(2047)
|
||||
Done
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
testing @ and error_reporting - 7
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
function foo1($arg) {
|
||||
}
|
||||
|
||||
function foo2($arg) {
|
||||
}
|
||||
|
||||
function foo3($arg) {
|
||||
echo $undef3;
|
||||
throw new Exception("test");
|
||||
}
|
||||
|
||||
try {
|
||||
@error_reporting(@foo1(@foo2(@foo3())));
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(2047)
|
||||
Done
|
||||
@@ -0,0 +1,32 @@
|
||||
--TEST--
|
||||
testing @ and error_reporting - 8
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
function foo1($arg) {
|
||||
}
|
||||
|
||||
function foo2($arg) {
|
||||
}
|
||||
|
||||
function foo3($arg) {
|
||||
error_reporting(E_ALL|E_STRICT);
|
||||
echo $undef3;
|
||||
throw new Exception("test");
|
||||
}
|
||||
|
||||
try {
|
||||
@foo1(@foo2(@foo3()));
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: undef3 in %s on line %d
|
||||
int(4095)
|
||||
Done
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
testing @ and error_reporting - 9
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
function bar() {
|
||||
echo @$blah;
|
||||
echo $undef2;
|
||||
}
|
||||
|
||||
function foo() {
|
||||
echo @$undef;
|
||||
error_reporting(E_ALL|E_STRICT);
|
||||
echo $blah;
|
||||
return bar();
|
||||
}
|
||||
|
||||
@foo();
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: blah in %s on line %d
|
||||
|
||||
Notice: Undefined variable: undef2 in %s on line %d
|
||||
int(4095)
|
||||
Done
|
||||
@@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
testing @ and error_reporting - 10
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
function make_exception()
|
||||
{
|
||||
@$blah;
|
||||
str_replace();
|
||||
error_reporting(0);
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
try {
|
||||
@make_exception();
|
||||
} catch (Exception $e) {}
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
error_reporting(E_ALL&~E_NOTICE);
|
||||
|
||||
try {
|
||||
@make_exception();
|
||||
} catch (Exception $e) {}
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(2047)
|
||||
int(2039)
|
||||
Done
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
instanceof shouldn't call __autoload
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name) {
|
||||
echo("AUTOLOAD '$name'\n");
|
||||
eval("class $name {}");
|
||||
}
|
||||
|
||||
class A {
|
||||
}
|
||||
$a = new A;
|
||||
var_dump($a instanceof B);
|
||||
var_dump($a instanceof A);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(true)
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
--TEST--
|
||||
is_a() and is_subclass_of() shouldn't call __autoload
|
||||
--INI--
|
||||
error_reporting=4095
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name) {
|
||||
echo("AUTOLOAD '$name'\n");
|
||||
eval("class $name {}");
|
||||
}
|
||||
|
||||
class BASE {
|
||||
}
|
||||
|
||||
interface INT {
|
||||
}
|
||||
|
||||
class A extends BASE implements INT {
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
var_dump(is_a($a, "B1"));
|
||||
var_dump(is_a($a, "A"));
|
||||
var_dump(is_a($a, "BASE"));
|
||||
var_dump(is_a($a, "INT"));
|
||||
var_dump(is_subclass_of($a, "B2"));
|
||||
var_dump(is_subclass_of($a, "A"));
|
||||
var_dump(is_subclass_of($a, "BASE"));
|
||||
var_dump(is_subclass_of($a, "INT"));
|
||||
|
||||
var_dump(is_subclass_of("X1", "X2"));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 17
|
||||
bool(false)
|
||||
|
||||
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 18
|
||||
bool(true)
|
||||
|
||||
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 19
|
||||
bool(true)
|
||||
|
||||
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 20
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
AUTOLOAD 'X1'
|
||||
AUTOLOAD 'X2'
|
||||
bool(false)
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
unset() CV 12 (unset() in indirect called function)
|
||||
--FILE--
|
||||
<?php
|
||||
$x = 1;
|
||||
function foo() {unset($GLOBALS["x"]);}
|
||||
call_user_func("foo");
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
+16
-7
@@ -38,6 +38,7 @@
|
||||
# define GLOBAL_FUNCTION_TABLE CG(function_table)
|
||||
# define GLOBAL_CLASS_TABLE CG(class_table)
|
||||
# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals)
|
||||
# define GLOBAL_CONSTANTS_TABLE EG(zend_constants)
|
||||
#endif
|
||||
|
||||
#if defined(ZEND_WIN32) && ZEND_DEBUG
|
||||
@@ -88,6 +89,7 @@ HashTable *global_function_table;
|
||||
HashTable *global_class_table;
|
||||
HashTable *global_constants_table;
|
||||
HashTable *global_auto_globals_table;
|
||||
static HashTable *global_persistent_list = NULL;
|
||||
#endif
|
||||
|
||||
ZEND_API zend_utility_values zend_uv;
|
||||
@@ -127,7 +129,7 @@ static void print_hash(HashTable *ht, int indent, zend_bool is_object TSRMLS_DC)
|
||||
if (is_object) {
|
||||
char *prop_name, *class_name;
|
||||
|
||||
zend_unmangle_property_name(string_key, &class_name, &prop_name);
|
||||
zend_unmangle_property_name_ex(string_key, str_len, &class_name, &prop_name);
|
||||
ZEND_PUTS(prop_name);
|
||||
if (class_name) {
|
||||
if (class_name[0]=='*') {
|
||||
@@ -486,6 +488,13 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS
|
||||
static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC)
|
||||
{
|
||||
zend_ini_shutdown(TSRMLS_C);
|
||||
if (&executor_globals->persistent_list != global_persistent_list) {
|
||||
zend_destroy_rsrc_list(&executor_globals->persistent_list TSRMLS_CC);
|
||||
}
|
||||
if (executor_globals->zend_constants != GLOBAL_CONSTANTS_TABLE) {
|
||||
zend_hash_destroy(executor_globals->zend_constants);
|
||||
free(executor_globals->zend_constants);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -682,6 +691,7 @@ void zend_post_startup(TSRMLS_D)
|
||||
compiler_globals_ctor(compiler_globals, tsrm_ls);
|
||||
free(EG(zend_constants));
|
||||
executor_globals_ctor(executor_globals, tsrm_ls);
|
||||
global_persistent_list = &EG(persistent_list);
|
||||
zend_new_thread_end_handler(tsrm_thread_id() TSRMLS_CC);
|
||||
}
|
||||
#endif
|
||||
@@ -691,9 +701,6 @@ void zend_shutdown(TSRMLS_D)
|
||||
{
|
||||
#ifdef ZEND_WIN32
|
||||
zend_shutdown_timeout_thread();
|
||||
#endif
|
||||
#ifndef ZTS
|
||||
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
|
||||
#endif
|
||||
zend_hash_graceful_reverse_destroy(&module_registry);
|
||||
|
||||
@@ -706,16 +713,18 @@ void zend_shutdown(TSRMLS_D)
|
||||
zend_shutdown_extensions(TSRMLS_C);
|
||||
free(zend_version_info);
|
||||
|
||||
zend_shutdown_constants(TSRMLS_C);
|
||||
free(GLOBAL_FUNCTION_TABLE);
|
||||
free(GLOBAL_CLASS_TABLE);
|
||||
#ifdef ZTS
|
||||
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
|
||||
|
||||
zend_hash_destroy(GLOBAL_CONSTANTS_TABLE);
|
||||
free(GLOBAL_CONSTANTS_TABLE);
|
||||
|
||||
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
|
||||
#ifdef ZTS
|
||||
GLOBAL_FUNCTION_TABLE = NULL;
|
||||
GLOBAL_CLASS_TABLE = NULL;
|
||||
GLOBAL_AUTO_GLOBALS_TABLE = NULL;
|
||||
GLOBAL_CONSTANTS_TABLE = NULL;
|
||||
#endif
|
||||
zend_destroy_rsrc_list_dtors();
|
||||
}
|
||||
|
||||
@@ -331,6 +331,7 @@ struct _zend_class_entry {
|
||||
HashTable function_table;
|
||||
HashTable default_properties;
|
||||
HashTable properties_info;
|
||||
HashTable default_static_members;
|
||||
HashTable *static_members;
|
||||
HashTable constants_table;
|
||||
struct _zend_function_entry *builtin_functions;
|
||||
|
||||
+256
-23
@@ -753,13 +753,53 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro
|
||||
|
||||
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC)
|
||||
{
|
||||
if (!class_type->constants_updated) {
|
||||
if (!class_type->constants_updated || !class_type->static_members) {
|
||||
zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry);
|
||||
zend_class_entry *old_scope = *scope;
|
||||
|
||||
*scope = class_type;
|
||||
zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
|
||||
if (!class_type->static_members) {
|
||||
HashPosition pos;
|
||||
zval **p;
|
||||
|
||||
if (class_type->parent) {
|
||||
zend_update_class_constants(class_type->parent TSRMLS_CC);
|
||||
}
|
||||
ALLOC_HASHTABLE(class_type->static_members);
|
||||
zend_hash_init(class_type->static_members, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(&class_type->default_static_members, &pos);
|
||||
while (zend_hash_get_current_data_ex(&class_type->default_static_members, (void**)&p, &pos) == SUCCESS) {
|
||||
char *str_index;
|
||||
uint str_length;
|
||||
ulong num_index;
|
||||
zval **q;
|
||||
|
||||
zend_hash_get_current_key_ex(&class_type->default_static_members, &str_index, &str_length, &num_index, 0, &pos);
|
||||
if ((*p)->is_ref &&
|
||||
class_type->parent &&
|
||||
zend_hash_find(&class_type->parent->default_static_members, str_index, str_length, (void**)&q) == SUCCESS &&
|
||||
*p == *q &&
|
||||
zend_hash_find(class_type->parent->static_members, str_index, str_length, (void**)&q) == SUCCESS) {
|
||||
(*q)->refcount++;
|
||||
(*q)->is_ref = 1;
|
||||
zend_hash_add(class_type->static_members, str_index, str_length, (void**)q, sizeof(zval*), NULL);
|
||||
} else {
|
||||
zval *q;
|
||||
|
||||
ALLOC_ZVAL(q);
|
||||
*q = **p;
|
||||
INIT_PZVAL(q)
|
||||
zval_copy_ctor(q);
|
||||
zend_hash_add(class_type->static_members, str_index, str_length, (void**)&q, sizeof(zval*), NULL);
|
||||
}
|
||||
zend_hash_move_forward_ex(&class_type->default_static_members, &pos);
|
||||
}
|
||||
}
|
||||
zend_hash_apply_with_argument(class_type->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
|
||||
*scope = old_scope;
|
||||
class_type->constants_updated = 1;
|
||||
}
|
||||
@@ -895,7 +935,7 @@ ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int add_index_long(zval *arg, uint index, long n)
|
||||
ZEND_API int add_index_long(zval *arg, ulong index, long n)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
@@ -906,7 +946,7 @@ ZEND_API int add_index_long(zval *arg, uint index, long n)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int add_index_null(zval *arg, uint index)
|
||||
ZEND_API int add_index_null(zval *arg, ulong index)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
@@ -916,7 +956,7 @@ ZEND_API int add_index_null(zval *arg, uint index)
|
||||
return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
ZEND_API int add_index_bool(zval *arg, uint index, int b)
|
||||
ZEND_API int add_index_bool(zval *arg, ulong index, int b)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
@@ -927,7 +967,7 @@ ZEND_API int add_index_bool(zval *arg, uint index, int b)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int add_index_resource(zval *arg, uint index, int r)
|
||||
ZEND_API int add_index_resource(zval *arg, ulong index, int r)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
@@ -938,7 +978,7 @@ ZEND_API int add_index_resource(zval *arg, uint index, int r)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int add_index_double(zval *arg, uint index, double d)
|
||||
ZEND_API int add_index_double(zval *arg, ulong index, double d)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
@@ -949,7 +989,7 @@ ZEND_API int add_index_double(zval *arg, uint index, double d)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int add_index_string(zval *arg, uint index, char *str, int duplicate)
|
||||
ZEND_API int add_index_string(zval *arg, ulong index, char *str, int duplicate)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
@@ -960,7 +1000,7 @@ ZEND_API int add_index_string(zval *arg, uint index, char *str, int duplicate)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int add_index_stringl(zval *arg, uint index, char *str, uint length, int duplicate)
|
||||
ZEND_API int add_index_stringl(zval *arg, ulong index, char *str, uint length, int duplicate)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
@@ -971,7 +1011,7 @@ ZEND_API int add_index_stringl(zval *arg, uint index, char *str, uint length, in
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int add_index_zval(zval *arg, uint index, zval *value)
|
||||
ZEND_API int add_index_zval(zval *arg, ulong index, zval *value)
|
||||
{
|
||||
return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &value, sizeof(zval *), NULL);
|
||||
}
|
||||
@@ -1082,7 +1122,7 @@ ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int add_get_index_long(zval *arg, uint index, long l, void **dest)
|
||||
ZEND_API int add_get_index_long(zval *arg, ulong index, long l, void **dest)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
@@ -1093,7 +1133,7 @@ ZEND_API int add_get_index_long(zval *arg, uint index, long l, void **dest)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int add_get_index_double(zval *arg, uint index, double d, void **dest)
|
||||
ZEND_API int add_get_index_double(zval *arg, ulong index, double d, void **dest)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
@@ -1104,7 +1144,7 @@ ZEND_API int add_get_index_double(zval *arg, uint index, double d, void **dest)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int add_get_index_string(zval *arg, uint index, char *str, void **dest, int duplicate)
|
||||
ZEND_API int add_get_index_string(zval *arg, ulong index, char *str, void **dest, int duplicate)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
@@ -1115,7 +1155,7 @@ ZEND_API int add_get_index_string(zval *arg, uint index, char *str, void **dest,
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int add_get_index_stringl(zval *arg, uint index, char *str, uint length, void **dest, int duplicate)
|
||||
ZEND_API int add_get_index_stringl(zval *arg, ulong index, char *str, uint length, void **dest, int duplicate)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
@@ -1494,10 +1534,14 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
}
|
||||
} else {
|
||||
if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) {
|
||||
efree(lc_class_name);
|
||||
zend_error(error_type, "Interface %s cannot contain non abstract method %s()", scope->name, ptr->fname);
|
||||
return FAILURE;
|
||||
}
|
||||
if (!internal_function->handler) {
|
||||
if (scope) {
|
||||
efree(lc_class_name);
|
||||
}
|
||||
zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
|
||||
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
|
||||
return FAILURE;
|
||||
@@ -1905,23 +1949,28 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_
|
||||
return 1;
|
||||
}
|
||||
|
||||
ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC)
|
||||
ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC)
|
||||
{
|
||||
char *lcname;
|
||||
zend_bool retval = 0;
|
||||
int callable_name_len_local;
|
||||
zend_class_entry *ce_local;
|
||||
zend_function *fptr_local;
|
||||
zval **zobj_ptr_local;
|
||||
|
||||
if (callable_name_len == NULL) {
|
||||
callable_name_len = &callable_name_len_local;
|
||||
}
|
||||
if (ce_ptr == NULL) {
|
||||
ce_ptr = &ce_local;
|
||||
}
|
||||
if (fptr_ptr == NULL) {
|
||||
fptr_ptr = &fptr_local;
|
||||
}
|
||||
if (zobj_ptr_ptr == NULL) {
|
||||
zobj_ptr_ptr = &zobj_ptr_local;
|
||||
}
|
||||
*ce_ptr = NULL;
|
||||
*fptr_ptr = NULL;
|
||||
*zobj_ptr_ptr = NULL;
|
||||
|
||||
@@ -1944,9 +1993,9 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
|
||||
|
||||
case IS_ARRAY:
|
||||
{
|
||||
zend_class_entry *ce = NULL, **pce;
|
||||
zval **method;
|
||||
zval **obj;
|
||||
zend_class_entry *ce = NULL, **pce;
|
||||
|
||||
if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2 &&
|
||||
zend_hash_index_find(Z_ARRVAL_P(callable), 0, (void **) &obj) == SUCCESS &&
|
||||
@@ -1965,10 +2014,12 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
|
||||
memcpy(ptr, "::", sizeof("::") - 1);
|
||||
ptr += sizeof("::") - 1;
|
||||
memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY)
|
||||
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
|
||||
*ce_ptr = ce;
|
||||
return 1;
|
||||
}
|
||||
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
|
||||
|
||||
@@ -1998,8 +2049,10 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
|
||||
memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
|
||||
}
|
||||
|
||||
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY)
|
||||
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
|
||||
*ce_ptr = ce;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (ce) {
|
||||
@@ -2028,7 +2081,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
|
||||
}
|
||||
}
|
||||
/* check for __call too */
|
||||
if (retval == 0 && ce->__call != 0) {
|
||||
if (retval == 0 && *zobj_ptr_ptr && ce->__call != 0) {
|
||||
retval = 1;
|
||||
}
|
||||
efree(lcname);
|
||||
@@ -2037,6 +2090,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
|
||||
*callable_name = estrndup("Array", sizeof("Array")-1);
|
||||
*callable_name_len = sizeof("Array") - 1;
|
||||
}
|
||||
*ce_ptr = ce;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2061,7 +2115,7 @@ ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **cal
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
return zend_is_callable_ex(callable, check_flags, callable_name, NULL, NULL, NULL TSRMLS_CC);
|
||||
return zend_is_callable_ex(callable, check_flags, callable_name, NULL, NULL, NULL, NULL TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
@@ -2072,7 +2126,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRML
|
||||
zend_class_entry **pce;
|
||||
int class_name_len;
|
||||
|
||||
if (zend_is_callable_ex(callable, 0, callable_name, NULL, NULL, NULL TSRMLS_CC)) {
|
||||
if (zend_is_callable_ex(callable, 0, callable_name, NULL, NULL, NULL, NULL TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
switch (Z_TYPE_P(callable)) {
|
||||
@@ -2126,7 +2180,7 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name
|
||||
access_type |= ZEND_ACC_PUBLIC;
|
||||
}
|
||||
if (access_type & ZEND_ACC_STATIC) {
|
||||
target_symbol_table = ce->static_members;
|
||||
target_symbol_table = &ce->default_static_members;
|
||||
} else {
|
||||
target_symbol_table = &ce->default_properties;
|
||||
}
|
||||
@@ -2274,6 +2328,73 @@ ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int
|
||||
return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_t name_length, zval *value TSRMLS_DC)
|
||||
{
|
||||
return zend_hash_update(&ce->constants_table, name, name_length+1, &value, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC)
|
||||
{
|
||||
zval *constant;
|
||||
|
||||
if (ce->type & ZEND_INTERNAL_CLASS) {
|
||||
constant = malloc(sizeof(zval));
|
||||
} else {
|
||||
ALLOC_ZVAL(constant);
|
||||
}
|
||||
ZVAL_LONG(constant, value);
|
||||
INIT_PZVAL(constant);
|
||||
return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, char *name, size_t name_length, zend_bool value TSRMLS_DC)
|
||||
{
|
||||
zval *constant;
|
||||
|
||||
if (ce->type & ZEND_INTERNAL_CLASS) {
|
||||
constant = malloc(sizeof(zval));
|
||||
} else {
|
||||
ALLOC_ZVAL(constant);
|
||||
}
|
||||
ZVAL_BOOL(constant, value);
|
||||
INIT_PZVAL(constant);
|
||||
return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, char *name, size_t name_length, double value TSRMLS_DC)
|
||||
{
|
||||
zval *constant;
|
||||
|
||||
if (ce->type & ZEND_INTERNAL_CLASS) {
|
||||
constant = malloc(sizeof(zval));
|
||||
} else {
|
||||
ALLOC_ZVAL(constant);
|
||||
}
|
||||
ZVAL_DOUBLE(constant, value);
|
||||
INIT_PZVAL(constant);
|
||||
return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, char *name, size_t name_length, char *value, size_t value_length TSRMLS_DC)
|
||||
{
|
||||
zval *constant;
|
||||
|
||||
if (ce->type & ZEND_INTERNAL_CLASS) {
|
||||
constant = malloc(sizeof(zval));
|
||||
ZVAL_STRINGL(constant, zend_strndup(value, value_length), value_length, 0);
|
||||
} else {
|
||||
ALLOC_ZVAL(constant);
|
||||
ZVAL_STRINGL(constant, value, value_length, 1);
|
||||
}
|
||||
INIT_PZVAL(constant);
|
||||
return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, char *name, size_t name_length, char *value TSRMLS_DC)
|
||||
{
|
||||
return zend_declare_class_constant_stringl(ce, name, name_length, value, strlen(value) TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC)
|
||||
{
|
||||
zval property;
|
||||
@@ -2335,7 +2456,7 @@ ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object,
|
||||
ALLOC_ZVAL(tmp);
|
||||
tmp->is_ref = 0;
|
||||
tmp->refcount = 0;
|
||||
ZVAL_LONG(tmp, value);
|
||||
ZVAL_DOUBLE(tmp, value);
|
||||
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
|
||||
}
|
||||
|
||||
@@ -2361,6 +2482,106 @@ ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object
|
||||
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC)
|
||||
{
|
||||
zval **property;
|
||||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
EG(scope) = scope;
|
||||
property = zend_std_get_static_property(scope, name, name_length, 0 TSRMLS_CC);
|
||||
EG(scope) = old_scope;
|
||||
if (!property) {
|
||||
return FAILURE;
|
||||
} else {
|
||||
if (*property != value) {
|
||||
if (PZVAL_IS_REF(*property)) {
|
||||
zval_dtor(*property);
|
||||
(*property)->type = value->type;
|
||||
(*property)->value = value->value;
|
||||
if (value->refcount > 0) {
|
||||
zval_copy_ctor(*property);
|
||||
}
|
||||
} else {
|
||||
zval *garbage = *property;
|
||||
|
||||
value->refcount++;
|
||||
if (PZVAL_IS_REF(value)) {
|
||||
SEPARATE_ZVAL(&value);
|
||||
}
|
||||
*property = value;
|
||||
zval_ptr_dtor(&garbage);
|
||||
}
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *name, int name_length TSRMLS_DC)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
tmp->is_ref = 0;
|
||||
tmp->refcount = 0;
|
||||
ZVAL_NULL(tmp);
|
||||
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
tmp->is_ref = 0;
|
||||
tmp->refcount = 0;
|
||||
ZVAL_BOOL(tmp, value);
|
||||
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
tmp->is_ref = 0;
|
||||
tmp->refcount = 0;
|
||||
ZVAL_LONG(tmp, value);
|
||||
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *name, int name_length, double value TSRMLS_DC)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
tmp->is_ref = 0;
|
||||
tmp->refcount = 0;
|
||||
ZVAL_DOUBLE(tmp, value);
|
||||
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, char *value TSRMLS_DC)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
tmp->is_ref = 0;
|
||||
tmp->refcount = 0;
|
||||
ZVAL_STRING(tmp, value, 1);
|
||||
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, char *value, int value_len TSRMLS_DC)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
tmp->is_ref = 0;
|
||||
tmp->refcount = 0;
|
||||
ZVAL_STRINGL(tmp, value, value_len, 1);
|
||||
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC)
|
||||
{
|
||||
zval property, *value;
|
||||
@@ -2382,6 +2603,18 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *n
|
||||
return value;
|
||||
}
|
||||
|
||||
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC)
|
||||
{
|
||||
zval **property;
|
||||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
EG(scope) = scope;
|
||||
property = zend_std_get_static_property(scope, name, name_length, silent TSRMLS_CC);
|
||||
EG(scope) = old_scope;
|
||||
|
||||
return property?*property:NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
|
||||
+30
-13
@@ -198,7 +198,7 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D);
|
||||
#define IS_CALLABLE_CHECK_NO_ACCESS (1<<1)
|
||||
#define IS_CALLABLE_CHECK_IS_STATIC (1<<2)
|
||||
|
||||
ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
|
||||
ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
|
||||
ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name);
|
||||
ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC);
|
||||
ZEND_API char *zend_get_module_version(char *module_name);
|
||||
@@ -212,6 +212,13 @@ ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int
|
||||
ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC);
|
||||
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_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);
|
||||
ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, char *name, size_t name_length, char *value, size_t value_length TSRMLS_DC);
|
||||
ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, char *name, size_t name_length, char *value TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC);
|
||||
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC);
|
||||
@@ -221,8 +228,18 @@ ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object,
|
||||
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *name, int name_length TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *name, int name_length, double value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, char *value TSRMLS_DC);
|
||||
ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, char *value, int value_length TSRMLS_DC);
|
||||
|
||||
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC);
|
||||
|
||||
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC);
|
||||
|
||||
ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC);
|
||||
ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC);
|
||||
|
||||
@@ -277,14 +294,14 @@ ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value);
|
||||
#define add_next_index_unset(__arg) add_next_index_null(__arg)
|
||||
#define add_property_unset(__arg, __key) add_property_null(__arg, __key)
|
||||
|
||||
ZEND_API int add_index_long(zval *arg, uint idx, long n);
|
||||
ZEND_API int add_index_null(zval *arg, uint idx);
|
||||
ZEND_API int add_index_bool(zval *arg, uint idx, int b);
|
||||
ZEND_API int add_index_resource(zval *arg, uint idx, int r);
|
||||
ZEND_API int add_index_double(zval *arg, uint idx, double d);
|
||||
ZEND_API int add_index_string(zval *arg, uint idx, char *str, int duplicate);
|
||||
ZEND_API int add_index_stringl(zval *arg, uint idx, char *str, uint length, int duplicate);
|
||||
ZEND_API int add_index_zval(zval *arg, uint index, zval *value);
|
||||
ZEND_API int add_index_long(zval *arg, ulong idx, long n);
|
||||
ZEND_API int add_index_null(zval *arg, ulong idx);
|
||||
ZEND_API int add_index_bool(zval *arg, ulong idx, int b);
|
||||
ZEND_API int add_index_resource(zval *arg, ulong idx, int r);
|
||||
ZEND_API int add_index_double(zval *arg, ulong idx, double d);
|
||||
ZEND_API int add_index_string(zval *arg, ulong idx, char *str, int duplicate);
|
||||
ZEND_API int add_index_stringl(zval *arg, ulong idx, char *str, uint length, int duplicate);
|
||||
ZEND_API int add_index_zval(zval *arg, ulong index, zval *value);
|
||||
|
||||
ZEND_API int add_next_index_long(zval *arg, long n);
|
||||
ZEND_API int add_next_index_null(zval *arg);
|
||||
@@ -301,10 +318,10 @@ ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *
|
||||
#define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate)
|
||||
#define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate)
|
||||
|
||||
ZEND_API int add_get_index_long(zval *arg, uint idx, long l, void **dest);
|
||||
ZEND_API int add_get_index_double(zval *arg, uint idx, double d, void **dest);
|
||||
ZEND_API int add_get_index_string(zval *arg, uint idx, char *str, void **dest, int duplicate);
|
||||
ZEND_API int add_get_index_stringl(zval *arg, uint idx, char *str, uint length, void **dest, int duplicate);
|
||||
ZEND_API int add_get_index_long(zval *arg, ulong idx, long l, void **dest);
|
||||
ZEND_API int add_get_index_double(zval *arg, ulong idx, double d, void **dest);
|
||||
ZEND_API int add_get_index_string(zval *arg, ulong idx, char *str, void **dest, int duplicate);
|
||||
ZEND_API int add_get_index_stringl(zval *arg, ulong idx, char *str, uint length, void **dest, int duplicate);
|
||||
|
||||
ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long l TSRMLS_DC);
|
||||
ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC);
|
||||
|
||||
+2
-1
@@ -75,7 +75,8 @@ static long mem_block_end_magic = MEM_BLOCK_END_MAGIC;
|
||||
#define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { AG(allocated_memory) += rs;\
|
||||
if (AG(memory_limit)<AG(allocated_memory)) {\
|
||||
int php_mem_limit = AG(memory_limit); \
|
||||
if (EG(in_execution) && AG(memory_limit)+1048576 > AG(allocated_memory) - rs) { \
|
||||
AG(allocated_memory) -= rs; \
|
||||
if (EG(in_execution) && AG(memory_limit)+1048576 > AG(allocated_memory)) { \
|
||||
AG(memory_limit) = AG(allocated_memory) + 1048576; \
|
||||
if (file) { \
|
||||
zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)", php_mem_limit, file, lineno, s); \
|
||||
|
||||
@@ -229,6 +229,7 @@ ZEND_FUNCTION(func_get_arg)
|
||||
arg = *(p-(arg_count-requested_offset));
|
||||
*return_value = *arg;
|
||||
zval_copy_ctor(return_value);
|
||||
INIT_PZVAL(return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -624,7 +625,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
|
||||
|
||||
convert_to_string_ex(class_name);
|
||||
|
||||
if (zend_lookup_class(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name), &ce TSRMLS_CC) == FAILURE) {
|
||||
if (zend_lookup_class_ex(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name), (instance_ce != NULL), &ce TSRMLS_CC) == FAILURE) {
|
||||
retval = 0;
|
||||
} else {
|
||||
if (only_subclass) {
|
||||
@@ -689,7 +690,7 @@ static void add_class_vars(zend_class_entry *ce, HashTable *properties, zval *re
|
||||
|
||||
zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos);
|
||||
zend_hash_move_forward_ex(properties, &pos);
|
||||
zend_unmangle_property_name(key, &class_name, &prop_name);
|
||||
zend_unmangle_property_name_ex(key, key_len, &class_name, &prop_name);
|
||||
if (class_name) {
|
||||
if (class_name[0] != '*' && strcmp(class_name, ce->name)) {
|
||||
/* filter privates from base classes */
|
||||
@@ -736,6 +737,7 @@ ZEND_FUNCTION(get_class_vars)
|
||||
} else {
|
||||
array_init(return_value);
|
||||
add_class_vars(*pce, &(*pce)->default_properties, return_value TSRMLS_CC);
|
||||
zend_update_class_constants(*pce TSRMLS_CC);
|
||||
add_class_vars(*pce, (*pce)->static_members, return_value TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
@@ -780,7 +782,7 @@ ZEND_FUNCTION(get_object_vars)
|
||||
(*value)->refcount++;
|
||||
add_assoc_zval_ex(return_value, key, key_len, *value);
|
||||
} else if (instanceof) {
|
||||
zend_unmangle_property_name(key, &class_name, &prop_name);
|
||||
zend_unmangle_property_name_ex(key, key_len, &class_name, &prop_name);
|
||||
if (!memcmp(class_name, "*", 2) || (Z_OBJCE_P(EG(This)) == Z_OBJCE_PP(obj) && !strcmp(Z_OBJCE_P(EG(This))->name, class_name))) {
|
||||
/* Not separating references */
|
||||
(*value)->refcount++;
|
||||
@@ -929,7 +931,7 @@ ZEND_FUNCTION(property_exists)
|
||||
if (property_info->flags & ZEND_ACC_PUBLIC) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
zend_unmangle_property_name(property_info->name, &class_name, &prop_name);
|
||||
zend_unmangle_property_name_ex(property_info->name, property_info->name_length, &class_name, &prop_name);
|
||||
if (!strncmp(class_name, "*", 1)) {
|
||||
if (instanceof_function(EG(scope), ce TSRMLS_CC)) {
|
||||
RETURN_TRUE;
|
||||
@@ -1846,7 +1848,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
|
||||
ptr = EG(current_execute_data);
|
||||
|
||||
/* skip "new Exception()" */
|
||||
if ((skip_last == 0) && ptr->opline && (ptr->opline->opcode == ZEND_NEW)) {
|
||||
if (ptr && (skip_last == 0) && ptr->opline && (ptr->opline->opcode == ZEND_NEW)) {
|
||||
ptr = ptr->prev_execute_data;
|
||||
}
|
||||
|
||||
|
||||
+106
-41
@@ -540,30 +540,50 @@ void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC)
|
||||
int last_op_number = get_next_op_number(CG(active_op_array));
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
if (last_op_number > 0) {
|
||||
zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number-1];
|
||||
if (variable->op_type == IS_VAR) {
|
||||
int n = 0;
|
||||
|
||||
if (last_op->opcode == ZEND_FETCH_OBJ_W) {
|
||||
last_op->opcode = ZEND_ASSIGN_OBJ;
|
||||
while (last_op_number - n > 0) {
|
||||
zend_op *last_op;
|
||||
|
||||
last_op = &CG(active_op_array)->opcodes[last_op_number-(n+1)];
|
||||
|
||||
zend_do_op_data(opline, value TSRMLS_CC);
|
||||
SET_UNUSED(opline->result);
|
||||
*result = last_op->result;
|
||||
return;
|
||||
} else if (last_op->opcode == ZEND_FETCH_DIM_W) {
|
||||
last_op->opcode = ZEND_ASSIGN_DIM;
|
||||
|
||||
zend_do_op_data(opline, value TSRMLS_CC);
|
||||
opline->op2.u.var = get_temporary_variable(CG(active_op_array));
|
||||
opline->op2.u.EA.type = 0;
|
||||
opline->op2.op_type = IS_VAR;
|
||||
SET_UNUSED(opline->result);
|
||||
*result = last_op->result;
|
||||
return;
|
||||
} else {
|
||||
if (opline_is_fetch_this(last_op TSRMLS_CC)) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
|
||||
if (last_op->result.op_type == IS_VAR &&
|
||||
last_op->result.u.var == variable->u.var) {
|
||||
if (last_op->opcode == ZEND_FETCH_OBJ_W) {
|
||||
if (n > 0) {
|
||||
*opline = *last_op;
|
||||
MAKE_NOP(last_op);
|
||||
last_op = opline;
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
}
|
||||
last_op->opcode = ZEND_ASSIGN_OBJ;
|
||||
zend_do_op_data(opline, value TSRMLS_CC);
|
||||
SET_UNUSED(opline->result);
|
||||
*result = last_op->result;
|
||||
return;
|
||||
} else if (last_op->opcode == ZEND_FETCH_DIM_W) {
|
||||
if (n > 0) {
|
||||
*opline = *last_op;
|
||||
MAKE_NOP(last_op);
|
||||
last_op = opline;
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
}
|
||||
last_op->opcode = ZEND_ASSIGN_DIM;
|
||||
zend_do_op_data(opline, value TSRMLS_CC);
|
||||
opline->op2.u.var = get_temporary_variable(CG(active_op_array));
|
||||
opline->op2.u.EA.type = 0;
|
||||
opline->op2.op_type = IS_VAR;
|
||||
SET_UNUSED(opline->result);
|
||||
*result = last_op->result;
|
||||
return;
|
||||
} else if (opline_is_fetch_this(last_op TSRMLS_CC)) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,7 +611,8 @@ void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC)
|
||||
if (last_op_number > 0) {
|
||||
zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number-1];
|
||||
|
||||
if (opline_is_fetch_this(last_op TSRMLS_CC)) {
|
||||
if (lvar->op_type == IS_VAR &&
|
||||
opline_is_fetch_this(last_op TSRMLS_CC)) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
|
||||
}
|
||||
}
|
||||
@@ -1499,7 +1520,12 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC)
|
||||
}
|
||||
|
||||
if (function_ptr) {
|
||||
send_by_reference = ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset) ? ZEND_ARG_SEND_BY_REF : 0;
|
||||
if (ARG_MAY_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) {
|
||||
op = (param->op_type & (IS_VAR|IS_CV))?ZEND_SEND_REF:ZEND_SEND_VAL;
|
||||
send_by_reference = 0;
|
||||
} else {
|
||||
send_by_reference = ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset) ? ZEND_ARG_SEND_BY_REF : 0;
|
||||
}
|
||||
} else {
|
||||
send_by_reference = 0;
|
||||
}
|
||||
@@ -1701,6 +1727,13 @@ void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var,
|
||||
long catch_op_number = get_next_op_number(CG(active_op_array));
|
||||
zend_op *opline;
|
||||
|
||||
if (catch_op_number > 0) {
|
||||
opline = &CG(active_op_array)->opcodes[catch_op_number-1];
|
||||
if (opline->opcode == ZEND_FETCH_CLASS) {
|
||||
opline->extended_value |= ZEND_FETCH_CLASS_NO_AUTOLOAD;
|
||||
}
|
||||
}
|
||||
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_CATCH;
|
||||
opline->op1 = *catch_class;
|
||||
@@ -2034,20 +2067,28 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
|
||||
zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, child_info->name, child_info->name_length, ce->type & ZEND_INTERNAL_CLASS);
|
||||
if (child_info->flags & ZEND_ACC_STATIC) {
|
||||
zval **prop;
|
||||
if (zend_hash_find(parent_ce->static_members, prot_name, prot_name_length+1, (void**)&prop) == SUCCESS) {
|
||||
HashTable *ht;
|
||||
|
||||
if (parent_ce->type != ce->type) {
|
||||
/* User class extends internal class */
|
||||
ht = parent_ce->static_members;
|
||||
} else {
|
||||
ht = &parent_ce->default_static_members;
|
||||
}
|
||||
if (zend_hash_find(ht, prot_name, prot_name_length+1, (void**)&prop) == SUCCESS) {
|
||||
zval **new_prop;
|
||||
if (zend_hash_find(ce->static_members, child_info->name, child_info->name_length+1, (void**)&new_prop) == SUCCESS) {
|
||||
if (zend_hash_find(&ce->default_static_members, child_info->name, child_info->name_length+1, (void**)&new_prop) == SUCCESS) {
|
||||
if (Z_TYPE_PP(new_prop) != IS_NULL && Z_TYPE_PP(prop) != IS_NULL) {
|
||||
char *prop_name, *tmp;
|
||||
zend_unmangle_property_name(child_info->name, &tmp, &prop_name);
|
||||
zend_unmangle_property_name_ex(child_info->name, child_info->name_length, &tmp, &prop_name);
|
||||
|
||||
zend_error(E_COMPILE_ERROR, "Cannot change initial value of property static protected %s::$%s in class %s",
|
||||
parent_ce->name, prop_name, ce->name);
|
||||
}
|
||||
}
|
||||
(*prop)->refcount++;
|
||||
zend_hash_update(ce->static_members, child_info->name, child_info->name_length+1, (void**)prop, sizeof(zval*), NULL);
|
||||
zend_hash_del(ce->static_members, prot_name, prot_name_length+1);
|
||||
zend_hash_update(&ce->default_static_members, child_info->name, child_info->name_length+1, (void**)prop, sizeof(zval*), NULL);
|
||||
zend_hash_del(&ce->default_static_members, prot_name, prot_name_length+1);
|
||||
}
|
||||
} else {
|
||||
zend_hash_del(&ce->default_properties, prot_name, prot_name_length+1);
|
||||
@@ -2133,7 +2174,13 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
|
||||
|
||||
/* Inherit properties */
|
||||
zend_hash_merge(&ce->default_properties, &parent_ce->default_properties, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0);
|
||||
zend_hash_merge(ce->static_members, parent_ce->static_members, (void (*)(void *)) inherit_static_prop, NULL, sizeof(zval *), 0);
|
||||
if (parent_ce->type != ce->type) {
|
||||
/* User class extends internal class */
|
||||
zend_update_class_constants(parent_ce TSRMLS_CC);
|
||||
zend_hash_merge(&ce->default_static_members, parent_ce->static_members, (void (*)(void *)) inherit_static_prop, NULL, sizeof(zval *), 0);
|
||||
} else {
|
||||
zend_hash_merge(&ce->default_static_members, &parent_ce->default_static_members, (void (*)(void *)) inherit_static_prop, NULL, sizeof(zval *), 0);
|
||||
}
|
||||
zend_hash_merge_ex(&ce->properties_info, &parent_ce->properties_info, (copy_ctor_func_t) (ce->type & ZEND_INTERNAL_CLASS ? zend_duplicate_property_info_internal : zend_duplicate_property_info), sizeof(zend_property_info), (merge_checker_func_t) do_inherit_property_access_check, ce);
|
||||
|
||||
zend_hash_merge(&ce->constants_table, &parent_ce->constants_table, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0);
|
||||
@@ -2263,7 +2310,7 @@ ZEND_API zend_class_entry *do_bind_inherited_class(zend_op *opline, HashTable *c
|
||||
zend_hash_destroy(&ce->function_table);
|
||||
zend_hash_destroy(&ce->default_properties);
|
||||
zend_hash_destroy(&ce->properties_info);
|
||||
zend_hash_destroy(ce->static_members);
|
||||
zend_hash_destroy(&ce->default_static_members);
|
||||
zend_hash_destroy(&ce->constants_table);
|
||||
return NULL;
|
||||
}
|
||||
@@ -2782,6 +2829,18 @@ ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_unmangle_property_name_ex(char *mangled_property, int mangled_property_len, char **class_name, char **prop_name)
|
||||
{
|
||||
*prop_name = *class_name = NULL;
|
||||
|
||||
if (mangled_property_len < 2) { /* do not try to unmangle empty strings */
|
||||
*prop_name = mangled_property;
|
||||
return;
|
||||
}
|
||||
|
||||
zend_unmangle_property_name(mangled_property, class_name, prop_name);
|
||||
}
|
||||
|
||||
ZEND_API void zend_unmangle_property_name(char *mangled_property, char **class_name, char **prop_name)
|
||||
{
|
||||
*prop_name = *class_name = NULL;
|
||||
@@ -3443,8 +3502,17 @@ void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC
|
||||
|
||||
void zend_do_instanceof(znode *result, znode *expr, znode *class_znode, int type TSRMLS_DC)
|
||||
{
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
int last_op_number = get_next_op_number(CG(active_op_array));
|
||||
zend_op *opline;
|
||||
|
||||
if (last_op_number > 0) {
|
||||
opline = &CG(active_op_array)->opcodes[last_op_number-1];
|
||||
if (opline->opcode == ZEND_FETCH_CLASS) {
|
||||
opline->extended_value |= ZEND_FETCH_CLASS_NO_AUTOLOAD;
|
||||
}
|
||||
}
|
||||
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_INSTANCEOF;
|
||||
opline->result.op_type = IS_TMP_VAR;
|
||||
opline->result.u.var = get_temporary_variable(CG(active_op_array));
|
||||
@@ -3568,7 +3636,8 @@ void zend_do_foreach_cont(znode *foreach_token, znode *as_token, znode *value, z
|
||||
}
|
||||
|
||||
value_node = opline->result;
|
||||
if (assign_by_ref) {
|
||||
zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
|
||||
if (assign_by_ref) {
|
||||
/* Mark FE_FETCH as IS_VAR as it holds the data directly as a value */
|
||||
zend_do_assign_ref(NULL, value, &value_node TSRMLS_CC);
|
||||
} else {
|
||||
@@ -3579,7 +3648,8 @@ void zend_do_foreach_cont(znode *foreach_token, znode *as_token, znode *value, z
|
||||
if (key->op_type != IS_UNUSED) {
|
||||
znode key_node;
|
||||
|
||||
opline = &CG(active_op_array)->opcodes[as_token->u.opline_num+1];
|
||||
zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
|
||||
opline = &CG(active_op_array)->opcodes[as_token->u.opline_num+1];
|
||||
opline->result.op_type = IS_TMP_VAR;
|
||||
opline->result.u.EA.type = 0;
|
||||
opline->result.u.opline_num = get_temporary_variable(CG(active_op_array));
|
||||
@@ -3927,17 +3997,12 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify
|
||||
|
||||
zend_hash_init_ex(&ce->default_properties, 0, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
|
||||
zend_hash_init_ex(&ce->properties_info, 0, NULL, (dtor_func_t) (persistent_hashes ? zend_destroy_property_info_internal : zend_destroy_property_info), persistent_hashes, 0);
|
||||
|
||||
if (persistent_hashes) {
|
||||
ce->static_members = (HashTable *) malloc(sizeof(HashTable));
|
||||
} else {
|
||||
ALLOC_HASHTABLE(ce->static_members);
|
||||
}
|
||||
|
||||
zend_hash_init_ex(ce->static_members, 0, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
|
||||
zend_hash_init_ex(&ce->default_static_members, 0, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
|
||||
zend_hash_init_ex(&ce->constants_table, 0, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
|
||||
zend_hash_init_ex(&ce->function_table, 0, NULL, ZEND_FUNCTION_DTOR, persistent_hashes, 0);
|
||||
|
||||
ce->static_members = (ce->type == ZEND_INTERNAL_CLASS) ? NULL : &ce->default_static_members;
|
||||
|
||||
if (nullify_handlers) {
|
||||
ce->constructor = NULL;
|
||||
ce->destructor = NULL;
|
||||
|
||||
+25
-4
@@ -291,9 +291,9 @@ struct _zend_execute_data {
|
||||
union _temp_variable *Ts;
|
||||
zval ***CVs;
|
||||
zend_bool original_in_execution;
|
||||
zend_class_entry *calling_scope;
|
||||
HashTable *symbol_table;
|
||||
struct _zend_execute_data *prev_execute_data;
|
||||
zval *old_error_reporting;
|
||||
};
|
||||
|
||||
#define EX(element) execute_data.element
|
||||
@@ -522,6 +522,7 @@ void zend_class_add_ref(zend_class_entry **ce);
|
||||
|
||||
ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal);
|
||||
ZEND_API void zend_unmangle_property_name(char *mangled_property, char **prop_name, char **class_name);
|
||||
ZEND_API void zend_unmangle_property_name_ex(char *mangled_property, int mangled_property_len, char **prop_name, char **class_name);
|
||||
|
||||
#define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor
|
||||
#define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
|
||||
@@ -583,7 +584,7 @@ int zendlex(znode *zendlval TSRMLS_DC);
|
||||
#define ZEND_FETCH_CLASS_GLOBAL 4
|
||||
#define ZEND_FETCH_CLASS_AUTO 5
|
||||
#define ZEND_FETCH_CLASS_INTERFACE 6
|
||||
|
||||
#define ZEND_FETCH_CLASS_NO_AUTOLOAD 0x80
|
||||
|
||||
/* variable parsing type (compile-time) */
|
||||
#define ZEND_PARSED_MEMBER (1<<0)
|
||||
@@ -648,6 +649,10 @@ int zendlex(znode *zendlval TSRMLS_DC);
|
||||
#define ZEND_ARG_COMPILE_TIME_BOUND (1<<1)
|
||||
#define ZEND_ARG_SEND_FUNCTION (1<<2)
|
||||
|
||||
#define ZEND_SEND_BY_VAL 0
|
||||
#define ZEND_SEND_BY_REF 1
|
||||
#define ZEND_SEND_PREFER_REF 2
|
||||
|
||||
/* Lost In Stupid Parentheses */
|
||||
#define ARG_SHOULD_BE_SENT_BY_REF(zf, arg_num) \
|
||||
( \
|
||||
@@ -657,15 +662,31 @@ int zendlex(znode *zendlval TSRMLS_DC);
|
||||
( \
|
||||
( \
|
||||
arg_num<=((zend_function *) zf)->common.num_args \
|
||||
&& ((zend_function *) zf)->common.arg_info[arg_num-1].pass_by_reference \
|
||||
&& ((zend_function *) zf)->common.arg_info[arg_num-1].pass_by_reference == ZEND_SEND_BY_REF \
|
||||
) \
|
||||
|| ( \
|
||||
arg_num>((zend_function *) zf)->common.num_args \
|
||||
&& ((zend_function *) zf)->common.pass_rest_by_reference \
|
||||
&& ((zend_function *) zf)->common.pass_rest_by_reference == ZEND_SEND_BY_REF \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
#define ARG_MAY_BE_SENT_BY_REF(zf, arg_num) \
|
||||
( \
|
||||
zf \
|
||||
&& ((zend_function *) zf)->common.arg_info \
|
||||
&& \
|
||||
( \
|
||||
( \
|
||||
arg_num<=((zend_function *) zf)->common.num_args \
|
||||
&& ((zend_function *) zf)->common.arg_info[arg_num-1].pass_by_reference == ZEND_SEND_PREFER_REF \
|
||||
) \
|
||||
|| ( \
|
||||
arg_num>((zend_function *) zf)->common.num_args \
|
||||
&& ((zend_function *) zf)->common.pass_rest_by_reference == ZEND_SEND_PREFER_REF \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
#define ZEND_RETURN_VAL 0
|
||||
#define ZEND_RETURN_REF 1
|
||||
|
||||
@@ -196,6 +196,7 @@ static void _default_exception_get_entry(zval *object, char *name, int name_len,
|
||||
|
||||
*return_value = *value;
|
||||
zval_copy_ctor(return_value);
|
||||
INIT_PZVAL(return_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+32
-27
@@ -392,12 +392,6 @@ static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **va
|
||||
if (variable_ptr == EG(error_zval_ptr) || value_ptr==EG(error_zval_ptr)) {
|
||||
variable_ptr_ptr = &EG(uninitialized_zval_ptr);
|
||||
} else if (variable_ptr != value_ptr) {
|
||||
variable_ptr->refcount--;
|
||||
if (variable_ptr->refcount==0) {
|
||||
zendi_zval_dtor(*variable_ptr);
|
||||
FREE_ZVAL(variable_ptr);
|
||||
}
|
||||
|
||||
if (!PZVAL_IS_REF(value_ptr)) {
|
||||
/* break it away */
|
||||
value_ptr->refcount--;
|
||||
@@ -413,6 +407,12 @@ static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **va
|
||||
|
||||
*variable_ptr_ptr = value_ptr;
|
||||
value_ptr->refcount++;
|
||||
|
||||
variable_ptr->refcount--;
|
||||
if (variable_ptr->refcount==0) {
|
||||
zendi_zval_dtor(*variable_ptr);
|
||||
FREE_ZVAL(variable_ptr);
|
||||
}
|
||||
} else if (!variable_ptr->is_ref) {
|
||||
if (variable_ptr_ptr == value_ptr_ptr) {
|
||||
SEPARATE_ZVAL(variable_ptr_ptr);
|
||||
@@ -448,6 +448,7 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
|
||||
{
|
||||
zend_arg_info *cur_arg_info;
|
||||
zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data;
|
||||
char *fclass, *fsep, *fname;
|
||||
|
||||
if (!zf->common.arg_info
|
||||
|| arg_num>zf->common.num_args) {
|
||||
@@ -455,22 +456,25 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
|
||||
}
|
||||
|
||||
cur_arg_info = &zf->common.arg_info[arg_num-1];
|
||||
fname = zf->common.function_name;
|
||||
fsep = zf->common.scope ? "::" : "";
|
||||
fclass = zf->common.scope ? zf->common.scope->name : "";
|
||||
|
||||
if (cur_arg_info->class_name) {
|
||||
if (!arg) {
|
||||
if(ptr && ptr->op_array) {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d must be an object of class %s, called in %s on line %d and defined", arg_num, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
|
||||
if (ptr && ptr->op_array) {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %s, called in %s on line %d and defined", arg_num, fclass, fsep, fname, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
|
||||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d must be an object of class %s", arg_num, cur_arg_info->class_name);
|
||||
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %s", arg_num, fclass, fsep, fname, cur_arg_info->class_name);
|
||||
}
|
||||
}
|
||||
switch (Z_TYPE_P(arg)) {
|
||||
case IS_NULL:
|
||||
if (!cur_arg_info->allow_null) {
|
||||
if(ptr && ptr->op_array) {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d must not be null, called in %s on line %d and defined", arg_num, ptr->op_array->filename, ptr->opline->lineno);
|
||||
if (ptr && ptr->op_array) {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
|
||||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d must not be null", arg_num);
|
||||
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null", arg_num, fclass, fsep, fname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -484,47 +488,47 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
|
||||
} else {
|
||||
error_msg = "be an instance of";
|
||||
}
|
||||
if(ptr && ptr->op_array) {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d must %s %s, called in %s on line %d and defined", arg_num, error_msg, ce->name, ptr->op_array->filename, ptr->opline->lineno);
|
||||
if (ptr && ptr->op_array) {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must %s %s, called in %s on line %d and defined", arg_num, fclass, fsep, fname, error_msg, ce->name, ptr->op_array->filename, ptr->opline->lineno);
|
||||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d must %s %s", arg_num, error_msg, ce->name);
|
||||
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must %s %s", arg_num, fclass, fsep, fname, error_msg, ce->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if(ptr && ptr->op_array) {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d must be an object of class %s, called in %s on line %d and defined", arg_num, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
|
||||
if (ptr && ptr->op_array) {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %s, called in %s on line %d and defined", arg_num, fclass, fsep, fname, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
|
||||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d must be an object of class %s", arg_num, cur_arg_info->class_name);
|
||||
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %s", arg_num, fclass, fsep, fname, cur_arg_info->class_name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (cur_arg_info->array_type_hint) {
|
||||
} else if (cur_arg_info->array_type_hint) {
|
||||
if (!arg) {
|
||||
if(ptr && ptr->op_array) {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d must be an array, called in %s on line %d and defined", arg_num, ptr->op_array->filename, ptr->opline->lineno);
|
||||
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
|
||||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d must be an array", arg_num);
|
||||
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array", arg_num, fclass, fsep, fname);
|
||||
}
|
||||
}
|
||||
switch (Z_TYPE_P(arg)) {
|
||||
case IS_NULL:
|
||||
if (!cur_arg_info->allow_null) {
|
||||
if(ptr && ptr->op_array) {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d must not be null, called in %s on line %d and defined", arg_num, ptr->op_array->filename, ptr->opline->lineno);
|
||||
if (ptr && ptr->op_array) {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
|
||||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d must not be null", arg_num);
|
||||
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null", arg_num, fclass, fsep, fname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
break;
|
||||
default:
|
||||
if(ptr && ptr->op_array) {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d must be an array, called in %s on line %d and defined", arg_num, ptr->op_array->filename, ptr->opline->lineno);
|
||||
if (ptr && ptr->op_array) {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
|
||||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Argument %d must be an array", arg_num);
|
||||
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array", arg_num, fclass, fsep, fname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1057,6 +1061,7 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container
|
||||
SEPARATE_ZVAL(container_ptr);
|
||||
container = *container_ptr;
|
||||
}
|
||||
zval_dtor(container);
|
||||
array_init(container);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ static inline void safe_free_zval_ptr_rel(zval *p ZEND_FILE_LINE_DC ZEND_FILE_LI
|
||||
}
|
||||
}
|
||||
ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
|
||||
ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC);
|
||||
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
|
||||
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
|
||||
|
||||
@@ -98,6 +99,24 @@ static inline int i_zend_is_true(zval *op)
|
||||
case IS_OBJECT:
|
||||
if(IS_ZEND_STD_OBJECT(*op)) {
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (Z_OBJ_HT_P(op)->cast_object) {
|
||||
zval tmp;
|
||||
if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_BOOL, 0 TSRMLS_CC) == SUCCESS) {
|
||||
result = Z_LVAL(tmp);
|
||||
break;
|
||||
}
|
||||
} else if (Z_OBJ_HT_P(op)->get) {
|
||||
zval *tmp = Z_OBJ_HT_P(op)->get(op TSRMLS_CC);
|
||||
if(Z_TYPE_P(tmp) != IS_OBJECT) {
|
||||
/* for safety - avoid loop */
|
||||
convert_to_boolean(tmp);
|
||||
result = Z_LVAL_P(tmp);
|
||||
zval_ptr_dtor(&tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(EG(ze1_compatibility_mode)) {
|
||||
result = (zend_hash_num_elements(Z_OBJPROP_P(op))?1:0);
|
||||
} else {
|
||||
|
||||
+29
-10
@@ -386,6 +386,13 @@ ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC)
|
||||
zval_dtor(*zval_ptr);
|
||||
safe_free_zval_ptr_rel(*zval_ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC);
|
||||
} else if ((*zval_ptr)->refcount == 1) {
|
||||
if ((*zval_ptr)->type == IS_OBJECT) {
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (EG(ze1_compatibility_mode)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
(*zval_ptr)->is_ref = 0;
|
||||
}
|
||||
}
|
||||
@@ -750,7 +757,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (fci_cache) {
|
||||
if (fci_cache &&
|
||||
(EX(function_state).function->type != ZEND_INTERNAL_FUNCTION ||
|
||||
((zend_internal_function*)EX(function_state).function)->handler != zend_std_call_user_call)) {
|
||||
fci_cache->function_handler = EX(function_state).function;
|
||||
fci_cache->object_pp = fci->object_pp;
|
||||
fci_cache->calling_scope = calling_scope;
|
||||
@@ -906,7 +915,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
|
||||
ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC)
|
||||
{
|
||||
zval **args[1];
|
||||
zval autoload_function;
|
||||
@@ -934,7 +943,7 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
|
||||
/* The compiler is not-reentrant. Make sure we __autoload() only during run-time
|
||||
* (doesn't impact fuctionality of __autoload()
|
||||
*/
|
||||
if (zend_is_compiling(TSRMLS_C)) {
|
||||
if (!use_autoload || zend_is_compiling(TSRMLS_C)) {
|
||||
free_alloca(lc_name);
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -1002,6 +1011,11 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
|
||||
return retval;
|
||||
}
|
||||
|
||||
ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
|
||||
{
|
||||
return zend_lookup_class_ex(name, name_length, 1, ce TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC)
|
||||
{
|
||||
zval pv;
|
||||
@@ -1327,7 +1341,9 @@ void zend_unset_timeout(TSRMLS_D)
|
||||
zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC)
|
||||
{
|
||||
zend_class_entry **pce;
|
||||
int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
|
||||
|
||||
fetch_type = fetch_type & ~ZEND_FETCH_CLASS_NO_AUTOLOAD;
|
||||
check_fetch_type:
|
||||
switch (fetch_type) {
|
||||
case ZEND_FETCH_CLASS_SELF:
|
||||
@@ -1352,12 +1368,15 @@ check_fetch_type:
|
||||
break;
|
||||
}
|
||||
|
||||
if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC)==FAILURE) {
|
||||
if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) {
|
||||
zend_error(E_ERROR, "Interface '%s' not found", class_name);
|
||||
} else {
|
||||
zend_error(E_ERROR, "Class '%s' not found", class_name);
|
||||
if (zend_lookup_class_ex(class_name, class_name_len, use_autoload, &pce TSRMLS_CC)==FAILURE) {
|
||||
if (use_autoload) {
|
||||
if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) {
|
||||
zend_error(E_ERROR, "Interface '%s' not found", class_name);
|
||||
} else {
|
||||
zend_error(E_ERROR, "Class '%s' not found", class_name);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return *pce;
|
||||
}
|
||||
@@ -1417,7 +1436,7 @@ ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC)
|
||||
int i;
|
||||
|
||||
for (ex = EG(current_execute_data); ex; ex = ex->prev_execute_data) {
|
||||
if (ex->symbol_table == symbol_table) {
|
||||
if (ex->op_array && ex->symbol_table == symbol_table) {
|
||||
for (i = 0; i < ex->op_array->last_var; i++) {
|
||||
ex->CVs[i] = NULL;
|
||||
}
|
||||
@@ -1432,7 +1451,7 @@ ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC)
|
||||
|
||||
if (zend_hash_quick_exists(&EG(symbol_table), name, name_len+1, hash_value)) {
|
||||
for (ex = EG(current_execute_data); ex; ex = ex->prev_execute_data) {
|
||||
if (ex->symbol_table == &EG(symbol_table)) {
|
||||
if (ex->op_array && ex->symbol_table == &EG(symbol_table)) {
|
||||
int i;
|
||||
for (i = 0; i < ex->op_array->last_var; i++) {
|
||||
if (ex->op_array->vars[i].hash_value == hash_value &&
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/* The first number is the engine version and the rest is the date.
|
||||
* This way engine 2 API no. is always greater than engine 1 API no..
|
||||
*/
|
||||
#define ZEND_EXTENSION_API_NO 220050617
|
||||
#define ZEND_EXTENSION_API_NO 220051025
|
||||
|
||||
typedef struct _zend_extension_version_info {
|
||||
int zend_extension_api_no;
|
||||
|
||||
+7
-4
@@ -154,6 +154,7 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
|
||||
zend_ini_entry *hashed_ini_entry;
|
||||
zval default_value;
|
||||
HashTable *directives = registered_zend_ini_directives;
|
||||
zend_bool config_directive_success = 0;
|
||||
|
||||
#ifdef ZTS
|
||||
/* if we are called during the request, eg: from dl(),
|
||||
@@ -171,6 +172,7 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
|
||||
|
||||
while (p->name) {
|
||||
p->module_number = module_number;
|
||||
config_directive_success = 0;
|
||||
if (zend_hash_add(directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
|
||||
zend_unregister_ini_entries(module_number TSRMLS_CC);
|
||||
return FAILURE;
|
||||
@@ -180,11 +182,12 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
|
||||
|| hashed_ini_entry->on_modify(hashed_ini_entry, default_value.value.str.val, default_value.value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC)==SUCCESS) {
|
||||
hashed_ini_entry->value = default_value.value.str.val;
|
||||
hashed_ini_entry->value_length = default_value.value.str.len;
|
||||
config_directive_success = 1;
|
||||
}
|
||||
} else {
|
||||
if (hashed_ini_entry->on_modify) {
|
||||
hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
if (!config_directive_success && hashed_ini_entry->on_modify) {
|
||||
hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
|
||||
/* no interest in caching and no information already present that is
|
||||
* needed later inside zend_call_function. */
|
||||
ZVAL_STRINGL(&z_fname, function_name, function_name_len, 0);
|
||||
fci.function_table = !object_pp ? EG(function_table) : NULL;
|
||||
result = zend_call_function(&fci, NULL TSRMLS_CC);
|
||||
} else {
|
||||
zend_fcall_info_cache fcic;
|
||||
|
||||
@@ -181,7 +181,7 @@ inner_statement:
|
||||
|
||||
|
||||
statement:
|
||||
unticked_statement { zend_do_ticks(TSRMLS_C); RESET_DOC_COMMENT(); }
|
||||
unticked_statement { zend_do_ticks(TSRMLS_C); }
|
||||
;
|
||||
|
||||
unticked_statement:
|
||||
@@ -220,7 +220,7 @@ unticked_statement:
|
||||
foreach_statement { zend_do_foreach_end(&$1, &$5 TSRMLS_CC); }
|
||||
| T_FOREACH '(' expr_without_variable { zend_do_foreach_begin(&$1, &$2, &$3, 0 TSRMLS_CC); } T_AS
|
||||
{ zend_do_foreach_fetch(&$1, &$2, &$5 TSRMLS_CC); }
|
||||
w_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$1, &$5, &$7, &$8 TSRMLS_CC); }
|
||||
variable foreach_optional_arg ')' { zend_check_writable_variable(&$7); zend_do_foreach_cont(&$1, &$5, &$7, &$8 TSRMLS_CC); }
|
||||
foreach_statement { zend_do_foreach_end(&$1, &$5 TSRMLS_CC); }
|
||||
| T_DECLARE { $1.u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); }
|
||||
| ';' /* empty statement */
|
||||
@@ -338,8 +338,8 @@ foreach_optional_arg:
|
||||
|
||||
|
||||
foreach_variable:
|
||||
w_variable { $$ = $1; }
|
||||
| '&' w_variable { $$ = $2; $$.u.EA.type |= ZEND_PARSED_REFERENCE_VARIABLE; }
|
||||
variable { zend_check_writable_variable(&$1); $$ = $1; }
|
||||
| '&' variable { zend_check_writable_variable(&$2); $$ = $2; $$.u.EA.type |= ZEND_PARSED_REFERENCE_VARIABLE; }
|
||||
;
|
||||
|
||||
for_statement:
|
||||
|
||||
@@ -615,6 +615,7 @@ int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_
|
||||
if (zend_prepare_string_for_scanning(str, str_name TSRMLS_CC)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
BEGIN(INITIAL);
|
||||
zend_highlight(syntax_highlighter_ini TSRMLS_CC);
|
||||
#ifdef ZEND_MULTIBYTE
|
||||
if (SCNG(script_org)) {
|
||||
@@ -1833,6 +1834,13 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
return T_CHARACTER;
|
||||
}
|
||||
|
||||
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\{$" {
|
||||
zendlval->value.str.val = estrndup("{$", sizeof("{$")-1);
|
||||
zendlval->value.str.len = sizeof("{$")-1;
|
||||
zendlval->type = IS_STRING;
|
||||
return T_STRING;
|
||||
}
|
||||
|
||||
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\"{ANY_CHAR} {
|
||||
switch (yytext[1]) {
|
||||
case 'n':
|
||||
@@ -1850,9 +1858,6 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
case '$':
|
||||
zendlval->value.lval = (long) yytext[1];
|
||||
break;
|
||||
case '{':
|
||||
zendlval->value.lval = (long) yytext[1];
|
||||
break;
|
||||
default:
|
||||
zendlval->value.str.val = estrndup(yytext, yyleng);
|
||||
zendlval->value.str.len = yyleng;
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ 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 all_args_by_ref[1];
|
||||
|
||||
#define ZEND_MODULE_API_NO 20050617
|
||||
#define ZEND_MODULE_API_NO 20050922
|
||||
#ifdef ZTS
|
||||
#define USING_ZTS 1
|
||||
#else
|
||||
|
||||
@@ -482,8 +482,10 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC
|
||||
zval tmp_member;
|
||||
zval **retval;
|
||||
zend_property_info *property_info;
|
||||
zend_bool use_get;
|
||||
|
||||
zobj = Z_OBJ_P(object);
|
||||
use_get = (zobj->ce->__get && !zobj->in_get);
|
||||
|
||||
if (member->type != IS_STRING) {
|
||||
tmp_member = *member;
|
||||
@@ -496,12 +498,12 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC
|
||||
fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member));
|
||||
#endif
|
||||
|
||||
property_info = zend_get_property_info(zobj->ce, member, 0 TSRMLS_CC);
|
||||
property_info = zend_get_property_info(zobj->ce, member, use_get TSRMLS_CC);
|
||||
|
||||
if (zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE) {
|
||||
if (!property_info || zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE) {
|
||||
zval *new_zval;
|
||||
|
||||
if (!zobj->ce->__get && !zobj->ce->__set) {
|
||||
if (!use_get) {
|
||||
/* we don't have access controls - will just add it */
|
||||
new_zval = &EG(uninitialized_zval);
|
||||
|
||||
@@ -820,6 +822,8 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *propert
|
||||
return NULL;
|
||||
}
|
||||
|
||||
zend_update_class_constants(tmp_ce TSRMLS_CC);
|
||||
|
||||
zend_hash_quick_find(tmp_ce->static_members, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval);
|
||||
|
||||
if (!retval) {
|
||||
@@ -830,7 +834,6 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *propert
|
||||
}
|
||||
}
|
||||
|
||||
zval_update_constant(retval, (void *) 1 TSRMLS_CC);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
+12
-4
@@ -38,6 +38,7 @@ ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint ini
|
||||
ZEND_API void zend_objects_store_destroy(zend_objects_store *objects)
|
||||
{
|
||||
efree(objects->object_buckets);
|
||||
objects->object_buckets = NULL;
|
||||
}
|
||||
|
||||
ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC)
|
||||
@@ -50,7 +51,7 @@ 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) {
|
||||
if (obj->dtor && obj->object) {
|
||||
obj->dtor(obj->object, i TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
@@ -138,9 +139,16 @@ ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC)
|
||||
|
||||
ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC)
|
||||
{
|
||||
zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
|
||||
struct _store_object *obj = &EG(objects_store).object_buckets[handle].bucket.obj;
|
||||
|
||||
zend_object_handle handle;
|
||||
struct _store_object *obj;
|
||||
|
||||
if (!EG(objects_store).object_buckets) {
|
||||
return;
|
||||
}
|
||||
|
||||
handle = Z_OBJ_HANDLE_P(zobject);
|
||||
obj = &EG(objects_store).object_buckets[handle].bucket.obj;
|
||||
|
||||
/* Make sure we hold a reference count during the destructor call
|
||||
otherwise, when the destructor ends the storage might be freed
|
||||
when the refcount reaches 0 a second time
|
||||
|
||||
+9
-5
@@ -138,11 +138,17 @@ ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC)
|
||||
|
||||
ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC)
|
||||
{
|
||||
if ((*pce)->static_members) {
|
||||
if ((*pce)->static_members != &(*pce)->default_static_members) {
|
||||
zend_hash_destroy((*pce)->static_members);
|
||||
FREE_HASHTABLE((*pce)->static_members);
|
||||
}
|
||||
(*pce)->static_members = NULL;
|
||||
}
|
||||
if ((*pce)->type == ZEND_USER_CLASS) {
|
||||
/* 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_clean((*pce)->static_members);
|
||||
zend_hash_apply(&(*pce)->function_table, (apply_func_t) zend_cleanup_function_data TSRMLS_CC);
|
||||
}
|
||||
return 0;
|
||||
@@ -159,10 +165,9 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce)
|
||||
case ZEND_USER_CLASS:
|
||||
zend_hash_destroy(&ce->default_properties);
|
||||
zend_hash_destroy(&ce->properties_info);
|
||||
zend_hash_destroy(ce->static_members);
|
||||
zend_hash_destroy(&ce->default_static_members);
|
||||
efree(ce->name);
|
||||
zend_hash_destroy(&ce->function_table);
|
||||
FREE_HASHTABLE(ce->static_members);
|
||||
zend_hash_destroy(&ce->constants_table);
|
||||
if (ce->num_interfaces > 0 && ce->interfaces) {
|
||||
efree(ce->interfaces);
|
||||
@@ -175,10 +180,9 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce)
|
||||
case ZEND_INTERNAL_CLASS:
|
||||
zend_hash_destroy(&ce->default_properties);
|
||||
zend_hash_destroy(&ce->properties_info);
|
||||
zend_hash_destroy(ce->static_members);
|
||||
zend_hash_destroy(&ce->default_static_members);
|
||||
free(ce->name);
|
||||
zend_hash_destroy(&ce->function_table);
|
||||
free(ce->static_members);
|
||||
zend_hash_destroy(&ce->constants_table);
|
||||
if (ce->num_interfaces > 0) {
|
||||
free(ce->interfaces);
|
||||
|
||||
@@ -482,7 +482,7 @@ ZEND_API void convert_to_boolean(zval *op)
|
||||
zend_bool retval = 1;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
convert_object_to_type(op, IS_BOOL, convert_to_double);
|
||||
convert_object_to_type(op, IS_BOOL, convert_to_boolean);
|
||||
|
||||
if (op->type == IS_BOOL) {
|
||||
return;
|
||||
|
||||
@@ -84,7 +84,14 @@ static inline void zend_ptr_stack_3_pop(zend_ptr_stack *stack, void **a, void **
|
||||
*a = *(--stack->top_element);
|
||||
*b = *(--stack->top_element);
|
||||
*c = *(--stack->top_element);
|
||||
stack->top -= 3;;
|
||||
stack->top -= 3;
|
||||
}
|
||||
|
||||
static inline void zend_ptr_stack_2_pop(zend_ptr_stack *stack, void **a, void **b)
|
||||
{
|
||||
*a = *(--stack->top_element);
|
||||
*b = *(--stack->top_element);
|
||||
stack->top -= 2;
|
||||
}
|
||||
|
||||
static inline void zend_ptr_stack_push(zend_ptr_stack *stack, void *ptr)
|
||||
|
||||
+95
-95
@@ -41,13 +41,13 @@ zend_class_entry *reflection_property_ptr;
|
||||
zend_class_entry *reflection_extension_ptr;
|
||||
|
||||
/* Method macros */
|
||||
#define METHOD_NOTSTATIC \
|
||||
if (!this_ptr) { \
|
||||
#define METHOD_NOTSTATIC(ce) \
|
||||
if (!this_ptr || !instanceof_function(Z_OBJCE_P(this_ptr), ce TSRMLS_CC)) { \
|
||||
zend_error(E_ERROR, "%s() cannot be called statically", get_active_function_name(TSRMLS_C)); \
|
||||
return; \
|
||||
} \
|
||||
|
||||
#define METHOD_NOTSTATIC_NUMPARAMS(c) METHOD_NOTSTATIC \
|
||||
#define METHOD_NOTSTATIC_NUMPARAMS(ce, c) METHOD_NOTSTATIC(ce) \
|
||||
if (ZEND_NUM_ARGS() > c) { \
|
||||
ZEND_WRONG_PARAM_COUNT(); \
|
||||
} \
|
||||
@@ -720,7 +720,7 @@ static void _property_string(string *str, zend_property_info *prop, char *prop_n
|
||||
string_printf(str, "static ");
|
||||
}
|
||||
|
||||
zend_unmangle_property_name(prop->name, &class_name, &prop_name);
|
||||
zend_unmangle_property_name_ex(prop->name, prop->name_length, &class_name, &prop_name);
|
||||
string_printf(str, "$%s", prop_name);
|
||||
}
|
||||
|
||||
@@ -753,7 +753,7 @@ static int _extension_ini_string(zend_ini_entry *ini_entry, int num_args, va_lis
|
||||
}
|
||||
}
|
||||
|
||||
string_printf(str, "> ]\n", indent, ini_entry->name);
|
||||
string_printf(str, "> ]\n");
|
||||
string_printf(str, " %s Current = '%s'\n", indent, ini_entry->value ? ini_entry->value : "");
|
||||
if (ini_entry->modified) {
|
||||
string_printf(str, " %s Default = '%s'\n", indent, ini_entry->orig_value ? ini_entry->orig_value : "");
|
||||
@@ -852,7 +852,7 @@ static void _function_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
|
||||
reflection_object *intern;
|
||||
zend_function *mptr;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(mptr);
|
||||
RETURN_BOOL(mptr->common.fn_flags & mask);
|
||||
}
|
||||
@@ -978,7 +978,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
|
||||
property_reference *reference;
|
||||
char *class_name, *prop_name;
|
||||
|
||||
zend_unmangle_property_name(prop->name, &class_name, &prop_name);
|
||||
zend_unmangle_property_name_ex(prop->name, prop->name_length, &class_name, &prop_name);
|
||||
|
||||
if (!(prop->flags & ZEND_ACC_PRIVATE)) {
|
||||
/* we have to seach the class hierarchy for this (implicit) public or protected property */
|
||||
@@ -1252,7 +1252,7 @@ ZEND_METHOD(reflection_function, __toString)
|
||||
zend_function *fptr;
|
||||
string str;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
string_init(&str);
|
||||
_function_string(&str, fptr, "" TSRMLS_CC);
|
||||
@@ -1264,7 +1264,7 @@ ZEND_METHOD(reflection_function, __toString)
|
||||
Returns this function's name */
|
||||
ZEND_METHOD(reflection, function_getName)
|
||||
{
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
|
||||
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1276,7 +1276,7 @@ ZEND_METHOD(reflection, function_isInternal)
|
||||
reflection_object *intern;
|
||||
zend_function *fptr;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
RETURN_BOOL(fptr->type == ZEND_INTERNAL_FUNCTION);
|
||||
}
|
||||
@@ -1289,7 +1289,7 @@ ZEND_METHOD(reflection_function, isUserDefined)
|
||||
reflection_object *intern;
|
||||
zend_function *fptr;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
RETURN_BOOL(fptr->type == ZEND_USER_FUNCTION);
|
||||
}
|
||||
@@ -1302,7 +1302,7 @@ ZEND_METHOD(reflection_function, getFileName)
|
||||
reflection_object *intern;
|
||||
zend_function *fptr;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
if (fptr->type == ZEND_USER_FUNCTION) {
|
||||
RETURN_STRING(fptr->op_array.filename, 1);
|
||||
@@ -1318,7 +1318,7 @@ ZEND_METHOD(reflection_function, getStartLine)
|
||||
reflection_object *intern;
|
||||
zend_function *fptr;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
if (fptr->type == ZEND_USER_FUNCTION) {
|
||||
RETURN_LONG(fptr->op_array.line_start);
|
||||
@@ -1334,7 +1334,7 @@ ZEND_METHOD(reflection_function, getEndLine)
|
||||
reflection_object *intern;
|
||||
zend_function *fptr;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
if (fptr->type == ZEND_USER_FUNCTION) {
|
||||
RETURN_LONG(fptr->op_array.line_end);
|
||||
@@ -1350,7 +1350,7 @@ ZEND_METHOD(reflection_function, getDocComment)
|
||||
reflection_object *intern;
|
||||
zend_function *fptr;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
|
||||
RETURN_STRINGL(fptr->op_array.doc_comment, fptr->op_array.doc_comment_len, 1);
|
||||
@@ -1367,12 +1367,13 @@ ZEND_METHOD(reflection_function, getStaticVariables)
|
||||
reflection_object *intern;
|
||||
zend_function *fptr;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
|
||||
/* Return an empty array in case no static variables exist */
|
||||
array_init(return_value);
|
||||
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.static_variables != NULL) {
|
||||
zend_hash_apply_with_argument(fptr->op_array.static_variables, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
|
||||
zend_hash_copy(Z_ARRVAL_P(return_value), fptr->op_array.static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
|
||||
}
|
||||
}
|
||||
@@ -1391,7 +1392,7 @@ ZEND_METHOD(reflection_function, invoke)
|
||||
reflection_object *intern;
|
||||
zend_function *fptr;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_function_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
|
||||
params = safe_emalloc(sizeof(zval **), argc, 0);
|
||||
@@ -1451,7 +1452,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
|
||||
zend_function *fptr;
|
||||
zval *param_array;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_function_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", ¶m_array) == FAILURE) {
|
||||
@@ -1502,7 +1503,7 @@ ZEND_METHOD(reflection_function, returnsReference)
|
||||
reflection_object *intern;
|
||||
zend_function *fptr;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_function_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
|
||||
RETURN_BOOL(fptr->op_array.return_reference);
|
||||
@@ -1516,7 +1517,7 @@ ZEND_METHOD(reflection_function, getNumberOfParameters)
|
||||
reflection_object *intern;
|
||||
zend_function *fptr;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_function_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
|
||||
RETURN_LONG(fptr->common.num_args);
|
||||
@@ -1530,7 +1531,7 @@ ZEND_METHOD(reflection_function, getNumberOfRequiredParameters)
|
||||
reflection_object *intern;
|
||||
zend_function *fptr;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_function_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
|
||||
RETURN_LONG(fptr->common.required_num_args);
|
||||
@@ -1546,7 +1547,7 @@ ZEND_METHOD(reflection_function, getParameters)
|
||||
zend_uint i;
|
||||
struct _zend_arg_info *arg_info;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_function_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
|
||||
arg_info= fptr->common.arg_info;
|
||||
@@ -1708,7 +1709,7 @@ ZEND_METHOD(reflection_parameter, __toString)
|
||||
parameter_reference *param;
|
||||
string str;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(param);
|
||||
string_init(&str);
|
||||
_parameter_string(&str, param->fptr, param->arg_info, param->offset, param->required, "" TSRMLS_CC);
|
||||
@@ -1720,7 +1721,7 @@ ZEND_METHOD(reflection_parameter, __toString)
|
||||
Returns this parameters's name */
|
||||
ZEND_METHOD(reflection_parameter, getName)
|
||||
{
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
|
||||
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1732,22 +1733,19 @@ ZEND_METHOD(reflection_parameter, getClass)
|
||||
reflection_object *intern;
|
||||
parameter_reference *param;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(param);
|
||||
|
||||
if (!param->arg_info->class_name) {
|
||||
RETURN_NULL();
|
||||
} else {
|
||||
zend_class_entry **pce;
|
||||
char *lcname = do_alloca(param->arg_info->class_name_len + 1);
|
||||
zend_str_tolower_copy(lcname, param->arg_info->class_name, param->arg_info->class_name_len);
|
||||
if (zend_hash_find(EG(class_table), lcname, param->arg_info->class_name_len + 1, (void **) &pce) == FAILURE) {
|
||||
free_alloca(lcname);
|
||||
|
||||
if (zend_lookup_class_ex(param->arg_info->class_name, param->arg_info->class_name_len, 1, &pce TSRMLS_CC) == FAILURE) {
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Class %s does not exist", param->arg_info->class_name);
|
||||
return;
|
||||
}
|
||||
free_alloca(lcname);
|
||||
zend_reflection_class_factory(*pce, return_value TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
@@ -1760,7 +1758,7 @@ ZEND_METHOD(reflection_parameter, isArray)
|
||||
reflection_object *intern;
|
||||
parameter_reference *param;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(param);
|
||||
|
||||
RETVAL_BOOL(param->arg_info->array_type_hint);
|
||||
@@ -1774,7 +1772,7 @@ ZEND_METHOD(reflection_parameter, allowsNull)
|
||||
reflection_object *intern;
|
||||
parameter_reference *param;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(param);
|
||||
|
||||
RETVAL_BOOL(param->arg_info->allow_null);
|
||||
@@ -1788,7 +1786,7 @@ ZEND_METHOD(reflection_parameter, isPassedByReference)
|
||||
reflection_object *intern;
|
||||
parameter_reference *param;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(param);
|
||||
|
||||
RETVAL_BOOL(param->arg_info->pass_by_reference);
|
||||
@@ -1802,7 +1800,7 @@ ZEND_METHOD(reflection_parameter, isOptional)
|
||||
reflection_object *intern;
|
||||
parameter_reference *param;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(param);
|
||||
|
||||
RETVAL_BOOL(param->offset >= param->required);
|
||||
@@ -1817,7 +1815,7 @@ ZEND_METHOD(reflection_parameter, isDefaultValueAvailable)
|
||||
parameter_reference *param;
|
||||
zend_op *precv;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(param);
|
||||
|
||||
if (param->fptr->type != ZEND_USER_FUNCTION)
|
||||
@@ -1844,7 +1842,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
|
||||
zend_op *precv;
|
||||
zval *zv, zv_copy;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(param);
|
||||
|
||||
if (param->fptr->type != ZEND_USER_FUNCTION)
|
||||
@@ -1864,7 +1862,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
|
||||
|
||||
zv_copy = precv->op2.u.constant;
|
||||
zv = &zv_copy;
|
||||
zval_update_constant(&zv, (void*)1 TSRMLS_CC);
|
||||
zval_update_constant(&zv, (void*)0 TSRMLS_CC);
|
||||
RETURN_ZVAL(zv, 1, 1);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1953,7 +1951,7 @@ ZEND_METHOD(reflection_method, __toString)
|
||||
zend_function *mptr;
|
||||
string str;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(mptr);
|
||||
string_init(&str);
|
||||
_function_string(&str, mptr, "" TSRMLS_CC);
|
||||
@@ -1976,7 +1974,7 @@ ZEND_METHOD(reflection_method, invoke)
|
||||
zend_fcall_info_cache fcc;
|
||||
zend_class_entry *obj_ce;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_method_ptr);
|
||||
|
||||
if (argc < 1) {
|
||||
zend_error(E_WARNING, "Invoke() expects at least one parameter, none given");
|
||||
@@ -2080,7 +2078,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
|
||||
zend_class_entry *obj_ce;
|
||||
zval *param_array;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_method_ptr);
|
||||
|
||||
GET_REFLECTION_OBJECT_PTR(mptr);
|
||||
|
||||
@@ -2223,7 +2221,7 @@ ZEND_METHOD(reflection_method, isConstructor)
|
||||
reflection_object *intern;
|
||||
zend_function *mptr;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(mptr);
|
||||
/* we need to check if the ctor is the ctor of the class level we we
|
||||
* looking at since we might be looking at an inherited old style ctor
|
||||
@@ -2239,7 +2237,7 @@ ZEND_METHOD(reflection_method, isDestructor)
|
||||
reflection_object *intern;
|
||||
zend_function *mptr;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(mptr);
|
||||
RETURN_BOOL(mptr->common.fn_flags & ZEND_ACC_DTOR);
|
||||
}
|
||||
@@ -2252,7 +2250,7 @@ ZEND_METHOD(reflection_method, getModifiers)
|
||||
reflection_object *intern;
|
||||
zend_function *mptr;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(mptr);
|
||||
|
||||
RETURN_LONG(mptr->common.fn_flags);
|
||||
@@ -2266,7 +2264,7 @@ ZEND_METHOD(reflection_method, getDeclaringClass)
|
||||
reflection_object *intern;
|
||||
zend_function *mptr;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_method_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(mptr);
|
||||
|
||||
zend_reflection_class_factory(mptr->common.scope, return_value TSRMLS_CC);
|
||||
@@ -2350,7 +2348,7 @@ ZEND_METHOD(reflection_class, getStaticProperties)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
|
||||
zend_update_class_constants(ce TSRMLS_CC);
|
||||
@@ -2436,7 +2434,7 @@ ZEND_METHOD(reflection_class, getDefaultProperties)
|
||||
zend_class_entry *ce;
|
||||
int count;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
array_init(return_value);
|
||||
|
||||
@@ -2456,7 +2454,7 @@ ZEND_METHOD(reflection_class, getDefaultProperties)
|
||||
|
||||
zend_hash_get_current_key_ex(&ce->default_properties, &key, &key_len, &num_index, 0, &pos);
|
||||
zend_hash_move_forward_ex(&ce->default_properties, &pos);
|
||||
zend_unmangle_property_name(key, &class_name, &prop_name);
|
||||
zend_unmangle_property_name_ex(key, key_len, &class_name, &prop_name);
|
||||
if (class_name && class_name[0] != '*' && strcmp(class_name, ce->name)) {
|
||||
/* filter privates from base classes */
|
||||
continue;
|
||||
@@ -2482,7 +2480,7 @@ ZEND_METHOD(reflection_class, __toString)
|
||||
zend_class_entry *ce;
|
||||
string str;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
string_init(&str);
|
||||
_class_string(&str, ce, intern->obj, "" TSRMLS_CC);
|
||||
@@ -2494,7 +2492,7 @@ ZEND_METHOD(reflection_class, __toString)
|
||||
Returns the class' name */
|
||||
ZEND_METHOD(reflection_class, getName)
|
||||
{
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2506,7 +2504,7 @@ ZEND_METHOD(reflection_class, isInternal)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
RETURN_BOOL(ce->type == ZEND_INTERNAL_CLASS);
|
||||
}
|
||||
@@ -2519,7 +2517,7 @@ ZEND_METHOD(reflection_class, isUserDefined)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
RETURN_BOOL(ce->type == ZEND_USER_CLASS);
|
||||
}
|
||||
@@ -2532,7 +2530,7 @@ ZEND_METHOD(reflection_class, getFileName)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
if (ce->type == ZEND_USER_CLASS) {
|
||||
RETURN_STRING(ce->filename, 1);
|
||||
@@ -2548,7 +2546,7 @@ ZEND_METHOD(reflection_class, getStartLine)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
if (ce->type == ZEND_USER_FUNCTION) {
|
||||
RETURN_LONG(ce->line_start);
|
||||
@@ -2564,7 +2562,7 @@ ZEND_METHOD(reflection_class, getEndLine)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
if (ce->type == ZEND_USER_CLASS) {
|
||||
RETURN_LONG(ce->line_end);
|
||||
@@ -2580,7 +2578,7 @@ ZEND_METHOD(reflection_class, getDocComment)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
if (ce->type == ZEND_USER_CLASS && ce->doc_comment) {
|
||||
RETURN_STRINGL(ce->doc_comment, ce->doc_comment_len, 1);
|
||||
@@ -2596,7 +2594,7 @@ ZEND_METHOD(reflection_class, getConstructor)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
|
||||
if (ce->constructor) {
|
||||
@@ -2616,7 +2614,7 @@ ZEND_METHOD(reflection_class, hasMethod)
|
||||
char *name, *lc_name;
|
||||
int name_len;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2643,7 +2641,7 @@ ZEND_METHOD(reflection_class, getMethod)
|
||||
char *name, *lc_name;
|
||||
int name_len;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2689,7 +2687,7 @@ ZEND_METHOD(reflection_class, getMethods)
|
||||
long filter = 0;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
if (argc) {
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "|l", &filter) == FAILURE) {
|
||||
return;
|
||||
@@ -2716,7 +2714,7 @@ ZEND_METHOD(reflection_class, hasProperty)
|
||||
int name_len;
|
||||
zval *property;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2750,7 +2748,7 @@ ZEND_METHOD(reflection_class, getProperty)
|
||||
char *name;
|
||||
int name_len;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2797,7 +2795,7 @@ ZEND_METHOD(reflection_class, getProperties)
|
||||
long filter = 0;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
if (argc) {
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "|l", &filter) == FAILURE) {
|
||||
return;
|
||||
@@ -2823,7 +2821,7 @@ ZEND_METHOD(reflection_class, hasConstant)
|
||||
char *name;
|
||||
int name_len;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2845,7 +2843,7 @@ ZEND_METHOD(reflection_class, getConstants)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
array_init(return_value);
|
||||
zend_hash_apply_with_argument(&ce->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
|
||||
@@ -2863,7 +2861,7 @@ ZEND_METHOD(reflection_class, getConstant)
|
||||
char *name;
|
||||
int name_len;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2884,7 +2882,7 @@ static void _class_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
RETVAL_BOOL(ce->ce_flags & mask);
|
||||
}
|
||||
@@ -2897,9 +2895,9 @@ ZEND_METHOD(reflection_class, isInstantiable)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_ABSTRACT)) {
|
||||
if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2944,7 +2942,7 @@ ZEND_METHOD(reflection_class, getModifiers)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
|
||||
RETURN_LONG(ce->ce_flags);
|
||||
@@ -2959,7 +2957,7 @@ ZEND_METHOD(reflection_class, isInstance)
|
||||
zend_class_entry *ce;
|
||||
zval *object;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &object) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2977,7 +2975,7 @@ ZEND_METHOD(reflection_class, newInstance)
|
||||
zend_class_entry *ce;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
|
||||
object_init_ex(return_value, ce);
|
||||
@@ -3035,7 +3033,7 @@ ZEND_METHOD(reflection_class, getInterfaces)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
|
||||
/* Return an empty array if this class implements no interfaces */
|
||||
@@ -3061,7 +3059,7 @@ ZEND_METHOD(reflection_class, getParentClass)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
|
||||
if (ce->parent) {
|
||||
@@ -3080,7 +3078,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
|
||||
zend_class_entry *ce, **pce, *class_ce;
|
||||
zval *class_name;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &class_name) == FAILURE) {
|
||||
@@ -3126,7 +3124,7 @@ ZEND_METHOD(reflection_class, implementsInterface)
|
||||
zend_class_entry *ce, *interface_ce, **pce;
|
||||
zval *interface;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &interface) == FAILURE) {
|
||||
@@ -3175,7 +3173,7 @@ ZEND_METHOD(reflection_class, isIterateable)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
|
||||
RETURN_BOOL(ce->get_iterator != NULL);
|
||||
@@ -3189,7 +3187,7 @@ ZEND_METHOD(reflection_class, getExtension)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
|
||||
if (ce->module) {
|
||||
@@ -3205,7 +3203,7 @@ ZEND_METHOD(reflection_class, getExtensionName)
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_class_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
|
||||
if (ce->module) {
|
||||
@@ -3310,7 +3308,7 @@ ZEND_METHOD(reflection_property, __construct)
|
||||
ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
|
||||
zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL);
|
||||
|
||||
zend_unmangle_property_name(property_info->name, &class_name, &prop_name);
|
||||
zend_unmangle_property_name_ex(property_info->name, property_info->name_length, &class_name, &prop_name);
|
||||
MAKE_STD_ZVAL(propname);
|
||||
ZVAL_STRING(propname, prop_name, 1);
|
||||
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &propname, sizeof(zval *), NULL);
|
||||
@@ -3332,7 +3330,7 @@ ZEND_METHOD(reflection_property, __toString)
|
||||
property_reference *ref;
|
||||
string str;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ref);
|
||||
string_init(&str);
|
||||
_property_string(&str, ref->prop, NULL, "" TSRMLS_CC);
|
||||
@@ -3344,7 +3342,7 @@ ZEND_METHOD(reflection_property, __toString)
|
||||
Returns the class' name */
|
||||
ZEND_METHOD(reflection_property, getName)
|
||||
{
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
|
||||
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -3354,7 +3352,7 @@ static void _property_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
|
||||
reflection_object *intern;
|
||||
property_reference *ref;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ref);
|
||||
RETURN_BOOL(ref->prop->flags & mask);
|
||||
}
|
||||
@@ -3406,7 +3404,7 @@ ZEND_METHOD(reflection_property, getModifiers)
|
||||
reflection_object *intern;
|
||||
property_reference *ref;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ref);
|
||||
|
||||
RETURN_LONG(ref->prop->flags);
|
||||
@@ -3422,7 +3420,7 @@ ZEND_METHOD(reflection_property, getValue)
|
||||
zval *object;
|
||||
zval **member= NULL;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_property_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(ref);
|
||||
|
||||
if (!(ref->prop->flags & ZEND_ACC_PUBLIC)) {
|
||||
@@ -3448,6 +3446,7 @@ ZEND_METHOD(reflection_property, getValue)
|
||||
|
||||
*return_value= **member;
|
||||
zval_copy_ctor(return_value);
|
||||
INIT_PZVAL(return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -3464,7 +3463,7 @@ ZEND_METHOD(reflection_property, setValue)
|
||||
zval *tmp;
|
||||
HashTable *prop_table;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
METHOD_NOTSTATIC(reflection_property_ptr);
|
||||
GET_REFLECTION_OBJECT_PTR(ref);
|
||||
|
||||
if (ref->prop->flags & ~(ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)) {
|
||||
@@ -3478,6 +3477,7 @@ ZEND_METHOD(reflection_property, setValue)
|
||||
return;
|
||||
}
|
||||
}
|
||||
zend_update_class_constants(intern->ce TSRMLS_CC);
|
||||
prop_table = intern->ce->static_members;
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oz", &object, &value) == FAILURE) {
|
||||
@@ -3522,7 +3522,7 @@ ZEND_METHOD(reflection_property, getDeclaringClass)
|
||||
reflection_object *intern;
|
||||
property_reference *ref;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ref);
|
||||
|
||||
zend_reflection_class_factory(ref->ce, return_value TSRMLS_CC);
|
||||
@@ -3535,7 +3535,7 @@ ZEND_METHOD(reflection_property, getDocComment)
|
||||
reflection_object *intern;
|
||||
property_reference *ref;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(ref);
|
||||
if (ref->prop->doc_comment) {
|
||||
RETURN_STRINGL(ref->prop->doc_comment, ref->prop->doc_comment_len, 1);
|
||||
@@ -3598,7 +3598,7 @@ ZEND_METHOD(reflection_extension, __toString)
|
||||
zend_module_entry *module;
|
||||
string str;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(module);
|
||||
string_init(&str);
|
||||
_extension_string(&str, module, "" TSRMLS_CC);
|
||||
@@ -3610,7 +3610,7 @@ ZEND_METHOD(reflection_extension, __toString)
|
||||
Returns this extension's name */
|
||||
ZEND_METHOD(reflection_extension, getName)
|
||||
{
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
|
||||
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -3622,7 +3622,7 @@ ZEND_METHOD(reflection_extension, getVersion)
|
||||
reflection_object *intern;
|
||||
zend_module_entry *module;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(module);
|
||||
|
||||
/* An extension does not necessarily have a version number */
|
||||
@@ -3641,7 +3641,7 @@ ZEND_METHOD(reflection_extension, getFunctions)
|
||||
reflection_object *intern;
|
||||
zend_module_entry *module;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(module);
|
||||
|
||||
array_init(return_value);
|
||||
@@ -3689,7 +3689,7 @@ ZEND_METHOD(reflection_extension, getConstants)
|
||||
reflection_object *intern;
|
||||
zend_module_entry *module;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(module);
|
||||
|
||||
array_init(return_value);
|
||||
@@ -3721,7 +3721,7 @@ ZEND_METHOD(reflection_extension, getINIEntries)
|
||||
reflection_object *intern;
|
||||
zend_module_entry *module;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(module);
|
||||
|
||||
array_init(return_value);
|
||||
@@ -3757,7 +3757,7 @@ ZEND_METHOD(reflection_extension, getClasses)
|
||||
reflection_object *intern;
|
||||
zend_module_entry *module;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(module);
|
||||
|
||||
array_init(return_value);
|
||||
@@ -3772,7 +3772,7 @@ ZEND_METHOD(reflection_extension, getClassNames)
|
||||
reflection_object *intern;
|
||||
zend_module_entry *module;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
|
||||
GET_REFLECTION_OBJECT_PTR(module);
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
+111
-67
@@ -13,6 +13,8 @@
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
| Dmitry Stogov <dmitry@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@@ -1051,7 +1053,7 @@ ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMP|VAR|CV)
|
||||
ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
zend_free_op free_op1, free_op2;
|
||||
@@ -1075,13 +1077,17 @@ ZEND_VM_HANDLER(90, ZEND_FETCH_DIM_IS, VAR|CV, CONST|TMP|VAR|CV)
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|CV)
|
||||
ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
zend_free_op free_op1, free_op2;
|
||||
int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R;
|
||||
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
zval *dim;
|
||||
|
||||
if (OP2_TYPE == IS_UNUSED && type == BP_VAR_R) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_ZVAL_PTR_PTR(type), dim, IS_OP2_TMP_FREE(), type TSRMLS_CC);
|
||||
FREE_OP2();
|
||||
FREE_OP1_VAR_PTR();
|
||||
@@ -1092,6 +1098,7 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMP|VAR|CV)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_UNSET);
|
||||
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
/* Not needed in DIM_UNSET
|
||||
@@ -1099,7 +1106,12 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMP|VAR|CV)
|
||||
PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr);
|
||||
}
|
||||
*/
|
||||
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_ZVAL_PTR_PTR(BP_VAR_UNSET), dim, IS_OP2_TMP_FREE(), BP_VAR_UNSET TSRMLS_CC);
|
||||
if (OP1_TYPE == IS_CV) {
|
||||
if (container != &EG(uninitialized_zval_ptr)) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(container);
|
||||
}
|
||||
}
|
||||
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_UNSET TSRMLS_CC);
|
||||
FREE_OP2();
|
||||
FREE_OP1_VAR_PTR();
|
||||
if (EX_T(opline->result.u.var).var.ptr_ptr == NULL) {
|
||||
@@ -1257,12 +1269,18 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
zend_free_op free_op1, free_op2, free_res;
|
||||
zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_R);
|
||||
zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
if (OP1_TYPE == IS_CV) {
|
||||
if (container != &EG(uninitialized_zval_ptr)) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(container);
|
||||
}
|
||||
}
|
||||
if (IS_OP2_TMP_FREE()) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_R), property, BP_VAR_R TSRMLS_CC);
|
||||
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_R TSRMLS_CC);
|
||||
if (IS_OP2_TMP_FREE()) {
|
||||
zval_ptr_dtor(&property);
|
||||
} else {
|
||||
@@ -1615,7 +1633,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
int function_name_strlen;
|
||||
zend_free_op free_op1, free_op2;
|
||||
|
||||
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
|
||||
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
|
||||
|
||||
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
@@ -1626,8 +1644,6 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
function_name_strval = function_name->value.str.val;
|
||||
function_name_strlen = function_name->value.str.len;
|
||||
|
||||
EX(calling_scope) = EG(scope);
|
||||
|
||||
EX(object) = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
if (EX(object) && EX(object)->type == IS_OBJECT) {
|
||||
@@ -1658,12 +1674,6 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
}
|
||||
}
|
||||
|
||||
if (EX(fbc)->type == ZEND_USER_FUNCTION) {
|
||||
EX(calling_scope) = EX(fbc)->common.scope;
|
||||
} else {
|
||||
EX(calling_scope) = NULL;
|
||||
}
|
||||
|
||||
FREE_OP2();
|
||||
FREE_OP1_IF_VAR();
|
||||
|
||||
@@ -1676,7 +1686,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV)
|
||||
zval *function_name;
|
||||
zend_class_entry *ce;
|
||||
|
||||
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
|
||||
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
|
||||
|
||||
ce = EX_T(opline->op1.u.var).class_entry;
|
||||
if(OP2_TYPE != IS_UNUSED) {
|
||||
@@ -1711,8 +1721,6 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV)
|
||||
EX(fbc) = ce->constructor;
|
||||
}
|
||||
|
||||
EX(calling_scope) = EX(fbc)->common.scope;
|
||||
|
||||
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
EX(object) = NULL;
|
||||
} else {
|
||||
@@ -1733,7 +1741,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
|
||||
int function_name_strlen;
|
||||
zend_free_op free_op2;
|
||||
|
||||
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
|
||||
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
|
||||
|
||||
if (OP2_TYPE == IS_CONST) {
|
||||
function_name_strval = opline->op2.u.constant.value.str.val;
|
||||
@@ -1759,7 +1767,6 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
|
||||
FREE_OP2();
|
||||
}
|
||||
|
||||
EX(calling_scope) = function->common.scope;
|
||||
EX(object) = NULL;
|
||||
|
||||
EX(fbc) = function;
|
||||
@@ -1776,6 +1783,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
zval *current_this;
|
||||
int return_value_used = RETURN_VALUE_USED(opline);
|
||||
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);
|
||||
@@ -1792,7 +1800,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
current_this = EG(This);
|
||||
EG(This) = EX(object);
|
||||
current_scope = EG(scope);
|
||||
EG(scope) = EX(calling_scope);
|
||||
EG(scope) = (EX(function_state).function->type == ZEND_USER_FUNCTION || !EX(object)) ? EX(function_state).function->common.scope : NULL;
|
||||
} else {
|
||||
should_change_scope = 0;
|
||||
}
|
||||
@@ -1814,6 +1822,8 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
}
|
||||
}
|
||||
if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) {
|
||||
unsigned char return_reference = EX(function_state).function->common.return_reference;
|
||||
|
||||
ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
|
||||
INIT_ZVAL(*(EX_T(opline->result.u.var).var.ptr));
|
||||
|
||||
@@ -1838,16 +1848,20 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
}
|
||||
|
||||
EG(current_execute_data) = EXECUTE_DATA;
|
||||
|
||||
/* We shouldn't fix bad extensions here,
|
||||
because it can break proper ones (Bug #34045)
|
||||
if (!EX(function_state).function->common.return_reference) {
|
||||
EX_T(opline->result.u.var).var.ptr->is_ref = 0;
|
||||
EX_T(opline->result.u.var).var.ptr->refcount = 1;
|
||||
}
|
||||
*/
|
||||
if (!return_value_used) {
|
||||
zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
|
||||
} else {
|
||||
EX_T(opline->result.u.var).var.fcall_returned_reference = return_reference;
|
||||
}
|
||||
} else if (EX(function_state).function->type == ZEND_USER_FUNCTION) {
|
||||
HashTable *calling_symbol_table;
|
||||
|
||||
EX_T(opline->result.u.var).var.ptr = NULL;
|
||||
if (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
|
||||
/*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/
|
||||
@@ -1857,7 +1871,6 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
zend_hash_init(EX(function_state).function_symbol_table, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
/*printf("Cache miss! Initialized %x\n", function_state.function_symbol_table);*/
|
||||
}
|
||||
calling_symbol_table = EG(active_symbol_table);
|
||||
EG(active_symbol_table) = EX(function_state).function_symbol_table;
|
||||
original_return_value = EG(return_value_ptr_ptr);
|
||||
EG(return_value_ptr_ptr) = EX_T(opline->result.u.var).var.ptr_ptr;
|
||||
@@ -1887,7 +1900,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
zend_hash_clean(EX(function_state).function_symbol_table);
|
||||
*(++EG(symtable_cache_ptr)) = EX(function_state).function_symbol_table;
|
||||
}
|
||||
EG(active_symbol_table) = calling_symbol_table;
|
||||
EG(active_symbol_table) = EX(symbol_table);
|
||||
} else { /* ZEND_OVERLOADED_FUNCTION */
|
||||
ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
|
||||
INIT_ZVAL(*(EX_T(opline->result.u.var).var.ptr));
|
||||
@@ -1912,16 +1925,18 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
}
|
||||
}
|
||||
|
||||
ctor_opline = (zend_op*)zend_ptr_stack_pop(&EG(arg_types_stack));
|
||||
|
||||
if (EG(This)) {
|
||||
if (EG(exception) && EX(fbc) && EX(fbc)->common.fn_flags&ZEND_ACC_CTOR) {
|
||||
EG(This)->refcount--;
|
||||
if (EG(exception) && ctor_opline) {
|
||||
if (RETURN_VALUE_USED(ctor_opline)) {
|
||||
EG(This)->refcount--;
|
||||
}
|
||||
if (EG(This)->refcount == 1) {
|
||||
zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
|
||||
}
|
||||
if (should_change_scope && EG(This) != current_this) {
|
||||
zval_ptr_dtor(&EG(This));
|
||||
}
|
||||
} else if (should_change_scope) {
|
||||
}
|
||||
if (should_change_scope) {
|
||||
zval_ptr_dtor(&EG(This));
|
||||
}
|
||||
}
|
||||
@@ -1930,7 +1945,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
EG(This) = current_this;
|
||||
EG(scope) = current_scope;
|
||||
}
|
||||
zend_ptr_stack_3_pop(&EG(arg_types_stack), (void**)&EX(calling_scope), (void**)&EX(object), (void**)&EX(fbc));
|
||||
zend_ptr_stack_2_pop(&EG(arg_types_stack), (void**)&EX(object), (void**)&EX(fbc));
|
||||
|
||||
EX(function_state).function = (zend_function *) EX(op_array);
|
||||
EG(function_state_ptr) = &EX(function_state);
|
||||
@@ -1958,13 +1973,12 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY)
|
||||
zend_free_op free_op1;
|
||||
zval *fname = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
|
||||
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
|
||||
|
||||
if (zend_hash_find(EG(function_table), fname->value.str.val, fname->value.str.len+1, (void **) &EX(function_state).function)==FAILURE) {
|
||||
zend_error_noreturn(E_ERROR, "Unknown function: %s()\n", fname->value.str.val);
|
||||
zend_error_noreturn(E_ERROR, "Unknown function: %s()", fname->value.str.val);
|
||||
}
|
||||
EX(object) = NULL;
|
||||
EX(calling_scope) = EX(function_state).function->common.scope;
|
||||
|
||||
FREE_OP1();
|
||||
|
||||
@@ -2163,6 +2177,9 @@ ZEND_VM_HELPER(zend_send_by_var_helper, VAR|CV, ANY)
|
||||
ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
zend_free_op free_op1;
|
||||
zval *varptr;
|
||||
|
||||
if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */
|
||||
if (!(opline->extended_value & ZEND_ARG_SEND_BY_REF)) {
|
||||
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper);
|
||||
@@ -2170,23 +2187,27 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
|
||||
} else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) {
|
||||
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper);
|
||||
}
|
||||
if ((opline->extended_value & ZEND_ARG_SEND_FUNCTION) &&
|
||||
!EX_T(opline->op1.u.var).var.fcall_returned_reference) {
|
||||
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference");
|
||||
|
||||
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
|
||||
EX_T(opline->op1.u.var).var.fcall_returned_reference) &&
|
||||
varptr != &EG(uninitialized_zval) &&
|
||||
(PZVAL_IS_REF(varptr) || varptr->refcount == 1)) {
|
||||
varptr->is_ref = 1;
|
||||
varptr->refcount++;
|
||||
zend_ptr_stack_push(&EG(argument_stack), varptr);
|
||||
} else {
|
||||
zval *varptr;
|
||||
zend_free_op free_op1;
|
||||
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
zval *valptr;
|
||||
|
||||
if (varptr != &EG(uninitialized_zval) && (PZVAL_IS_REF(varptr) || varptr->refcount == 1)) {
|
||||
varptr->is_ref = 1;
|
||||
varptr->refcount++;
|
||||
zend_ptr_stack_push(&EG(argument_stack), varptr);
|
||||
FREE_OP1_IF_VAR();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
zend_error(E_STRICT, "Only variables should be passed by reference");
|
||||
ALLOC_ZVAL(valptr);
|
||||
INIT_PZVAL_COPY(valptr, varptr);
|
||||
if (!IS_OP1_TMP_FREE()) {
|
||||
zval_copy_ctor(valptr);
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference");
|
||||
zend_ptr_stack_push(&EG(argument_stack), valptr);
|
||||
}
|
||||
FREE_OP1_IF_VAR();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
@@ -2414,17 +2435,12 @@ ZEND_VM_HANDLER(68, ZEND_NEW, ANY, ANY)
|
||||
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
|
||||
EX_T(opline->result.u.var).var.ptr = object_zval;
|
||||
|
||||
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
|
||||
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), opline);
|
||||
|
||||
/* We are not handling overloaded classes right now */
|
||||
EX(object) = object_zval;
|
||||
EX(fbc) = constructor;
|
||||
|
||||
if (constructor->type == ZEND_USER_FUNCTION) { /* HACK!! */
|
||||
EX(calling_scope) = constructor->common.scope;
|
||||
} else {
|
||||
EX(calling_scope) = NULL;
|
||||
}
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
}
|
||||
@@ -2718,7 +2734,6 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
|
||||
if (inc_filename==&tmp_inc_filename) {
|
||||
zval_dtor(&tmp_inc_filename);
|
||||
}
|
||||
FREE_OP1();
|
||||
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
|
||||
if (new_op_array) {
|
||||
zval *saved_object;
|
||||
@@ -2768,6 +2783,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
|
||||
EX_T(opline->result.u.var).var.ptr->type = IS_BOOL;
|
||||
}
|
||||
}
|
||||
FREE_OP1();
|
||||
EG(return_value_ptr_ptr) = original_return_value;
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
@@ -2799,12 +2815,14 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, ANY)
|
||||
do {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ex->op_array->last_var; i++) {
|
||||
if (ex->op_array->vars[i].hash_value == hash_value &&
|
||||
ex->op_array->vars[i].name_len == varname->value.str.len &&
|
||||
!memcmp(ex->op_array->vars[i].name, varname->value.str.val, varname->value.str.len)) {
|
||||
ex->CVs[i] = NULL;
|
||||
break;
|
||||
if (ex->op_array) {
|
||||
for (i = 0; i < ex->op_array->last_var; i++) {
|
||||
if (ex->op_array->vars[i].hash_value == hash_value &&
|
||||
ex->op_array->vars[i].name_len == varname->value.str.len &&
|
||||
!memcmp(ex->op_array->vars[i].name, varname->value.str.val, varname->value.str.len)) {
|
||||
ex->CVs[i] = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ex = ex->prev_execute_data;
|
||||
@@ -2855,7 +2873,7 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
ulong hash_value = zend_inline_hash_func(offset->value.str.val, offset->value.str.len+1);
|
||||
|
||||
for (ex = EXECUTE_DATA; ex; ex = ex->prev_execute_data) {
|
||||
if (ex->symbol_table == ht) {
|
||||
if (ex->op_array && ex->symbol_table == ht) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ex->op_array->last_var; i++) {
|
||||
@@ -3100,7 +3118,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
||||
zend_hash_move_forward(fe_ht);
|
||||
} while (key_type != HASH_KEY_IS_STRING || zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS);
|
||||
if (use_key) {
|
||||
zend_unmangle_property_name(str_key, &class_name, &prop_name);
|
||||
zend_unmangle_property_name_ex(str_key, str_key_len, &class_name, &prop_name);
|
||||
str_key_len = strlen(prop_name);
|
||||
str_key = estrndup(prop_name, str_key_len);
|
||||
str_key_len++;
|
||||
@@ -3415,10 +3433,16 @@ ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV, ANY)
|
||||
ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
|
||||
|
||||
EX_T(opline->result.u.var).tmp_var.value.lval = EG(error_reporting);
|
||||
EX_T(opline->result.u.var).tmp_var.type = IS_LONG; /* shouldn't be necessary */
|
||||
zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
|
||||
if (EX(old_error_reporting) == NULL) {
|
||||
EX(old_error_reporting) = &EX_T(opline->result.u.var).tmp_var;
|
||||
}
|
||||
|
||||
if (EG(error_reporting)) {
|
||||
zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
|
||||
}
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
@@ -3433,13 +3457,16 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
|
||||
zend_op *opline = EX(opline);
|
||||
zval restored_error_reporting;
|
||||
|
||||
if (!EG(error_reporting)) {
|
||||
if (!EG(error_reporting) && EX_T(opline->op1.u.var).tmp_var.value.lval != 0) {
|
||||
restored_error_reporting.type = IS_LONG;
|
||||
restored_error_reporting.value.lval = EX_T(opline->op1.u.var).tmp_var.value.lval;
|
||||
convert_to_string(&restored_error_reporting);
|
||||
zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
|
||||
zendi_zval_dtor(restored_error_reporting);
|
||||
}
|
||||
if (EX(old_error_reporting) == &EX_T(opline->op1.u.var).tmp_var) {
|
||||
EX(old_error_reporting) = NULL;
|
||||
}
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
@@ -3566,11 +3593,13 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
|
||||
int i;
|
||||
int encapsulating_block=-1;
|
||||
zval **stack_zval_pp;
|
||||
zval restored_error_reporting;
|
||||
|
||||
stack_zval_pp = (zval **) EG(argument_stack).top_element - 1;
|
||||
while (*stack_zval_pp != NULL) {
|
||||
zval_ptr_dtor(stack_zval_pp);
|
||||
EG(argument_stack).top_element--;
|
||||
EG(argument_stack).top--;
|
||||
stack_zval_pp--;
|
||||
}
|
||||
|
||||
@@ -3586,12 +3615,27 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
|
||||
}
|
||||
|
||||
while (EX(fbc)) {
|
||||
zend_op *ctor_opline = (zend_op*)zend_ptr_stack_pop(&EG(arg_types_stack));
|
||||
|
||||
if (EX(object)) {
|
||||
if (ctor_opline && RETURN_VALUE_USED(ctor_opline)) {
|
||||
EX(object)->refcount--;
|
||||
}
|
||||
zval_ptr_dtor(&EX(object));
|
||||
}
|
||||
zend_ptr_stack_n_pop(&EG(arg_types_stack), 3, &EX(calling_scope), &EX(object), &EX(fbc));
|
||||
zend_ptr_stack_2_pop(&EG(arg_types_stack), (void**)&EX(object), (void**)&EX(fbc));
|
||||
}
|
||||
|
||||
/* restore previous error_reporting value */
|
||||
if (!EG(error_reporting) && EX(old_error_reporting) != NULL && EX(old_error_reporting)->value.lval != 0) {
|
||||
restored_error_reporting.type = IS_LONG;
|
||||
restored_error_reporting.value.lval = EX(old_error_reporting)->value.lval;
|
||||
convert_to_string(&restored_error_reporting);
|
||||
zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
|
||||
zendi_zval_dtor(restored_error_reporting);
|
||||
}
|
||||
EX(old_error_reporting) = NULL;
|
||||
|
||||
if (encapsulating_block == -1) {
|
||||
ZEND_VM_RETURN_FROM_EXECUTE_LOOP();
|
||||
} else {
|
||||
|
||||
+420
-301
File diff suppressed because it is too large.
Load diff
@@ -10,6 +10,7 @@ ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC)
|
||||
/* Initialize execute_data */
|
||||
EX(fbc) = NULL;
|
||||
EX(object) = NULL;
|
||||
EX(old_error_reporting) = NULL;
|
||||
if (op_array->T < TEMP_VAR_STACK_LIMIT) {
|
||||
EX(Ts) = (temp_variable *) do_alloca(sizeof(temp_variable) * op_array->T);
|
||||
} else {
|
||||
|
||||
+21
-2
@@ -1,4 +1,23 @@
|
||||
<?php
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2005 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.zend.com/license/2_00.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Dmitry Stogov <dmitry@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
$header_text = <<< DATA
|
||||
/*
|
||||
@@ -16,11 +35,11 @@ $header_text = <<< DATA
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
| Dmitry Stogov <dmitry@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* \$Id$ */
|
||||
|
||||
|
||||
DATA;
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
| Dmitry Stogov <dmitry@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#define ZEND_NOP 0
|
||||
#define ZEND_ADD 1
|
||||
#define ZEND_SUB 2
|
||||
|
||||
+81
-83
@@ -255,14 +255,14 @@ dnl append to the array which has been dynamically chosen at m4 time
|
||||
|
||||
dnl choose the right compiler/flags/etc. for the source-file
|
||||
case $ac_src in
|
||||
*.c[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
|
||||
*.s[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
|
||||
*.S[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
|
||||
*.cpp|*.cc|*.cxx[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;;
|
||||
*.c[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
|
||||
*.s[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
|
||||
*.S[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
|
||||
*.cpp|*.cc|*.cxx[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;;
|
||||
esac
|
||||
|
||||
dnl create a rule for the object/source combo
|
||||
cat >>Makefile.objects<<EOF
|
||||
cat >>Makefile.objects<<EOF
|
||||
$ac_bdir[$]ac_obj.lo: $ac_srcdir[$]ac_src
|
||||
$ac_comp
|
||||
EOF
|
||||
@@ -301,27 +301,27 @@ dnl
|
||||
AC_DEFUN([PHP_RUNPATH_SWITCH],[
|
||||
AC_MSG_CHECKING([if compiler supports -R])
|
||||
AC_CACHE_VAL(php_cv_cc_dashr,[
|
||||
SAVE_LIBS=$LIBS
|
||||
LIBS="-R /usr/$PHP_LIBDIR $LIBS"
|
||||
AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
|
||||
LIBS=$SAVE_LIBS])
|
||||
SAVE_LIBS=$LIBS
|
||||
LIBS="-R /usr/$PHP_LIBDIR $LIBS"
|
||||
AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
|
||||
LIBS=$SAVE_LIBS])
|
||||
AC_MSG_RESULT([$php_cv_cc_dashr])
|
||||
if test $php_cv_cc_dashr = "yes"; then
|
||||
ld_runpath_switch=-R
|
||||
ld_runpath_switch=-R
|
||||
else
|
||||
AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
|
||||
AC_CACHE_VAL(php_cv_cc_rpath,[
|
||||
SAVE_LIBS=$LIBS
|
||||
LIBS="-Wl,-rpath,/usr/$PHP_LIBDIR $LIBS"
|
||||
AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
|
||||
LIBS=$SAVE_LIBS])
|
||||
AC_MSG_RESULT([$php_cv_cc_rpath])
|
||||
if test $php_cv_cc_rpath = "yes"; then
|
||||
ld_runpath_switch=-Wl,-rpath,
|
||||
else
|
||||
dnl something innocuous
|
||||
ld_runpath_switch=-L
|
||||
fi
|
||||
AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
|
||||
AC_CACHE_VAL(php_cv_cc_rpath,[
|
||||
SAVE_LIBS=$LIBS
|
||||
LIBS="-Wl,-rpath,/usr/$PHP_LIBDIR $LIBS"
|
||||
AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
|
||||
LIBS=$SAVE_LIBS])
|
||||
AC_MSG_RESULT([$php_cv_cc_rpath])
|
||||
if test $php_cv_cc_rpath = "yes"; then
|
||||
ld_runpath_switch=-Wl,-rpath,
|
||||
else
|
||||
dnl something innocuous
|
||||
ld_runpath_switch=-L
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -854,13 +854,9 @@ AC_DEFUN([PHP_SHARED_MODULE],[
|
||||
suffix=so
|
||||
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -Wl,-G -o '$3'/$1.la -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD) && mv -f '$3'/.libs/$1.so '$3'/$1.so'
|
||||
;;
|
||||
*darwin*[)]
|
||||
suffix=so
|
||||
link_cmd='ifelse($4,,[$(CC)],[$(CXX)]) -dynamic -flat_namespace -bundle -undefined suppress $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
|
||||
;;
|
||||
*netware*[)]
|
||||
suffix=nlm
|
||||
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -shared -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
|
||||
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -shared -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) ifelse($1, php5lib, , -L$(top_builddir)/netware -lphp5lib) $(translit(ifelse($1, php5lib, $1, m4_substr($1, 3)),a-z_-,A-Z__)_SHARED_LIBADD)'
|
||||
;;
|
||||
*[)]
|
||||
suffix=la
|
||||
@@ -955,11 +951,13 @@ dnl ---------------------------------------------- Static module
|
||||
dnl ---------------------------------------------- Shared module
|
||||
PHP_ADD_SOURCES_X(PHP_EXT_DIR($1),$2,$ac_extra,shared_objects_$1,yes)
|
||||
case $host_alias in
|
||||
*netware*)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(php5lib, netware, translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
|
||||
;;
|
||||
*netware*[)]
|
||||
PHP_SHARED_MODULE(php$1,shared_objects_$1, $ext_builddir, $6)
|
||||
;;
|
||||
*[)]
|
||||
PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6)
|
||||
;;
|
||||
esac
|
||||
PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6)
|
||||
AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z__), 1, Whether to build $1 as dynamic module)
|
||||
fi
|
||||
fi
|
||||
@@ -1240,16 +1238,16 @@ AC_DEFUN([PHP_READDIR_R_TYPE],[
|
||||
#endif
|
||||
|
||||
main() {
|
||||
DIR *dir;
|
||||
char entry[sizeof(struct dirent)+PATH_MAX];
|
||||
struct dirent *pentry = (struct dirent *) &entry;
|
||||
DIR *dir;
|
||||
char entry[sizeof(struct dirent)+PATH_MAX];
|
||||
struct dirent *pentry = (struct dirent *) &entry;
|
||||
|
||||
dir = opendir("/");
|
||||
if (!dir)
|
||||
exit(1);
|
||||
if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0)
|
||||
exit(0);
|
||||
exit(1);
|
||||
dir = opendir("/");
|
||||
if (!dir)
|
||||
exit(1);
|
||||
if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0)
|
||||
exit(0);
|
||||
exit(1);
|
||||
}
|
||||
],[
|
||||
ac_cv_what_readdir_r=POSIX
|
||||
@@ -1380,17 +1378,17 @@ AC_DEFUN([PHP_AC_BROKEN_SNPRINTF],[
|
||||
AC_TRY_RUN([
|
||||
#define NULL (0L)
|
||||
main() {
|
||||
char buf[20];
|
||||
int res = 0;
|
||||
res = res || (snprintf(buf, 2, "marcus") != 6);
|
||||
res = res || (buf[1] != '\0');
|
||||
/* Implementations may consider this as an encoding error */
|
||||
snprintf(buf, 0, "boerger");
|
||||
/* However, they MUST ignore the pointer */
|
||||
res = res || (buf[0] != 'm');
|
||||
res = res || (snprintf(NULL, 0, "boerger") != 7);
|
||||
res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8);
|
||||
exit(res);
|
||||
char buf[20];
|
||||
int res = 0;
|
||||
res = res || (snprintf(buf, 2, "marcus") != 6);
|
||||
res = res || (buf[1] != '\0');
|
||||
/* Implementations may consider this as an encoding error */
|
||||
snprintf(buf, 0, "boerger");
|
||||
/* However, they MUST ignore the pointer */
|
||||
res = res || (buf[0] != 'm');
|
||||
res = res || (snprintf(NULL, 0, "boerger") != 7);
|
||||
res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8);
|
||||
exit(res);
|
||||
}
|
||||
],[
|
||||
ac_cv_broken_snprintf=no
|
||||
@@ -1421,14 +1419,16 @@ AC_DEFUN([PHP_SOLARIS_PIC_WEIRDNESS],[
|
||||
if test -n "$EXT_SHARED"; then
|
||||
os=`uname -sr 2>/dev/null`
|
||||
case $os in
|
||||
"SunOS 5.6"|"SunOS 5.7"[)]
|
||||
case $CC in
|
||||
gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";;
|
||||
*[)] CFLAGS="$CFLAGS -fpic";;
|
||||
esac
|
||||
AC_MSG_RESULT([yes]);;
|
||||
*[)]
|
||||
AC_MSG_RESULT([no]);;
|
||||
"SunOS 5.6"|"SunOS 5.7"[)]
|
||||
case $CC in
|
||||
gcc*|egcs*)
|
||||
CFLAGS="$CFLAGS -fPIC";;
|
||||
*[)]
|
||||
CFLAGS="$CFLAGS -fpic";;
|
||||
esac
|
||||
AC_MSG_RESULT([yes]);;
|
||||
*[)]
|
||||
AC_MSG_RESULT([no]);;
|
||||
esac
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
@@ -1562,10 +1562,10 @@ AC_DEFUN([PHP_BROKEN_GETCWD],[
|
||||
os=`uname -sr 2>/dev/null`
|
||||
case $os in
|
||||
SunOS*[)]
|
||||
AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd])
|
||||
AC_MSG_RESULT([yes]);;
|
||||
*[)]
|
||||
AC_MSG_RESULT([no]);;
|
||||
AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd])
|
||||
AC_MSG_RESULT([yes]);;
|
||||
*[)]
|
||||
AC_MSG_RESULT([no]);;
|
||||
esac
|
||||
])
|
||||
|
||||
@@ -1585,8 +1585,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
fp = fopen(filename, "w");
|
||||
if (fp == NULL) {
|
||||
perror("fopen");
|
||||
exit(2);
|
||||
perror("fopen");
|
||||
exit(2);
|
||||
}
|
||||
fputs("foobar", fp);
|
||||
fclose(fp);
|
||||
@@ -1596,7 +1596,7 @@ int main(int argc, char *argv[])
|
||||
fclose(fp);
|
||||
unlink(filename);
|
||||
if (position == 0)
|
||||
return 1;
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
],
|
||||
@@ -1614,10 +1614,10 @@ choke me
|
||||
)])
|
||||
|
||||
if test "$have_broken_glibc_fopen_append" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+])
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -1646,7 +1646,7 @@ AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
|
||||
struct cookiedata {
|
||||
__off64_t pos;
|
||||
__off64_t pos;
|
||||
};
|
||||
|
||||
__ssize_t reader(void *cookie, char *buffer, size_t size)
|
||||
@@ -1665,7 +1665,7 @@ main() {
|
||||
FILE *fp = fopencookie(&g, "r", funcs);
|
||||
|
||||
if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192)
|
||||
exit(0);
|
||||
exit(0);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -1899,14 +1899,14 @@ AC_DEFUN([PHP_C_BIGENDIAN],
|
||||
[
|
||||
int main(void)
|
||||
{
|
||||
short one = 1;
|
||||
char *cp = (char *)&one;
|
||||
short one = 1;
|
||||
char *cp = (char *)&one;
|
||||
|
||||
if (*cp == 0) {
|
||||
return(0);
|
||||
} else {
|
||||
return(1);
|
||||
}
|
||||
if (*cp == 0) {
|
||||
return(0);
|
||||
} else {
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown])
|
||||
])
|
||||
@@ -2035,8 +2035,6 @@ AC_DEFUN([PHP_PROG_RE2C],[
|
||||
php_cv_re2c_version="`echo "" | re2c --version | cut -d ' ' -f 2 2>/dev/null` (ok)"
|
||||
fi
|
||||
])
|
||||
else
|
||||
php_cv_re2c_version=none
|
||||
fi
|
||||
case $php_cv_re2c_version in
|
||||
""|invalid[)]
|
||||
@@ -2339,7 +2337,7 @@ AC_CACHE_CHECK([for xml2-config path], ac_cv_php_xml2_config_path,
|
||||
set $libxml_full_version
|
||||
IFS=$ac_IFS
|
||||
LIBXML_VERSION=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
|
||||
if test "$LIBXML_VERSION" -ge "2006000"; then
|
||||
if test "$LIBXML_VERSION" -ge "2006011"; then
|
||||
LIBXML_LIBS=`$XML2_CONFIG --libs`
|
||||
LIBXML_INCS=`$XML2_CONFIG --cflags`
|
||||
PHP_EVAL_LIBLINE($LIBXML_LIBS, $1)
|
||||
@@ -2362,7 +2360,7 @@ AC_CACHE_CHECK([for xml2-config path], ac_cv_php_xml2_config_path,
|
||||
fi
|
||||
$2
|
||||
else
|
||||
AC_MSG_ERROR([libxml2 version 2.6.0 or greater required.])
|
||||
AC_MSG_ERROR([libxml2 version 2.6.11 or greater required.])
|
||||
fi
|
||||
ifelse([$3],[],,[else $3])
|
||||
fi
|
||||
|
||||
+4
-6
@@ -42,7 +42,7 @@ AC_CONFIG_HEADER(main/php_config.h)
|
||||
MAJOR_VERSION=5
|
||||
MINOR_VERSION=1
|
||||
RELEASE_VERSION=0
|
||||
EXTRA_VERSION="-dev"
|
||||
EXTRA_VERSION="RC4"
|
||||
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
|
||||
|
||||
dnl Define where extension directories are located in the configure context
|
||||
@@ -875,13 +875,11 @@ if test "$PHP_PEAR" != "no"; then
|
||||
PEAR requires XML to be enabled. Add --enable-xml to the configure line. (or --without-pear)"
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl ext/xmlrpc is not really there yet to be a requirement..
|
||||
dnl
|
||||
dnl if test "$PHP_XMLRPC" = "no"; then
|
||||
dnl pear_error_msg="$pear_error_msg
|
||||
dnl PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line. (or --without-pear)"
|
||||
dnl fi
|
||||
dnl fi
|
||||
dnl
|
||||
|
||||
if test "$pear_error_msg"; then
|
||||
@@ -1183,7 +1181,7 @@ INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
|
||||
CXXFLAGS="$CXXFLAGS $standard_libtool_flag"
|
||||
|
||||
all_targets='$(OVERALL_TARGET) $(PHP_MODULES) $(PHP_CLI_TARGET)'
|
||||
install_targets="$install_modules $install_pear install-build install-headers install-programs"
|
||||
install_targets="$install_modules install-build install-headers install-programs $install_pear"
|
||||
|
||||
case $PHP_SAPI in
|
||||
cgi)
|
||||
@@ -1369,7 +1367,7 @@ X
|
||||
fi
|
||||
|
||||
# Warn about linking Apache with libpthread if oci8 extension is enabled on linux.
|
||||
if test "$PHP_OCI8" != "no" -o "$PHP_ORACLE" != "no"; then
|
||||
if test "$PHP_OCI8" != "no"; then
|
||||
if test "$PHP_SAPI" = "apache"; then
|
||||
if test `uname` = "Linux"; then
|
||||
cat <<X
|
||||
|
||||
+1
-1
@@ -441,7 +441,7 @@ PHP_FUNCTION(bzdecompress)
|
||||
char *source, *dest;
|
||||
int source_len, error;
|
||||
long small = 0;
|
||||
#if defined(PHP_WIN32) && _MSC_VER < 1300
|
||||
#if defined(PHP_WIN32)
|
||||
unsigned __int64 size = 0;
|
||||
#else
|
||||
unsigned long long size = 0;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
cal_days_in_month()
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$num = cal_days_in_month(CAL_GREGORIAN, 8, 2003);
|
||||
echo "There are $num days in August 2003\n";
|
||||
$num = cal_days_in_month(CAL_GREGORIAN, 2, 2003);
|
||||
echo "There are $num days in February 2003\n";
|
||||
$num = cal_days_in_month(CAL_GREGORIAN, 2, 2004);
|
||||
echo "There are $num days in February 2004\n";
|
||||
$num = cal_days_in_month(CAL_GREGORIAN, -1, -2003);
|
||||
echo "There are $num days in -1, -2003\n";
|
||||
$num = cal_days_in_month(CAL_GREGORIAN, 12, 2034);
|
||||
echo "There are $num days in December 2034\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
There are 31 days in August 2003
|
||||
There are 28 days in February 2003
|
||||
There are 29 days in February 2004
|
||||
There are 990210 days in -1, -2003
|
||||
There are 31 days in December 2034
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
cal_to_jd()
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo cal_to_jd(CAL_GREGORIAN, 8, 26, 74), "\n";
|
||||
echo cal_to_jd(CAL_JULIAN, 8, 26, 74), "\n";
|
||||
echo cal_to_jd(CAL_JEWISH, 8, 26, 74), "\n";
|
||||
echo cal_to_jd(CAL_FRENCH, 8, 26, 74), "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
1748326
|
||||
1748324
|
||||
374867
|
||||
0
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
easter_days()
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo easter_days(1999), "\n";
|
||||
echo easter_days(1492), "\n";
|
||||
echo easter_days(1913), "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
14
|
||||
32
|
||||
2
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
frenchtojd()
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo frenchtojd(-1,-1,-1), "\n";
|
||||
echo frenchtojd(0,0,0), "\n";
|
||||
echo frenchtojd(1,1,1), "\n";
|
||||
echo frenchtojd(14,31,15), "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
0
|
||||
0
|
||||
2375840
|
||||
0
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
if(!extension_loaded("calendar"))
|
||||
print "skip - CALENDAR extension not available";
|
||||
?>
|
||||
+25
-20
@@ -92,34 +92,39 @@ PHP_MINFO_FUNCTION(ctype)
|
||||
/* {{{ ctype
|
||||
*/
|
||||
#define CTYPE(iswhat) \
|
||||
zval *c; \
|
||||
zval *c, tmp; \
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &c) == FAILURE) \
|
||||
return; \
|
||||
switch (Z_TYPE_P(c)) { \
|
||||
case IS_LONG: \
|
||||
if (Z_TYPE_P(c) == IS_LONG) { \
|
||||
if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \
|
||||
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
|
||||
} else if (Z_LVAL_P(c) >= -128 && Z_LVAL_P(c) < 0) { \
|
||||
RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \
|
||||
} \
|
||||
SEPARATE_ZVAL(&c); \
|
||||
convert_to_string(c); \
|
||||
case IS_STRING: \
|
||||
{ \
|
||||
char *p = Z_STRVAL_P(c), *e = Z_STRVAL_P(c) + Z_STRLEN_P(c); \
|
||||
if (e == p) { \
|
||||
RETURN_FALSE; \
|
||||
} \
|
||||
while (p < e) { \
|
||||
if(!iswhat((int)*(unsigned char *)(p++))) RETURN_FALSE; \
|
||||
} \
|
||||
RETURN_TRUE; \
|
||||
} \
|
||||
default: \
|
||||
break; \
|
||||
tmp = *c; \
|
||||
zval_copy_ctor(&tmp); \
|
||||
convert_to_string(&tmp); \
|
||||
} else { \
|
||||
tmp = *c; \
|
||||
} \
|
||||
RETURN_FALSE;
|
||||
|
||||
if (Z_TYPE(tmp) == IS_STRING) { \
|
||||
char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRLEN(tmp); \
|
||||
if (e == p) { \
|
||||
if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
|
||||
RETURN_FALSE; \
|
||||
} \
|
||||
while (p < e) { \
|
||||
if(!iswhat((int)*(unsigned char *)(p++))) { \
|
||||
if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
|
||||
RETURN_FALSE; \
|
||||
} \
|
||||
} \
|
||||
if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
|
||||
RETURN_TRUE; \
|
||||
} else { \
|
||||
RETURN_FALSE; \
|
||||
} \
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool ctype_alnum(mixed c)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #34645 (ctype corrupts memory when validating large numbers)
|
||||
--FILE--
|
||||
<?php
|
||||
$id = 394829384;
|
||||
var_dump(ctype_digit($id));
|
||||
var_dump($id);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
int(394829384)
|
||||
+33
-1
@@ -36,7 +36,7 @@ if test "$PHP_CURL" != "no"; then
|
||||
CURL_CONFIG=${CURL_DIR}/bin/curl-config
|
||||
else
|
||||
if ${CURL_DIR}/curl-config --libs > /dev/null 2>&1; then
|
||||
CURL_CONFIG=${CURL_DIR}/curl-config
|
||||
CURL_CONFIG=${CURL_DIR}/curl-config
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -48,6 +48,38 @@ if test "$PHP_CURL" != "no"; then
|
||||
else
|
||||
AC_MSG_ERROR(cURL version 7.10.5 or later is required to compile php with cURL support)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for SSL support in libcurl])
|
||||
CURL_SSL=`$CURL_CONFIG --features | $EGREP SSL`
|
||||
if test "$CURL_SSL" = "SSL"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([HAVE_CURL_SSL], [1], [Have cURL with SSL support])
|
||||
|
||||
AC_MSG_CHECKING([for SSL library used])
|
||||
CURL_SSL_FLAVOUR=
|
||||
for i in $CURL_LIBS; do
|
||||
if test "$i" = "-lssl"; then
|
||||
CURL_SSL_FLAVOUR="openssl"
|
||||
AC_MSG_RESULT([openssl])
|
||||
AC_DEFINE([HAVE_CURL_OPENSSL], [1], [Have cURL with OpenSSL support])
|
||||
AC_CHECK_HEADERS([openssl/crypto.h])
|
||||
break
|
||||
elif test "$i" = "-lgnutls"; then
|
||||
CURL_SSL_FLAVOUR="gnutls"
|
||||
AC_MSG_RESULT([gnutls])
|
||||
AC_DEFINE([HAVE_CURL_GNUTLS], [1], [Have cURL with GnuTLS support])
|
||||
AC_CHECK_HEADERS([gcrypt.h])
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$CURL_SSL_FLAVOUR"; then
|
||||
AC_MSG_RESULT([unknown!])
|
||||
AC_MSG_WARN([Could not determine the type of SSL library used!])
|
||||
AC_MSG_WARN([Building will fail in ZTS mode!])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
PHP_ADD_INCLUDE($CURL_DIR/include)
|
||||
PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
|
||||
|
||||
@@ -12,6 +12,7 @@ if (PHP_CURL != "no") {
|
||||
CHECK_LIB("winmm.lib", "curl", PHP_CURL)) {
|
||||
EXTENSION("curl", "interface.c multi.c streams.c");
|
||||
AC_DEFINE('HAVE_CURL', 1, 'Have CURL library');
|
||||
AC_DEFINE('HAVE_CURL_SSL', 1, 'Have SSL suppurt in CURL');
|
||||
// TODO: check for curl_version_info
|
||||
// AC_DEFINE('PHP_CURL_URL_WRAPPERS', 0, 'Use curl for URL wrappers [experimental]');
|
||||
} else {
|
||||
|
||||
+158
-5
@@ -44,6 +44,45 @@
|
||||
#define HttpPost curl_httppost
|
||||
#endif
|
||||
|
||||
/* {{{ 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
|
||||
# warning \
|
||||
"libcurl was compiled with OpenSSL support, but configure could not find " \
|
||||
"openssl/crypto.h; thus no SSL crypto locking callbacks will be set, which may " \
|
||||
"cause random crashes on SSL requests"
|
||||
# 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
|
||||
# warning \
|
||||
"libcurl was compiled with GnuTLS support, but configure could not find " \
|
||||
"gcrypt.h; thus no SSL crypto locking callbacks will be set, which may " \
|
||||
"cause random crashes on SSL requests"
|
||||
# endif
|
||||
# else
|
||||
# warning \
|
||||
"libcurl was compiled with SSL support, but configure could not determine which" \
|
||||
"library was used; thus no SSL crypto locking callbacks will be set, which may " \
|
||||
"cause random crashes on SSL requests"
|
||||
# endif /* HAVE_CURL_OPENSSL || HAVE_CURL_GNUTLS */
|
||||
# endif /* PHP_WIN32 */
|
||||
#endif /* ZTS && HAVE_CURL_SSL */
|
||||
/* }}} */
|
||||
|
||||
#define SMART_STR_PREALLOC 4096
|
||||
|
||||
#include "ext/standard/php_smart_str.h"
|
||||
@@ -55,6 +94,11 @@
|
||||
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);
|
||||
#endif
|
||||
|
||||
static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
|
||||
#define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err;
|
||||
@@ -65,7 +109,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
#define CAAZ(s, v) add_assoc_zval_ex(return_value, s, sizeof(s), (zval *) v);
|
||||
|
||||
#define PHP_CURL_CHECK_OPEN_BASEDIR(str, len) \
|
||||
if (PG(open_basedir) && *PG(open_basedir) && \
|
||||
if (((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) && \
|
||||
strncasecmp(str, "file://", sizeof("file://") - 1) == 0) \
|
||||
{ \
|
||||
php_url *tmp_url; \
|
||||
@@ -75,7 +119,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
RETURN_FALSE; \
|
||||
} \
|
||||
\
|
||||
if (php_check_open_basedir(tmp_url->path TSRMLS_CC) || \
|
||||
if (tmp_url->query || php_check_open_basedir(tmp_url->path TSRMLS_CC) || \
|
||||
(PG(safe_mode) && !php_checkuid(tmp_url->path, "rb+", CHECKUID_CHECK_MODE_PARAM)) \
|
||||
) { \
|
||||
php_url_free(tmp_url); \
|
||||
@@ -403,6 +447,9 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLFTPAUTH_TLS);
|
||||
#endif
|
||||
|
||||
#ifdef PHP_CURL_NEED_SSL_TSL
|
||||
php_curl_ssl_init();
|
||||
#endif
|
||||
if (curl_global_init(CURL_GLOBAL_SSL) != CURLE_OK) {
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -440,7 +487,9 @@ PHP_MSHUTDOWN_FUNCTION(curl)
|
||||
php_unregister_url_stream_wrapper("ldap" TSRMLS_CC);
|
||||
#endif
|
||||
curl_global_cleanup();
|
||||
|
||||
#ifdef PHP_CURL_NEED_SSL_TSL
|
||||
php_curl_ssl_cleanup();
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1146,10 +1195,15 @@ PHP_FUNCTION(curl_setopt)
|
||||
* must be explicitly cast to long in curl_formadd
|
||||
* use since curl needs a long not an int. */
|
||||
if (*postval == '@') {
|
||||
++postval;
|
||||
/* safe_mode / open_basedir check */
|
||||
if (php_check_open_basedir(postval TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(postval, "rb+", CHECKUID_CHECK_MODE_PARAM))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
error = curl_formadd(&first, &last,
|
||||
CURLFORM_COPYNAME, string_key,
|
||||
CURLFORM_NAMELENGTH, (long)string_key_len - 1,
|
||||
CURLFORM_FILE, ++postval,
|
||||
CURLFORM_FILE, postval,
|
||||
CURLFORM_END);
|
||||
} else {
|
||||
error = curl_formadd(&first, &last,
|
||||
@@ -1540,7 +1594,106 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#endif
|
||||
#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_OPTIONS_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 */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
|
||||
@@ -111,8 +111,6 @@ PHP_FUNCTION(curl_multi_remove_handle)
|
||||
ZEND_FETCH_RESOURCE(mh, php_curlm *, &z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle);
|
||||
ZEND_FETCH_RESOURCE(ch, php_curl *, &z_ch, -1, le_curl_name, le_curl);
|
||||
|
||||
zval_ptr_dtor(&z_ch);
|
||||
|
||||
--ch->uses;
|
||||
|
||||
RETURN_LONG((long) curl_multi_remove_handle(mh->multi, ch->cp));
|
||||
|
||||
+1
-1
@@ -361,7 +361,7 @@ static php_stream_wrapper_ops php_curl_wrapper_ops = {
|
||||
NULL, /* stream_stat: curl streams know how to stat themselves */
|
||||
NULL, /* stat url */
|
||||
NULL, /* opendir */
|
||||
NULL, /* label */
|
||||
"cURL", /* label */
|
||||
NULL, /* unlink */
|
||||
NULL, /* rename */
|
||||
NULL, /* mkdir */
|
||||
|
||||
@@ -9,7 +9,11 @@ timelib_sources="lib/dow.c lib/parse_date.c lib/parse_tz.c
|
||||
lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c"
|
||||
|
||||
PHP_NEW_EXTENSION(date, php_date.c $timelib_sources, no,, $PHP_DATE_CFLAGS)
|
||||
|
||||
PHP_ADD_BUILD_DIR([$ext_builddir/lib], 1)
|
||||
PHP_ADD_INCLUDE([$ext_builddir/lib])
|
||||
PHP_ADD_INCLUDE([$ext_srcdir/lib])
|
||||
|
||||
PHP_INSTALL_HEADERS([ext/date], [php_date.h lib/timelib.h lib/timelib_structs.h lib/timelib_config.h])
|
||||
|
||||
cat > $ext_builddir/lib/timelib_config.h <<EOF
|
||||
|
||||
+20
-4
@@ -31,9 +31,9 @@ static timelib_sll century_value(timelib_sll j)
|
||||
return c < 0 ? c + 7 : c;
|
||||
}
|
||||
|
||||
timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
static timelib_sll timelib_day_of_week_ex(timelib_sll y, timelib_sll m, timelib_sll d, int iso)
|
||||
{
|
||||
timelib_sll c1, y1, m1;
|
||||
timelib_sll c1, y1, m1, dow;
|
||||
|
||||
/* Only valid for Gregorian calendar */
|
||||
if (y < 1753) {
|
||||
@@ -42,7 +42,23 @@ timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
c1 = century_value(y / 100);
|
||||
y1 = (y % 100);
|
||||
m1 = timelib_is_leap(y) ? m_table_leap[m] : m_table_common[m];
|
||||
return (c1 + y1 + m1 + (y1 / 4) + d) % 7;
|
||||
dow = (c1 + y1 + m1 + (y1 / 4) + d) % 7;
|
||||
if (iso) {
|
||||
if (dow == 0) {
|
||||
dow = 7;
|
||||
}
|
||||
}
|
||||
return dow;
|
||||
}
|
||||
|
||||
timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
{
|
||||
return timelib_day_of_week_ex(y, m, d, 0);
|
||||
}
|
||||
|
||||
timelib_sll timelib_iso_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
{
|
||||
return timelib_day_of_week_ex(y, m, d, 1);
|
||||
}
|
||||
|
||||
/* jan feb mar apr may jun jul aug sep oct nov dec */
|
||||
@@ -91,7 +107,7 @@ void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, time
|
||||
int i;
|
||||
|
||||
i = y_leap ? 366 : 365;
|
||||
if ((i - doy) < (4 - weekday)) {
|
||||
if ((i - (doy - y_leap)) < (4 - weekday)) {
|
||||
*iy = y + 1;
|
||||
*iw = 1;
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
{ "sst", 0, -11, "Pacific/Apia" },
|
||||
{ "hst", 0, -10, "Pacific/Honolulu" },
|
||||
{ "akst", 0, -9, "America/Anchorage" },
|
||||
{ "akdt", 1, -8, "America/Anchorage" },
|
||||
{ "pst", 0, -8, "America/Los_Angeles" },
|
||||
{ "pdt", 1, -7, "America/Los_Angeles" },
|
||||
{ "mst", 0, -7, "America/Denver" },
|
||||
{ "mdt", 1, -6, "America/Denver" },
|
||||
{ "cst", 0, -6, "America/Chicago" },
|
||||
{ "cdt", 1, -5, "America/Chicago" },
|
||||
{ "est", 0, -5, "America/New_York" },
|
||||
{ "edt", 1, -4, "America/New_York" },
|
||||
{ "ast", 0, -4, "America/Halifax" },
|
||||
{ "adt", 1, -3, "America/Halifax" },
|
||||
{ "brt", 0, -3, "America/Sao_Paulo" },
|
||||
{ "brst", 1, -2, "America/Sao_Paulo" },
|
||||
{ "azost", 0, -1, "Atlantic/Azores" },
|
||||
{ "azodt", 1, 0, "Atlantic/Azores" },
|
||||
{ "gmt", 0, 0, "Europe/London" },
|
||||
{ "bst", 1, 1, "Europe/London" },
|
||||
{ "cet", 0, 1, "Europe/Paris" },
|
||||
{ "cest", 1, 2, "Europe/Paris" },
|
||||
{ "eet", 0, 2, "Europe/Helsinki" },
|
||||
{ "eest", 1, 3, "Europe/Helsinki" },
|
||||
{ "msk", 0, 3, "Europe/Moscow" },
|
||||
{ "msd", 1, 4, "Europe/Moscow" },
|
||||
{ "gst", 0, 4, "Asia/Dubai" },
|
||||
{ "pkt", 0, 5, "Asia/Karachi" },
|
||||
{ "ist", 0, 5.5, "Asia/Calcutta" },
|
||||
{ "npt", 0, 5.75, "Asia/Katmandu" },
|
||||
{ "yekt", 1, 6, "Asia/Yekaterinburg" },
|
||||
{ "novst", 1, 7, "Asia/Novosibirsk" },
|
||||
{ "krat", 0, 7, "Asia/Krasnoyarsk" },
|
||||
{ "krast", 1, 8, "Asia/Krasnoyarsk" },
|
||||
{ "jst", 0, 9, "Asia/Tokyo" },
|
||||
{ "est", 0, 10, "Australia/Melbourne" },
|
||||
{ "cst", 1, 10.5, "Australia/Adelaide" },
|
||||
{ "est", 1, 11, "Australia/Melbourne" },
|
||||
{ "nzst", 0, 12, "Pacific/Auckland" },
|
||||
{ "nzdt", 1, 13, "Pacific/Auckland" },
|
||||
+5364
-4749
File diff suppressed because it is too large.
Load diff
+129
-164
@@ -100,7 +100,7 @@ typedef unsigned char uchar;
|
||||
#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_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; }
|
||||
#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; } }
|
||||
|
||||
@@ -142,6 +142,7 @@ typedef struct Scanner {
|
||||
int errors;
|
||||
|
||||
struct timelib_time *time;
|
||||
timelib_tzdb *tzdb;
|
||||
} Scanner;
|
||||
|
||||
typedef struct _timelib_lookup_table {
|
||||
@@ -160,108 +161,13 @@ typedef struct _timelib_relunit {
|
||||
|
||||
/* The timezone table. */
|
||||
static timelib_tz_lookup_table timelib_timezone_lookup[] = {
|
||||
{ "a", 0, HOUR (- 1), NULL },
|
||||
{ "adt", 1, HOUR ( 4), "America/Halifax" }, /* Atlantic Daylight */
|
||||
{ "ahst", 0, HOUR ( 10), "America/Anchorage" }, /* Alaska-Hawaii Standard */
|
||||
{ "akdt", 0, HOUR ( 10), "America/Anchorage" }, /* Alaska Daylight */
|
||||
{ "akst", 0, HOUR ( 10), "America/Anchorage" }, /* Alaska Standard */
|
||||
{ "ast", 0, HOUR ( 4), "America/Halifax" }, /* Atlantic Standard */
|
||||
{ "at", 0, HOUR ( 2), "Atlantic/Azores" }, /* Azores */
|
||||
{ "b", 0, HOUR (- 2), NULL },
|
||||
{ "bst", 1, HOUR ( 0), "Europe/London" }, /* British Summer */
|
||||
{ "bt", 0, -HOUR ( 3), "Asia/Baghdad" }, /* Baghdad, USSR Zone 2 */
|
||||
{ "c", 0, HOUR (- 3), NULL },
|
||||
{ "cadt", 1, -HOUR (9.5), "Australia/Adelaide" }, /* Central Australian Daylight */
|
||||
{ "cast", 0, -HOUR (9.5), "Australia/Adelaide" }, /* Central Australian Standard */
|
||||
{ "cat", 0, HOUR ( 10), "America/Anchorage" }, /* Central Alaska */
|
||||
{ "cct", 0, -HOUR ( 8), "Asia/Shanghai" }, /* China Coast, USSR Zone 7 */
|
||||
{ "cdt", 1, HOUR ( 6), "America/Chicago" }, /* Central Daylight */
|
||||
{ "cest", 1, -HOUR ( 1), "Europe/Berlin" }, /* Central European Summer */
|
||||
{ "cet", 0, -HOUR ( 1), "Europe/Berlin" }, /* Central European */
|
||||
{ "cst", 0, HOUR ( 6), "America/Chicago" }, /* Central Standard */
|
||||
{ "d", 0, HOUR (- 4), NULL },
|
||||
{ "e", 0, HOUR (- 5), NULL },
|
||||
{ "eadt", 1, -HOUR ( 10), "Australia/Sydney" }, /* Eastern Australian Daylight */
|
||||
{ "east", 0, -HOUR ( 10), "Australia/Sydney" }, /* Eastern Australian Standard */
|
||||
{ "edt", 1, HOUR ( 5), "America/New_York" }, /* Eastern Daylight */
|
||||
{ "eest", 1, HOUR ( 2), "Europe/Helsinki" }, /* Eastern European Summer */
|
||||
{ "eet", 0, -HOUR ( 2), "Europe/Bucharest" }, /* Eastern Europe, USSR Zone 1 */
|
||||
{ "est", 0, HOUR ( 5), "America/New_York" }, /* Eastern Standard */
|
||||
{ "f", 0, HOUR (- 6), NULL },
|
||||
{ "fst", 1, -HOUR ( 1), "Europe/Paris" }, /* French Summer */
|
||||
{ "fwt", 0, -HOUR ( 1), "Europe/Paris" }, /* French Winter */
|
||||
{ "g", 0, HOUR (- 7), NULL },
|
||||
{ "gmt", 0, HOUR ( 0), "GMT" }, /* Greenwich Mean */
|
||||
{ "gst", 0, -HOUR ( 10), "Pacific/Guam" }, /* Guam Standard, USSR Zone 9 */
|
||||
{ "h", 0, HOUR (- 8), NULL },
|
||||
{ "hdt", 1, HOUR ( 10), "Pacific/Honolulu" }, /* Hawaii Daylight */
|
||||
{ "hst", 0, HOUR ( 10), "Pacific/Honolulu" }, /* Hawaii Standard */
|
||||
{ "i", 0, HOUR (- 9), NULL },
|
||||
{ "idle", 0, -HOUR ( 12), "NZ" }, /* International Date Line East */
|
||||
{ "idlw", 0, HOUR ( 12), NULL }, /* International Date Line West */
|
||||
{ "ist", 0, -HOUR (5.5), "Asia/Calcutta" }, /* Indian Standard */
|
||||
{ "it", 0, -HOUR (3.5), "Asia/Tehran" }, /* Iran */
|
||||
{ "jst", 0, -HOUR ( 9), "Asia/Tokyo" }, /* Japan Standard, USSR Zone 8 */
|
||||
{ "jt", 0, -HOUR (7.5), NULL }, /* Java (3pm in Cronusland!) */
|
||||
{ "k", 0, HOUR (-10), NULL },
|
||||
{ "l", 0, HOUR (-11), NULL },
|
||||
{ "m", 0, HOUR (-12), NULL },
|
||||
{ "mdt", 1, HOUR ( 7), "America/Phoenix" }, /* Mountain Daylight */
|
||||
{ "mest", 1, -HOUR ( 1), "MET" }, /* Middle European Summer */
|
||||
{ "mesz", 1, -HOUR ( 1), "MET" }, /* Middle European Summer */
|
||||
{ "met", 0, -HOUR ( 1), "MET" }, /* Middle European */
|
||||
{ "mewt", 0, -HOUR ( 1), "MET" }, /* Middle European Winter */
|
||||
{ "msd", 1, HOUR ( 3), "Europe/Moscow" }, /* Moscow Summer */
|
||||
{ "msk", 0, HOUR ( 3), "Europe/Moscow" }, /* Moscow */
|
||||
{ "mst", 0, HOUR ( 7), "America/Phoenix" }, /* Mountain Standard */
|
||||
{ "n", 0, HOUR ( 1), NULL },
|
||||
{ "ndt", 1, HOUR (3.5), "America/St_Johns" }, /* Newfoundland Daylight */
|
||||
{ "nft", 0, HOUR (3.5), "America/St_Johns" }, /* Newfoundland */
|
||||
{ "nst", 0, HOUR (3.5), "America/St_Johns" }, /* Newfoundland Standard */
|
||||
{ "nt", 0, HOUR ( 11), NULL }, /* Nome */
|
||||
{ "nzdt", 1, -HOUR ( 12), "NZ" }, /* New Zealand Daylight */
|
||||
{ "nzst", 0, -HOUR ( 12), "NZ" }, /* New Zealand Standard */
|
||||
{ "nzt", 0, -HOUR ( 12), "NZ" }, /* New Zealand */
|
||||
{ "o", 0, HOUR ( 2), NULL },
|
||||
{ "p", 0, HOUR ( 3), NULL },
|
||||
{ "pdt", 1, HOUR ( 8), "America/Los_Angeles" }, /* Pacific Daylight */
|
||||
{ "pst", 0, HOUR ( 8), "America/Los_Angeles" }, /* Pacific Standard */
|
||||
{ "q", 0, HOUR ( 4), NULL },
|
||||
{ "r", 0, HOUR ( 5), NULL },
|
||||
{ "s", 0, HOUR ( 6), NULL },
|
||||
{ "slst", 1, -HOUR ( 1), "Europe/Oslo" }, /* Skien Local Summer Time */
|
||||
{ "slt", 0, -HOUR ( 1), "Europe/Oslo" }, /* Skien Local Time */
|
||||
{ "sst", 1, -HOUR ( 1), "Europe/Stockholm" }, /* Swedish Summer */
|
||||
{ "swt", 0, -HOUR ( 1), "Europe/Stockholm" }, /* Swedish Winter */
|
||||
{ "t", 0, HOUR ( 7), NULL },
|
||||
{ "u", 0, HOUR ( 8), NULL },
|
||||
{ "ut", 0, HOUR ( 0), "UTC" }, /* Universal (Coordinated) */
|
||||
{ "utc", 0, HOUR ( 0), "UTC" },
|
||||
{ "v", 0, HOUR ( 9), NULL },
|
||||
{ "w", 0, HOUR ( 10), NULL },
|
||||
{ "wadt", 1, -HOUR ( 7), "Australia/Perth" }, /* West Australian Daylight */
|
||||
{ "wast", 0, -HOUR ( 7), "Australia/Perth" }, /* West Australian Standard */
|
||||
{ "wat", 0, HOUR ( 1), "Africa/Dakar" }, /* West Africa */
|
||||
{ "wet", 0, HOUR ( 0), "Europe/London" }, /* Western European */
|
||||
{ "x", 0, HOUR ( 11), NULL },
|
||||
{ "y", 0, HOUR ( 12), NULL },
|
||||
{ "ydt", 1, HOUR ( 9), "America/Anchorage" }, /* Yukon Daylight */
|
||||
{ "yst", 0, HOUR ( 9), "America/Anchorage" }, /* Yukon Standard */
|
||||
{ "z", 0, HOUR ( 0), NULL },
|
||||
{ "zp4", 0, -HOUR ( 4), NULL }, /* USSR Zone 3 */
|
||||
{ "zp5", 0, -HOUR ( 5), NULL }, /* USSR Zone 4 */
|
||||
{ "zp6", 0, -HOUR ( 6), NULL }, /* USSR Zone 5 */
|
||||
#if 0
|
||||
/* For completeness. BST is also British Summer, and GST is
|
||||
* also Guam Standard. */
|
||||
{ "bst", 0, HOUR ( 3), NULL }, /* Brazil Standard */
|
||||
{ "gst", 0, HOUR ( 3), NULL }, /* Greenland Standard */
|
||||
#include "timezonemap.h"
|
||||
{ NULL, 0, 0, NULL },
|
||||
};
|
||||
|
||||
/* For completeness. NST is also Newfoundland Standard, and SST is
|
||||
* also Swedish Summer. */
|
||||
{ "nst", 0, -HOUR (6.5), NULL },/* North Sumatra */
|
||||
{ "sst", 0, -HOUR (7), NULL }, /* South Sumatra, USSR Zone 6 */
|
||||
#endif
|
||||
static timelib_tz_lookup_table timelib_timezone_fallbackmap[] = {
|
||||
#include "fallbackmap.h"
|
||||
{ NULL, 0, 0, NULL },
|
||||
};
|
||||
|
||||
static timelib_relunit const timelib_relunit_lookup[] = {
|
||||
@@ -316,8 +222,8 @@ static timelib_lookup_table const timelib_reltext_lookup[] = {
|
||||
{ "twelfth", 0, 12 },
|
||||
{ "last", 0, -1 },
|
||||
{ "previous", 0, -1 },
|
||||
{ "this", 0, 0 },
|
||||
{ NULL, 0, 0 }
|
||||
{ "this", 1, 0 },
|
||||
{ NULL, 1, 0 }
|
||||
};
|
||||
|
||||
/* The month table. */
|
||||
@@ -533,7 +439,7 @@ static long timelib_parse_tz_cor(char **ptr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static timelib_sll timelib_lookup_relative_text(char **ptr)
|
||||
static timelib_sll timelib_lookup_relative_text(char **ptr, int *behavior)
|
||||
{
|
||||
char *word;
|
||||
char *begin = *ptr, *end;
|
||||
@@ -550,6 +456,7 @@ static timelib_sll timelib_lookup_relative_text(char **ptr)
|
||||
for (tp = timelib_reltext_lookup; tp->name; tp++) {
|
||||
if (strcasecmp(word, tp->name) == 0) {
|
||||
value = tp->value;
|
||||
*behavior = tp->type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -557,12 +464,12 @@ static timelib_sll timelib_lookup_relative_text(char **ptr)
|
||||
return value;
|
||||
}
|
||||
|
||||
static timelib_sll timelib_get_relative_text(char **ptr)
|
||||
static timelib_sll timelib_get_relative_text(char **ptr, int *behavior)
|
||||
{
|
||||
while (**ptr == ' ' || **ptr == '-' || **ptr == '/') {
|
||||
++*ptr;
|
||||
}
|
||||
return timelib_lookup_relative_text(ptr);
|
||||
return timelib_lookup_relative_text(ptr, behavior);
|
||||
}
|
||||
|
||||
static long timelib_lookup_month(char **ptr)
|
||||
@@ -628,7 +535,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
|
||||
return value;
|
||||
}
|
||||
|
||||
static void timelib_set_relative(char **ptr, timelib_sll amount, Scanner *s)
|
||||
static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, Scanner *s)
|
||||
{
|
||||
const timelib_relunit* relunit;
|
||||
|
||||
@@ -646,28 +553,42 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, Scanner *s)
|
||||
TIMELIB_UNHAVE_TIME();
|
||||
s->time->relative.d += (amount > 0 ? amount - 1 : amount) * 7;
|
||||
s->time->relative.weekday = relunit->multiplier;
|
||||
s->time->relative.weekday_behavior = behavior;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static timelib_tz_lookup_table* zone_search(const char *word, int left, int right)
|
||||
static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, int isdst)
|
||||
{
|
||||
int mid, cmp;
|
||||
|
||||
if (left > right) {
|
||||
return NULL; /* not found */
|
||||
int first_found = 0;
|
||||
timelib_tz_lookup_table *tp, *first_found_elem;
|
||||
timelib_tz_lookup_table *fmp;
|
||||
|
||||
for (tp = timelib_timezone_lookup; tp->name; tp++) {
|
||||
if (strcasecmp(word, tp->name) == 0) {
|
||||
if (!first_found) {
|
||||
first_found = 1;
|
||||
first_found_elem = tp;
|
||||
if (gmtoffset == -1) {
|
||||
return tp;
|
||||
}
|
||||
}
|
||||
if (tp->gmtoffset == gmtoffset) {
|
||||
return tp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mid = (left + right) / 2;
|
||||
|
||||
cmp = strcasecmp(word, timelib_timezone_lookup[mid].name);
|
||||
if (cmp < 0) {
|
||||
return zone_search(word, left, mid - 1);
|
||||
} else if (cmp > 0) {
|
||||
return zone_search(word, mid + 1, right);
|
||||
} else { /* (cmp == 0) */
|
||||
return (timelib_tz_lookup_table*)&timelib_timezone_lookup[mid];
|
||||
if (first_found) {
|
||||
return first_found_elem;
|
||||
}
|
||||
/* Still didn't find anything, let's find the zone solely based on
|
||||
* offset/isdst then */
|
||||
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
|
||||
if ((fmp->gmtoffset * 3600) == gmtoffset && fmp->type == isdst) {
|
||||
return fmp;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found)
|
||||
@@ -684,9 +605,10 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
|
||||
word = calloc(1, end - begin + 1);
|
||||
memcpy(word, begin, end - begin);
|
||||
|
||||
if ((tp = zone_search(word, 0, sizeof(timelib_timezone_lookup)/sizeof(*timelib_timezone_lookup)-1))) {
|
||||
value = tp->value;
|
||||
if ((tp = zone_search(word, -1, 0))) {
|
||||
value = -tp->gmtoffset / 60;
|
||||
*dst = tp->type;
|
||||
value += tp->type * 60;
|
||||
*found = 1;
|
||||
} else {
|
||||
*found = 0;
|
||||
@@ -696,7 +618,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
|
||||
return value;
|
||||
}
|
||||
|
||||
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found)
|
||||
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, timelib_tzdb *tzdb)
|
||||
{
|
||||
timelib_tzinfo *res;
|
||||
|
||||
@@ -710,6 +632,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
|
||||
t->is_localtime = 1;
|
||||
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
|
||||
*tz_not_found = 0;
|
||||
t->dst = 0;
|
||||
|
||||
return -1 * timelib_parse_tz_cor(ptr);
|
||||
} else if (**ptr == '-') {
|
||||
@@ -717,6 +640,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
|
||||
t->is_localtime = 1;
|
||||
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
|
||||
*tz_not_found = 0;
|
||||
t->dst = 0;
|
||||
|
||||
return timelib_parse_tz_cor(ptr);
|
||||
} else {
|
||||
@@ -736,7 +660,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
|
||||
#endif
|
||||
/* If we have a TimeZone identifier to start with, use it */
|
||||
if (strstr(tz_abbr, "/")) {
|
||||
if ((res = timelib_parse_tzfile(tz_abbr)) != NULL) {
|
||||
if ((res = timelib_parse_tzfile(tz_abbr, tzdb)) != NULL) {
|
||||
t->tz_info = res;
|
||||
t->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
found++;
|
||||
@@ -810,15 +734,16 @@ monthroman = "I" | "II" | "III" | "IV" | "V" | "VI" | "VII" | "VIII" | "IX" | "X
|
||||
monthtext = monthfull | monthabbr | monthroman;
|
||||
|
||||
/* Time formats */
|
||||
timeshort12 = hour12[:]minutelz space? meridian;
|
||||
timelong12 = hour12[:]minute[:]secondlz space? meridian;
|
||||
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 = hour24[:.]minute;
|
||||
timelong24 = hour24[:.]minute[:.]second;
|
||||
iso8601long = hour24 [:.] minute [:.] second frac;
|
||||
|
||||
/* iso8601shorttz = hour24 [:] minutelz space? (tzcorrection | tz); */
|
||||
iso8601normtz = hour24 [:] minute [:] secondlz space? (tzcorrection | tz);
|
||||
iso8601normtz = hour24 [:.] minute [:.] secondlz space? (tzcorrection | tz);
|
||||
/* iso8601longtz = hour24 [:] minute [:] secondlz frac space? (tzcorrection | tz); */
|
||||
|
||||
gnunocolon = hour24lz minutelz;
|
||||
@@ -830,6 +755,7 @@ iso8601nocolon = hour24lz minutelz secondlz;
|
||||
americanshort = month "/" day;
|
||||
american = month "/" day "/" year;
|
||||
iso8601dateslash = year4 "/" monthlz "/" daylz "/"?;
|
||||
dateslash = year4 "/" month "/" day;
|
||||
gnudateshort = year "-" month "-" day;
|
||||
iso8601date = year4 "-" monthlz "-" daylz;
|
||||
pointeddate = day "." month "." year;
|
||||
@@ -898,9 +824,21 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
|
||||
"today"
|
||||
"noon"
|
||||
{
|
||||
DEBUG_OUTPUT("today");
|
||||
DEBUG_OUTPUT("noon");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_UNHAVE_TIME();
|
||||
TIMELIB_HAVE_TIME();
|
||||
s->time->h = 12;
|
||||
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
|
||||
"midnight" | "today"
|
||||
{
|
||||
DEBUG_OUTPUT("midnight | today");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_UNHAVE_TIME();
|
||||
|
||||
@@ -944,15 +882,17 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
|
||||
timeshort12 | timelong12
|
||||
timetiny12 | timeshort12 | timelong12
|
||||
{
|
||||
DEBUG_OUTPUT("timeshort12 | timelong12");
|
||||
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_TIME();
|
||||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
if (*ptr == ':') {
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
if (*ptr == ':' || *ptr == '.') {
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
if (*ptr == ':' || *ptr == '.') {
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
}
|
||||
}
|
||||
s->time->h += timelib_meridian((char **) &ptr, s->time->h);
|
||||
TIMELIB_DEINIT;
|
||||
@@ -967,7 +907,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
TIMELIB_HAVE_TIME();
|
||||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
if (*ptr == ':') {
|
||||
if (*ptr == ':' || *ptr == '.') {
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
if (*ptr == '.') {
|
||||
@@ -976,7 +916,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
@@ -1014,7 +954,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->s = 0;
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, s->tzdb);
|
||||
break;
|
||||
case 1:
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1039,7 +979,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
@@ -1048,6 +988,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
americanshort | american
|
||||
{
|
||||
DEBUG_OUTPUT("americanshort | american");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_nr((char **) &ptr, 2);
|
||||
@@ -1060,8 +1001,9 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
return TIMELIB_AMERICAN;
|
||||
}
|
||||
|
||||
iso8601date | iso8601dateslash
|
||||
iso8601date | iso8601dateslash | dateslash
|
||||
{
|
||||
DEBUG_OUTPUT("iso8601date | iso8601dateslash | dateslash");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1073,6 +1015,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
gnudateshort
|
||||
{
|
||||
DEBUG_OUTPUT("gnudateshort");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1085,6 +1028,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
datefull
|
||||
{
|
||||
DEBUG_OUTPUT("datefull");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
@@ -1097,6 +1041,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
pointeddate
|
||||
{
|
||||
DEBUG_OUTPUT("pointed date");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
@@ -1109,6 +1054,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
datenoday
|
||||
{
|
||||
DEBUG_OUTPUT("datenoday");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
@@ -1121,6 +1067,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
datenodayrev
|
||||
{
|
||||
DEBUG_OUTPUT("datenodayrev");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1133,6 +1080,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
datetextual | datenoyear
|
||||
{
|
||||
DEBUG_OUTPUT("datetextual | datenoyear");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
@@ -1145,6 +1093,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
datenoyearrev
|
||||
{
|
||||
DEBUG_OUTPUT("datenoyearrev");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
@@ -1155,6 +1104,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
datenocolon
|
||||
{
|
||||
DEBUG_OUTPUT("datenocolon");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1167,6 +1117,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
xmlrpc | xmlrpcnocolon | soap | wddx
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_TIME();
|
||||
TIMELIB_HAVE_DATE();
|
||||
@@ -1178,7 +1129,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
if (*ptr == '.') {
|
||||
s->time->f = timelib_get_frac_nr((char **) &ptr, 9);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
@@ -1187,6 +1138,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
pgydotd
|
||||
{
|
||||
DEBUG_OUTPUT("pgydotd");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1200,7 +1152,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
isoweekday
|
||||
{
|
||||
timelib_sll w, d;
|
||||
|
||||
DEBUG_OUTPUT("isoweekday");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
@@ -1219,7 +1171,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
isoweek
|
||||
{
|
||||
timelib_sll w, d;
|
||||
|
||||
DEBUG_OUTPUT("isoweek");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
@@ -1237,6 +1189,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
pgtextshort
|
||||
{
|
||||
DEBUG_OUTPUT("pgtextshort");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
@@ -1249,6 +1202,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
pgtextreverse
|
||||
{
|
||||
DEBUG_OUTPUT("pgtextreverse");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1262,6 +1216,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
clf
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("clf");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_TIME();
|
||||
TIMELIB_HAVE_DATE();
|
||||
@@ -1271,7 +1226,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
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->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
@@ -1279,6 +1234,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
year4
|
||||
{
|
||||
DEBUG_OUTPUT("year4");
|
||||
TIMELIB_INIT;
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
TIMELIB_DEINIT;
|
||||
@@ -1287,6 +1243,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
ago
|
||||
{
|
||||
DEBUG_OUTPUT("ago");
|
||||
TIMELIB_INIT;
|
||||
s->time->relative.y = 0 - s->time->relative.y;
|
||||
s->time->relative.m = 0 - s->time->relative.m;
|
||||
@@ -1302,14 +1259,15 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
relativetext
|
||||
{
|
||||
timelib_sll i;
|
||||
|
||||
int behavior;
|
||||
DEBUG_OUTPUT("relativetext");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
|
||||
while(*ptr) {
|
||||
i = timelib_get_relative_text((char **) &ptr);
|
||||
i = timelib_get_relative_text((char **) &ptr, &behavior);
|
||||
timelib_eat_spaces((char **) &ptr);
|
||||
timelib_set_relative((char **) &ptr, i, s);
|
||||
timelib_set_relative((char **) &ptr, i, behavior, s);
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
@@ -1318,7 +1276,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
dayfull
|
||||
{
|
||||
const timelib_relunit* relunit;
|
||||
|
||||
DEBUG_OUTPUT("dayfull");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
TIMELIB_HAVE_WEEKDAY_RELATIVE();
|
||||
@@ -1326,6 +1284,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
relunit = timelib_lookup_relunit((char**) &ptr);
|
||||
s->time->relative.weekday = relunit->multiplier;
|
||||
s->time->relative.weekday_behavior = 1;
|
||||
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
@@ -1333,14 +1292,16 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
dayabbr
|
||||
{
|
||||
DEBUG_OUTPUT("dayabbr");
|
||||
goto std;
|
||||
}
|
||||
|
||||
tzcorrection | tz
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
TIMELIB_INIT;
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIMEZONE;
|
||||
@@ -1349,6 +1310,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
@@ -1366,7 +1328,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
@@ -1376,14 +1338,14 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
relative
|
||||
{
|
||||
timelib_ull i;
|
||||
|
||||
DEBUG_OUTPUT("relative");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
|
||||
while(*ptr) {
|
||||
i = timelib_get_unsigned_nr((char **) &ptr, 24);
|
||||
timelib_eat_spaces((char **) &ptr);
|
||||
timelib_set_relative((char **) &ptr, i, s);
|
||||
timelib_set_relative((char **) &ptr, i, 0, s);
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
@@ -1411,16 +1373,16 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
/*!max:re2c */
|
||||
|
||||
timelib_time* timelib_strtotime(char *s, int *errors)
|
||||
timelib_time* timelib_strtotime(char *s, int *errors, timelib_tzdb *tzdb)
|
||||
{
|
||||
Scanner in;
|
||||
int t;
|
||||
|
||||
memset(&in, 0, sizeof(in));
|
||||
in.str = malloc(strlen(s) + 25);
|
||||
memset(in.str, 0, strlen(s) + 25);
|
||||
in.str = malloc(strlen(s) + YYMAXFILL);
|
||||
memset(in.str, 0, strlen(s) + YYMAXFILL);
|
||||
memcpy(in.str, s, strlen(s));
|
||||
in.lim = in.str + strlen(s) + 25;
|
||||
in.lim = in.str + strlen(s) + YYMAXFILL;
|
||||
in.cur = in.str;
|
||||
in.time = timelib_time_ctor();
|
||||
in.time->y = -1;
|
||||
@@ -1433,10 +1395,13 @@ timelib_time* timelib_strtotime(char *s, int *errors)
|
||||
in.time->z = -1;
|
||||
in.time->dst = -1;
|
||||
in.errors = 0;
|
||||
in.tzdb = tzdb;
|
||||
|
||||
do {
|
||||
t = scan(&in);
|
||||
/* printf("%d\n", t); */
|
||||
#ifdef DEBUG_PARSER
|
||||
printf("%d\n", t);
|
||||
#endif
|
||||
} while(t != EOI);
|
||||
|
||||
free(in.str);
|
||||
@@ -1479,11 +1444,11 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
|
||||
*/
|
||||
}
|
||||
|
||||
char *timelib_timezone_id_from_abbr(const char *abbr)
|
||||
char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
|
||||
{
|
||||
timelib_tz_lookup_table *tp;
|
||||
|
||||
tp = zone_search(abbr, 0, sizeof(timelib_timezone_lookup) / sizeof(*timelib_timezone_lookup) - 1);
|
||||
tp = zone_search(abbr, gmtoffset, isdst);
|
||||
if (tp) {
|
||||
return (tp->full_tz_name);
|
||||
} else {
|
||||
|
||||
+48
-14
@@ -164,6 +164,15 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
|
||||
printf("Local types count: %lu\n", (unsigned long) tz->typecnt);
|
||||
printf("Zone Abbr. count: %lu\n", (unsigned long) tz->charcnt);
|
||||
|
||||
printf ("%8s (%12s) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
|
||||
"", "", 0,
|
||||
(long int) tz->type[0].offset,
|
||||
tz->type[0].isdst,
|
||||
tz->type[0].abbr_idx,
|
||||
&tz->timezone_abbr[tz->type[0].abbr_idx],
|
||||
tz->type[0].isstdcnt,
|
||||
tz->type[0].isgmtcnt
|
||||
);
|
||||
for (i = 0; i < tz->timecnt; i++) {
|
||||
printf ("%08X (%12d) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
|
||||
tz->trans[i], tz->trans[i], tz->trans_idx[i],
|
||||
@@ -183,7 +192,7 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
|
||||
}
|
||||
}
|
||||
|
||||
static int tz_search(char *timezone, int left, int right)
|
||||
static int tz_search(char *timezone, int left, int right, timelib_tzdb *tzdb)
|
||||
{
|
||||
int mid, cmp;
|
||||
|
||||
@@ -193,41 +202,48 @@ static int tz_search(char *timezone, int left, int right)
|
||||
|
||||
mid = (left + right) / 2;
|
||||
|
||||
cmp = strcasecmp(timezone, timezonedb_idx[mid].id);
|
||||
cmp = strcasecmp(timezone, tzdb->index[mid].id);
|
||||
if (cmp < 0) {
|
||||
return tz_search(timezone, left, mid - 1);
|
||||
return tz_search(timezone, left, mid - 1, tzdb);
|
||||
} else if (cmp > 0) {
|
||||
return tz_search(timezone, mid + 1, right);
|
||||
return tz_search(timezone, mid + 1, right, tzdb);
|
||||
} else { /* (cmp == 0) */
|
||||
return timezonedb_idx[mid].pos;
|
||||
return tzdb->index[mid].pos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int seek_to_tz_position(char **tzf, char *timezone)
|
||||
static int seek_to_tz_position(char **tzf, char *timezone, timelib_tzdb *tzdb)
|
||||
{
|
||||
int pos = tz_search(timezone, 0, sizeof(timezonedb_idx)/sizeof(*timezonedb_idx)-1);
|
||||
int pos;
|
||||
|
||||
pos = tz_search(timezone, 0, tzdb->index_size, tzdb);
|
||||
|
||||
if (pos == -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
(*tzf) = &timelib_timezone_db_data[pos + 20];
|
||||
(*tzf) = &(tzdb->data[pos + 20]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
timelib_tzdb_index_entry *timelib_timezone_identifiers_list(int *count)
|
||||
timelib_tzdb *timelib_builtin_db(void)
|
||||
{
|
||||
*count = sizeof(timezonedb_idx) / sizeof(*timezonedb_idx);
|
||||
return timezonedb_idx;
|
||||
return &timezonedb_builtin;
|
||||
}
|
||||
|
||||
timelib_tzinfo *timelib_parse_tzfile(char *timezone)
|
||||
timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count)
|
||||
{
|
||||
*count = sizeof(timezonedb_idx_builtin) / sizeof(*timezonedb_idx_builtin);
|
||||
return timezonedb_idx_builtin;
|
||||
}
|
||||
|
||||
timelib_tzinfo *timelib_parse_tzfile(char *timezone, timelib_tzdb *tzdb)
|
||||
{
|
||||
char *tzf;
|
||||
timelib_tzinfo *tmp;
|
||||
|
||||
if (seek_to_tz_position((char**) &tzf, timezone)) {
|
||||
if (seek_to_tz_position((char**) &tzf, timezone, tzdb)) {
|
||||
tmp = timelib_tzinfo_ctor(timezone);
|
||||
|
||||
read_header((char**) &tzf, tmp);
|
||||
@@ -244,6 +260,8 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
/* If there is no transistion time, we pick the first one, if that doesn't
|
||||
* exist we return NULL */
|
||||
if (!tz->timecnt || !tz->trans) {
|
||||
*transition_time = 0;
|
||||
if (tz->typecnt == 1) {
|
||||
@@ -252,10 +270,26 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* If the TS is lower than the first transistion time, then we scan over
|
||||
* all the transistion times to find the first non-DST one, or the first
|
||||
* one in case there are only DST entries. Not sure which smartass came up
|
||||
* with this idea in the first though :) */
|
||||
if (ts < tz->trans[0]) {
|
||||
uint32_t j;
|
||||
|
||||
*transition_time = 0;
|
||||
return &(tz->type[tz->trans_idx[tz->timecnt - 1]]);
|
||||
j = 0;
|
||||
while (j < tz->timecnt && tz->type[j].isdst) {
|
||||
++j;
|
||||
}
|
||||
if (j == tz->timecnt) {
|
||||
j = 0;
|
||||
}
|
||||
return &(tz->type[j]);
|
||||
}
|
||||
|
||||
/* In all other cases we loop through the available transtion times to find
|
||||
* the correct entry */
|
||||
for (i = 0; i < tz->timecnt; i++) {
|
||||
if (ts < tz->trans[i]) {
|
||||
*transition_time = tz->trans[i - 1];
|
||||
|
||||
+129
-164
@@ -100,7 +100,7 @@ typedef unsigned char uchar;
|
||||
#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_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; }
|
||||
#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; } }
|
||||
|
||||
@@ -142,6 +142,7 @@ typedef struct Scanner {
|
||||
int errors;
|
||||
|
||||
struct timelib_time *time;
|
||||
timelib_tzdb *tzdb;
|
||||
} Scanner;
|
||||
|
||||
typedef struct _timelib_lookup_table {
|
||||
@@ -160,108 +161,13 @@ typedef struct _timelib_relunit {
|
||||
|
||||
/* The timezone table. */
|
||||
static timelib_tz_lookup_table timelib_timezone_lookup[] = {
|
||||
{ "a", 0, HOUR (- 1), NULL },
|
||||
{ "adt", 1, HOUR ( 4), "America/Halifax" }, /* Atlantic Daylight */
|
||||
{ "ahst", 0, HOUR ( 10), "America/Anchorage" }, /* Alaska-Hawaii Standard */
|
||||
{ "akdt", 0, HOUR ( 10), "America/Anchorage" }, /* Alaska Daylight */
|
||||
{ "akst", 0, HOUR ( 10), "America/Anchorage" }, /* Alaska Standard */
|
||||
{ "ast", 0, HOUR ( 4), "America/Halifax" }, /* Atlantic Standard */
|
||||
{ "at", 0, HOUR ( 2), "Atlantic/Azores" }, /* Azores */
|
||||
{ "b", 0, HOUR (- 2), NULL },
|
||||
{ "bst", 1, HOUR ( 0), "Europe/London" }, /* British Summer */
|
||||
{ "bt", 0, -HOUR ( 3), "Asia/Baghdad" }, /* Baghdad, USSR Zone 2 */
|
||||
{ "c", 0, HOUR (- 3), NULL },
|
||||
{ "cadt", 1, -HOUR (9.5), "Australia/Adelaide" }, /* Central Australian Daylight */
|
||||
{ "cast", 0, -HOUR (9.5), "Australia/Adelaide" }, /* Central Australian Standard */
|
||||
{ "cat", 0, HOUR ( 10), "America/Anchorage" }, /* Central Alaska */
|
||||
{ "cct", 0, -HOUR ( 8), "Asia/Shanghai" }, /* China Coast, USSR Zone 7 */
|
||||
{ "cdt", 1, HOUR ( 6), "America/Chicago" }, /* Central Daylight */
|
||||
{ "cest", 1, -HOUR ( 1), "Europe/Berlin" }, /* Central European Summer */
|
||||
{ "cet", 0, -HOUR ( 1), "Europe/Berlin" }, /* Central European */
|
||||
{ "cst", 0, HOUR ( 6), "America/Chicago" }, /* Central Standard */
|
||||
{ "d", 0, HOUR (- 4), NULL },
|
||||
{ "e", 0, HOUR (- 5), NULL },
|
||||
{ "eadt", 1, -HOUR ( 10), "Australia/Sydney" }, /* Eastern Australian Daylight */
|
||||
{ "east", 0, -HOUR ( 10), "Australia/Sydney" }, /* Eastern Australian Standard */
|
||||
{ "edt", 1, HOUR ( 5), "America/New_York" }, /* Eastern Daylight */
|
||||
{ "eest", 1, HOUR ( 2), "Europe/Helsinki" }, /* Eastern European Summer */
|
||||
{ "eet", 0, -HOUR ( 2), "Europe/Bucharest" }, /* Eastern Europe, USSR Zone 1 */
|
||||
{ "est", 0, HOUR ( 5), "America/New_York" }, /* Eastern Standard */
|
||||
{ "f", 0, HOUR (- 6), NULL },
|
||||
{ "fst", 1, -HOUR ( 1), "Europe/Paris" }, /* French Summer */
|
||||
{ "fwt", 0, -HOUR ( 1), "Europe/Paris" }, /* French Winter */
|
||||
{ "g", 0, HOUR (- 7), NULL },
|
||||
{ "gmt", 0, HOUR ( 0), "GMT" }, /* Greenwich Mean */
|
||||
{ "gst", 0, -HOUR ( 10), "Pacific/Guam" }, /* Guam Standard, USSR Zone 9 */
|
||||
{ "h", 0, HOUR (- 8), NULL },
|
||||
{ "hdt", 1, HOUR ( 10), "Pacific/Honolulu" }, /* Hawaii Daylight */
|
||||
{ "hst", 0, HOUR ( 10), "Pacific/Honolulu" }, /* Hawaii Standard */
|
||||
{ "i", 0, HOUR (- 9), NULL },
|
||||
{ "idle", 0, -HOUR ( 12), "NZ" }, /* International Date Line East */
|
||||
{ "idlw", 0, HOUR ( 12), NULL }, /* International Date Line West */
|
||||
{ "ist", 0, -HOUR (5.5), "Asia/Calcutta" }, /* Indian Standard */
|
||||
{ "it", 0, -HOUR (3.5), "Asia/Tehran" }, /* Iran */
|
||||
{ "jst", 0, -HOUR ( 9), "Asia/Tokyo" }, /* Japan Standard, USSR Zone 8 */
|
||||
{ "jt", 0, -HOUR (7.5), NULL }, /* Java (3pm in Cronusland!) */
|
||||
{ "k", 0, HOUR (-10), NULL },
|
||||
{ "l", 0, HOUR (-11), NULL },
|
||||
{ "m", 0, HOUR (-12), NULL },
|
||||
{ "mdt", 1, HOUR ( 7), "America/Phoenix" }, /* Mountain Daylight */
|
||||
{ "mest", 1, -HOUR ( 1), "MET" }, /* Middle European Summer */
|
||||
{ "mesz", 1, -HOUR ( 1), "MET" }, /* Middle European Summer */
|
||||
{ "met", 0, -HOUR ( 1), "MET" }, /* Middle European */
|
||||
{ "mewt", 0, -HOUR ( 1), "MET" }, /* Middle European Winter */
|
||||
{ "msd", 1, HOUR ( 3), "Europe/Moscow" }, /* Moscow Summer */
|
||||
{ "msk", 0, HOUR ( 3), "Europe/Moscow" }, /* Moscow */
|
||||
{ "mst", 0, HOUR ( 7), "America/Phoenix" }, /* Mountain Standard */
|
||||
{ "n", 0, HOUR ( 1), NULL },
|
||||
{ "ndt", 1, HOUR (3.5), "America/St_Johns" }, /* Newfoundland Daylight */
|
||||
{ "nft", 0, HOUR (3.5), "America/St_Johns" }, /* Newfoundland */
|
||||
{ "nst", 0, HOUR (3.5), "America/St_Johns" }, /* Newfoundland Standard */
|
||||
{ "nt", 0, HOUR ( 11), NULL }, /* Nome */
|
||||
{ "nzdt", 1, -HOUR ( 12), "NZ" }, /* New Zealand Daylight */
|
||||
{ "nzst", 0, -HOUR ( 12), "NZ" }, /* New Zealand Standard */
|
||||
{ "nzt", 0, -HOUR ( 12), "NZ" }, /* New Zealand */
|
||||
{ "o", 0, HOUR ( 2), NULL },
|
||||
{ "p", 0, HOUR ( 3), NULL },
|
||||
{ "pdt", 1, HOUR ( 8), "America/Los_Angeles" }, /* Pacific Daylight */
|
||||
{ "pst", 0, HOUR ( 8), "America/Los_Angeles" }, /* Pacific Standard */
|
||||
{ "q", 0, HOUR ( 4), NULL },
|
||||
{ "r", 0, HOUR ( 5), NULL },
|
||||
{ "s", 0, HOUR ( 6), NULL },
|
||||
{ "slst", 1, -HOUR ( 1), "Europe/Oslo" }, /* Skien Local Summer Time */
|
||||
{ "slt", 0, -HOUR ( 1), "Europe/Oslo" }, /* Skien Local Time */
|
||||
{ "sst", 1, -HOUR ( 1), "Europe/Stockholm" }, /* Swedish Summer */
|
||||
{ "swt", 0, -HOUR ( 1), "Europe/Stockholm" }, /* Swedish Winter */
|
||||
{ "t", 0, HOUR ( 7), NULL },
|
||||
{ "u", 0, HOUR ( 8), NULL },
|
||||
{ "ut", 0, HOUR ( 0), "UTC" }, /* Universal (Coordinated) */
|
||||
{ "utc", 0, HOUR ( 0), "UTC" },
|
||||
{ "v", 0, HOUR ( 9), NULL },
|
||||
{ "w", 0, HOUR ( 10), NULL },
|
||||
{ "wadt", 1, -HOUR ( 7), "Australia/Perth" }, /* West Australian Daylight */
|
||||
{ "wast", 0, -HOUR ( 7), "Australia/Perth" }, /* West Australian Standard */
|
||||
{ "wat", 0, HOUR ( 1), "Africa/Dakar" }, /* West Africa */
|
||||
{ "wet", 0, HOUR ( 0), "Europe/London" }, /* Western European */
|
||||
{ "x", 0, HOUR ( 11), NULL },
|
||||
{ "y", 0, HOUR ( 12), NULL },
|
||||
{ "ydt", 1, HOUR ( 9), "America/Anchorage" }, /* Yukon Daylight */
|
||||
{ "yst", 0, HOUR ( 9), "America/Anchorage" }, /* Yukon Standard */
|
||||
{ "z", 0, HOUR ( 0), NULL },
|
||||
{ "zp4", 0, -HOUR ( 4), NULL }, /* USSR Zone 3 */
|
||||
{ "zp5", 0, -HOUR ( 5), NULL }, /* USSR Zone 4 */
|
||||
{ "zp6", 0, -HOUR ( 6), NULL }, /* USSR Zone 5 */
|
||||
#if 0
|
||||
/* For completeness. BST is also British Summer, and GST is
|
||||
* also Guam Standard. */
|
||||
{ "bst", 0, HOUR ( 3), NULL }, /* Brazil Standard */
|
||||
{ "gst", 0, HOUR ( 3), NULL }, /* Greenland Standard */
|
||||
#include "timezonemap.h"
|
||||
{ NULL, 0, 0, NULL },
|
||||
};
|
||||
|
||||
/* For completeness. NST is also Newfoundland Standard, and SST is
|
||||
* also Swedish Summer. */
|
||||
{ "nst", 0, -HOUR (6.5), NULL },/* North Sumatra */
|
||||
{ "sst", 0, -HOUR (7), NULL }, /* South Sumatra, USSR Zone 6 */
|
||||
#endif
|
||||
static timelib_tz_lookup_table timelib_timezone_fallbackmap[] = {
|
||||
#include "fallbackmap.h"
|
||||
{ NULL, 0, 0, NULL },
|
||||
};
|
||||
|
||||
static timelib_relunit const timelib_relunit_lookup[] = {
|
||||
@@ -316,8 +222,8 @@ static timelib_lookup_table const timelib_reltext_lookup[] = {
|
||||
{ "twelfth", 0, 12 },
|
||||
{ "last", 0, -1 },
|
||||
{ "previous", 0, -1 },
|
||||
{ "this", 0, 0 },
|
||||
{ NULL, 0, 0 }
|
||||
{ "this", 1, 0 },
|
||||
{ NULL, 1, 0 }
|
||||
};
|
||||
|
||||
/* The month table. */
|
||||
@@ -533,7 +439,7 @@ static long timelib_parse_tz_cor(char **ptr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static timelib_sll timelib_lookup_relative_text(char **ptr)
|
||||
static timelib_sll timelib_lookup_relative_text(char **ptr, int *behavior)
|
||||
{
|
||||
char *word;
|
||||
char *begin = *ptr, *end;
|
||||
@@ -550,6 +456,7 @@ static timelib_sll timelib_lookup_relative_text(char **ptr)
|
||||
for (tp = timelib_reltext_lookup; tp->name; tp++) {
|
||||
if (strcasecmp(word, tp->name) == 0) {
|
||||
value = tp->value;
|
||||
*behavior = tp->type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -557,12 +464,12 @@ static timelib_sll timelib_lookup_relative_text(char **ptr)
|
||||
return value;
|
||||
}
|
||||
|
||||
static timelib_sll timelib_get_relative_text(char **ptr)
|
||||
static timelib_sll timelib_get_relative_text(char **ptr, int *behavior)
|
||||
{
|
||||
while (**ptr == ' ' || **ptr == '-' || **ptr == '/') {
|
||||
++*ptr;
|
||||
}
|
||||
return timelib_lookup_relative_text(ptr);
|
||||
return timelib_lookup_relative_text(ptr, behavior);
|
||||
}
|
||||
|
||||
static long timelib_lookup_month(char **ptr)
|
||||
@@ -628,7 +535,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
|
||||
return value;
|
||||
}
|
||||
|
||||
static void timelib_set_relative(char **ptr, timelib_sll amount, Scanner *s)
|
||||
static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, Scanner *s)
|
||||
{
|
||||
const timelib_relunit* relunit;
|
||||
|
||||
@@ -646,28 +553,42 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, Scanner *s)
|
||||
TIMELIB_UNHAVE_TIME();
|
||||
s->time->relative.d += (amount > 0 ? amount - 1 : amount) * 7;
|
||||
s->time->relative.weekday = relunit->multiplier;
|
||||
s->time->relative.weekday_behavior = behavior;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static timelib_tz_lookup_table* zone_search(const char *word, int left, int right)
|
||||
static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, int isdst)
|
||||
{
|
||||
int mid, cmp;
|
||||
|
||||
if (left > right) {
|
||||
return NULL; /* not found */
|
||||
int first_found = 0;
|
||||
timelib_tz_lookup_table *tp, *first_found_elem;
|
||||
timelib_tz_lookup_table *fmp;
|
||||
|
||||
for (tp = timelib_timezone_lookup; tp->name; tp++) {
|
||||
if (strcasecmp(word, tp->name) == 0) {
|
||||
if (!first_found) {
|
||||
first_found = 1;
|
||||
first_found_elem = tp;
|
||||
if (gmtoffset == -1) {
|
||||
return tp;
|
||||
}
|
||||
}
|
||||
if (tp->gmtoffset == gmtoffset) {
|
||||
return tp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mid = (left + right) / 2;
|
||||
|
||||
cmp = strcasecmp(word, timelib_timezone_lookup[mid].name);
|
||||
if (cmp < 0) {
|
||||
return zone_search(word, left, mid - 1);
|
||||
} else if (cmp > 0) {
|
||||
return zone_search(word, mid + 1, right);
|
||||
} else { /* (cmp == 0) */
|
||||
return (timelib_tz_lookup_table*)&timelib_timezone_lookup[mid];
|
||||
if (first_found) {
|
||||
return first_found_elem;
|
||||
}
|
||||
/* Still didn't find anything, let's find the zone solely based on
|
||||
* offset/isdst then */
|
||||
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
|
||||
if ((fmp->gmtoffset * 3600) == gmtoffset && fmp->type == isdst) {
|
||||
return fmp;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found)
|
||||
@@ -684,9 +605,10 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
|
||||
word = calloc(1, end - begin + 1);
|
||||
memcpy(word, begin, end - begin);
|
||||
|
||||
if ((tp = zone_search(word, 0, sizeof(timelib_timezone_lookup)/sizeof(*timelib_timezone_lookup)-1))) {
|
||||
value = tp->value;
|
||||
if ((tp = zone_search(word, -1, 0))) {
|
||||
value = -tp->gmtoffset / 60;
|
||||
*dst = tp->type;
|
||||
value += tp->type * 60;
|
||||
*found = 1;
|
||||
} else {
|
||||
*found = 0;
|
||||
@@ -696,7 +618,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
|
||||
return value;
|
||||
}
|
||||
|
||||
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found)
|
||||
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, timelib_tzdb *tzdb)
|
||||
{
|
||||
timelib_tzinfo *res;
|
||||
|
||||
@@ -710,6 +632,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
|
||||
t->is_localtime = 1;
|
||||
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
|
||||
*tz_not_found = 0;
|
||||
t->dst = 0;
|
||||
|
||||
return -1 * timelib_parse_tz_cor(ptr);
|
||||
} else if (**ptr == '-') {
|
||||
@@ -717,6 +640,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
|
||||
t->is_localtime = 1;
|
||||
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
|
||||
*tz_not_found = 0;
|
||||
t->dst = 0;
|
||||
|
||||
return timelib_parse_tz_cor(ptr);
|
||||
} else {
|
||||
@@ -736,7 +660,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
|
||||
#endif
|
||||
/* If we have a TimeZone identifier to start with, use it */
|
||||
if (strstr(tz_abbr, "/")) {
|
||||
if ((res = timelib_parse_tzfile(tz_abbr)) != NULL) {
|
||||
if ((res = timelib_parse_tzfile(tz_abbr, tzdb)) != NULL) {
|
||||
t->tz_info = res;
|
||||
t->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
found++;
|
||||
@@ -810,15 +734,16 @@ monthroman = "I" | "II" | "III" | "IV" | "V" | "VI" | "VII" | "VIII" | "IX" | "X
|
||||
monthtext = monthfull | monthabbr | monthroman;
|
||||
|
||||
/* Time formats */
|
||||
timeshort12 = hour12[:]minutelz space? meridian;
|
||||
timelong12 = hour12[:]minute[:]secondlz space? meridian;
|
||||
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 = hour24[:.]minute;
|
||||
timelong24 = hour24[:.]minute[:.]second;
|
||||
iso8601long = hour24 [:.] minute [:.] second frac;
|
||||
|
||||
/* iso8601shorttz = hour24 [:] minutelz space? (tzcorrection | tz); */
|
||||
iso8601normtz = hour24 [:] minute [:] secondlz space? (tzcorrection | tz);
|
||||
iso8601normtz = hour24 [:.] minute [:.] secondlz space? (tzcorrection | tz);
|
||||
/* iso8601longtz = hour24 [:] minute [:] secondlz frac space? (tzcorrection | tz); */
|
||||
|
||||
gnunocolon = hour24lz minutelz;
|
||||
@@ -830,6 +755,7 @@ iso8601nocolon = hour24lz minutelz secondlz;
|
||||
americanshort = month "/" day;
|
||||
american = month "/" day "/" year;
|
||||
iso8601dateslash = year4 "/" monthlz "/" daylz "/"?;
|
||||
dateslash = year4 "/" month "/" day;
|
||||
gnudateshort = year "-" month "-" day;
|
||||
iso8601date = year4 "-" monthlz "-" daylz;
|
||||
pointeddate = day "." month "." year;
|
||||
@@ -898,9 +824,21 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
|
||||
"today"
|
||||
"noon"
|
||||
{
|
||||
DEBUG_OUTPUT("today");
|
||||
DEBUG_OUTPUT("noon");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_UNHAVE_TIME();
|
||||
TIMELIB_HAVE_TIME();
|
||||
s->time->h = 12;
|
||||
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
|
||||
"midnight" | "today"
|
||||
{
|
||||
DEBUG_OUTPUT("midnight | today");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_UNHAVE_TIME();
|
||||
|
||||
@@ -944,15 +882,17 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
|
||||
timeshort12 | timelong12
|
||||
timetiny12 | timeshort12 | timelong12
|
||||
{
|
||||
DEBUG_OUTPUT("timeshort12 | timelong12");
|
||||
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_TIME();
|
||||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
if (*ptr == ':') {
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
if (*ptr == ':' || *ptr == '.') {
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
if (*ptr == ':' || *ptr == '.') {
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
}
|
||||
}
|
||||
s->time->h += timelib_meridian((char **) &ptr, s->time->h);
|
||||
TIMELIB_DEINIT;
|
||||
@@ -967,7 +907,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
TIMELIB_HAVE_TIME();
|
||||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
if (*ptr == ':') {
|
||||
if (*ptr == ':' || *ptr == '.') {
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
if (*ptr == '.') {
|
||||
@@ -976,7 +916,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
@@ -1014,7 +954,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->s = 0;
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, s->tzdb);
|
||||
break;
|
||||
case 1:
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1039,7 +979,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
@@ -1048,6 +988,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
americanshort | american
|
||||
{
|
||||
DEBUG_OUTPUT("americanshort | american");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_nr((char **) &ptr, 2);
|
||||
@@ -1060,8 +1001,9 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
return TIMELIB_AMERICAN;
|
||||
}
|
||||
|
||||
iso8601date | iso8601dateslash
|
||||
iso8601date | iso8601dateslash | dateslash
|
||||
{
|
||||
DEBUG_OUTPUT("iso8601date | iso8601dateslash | dateslash");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1073,6 +1015,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
gnudateshort
|
||||
{
|
||||
DEBUG_OUTPUT("gnudateshort");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1085,6 +1028,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
datefull
|
||||
{
|
||||
DEBUG_OUTPUT("datefull");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
@@ -1097,6 +1041,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
pointeddate
|
||||
{
|
||||
DEBUG_OUTPUT("pointed date");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
@@ -1109,6 +1054,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
datenoday
|
||||
{
|
||||
DEBUG_OUTPUT("datenoday");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
@@ -1121,6 +1067,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
datenodayrev
|
||||
{
|
||||
DEBUG_OUTPUT("datenodayrev");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1133,6 +1080,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
datetextual | datenoyear
|
||||
{
|
||||
DEBUG_OUTPUT("datetextual | datenoyear");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
@@ -1145,6 +1093,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
datenoyearrev
|
||||
{
|
||||
DEBUG_OUTPUT("datenoyearrev");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
@@ -1155,6 +1104,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
datenocolon
|
||||
{
|
||||
DEBUG_OUTPUT("datenocolon");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1167,6 +1117,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
xmlrpc | xmlrpcnocolon | soap | wddx
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_TIME();
|
||||
TIMELIB_HAVE_DATE();
|
||||
@@ -1178,7 +1129,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
if (*ptr == '.') {
|
||||
s->time->f = timelib_get_frac_nr((char **) &ptr, 9);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
@@ -1187,6 +1138,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
pgydotd
|
||||
{
|
||||
DEBUG_OUTPUT("pgydotd");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1200,7 +1152,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
isoweekday
|
||||
{
|
||||
timelib_sll w, d;
|
||||
|
||||
DEBUG_OUTPUT("isoweekday");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
@@ -1219,7 +1171,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
isoweek
|
||||
{
|
||||
timelib_sll w, d;
|
||||
|
||||
DEBUG_OUTPUT("isoweek");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
@@ -1237,6 +1189,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
pgtextshort
|
||||
{
|
||||
DEBUG_OUTPUT("pgtextshort");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
@@ -1249,6 +1202,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
pgtextreverse
|
||||
{
|
||||
DEBUG_OUTPUT("pgtextreverse");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1262,6 +1216,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
clf
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("clf");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_TIME();
|
||||
TIMELIB_HAVE_DATE();
|
||||
@@ -1271,7 +1226,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
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->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
@@ -1279,6 +1234,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
year4
|
||||
{
|
||||
DEBUG_OUTPUT("year4");
|
||||
TIMELIB_INIT;
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
TIMELIB_DEINIT;
|
||||
@@ -1287,6 +1243,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
ago
|
||||
{
|
||||
DEBUG_OUTPUT("ago");
|
||||
TIMELIB_INIT;
|
||||
s->time->relative.y = 0 - s->time->relative.y;
|
||||
s->time->relative.m = 0 - s->time->relative.m;
|
||||
@@ -1302,14 +1259,15 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
relativetext
|
||||
{
|
||||
timelib_sll i;
|
||||
|
||||
int behavior;
|
||||
DEBUG_OUTPUT("relativetext");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
|
||||
while(*ptr) {
|
||||
i = timelib_get_relative_text((char **) &ptr);
|
||||
i = timelib_get_relative_text((char **) &ptr, &behavior);
|
||||
timelib_eat_spaces((char **) &ptr);
|
||||
timelib_set_relative((char **) &ptr, i, s);
|
||||
timelib_set_relative((char **) &ptr, i, behavior, s);
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
@@ -1318,7 +1276,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
dayfull
|
||||
{
|
||||
const timelib_relunit* relunit;
|
||||
|
||||
DEBUG_OUTPUT("dayfull");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
TIMELIB_HAVE_WEEKDAY_RELATIVE();
|
||||
@@ -1326,6 +1284,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
relunit = timelib_lookup_relunit((char**) &ptr);
|
||||
s->time->relative.weekday = relunit->multiplier;
|
||||
s->time->relative.weekday_behavior = 1;
|
||||
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
@@ -1333,14 +1292,16 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
dayabbr
|
||||
{
|
||||
DEBUG_OUTPUT("dayabbr");
|
||||
goto std;
|
||||
}
|
||||
|
||||
tzcorrection | tz
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
TIMELIB_INIT;
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIMEZONE;
|
||||
@@ -1349,6 +1310,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
@@ -1366,7 +1328,7 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
s->errors += tz_not_found;
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
@@ -1376,14 +1338,14 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
relative
|
||||
{
|
||||
timelib_ull i;
|
||||
|
||||
DEBUG_OUTPUT("relative");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
|
||||
while(*ptr) {
|
||||
i = timelib_get_unsigned_nr((char **) &ptr, 24);
|
||||
timelib_eat_spaces((char **) &ptr);
|
||||
timelib_set_relative((char **) &ptr, i, s);
|
||||
timelib_set_relative((char **) &ptr, i, 0, s);
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
@@ -1411,16 +1373,16 @@ relativetext = (reltextnumber space? reltextunit)+;
|
||||
|
||||
/*!max:re2c */
|
||||
|
||||
timelib_time* timelib_strtotime(char *s, int *errors)
|
||||
timelib_time* timelib_strtotime(char *s, int *errors, timelib_tzdb *tzdb)
|
||||
{
|
||||
Scanner in;
|
||||
int t;
|
||||
|
||||
memset(&in, 0, sizeof(in));
|
||||
in.str = malloc(strlen(s) + 25);
|
||||
memset(in.str, 0, strlen(s) + 25);
|
||||
in.str = malloc(strlen(s) + YYMAXFILL);
|
||||
memset(in.str, 0, strlen(s) + YYMAXFILL);
|
||||
memcpy(in.str, s, strlen(s));
|
||||
in.lim = in.str + strlen(s) + 25;
|
||||
in.lim = in.str + strlen(s) + YYMAXFILL;
|
||||
in.cur = in.str;
|
||||
in.time = timelib_time_ctor();
|
||||
in.time->y = -1;
|
||||
@@ -1433,10 +1395,13 @@ timelib_time* timelib_strtotime(char *s, int *errors)
|
||||
in.time->z = -1;
|
||||
in.time->dst = -1;
|
||||
in.errors = 0;
|
||||
in.tzdb = tzdb;
|
||||
|
||||
do {
|
||||
t = scan(&in);
|
||||
/* printf("%d\n", t); */
|
||||
#ifdef DEBUG_PARSER
|
||||
printf("%d\n", t);
|
||||
#endif
|
||||
} while(t != EOI);
|
||||
|
||||
free(in.str);
|
||||
@@ -1479,11 +1444,11 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
|
||||
*/
|
||||
}
|
||||
|
||||
char *timelib_timezone_id_from_abbr(const char *abbr)
|
||||
char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
|
||||
{
|
||||
timelib_tz_lookup_table *tp;
|
||||
|
||||
tp = zone_search(abbr, 0, sizeof(timelib_timezone_lookup) / sizeof(*timelib_timezone_lookup) - 1);
|
||||
tp = zone_search(abbr, gmtoffset, isdst);
|
||||
if (tp) {
|
||||
return (tp->full_tz_name);
|
||||
} else {
|
||||
|
||||
@@ -180,7 +180,7 @@ void timelib_dump_date(timelib_time *d, int options)
|
||||
d->relative.y, d->relative.m, d->relative.d, d->relative.h, d->relative.i, d->relative.s);
|
||||
}
|
||||
if (d->have_weekday_relative) {
|
||||
printf(" / %d", d->relative.weekday);
|
||||
printf(" / %d.%d", d->relative.weekday, d->relative.weekday_behavior);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
Loaded 100 of 831 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user