mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-09 18:20:50 +00:00
Compare commits
582
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4b6eb9b18 | ||
|
|
fcde3b066e | ||
|
|
2cdc86e8b4 | ||
|
|
cab8f40c2e | ||
|
|
12374956d0 | ||
|
|
5efb3301b2 | ||
|
|
cbdd728a8d | ||
|
|
5a4d19abe6 | ||
|
|
6cb74fb894 | ||
|
|
c40cb3fce6 | ||
|
|
4ba3d20c88 | ||
|
|
7b5258ab93 | ||
|
|
1d4d921a59 | ||
|
|
0d6c158620 | ||
|
|
74320cba7e | ||
|
|
73346d2f76 | ||
|
|
74b56b1258 | ||
|
|
ac5f1552ff | ||
|
|
93f65e2510 | ||
|
|
4c4bfd3c9b | ||
|
|
ea97c82b97 | ||
|
|
a6e1c3616b | ||
|
|
e1dc8e60a4 | ||
|
|
cda0f6145f | ||
|
|
b700e7a9db | ||
|
|
763006984d | ||
|
|
9bea6b1fb0 | ||
|
|
135d118ce7 | ||
|
|
1b6665b0d9 | ||
|
|
6f7b5eba99 | ||
|
|
ccf618e1dd | ||
|
|
f80035fb65 | ||
|
|
9c44d66034 | ||
|
|
6db67fe4ff | ||
|
|
125c9028a7 | ||
|
|
53e61c7f1f | ||
|
|
da02892d8c | ||
|
|
cd385539a3 | ||
|
|
a718d62f74 | ||
|
|
3931103064 | ||
|
|
238393e58a | ||
|
|
3de8ff865a | ||
|
|
0cb5aa2d53 | ||
|
|
89c61babec | ||
|
|
c5d37e6879 | ||
|
|
9bce9725ce | ||
|
|
fa13af4d59 | ||
|
|
916af07bc8 | ||
|
|
193bdf06d6 | ||
|
|
a3d2a4da0c | ||
|
|
a847d3a9dd | ||
|
|
618e5b21c3 | ||
|
|
3bc9cc5d2d | ||
|
|
da1255b17f | ||
|
|
a2c4aeb659 | ||
|
|
239e693751 | ||
|
|
039dd23c03 | ||
|
|
1d23c4d551 | ||
|
|
2082e22123 | ||
|
|
62f1637939 | ||
|
|
96cae711b9 | ||
|
|
3886f88503 | ||
|
|
d030269743 | ||
|
|
61e2b771d4 | ||
|
|
2e9541bef5 | ||
|
|
43b6cc62b1 | ||
|
|
ab4bfa115c | ||
|
|
3a2fb113bc | ||
|
|
bdad6ef8c1 | ||
|
|
59b098a525 | ||
|
|
a7cb6a8808 | ||
|
|
271e7df5eb | ||
|
|
0a60e71454 | ||
|
|
4163964612 | ||
|
|
29cd249649 | ||
|
|
f444b875b0 | ||
|
|
9327ad7d07 | ||
|
|
74d23c256b | ||
|
|
68aff652b9 | ||
|
|
aa06288173 | ||
|
|
77c460b59f | ||
|
|
d09c0303b8 | ||
|
|
7064084418 | ||
|
|
d605aa7846 | ||
|
|
36a5a19c48 | ||
|
|
71f00b6ab2 | ||
|
|
3bdc15821f | ||
|
|
3222f1defb | ||
|
|
b65cff0f53 | ||
|
|
4e5296741d | ||
|
|
7ec21cca55 | ||
|
|
acab9b33be | ||
|
|
bb7515902c | ||
|
|
8d3bd0f4f7 | ||
|
|
40d8309354 | ||
|
|
62f3ccdea9 | ||
|
|
77598e0382 | ||
|
|
d67ee093e8 | ||
|
|
69644e9272 | ||
|
|
fbb708e211 | ||
|
|
797a132d51 | ||
|
|
3241d7fc46 | ||
|
|
a8a3ae8566 | ||
|
|
f65691dc68 | ||
|
|
91aaefe043 | ||
|
|
e8cd732fb2 | ||
|
|
6a7ed50811 | ||
|
|
bacd5371f4 | ||
|
|
95e9a21e31 | ||
|
|
e1c0bcd35f | ||
|
|
34eb46c6b2 | ||
|
|
67dcd65a57 | ||
|
|
00fa3587ba | ||
|
|
044fba0b64 | ||
|
|
99041df380 | ||
|
|
ee3f17d3ee | ||
|
|
509eca4182 | ||
|
|
6b97f4e98c | ||
|
|
fcf9c0892d | ||
|
|
3c1b0101ef | ||
|
|
7d5b5f3054 | ||
|
|
7a379811d4 | ||
|
|
6749b09d8b | ||
|
|
1a1713a4c7 | ||
|
|
af05fce6b6 | ||
|
|
985122db3b | ||
|
|
216a000ce3 | ||
|
|
3f35f2252d | ||
|
|
480af61b74 | ||
|
|
f67d540a1b | ||
|
|
2452c92c2b | ||
|
|
b6b00a822c | ||
|
|
586f73b1ee | ||
|
|
4bc6ac34ae | ||
|
|
c32445a860 | ||
|
|
0f04dff942 | ||
|
|
70a7fced75 | ||
|
|
47fff9a15d | ||
|
|
50a4e4003a | ||
|
|
e0ffe2f109 | ||
|
|
fa5fbd0a0d | ||
|
|
aac98f3eba | ||
|
|
6f35c85c19 | ||
|
|
5fd210de89 | ||
|
|
49c5edcb9f | ||
|
|
07c6cb2a5b | ||
|
|
9891d3e03d | ||
|
|
c3c311943c | ||
|
|
d0fd3bf62e | ||
|
|
90546a871f | ||
|
|
f2d992c76f | ||
|
|
36b416f514 | ||
|
|
03ba78106d | ||
|
|
c7b537e2c3 | ||
|
|
523d3c122f | ||
|
|
e79de46f3c | ||
|
|
66a74b4c68 | ||
|
|
fd0e9cc044 | ||
|
|
f2dc3a258d | ||
|
|
6330a6078d | ||
|
|
ce726fa710 | ||
|
|
0b640b29d7 | ||
|
|
f0e8e0eae8 | ||
|
|
ef3ed0e4d4 | ||
|
|
6317956d02 | ||
|
|
b1e05a7b4f | ||
|
|
65a2433793 | ||
|
|
a5a29a86df | ||
|
|
7226e7077d | ||
|
|
00c9bd1a33 | ||
|
|
8a340b1572 | ||
|
|
4b03f9f172 | ||
|
|
167c1675b9 | ||
|
|
5ddec61e2d | ||
|
|
77e96aec61 | ||
|
|
9b6a953c91 | ||
|
|
61e90440ce | ||
|
|
0faac783e9 | ||
|
|
95b0546558 | ||
|
|
e5f62e61e6 | ||
|
|
0484413b86 | ||
|
|
59cb64f707 | ||
|
|
af9a8dfaa3 | ||
|
|
01ba76a2ed | ||
|
|
cd067e641a | ||
|
|
1228570437 | ||
|
|
c6b00a1223 | ||
|
|
998a9f4438 | ||
|
|
3959fe2470 | ||
|
|
db5037537b | ||
|
|
88c5b75698 | ||
|
|
c6e0f60774 | ||
|
|
1cae37c3da | ||
|
|
6ab8a6705d | ||
|
|
8c13a77e97 | ||
|
|
f1df31a3fb | ||
|
|
750646d822 | ||
|
|
3f4cf40c45 | ||
|
|
f941d0aeb0 | ||
|
|
331c9a83a3 | ||
|
|
cf476b6a51 | ||
|
|
eacce9faca | ||
|
|
9b68fae9c9 | ||
|
|
c981347ffb | ||
|
|
8360ce27aa | ||
|
|
0bcb369eac | ||
|
|
0c7f673a91 | ||
|
|
02a2e47986 | ||
|
|
3657fef77c | ||
|
|
d75ba00e90 | ||
|
|
1d31caf032 | ||
|
|
a50b0e717f | ||
|
|
b2ccce05e3 | ||
|
|
45a4e123e7 | ||
|
|
8f16f600d5 | ||
|
|
055d1c2134 | ||
|
|
e188ea9d39 | ||
|
|
11031593f3 | ||
|
|
eca839ae19 | ||
|
|
ac70367d73 | ||
|
|
d5830722a5 | ||
|
|
82dae9d9be | ||
|
|
e817baae1e | ||
|
|
7c3962f79d | ||
|
|
2016ad5441 | ||
|
|
67c833661e | ||
|
|
8b765c3c44 | ||
|
|
2daa88cd48 | ||
|
|
32617aea68 | ||
|
|
69d71f67d2 | ||
|
|
f779b01bca | ||
|
|
0036a3e4da | ||
|
|
b2f560dc94 | ||
|
|
501a4edf49 | ||
|
|
c896d7d6d0 | ||
|
|
0285963ec3 | ||
|
|
84a00322eb | ||
|
|
5dbe92d8a7 | ||
|
|
c2e2a30169 | ||
|
|
dee4566360 | ||
|
|
900df55818 | ||
|
|
d0ff60e95f | ||
|
|
98aa5b6eb2 | ||
|
|
4f92686415 | ||
|
|
a2f06a9a3c | ||
|
|
942c837e9f | ||
|
|
890b377094 | ||
|
|
fb5c9e76fc | ||
|
|
d5f88b12c0 | ||
|
|
7dd408c7e5 | ||
|
|
b00c9f4501 | ||
|
|
e81f5ce137 | ||
|
|
6081651c65 | ||
|
|
cbfa37cfad | ||
|
|
797cda2555 | ||
|
|
a540196a41 | ||
|
|
c33bcdda04 | ||
|
|
d85e4ebcc2 | ||
|
|
3b1d4b09da | ||
|
|
36280edc99 | ||
|
|
67bee6eb6e | ||
|
|
7942ff14c4 | ||
|
|
2728e52d58 | ||
|
|
96184fe715 | ||
|
|
5d5e004b34 | ||
|
|
2e67579965 | ||
|
|
f858b30f4e | ||
|
|
094aa8699d | ||
|
|
3d2c4f5670 | ||
|
|
ef3ea48ce0 | ||
|
|
a810fefdde | ||
|
|
2be9172661 | ||
|
|
5c085a9224 | ||
|
|
1665957a8f | ||
|
|
257f58c862 | ||
|
|
c6744a5370 | ||
|
|
643c61277f | ||
|
|
b790562222 | ||
|
|
39f83fc506 | ||
|
|
412fb096fa | ||
|
|
c4c952f023 | ||
|
|
10b2bb1cab | ||
|
|
406847a6cd | ||
|
|
57c5bff123 | ||
|
|
9062b2f967 | ||
|
|
29348ff48b | ||
|
|
2067727a80 | ||
|
|
6fcc1515cb | ||
|
|
08e7f480e1 | ||
|
|
f521b61ce2 | ||
|
|
16bc64121f | ||
|
|
d8cd133a33 | ||
|
|
f1ec84159d | ||
|
|
b9a6022f15 | ||
|
|
b832343962 | ||
|
|
8e3e81256f | ||
|
|
24ec8acb2d | ||
|
|
820516e756 | ||
|
|
09d555e3d0 | ||
|
|
9782bbd297 | ||
|
|
833331a53d | ||
|
|
a9b87039e4 | ||
|
|
327125e313 | ||
|
|
ce886edc0b | ||
|
|
bb3e125185 | ||
|
|
f5722d61b4 | ||
|
|
7d77171b9b | ||
|
|
76d520e9a7 | ||
|
|
aa5feff190 | ||
|
|
16dd07c5e0 | ||
|
|
14c1dc4ab4 | ||
|
|
18079dd248 | ||
|
|
ae5598fa85 | ||
|
|
6183a1ed3e | ||
|
|
177647c99b | ||
|
|
278aee14a5 | ||
|
|
29048d8d7e | ||
|
|
e3b65c75be | ||
|
|
a3858e17e9 | ||
|
|
0d27154a49 | ||
|
|
9ab9402ed9 | ||
|
|
db638b91b3 | ||
|
|
c1c1b21686 | ||
|
|
e62db3b3c8 | ||
|
|
f01310928c | ||
|
|
b003591f19 | ||
|
|
9ae0e91ef4 | ||
|
|
c2c1590d52 | ||
|
|
39916670cc | ||
|
|
14b2c4a1f4 | ||
|
|
2074b6ceee | ||
|
|
120ea84394 | ||
|
|
4ca31d911f | ||
|
|
03a1a3675a | ||
|
|
7052ece4e8 | ||
|
|
f34dafccdb | ||
|
|
65052194b4 | ||
|
|
88d0d5427e | ||
|
|
2c99f0230c | ||
|
|
ea138b85ab | ||
|
|
df93e470cc | ||
|
|
e54698481c | ||
|
|
43004bcaaa | ||
|
|
98c0dd4147 | ||
|
|
85f8b2a830 | ||
|
|
b8c51d4614 | ||
|
|
805fe58a28 | ||
|
|
f5c36b8d9e | ||
|
|
25ab185761 | ||
|
|
e7fcde565b | ||
|
|
6164ea4840 | ||
|
|
470ca9ef6f | ||
|
|
beffd8738e | ||
|
|
bce14e2c6f | ||
|
|
af2ee723dc | ||
|
|
975771b431 | ||
|
|
3f5e121f2b | ||
|
|
a000fe6c06 | ||
|
|
ff8c3d2d67 | ||
|
|
e6df40e831 | ||
|
|
b559075a02 | ||
|
|
1d87b34375 | ||
|
|
942a83b246 | ||
|
|
92689ec8e0 | ||
|
|
dfb664c946 | ||
|
|
8c4eede77d | ||
|
|
4ad82c5ef2 | ||
|
|
ca612d3fc0 | ||
|
|
87fca31a3f | ||
|
|
54b2a4d6a0 | ||
|
|
82a5d700e3 | ||
|
|
982ac8b7a2 | ||
|
|
6aed779dc8 | ||
|
|
69fe08beb2 | ||
|
|
412bae8482 | ||
|
|
27868d1799 | ||
|
|
bb19590b7e | ||
|
|
48dba110e2 | ||
|
|
255f9fc072 | ||
|
|
8f9fa59341 | ||
|
|
872f6e7af8 | ||
|
|
ecca999733 | ||
|
|
38d64188ff | ||
|
|
048aa76cc9 | ||
|
|
5c3249d954 | ||
|
|
b15b80c1b7 | ||
|
|
5facf4becc | ||
|
|
f5ebf71f49 | ||
|
|
7a69f34c69 | ||
|
|
f1b7a88393 | ||
|
|
853d714008 | ||
|
|
077b8f2d25 | ||
|
|
b6bb43ef94 | ||
|
|
6f20f9d285 | ||
|
|
2fb5c4394b | ||
|
|
9ca8a571e9 | ||
|
|
8ee05c9da8 | ||
|
|
a4430a9cfe | ||
|
|
2be03f0d73 | ||
|
|
85fe5f8c34 | ||
|
|
c7f52698c1 | ||
|
|
d775bca68f | ||
|
|
6c763f3721 | ||
|
|
949e461e8f | ||
|
|
59ed068c78 | ||
|
|
d8cd7dac07 | ||
|
|
4945317c28 | ||
|
|
34f4400502 | ||
|
|
259f662488 | ||
|
|
d349734059 | ||
|
|
fa5f20cfce | ||
|
|
435fff2cb1 | ||
|
|
9173e270b0 | ||
|
|
40645cc0a6 | ||
|
|
33e114b37e | ||
|
|
be85bd83e8 | ||
|
|
29099a7470 | ||
|
|
8823289f9f | ||
|
|
78363147b8 | ||
|
|
ac7665fdc2 | ||
|
|
1410d8c0b2 | ||
|
|
5a4158421c | ||
|
|
945115968c | ||
|
|
970f1f9c7f | ||
|
|
65ef16ef31 | ||
|
|
0186acacdb | ||
|
|
bc4a269d3c | ||
|
|
291441a34c | ||
|
|
d8c1e99f02 | ||
|
|
8d0cc271bf | ||
|
|
bbde60d6d2 | ||
|
|
e2b820f0ea | ||
|
|
c970dbb647 | ||
|
|
29c32f04e3 | ||
|
|
00c6777aa1 | ||
|
|
143ae77156 | ||
|
|
87ba25b722 | ||
|
|
dc77b5700c | ||
|
|
0e5c01290d | ||
|
|
ba16543ef5 | ||
|
|
f65e4feda4 | ||
|
|
20181fde3d | ||
|
|
491ed1813e | ||
|
|
caa5dbe679 | ||
|
|
7e6d72f030 | ||
|
|
6ea962c767 | ||
|
|
c87b2d0cee | ||
|
|
c2c31547c2 | ||
|
|
21851b0001 | ||
|
|
bd96cca64f | ||
|
|
02893ad216 | ||
|
|
4f88703159 | ||
|
|
abc62474bf | ||
|
|
3a9754715a | ||
|
|
2f212ab8d5 | ||
|
|
71be1ed5f1 | ||
|
|
1c6896076f | ||
|
|
6a2d265af6 | ||
|
|
6fe9c3735a | ||
|
|
5d43cf4ec4 | ||
|
|
8b3b1eb121 | ||
|
|
836a7b1a88 | ||
|
|
c26edafb17 | ||
|
|
a9bf810ba2 | ||
|
|
a737e92b08 | ||
|
|
54ae55a949 | ||
|
|
5ab53094fa | ||
|
|
aff24aed0d | ||
|
|
b915644ec4 | ||
|
|
28c71a667a | ||
|
|
d45c4f86d3 | ||
|
|
8060534f63 | ||
|
|
80bdf7eae5 | ||
|
|
2dad2b3882 | ||
|
|
aa0a80bea8 | ||
|
|
dec171c4bf | ||
|
|
6d5779844f | ||
|
|
94ed0368b9 | ||
|
|
6c8d9c8c8e | ||
|
|
9de0be49d6 | ||
|
|
5a76218edd | ||
|
|
d84c321376 | ||
|
|
b3262ff512 | ||
|
|
a825563c0b | ||
|
|
da476e0da9 | ||
|
|
46107c39a4 | ||
|
|
a263d88c81 | ||
|
|
9158cd2494 | ||
|
|
2e98f2dd1a | ||
|
|
902b4bda6a | ||
|
|
87b52bb5cd | ||
|
|
e6199b5279 | ||
|
|
e7f995106c | ||
|
|
3bcb1f3af1 | ||
|
|
13a652c81c | ||
|
|
5ddd062e36 | ||
|
|
4bedc6bb31 | ||
|
|
70f94e52ea | ||
|
|
87c3363fa9 | ||
|
|
ca1dc06e04 | ||
|
|
b5ed0a1d3d | ||
|
|
19c8eeb4e8 | ||
|
|
293e62c99d | ||
|
|
2da7dd5982 | ||
|
|
6325b1b630 | ||
|
|
9244e0eee1 | ||
|
|
712d951ffc | ||
|
|
40773632e0 | ||
|
|
88628a2319 | ||
|
|
31120ba5f7 | ||
|
|
75276870db | ||
|
|
fc0b122460 | ||
|
|
d976c362ac | ||
|
|
6c82c26884 | ||
|
|
a0ef3e1865 | ||
|
|
4f91645642 | ||
|
|
46b2bef868 | ||
|
|
26319ee1a1 | ||
|
|
42a8242676 | ||
|
|
57ab773c70 | ||
|
|
219364ee55 | ||
|
|
8b5fc29c7a | ||
|
|
21f4b69b2b | ||
|
|
f76ce400eb | ||
|
|
16204148bb | ||
|
|
1f2d017ae1 | ||
|
|
1b10ad424a | ||
|
|
3e65f6bf57 | ||
|
|
f84d03b2bc | ||
|
|
2db28891e4 | ||
|
|
7adc26fd8b | ||
|
|
fe80df5446 | ||
|
|
8588815ef3 | ||
|
|
a70fc67b0b | ||
|
|
b5c53ae6c7 | ||
|
|
3d018fb061 | ||
|
|
3845e2c145 | ||
|
|
1930c2c33b | ||
|
|
1e2b92b517 | ||
|
|
983fa5a21e | ||
|
|
3ecbb5c314 | ||
|
|
8fa1628958 | ||
|
|
e52b580cad | ||
|
|
4b28e0a8f1 | ||
|
|
91f5ceb3be | ||
|
|
603758b484 | ||
|
|
b6b575c1d5 | ||
|
|
e2f3142c78 | ||
|
|
7623887079 | ||
|
|
1bd6ec4c91 | ||
|
|
33a6aefce8 | ||
|
|
d3f8aaecd8 | ||
|
|
049cca1711 | ||
|
|
a40df45348 | ||
|
|
8f42eaae01 | ||
|
|
ebeefd9f7d | ||
|
|
646f9a4a8b | ||
|
|
b4fa1661af | ||
|
|
ba3c63dbc9 | ||
|
|
350535d498 | ||
|
|
467caa4307 | ||
|
|
01b6956d61 | ||
|
|
61c3a669b4 | ||
|
|
befb6e9b80 | ||
|
|
35e43dabe1 | ||
|
|
b905779950 | ||
|
|
04c32887f1 | ||
|
|
e0a39d68d8 | ||
|
|
92ec8541c1 | ||
|
|
82a7ef78f3 | ||
|
|
236c42c14e | ||
|
|
b8fdc56a8b | ||
|
|
17ad61bd7f | ||
|
|
ec1507ea9d | ||
|
|
69bd1f31fd | ||
|
|
b9d4af72e9 | ||
|
|
fbbc036830 | ||
|
|
c2b0fdd647 | ||
|
|
3706b626fe | ||
|
|
edbfc48fdd | ||
|
|
59c6886c65 | ||
|
|
8091552925 |
No files matched your search
+2
-2
@@ -220,7 +220,7 @@ COMMENT: Using the new OCI8 driver is encouraged where possible.
|
||||
EXTENSION: dom
|
||||
PRIMARY MAINTAINER: Christian Stocker <chregu@php.net>, Rob Richards <rrichards@php.net>, Marcus Boerger <helly@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
STATUS: Working
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: simplexml
|
||||
@@ -247,7 +247,7 @@ STATUS: Experimental
|
||||
EXTENSION: xsl
|
||||
PRIMARY MAINTAINER: Christian Stocker <chregu@php.net>, Rob Richards <rrichards@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
STATUS: Working
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -1,7 +1,213 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2004, PHP 5.0.1
|
||||
09 Dec 2004, PHP 5.0.3RC2
|
||||
- Fixed bug #31034 (Problem with non-existing iconv header file). (Derick)
|
||||
- Fixed bug #28598 (Lost support for MS Symbol fonts). (Pierre)
|
||||
|
||||
29 Nov 2004, PHP 5.0.3RC1
|
||||
- Added the %F modifier to *printf to render a non-locale-aware representation
|
||||
of a float with the . as decimal seperator. (Derick)
|
||||
- Fixed error handling in mysqli_multi_query. (Georg)
|
||||
- Extended the functionality of is_subclass_of() to accept either a class name
|
||||
or an object as first parameter. (Andrey)
|
||||
- Fixed potential problems with unserializing invalid serialize data. (Marcus)
|
||||
- Fixed bug #30995 (snmp extension does not build with net-snmp 5.2). (Ilia)
|
||||
- Fixed bug #30990 (allow popen() on *NIX to accept 'b' flag). (Ilia)
|
||||
- Fixed bug #30967 (properties in extended mysqli classes don't work). (Georg)
|
||||
- Fixed bug #30928 (When Using WSDL, SoapServer doesn't handle private or
|
||||
protected properties). (Dmitry)
|
||||
- Fixed bug #30922 (reflective functions crash PHP when interfaces extend
|
||||
themselves). (Tony, Dmitry)
|
||||
- Fixed bug #30904 (segfault when recording soapclient into session). (Tony,
|
||||
Dmitry)
|
||||
- Fixed bug #30890 (MySQLi testsuite)
|
||||
- Fixed bug #30856 (ReflectionClass::getStaticProperties segfaults). (Marcus)
|
||||
- Fixed bug #30832 ("!" stripped off comments in xml parser). (Rob)
|
||||
- Fixed bug #30799 (SoapServer doesn't handle private or protected properties).
|
||||
(Dmitry)
|
||||
- Fixed bug #30783 (Apache crash when using ReflectionFunction::
|
||||
getStaticVariables()). (Marcus)
|
||||
- Fixed bug #30750 (Meaningful error message when upload directory is not
|
||||
accessible). (Ilia)
|
||||
- Fixed bug #30685 (Malformed SOAPClient http header reequest). (Dmitry)
|
||||
- Fixed bug #30672 (Problem handling exif data in jpeg images at unusual
|
||||
places). (Marcus)
|
||||
- Fixed bug #30658 (Ensure that temporary files created by GD are removed).
|
||||
(Ilia)
|
||||
- Fixed bug #30645 (def. multi result set support for mysql_connect). (Georg)
|
||||
- Fixed bug #30637 (compile with pear error). (Antony)
|
||||
- Fixed bug #30587 (array_multisort doesn't separate zvals before
|
||||
changing them). (Tony)
|
||||
- Fixed bug #30572 (crash when comparing SimpleXML attribute to a boolean).
|
||||
(Andi)
|
||||
- Fixed bug #30566 (attribute namespace URIs are inconsistent when parsing).
|
||||
(Rob)
|
||||
- Fixed bug #30490 (PEAR installation fails). (Antony)
|
||||
- Fixed bug #30475 (curl_getinfo() may crash in some situations). (Ilia)
|
||||
- Fixed bug #30442 (segfault when parsing ?getvariable[][ ). (Tony)
|
||||
- Fixed bug #30388 (rename across filesystems loses ownership and
|
||||
permission info). (Tony)
|
||||
- Fixed bug #30387 (stream_socket_client async connect was broken).
|
||||
(vnegrier at esds dot com, Wez).
|
||||
- Fixed bug #30381 (Strange results with get_class_vars()). (Marcus)
|
||||
- Fixed bug #30375 (cal_info() does not work without a parameter). (Ilia)
|
||||
- Fixed bug #30362 (stream_get_line() not handling end string correctly).
|
||||
(Ilia)
|
||||
- Fixed bug #30359 (SOAP client requests have no port in "Host" field).
|
||||
(Dmitry)
|
||||
- Fixed bug #30356 (str_ireplace() does not work on all strings). (Ilia)
|
||||
- Fixed bug #30344 (Reflection::getModifierNames() returns too long strings).
|
||||
(Marcus)
|
||||
- Fixed bug #30329 (Error Fetching http body, No Content-Length, connection
|
||||
closed or chunked data). (Dmitry)
|
||||
- Fixed bug #30282 (segfault when using unknown/unsupported
|
||||
session.save_handler and/or session.serialize_handler). (Tony)
|
||||
- Fixed bug #30281 (Prevent non-wbmp images from being detected as such).
|
||||
(Ilia)
|
||||
- Fixed bug #30276 (Possible crash in ctype_digit on large numbers). (Ilia)
|
||||
- Fixed bug #30230 (exception handler not working with objects). (Marcus)
|
||||
- Fixed bug #30224 (Sybase date strings are sometimes not null terminated).
|
||||
(Ilia)
|
||||
- Fixed bug #30175 (SOAP results aren't parsed correctly). (Dmitry)
|
||||
- Fixed bug #30147 (OO sqlite_fetch_object did not reset error handler). (Wez)
|
||||
- Fixed bug #30133 (get_current_user() crashes on Windows). (Edin)
|
||||
- Fixed bug #30061 (xml_set_start_namespace_decl_handler not called). (Rob)
|
||||
- Fixed bug #30057 (did not detect IPV6 on FreeBSD 4.1). (Wez)
|
||||
- Fixed bug #30042 (strtotime does not use second param). (Derick)
|
||||
- Fixed bug #30027 (Possible crash inside ftp_get()).
|
||||
(cfield at affinitysolutions dot com)
|
||||
- Fixed bug #29954 (array_reduce segfaults when initial value is array). (Tony)
|
||||
- Fixed bug #29883 (isset gives invalid values on strings). (Tony, Dmitry)
|
||||
- Fixed bug #29801 (Set limit on the size of mmapable data). (Ilia)
|
||||
- Fixed bug #29557 (strtotime error). (Derick)
|
||||
- Fixed bug #29418 (double free when openssl_csr_new fails).
|
||||
(Kamesh Jayachandran).
|
||||
- Fixed bug #29385 (Soapserver always uses std class). (David, Dmitry)
|
||||
- Fixed bug #29211 (SoapClient doesn't request wsdl through proxy). (Rob)
|
||||
- Fixed bug #28817 (Var problem when extending domDocument). (Georg)
|
||||
- Fixed bug #28599 (strtotime fails with zero base time). (Derick)
|
||||
- Fixed bug #28220 (mb_strwidth() returns wrong width values for some hangul
|
||||
characters). (Moriyoshi)
|
||||
- Fixed bug #28209 (strtotime("now")). (Derick)
|
||||
- Fixed bug #27798 (private / protected variables not exposed by
|
||||
get_object_vars() inside class). (Marcus)
|
||||
- Fixed bug #27183 (Userland stream wrapper segfaults on stream_write).
|
||||
(Christian)
|
||||
|
||||
23 Sep 2004, PHP 5.0.2
|
||||
- Added new boolean (fourth) parameter to array_slice() that turns on the
|
||||
preservation of keys in the returned array. (Derick)
|
||||
- Added the sorting flag SORT_LOCALE_STRING to the sort() functions which makes
|
||||
them sort based on the current locale. (Derick)
|
||||
- Added interface_exists() and make class_exists() only return true for real
|
||||
classes. (Andrey)
|
||||
- Added PHP_EOL constant that contains the OS way of representing newlines.
|
||||
(Paul Hudson, Derick)
|
||||
- Implemented periodic PCRE compiled regexp cache cleanup, to avoid memory
|
||||
exhaustion. (Andrei)
|
||||
- Renamed SoapClient->__call() to SoapClinet->__soapCall(). (Dmitry)
|
||||
- Fixed bug with raw_post_data not getting set (Brian)
|
||||
- Fixed a file-descriptor leak with phpinfo() and other 'special' URLs (Zeev)
|
||||
- Fixed bug #30209 (ReflectionClass::getMethod() lowercases attribute).
|
||||
(Marcus)
|
||||
- Fixed bug #30182 (SOAP module processing WSDL file dumps core). (Dmitry)
|
||||
- Fixed bug #30045 (Cannot pass big integers (> 2147483647) in SOAP requests).
|
||||
(Dmitry)
|
||||
- Fixed bug #29985 (unserialize()/ __PHP_Incomplete_class does not report
|
||||
correctly class name). (Marcus, Tony)
|
||||
- Fixed bug #29945 (simplexml_load_file URL limitation 255 char). (Rob)
|
||||
- Fixed bug #29873 (No defines around pcntl_*priority definitions). (Derick)
|
||||
- Fixed bug #29844 (SOAP doesn't return the result of a valid SOAP request).
|
||||
(Dmitry)
|
||||
- Fixed bug #29842 (soapclient return null value). (Dmitry)
|
||||
- Fixed bug #29839 (incorrect convert (xml:lang to lang)). (Dmitry)
|
||||
- Fixed bug #29830 (SoapServer::setClass() should not export non-public
|
||||
methods). (Dmitry)
|
||||
- Fixed bug #29828 (Interfaces no longer work). (Marcus)
|
||||
- Fixed bug #29821 (Fixed possible crashes in convert_uudecode() on invalid
|
||||
data). (Ilia)
|
||||
- Fixed bug #29808 (array_count_values() breaks with numeric strings). (Ilia)
|
||||
- Fixed bug #29805 (HTTP Authentication Issues). (Uwe Schindler)
|
||||
- Fixed bug #29795 (SegFault with Soap and Amazon's Web Services). (Dmitry)
|
||||
- Fixed bug #29737 (ip2long should return -1 if IP is 255.255.255.255 and FALSE
|
||||
on error). (Tony)
|
||||
- Fixed bug #29711 (Changed ext/xml to default to UTF-8 output). (Rob)
|
||||
- Fixed bug #29678 (opendir() with ftp:// wrapper segfaults if path does not
|
||||
have trailing slash). (Ilia)
|
||||
- Fixed bug #29657 (xml_* functions throw non descriptive error).
|
||||
(Christian, Rob)
|
||||
- Fixed bug #29656 (segfault on result and statement properties). (Georg)
|
||||
- Fixed bug #29566 (foreach/string handling strangeness (crash)). (Dmitry)
|
||||
- Fixed bug #29447 (Reflection API issues). (Marcus)
|
||||
- Fixed bug #29296 (Added sslv2 and sslv3 transports). (Wez)
|
||||
- Fixed bug #29283 (Invalid statement handle in mysqli on execute). (Georg)
|
||||
- Fixed bug #29913 (parse_url() is now binary safe). (Ilia)
|
||||
- Fixed bug #27994 (segfault with Soapserver when WSDL-Cache is enabled).
|
||||
(Dmitry)
|
||||
- Fixed bug #27791 (Apache 2.0 SAPI build against Apache 2 HEAD). (Joe Orton,
|
||||
Derick)
|
||||
- Fixed bug #26737 (private/protected properties not serialized when user
|
||||
declared method __sleep() exists). E_NOTICE thrown when __sleep() returns
|
||||
name of non-existing member. (Andrey, Curt)
|
||||
|
||||
12 Aug 2004, PHP 5.0.1
|
||||
- Changed destructor mechanism so that destructors are called prior to request
|
||||
shutdown. (Marcus)
|
||||
- Rewritten UNIX and Windows install help files. (Documentation Team)
|
||||
- Updated several libraries bundled with the windows release which now
|
||||
includes libxml2-2.6.11, libxslt-1.1.7 and iconv-1.9.1. (Rob, Edin)
|
||||
- Improved and moved ActiveScript SAPI to PECL. (Wez)
|
||||
- Fixed bug #29606 (php_strip_whitespace() prints to stdout rather then
|
||||
returning the value). (Ilia)
|
||||
- Fixed bug #29577 (MYSQLI_CLIENT_FOUND_ROWS undefined) (Georg)
|
||||
- Fixed bug #29573 (Segmentation fault, when exception thrown within
|
||||
PHP function called from XSLT). (Christian)
|
||||
- Fixed bug #29522 (accessing properties without connection) (Georg)
|
||||
- Fixed bug #29505 (get_class_vars() severely broken when used with arrays).
|
||||
(Marcus)
|
||||
- Fixed bug #29490 (.Net object instantiation failed). (Michael Sisolak).
|
||||
- Fixed bug #29474 (win32: usleep() doesn't work). (Wez)
|
||||
- Fixed bug #29449 (win32: feof() hangs on empty tcp stream). (Wez)
|
||||
- Fixed bug #29437 (Possible crash inside array_walk_recursive()). (Ilia)
|
||||
- Fixed bug #29431 (crash when parsing invalid address; invalid address
|
||||
returned by stream_socket_recvfrom(), stream_socket_getname()). (Wez)
|
||||
- Fixed bug #29409 (Segfault in PHP functions called from XSLT). (Rob)
|
||||
- Fixed unloading of dynamically loaded extensions.
|
||||
(Marcus, kameshj at fastmail dot fm)
|
||||
- Fixed bug #29395 (sqlite_escape_string() returns bogus data on empty
|
||||
strings). (Ilia, Tony)
|
||||
- Fixed bug #29392 (com_dotnet crashes when echo'ing an object). (Wez)
|
||||
- Fixed bug #29368 (The destructor is called when an exception is thrown from
|
||||
the constructor). (Marcus)
|
||||
- Fixed bug #29354 (Exception constructor marked as both public and protected).
|
||||
(Marcus)
|
||||
- Fixed bug #29342 (strtotime() does not handle empty date string properly).
|
||||
(Ilia)
|
||||
- Fixed bug #29340 (win32 build produces invalid php_ifx.dll). (Edin)
|
||||
- Fixed bug #29335 (fetch functions now use MYSQLI_BOTH as default) (Georg)
|
||||
- Fixed bug #29291 (get_class_vars() return names with NULLs). (Marcus)
|
||||
- Fixed bug #29264 (gettext extension not working). (Edin)
|
||||
- Fixed bug #29258 (variant_date_from_timestamp() does not honour
|
||||
timezone). (Wez)
|
||||
- Fixed bug #29256 (error when sending large packets on a socket). (Dmitry)
|
||||
- Fixed bug #29236 (memory error when wsdl-cache is enabled). (Dmitry)
|
||||
- Fixed bug #29147 (Compile Error in mnoGoSearch functions). (Sergey, Antony)
|
||||
- Fixed bug #29132 ($_SERVER["PHP_AUTH_USER"] isn't defined). (Stefan)
|
||||
- Fixed bug #29119 (html_entity_decode() misbehaves with UTF-8). (Moriyoshi)
|
||||
- Fixed bug #29109 (SoapFault exception: [WSDL] Out of memory). (Dmitry)
|
||||
- Fixed bug #29061 (soap extension segfaults). (Dmitry)
|
||||
- Fixed bug #28985 (__getTypes() returning nothing on complex WSDL). (Dmitry)
|
||||
- Fixed bug #28969 (Wrong data encoding of special characters). (Dmitry)
|
||||
- Fixed bug #28895 (ReflectionClass::isAbstract always returns false). (Marcus)
|
||||
- Fixed bug #28829 (Thread-unsafety in bcmath elementary values). (Sara)
|
||||
- Fixed bug #28464 (catch() does not catch exceptions by interfaces). (Marcus)
|
||||
- Fixed bug #27669 (PHP 5 didn't support all possibilities for calling static
|
||||
methods dynamically). (Dmitry)
|
||||
- Fixed ReflectionClass::getMethod() and ReflectionClass::getProperty() to
|
||||
raise an ReflectionException instead of returning NULL on failure.
|
||||
(Sebastian)
|
||||
- Fixed convert.* filters to consume remaining buckets_in on flush. (Sara)
|
||||
- Fixed bug in mysqli->client_version. (Georg)
|
||||
|
||||
13 Jul 2004, PHP 5.0.0
|
||||
- Updated PCRE to provide better error handling in certain cases. (Andrei)
|
||||
@@ -10,7 +216,6 @@ PHP NEWS
|
||||
- Fixed bug #29008 (array_combine() does not handle non-numeric/string keys).
|
||||
(Ilia)
|
||||
- Fixed bug #28999 (fixed behaviour of exec() to work as it did in 4.X). (Ilia)
|
||||
- Fixed bug #28895 (ReflectionClass::isAbstract always returns false). (Marcus)
|
||||
- Fixed bug #28868 (Internal filter registry not thread safe). (Sara)
|
||||
- Fixed bug #28851 (call_user_func_array has typo in error message). (Marcus)
|
||||
- Fixed bug #28831 (ArrayObject::offsetGet() does the work of offsetUnset()).
|
||||
@@ -27,7 +232,6 @@ PHP NEWS
|
||||
- Fixed bug #28699 (Reflection api bugs). (Marcus)
|
||||
- Fixed bug #28694 (ReflectionExtension::getFunctions() crashes PHP). (Marcus)
|
||||
- Fixed bug #28512 (Allocate enough space to store MSSQL data). (Frank)
|
||||
- Fixed bug #28325 (Circular references not properly serialised). (Moriyoshi)
|
||||
- Fixed strip_tags() to correctly handle '\0' characters. (Stefan)
|
||||
|
||||
7 Jun 2004, PHP 5 Release Candidate 3
|
||||
@@ -112,7 +316,6 @@ PHP NEWS
|
||||
- Fixed bug #27619 (filters not applied to pre-buffered stream data). (Sara)
|
||||
- Fixed bug #27519 (Reflection_Function constructor crashes with non-existant
|
||||
function's name). (Marcus)
|
||||
- Fixed bug #27469 (serialize() objects of incomplete class). (Dmitry)
|
||||
- Fixed bug #27457 (handling of numeric indexes in strtr()). (Dmitry)
|
||||
- Fixed bug #27397 (debug_backtrace() not showing function arguments). (Zeev)
|
||||
- Fixed bug #27283 (The last catch statement was sometimes skipped). (Andi)
|
||||
|
||||
+10
-18
@@ -37,8 +37,11 @@ The next few rules are more of a technical nature.
|
||||
messages every day. Woe be to those who attempt to mess with it.
|
||||
|
||||
2. All news updates intended for public viewing, such as new features,
|
||||
bug fixes, improvements, etc., should go into the NEWS file. Also see
|
||||
the note below about automatically updating NEWS in your commit message.
|
||||
bug fixes, improvements, etc., should go into the NEWS file.
|
||||
|
||||
NB! Lines, starting with @ will go automagically into NEWS file, but
|
||||
this is NOT recommended, though. Please, add news entries directly to
|
||||
NEWS file and don't forget to keep them adjusted and sorted.
|
||||
|
||||
3. Do not commit multiple file and dump all messages in one commit. If you
|
||||
modified several unrelated files, commit each group separately and
|
||||
@@ -59,14 +62,10 @@ The next few rules are more of a technical nature.
|
||||
The format of the commit messages is pretty simple.
|
||||
|
||||
If a line begins with #, it is taken to be a comment and will not appear
|
||||
in the ChangeLog. If the line begins with @, it will be redirected to the
|
||||
NEWS file. Everything else goes into the ChangeLog.
|
||||
in the ChangeLog. Everything else goes into the ChangeLog.
|
||||
|
||||
It is important to note that if your comment or news logline spans multiple
|
||||
lines, you have to put # or @ at the beginning of _every_ such line. Every
|
||||
entry in NEWS has to have a name after it, so if you did it with someone's
|
||||
help, put both your names there. Your name WILL NOT be automatically put
|
||||
at the end of the NEWS entry - so, please provide it yourself.
|
||||
lines, you have to put # at the beginning of _every_ such line.
|
||||
|
||||
Example. Say you modified two files, datetime.c and string.c. In datetime.c
|
||||
you added a new format option for date() function, and in string.c you fixed
|
||||
@@ -78,17 +77,12 @@ For datetime.c:
|
||||
|
||||
(PHP date) Added new 'K' format modifier for printing out number of
|
||||
days until New Year's Eve.
|
||||
@- Added new 'K' format modifier that will output the number of days
|
||||
@ until New Year's Eve. (Bob)
|
||||
|
||||
For string.c:
|
||||
(php_trim) Fixed a memory leak resulting from improper use of zval_dtor().
|
||||
# Man, that thing was leaking all over the place!
|
||||
@- Fixed memory leak in trim(). (Bob)
|
||||
|
||||
The lines above marked with @ will go into NEWS file automagically, and the
|
||||
# lines will be omitted from the ChangeLog. Alternatively, you might want
|
||||
to modify NEWS file directly and not use the @ lines.
|
||||
The # lines will be omitted from the ChangeLog automagically.
|
||||
|
||||
If you fix some bugs, you should note the bug ID numbers in your
|
||||
commit message. Bug ID should be prefixed by "#" for easier access to
|
||||
@@ -97,12 +91,10 @@ bug report when developers are browsing CVS via. LXR or Bonsai.
|
||||
Example:
|
||||
|
||||
Fixed pgsql notice handler double free crash bug. Bug #14016
|
||||
@ Fixed pgsql notice handler double free crash bug. Bug #14016
|
||||
|
||||
If you don't see your messages in ChangeLog and NEWS right away, don't worry!
|
||||
If you don't see your messages in ChangeLog right away, don't worry!
|
||||
These files are updated once a day, so your stuff will not show up until
|
||||
somewhat later. Don't go adding stuff to NEWS by hand if you already put @
|
||||
lines in the commit message.
|
||||
somewhat later.
|
||||
|
||||
You can use LXR (http://lxr.php.net/) and Bonsai (http://bonsai.php.net/)
|
||||
to look at PHP CVS repository in various ways.
|
||||
|
||||
@@ -77,20 +77,24 @@
|
||||
|
||||
9. get_class() starting PHP 5 returns the name of the class as it was
|
||||
declared which may lead to problems in older scripts that rely on
|
||||
the previous behaviour - the class name is lowercased.
|
||||
the previous behaviour - the class name is lowercased. Expect the
|
||||
same behaviour from get_parent_class() when applicable.
|
||||
Example :
|
||||
<?php
|
||||
class FooBar {
|
||||
}
|
||||
class ExtFooBar extends FooBar{}
|
||||
$a = new FooBar();
|
||||
var_dump(get_class($a));
|
||||
var_dump(get_class($a), get_parent_class($a));
|
||||
?>
|
||||
|
||||
Output (PHP 4):
|
||||
string(6) "foobar"
|
||||
string(9) "extfoobar"
|
||||
|
||||
Output (PHP 5):
|
||||
string(6) "FooBar"
|
||||
string(9) "ExtFooBar"
|
||||
----------------------------------------------------------------------
|
||||
Example code that will break :
|
||||
//....
|
||||
@@ -101,7 +105,51 @@
|
||||
//...
|
||||
}
|
||||
//...
|
||||
Possible solution is to search for get_class() in all your scripts and
|
||||
use strtolower().
|
||||
Possible solution is to search for get_class() and get_parent_class() in
|
||||
all your scripts and use strtolower().
|
||||
|
||||
10. get_class_methods() returns the names of the methods of a class as they
|
||||
declared. In PHP4 the names are all lowercased.
|
||||
Example code :
|
||||
<?php
|
||||
class Foo{
|
||||
function doFoo(){}
|
||||
function hasFoo(){}
|
||||
}
|
||||
var_dump(get_class_methods("Foo"));
|
||||
?>
|
||||
Output (PHP4):
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(5) "dofoo"
|
||||
[1]=>
|
||||
string(6) "hasfoo"
|
||||
}
|
||||
Output (PHP5):
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(5) "doFoo"
|
||||
[1]=>
|
||||
string(6) "hasFoo"
|
||||
}
|
||||
|
||||
11. Assignment $this is impossible. Starting PHP 5.0.0 $this has special
|
||||
meaning in class methods and is recognized by the PHP parser. The latter
|
||||
will generate a parse error when assignment to $this is found
|
||||
Example code :
|
||||
<?php
|
||||
class Foo {
|
||||
function assignNew($obj) {
|
||||
$this = $obj;
|
||||
}
|
||||
}
|
||||
$a = new Foo();
|
||||
$b = new Foo();
|
||||
$a->assignNew($b);
|
||||
echo "I was executed\n";
|
||||
?>
|
||||
Output (PHP 4):
|
||||
I was executed
|
||||
Output (PHP 5):
|
||||
PHP Fatal error: Cannot re-assign $this in /tmp/this_ex.php on line 4
|
||||
|
||||
|
||||
+51
-10
@@ -308,15 +308,22 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
|
||||
if (path_length == 0)
|
||||
return (0);
|
||||
if (path_length >= MAXPATHLEN)
|
||||
return (1);
|
||||
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
/* cwd_length can be 0 when getcwd() fails.
|
||||
* This can happen under solaris when a dir does not have read permissions
|
||||
* but *does* have execute permissions */
|
||||
if (IS_ABSOLUTE_PATH(path, path_length) || (state->cwd_length < 1)) {
|
||||
if (use_realpath && realpath(path, resolved_path)) {
|
||||
path = resolved_path;
|
||||
path_length = strlen(path);
|
||||
if (use_realpath) {
|
||||
if (realpath(path, resolved_path)) {
|
||||
path = resolved_path;
|
||||
path_length = strlen(path);
|
||||
} else {
|
||||
/* disable for now
|
||||
return 1; */
|
||||
}
|
||||
}
|
||||
} else { /* Concat current directory with relative path and then run realpath() on it */
|
||||
char *tmp;
|
||||
@@ -332,9 +339,19 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
memcpy(ptr, path, path_length);
|
||||
ptr += path_length;
|
||||
*ptr = '\0';
|
||||
if (use_realpath && realpath(tmp, resolved_path)) {
|
||||
path = resolved_path;
|
||||
path_length = strlen(path);
|
||||
if (strlen(tmp) >= MAXPATHLEN) {
|
||||
free(tmp);
|
||||
return 1;
|
||||
}
|
||||
if (use_realpath) {
|
||||
if (realpath(tmp, resolved_path)) {
|
||||
path = resolved_path;
|
||||
path_length = strlen(path);
|
||||
} else {
|
||||
/* disable for now
|
||||
free(tmp);
|
||||
return 1; */
|
||||
}
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
@@ -851,13 +868,24 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
|
||||
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
|
||||
{
|
||||
int command_length;
|
||||
int dir_length, extra = 0;
|
||||
char *command_line;
|
||||
char *ptr;
|
||||
char *ptr, *dir;
|
||||
FILE *retval;
|
||||
|
||||
command_length = strlen(command);
|
||||
|
||||
ptr = command_line = (char *) malloc(command_length + sizeof("cd ; ") + CWDG(cwd).cwd_length+1);
|
||||
dir_length = CWDG(cwd).cwd_length;
|
||||
dir = CWDG(cwd).cwd;
|
||||
while (dir_length > 0) {
|
||||
if (*dir == '\'') extra+=3;
|
||||
dir++;
|
||||
dir_length--;
|
||||
}
|
||||
dir_length = CWDG(cwd).cwd_length;
|
||||
dir = CWDG(cwd).cwd;
|
||||
|
||||
ptr = command_line = (char *) malloc(command_length + sizeof("cd '' ; ") + dir_length +1+1);
|
||||
if (!command_line) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -867,8 +895,21 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
|
||||
if (CWDG(cwd).cwd_length == 0) {
|
||||
*ptr++ = DEFAULT_SLASH;
|
||||
} else {
|
||||
memcpy(ptr, CWDG(cwd).cwd, CWDG(cwd).cwd_length);
|
||||
ptr += CWDG(cwd).cwd_length;
|
||||
*ptr++ = '\'';
|
||||
while (dir_length > 0) {
|
||||
switch (*dir) {
|
||||
case '\'':
|
||||
*ptr++ = '\'';
|
||||
*ptr++ = '\\';
|
||||
*ptr++ = '\'';
|
||||
/* fall-through */
|
||||
default:
|
||||
*ptr++ = *dir;
|
||||
}
|
||||
dir++;
|
||||
dir_length--;
|
||||
}
|
||||
*ptr++ = '\'';
|
||||
}
|
||||
|
||||
*ptr++ = ' ';
|
||||
|
||||
+2
-1
@@ -16,7 +16,8 @@ libZend_la_SOURCES=\
|
||||
zend_ini.c zend_qsort.c zend_objects.c zend_object_handlers.c \
|
||||
zend_objects_API.c zend_ts_hash.c zend_stream.c zend_mm.c \
|
||||
zend_default_classes.c zend_reflection_api.c \
|
||||
zend_iterators.c zend_interfaces.c zend_exceptions.c
|
||||
zend_iterators.c zend_interfaces.c zend_exceptions.c \
|
||||
zend_strtod.c
|
||||
|
||||
libZend_la_LDFLAGS =
|
||||
libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
|
||||
|
||||
+42
-1
@@ -545,7 +545,7 @@ Changes in the Zend Engine 2.0
|
||||
|
||||
<?php
|
||||
class Exception {
|
||||
function __construct(string $message=NULL, int $code=0) {
|
||||
function __construct(/*string*/ $message=NULL, /*int*/ $code=0) {
|
||||
if (func_num_args()) {
|
||||
$this->message = $message;
|
||||
}
|
||||
@@ -890,6 +890,47 @@ Changes in the Zend Engine 2.0
|
||||
the use of all abstract methods declared in the interfaces Iterator
|
||||
and IteratorAggregate respectively.
|
||||
|
||||
* Array overloading
|
||||
|
||||
Objects can be used with Array notation when they implement the
|
||||
interface ArrayAccess. You cannot use such objects in standard
|
||||
array functions, however you have full control over the array
|
||||
notation. This allows lazy initialization or read only array.
|
||||
|
||||
Note that setting [] results in a call to offsetSet() with
|
||||
index being NULL. That means that as with standard arrays you
|
||||
cannot store NULL keys.
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
class ArrayClass implements ArrayAccess {
|
||||
public $a = array();
|
||||
|
||||
function offsetExists($index) {
|
||||
return array_key_exists($index, $this->a);
|
||||
}
|
||||
function offsetGet($index) {
|
||||
return $this->a[$index];
|
||||
}
|
||||
function offsetSet($index, $newval) {
|
||||
return $this->a[$index] = $newval;
|
||||
}
|
||||
function offsetUnset($index) {
|
||||
unset($this->a[$index]);
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new ArrayClass;
|
||||
|
||||
$obj[0] = 'bla'; // calls offsetSet(0,'bla')
|
||||
$obj[] = 42; // calls offsetSet(NULL, 42)
|
||||
$x = $obj[0]; // calls offsetGet(0)
|
||||
$b = isset($obj[0]); // calls offsetExists(0)
|
||||
unset($obj[0]); // calls offsetUnset(0)
|
||||
?>
|
||||
|
||||
|
||||
* __METHOD__
|
||||
|
||||
The pseudo constant __METHOD__ shows the current class and method
|
||||
|
||||
+27
-19
@@ -7,20 +7,20 @@
|
||||
CFG=Zend - Win32 Release_inline
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Zend.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Zend.mak" CFG="Zend - Win32 Release_inline"
|
||||
!MESSAGE
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE
|
||||
!MESSAGE "Zend - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "Zend - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "Zend - Win32 Release_inline" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
@@ -95,7 +95,7 @@ LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
@@ -135,10 +135,6 @@ SOURCE=.\zend_default_classes.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_interfaces.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_dynamic_array.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -179,6 +175,10 @@ SOURCE=.\zend_ini_scanner.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_interfaces.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_parser.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -243,6 +243,10 @@ SOURCE=.\zend_stream.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_strtod.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ts_hash.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -291,10 +295,6 @@ SOURCE=.\zend_default_classes.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_interfaces.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_dynamic_array.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -351,6 +351,10 @@ SOURCE=.\zend_ini_scanner.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_interfaces.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_istdiostream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -415,6 +419,10 @@ SOURCE=.\zend_stream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_strtod.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ts_hash.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -449,7 +457,7 @@ BuildCmds= \
|
||||
|
||||
!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
|
||||
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -504,7 +512,7 @@ BuildCmds= \
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
@@ -533,7 +541,7 @@ InputPath=.\zend_ini_scanner.l
|
||||
|
||||
!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
|
||||
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -570,7 +578,7 @@ InputPath=".\zend_language_scanner.l"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
|
||||
@@ -276,6 +276,10 @@ SOURCE=.\zend_stream.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_strtod.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ts_hash.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -452,6 +456,10 @@ SOURCE=.\zend_stream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_strtod.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ts_hash.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
Executable
+72
@@ -0,0 +1,72 @@
|
||||
--TEST--
|
||||
Bug #27798 (private / protected variables not exposed by get_object_vars() inside class)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Base
|
||||
{
|
||||
public $Foo = 1;
|
||||
protected $Bar = 2;
|
||||
private $Baz = 3;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
echo __METHOD__ . "\n";
|
||||
var_dump(get_object_vars($this));
|
||||
}
|
||||
}
|
||||
|
||||
class Child extends Base
|
||||
{
|
||||
private $Baz = 4;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
echo __METHOD__ . "\n";
|
||||
var_dump(get_object_vars($this));
|
||||
}
|
||||
}
|
||||
|
||||
var_dump(get_object_vars(new Base));
|
||||
var_dump(get_object_vars(new Child));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
Base::__construct
|
||||
array(3) {
|
||||
["Foo"]=>
|
||||
int(1)
|
||||
["Bar"]=>
|
||||
int(2)
|
||||
["Baz"]=>
|
||||
int(3)
|
||||
}
|
||||
array(1) {
|
||||
["Foo"]=>
|
||||
int(1)
|
||||
}
|
||||
Base::__construct
|
||||
array(3) {
|
||||
["Baz"]=>
|
||||
int(4)
|
||||
["Foo"]=>
|
||||
int(1)
|
||||
["Bar"]=>
|
||||
int(2)
|
||||
}
|
||||
Child::__construct
|
||||
array(3) {
|
||||
["Baz"]=>
|
||||
int(4)
|
||||
["Foo"]=>
|
||||
int(1)
|
||||
["Bar"]=>
|
||||
int(2)
|
||||
}
|
||||
array(1) {
|
||||
["Foo"]=>
|
||||
int(1)
|
||||
}
|
||||
===DONE===
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
--TEST--
|
||||
Bug #28444 (Cannot access undefined property for object with overloaded property access)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Object
|
||||
{
|
||||
public $x;
|
||||
|
||||
function __construct($x)
|
||||
{
|
||||
$this->x = $x;
|
||||
}
|
||||
}
|
||||
|
||||
class Overloaded
|
||||
{
|
||||
public $props = array();
|
||||
public $x;
|
||||
|
||||
function __construct($x)
|
||||
{
|
||||
$this->x = new Object($x);
|
||||
}
|
||||
|
||||
function __get($prop)
|
||||
{
|
||||
echo __METHOD__ . "($prop)\n";
|
||||
return $this->props[$prop];
|
||||
}
|
||||
|
||||
function __set($prop, $val)
|
||||
{
|
||||
echo __METHOD__ . "($prop,$val)\n";
|
||||
$this->props[$prop] = $val;
|
||||
}
|
||||
}
|
||||
$y = new Overloaded(2);
|
||||
var_dump($y->x);
|
||||
var_dump($y->x->x);
|
||||
var_dump($y->x->x = 3);
|
||||
var_dump($y->y = 3);
|
||||
var_dump($y->y);
|
||||
var_dump($y->z = new Object(4));
|
||||
var_dump($y->z->x);
|
||||
$t = $y->z;
|
||||
var_dump($t->x = 5);
|
||||
var_dump($y->z->x = 6);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
object(Object)#%d (1) {
|
||||
["x"]=>
|
||||
int(2)
|
||||
}
|
||||
int(2)
|
||||
int(3)
|
||||
Overloaded::__set(y,3)
|
||||
int(3)
|
||||
Overloaded::__get(y)
|
||||
int(3)
|
||||
Overloaded::__set(z,Object id #3)
|
||||
object(Object)#%d (1) {
|
||||
["x"]=>
|
||||
int(4)
|
||||
}
|
||||
Overloaded::__get(z)
|
||||
int(4)
|
||||
Overloaded::__get(z)
|
||||
int(5)
|
||||
Overloaded::__get(z)
|
||||
int(6)
|
||||
===DONE===
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
--TEST--
|
||||
Bug #29368 (The destructor is called when an exception is thrown from the constructor)
|
||||
--FILE--
|
||||
<?
|
||||
|
||||
class Foo
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
echo __METHOD__ . "\n";
|
||||
throw new Exception;
|
||||
}
|
||||
function __destruct()
|
||||
{
|
||||
echo __METHOD__ . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$bar = new Foo;
|
||||
} catch(Exception $exc)
|
||||
{
|
||||
echo "Caught exception!\n";
|
||||
}
|
||||
|
||||
unset($bar);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Foo::__construct
|
||||
Caught exception!
|
||||
===DONE===
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Bug #29505 (get_class_vars() severely broken when used with arrays)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
public $empty = array();
|
||||
public $three = array(1, "b"=>"c", 3=>array());
|
||||
}
|
||||
|
||||
var_dump(get_class_vars('Test'));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
["empty"]=>
|
||||
array(0) {
|
||||
}
|
||||
["three"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
["b"]=>
|
||||
string(1) "c"
|
||||
[3]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #29883 (isset gives invalid values on strings)
|
||||
--FILE--
|
||||
<?php
|
||||
$x = "bug";
|
||||
var_dump(isset($x[-1]));
|
||||
var_dump(isset($x["1"]));
|
||||
echo $x["1"]."\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(true)
|
||||
u
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #30922 (reflective functions crash PHP when interfaces extend themselves)
|
||||
--FILE--
|
||||
<?php
|
||||
interface RecurisiveFooFar extends RecurisiveFooFar {}
|
||||
class A implements RecurisiveFooFar {}
|
||||
|
||||
$a = new A();
|
||||
var_dump($a instanceOf A);
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Interface RecurisiveFooFar cannot not implement itself in %sbug30922.php on line %d
|
||||
+10
-2
@@ -83,7 +83,6 @@ ZEND_INI_END()
|
||||
ZEND_API int compiler_globals_id;
|
||||
ZEND_API int executor_globals_id;
|
||||
ZEND_API int alloc_globals_id;
|
||||
zend_class_entry global_main_class;
|
||||
HashTable *global_function_table;
|
||||
HashTable *global_class_table;
|
||||
HashTable *global_constants_table;
|
||||
@@ -866,6 +865,7 @@ ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval
|
||||
ZEND_API void zend_error(int type, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_list usr_copy;
|
||||
zval ***params;
|
||||
zval *retval;
|
||||
zval *z_error_type, *z_error_message, *z_error_filename, *z_error_lineno, *z_context;
|
||||
@@ -937,7 +937,15 @@ ZEND_API void zend_error(int type, const char *format, ...)
|
||||
ALLOC_INIT_ZVAL(z_error_lineno);
|
||||
ALLOC_INIT_ZVAL(z_context);
|
||||
|
||||
z_error_message->value.str.len = zend_vspprintf(&z_error_message->value.str.val, 0, format, args);
|
||||
#if defined(va_copy)
|
||||
va_copy(usr_copy, args);
|
||||
#else
|
||||
usr_copy = args;
|
||||
#endif
|
||||
z_error_message->value.str.len = zend_vspprintf(&z_error_message->value.str.val, 0, format, usr_copy);
|
||||
#if defined(va_copy)
|
||||
va_end(usr_copy);
|
||||
#endif
|
||||
z_error_message->type = IS_STRING;
|
||||
|
||||
z_error_type->value.lval = type;
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "2.0.1-dev"
|
||||
#define ZEND_VERSION "2.0.3RC2"
|
||||
|
||||
#define ZEND_ENGINE_2
|
||||
|
||||
@@ -91,7 +91,7 @@ const char *zend_mh_bundle_error(void);
|
||||
|
||||
#endif /* HAVE_MACH_O_DYLD_H */
|
||||
|
||||
#if defined(HAVE_LIBDL)
|
||||
#if defined(HAVE_LIBDL) && !defined(HAVE_MACH_O_DYLD_H)
|
||||
|
||||
# ifndef RTLD_LAZY
|
||||
# define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
|
||||
|
||||
+82
-15
@@ -316,11 +316,13 @@ static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
|
||||
*pl = Z_STRLEN_PP(arg);
|
||||
break;
|
||||
case IS_OBJECT: {
|
||||
if (Z_OBJ_HANDLER_PP(arg, cast_object)
|
||||
&& Z_OBJ_HANDLER_PP(arg, cast_object)(*arg, *arg, IS_STRING, 0 TSRMLS_CC) == SUCCESS) {
|
||||
*pl = Z_STRLEN_PP(arg);
|
||||
*p = Z_STRVAL_PP(arg);
|
||||
break;
|
||||
if (Z_OBJ_HANDLER_PP(arg, cast_object)) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(arg);
|
||||
if (Z_OBJ_HANDLER_PP(arg, cast_object)(*arg, *arg, IS_STRING, 0 TSRMLS_CC) == SUCCESS) {
|
||||
*pl = Z_STRLEN_PP(arg);
|
||||
*p = Z_STRVAL_PP(arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1216,6 +1218,29 @@ ZEND_API int zend_startup_module(zend_module_entry *module)
|
||||
return zend_register_module_ex(module TSRMLS_CC);
|
||||
}
|
||||
|
||||
void zend_check_magic_method_implementation(zend_class_entry *ce, zend_function *fptr, int error_type TSRMLS_DC)
|
||||
{
|
||||
char lcname[16];
|
||||
int name_len;
|
||||
|
||||
/* we don't care if the function name is longer, in fact lowercasing only
|
||||
* the beginning of the name speeds up the check process */
|
||||
name_len = strlen(fptr->common.function_name);
|
||||
zend_str_tolower_copy(lcname, fptr->common.function_name, MIN(name_len, sizeof(lcname)-1));
|
||||
lcname[sizeof(lcname)-1] = '\0'; /* zend_str_tolower_copy won't necessarily set the zero byte */
|
||||
|
||||
if (name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)) && fptr->common.num_args != 0) {
|
||||
zend_error(error_type, "Destuctor %s::%s() cannot take arguments", ce->name, ZEND_DESTRUCTOR_FUNC_NAME);
|
||||
} else if (name_len == sizeof(ZEND_CLONE_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)) && fptr->common.num_args != 0) {
|
||||
zend_error(error_type, "Method %s::%s() cannot accept any arguments", ce->name, ZEND_CLONE_FUNC_NAME);
|
||||
} else if (name_len == sizeof(ZEND_GET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)) && fptr->common.num_args != 1) {
|
||||
zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_GET_FUNC_NAME);
|
||||
} else if (name_len == sizeof(ZEND_SET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)) && fptr->common.num_args != 2) {
|
||||
zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_SET_FUNC_NAME);
|
||||
} else if (name_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)) && fptr->common.num_args != 2) {
|
||||
zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_CALL_FUNC_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
/* registers all functions in *library_functions in the function hash */
|
||||
ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC)
|
||||
@@ -1226,9 +1251,11 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
int count=0, unload=0;
|
||||
HashTable *target_function_table = function_table;
|
||||
int error_type;
|
||||
zend_function *ctor = NULL, *dtor = NULL, *clone = NULL;
|
||||
zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__call = NULL;
|
||||
char *lowercase_name;
|
||||
int fname_len;
|
||||
char *lc_class_name;
|
||||
int class_name_len;
|
||||
|
||||
if (type==MODULE_PERSISTENT) {
|
||||
error_type = E_CORE_WARNING;
|
||||
@@ -1240,6 +1267,11 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
target_function_table = CG(function_table);
|
||||
}
|
||||
internal_function->type = ZEND_INTERNAL_FUNCTION;
|
||||
|
||||
if (scope) {
|
||||
class_name_len = strlen(scope->name);
|
||||
lc_class_name = zend_str_tolower_dup(scope->name, class_name_len);
|
||||
}
|
||||
|
||||
while (ptr->fname) {
|
||||
internal_function->handler = ptr->handler;
|
||||
@@ -1309,18 +1341,28 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
* If it's an old-style constructor, store it only if we don't have
|
||||
* a constructor already.
|
||||
*/
|
||||
if (!strcmp(ptr->fname, scope->name) && !ctor) {
|
||||
if ((fname_len == class_name_len) && !memcmp(lowercase_name, lc_class_name, class_name_len+1) && !ctor) {
|
||||
ctor = reg_function;
|
||||
} else if (!strcmp(ptr->fname, ZEND_CONSTRUCTOR_FUNC_NAME)) {
|
||||
} else if ((fname_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME))) {
|
||||
ctor = reg_function;
|
||||
} else if (!strcmp(ptr->fname, ZEND_DESTRUCTOR_FUNC_NAME)) {
|
||||
} else if ((fname_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME))) {
|
||||
dtor = reg_function;
|
||||
if (internal_function->num_args) {
|
||||
zend_error(error_type, "Destructor %s::%s() cannot take arguments", scope->name, ptr->fname);
|
||||
}
|
||||
|
||||
} else if (!strcmp(ptr->fname, ZEND_CLONE_FUNC_NAME)) {
|
||||
} else if ((fname_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME))) {
|
||||
clone = reg_function;
|
||||
} else if ((fname_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME))) {
|
||||
__call = reg_function;
|
||||
} else if ((fname_len == sizeof(ZEND_GET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME))) {
|
||||
__get = reg_function;
|
||||
} else if ((fname_len == sizeof(ZEND_SET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME))) {
|
||||
__set = reg_function;
|
||||
} else {
|
||||
reg_function = NULL;
|
||||
}
|
||||
if (reg_function) {
|
||||
zend_check_magic_method_implementation(scope, reg_function, error_type TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
ptr++;
|
||||
@@ -1328,9 +1370,12 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
free_alloca(lowercase_name);
|
||||
}
|
||||
if (unload) { /* before unloading, display all remaining bad function in the module */
|
||||
if (scope) {
|
||||
efree(lc_class_name);
|
||||
}
|
||||
while (ptr->fname) {
|
||||
if (zend_hash_exists(target_function_table, ptr->fname, strlen(ptr->fname)+1)) {
|
||||
zend_error(error_type, "Function registration failed - duplicate name - %s", ptr->fname);
|
||||
zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
@@ -1341,27 +1386,49 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
scope->constructor = ctor;
|
||||
scope->destructor = dtor;
|
||||
scope->clone = clone;
|
||||
scope->__call = __call;
|
||||
scope->__get = __get;
|
||||
scope->__set = __set;
|
||||
if (ctor) {
|
||||
ctor->common.fn_flags |= ZEND_ACC_CTOR;
|
||||
if (ctor->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Constructor %s::%s cannot be static", ctor->common.scope->name, ctor->common.function_name);
|
||||
zend_error(error_type, "Constructor %s::%s() cannot be static", scope->name, ctor->common.function_name);
|
||||
}
|
||||
ctor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
if (dtor) {
|
||||
dtor->common.fn_flags |= ZEND_ACC_DTOR;
|
||||
if (dtor->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Destructor %s::%s cannot be static", dtor->common.scope->name, dtor->common.function_name);
|
||||
zend_error(error_type, "Destructor %s::%s() cannot be static", scope->name, dtor->common.function_name);
|
||||
}
|
||||
dtor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
if (clone) {
|
||||
clone->common.fn_flags |= ZEND_ACC_CLONE;
|
||||
if (clone->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Constructor %s::%s cannot be static", clone->common.scope->name, clone->common.function_name);
|
||||
zend_error(error_type, "Constructor %s::%s() cannot be static", scope->name, clone->common.function_name);
|
||||
}
|
||||
clone->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
if (__call) {
|
||||
if (__call->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __call->common.function_name);
|
||||
}
|
||||
__call->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
if (__get) {
|
||||
if (__get->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __get->common.function_name);
|
||||
}
|
||||
__get->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
if (__set) {
|
||||
if (__set->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __set->common.function_name);
|
||||
}
|
||||
__set->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
efree(lc_class_name);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -168,6 +168,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
ZEND_API void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
|
||||
ZEND_API int zend_register_module(zend_module_entry *module_entry);
|
||||
ZEND_API int zend_register_module_ex(zend_module_entry *module TSRMLS_DC);
|
||||
void zend_check_magic_method_implementation(zend_class_entry *ce, zend_function *fptr, int error_type TSRMLS_DC);
|
||||
|
||||
ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry TSRMLS_DC);
|
||||
ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC);
|
||||
|
||||
+1
-1
@@ -481,7 +481,7 @@ ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC)
|
||||
unsigned int i, j;
|
||||
zend_mem_header *ptr;
|
||||
|
||||
for (i=1; i<MAX_CACHED_MEMORY; i++) {
|
||||
for (i=0; i<MAX_CACHED_MEMORY; i++) {
|
||||
for (j=0; j<AG(cache_count)[i]; j++) {
|
||||
ptr = (zend_mem_header *) AG(cache)[i][j];
|
||||
# if MEMORY_LIMIT
|
||||
|
||||
@@ -85,6 +85,10 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN
|
||||
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
|
||||
ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
|
||||
|
||||
#define USE_ZEND_ALLOC 1
|
||||
|
||||
#if USE_ZEND_ALLOC
|
||||
|
||||
/* Standard wrapper macros */
|
||||
#define emalloc(size) _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
#define safe_emalloc(nmemb, size, offset) _safe_emalloc((nmemb), (size), (offset) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
@@ -123,6 +127,52 @@ ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZE
|
||||
#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):(empty_string))
|
||||
#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):(empty_string))
|
||||
|
||||
#else
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <string.h>
|
||||
#undef _GNU_SOURCE
|
||||
|
||||
/* Standard wrapper macros */
|
||||
#define emalloc(size) malloc(size)
|
||||
#define safe_emalloc(nmemb, size, offset) malloc((nmemb) * (size) + (offset))
|
||||
#define efree(ptr) free(ptr)
|
||||
#define ecalloc(nmemb, size) calloc((nmemb), (size))
|
||||
#define erealloc(ptr, size) realloc((ptr), (size))
|
||||
#define erealloc_recoverable(ptr, size) realloc((ptr), (size))
|
||||
#define estrdup(s) strdup(s)
|
||||
#define estrndup(s, length) strndup((s), (length))
|
||||
|
||||
/* Relay wrapper macros */
|
||||
#define emalloc_rel(size) malloc(size)
|
||||
#define safe_emalloc_rel(nmemb, size, offset) malloc((nmemb) * (size) + (offset))
|
||||
#define efree_rel(ptr) free(ptr)
|
||||
#define ecalloc_rel(nmemb, size) calloc((nmemb), (size))
|
||||
#define erealloc_rel(ptr, size) realloc((ptr), (size))
|
||||
#define erealloc_recoverable_rel(ptr, size) realloc((ptr), (size))
|
||||
#define estrdup_rel(s) strdup(s)
|
||||
#define estrndup_rel(s, length) strndup((s), (length))
|
||||
|
||||
/* Selective persistent/non persistent allocation macros */
|
||||
#define pemalloc(size, persistent) malloc(size)
|
||||
#define pefree(ptr, persistent) free(ptr)
|
||||
#define pecalloc(nmemb, size, persistent) calloc((nmemb), (size))
|
||||
#define perealloc(ptr, size, persistent) realloc((ptr), (size))
|
||||
#define perealloc_recoverable(ptr, size, persistent) realloc((ptr), (size))
|
||||
#define pestrdup(s, persistent) strdup(s)
|
||||
|
||||
#define pemalloc_rel(size, persistent) malloc(size)
|
||||
#define pefree_rel(ptr, persistent) free(ptr)
|
||||
#define pecalloc_rel(nmemb, size, persistent) calloc((nmemb), (size))
|
||||
#define perealloc_rel(ptr, size, persistent) realloc((ptr), (size))
|
||||
#define perealloc_recoverable_rel(ptr, size, persistent) realloc((ptr), (size))
|
||||
#define pestrdup_rel(s, persistent) strdup(s)
|
||||
|
||||
#define safe_estrdup(ptr) ((ptr)?(strdup(ptr)):(empty_string))
|
||||
#define safe_estrndup(ptr, len) ((ptr)?(strndup((ptr), (len))):(empty_string))
|
||||
|
||||
#endif
|
||||
|
||||
ZEND_API int zend_set_memory_limit(unsigned int memory_limit);
|
||||
|
||||
ZEND_API void start_memory_manager(TSRMLS_D);
|
||||
|
||||
+145
-33
@@ -44,6 +44,7 @@ static ZEND_FUNCTION(get_class);
|
||||
static ZEND_FUNCTION(get_parent_class);
|
||||
static ZEND_FUNCTION(method_exists);
|
||||
static ZEND_FUNCTION(class_exists);
|
||||
static ZEND_FUNCTION(interface_exists);
|
||||
static ZEND_FUNCTION(function_exists);
|
||||
#if ZEND_DEBUG
|
||||
static ZEND_FUNCTION(leak);
|
||||
@@ -102,6 +103,7 @@ static zend_function_entry builtin_functions[] = {
|
||||
ZEND_FE(get_parent_class, NULL)
|
||||
ZEND_FE(method_exists, NULL)
|
||||
ZEND_FE(class_exists, NULL)
|
||||
ZEND_FE(interface_exists, NULL)
|
||||
ZEND_FE(function_exists, NULL)
|
||||
#if ZEND_DEBUG
|
||||
ZEND_FE(leak, NULL)
|
||||
@@ -601,12 +603,21 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
if (Z_TYPE_PP(obj) != IS_OBJECT) {
|
||||
if (only_subclass && Z_TYPE_PP(obj) == IS_STRING) {
|
||||
zend_class_entry **the_ce;
|
||||
if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &the_ce TSRMLS_CC) == FAILURE) {
|
||||
zend_error(E_WARNING, "Unknown class passed as parameter");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
instance_ce = *the_ce;
|
||||
} else if (Z_TYPE_PP(obj) != IS_OBJECT) {
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
instance_ce = NULL;
|
||||
}
|
||||
|
||||
/* TBI!! new object handlers */
|
||||
if (!HAS_CLASS_ENTRY(**obj)) {
|
||||
if (Z_TYPE_PP(obj) == IS_OBJECT && !HAS_CLASS_ENTRY(**obj)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -616,7 +627,11 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
|
||||
retval = 0;
|
||||
} else {
|
||||
if (only_subclass) {
|
||||
instance_ce = Z_OBJCE_PP(obj)->parent;
|
||||
if (!instance_ce) {
|
||||
instance_ce = Z_OBJCE_PP(obj)->parent;
|
||||
} else {
|
||||
instance_ce = instance_ce->parent;
|
||||
}
|
||||
} else {
|
||||
instance_ce = Z_OBJCE_PP(obj);
|
||||
}
|
||||
@@ -655,30 +670,72 @@ ZEND_FUNCTION(is_a)
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ add_class_vars */
|
||||
static void add_class_vars(zend_class_entry *ce, HashTable *properties, zval *return_value TSRMLS_DC)
|
||||
{
|
||||
int instanceof = EG(scope) && instanceof_function(EG(scope), ce TSRMLS_CC);
|
||||
|
||||
if (zend_hash_num_elements(properties) > 0) {
|
||||
HashPosition pos;
|
||||
zval **prop;
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(properties, &pos);
|
||||
while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) {
|
||||
char *key, *class_name, *prop_name;
|
||||
uint key_len;
|
||||
ulong num_index;
|
||||
zval *prop_copy;
|
||||
|
||||
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);
|
||||
if (class_name) {
|
||||
if (class_name[0] != '*' && strcmp(class_name, ce->name)) {
|
||||
/* filter privates from base classes */
|
||||
continue;
|
||||
} else if (!instanceof) {
|
||||
/* filter protected if not inside class */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* copy: enforce read only access */
|
||||
ALLOC_ZVAL(prop_copy);
|
||||
*prop_copy = **prop;
|
||||
zval_copy_ctor(prop_copy);
|
||||
INIT_PZVAL(prop_copy);
|
||||
|
||||
/* this is necessary to make it able to work with default array
|
||||
* properties, returned to user */
|
||||
if (Z_TYPE_P(prop_copy) == IS_CONSTANT_ARRAY || Z_TYPE_P(prop_copy) == IS_CONSTANT) {
|
||||
zval_update_constant(&prop_copy, 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
add_assoc_zval(return_value, prop_name, prop_copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto array get_class_vars(string class_name)
|
||||
Returns an array of default properties of the class */
|
||||
Returns an array of default properties of the class. */
|
||||
ZEND_FUNCTION(get_class_vars)
|
||||
{
|
||||
zval **class_name;
|
||||
zend_class_entry *ce, **pce;
|
||||
zval *tmp;
|
||||
char *class_name;
|
||||
int class_name_len;
|
||||
zend_class_entry **pce;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class_name)==FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &class_name, &class_name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
convert_to_string_ex(class_name);
|
||||
|
||||
if (zend_lookup_class(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name), &pce TSRMLS_CC) == FAILURE) {
|
||||
if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
ce = *pce;
|
||||
array_init(return_value);
|
||||
if (!ce->constants_updated) {
|
||||
zend_hash_apply_with_argument(&ce->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
ce->constants_updated = 1;
|
||||
}
|
||||
zend_hash_copy(return_value->value.ht, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
add_class_vars(*pce, &(*pce)->default_properties, return_value TSRMLS_CC);
|
||||
add_class_vars(*pce, (*pce)->static_members, return_value TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -692,9 +749,10 @@ ZEND_FUNCTION(get_object_vars)
|
||||
zval **value;
|
||||
HashTable *properties;
|
||||
HashPosition pos;
|
||||
char *key;
|
||||
char *key, *prop_name, *class_name;
|
||||
uint key_len;
|
||||
ulong num_index;
|
||||
int instanceof;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &obj) == FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
@@ -707,16 +765,27 @@ ZEND_FUNCTION(get_object_vars)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
instanceof = EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), Z_OBJCE_PP(obj) TSRMLS_CC);
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
properties = Z_OBJ_HT_PP(obj)->get_properties(*obj TSRMLS_CC);
|
||||
zend_hash_internal_pointer_reset_ex(properties, &pos);
|
||||
|
||||
while (zend_hash_get_current_data_ex(properties, (void **) &value, &pos) == SUCCESS) {
|
||||
if (zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos) == HASH_KEY_IS_STRING && key[0]) {
|
||||
if (zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos) == HASH_KEY_IS_STRING) {
|
||||
if (key[0]) {
|
||||
/* Not separating references */
|
||||
(*value)->refcount++;
|
||||
add_assoc_zval_ex(return_value, key, key_len, *value);
|
||||
} else if (instanceof) {
|
||||
zend_unmangle_property_name(key, &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++;
|
||||
add_assoc_zval_ex(return_value, prop_name, strlen(prop_name)+1, *value);
|
||||
}
|
||||
}
|
||||
}
|
||||
zend_hash_move_forward_ex(properties, &pos);
|
||||
}
|
||||
@@ -733,6 +802,7 @@ ZEND_FUNCTION(get_class_methods)
|
||||
zend_class_entry *ce = NULL, **pce;
|
||||
HashPosition pos;
|
||||
zend_function *mptr;
|
||||
int instanceof;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class)==FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
@@ -754,18 +824,22 @@ ZEND_FUNCTION(get_class_methods)
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
instanceof = EG(scope) && instanceof_function(EG(scope), ce TSRMLS_CC);
|
||||
|
||||
array_init(return_value);
|
||||
zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos);
|
||||
|
||||
while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) {
|
||||
MAKE_STD_ZVAL(method_name);
|
||||
ZVAL_STRING(method_name, mptr->common.function_name, 1);
|
||||
zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
|
||||
if ((mptr->common.fn_flags & ZEND_ACC_PUBLIC)
|
||||
|| (instanceof && ((mptr->common.fn_flags & ZEND_ACC_PROTECTED) || EG(scope) == mptr->common.scope))) {
|
||||
MAKE_STD_ZVAL(method_name);
|
||||
ZVAL_STRING(method_name, mptr->common.function_name, 1);
|
||||
zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
|
||||
}
|
||||
zend_hash_move_forward_ex(&ce->function_table, &pos);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
\
|
||||
|
||||
|
||||
/* {{{ proto bool method_exists(object object, string method)
|
||||
@@ -819,11 +893,42 @@ ZEND_FUNCTION(class_exists)
|
||||
|
||||
found = zend_hash_find(EG(class_table), lc_name, class_name_len+1, (void **) &ce);
|
||||
free_alloca(lc_name);
|
||||
RETURN_BOOL(found == SUCCESS);
|
||||
RETURN_BOOL(found == SUCCESS && !((*ce)->ce_flags & ZEND_ACC_INTERFACE));
|
||||
}
|
||||
|
||||
if (zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC) == SUCCESS) {
|
||||
RETURN_TRUE;
|
||||
RETURN_BOOL(((*ce)->ce_flags & ZEND_ACC_INTERFACE) == 0);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool interface_exists(string classname [, bool autoload])
|
||||
Checks if the class exists */
|
||||
ZEND_FUNCTION(interface_exists)
|
||||
{
|
||||
char *iface_name, *lc_name;
|
||||
zend_class_entry **ce;
|
||||
int iface_name_len;
|
||||
zend_bool autoload = 1;
|
||||
int found;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &iface_name, &iface_name_len, &autoload) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!autoload) {
|
||||
lc_name = do_alloca(iface_name_len + 1);
|
||||
zend_str_tolower_copy(lc_name, iface_name, iface_name_len);
|
||||
|
||||
found = zend_hash_find(EG(class_table), lc_name, iface_name_len+1, (void **) &ce);
|
||||
free_alloca(lc_name);
|
||||
RETURN_BOOL(found == SUCCESS && (*ce)->ce_flags & ZEND_ACC_INTERFACE);
|
||||
}
|
||||
|
||||
if (zend_lookup_class(iface_name, iface_name_len, &ce TSRMLS_CC) == SUCCESS) {
|
||||
RETURN_BOOL(((*ce)->ce_flags & ZEND_ACC_INTERFACE) > 0);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1035,13 +1140,15 @@ ZEND_FUNCTION(set_exception_handler)
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
if (!zend_is_callable(*exception_handler, 0, &exception_handler_name)) {
|
||||
zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
|
||||
get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name:"unknown");
|
||||
if (Z_TYPE_PP(exception_handler) != IS_NULL) { /* NULL == unset */
|
||||
if (!zend_is_callable(*exception_handler, 0, &exception_handler_name)) {
|
||||
zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
|
||||
get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name:"unknown");
|
||||
efree(exception_handler_name);
|
||||
return;
|
||||
}
|
||||
efree(exception_handler_name);
|
||||
return;
|
||||
}
|
||||
efree(exception_handler_name);
|
||||
|
||||
if (EG(user_exception_handler)) {
|
||||
had_orig_exception_handler = 1;
|
||||
@@ -1051,7 +1158,7 @@ ZEND_FUNCTION(set_exception_handler)
|
||||
}
|
||||
ALLOC_ZVAL(EG(user_exception_handler));
|
||||
|
||||
if (Z_STRLEN_PP(exception_handler)==0) { /* unset user-defined handler */
|
||||
if (Z_TYPE_PP(exception_handler) == IS_NULL) { /* unset user-defined handler */
|
||||
FREE_ZVAL(EG(user_exception_handler));
|
||||
EG(user_exception_handler) = NULL;
|
||||
RETURN_TRUE;
|
||||
@@ -1598,11 +1705,11 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
|
||||
ptr = EG(current_execute_data);
|
||||
|
||||
/* skip debug_backtrace() */
|
||||
ptr = ptr->prev_execute_data;
|
||||
if (skip_last--) {
|
||||
int arg_count = *((ulong*)(cur_arg_pos - 2));
|
||||
cur_arg_pos -= (arg_count + 2);
|
||||
frames_on_stack--;
|
||||
ptr = ptr->prev_execute_data;
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
@@ -1655,6 +1762,11 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
|
||||
/* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */
|
||||
zend_bool build_filename_arg = 1;
|
||||
|
||||
if (!ptr->opline) {
|
||||
/* can happen when calling eval from a custom sapi */
|
||||
function_name = "unknown";
|
||||
build_filename_arg = 0;
|
||||
} else
|
||||
switch (ptr->opline->op2.u.constant.value.lval) {
|
||||
case ZEND_EVAL:
|
||||
function_name = "eval";
|
||||
|
||||
+73
-60
@@ -761,6 +761,9 @@ void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC)
|
||||
opline->opcode += 3;
|
||||
break;
|
||||
case BP_VAR_IS:
|
||||
if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
opline->opcode += 6; /* 3+3 */
|
||||
break;
|
||||
case BP_VAR_FUNC_ARG:
|
||||
@@ -992,35 +995,37 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
|
||||
fn_flags |= ZEND_ACC_PUBLIC;
|
||||
}
|
||||
|
||||
short_class_name = do_alloca(short_class_name_length + 1);
|
||||
zend_str_tolower_copy(short_class_name, CG(active_class_entry)->name, short_class_name_length);
|
||||
/* Improve after RC: cache the lowercase class name */
|
||||
|
||||
if ((short_class_name_length == name_len) && (!memcmp(short_class_name, lcname, name_len))) {
|
||||
if (CG(active_class_entry)->constructor) {
|
||||
zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name);
|
||||
} else {
|
||||
if (!(CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) {
|
||||
short_class_name = do_alloca(short_class_name_length + 1);
|
||||
zend_str_tolower_copy(short_class_name, CG(active_class_entry)->name, short_class_name_length);
|
||||
/* Improve after RC: cache the lowercase class name */
|
||||
|
||||
if ((short_class_name_length == name_len) && (!memcmp(short_class_name, lcname, name_len))) {
|
||||
if (CG(active_class_entry)->constructor) {
|
||||
zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name);
|
||||
} else {
|
||||
CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
|
||||
}
|
||||
} else if ((name_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) {
|
||||
if (CG(active_class_entry)->constructor) {
|
||||
zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name);
|
||||
}
|
||||
CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->destructor = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->clone = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__call = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__get = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__set = (zend_function *) CG(active_op_array);
|
||||
} else if (!(fn_flags & ZEND_ACC_STATIC)) {
|
||||
CG(active_op_array)->fn_flags |= ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
} else if ((name_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) {
|
||||
if (CG(active_class_entry)->constructor) {
|
||||
zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name);
|
||||
}
|
||||
CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->destructor = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->clone = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__call = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__get = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__set = (zend_function *) CG(active_op_array);
|
||||
} else if (!(fn_flags & ZEND_ACC_STATIC)) {
|
||||
CG(active_op_array)->fn_flags |= ZEND_ACC_ALLOW_STATIC;
|
||||
free_alloca(short_class_name);
|
||||
}
|
||||
free_alloca(short_class_name);
|
||||
|
||||
efree(lcname);
|
||||
} else {
|
||||
@@ -1087,16 +1092,26 @@ void zend_do_handle_exception(TSRMLS_D)
|
||||
|
||||
void zend_do_end_function_declaration(znode *function_token TSRMLS_DC)
|
||||
{
|
||||
char lcname[16];
|
||||
int name_len;
|
||||
|
||||
zend_do_extended_info(TSRMLS_C);
|
||||
zend_do_return(NULL, 0 TSRMLS_CC);
|
||||
zend_do_handle_exception(TSRMLS_C);
|
||||
|
||||
pass_two(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
if (CG(active_class_entry)
|
||||
&& !strcmp(CG(active_op_array)->function_name, ZEND_CLONE_FUNC_NAME)
|
||||
&& CG(active_op_array)->num_args != 0) {
|
||||
zend_error(E_COMPILE_ERROR, "The clone method cannot accept any arguments");
|
||||
if (CG(active_class_entry)) {
|
||||
zend_check_magic_method_implementation(CG(active_class_entry), (zend_function*)CG(active_op_array), E_COMPILE_ERROR TSRMLS_CC);
|
||||
} else {
|
||||
/* we don't care if the function name is longer, in fact lowercasing only
|
||||
* the beginning of the name speeds up the check process */
|
||||
name_len = strlen(CG(active_op_array)->function_name);
|
||||
zend_str_tolower_copy(lcname, CG(active_op_array)->function_name, MIN(name_len, sizeof(lcname)-1));
|
||||
lcname[sizeof(lcname)-1] = '\0'; /* zend_str_tolower_copy won't necessarily set the zero byte */
|
||||
if (name_len == sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)) && CG(active_op_array)->num_args != 1) {
|
||||
zend_error(E_COMPILE_ERROR, "%s() must take exactly 1 argument", ZEND_AUTOLOAD_FUNC_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
CG(active_op_array)->line_end = zend_get_compiled_lineno(TSRMLS_C);
|
||||
@@ -1114,10 +1129,6 @@ void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initia
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
zend_arg_info *cur_arg_info;
|
||||
|
||||
if (CG(active_class_entry) && CG(active_class_entry)->destructor == (zend_function *) CG(active_op_array))
|
||||
{
|
||||
zend_error(E_COMPILE_ERROR, "Destuctor %s::%s() cannot take arguments", CG(active_class_entry)->name, CG(active_op_array)->function_name);
|
||||
}
|
||||
CG(active_op_array)->num_args++;
|
||||
opline->opcode = op;
|
||||
opline->result = *var;
|
||||
@@ -1193,7 +1204,7 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC)
|
||||
last_op_number = get_next_op_number(CG(active_op_array))-1;
|
||||
last_op = &CG(active_op_array)->opcodes[last_op_number];
|
||||
|
||||
if ((last_op->op2.op_type == IS_CONST) && (last_op->op2.u.constant.value.str.len == sizeof(ZEND_CLONE_FUNC_NAME)-1)
|
||||
if ((last_op->op2.op_type == IS_CONST) && (last_op->op2.u.constant.type == IS_STRING) && (last_op->op2.u.constant.value.str.len == sizeof(ZEND_CLONE_FUNC_NAME)-1)
|
||||
&& !zend_binary_strcasecmp(last_op->op2.u.constant.value.str.val, last_op->op2.u.constant.value.str.len, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1)) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot call __clone() method on objects - use 'clone $obj' instead");
|
||||
}
|
||||
@@ -1298,36 +1309,27 @@ void zend_do_fetch_class_name(znode *result, znode *class_name_entry, znode *cla
|
||||
result->u.constant.value.str.len = length;
|
||||
}
|
||||
|
||||
void zend_do_begin_class_member_function_call(TSRMLS_D)
|
||||
void zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC)
|
||||
{
|
||||
unsigned char *ptr = NULL;
|
||||
long fetch_const_op_number = get_next_op_number(CG(active_op_array));
|
||||
zend_op *last_op = &CG(active_op_array)->opcodes[fetch_const_op_number-1];
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
if (last_op->opcode == ZEND_FETCH_CONSTANT) { /* regular method call */
|
||||
/* a tmp var is leaked here */
|
||||
last_op->opcode = ZEND_INIT_STATIC_METHOD_CALL;
|
||||
if(last_op->op2.op_type == IS_CONST &&
|
||||
(sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRLEN(last_op->op2.u.constant) &&
|
||||
memcmp(Z_STRVAL(last_op->op2.u.constant), ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) {
|
||||
zval_dtor(&last_op->op2.u.constant);
|
||||
SET_UNUSED(last_op->op2);
|
||||
opline->opcode = ZEND_INIT_STATIC_METHOD_CALL;
|
||||
opline->op1 = *class_name;
|
||||
opline->op2 = *method_name;
|
||||
|
||||
if (opline->op2.op_type == IS_CONST) {
|
||||
if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRLEN(opline->op2.u.constant) &&
|
||||
memcmp(Z_STRVAL(opline->op2.u.constant), ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) {
|
||||
zval_dtor(&opline->op2.u.constant);
|
||||
SET_UNUSED(opline->op2);
|
||||
} else {
|
||||
zend_lowercase_znode_if_const(&last_op->op2);
|
||||
zend_str_tolower(opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len);
|
||||
}
|
||||
} else if (last_op->opcode == ZEND_FETCH_R) { /* indirect method call */
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
last_op->op2.u.EA.type = ZEND_FETCH_LOCAL;
|
||||
opline->opcode = ZEND_INIT_STATIC_METHOD_CALL;
|
||||
opline->op1 = last_op->op2;
|
||||
opline->op2 = last_op->result;
|
||||
} else {
|
||||
zend_error(E_COMPILE_ERROR, "Internal compiler error - please report!");
|
||||
}
|
||||
|
||||
|
||||
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
|
||||
zend_do_extended_fcall_begin(TSRMLS_C);
|
||||
}
|
||||
|
||||
|
||||
@@ -1675,9 +1677,11 @@ static void do_inherit_parent_constructor(zend_class_entry *ce)
|
||||
if (!zend_hash_exists(&ce->function_table, lc_class_name, ce->name_length+1)) {
|
||||
lc_parent_class_name = zend_str_tolower_dup(ce->parent->name, ce->parent->name_length);
|
||||
if (zend_hash_find(&ce->parent->function_table, lc_parent_class_name, ce->parent->name_length+1, (void **)&function)==SUCCESS) {
|
||||
/* inherit parent's constructor */
|
||||
zend_hash_update(&ce->function_table, lc_class_name, ce->name_length+1, function, sizeof(zend_function), NULL);
|
||||
function_add_ref(function);
|
||||
if (function->common.fn_flags & ZEND_ACC_CTOR) {
|
||||
/* inherit parent's constructor */
|
||||
zend_hash_update(&ce->function_table, lc_class_name, ce->name_length+1, function, sizeof(zend_function), NULL);
|
||||
function_add_ref(function);
|
||||
}
|
||||
}
|
||||
efree(lc_parent_class_name);
|
||||
}
|
||||
@@ -1924,6 +1928,9 @@ static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry
|
||||
if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && iface->interface_gets_implemented && iface->interface_gets_implemented(iface, ce TSRMLS_CC) == FAILURE) {
|
||||
zend_error(E_CORE_ERROR, "Class %s could not implement interface %s", ce->name, iface->name);
|
||||
}
|
||||
if (ce == iface) {
|
||||
zend_error(E_ERROR, "Interface %s cannot not implement itself", ce->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1993,6 +2000,8 @@ void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce TSRML
|
||||
zend_hash_merge(&ce->constants_table, &parent_ce->constants_table, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0);
|
||||
zend_hash_merge_ex(&ce->function_table, &parent_ce->function_table, (copy_ctor_func_t) do_inherit_method, sizeof(zend_function), (merge_checker_func_t) do_inherit_method_check, ce);
|
||||
do_inherit_parent_constructor(ce);
|
||||
|
||||
zend_verify_abstract_class(ce TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
@@ -2100,6 +2109,10 @@ ZEND_API zend_class_entry *do_bind_inherited_class(zend_op *opline, HashTable *c
|
||||
ce = *pce;
|
||||
}
|
||||
|
||||
if (parent_ce->ce_flags & ZEND_ACC_INTERFACE) {
|
||||
zend_error(E_COMPILE_ERROR, "Class %s cannot extend from interface %s", ce->name, parent_ce->name);
|
||||
}
|
||||
|
||||
zend_do_inheritance(ce, parent_ce TSRMLS_CC);
|
||||
|
||||
ce->refcount++;
|
||||
|
||||
+2
-1
@@ -375,7 +375,7 @@ void zend_do_clone(znode *result, znode *expr TSRMLS_DC);
|
||||
void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC);
|
||||
void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC);
|
||||
void zend_do_fetch_class_name(znode *result, znode *class_entry, znode *class_name TSRMLS_DC);
|
||||
void zend_do_begin_class_member_function_call(TSRMLS_D);
|
||||
void zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC);
|
||||
void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC);
|
||||
void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC);
|
||||
void zend_do_handle_exception(TSRMLS_D);
|
||||
@@ -840,6 +840,7 @@ END_EXTERN_C()
|
||||
#define ZEND_GET_FUNC_NAME "__get"
|
||||
#define ZEND_SET_FUNC_NAME "__set"
|
||||
#define ZEND_CALL_FUNC_NAME "__call"
|
||||
#define ZEND_AUTOLOAD_FUNC_NAME "__autoload"
|
||||
|
||||
#endif /* ZEND_COMPILE_H */
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ typedef unsigned int uint;
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_STRCOLL 1
|
||||
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
|
||||
@@ -50,7 +50,8 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC)
|
||||
zend_throw_exception_hook(exception TSRMLS_CC);
|
||||
}
|
||||
|
||||
if ((EG(current_execute_data)->opline+1)->opcode == ZEND_HANDLE_EXCEPTION) {
|
||||
if (EG(current_execute_data)->opline == NULL ||
|
||||
(EG(current_execute_data)->opline+1)->opcode == ZEND_HANDLE_EXCEPTION) {
|
||||
/* no need to rethrow the exception */
|
||||
return;
|
||||
}
|
||||
@@ -427,9 +428,15 @@ ZEND_METHOD(exception, __toString)
|
||||
* And never try to change the state of exceptions and never implement anything
|
||||
* that gives the user anything to accomplish this.
|
||||
*/
|
||||
static
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_exception___construct, 0)
|
||||
ZEND_ARG_INFO(0, message)
|
||||
ZEND_ARG_INFO(0, code)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
static zend_function_entry default_exception_functions[] = {
|
||||
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, __construct, NULL, 0)
|
||||
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
|
||||
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
|
||||
+35
-17
@@ -52,6 +52,7 @@ static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_
|
||||
#define EX_T(offset) (*(temp_variable *)((char *) EX(Ts) + offset))
|
||||
#define T(offset) (*(temp_variable *)((char *) Ts + offset))
|
||||
|
||||
#define TEMP_VAR_STACK_LIMIT 2000
|
||||
|
||||
/* former zend_execute_locks.h */
|
||||
static inline void zend_pzval_lock_func(zval *z)
|
||||
@@ -377,7 +378,7 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode
|
||||
*retval = EG(uninitialized_zval_ptr);
|
||||
|
||||
SELECTIVE_PZVAL_LOCK(*retval, result);
|
||||
PZVAL_UNLOCK(value);
|
||||
FREE_OP(Ts, value_op, free_value);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1330,7 +1331,11 @@ static int zend_check_symbol(zval **pz TSRMLS_DC)
|
||||
}
|
||||
|
||||
#define RETURN_FROM_EXECUTE_LOOP(execute_data) \
|
||||
efree(EX(Ts)); \
|
||||
if (EX(op_array)->T < TEMP_VAR_STACK_LIMIT) { \
|
||||
free_alloca(EX(Ts)); \
|
||||
} else { \
|
||||
efree(EX(Ts)); \
|
||||
} \
|
||||
EG(in_execution) = EX(original_in_execution); \
|
||||
EG(current_execute_data) = EX(prev_execute_data); \
|
||||
return 1; /* CHECK_ME */
|
||||
@@ -1349,7 +1354,11 @@ ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
|
||||
/* Initialize execute_data */
|
||||
EX(fbc) = NULL;
|
||||
EX(object) = NULL;
|
||||
EX(Ts) = (temp_variable *) safe_emalloc(sizeof(temp_variable), op_array->T, 0);
|
||||
if (op_array->T < TEMP_VAR_STACK_LIMIT) {
|
||||
EX(Ts) = (temp_variable *) do_alloca(sizeof(temp_variable) * op_array->T);
|
||||
} else {
|
||||
EX(Ts) = (temp_variable *) safe_emalloc(sizeof(temp_variable), op_array->T, 0);
|
||||
}
|
||||
EX(op_array) = op_array;
|
||||
EX(original_in_execution) = EG(in_execution);
|
||||
EX(prev_execute_data) = EG(current_execute_data);
|
||||
@@ -1766,6 +1775,9 @@ static inline int zend_binary_assign_op_helper(int (*binary_op)(zval *result, zv
|
||||
EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr);
|
||||
SELECTIVE_PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &opline->result);
|
||||
AI_USE_PTR(EX_T(opline->result.u.var).var);
|
||||
if (increment_opline) {
|
||||
INC_OPCODE();
|
||||
}
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
|
||||
@@ -2777,6 +2789,9 @@ int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS)
|
||||
if (EG(This)) {
|
||||
if (EG(exception) && EX(fbc) && EX(fbc)->common.fn_flags&ZEND_ACC_CTOR) {
|
||||
EG(This)->refcount--;
|
||||
if (EG(This)->refcount == 1) {
|
||||
zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
|
||||
}
|
||||
zval_ptr_dtor(&EG(This));
|
||||
} else if (should_change_scope) {
|
||||
zval_ptr_dtor(&EG(This));
|
||||
@@ -2929,21 +2944,16 @@ int zend_catch_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
}
|
||||
ce = Z_OBJCE_P(EG(exception));
|
||||
if (ce != EX_T(opline->op1.u.var).class_entry) {
|
||||
while (ce->parent) {
|
||||
if (ce->parent == EX_T(opline->op1.u.var).class_entry) {
|
||||
goto exception_should_be_taken;
|
||||
if (!instanceof_function(ce, EX_T(opline->op1.u.var).class_entry TSRMLS_CC)) {
|
||||
if (opline->op1.u.EA.type) {
|
||||
zend_throw_exception_internal(NULL TSRMLS_CC);
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
ce = ce->parent;
|
||||
SET_OPCODE(&op_array->opcodes[opline->extended_value]);
|
||||
return 0; /* CHECK_ME */
|
||||
}
|
||||
if (opline->op1.u.EA.type) {
|
||||
zend_throw_exception_internal(NULL TSRMLS_CC);
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
SET_OPCODE(&op_array->opcodes[opline->extended_value]);
|
||||
return 0; /* CHECK_ME */
|
||||
}
|
||||
|
||||
exception_should_be_taken:
|
||||
zend_hash_update(EG(active_symbol_table), opline->op2.u.constant.value.str.val,
|
||||
opline->op2.u.constant.value.str.len+1, &EG(exception), sizeof(zval *), (void **) NULL);
|
||||
EG(exception) = NULL;
|
||||
@@ -3699,7 +3709,7 @@ int zend_fe_reset_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
if (opline->extended_value) {
|
||||
array_ptr_ptr = get_zval_ptr_ptr(&opline->op1, EX(Ts), BP_VAR_R);
|
||||
if (array_ptr_ptr == NULL) {
|
||||
MAKE_STD_ZVAL(array_ptr);
|
||||
ALLOC_INIT_ZVAL(array_ptr);
|
||||
} else if (Z_TYPE_PP(array_ptr_ptr) == IS_OBJECT) {
|
||||
ce = Z_OBJCE_PP(array_ptr_ptr);
|
||||
if (!ce || ce->get_iterator == NULL) {
|
||||
@@ -4023,14 +4033,22 @@ static int zend_isset_isempty_dim_prop_obj_handler(int prop_dim, ZEND_OPCODE_HAN
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC);
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING) { /* string offsets */
|
||||
zval tmp_offset;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
tmp_offset = *offset;
|
||||
zval_copy_ctor(&tmp_offset);
|
||||
convert_to_long(&tmp_offset);
|
||||
offset = &tmp_offset;
|
||||
}
|
||||
switch (opline->extended_value) {
|
||||
case ZEND_ISSET:
|
||||
if (offset->value.lval <= Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
result = 1;
|
||||
}
|
||||
break;
|
||||
case ZEND_ISEMPTY:
|
||||
if (offset->value.lval <= Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
+10
-5
@@ -183,8 +183,6 @@ void init_executor(TSRMLS_D)
|
||||
EG(scope) = NULL;
|
||||
|
||||
EG(This) = NULL;
|
||||
|
||||
EG(float_separator)[0] = '.';
|
||||
}
|
||||
|
||||
void shutdown_executor(TSRMLS_D)
|
||||
@@ -208,6 +206,9 @@ void shutdown_executor(TSRMLS_D)
|
||||
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_deactivator TSRMLS_CC);
|
||||
zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC);
|
||||
zend_hash_graceful_reverse_destroy(&EG(symbol_table));
|
||||
} zend_catch {
|
||||
/* if we couldn't destruct cleanly, mark all objects as destructed anyway */
|
||||
zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC);
|
||||
} zend_end_try();
|
||||
|
||||
zend_try {
|
||||
@@ -684,7 +685,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
zend_error(E_ERROR, "Object does not support method calls");
|
||||
}
|
||||
EX(function_state).function =
|
||||
Z_OBJ_HT_PP(fci->object_pp)->get_method(*fci->object_pp, Z_STRVAL_P(fci->function_name), Z_STRLEN_P(fci->function_name) TSRMLS_CC);
|
||||
Z_OBJ_HT_PP(fci->object_pp)->get_method(*fci->object_pp, Z_STRVAL_P(fci->function_name), Z_STRLEN_P(fci->function_name) TSRMLS_CC);
|
||||
} else if (calling_scope) {
|
||||
char *function_name_lc = zend_str_tolower_dup(Z_STRVAL_P(fci->function_name), Z_STRLEN_P(fci->function_name));
|
||||
|
||||
@@ -885,6 +886,10 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
|
||||
zval *exception;
|
||||
char dummy = 1;
|
||||
|
||||
if (name == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
lc_name = do_alloca(name_length + 1);
|
||||
zend_str_tolower_copy(lc_name, name, name_length);
|
||||
|
||||
@@ -911,7 +916,7 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ZVAL_STRINGL(&autoload_function, "__autoload", sizeof("__autoload")-1, 0);
|
||||
ZVAL_STRINGL(&autoload_function, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1, 0);
|
||||
|
||||
INIT_PZVAL(class_name_ptr);
|
||||
ZVAL_STRINGL(class_name_ptr, name, name_length, 0);
|
||||
@@ -932,7 +937,7 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
|
||||
|
||||
if (EG(exception)) {
|
||||
free_alloca(lc_name);
|
||||
zend_error(E_ERROR, "__autoload(%s) threw an exception of type '%s'", name, Z_OBJCE_P(EG(exception))->name);
|
||||
zend_error(E_ERROR, "Function %s(%s) threw an exception of type '%s'", ZEND_AUTOLOAD_FUNC_NAME, name, Z_OBJCE_P(EG(exception))->name);
|
||||
return FAILURE;
|
||||
}
|
||||
EG(exception) = exception;
|
||||
|
||||
@@ -237,9 +237,6 @@ struct _zend_executor_globals {
|
||||
|
||||
zend_property_info std_property_info;
|
||||
|
||||
/* locale stuff */
|
||||
char float_separator[1];
|
||||
|
||||
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
|
||||
};
|
||||
|
||||
|
||||
+10
-4
@@ -159,6 +159,12 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
|
||||
switch (token_type) {
|
||||
case T_END_HEREDOC:
|
||||
zend_html_puts(token.value.str.val, token.value.str.len TSRMLS_CC);
|
||||
{
|
||||
char *ptr = LANG_SCNG(yy_text);
|
||||
if (ptr[LANG_SCNG(yy_leng) - 1] != ';') {
|
||||
zend_html_putc('\n');
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC);
|
||||
@@ -203,7 +209,7 @@ ZEND_API void zend_strip(TSRMLS_D)
|
||||
switch (token_type) {
|
||||
case T_WHITESPACE:
|
||||
if (!prev_space) {
|
||||
putchar(' ');
|
||||
zend_write(" ", sizeof(" ") - 1);
|
||||
prev_space = 1;
|
||||
}
|
||||
/* lack of break; is intentional */
|
||||
@@ -215,9 +221,9 @@ ZEND_API void zend_strip(TSRMLS_D)
|
||||
case T_END_HEREDOC: {
|
||||
char *ptr = LANG_SCNG(yy_text);
|
||||
|
||||
fwrite(ptr, LANG_SCNG(yy_leng) - 1, 1, stdout);
|
||||
zend_write(ptr, LANG_SCNG(yy_leng) - 1);
|
||||
/* The ensure that we only write one ; and that it followed by the required newline */
|
||||
putchar('\n');
|
||||
zend_write("\n", sizeof("\n") - 1);
|
||||
if (ptr[LANG_SCNG(yy_leng) - 1] == ';') {
|
||||
lex_scan(&token TSRMLS_CC);
|
||||
}
|
||||
@@ -226,7 +232,7 @@ ZEND_API void zend_strip(TSRMLS_D)
|
||||
break;
|
||||
|
||||
default:
|
||||
fwrite(LANG_SCNG(yy_text), LANG_SCNG(yy_leng), 1, stdout);
|
||||
zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+20
-4
@@ -24,6 +24,7 @@
|
||||
#include "zend_ini.h"
|
||||
#include "zend_alloc.h"
|
||||
#include "zend_operators.h"
|
||||
#include "zend_strtod.h"
|
||||
|
||||
static HashTable *registered_zend_ini_directives;
|
||||
|
||||
@@ -147,10 +148,25 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
|
||||
zend_ini_entry *p = ini_entry;
|
||||
zend_ini_entry *hashed_ini_entry;
|
||||
zval default_value;
|
||||
HashTable *directives = registered_zend_ini_directives;
|
||||
|
||||
#ifdef ZTS
|
||||
/* if we are called during the request, eg: from dl(),
|
||||
* then we should not touch the global directives table,
|
||||
* and should update the per-(request|thread) version instead.
|
||||
* This solves two problems: one is that ini entries for dl()'d
|
||||
* extensions will now work, and the second is that updating the
|
||||
* global hash here from dl() is not mutex protected and can
|
||||
* lead to death.
|
||||
*/
|
||||
if (directives != EG(ini_directives)) {
|
||||
directives = EG(ini_directives);
|
||||
}
|
||||
#endif
|
||||
|
||||
while (p->name) {
|
||||
p->module_number = module_number;
|
||||
if (zend_hash_add(registered_zend_ini_directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
|
||||
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;
|
||||
}
|
||||
@@ -283,9 +299,9 @@ ZEND_API double zend_ini_double(char *name, uint name_length, int orig)
|
||||
|
||||
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
|
||||
if (orig && ini_entry->modified) {
|
||||
return (double) (ini_entry->orig_value ? strtod(ini_entry->orig_value, NULL) : 0.0);
|
||||
return (double) (ini_entry->orig_value ? zend_strtod(ini_entry->orig_value, NULL) : 0.0);
|
||||
} else if (ini_entry->value) {
|
||||
return (double) strtod(ini_entry->value, NULL);
|
||||
return (double) zend_strtod(ini_entry->value, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,7 +487,7 @@ ZEND_API ZEND_INI_MH(OnUpdateReal)
|
||||
|
||||
p = (double *) (base+(size_t) mh_arg1);
|
||||
|
||||
*p = strtod(new_value, NULL);
|
||||
*p = zend_strtod(new_value, NULL);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -192,7 +192,7 @@ END_EXTERN_C()
|
||||
/* INI parsing engine */
|
||||
typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, int callback_type, void *arg);
|
||||
BEGIN_EXTERN_C()
|
||||
int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg);
|
||||
ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg);
|
||||
END_EXTERN_C()
|
||||
|
||||
#define ZEND_INI_PARSER_ENTRY 1
|
||||
|
||||
@@ -139,7 +139,7 @@ static void ini_error(char *str)
|
||||
}
|
||||
|
||||
|
||||
int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg)
|
||||
ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg)
|
||||
{
|
||||
int retval;
|
||||
zend_ini_parser_param ini_parser_param;
|
||||
|
||||
@@ -272,7 +272,7 @@ static zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce,
|
||||
|
||||
zend_class_entry *ce_it = Z_TYPE_P(iterator) == IS_OBJECT ? Z_OBJCE_P(iterator) : NULL;
|
||||
|
||||
if (!ce || !ce_it || !ce_it->get_iterator) {
|
||||
if (!ce || !ce_it || !ce_it->get_iterator || (ce_it->get_iterator == zend_user_it_get_new_iterator && iterator == object)) {
|
||||
zend_error(E_WARNING, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce->name);
|
||||
zval_ptr_dtor(&iterator);
|
||||
return NULL;
|
||||
@@ -287,7 +287,7 @@ static zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce,
|
||||
static int zend_implement_traversable(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC)
|
||||
{
|
||||
/* check that class_type is traversable at c-level or implements at least one of 'aggregate' and 'Iterator' */
|
||||
int i;
|
||||
zend_uint i;
|
||||
|
||||
if (class_type->get_iterator || (class_type->parent && class_type->parent->get_iterator)) {
|
||||
return SUCCESS;
|
||||
|
||||
@@ -614,12 +614,12 @@ function_call:
|
||||
T_STRING '(' { $2.u.opline_num = zend_do_begin_function_call(&$1 TSRMLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { zend_do_end_function_call(&$1, &$$, &$4, 0, $2.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
|
||||
| class_constant '(' { zend_do_begin_class_member_function_call(TSRMLS_C); zend_do_extended_fcall_begin(TSRMLS_C); }
|
||||
| fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { zend_do_end_function_call(NULL, &$$, &$4, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| static_member '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(TSRMLS_C); zend_do_extended_fcall_begin(TSRMLS_C); }
|
||||
')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { zend_do_end_function_call(NULL, &$$, &$4, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1 TSRMLS_CC); }
|
||||
function_call_parameter_list ')'
|
||||
{ zend_do_end_function_call(&$1, &$$, &$4, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include "zend_constants.h"
|
||||
#include "zend_variables.h"
|
||||
#include "zend_operators.h"
|
||||
#include "zend_strtod.h"
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
# include <stdarg.h>
|
||||
@@ -1188,7 +1189,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
errno = 0;
|
||||
zendlval->value.lval = strtol(yytext, NULL, 0);
|
||||
if (errno == ERANGE) { /* overflow */
|
||||
zendlval->value.dval = strtod(yytext, NULL);
|
||||
zendlval->value.dval = zend_strtod(yytext, NULL);
|
||||
zendlval->type = IS_DOUBLE;
|
||||
return T_DNUMBER;
|
||||
} else {
|
||||
@@ -1225,7 +1226,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>{DNUM}|{EXPONENT_DNUM} {
|
||||
zendlval->value.dval = strtod(yytext, NULL);
|
||||
zendlval->value.dval = zend_strtod(yytext, NULL);
|
||||
zendlval->type = IS_DOUBLE;
|
||||
return T_DNUMBER;
|
||||
}
|
||||
|
||||
+1
-1
@@ -37,7 +37,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 20040412
|
||||
#define ZEND_MODULE_API_NO 20041030
|
||||
#ifdef ZTS
|
||||
#define USING_ZTS 1
|
||||
#else
|
||||
|
||||
+6
-3
@@ -76,10 +76,13 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
|
||||
old_exception = EG(exception);
|
||||
EG(exception) = NULL;
|
||||
zend_call_method_with_0_params(&obj, object->ce, NULL, "__destruct", NULL);
|
||||
if (EG(exception)) {
|
||||
zval_ptr_dtor(&EG(exception));
|
||||
if (old_exception) {
|
||||
if (EG(exception)) {
|
||||
zend_error(E_ERROR, "Ignoring exception from %s::__destruct() while an exception is already active", object->ce->name);
|
||||
zval_ptr_dtor(&EG(exception));
|
||||
}
|
||||
EG(exception) = old_exception;
|
||||
}
|
||||
EG(exception) = old_exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,16 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSRMLS_DC)
|
||||
{
|
||||
zend_uint i = 1;
|
||||
|
||||
for (i = 1; i < objects->top ; i++) {
|
||||
if (objects->object_buckets[i].valid) {
|
||||
objects->object_buckets[i].destructor_called = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects TSRMLS_DC)
|
||||
{
|
||||
@@ -207,6 +217,15 @@ ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC
|
||||
}
|
||||
|
||||
|
||||
/* Called when the ctor was terminated by an exception */
|
||||
ZEND_API void zend_object_store_ctor_failed(zval *zobject TSRMLS_DC)
|
||||
{
|
||||
zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
|
||||
|
||||
EG(objects_store).object_buckets[handle].destructor_called = 1;
|
||||
}
|
||||
|
||||
|
||||
/* Proxy objects workings */
|
||||
typedef struct _zend_proxy_object {
|
||||
zval *object;
|
||||
|
||||
@@ -57,6 +57,7 @@ typedef struct _zend_objects_store {
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size);
|
||||
ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC);
|
||||
ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSRMLS_DC);
|
||||
ZEND_API void zend_objects_store_destroy(zend_objects_store *objects);
|
||||
|
||||
/* Store API functions */
|
||||
@@ -68,6 +69,7 @@ ZEND_API zend_object_value zend_objects_store_clone_obj(zval *object TSRMLS_DC);
|
||||
ZEND_API void *zend_object_store_get_object(zval *object TSRMLS_DC);
|
||||
/* See comment in zend_objects_API.c before you use this */
|
||||
ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC);
|
||||
ZEND_API void zend_object_store_ctor_failed(zval *zobject TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects TSRMLS_DC);
|
||||
|
||||
|
||||
+39
-16
@@ -29,6 +29,7 @@
|
||||
#include "zend_fast_cache.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_multiply.h"
|
||||
#include "zend_strtod.h"
|
||||
|
||||
#define LONG_SIGN_MASK (1L << (8*sizeof(long)-1))
|
||||
|
||||
@@ -376,7 +377,7 @@ ZEND_API void convert_to_double(zval *op)
|
||||
case IS_STRING:
|
||||
strval = op->value.str.val;
|
||||
|
||||
op->value.dval = strtod(strval, NULL);
|
||||
op->value.dval = zend_strtod(strval, NULL);
|
||||
STR_FREE(strval);
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
@@ -1221,6 +1222,35 @@ ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_D
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
#if HAVE_STRCOLL
|
||||
ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
zval op1_copy, op2_copy;
|
||||
int use_copy1, use_copy2;
|
||||
|
||||
zend_make_printable_zval(op1, &op1_copy, &use_copy1);
|
||||
zend_make_printable_zval(op2, &op2_copy, &use_copy2);
|
||||
|
||||
if (use_copy1) {
|
||||
op1 = &op1_copy;
|
||||
}
|
||||
if (use_copy2) {
|
||||
op2 = &op2_copy;
|
||||
}
|
||||
|
||||
result->value.lval = strcoll(op1->value.str.val, op2->value.str.val);
|
||||
result->type = IS_LONG;
|
||||
|
||||
if (use_copy1) {
|
||||
zval_dtor(op1);
|
||||
}
|
||||
if (use_copy2) {
|
||||
zval_dtor(op2);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
zval op1_copy, op2_copy;
|
||||
@@ -1867,9 +1897,9 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2)
|
||||
(ret2=is_numeric_string(s2->value.str.val, s2->value.str.len, &lval2, &dval2, 0))) {
|
||||
if ((ret1==IS_DOUBLE) || (ret2==IS_DOUBLE)) {
|
||||
if (ret1!=IS_DOUBLE) {
|
||||
dval1 = strtod(s1->value.str.val, NULL);
|
||||
dval1 = zend_strtod(s1->value.str.val, NULL);
|
||||
} else if (ret2!=IS_DOUBLE) {
|
||||
dval2 = strtod(s2->value.str.val, NULL);
|
||||
dval2 = zend_strtod(s2->value.str.val, NULL);
|
||||
}
|
||||
result->value.dval = dval1 - dval2;
|
||||
result->value.lval = ZEND_NORMALIZE_BOOL(result->value.dval);
|
||||
@@ -1922,13 +1952,13 @@ ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC)
|
||||
{
|
||||
result->type = IS_LONG;
|
||||
|
||||
if (Z_OBJ_HT_P(o1)->compare_objects == NULL) {
|
||||
if (Z_OBJ_HANDLE_P(o1) == Z_OBJ_HANDLE_P(o2)) {
|
||||
result->value.lval = 0;
|
||||
} else {
|
||||
result->value.lval = 1;
|
||||
}
|
||||
if (Z_OBJ_HANDLE_P(o1) == Z_OBJ_HANDLE_P(o2)) {
|
||||
result->value.lval = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Z_OBJ_HT_P(o1)->compare_objects == NULL) {
|
||||
result->value.lval = 1;
|
||||
} else {
|
||||
result->value.lval = Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC);
|
||||
}
|
||||
@@ -1943,13 +1973,6 @@ ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC)
|
||||
op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
|
||||
sprintf(op->value.str.val, "%.*G", (int) EG(precision), dval);
|
||||
op->value.str.len = strlen(op->value.str.val);
|
||||
|
||||
if (EG(float_separator)[0] != '.') {
|
||||
char *p = op->value.str.val;
|
||||
if ((p = strchr(p, '.'))) {
|
||||
*p = EG(float_separator)[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <ieeefp.h>
|
||||
#endif
|
||||
|
||||
#include "zend_strtod.h"
|
||||
|
||||
#if 0&&HAVE_BCMATH
|
||||
#include "ext/bcmath/libbcmath/src/bcmath.h"
|
||||
@@ -87,6 +88,8 @@ static inline zend_bool is_numeric_string(char *str, int length, long *lval, dou
|
||||
*lval = local_lval;
|
||||
}
|
||||
return IS_LONG;
|
||||
} else if (end_ptr_long == str && *end_ptr_long != '\0' && *str != '.') { /* ignore partial string matches */
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
end_ptr_long=NULL;
|
||||
@@ -97,7 +100,7 @@ static inline zend_bool is_numeric_string(char *str, int length, long *lval, dou
|
||||
}
|
||||
|
||||
errno=0;
|
||||
local_dval = strtod(str, &end_ptr_double);
|
||||
local_dval = zend_strtod(str, &end_ptr_double);
|
||||
if (errno != ERANGE) {
|
||||
if (end_ptr_double == str+length) { /* floating point string */
|
||||
if (!zend_finite(local_dval)) {
|
||||
@@ -177,6 +180,9 @@ ZEND_API int zval_is_true(zval *op);
|
||||
ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
#if HAVE_STRCOLL
|
||||
ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
ZEND_API void zend_str_tolower(char *str, unsigned int length);
|
||||
ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned int length);
|
||||
|
||||
+309
-92
@@ -145,8 +145,10 @@ typedef struct _property_reference {
|
||||
|
||||
/* Struct for parameters */
|
||||
typedef struct _parameter_reference {
|
||||
int offset;
|
||||
zend_uint offset;
|
||||
zend_uint required;
|
||||
struct _zend_arg_info *arg_info;
|
||||
zend_function *fptr;
|
||||
} parameter_reference;
|
||||
|
||||
/* Struct for reflection objects */
|
||||
@@ -155,6 +157,7 @@ typedef struct {
|
||||
void *ptr;
|
||||
unsigned int free_ptr:1;
|
||||
zval *obj;
|
||||
zend_class_entry *ce;
|
||||
} reflection_object;
|
||||
|
||||
static zend_object_handlers reflection_object_handlers;
|
||||
@@ -213,6 +216,7 @@ static void reflection_objects_clone(void *object, void **object_clone TSRMLS_DC
|
||||
|
||||
static zend_object_value reflection_objects_new(zend_class_entry *class_type TSRMLS_DC)
|
||||
{
|
||||
zval tmp;
|
||||
zend_object_value retval;
|
||||
reflection_object *intern;
|
||||
|
||||
@@ -226,6 +230,7 @@ static zend_object_value reflection_objects_new(zend_class_entry *class_type TSR
|
||||
|
||||
ALLOC_HASHTABLE(intern->zo.properties);
|
||||
zend_hash_init(intern->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
retval.handle = zend_objects_store_put(intern, NULL, reflection_free_objects_storage, reflection_objects_clone TSRMLS_CC);
|
||||
retval.handlers = &reflection_object_handlers;
|
||||
return retval;
|
||||
@@ -501,9 +506,14 @@ static void _const_string(string *str, char *name, zval *value, char *indent TSR
|
||||
/* }}} */
|
||||
|
||||
/* {{{ _parameter_string */
|
||||
static void _parameter_string(string *str, struct _zend_arg_info *arg_info, int offset, char* indent TSRMLS_DC)
|
||||
static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg_info *arg_info, zend_uint offset, zend_uint required, char* indent TSRMLS_DC)
|
||||
{
|
||||
string_printf(str, "Parameter #%d [ ", offset);
|
||||
if (offset >= required) {
|
||||
string_printf(str, "<optional> ");
|
||||
} else {
|
||||
string_printf(str, "<required> ");
|
||||
}
|
||||
if (arg_info->class_name) {
|
||||
string_printf(str, "%s ", arg_info->class_name);
|
||||
if (arg_info->allow_null) {
|
||||
@@ -518,6 +528,32 @@ static void _parameter_string(string *str, struct _zend_arg_info *arg_info, int
|
||||
} else {
|
||||
string_printf(str, "$param%d", offset);
|
||||
}
|
||||
if (fptr->type == ZEND_USER_FUNCTION && offset >= required) {
|
||||
zend_op *precv = &((zend_op_array*)fptr)->opcodes[offset*2 + 1];
|
||||
if (precv->opcode == ZEND_RECV_INIT && precv->op2.op_type != IS_UNUSED) {
|
||||
zval *zv, zv_copy;
|
||||
int use_copy;
|
||||
string_write(str, " = ", sizeof(" = ")-1);
|
||||
zv_copy = precv->op2.u.constant;
|
||||
zv = &zv_copy;
|
||||
zval_update_constant(&zv, (void*)1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(zv) == IS_NULL) {
|
||||
string_write(str, "NULL", sizeof("NULL")-1);
|
||||
} else if (Z_TYPE_P(zv) == IS_STRING) {
|
||||
string_write(str, "'", sizeof("'")-1);
|
||||
string_write(str, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 15));
|
||||
if (Z_STRLEN_P(zv) > 15) {
|
||||
string_write(str, "...", sizeof("...")-1);
|
||||
}
|
||||
string_write(str, "'", sizeof("'")-1);
|
||||
} else {
|
||||
zend_make_printable_zval(zv, &zv_copy, &use_copy);
|
||||
string_write(str, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy));
|
||||
zval_dtor(&zv_copy);
|
||||
}
|
||||
zval_ptr_dtor(&zv);
|
||||
}
|
||||
}
|
||||
string_write(str, " ]", sizeof(" ]")-1);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -525,8 +561,8 @@ static void _parameter_string(string *str, struct _zend_arg_info *arg_info, int
|
||||
/* {{{ _function_parameter_string */
|
||||
static void _function_parameter_string(string *str, zend_function *fptr, char* indent TSRMLS_DC)
|
||||
{
|
||||
zend_uint i;
|
||||
struct _zend_arg_info *arg_info = fptr->common.arg_info;
|
||||
zend_uint i, required = fptr->common.required_num_args;
|
||||
|
||||
if (!arg_info) {
|
||||
return;
|
||||
@@ -536,7 +572,7 @@ static void _function_parameter_string(string *str, zend_function *fptr, char* i
|
||||
string_printf(str, "%s- Parameters [%d] {\n", indent, fptr->common.num_args);
|
||||
for (i = 0; i < fptr->common.num_args; i++) {
|
||||
string_printf(str, "%s ", indent);
|
||||
_parameter_string(str, arg_info, i, indent TSRMLS_CC);
|
||||
_parameter_string(str, fptr, arg_info, i, required, indent TSRMLS_CC);
|
||||
string_write(str, "\n", sizeof("\n")-1);
|
||||
arg_info++;
|
||||
}
|
||||
@@ -586,6 +622,9 @@ static void _function_string(string *str, zend_function *fptr, char* indent TSRM
|
||||
case ZEND_ACC_PROTECTED:
|
||||
string_printf(str, "protected ");
|
||||
break;
|
||||
default:
|
||||
string_printf(str, "<visibilty error> ");
|
||||
break;
|
||||
}
|
||||
|
||||
string_printf(str, fptr->common.scope ? "method " : "function ");
|
||||
@@ -779,8 +818,8 @@ static void _function_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ reflection_class_factory */
|
||||
static void reflection_class_factory(zend_class_entry *ce, zval *object TSRMLS_DC)
|
||||
/* {{{ zend_reflection_class_factory */
|
||||
ZEND_API void zend_reflection_class_factory(zend_class_entry *ce, zval *object TSRMLS_DC)
|
||||
{
|
||||
reflection_object *intern;
|
||||
zval *name;
|
||||
@@ -791,6 +830,7 @@ static void reflection_class_factory(zend_class_entry *ce, zval *object TSRMLS_D
|
||||
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
|
||||
intern->ptr = ce;
|
||||
intern->free_ptr = 0;
|
||||
intern->ce = ce;
|
||||
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -818,12 +858,13 @@ static void reflection_extension_factory(zval *object, char *name_str TSRMLS_DC)
|
||||
ZVAL_STRINGL(name, module->name, name_len, 1);
|
||||
intern->ptr = module;
|
||||
intern->free_ptr = 0;
|
||||
intern->ce = NULL;
|
||||
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ reflection_parameter_factory */
|
||||
static void reflection_parameter_factory(struct _zend_arg_info *arg_info, int offset, zval *object TSRMLS_DC)
|
||||
static void reflection_parameter_factory(zend_function *fptr, struct _zend_arg_info *arg_info, zend_uint offset, zend_uint required, zval *object TSRMLS_DC)
|
||||
{
|
||||
reflection_object *intern;
|
||||
parameter_reference *reference;
|
||||
@@ -840,8 +881,11 @@ static void reflection_parameter_factory(struct _zend_arg_info *arg_info, int of
|
||||
reference = (parameter_reference*) emalloc(sizeof(parameter_reference));
|
||||
reference->arg_info = arg_info;
|
||||
reference->offset = offset;
|
||||
reference->required = required;
|
||||
reference->fptr = fptr;
|
||||
intern->ptr = reference;
|
||||
intern->free_ptr = 1;
|
||||
intern->ce = fptr->common.scope;
|
||||
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -859,6 +903,7 @@ static void reflection_function_factory(zend_function *function, zval *object TS
|
||||
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
|
||||
intern->ptr = function;
|
||||
intern->free_ptr = 0;
|
||||
intern->ce = NULL;
|
||||
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -878,6 +923,7 @@ static void reflection_method_factory(zend_class_entry *ce, zend_function *metho
|
||||
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
|
||||
intern->ptr = method;
|
||||
intern->free_ptr = 0;
|
||||
intern->ce = ce;
|
||||
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
|
||||
zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL);
|
||||
}
|
||||
@@ -923,6 +969,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
|
||||
reference->prop = prop;
|
||||
intern->ptr = reference;
|
||||
intern->free_ptr = 1;
|
||||
intern->ce = ce;
|
||||
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
|
||||
zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL);
|
||||
}
|
||||
@@ -1051,7 +1098,7 @@ ZEND_METHOD(reflection, export)
|
||||
zval_ptr_dtor(&fname);
|
||||
|
||||
if (result == FAILURE) {
|
||||
_DO_THROW("Invokation of method __toString() failed");
|
||||
_DO_THROW("Invocation of method __toString() failed");
|
||||
/* Returns from this function */
|
||||
}
|
||||
|
||||
@@ -1084,32 +1131,32 @@ ZEND_METHOD(reflection, getModifierNames)
|
||||
array_init(return_value);
|
||||
|
||||
if (modifiers & (ZEND_ACC_ABSTRACT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
|
||||
add_next_index_stringl(return_value, "abstract", sizeof("abstract"), 1);
|
||||
add_next_index_stringl(return_value, "abstract", sizeof("abstract")-1, 1);
|
||||
}
|
||||
if (modifiers & (ZEND_ACC_FINAL | ZEND_ACC_FINAL_CLASS)) {
|
||||
add_next_index_stringl(return_value, "final", sizeof("final"), 1);
|
||||
add_next_index_stringl(return_value, "final", sizeof("final")-1, 1);
|
||||
}
|
||||
|
||||
/* These are mutually exclusive */
|
||||
switch (modifiers & ZEND_ACC_PPP_MASK) {
|
||||
case ZEND_ACC_PUBLIC:
|
||||
add_next_index_stringl(return_value, "public", sizeof("public"), 1);
|
||||
add_next_index_stringl(return_value, "public", sizeof("public")-1, 1);
|
||||
break;
|
||||
case ZEND_ACC_PRIVATE:
|
||||
add_next_index_stringl(return_value, "private", sizeof("private"), 1);
|
||||
add_next_index_stringl(return_value, "private", sizeof("private")-1, 1);
|
||||
break;
|
||||
case ZEND_ACC_PROTECTED:
|
||||
add_next_index_stringl(return_value, "protected", sizeof("protected"), 1);
|
||||
add_next_index_stringl(return_value, "protected", sizeof("protected")-1, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (modifiers & ZEND_ACC_STATIC) {
|
||||
add_next_index_stringl(return_value, "static", sizeof("static"), 1);
|
||||
add_next_index_stringl(return_value, "static", sizeof("static")-1, 1);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public static mixed ReflectionFunction::export(string name, [, bool return]) throws ReflectionException
|
||||
/* {{{ proto public static mixed ReflectionFunction::export(string name [, bool return]) throws ReflectionException
|
||||
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
|
||||
ZEND_METHOD(reflection_function, export)
|
||||
{
|
||||
@@ -1152,6 +1199,7 @@ ZEND_METHOD(reflection_function, __construct)
|
||||
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
|
||||
intern->ptr = fptr;
|
||||
intern->free_ptr = 0;
|
||||
intern->ce = NULL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1283,7 +1331,7 @@ ZEND_METHOD(reflection_function, getStaticVariables)
|
||||
|
||||
/* Return an empty array in case no static variables exist */
|
||||
array_init(return_value);
|
||||
if (fptr->op_array.static_variables != NULL) {
|
||||
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.static_variables != NULL) {
|
||||
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 *));
|
||||
}
|
||||
}
|
||||
@@ -1332,7 +1380,7 @@ ZEND_METHOD(reflection_function, invoke)
|
||||
|
||||
if (result == FAILURE) {
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Invokation of method %s() failed", fptr->common.function_name);
|
||||
"Invocation of method %s() failed", fptr->common.function_name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1356,13 +1404,41 @@ ZEND_METHOD(reflection_function, returnsReference)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public bool ReflectionFunction::getNumberOfParameters()
|
||||
Gets the number of required parameters */
|
||||
ZEND_METHOD(reflection_function, getNumberOfParameters)
|
||||
{
|
||||
reflection_object *intern;
|
||||
zend_function *fptr;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
|
||||
RETURN_LONG(fptr->common.num_args);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public bool ReflectionFunction::getNumberOfRequiredParameters()
|
||||
Gets the number of required parameters */
|
||||
ZEND_METHOD(reflection_function, getNumberOfRequiredParameters)
|
||||
{
|
||||
reflection_object *intern;
|
||||
zend_function *fptr;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
GET_REFLECTION_OBJECT_PTR(fptr);
|
||||
|
||||
RETURN_LONG(fptr->common.required_num_args);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionParameter[] Reflection_Function::getParameters()
|
||||
Returns an array of parameter objects for this function */
|
||||
ZEND_METHOD(reflection_function, getParameters)
|
||||
{
|
||||
reflection_object *intern;
|
||||
zend_function *fptr;
|
||||
int i;
|
||||
zend_uint i;
|
||||
struct _zend_arg_info *arg_info;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
@@ -1375,7 +1451,7 @@ ZEND_METHOD(reflection_function, getParameters)
|
||||
zval *parameter;
|
||||
|
||||
ALLOC_ZVAL(parameter);
|
||||
reflection_parameter_factory(arg_info, i, parameter TSRMLS_CC);
|
||||
reflection_parameter_factory(fptr, arg_info, i, fptr->common.required_num_args, parameter TSRMLS_CC);
|
||||
add_next_index_zval(return_value, parameter);
|
||||
|
||||
arg_info++;
|
||||
@@ -1383,7 +1459,7 @@ ZEND_METHOD(reflection_function, getParameters)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public static mixed ReflectionParameter::export(mixed function, mixed parameter, [, bool return]) throws ReflectionException
|
||||
/* {{{ proto public static mixed ReflectionParameter::export(mixed function, mixed parameter [, bool return]) throws ReflectionException
|
||||
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
|
||||
ZEND_METHOD(reflection_parameter, export)
|
||||
{
|
||||
@@ -1403,6 +1479,7 @@ ZEND_METHOD(reflection_parameter, __construct)
|
||||
zend_function *fptr;
|
||||
struct _zend_arg_info *arg_info;
|
||||
int position;
|
||||
zend_class_entry *ce = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &reference, ¶meter) == FAILURE) {
|
||||
return;
|
||||
@@ -1435,7 +1512,6 @@ ZEND_METHOD(reflection_parameter, __construct)
|
||||
case IS_ARRAY: {
|
||||
zval **classref;
|
||||
zval **method;
|
||||
zend_class_entry *ce;
|
||||
zend_class_entry **pce;
|
||||
char *lcname;
|
||||
|
||||
@@ -1479,12 +1555,12 @@ ZEND_METHOD(reflection_parameter, __construct)
|
||||
arg_info = fptr->common.arg_info;
|
||||
if (Z_TYPE_P(parameter) == IS_LONG) {
|
||||
position= Z_LVAL_P(parameter);
|
||||
if (position < 0 || position >= fptr->common.num_args) {
|
||||
if (position < 0 || (zend_uint)position >= fptr->common.num_args) {
|
||||
_DO_THROW("The parameter specified by its offset could not be found");
|
||||
/* returns out of this function */
|
||||
}
|
||||
} else {
|
||||
int i;
|
||||
zend_uint i;
|
||||
|
||||
position= -1;
|
||||
convert_to_string_ex(¶meter);
|
||||
@@ -1510,9 +1586,12 @@ ZEND_METHOD(reflection_parameter, __construct)
|
||||
|
||||
ref = (parameter_reference*) emalloc(sizeof(parameter_reference));
|
||||
ref->arg_info = &arg_info[position];
|
||||
ref->offset = position;
|
||||
ref->offset = (zend_uint)position;
|
||||
ref->required = fptr->common.required_num_args;
|
||||
ref->fptr = fptr;
|
||||
intern->ptr = ref;
|
||||
intern->free_ptr = 1;
|
||||
intern->ce = ce;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1527,7 +1606,7 @@ ZEND_METHOD(reflection_parameter, __toString)
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
GET_REFLECTION_OBJECT_PTR(param);
|
||||
string_init(&str);
|
||||
_parameter_string(&str, param->arg_info, param->offset, "" TSRMLS_CC);
|
||||
_parameter_string(&str, param->fptr, param->arg_info, param->offset, param->required, "" TSRMLS_CC);
|
||||
RETURN_STRINGL(str.string, str.len - 1, 0);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1541,7 +1620,7 @@ ZEND_METHOD(reflection_parameter, getName)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionClass Reflection_Parameter::getClass()
|
||||
/* {{{ proto public ReflectionClass ReflectionParameter::getClass()
|
||||
Returns this parameters's class hint or NULL if there is none */
|
||||
ZEND_METHOD(reflection_parameter, getClass)
|
||||
{
|
||||
@@ -1564,7 +1643,7 @@ ZEND_METHOD(reflection_parameter, getClass)
|
||||
return;
|
||||
}
|
||||
free_alloca(lcname);
|
||||
reflection_class_factory(*pce, return_value TSRMLS_CC);
|
||||
zend_reflection_class_factory(*pce, return_value TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1597,7 +1676,81 @@ ZEND_METHOD(reflection_parameter, isPassedByReference)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public static mixed ReflectionMethod::export(mixed class, string name, [, bool return]) throws ReflectionException
|
||||
/* {{{ proto public bool ReflectionParameter::isOptional()
|
||||
Returns whether this parameter is an optional parameter */
|
||||
ZEND_METHOD(reflection_parameter, isOptional)
|
||||
{
|
||||
reflection_object *intern;
|
||||
parameter_reference *param;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
GET_REFLECTION_OBJECT_PTR(param);
|
||||
|
||||
RETVAL_BOOL(param->offset >= param->required);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public bool ReflectionParameter::isDefaultValueAvailable()
|
||||
Returns whether the default value of this parameter is available */
|
||||
ZEND_METHOD(reflection_parameter, isDefaultValueAvailable)
|
||||
{
|
||||
reflection_object *intern;
|
||||
parameter_reference *param;
|
||||
zend_op *precv;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
GET_REFLECTION_OBJECT_PTR(param);
|
||||
|
||||
if (param->fptr->type != ZEND_USER_FUNCTION)
|
||||
{
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (param->offset < param->required) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
precv = &((zend_op_array*)param->fptr)->opcodes[param->offset*2 + 1];
|
||||
if (precv->opcode != ZEND_RECV_INIT || precv->op2.op_type == IS_UNUSED) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public bool ReflectionParameter::getDefaultValue()
|
||||
Returns the default value of this parameter or throws an exception */
|
||||
ZEND_METHOD(reflection_parameter, getDefaultValue)
|
||||
{
|
||||
reflection_object *intern;
|
||||
parameter_reference *param;
|
||||
zend_op *precv;
|
||||
zval *zv, zv_copy;
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
GET_REFLECTION_OBJECT_PTR(param);
|
||||
|
||||
if (param->fptr->type != ZEND_USER_FUNCTION)
|
||||
{
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot determine default value for internal functions");
|
||||
return;
|
||||
}
|
||||
if (param->offset < param->required) {
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional");
|
||||
return;
|
||||
}
|
||||
precv = &((zend_op_array*)param->fptr)->opcodes[param->offset*2 + 1];
|
||||
if (precv->opcode != ZEND_RECV_INIT || precv->op2.op_type == IS_UNUSED) {
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error");
|
||||
return;
|
||||
}
|
||||
|
||||
zv_copy = precv->op2.u.constant;
|
||||
zv = &zv_copy;
|
||||
zval_update_constant(&zv, (void*)1 TSRMLS_CC);
|
||||
RETURN_ZVAL(zv, 1, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public static mixed ReflectionMethod::export(mixed class, string name [, bool return]) throws ReflectionException
|
||||
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
|
||||
ZEND_METHOD(reflection_method, export)
|
||||
{
|
||||
@@ -1669,6 +1822,7 @@ ZEND_METHOD(reflection_method, __construct)
|
||||
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
|
||||
intern->ptr = mptr;
|
||||
intern->free_ptr = 0;
|
||||
intern->ce = ce;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1781,7 +1935,7 @@ ZEND_METHOD(reflection_method, invoke)
|
||||
|
||||
if (result == FAILURE) {
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Invokation of method %s::%s() failed", mptr->common.scope->name, mptr->common.function_name);
|
||||
"Invocation of method %s::%s() failed", mptr->common.scope->name, mptr->common.function_name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1848,7 +2002,10 @@ ZEND_METHOD(reflection_method, isConstructor)
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
GET_REFLECTION_OBJECT_PTR(mptr);
|
||||
RETURN_BOOL(mptr->common.scope->constructor == 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
|
||||
* defined in base class. */
|
||||
RETURN_BOOL(mptr->common.fn_flags & ZEND_ACC_CTOR && intern->ce->constructor && intern->ce->constructor->common.scope == mptr->common.scope);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1861,7 +2018,7 @@ ZEND_METHOD(reflection_method, isDestructor)
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
GET_REFLECTION_OBJECT_PTR(mptr);
|
||||
RETURN_BOOL(mptr->common.scope->destructor == mptr);
|
||||
RETURN_BOOL(mptr->common.fn_flags && ZEND_ACC_DTOR);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1879,7 +2036,7 @@ ZEND_METHOD(reflection_method, getModifiers)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionClass Reflection_Method::getDeclaringClass()
|
||||
/* {{{ proto public ReflectionClass ReflectionMethod::getDeclaringClass()
|
||||
Get the declaring class */
|
||||
ZEND_METHOD(reflection_method, getDeclaringClass)
|
||||
{
|
||||
@@ -1889,11 +2046,11 @@ ZEND_METHOD(reflection_method, getDeclaringClass)
|
||||
METHOD_NOTSTATIC;
|
||||
GET_REFLECTION_OBJECT_PTR(mptr);
|
||||
|
||||
reflection_class_factory(mptr->common.scope, return_value TSRMLS_CC);
|
||||
zend_reflection_class_factory(mptr->common.scope, return_value TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public static mixed ReflectionClass::export(mixed argument, [, bool return]) throws ReflectionException
|
||||
/* {{{ proto public static mixed ReflectionClass::export(mixed argument [, bool return]) throws ReflectionException
|
||||
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
|
||||
ZEND_METHOD(reflection_class, export)
|
||||
{
|
||||
@@ -1970,6 +2127,13 @@ ZEND_METHOD(reflection_class, getStaticProperties)
|
||||
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
|
||||
if (!ce->constants_updated) {
|
||||
zend_hash_apply_with_argument(&ce->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
zend_hash_apply_with_argument(ce->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
ce->constants_updated = 1;
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
zend_hash_copy(Z_ARRVAL_P(return_value), ce->static_members, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
|
||||
}
|
||||
@@ -2134,7 +2298,7 @@ ZEND_METHOD(reflection_class, getDocComment)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionMethod Reflection_Class::getConstructor()
|
||||
/* {{{ proto public ReflectionMethod ReflectionClass::getConstructor()
|
||||
Returns the class' constructor if there is one, NULL otherwise */
|
||||
ZEND_METHOD(reflection_class, getConstructor)
|
||||
{
|
||||
@@ -2152,14 +2316,14 @@ ZEND_METHOD(reflection_class, getConstructor)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionMethod Reflection_Class::getMethod(string name)
|
||||
/* {{{ proto public ReflectionMethod ReflectionClass::getMethod(string name) throws ReflectionException
|
||||
Returns the class' method specified by it's name */
|
||||
ZEND_METHOD(reflection_class, getMethod)
|
||||
{
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
zend_function *mptr;
|
||||
char *name;
|
||||
char *name, *lc_name;
|
||||
int name_len;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
@@ -2168,11 +2332,15 @@ ZEND_METHOD(reflection_class, getMethod)
|
||||
}
|
||||
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
zend_str_tolower(name, name_len);
|
||||
if (zend_hash_find(&ce->function_table, name, name_len + 1, (void**) &mptr) == SUCCESS) {
|
||||
lc_name = zend_str_tolower_dup(name, name_len);
|
||||
if (zend_hash_find(&ce->function_table, lc_name, name_len + 1, (void**) &mptr) == SUCCESS) {
|
||||
reflection_method_factory(ce, mptr, return_value TSRMLS_CC);
|
||||
efree(lc_name);
|
||||
} else {
|
||||
RETURN_NULL();
|
||||
efree(lc_name);
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Method %s does not exist", name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2195,7 +2363,7 @@ static int _addmethod(zend_function *mptr, int num_args, va_list args, zend_hash
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionMethod[] Reflection_Class::getMethods()
|
||||
/* {{{ proto public ReflectionMethod[] ReflectionClass::getMethods()
|
||||
Returns an array of this class' methods */
|
||||
ZEND_METHOD(reflection_class, getMethods)
|
||||
{
|
||||
@@ -2221,7 +2389,7 @@ ZEND_METHOD(reflection_class, getMethods)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionProperty Reflection_Class::getProperty(string name)
|
||||
/* {{{ proto public ReflectionProperty ReflectionClass::getProperty(string name) throws ReflectionException
|
||||
Returns the class' property specified by it's name */
|
||||
ZEND_METHOD(reflection_class, getProperty)
|
||||
{
|
||||
@@ -2240,7 +2408,9 @@ ZEND_METHOD(reflection_class, getProperty)
|
||||
if (zend_hash_find(&ce->properties_info, name, name_len + 1, (void**) &property_info) == SUCCESS) {
|
||||
reflection_property_factory(ce, property_info, return_value TSRMLS_CC);
|
||||
} else {
|
||||
RETURN_NULL();
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Property %s does not exist", name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2263,7 +2433,7 @@ static int _addproperty(zend_property_info *pptr, int num_args, va_list args, ze
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionProperty[] Reflection_Class::getProperties()
|
||||
/* {{{ proto public ReflectionProperty[] ReflectionClass::getProperties()
|
||||
Returns an array of this class' properties */
|
||||
ZEND_METHOD(reflection_class, getProperties)
|
||||
{
|
||||
@@ -2300,6 +2470,7 @@ ZEND_METHOD(reflection_class, getConstants)
|
||||
METHOD_NOTSTATIC_NUMPARAMS(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);
|
||||
zend_hash_copy(Z_ARRVAL_P(return_value), &ce->constants_table, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2320,6 +2491,7 @@ ZEND_METHOD(reflection_class, getConstant)
|
||||
}
|
||||
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
zend_hash_apply_with_argument(&ce->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
|
||||
if (zend_hash_find(&ce->constants_table, name, name_len + 1, (void **) &value) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -2383,7 +2555,7 @@ ZEND_METHOD(reflection_class, isFinal)
|
||||
Returns whether this class is abstract */
|
||||
ZEND_METHOD(reflection_class, isAbstract)
|
||||
{
|
||||
_class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_IMPLICIT_ABSTRACT_CLASS);
|
||||
_class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -2467,7 +2639,7 @@ ZEND_METHOD(reflection_class, newInstance)
|
||||
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
||||
efree(params);
|
||||
zval_ptr_dtor(&retval_ptr);
|
||||
zend_error(E_WARNING, "Invokation of %s's constructor failed", ce->name);
|
||||
zend_error(E_WARNING, "Invocation of %s's constructor failed", ce->name);
|
||||
RETURN_NULL();
|
||||
}
|
||||
if (retval_ptr) {
|
||||
@@ -2478,7 +2650,7 @@ ZEND_METHOD(reflection_class, newInstance)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionClass[] Reflection_Class::getInterfaces()
|
||||
/* {{{ proto public ReflectionClass[] ReflectionClass::getInterfaces()
|
||||
Returns an array of interfaces this class implements */
|
||||
ZEND_METHOD(reflection_class, getInterfaces)
|
||||
{
|
||||
@@ -2497,14 +2669,14 @@ ZEND_METHOD(reflection_class, getInterfaces)
|
||||
for (i=0; i < ce->num_interfaces; i++) {
|
||||
zval *interface;
|
||||
ALLOC_ZVAL(interface);
|
||||
reflection_class_factory(ce->interfaces[i], interface TSRMLS_CC);
|
||||
zend_reflection_class_factory(ce->interfaces[i], interface TSRMLS_CC);
|
||||
add_next_index_zval(return_value, interface);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionClass Reflection_Class::getParentClass()
|
||||
/* {{{ proto public ReflectionClass ReflectionClass::getParentClass()
|
||||
Returns the class' parent class, or, if none exists, FALSE */
|
||||
ZEND_METHOD(reflection_class, getParentClass)
|
||||
{
|
||||
@@ -2515,14 +2687,14 @@ ZEND_METHOD(reflection_class, getParentClass)
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
|
||||
if (ce->parent) {
|
||||
reflection_class_factory(ce->parent, return_value TSRMLS_CC);
|
||||
zend_reflection_class_factory(ce->parent, return_value TSRMLS_CC);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public bool ReflectionClass::isSubclassOf(string|reflection_class class)
|
||||
/* {{{ proto public bool ReflectionClass::isSubclassOf(string|ReflectionClass class)
|
||||
Returns whether this class is a subclass of another class */
|
||||
ZEND_METHOD(reflection_class, isSubclassOf)
|
||||
{
|
||||
@@ -2541,7 +2713,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
|
||||
case IS_STRING:
|
||||
if (zend_lookup_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), &pce TSRMLS_CC) == FAILURE) {
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Interface %s doesn't exist", Z_STRVAL_P(class_name));
|
||||
"Interface %s does not exist", Z_STRVAL_P(class_name));
|
||||
return;
|
||||
}
|
||||
class_ce = *pce;
|
||||
@@ -2559,7 +2731,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
|
||||
/* no break */
|
||||
default:
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Parameter one must either be a string or a Reflection_Class object");
|
||||
"Parameter one must either be a string or a ReflectionClass object");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2568,7 +2740,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public bool ReflectionClass::implementsInterface(string|reflection_class interface_name)
|
||||
/* {{{ proto public bool ReflectionClass::implementsInterface(string|ReflectionClass interface_name)
|
||||
Returns whether this class is a subclass of another class */
|
||||
ZEND_METHOD(reflection_class, implementsInterface)
|
||||
{
|
||||
@@ -2587,7 +2759,7 @@ ZEND_METHOD(reflection_class, implementsInterface)
|
||||
case IS_STRING:
|
||||
if (zend_lookup_class(Z_STRVAL_P(interface), Z_STRLEN_P(interface), &pce TSRMLS_CC) == FAILURE) {
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Interface %s doesn't exist", Z_STRVAL_P(interface));
|
||||
"Interface %s does not exist", Z_STRVAL_P(interface));
|
||||
return;
|
||||
}
|
||||
interface_ce = *pce;
|
||||
@@ -2605,7 +2777,7 @@ ZEND_METHOD(reflection_class, implementsInterface)
|
||||
/* no break */
|
||||
default:
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Parameter one must either be a string or a Reflection_Class object");
|
||||
"Parameter one must either be a string or a ReflectionClass object");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2632,7 +2804,7 @@ ZEND_METHOD(reflection_class, isIterateable)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionExtension|NULL Reflection_Class::getExtension()
|
||||
/* {{{ proto public ReflectionExtension|NULL ReflectionClass::getExtension()
|
||||
Returns NULL or the extension the class belongs to */
|
||||
ZEND_METHOD(reflection_class, getExtension)
|
||||
{
|
||||
@@ -2666,7 +2838,7 @@ ZEND_METHOD(reflection_class, getExtensionName)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public static mixed ReflectionObject::export(mixed argument, [, bool return]) throws ReflectionException
|
||||
/* {{{ proto public static mixed ReflectionObject::export(mixed argument [, bool return]) throws ReflectionException
|
||||
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
|
||||
ZEND_METHOD(reflection_object, export)
|
||||
{
|
||||
@@ -2682,7 +2854,7 @@ ZEND_METHOD(reflection_object, __construct)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public static mixed ReflectionProperty::export(mixed class, string name, [, bool return]) throws ReflectionException
|
||||
/* {{{ proto public static mixed ReflectionProperty::export(mixed class, string name [, bool return]) throws ReflectionException
|
||||
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
|
||||
ZEND_METHOD(reflection_property, export)
|
||||
{
|
||||
@@ -2769,6 +2941,7 @@ ZEND_METHOD(reflection_property, __construct)
|
||||
reference->prop = property_info;
|
||||
intern->ptr = reference;
|
||||
intern->free_ptr = 1;
|
||||
intern->ce = ce;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -2861,7 +3034,7 @@ ZEND_METHOD(reflection_property, getModifiers)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public mixed ReflectionProperty::getValue(stdclass object)
|
||||
/* {{{ proto public mixed ReflectionProperty::getValue([stdclass object])
|
||||
Returns this property's value */
|
||||
ZEND_METHOD(reflection_property, getValue)
|
||||
{
|
||||
@@ -2878,16 +3051,15 @@ ZEND_METHOD(reflection_property, getValue)
|
||||
/* Returns from this function */
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &object) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ref->prop->flags & ZEND_ACC_STATIC)) {
|
||||
if (zend_hash_quick_find(Z_OBJCE_P(object)->static_members, ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) {
|
||||
if (zend_hash_quick_find(intern->ce->static_members, ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) {
|
||||
zend_error(E_ERROR, "Internal error: Could not find the property %s", ref->prop->name);
|
||||
/* Bails out */
|
||||
}
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &object) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (zend_hash_quick_find(Z_OBJPROP_P(object), ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) {
|
||||
zend_error(E_ERROR, "Internal error: Could not find the property %s", ref->prop->name);
|
||||
/* Bails out */
|
||||
@@ -2899,7 +3071,7 @@ ZEND_METHOD(reflection_property, getValue)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public void ReflectionProperty::setValue(stdclass object, mixed value)
|
||||
/* {{{ proto public void ReflectionProperty::setValue([stdclass object,] mixed value)
|
||||
Sets this property's value */
|
||||
ZEND_METHOD(reflection_property, setValue)
|
||||
{
|
||||
@@ -2909,38 +3081,48 @@ ZEND_METHOD(reflection_property, setValue)
|
||||
zval *object;
|
||||
zval *value;
|
||||
int setter_done = 0;
|
||||
zval *tmp;
|
||||
HashTable *prop_table;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
GET_REFLECTION_OBJECT_PTR(ref);
|
||||
|
||||
if (ref->prop->flags & ~ZEND_ACC_PUBLIC) {
|
||||
if (ref->prop->flags & ~(ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)) {
|
||||
_DO_THROW("Cannot access non-public member");
|
||||
/* Returns from this function */
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oz", &object, &value) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (zend_hash_quick_find(Z_OBJPROP_P(object), ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &variable_ptr) == SUCCESS) {
|
||||
if (*variable_ptr == value) {
|
||||
setter_done = 1;
|
||||
} else {
|
||||
if (PZVAL_IS_REF(*variable_ptr)) {
|
||||
zval_dtor(*variable_ptr);
|
||||
(*variable_ptr)->type = value->type;
|
||||
(*variable_ptr)->value = value->value;
|
||||
if (value->refcount > 0) {
|
||||
zval_copy_ctor(*variable_ptr);
|
||||
}
|
||||
setter_done = 1;
|
||||
if ((ref->prop->flags & ZEND_ACC_STATIC)) {
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z", &value) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &tmp, &value) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
prop_table = intern->ce->static_members;
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oz", &object, &value) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
prop_table = Z_OBJPROP_P(object);
|
||||
}
|
||||
|
||||
if (zend_hash_quick_find(prop_table, ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &variable_ptr) == FAILURE) {
|
||||
zend_error(E_ERROR, "Internal error: Could not find the property %s", ref->prop->name);
|
||||
/* Bails out */
|
||||
}
|
||||
|
||||
if (*variable_ptr == value) {
|
||||
setter_done = 1;
|
||||
} else {
|
||||
if (PZVAL_IS_REF(*variable_ptr)) {
|
||||
zval_dtor(*variable_ptr);
|
||||
(*variable_ptr)->type = value->type;
|
||||
(*variable_ptr)->value = value->value;
|
||||
if (value->refcount > 0) {
|
||||
zval_copy_ctor(*variable_ptr);
|
||||
}
|
||||
setter_done = 1;
|
||||
}
|
||||
}
|
||||
if (!setter_done) {
|
||||
zval **foo;
|
||||
|
||||
@@ -2948,12 +3130,12 @@ ZEND_METHOD(reflection_property, setValue)
|
||||
if (PZVAL_IS_REF(value)) {
|
||||
SEPARATE_ZVAL(&value);
|
||||
}
|
||||
zend_hash_quick_update(Z_OBJPROP_P(object), ref->prop->name, ref->prop->name_length+1, ref->prop->h, &value, sizeof(zval *), (void **) &foo);
|
||||
zend_hash_quick_update(prop_table, ref->prop->name, ref->prop->name_length+1, ref->prop->h, &value, sizeof(zval *), (void **) &foo);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionClass Reflection_Property::getDeclaringClass()
|
||||
/* {{{ proto public ReflectionClass ReflectionProperty::getDeclaringClass()
|
||||
Get the declaring class */
|
||||
ZEND_METHOD(reflection_property, getDeclaringClass)
|
||||
{
|
||||
@@ -2963,10 +3145,10 @@ ZEND_METHOD(reflection_property, getDeclaringClass)
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
GET_REFLECTION_OBJECT_PTR(ref);
|
||||
|
||||
reflection_class_factory(ref->ce, return_value TSRMLS_CC);
|
||||
zend_reflection_class_factory(ref->ce, return_value TSRMLS_CC);
|
||||
}
|
||||
|
||||
/* {{{ proto public static mixed ReflectionExtension::export(string name, [, bool return]) throws ReflectionException
|
||||
/* {{{ proto public static mixed ReflectionExtension::export(string name [, bool return]) throws ReflectionException
|
||||
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
|
||||
ZEND_METHOD(reflection_extension, export)
|
||||
{
|
||||
@@ -3009,6 +3191,7 @@ ZEND_METHOD(reflection_extension, __construct)
|
||||
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
|
||||
intern->ptr = module;
|
||||
intern->free_ptr = 0;
|
||||
intern->ce = NULL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -3056,7 +3239,7 @@ ZEND_METHOD(reflection_extension, getVersion)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionFunction[] Reflection_Extension::getFunctions()
|
||||
/* {{{ proto public ReflectionFunction[] ReflectionExtension::getFunctions()
|
||||
Returns an array of this extension's fuctions */
|
||||
ZEND_METHOD(reflection_extension, getFunctions)
|
||||
{
|
||||
@@ -3081,7 +3264,7 @@ ZEND_METHOD(reflection_extension, getFunctions)
|
||||
|
||||
ALLOC_ZVAL(function);
|
||||
reflection_function_factory(fptr, function TSRMLS_CC);
|
||||
add_next_index_zval(return_value, function);
|
||||
add_assoc_zval_ex(return_value, func->fname, strlen(func->fname)+1, function);
|
||||
func++;
|
||||
}
|
||||
}
|
||||
@@ -3162,7 +3345,7 @@ static int add_extension_class(zend_class_entry **pce, int num_args, va_list arg
|
||||
TSRMLS_FETCH();
|
||||
if (add_reflection_class) {
|
||||
ALLOC_ZVAL(zclass);
|
||||
reflection_class_factory(*pce, zclass TSRMLS_CC);
|
||||
zend_reflection_class_factory(*pce, zclass TSRMLS_CC);
|
||||
add_assoc_zval_ex(class_array, (*pce)->name, (*pce)->name_length + 1, zclass);
|
||||
} else {
|
||||
add_next_index_stringl(class_array, (*pce)->name, (*pce)->name_length + 1, 1);
|
||||
@@ -3173,7 +3356,7 @@ static int add_extension_class(zend_class_entry **pce, int num_args, va_list arg
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionClass[] ReflectionExtension::getClasses()
|
||||
Returns an array containing Reflection_Class objects for all classes of this extension */
|
||||
Returns an array containing ReflectionClass objects for all classes of this extension */
|
||||
ZEND_METHOD(reflection_extension, getClasses)
|
||||
{
|
||||
reflection_object *intern;
|
||||
@@ -3235,6 +3418,8 @@ static zend_function_entry reflection_function_functions[] = {
|
||||
ZEND_ME(reflection_function, invoke, NULL, 0)
|
||||
ZEND_ME(reflection_function, returnsReference, NULL, 0)
|
||||
ZEND_ME(reflection_function, getParameters, NULL, 0)
|
||||
ZEND_ME(reflection_function, getNumberOfParameters, NULL, 0)
|
||||
ZEND_ME(reflection_function, getNumberOfRequiredParameters, NULL, 0)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -3327,6 +3512,9 @@ static zend_function_entry reflection_parameter_functions[] = {
|
||||
ZEND_ME(reflection_parameter, isPassedByReference, NULL, 0)
|
||||
ZEND_ME(reflection_parameter, getClass, NULL, 0)
|
||||
ZEND_ME(reflection_parameter, allowsNull, NULL, 0)
|
||||
ZEND_ME(reflection_parameter, isOptional, NULL, 0)
|
||||
ZEND_ME(reflection_parameter, isDefaultValueAvailable, NULL, 0)
|
||||
ZEND_ME(reflection_parameter, getDefaultValue, NULL, 0)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -3346,12 +3534,33 @@ static zend_function_entry reflection_extension_functions[] = {
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
static zend_object_handlers *zend_std_obj_handlers;
|
||||
|
||||
/* {{{ _reflection_write_property */
|
||||
static void _reflection_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
|
||||
{
|
||||
if (Z_TYPE_P(member) == IS_STRING
|
||||
&& zend_hash_exists(&Z_OBJCE_P(object)->default_properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)
|
||||
&& (!strcmp(Z_STRVAL_P(member), "name") || !strcmp(Z_STRVAL_P(member), "class")))
|
||||
{
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Cannot set read-only property %s::$%s", Z_OBJCE_P(object)->name, Z_STRVAL_P(member));
|
||||
}
|
||||
else
|
||||
{
|
||||
zend_std_obj_handlers->write_property(object, member, value TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ zend_register_reflection_api */
|
||||
ZEND_API void zend_register_reflection_api(TSRMLS_D) {
|
||||
zend_class_entry _reflection_entry;
|
||||
|
||||
zend_std_obj_handlers = zend_get_std_object_handlers();
|
||||
memcpy(&reflection_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
reflection_object_handlers.clone_obj = NULL;
|
||||
reflection_object_handlers.write_property = _reflection_write_property;
|
||||
|
||||
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionException", reflection_exception_functions);
|
||||
reflection_exception_ptr = zend_register_internal_class_ex(&_reflection_entry, zend_exception_get_default(), NULL TSRMLS_CC);
|
||||
@@ -3367,20 +3576,25 @@ ZEND_API void zend_register_reflection_api(TSRMLS_D) {
|
||||
_reflection_entry.create_object = reflection_objects_new;
|
||||
reflection_function_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);
|
||||
reflection_register_implement(reflection_function_ptr, reflector_ptr TSRMLS_CC);
|
||||
zend_declare_property_string(reflection_function_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
|
||||
|
||||
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionParameter", reflection_parameter_functions);
|
||||
_reflection_entry.create_object = reflection_objects_new;
|
||||
reflection_parameter_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);
|
||||
reflection_register_implement(reflection_parameter_ptr, reflector_ptr TSRMLS_CC);
|
||||
zend_declare_property_string(reflection_parameter_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
|
||||
|
||||
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionMethod", reflection_method_functions);
|
||||
_reflection_entry.create_object = reflection_objects_new;
|
||||
reflection_method_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_ptr, NULL TSRMLS_CC);
|
||||
zend_declare_property_string(reflection_method_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
|
||||
zend_declare_property_string(reflection_method_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
|
||||
|
||||
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionClass", reflection_class_functions);
|
||||
_reflection_entry.create_object = reflection_objects_new;
|
||||
reflection_class_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);
|
||||
reflection_register_implement(reflection_class_ptr, reflector_ptr TSRMLS_CC);
|
||||
zend_declare_property_string(reflection_class_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
|
||||
|
||||
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionObject", reflection_object_functions);
|
||||
_reflection_entry.create_object = reflection_objects_new;
|
||||
@@ -3390,11 +3604,14 @@ ZEND_API void zend_register_reflection_api(TSRMLS_D) {
|
||||
_reflection_entry.create_object = reflection_objects_new;
|
||||
reflection_property_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);
|
||||
reflection_register_implement(reflection_property_ptr, reflector_ptr TSRMLS_CC);
|
||||
zend_declare_property_string(reflection_property_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
|
||||
zend_declare_property_string(reflection_property_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
|
||||
|
||||
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionExtension", reflection_extension_functions);
|
||||
_reflection_entry.create_object = reflection_objects_new;
|
||||
reflection_extension_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);
|
||||
reflection_register_implement(reflection_extension_ptr, reflector_ptr TSRMLS_CC);
|
||||
zend_declare_property_string(reflection_extension_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
|
||||
|
||||
/* Property modifiers */
|
||||
REGISTER_MAIN_LONG_CONSTANT("P_STATIC", ZEND_ACC_STATIC, CONST_PERSISTENT|CONST_CS);
|
||||
|
||||
+1769
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 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: Derick Rethans <derick@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* This is a header file for the strtod implementation by David M. Gay which
|
||||
* can be found in zend_strtod.c */
|
||||
#ifndef ZEND_STRTOD_H
|
||||
#define ZEND_STRTOD_H
|
||||
#include <zend.h>
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API double zend_strtod(const char *s00, char **se);
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif
|
||||
+15
-7
@@ -1,4 +1,4 @@
|
||||
dnl $Id$
|
||||
dnl $Id$ -*- autoconf -*-
|
||||
dnl
|
||||
dnl This file contains local autoconf functions.
|
||||
|
||||
@@ -21,12 +21,12 @@ AC_DEFUN(PHP_PROG_RE2C,[
|
||||
])
|
||||
|
||||
|
||||
dnl PHP_DEFINE(WHAT[, value])
|
||||
dnl PHP_DEFINE(WHAT[, value[, directory]])
|
||||
dnl
|
||||
dnl Creates builddir/include/what.h and in there #define WHAT value
|
||||
dnl
|
||||
AC_DEFUN([PHP_DEFINE],[
|
||||
[echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > include/php_]translit($1,A-Z,a-z)[.h]
|
||||
[echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > ]ifelse([$3],,[include],[$3])[/php_]translit($1,A-Z,a-z)[.h]
|
||||
])
|
||||
|
||||
dnl PHP_INIT_BUILD_SYSTEM
|
||||
@@ -1695,16 +1695,24 @@ AC_DEFUN([PHP_SETUP_ICONV], [
|
||||
found_iconv=no
|
||||
unset ICONV_DIR
|
||||
|
||||
# Create the directories for a VPATH build:
|
||||
test -d ext || mkdir ext
|
||||
test -d ext/iconv || mkdir ext/iconv
|
||||
|
||||
echo > ext/iconv/php_have_libiconv.h
|
||||
echo > ext/iconv/php_have_iconv.h
|
||||
echo > ext/iconv/php_php_iconv_impl.h
|
||||
|
||||
dnl
|
||||
dnl Check libc first if no path is provided in --with-iconv
|
||||
dnl
|
||||
if test "$PHP_ICONV" = "yes"; then
|
||||
AC_CHECK_FUNC(iconv, [
|
||||
PHP_DEFINE(HAVE_ICONV)
|
||||
PHP_DEFINE(HAVE_ICONV,1,[ext/iconv])
|
||||
found_iconv=yes
|
||||
],[
|
||||
AC_CHECK_FUNC(libiconv,[
|
||||
PHP_DEFINE(HAVE_LIBICONV)
|
||||
PHP_DEFINE(HAVE_LIBICONV,1,[ext/iconv])
|
||||
found_iconv=yes
|
||||
])
|
||||
])
|
||||
@@ -1737,11 +1745,11 @@ AC_DEFUN([PHP_SETUP_ICONV], [
|
||||
then
|
||||
PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [
|
||||
found_iconv=yes
|
||||
PHP_DEFINE(HAVE_LIBICONV)
|
||||
PHP_DEFINE(HAVE_LIBICONV,1,[ext/iconv])
|
||||
], [
|
||||
PHP_CHECK_LIBRARY($iconv_lib_name, iconv, [
|
||||
found_iconv=yes
|
||||
PHP_DEFINE(HAVE_ICONV)
|
||||
PHP_DEFINE(HAVE_ICONV,1,[ext/iconv])
|
||||
], [], [
|
||||
-L$ICONV_DIR/lib
|
||||
])
|
||||
|
||||
+24
-8
@@ -40,8 +40,8 @@ AC_CONFIG_HEADER(main/php_config.h)
|
||||
|
||||
MAJOR_VERSION=5
|
||||
MINOR_VERSION=0
|
||||
RELEASE_VERSION=1
|
||||
EXTRA_VERSION="-dev"
|
||||
RELEASE_VERSION=3
|
||||
EXTRA_VERSION="RC2"
|
||||
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
|
||||
|
||||
dnl Define where extension directories are located in the configure context
|
||||
@@ -545,17 +545,20 @@ AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
|
||||
AC_TRY_RUN([
|
||||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef AF_INET
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
int main(void) {
|
||||
struct addrinfo *ai, *pai, hints;
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
|
||||
if (getaddrinfo("127.0.0.1", NULL, &hints, &ai) < 0) {
|
||||
if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ai == NULL) {
|
||||
if (ai == 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -584,8 +587,8 @@ fi
|
||||
AC_REPLACE_FUNCS(strlcat strlcpy getopt)
|
||||
AC_FUNC_UTIME_NULL
|
||||
AC_FUNC_ALLOCA
|
||||
PHP_AC_BROKEN_SPRINTF
|
||||
PHP_AC_BROKEN_SNPRINTF
|
||||
dnl PHP_AC_BROKEN_SPRINTF
|
||||
dnl PHP_AC_BROKEN_SNPRINTF
|
||||
PHP_DECLARED_TIMEZONE
|
||||
PHP_TIME_R_TYPE
|
||||
PHP_READDIR_R_TYPE
|
||||
@@ -765,6 +768,19 @@ if test "$PHP_IPV6" != "no" && test "$ac_cv_ipv6_support" = yes; then
|
||||
AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([how big to make fd sets])
|
||||
AC_ARG_ENABLE(fd-setsize,
|
||||
[ --enable-fd-setsize Set size of descriptor sets],[
|
||||
if test "x$enableval" != "xyes"; then
|
||||
CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=$enableval"
|
||||
AC_MSG_RESULT(using $enableval)
|
||||
else
|
||||
AC_MSG_RESULT(using system default)
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(using system default)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([whether to enable versioning])
|
||||
AC_ARG_ENABLE(versioning,
|
||||
[ --enable-versioning Export only required symbols.
|
||||
@@ -933,7 +949,7 @@ fi
|
||||
|
||||
if test "$abs_srcdir" != "$abs_builddir"; then
|
||||
INCLUDES="$INCLUDES -I\$(top_srcdir)/main -I\$(top_srcdir)/Zend"
|
||||
INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM"
|
||||
INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM -I\$(top_builddir)/"
|
||||
fi
|
||||
|
||||
ZEND_EXTRA_LIBS="$LIBS"
|
||||
@@ -1232,7 +1248,7 @@ PHP_ADD_SOURCES(Zend, \
|
||||
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
|
||||
zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
|
||||
zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \
|
||||
zend_iterators.c zend_interfaces.c zend_exceptions.c)
|
||||
zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c)
|
||||
|
||||
if test -r "$abs_srcdir/Zend/zend_objects.c"; then
|
||||
PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c zend_mm.c \
|
||||
|
||||
@@ -92,6 +92,7 @@ bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale TSR
|
||||
bc_free_num (&power);
|
||||
bc_free_num (&exponent);
|
||||
bc_free_num (result);
|
||||
bc_free_num (&parity);
|
||||
*result = temp;
|
||||
return 0; /* Everything is OK. */
|
||||
}
|
||||
+42
-19
@@ -163,26 +163,14 @@ PHP_MINFO_FUNCTION(calendar)
|
||||
php_info_print_table_end();
|
||||
}
|
||||
|
||||
/* {{{ proto array cal_info(int calendar)
|
||||
Returns information about a particular calendar */
|
||||
PHP_FUNCTION(cal_info)
|
||||
static void _php_cal_info(int cal, zval **ret)
|
||||
{
|
||||
long cal;
|
||||
zval *months, *smonths;
|
||||
int i;
|
||||
struct cal_entry_t *calendar;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &cal) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (cal < 0 || cal >= CAL_NUM_CALS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld.", cal);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
calendar = &cal_conversion_table[cal];
|
||||
array_init(return_value);
|
||||
array_init(*ret);
|
||||
|
||||
MAKE_STD_ZVAL(months);
|
||||
MAKE_STD_ZVAL(smonths);
|
||||
@@ -193,11 +181,46 @@ PHP_FUNCTION(cal_info)
|
||||
add_index_string(months, i, calendar->month_name_long[i], 1);
|
||||
add_index_string(smonths, i, calendar->month_name_short[i], 1);
|
||||
}
|
||||
add_assoc_zval(return_value, "months", months);
|
||||
add_assoc_zval(return_value, "abbrevmonths", smonths);
|
||||
add_assoc_long(return_value, "maxdaysinmonth", calendar->max_days_in_month);
|
||||
add_assoc_string(return_value, "calname", calendar->name, 1);
|
||||
add_assoc_string(return_value, "calsymbol", calendar->symbol, 1);
|
||||
add_assoc_zval(*ret, "months", months);
|
||||
add_assoc_zval(*ret, "abbrevmonths", smonths);
|
||||
add_assoc_long(*ret, "maxdaysinmonth", calendar->max_days_in_month);
|
||||
add_assoc_string(*ret, "calname", calendar->name, 1);
|
||||
add_assoc_string(*ret, "calsymbol", calendar->symbol, 1);
|
||||
|
||||
}
|
||||
|
||||
/* {{{ proto array cal_info(int calendar)
|
||||
Returns information about a particular calendar */
|
||||
PHP_FUNCTION(cal_info)
|
||||
{
|
||||
long cal = -1;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &cal) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (cal == -1) {
|
||||
int i;
|
||||
zval *val;
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
for (i = 0; i < CAL_NUM_CALS; i++) {
|
||||
MAKE_STD_ZVAL(val);
|
||||
_php_cal_info(i, &val);
|
||||
add_index_zval(return_value, i, val);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (cal != -1 && (cal < 0 || cal >= CAL_NUM_CALS)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld.", cal);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
_php_cal_info(cal, &return_value);
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+173
-67
@@ -32,53 +32,139 @@
|
||||
# include "Zend/zend_exceptions.h"
|
||||
# include <mscoree.h>
|
||||
|
||||
/* Since there is no official public mscorlib.h header file, and since
|
||||
* generating your own version from the elusive binary .tlb file takes a lot of
|
||||
* hacking and results in a 3MB header file (!), we opt for this slightly
|
||||
* voodoo approach. The following is just enough definition to be able to
|
||||
* reach the _AppDomain::CreateInstance method that we need to use to be able
|
||||
* to fire up .Net objects. We used to use IDispatch for this, but it would
|
||||
* not always work.
|
||||
*
|
||||
* The following info was obtained using OleView to export the IDL from
|
||||
* mscorlib.tlb. Note that OleView is unable to generate C headers for this
|
||||
* particular tlb... hence this mess.
|
||||
*/
|
||||
|
||||
const GUID IID_mscorlib_System_AppDomain = {
|
||||
0x05F696DC, 0x2B29, 0x3663, {0xAD, 0x8B, 0xC4, 0x38, 0x9C, 0xF2, 0xA7, 0x13 }};
|
||||
|
||||
typedef struct _Imscorlib_System_AppDomain IAppDomain;
|
||||
|
||||
struct _Imscorlib_System_AppDomainVtbl {
|
||||
BEGIN_INTERFACE
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
IAppDomain * This,
|
||||
/* [in] */ REFIID riid,
|
||||
/* [iid_is][out] */ void **ppvObject);
|
||||
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
IAppDomain * This);
|
||||
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
IAppDomain * This);
|
||||
|
||||
/* this is padding to get CreateInstance into the correct position */
|
||||
#define DUMMY_METHOD(x) HRESULT ( STDMETHODCALLTYPE *dummy_##x )(IAppDomain *This)
|
||||
|
||||
DUMMY_METHOD(GetTypeInfoCount);
|
||||
DUMMY_METHOD(GetTypeInfo);
|
||||
DUMMY_METHOD(GetIDsOfNames);
|
||||
DUMMY_METHOD(Invoke);
|
||||
DUMMY_METHOD(ToString);
|
||||
DUMMY_METHOD(Equals);
|
||||
DUMMY_METHOD(GetHashCode);
|
||||
DUMMY_METHOD(GetType);
|
||||
DUMMY_METHOD(InitializeLifetimeService);
|
||||
DUMMY_METHOD(GetLifetimeService);
|
||||
DUMMY_METHOD(Evidence);
|
||||
DUMMY_METHOD(add_DomainUnload);
|
||||
DUMMY_METHOD(remove_DomainUnload);
|
||||
DUMMY_METHOD(add_AssemblyLoad);
|
||||
DUMMY_METHOD(remove_AssemblyLoad);
|
||||
DUMMY_METHOD(add_ProcessExit);
|
||||
DUMMY_METHOD(remove_ProcessExit);
|
||||
DUMMY_METHOD(add_TypeResolve);
|
||||
DUMMY_METHOD(remove_TypeResolve);
|
||||
DUMMY_METHOD(add_ResourceResolve);
|
||||
DUMMY_METHOD(remove_ResourceResolve);
|
||||
DUMMY_METHOD(add_AssemblyResolve);
|
||||
DUMMY_METHOD(remove_AssemblyResolve);
|
||||
DUMMY_METHOD(add_UnhandledException);
|
||||
DUMMY_METHOD(remove_UnhandledException);
|
||||
DUMMY_METHOD(DefineDynamicAssembly);
|
||||
DUMMY_METHOD(DefineDynamicAssembly_2);
|
||||
DUMMY_METHOD(DefineDynamicAssembly_3);
|
||||
DUMMY_METHOD(DefineDynamicAssembly_4);
|
||||
DUMMY_METHOD(DefineDynamicAssembly_5);
|
||||
DUMMY_METHOD(DefineDynamicAssembly_6);
|
||||
DUMMY_METHOD(DefineDynamicAssembly_7);
|
||||
DUMMY_METHOD(DefineDynamicAssembly_8);
|
||||
DUMMY_METHOD(DefineDynamicAssembly_9);
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE *CreateInstance )(IAppDomain * This, BSTR AssemblyName, BSTR typeName, IUnknown **pRetVal);
|
||||
HRESULT ( STDMETHODCALLTYPE *CreateInstanceFrom )(IAppDomain * This, BSTR AssemblyFile, BSTR typeName, IUnknown **pRetVal);
|
||||
|
||||
/* more methods live here */
|
||||
|
||||
END_INTERFACE
|
||||
};
|
||||
|
||||
struct _Imscorlib_System_AppDomain {
|
||||
struct _Imscorlib_System_AppDomainVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
struct dotnet_runtime_stuff {
|
||||
ICorRuntimeHost *dotnet_host;
|
||||
IDispatch *dotnet_domain;
|
||||
IAppDomain *dotnet_domain;
|
||||
DISPID create_instance;
|
||||
};
|
||||
|
||||
/* Since there is no official public mscorlib.h header file, and since
|
||||
* generating your own version from the binary .tlb file results in a 3MB
|
||||
* header file (!), we opt for the Dispatch-able approach. This is slightly
|
||||
* slower for creating new objects, but not too bad */
|
||||
static int dotnet_init(TSRMLS_D)
|
||||
static HRESULT dotnet_init(char **p_where TSRMLS_DC)
|
||||
{
|
||||
HRESULT hr;
|
||||
struct dotnet_runtime_stuff *stuff;
|
||||
IUnknown *unk = NULL;
|
||||
OLECHAR *olename;
|
||||
OLECHAR *olename, *oletmp;
|
||||
char *where = "";
|
||||
|
||||
stuff = malloc(sizeof(*stuff));
|
||||
memset(stuff, 0, sizeof(*stuff));
|
||||
|
||||
if (SUCCEEDED(CoCreateInstance(&CLSID_CorRuntimeHost, NULL, CLSCTX_ALL,
|
||||
&IID_ICorRuntimeHost, (LPVOID*)&stuff->dotnet_host))) {
|
||||
where = "CoCreateInstance";
|
||||
hr = CoCreateInstance(&CLSID_CorRuntimeHost, NULL, CLSCTX_ALL,
|
||||
&IID_ICorRuntimeHost, (LPVOID*)&stuff->dotnet_host);
|
||||
|
||||
/* fire up the host and get the domain object */
|
||||
if (SUCCEEDED(ICorRuntimeHost_Start(stuff->dotnet_host)) &&
|
||||
SUCCEEDED(ICorRuntimeHost_GetDefaultDomain(stuff->dotnet_host, &unk)) &&
|
||||
SUCCEEDED(IUnknown_QueryInterface(unk, &IID_IDispatch, (LPVOID*)&stuff->dotnet_domain))) {
|
||||
if (FAILED(hr))
|
||||
goto out;
|
||||
|
||||
/* locate the create-instance member */
|
||||
olename = php_com_string_to_olestring("CreateInstance", sizeof("CreateInstance")-1, CP_ACP TSRMLS_CC);
|
||||
hr = IDispatch_GetIDsOfNames(stuff->dotnet_domain, &IID_NULL, &olename, 1, LOCALE_SYSTEM_DEFAULT, &stuff->create_instance);
|
||||
efree(olename);
|
||||
/* fire up the host and get the domain object */
|
||||
where = "ICorRuntimeHost_Start\n";
|
||||
hr = ICorRuntimeHost_Start(stuff->dotnet_host);
|
||||
if (FAILED(hr))
|
||||
goto out;
|
||||
|
||||
where = "ICorRuntimeHost_GetDefaultDomain";
|
||||
hr = ICorRuntimeHost_GetDefaultDomain(stuff->dotnet_host, &unk);
|
||||
if (FAILED(hr))
|
||||
goto out;
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
COMG(dotnet_runtime_stuff) = stuff;
|
||||
}
|
||||
}
|
||||
where = "QI: System._AppDomain";
|
||||
hr = IUnknown_QueryInterface(unk, &IID_mscorlib_System_AppDomain, (LPVOID*)&stuff->dotnet_domain);
|
||||
if (FAILED(hr))
|
||||
goto out;
|
||||
|
||||
COMG(dotnet_runtime_stuff) = stuff;
|
||||
|
||||
if (unk) {
|
||||
IUnknown_Release(unk);
|
||||
}
|
||||
out:
|
||||
if (unk) {
|
||||
IUnknown_Release(unk);
|
||||
}
|
||||
|
||||
if (COMG(dotnet_runtime_stuff) == NULL) {
|
||||
/* clean up */
|
||||
if (stuff->dotnet_domain) {
|
||||
IDispatch_Release(stuff->dotnet_domain);
|
||||
IUnknown_Release(stuff->dotnet_domain);
|
||||
}
|
||||
if (stuff->dotnet_host) {
|
||||
ICorRuntimeHost_Stop(stuff->dotnet_host);
|
||||
@@ -86,10 +172,12 @@ static int dotnet_init(TSRMLS_D)
|
||||
}
|
||||
free(stuff);
|
||||
|
||||
return FAILURE;
|
||||
*p_where = where;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* {{{ com_dotnet_create_instance - ctor for DOTNET class */
|
||||
@@ -100,16 +188,21 @@ PHP_FUNCTION(com_dotnet_create_instance)
|
||||
char *assembly_name, *datatype_name;
|
||||
int assembly_name_len, datatype_name_len;
|
||||
struct dotnet_runtime_stuff *stuff;
|
||||
IObjectHandle *handle;
|
||||
DISPPARAMS params;
|
||||
VARIANT vargs[2];
|
||||
VARIANT retval;
|
||||
OLECHAR *olestring, *oleassembly, *oletype;
|
||||
HRESULT hr;
|
||||
int ret = FAILURE;
|
||||
char *where = "";
|
||||
IUnknown *unk = NULL;
|
||||
|
||||
if (COMG(dotnet_runtime_stuff) == NULL) {
|
||||
if (FAILURE == dotnet_init(TSRMLS_C)) {
|
||||
php_com_throw_exception(E_ERROR, "Failed to initialize .Net runtime" TSRMLS_CC);
|
||||
hr = dotnet_init(&where TSRMLS_CC);
|
||||
if (FAILED(hr)) {
|
||||
char buf[1024];
|
||||
char *err = php_win_err(hr);
|
||||
snprintf(buf, sizeof(buf), "Failed to init .Net runtime [%s] %s", where, err);
|
||||
if (err)
|
||||
LocalFree(err);
|
||||
php_com_throw_exception(hr, buf TSRMLS_CC);
|
||||
ZVAL_NULL(object);
|
||||
return;
|
||||
}
|
||||
@@ -128,50 +221,63 @@ PHP_FUNCTION(com_dotnet_create_instance)
|
||||
return;
|
||||
}
|
||||
|
||||
params.cArgs = 2;
|
||||
params.cNamedArgs = 0;
|
||||
params.rgdispidNamedArgs = NULL;
|
||||
params.rgvarg = vargs;
|
||||
|
||||
VariantInit(&vargs[0]);
|
||||
VariantInit(&vargs[1]);
|
||||
VariantInit(&retval);
|
||||
|
||||
V_VT(&vargs[0]) = VT_BSTR;
|
||||
V_BSTR(&vargs[0]) = php_com_string_to_olestring(datatype_name, datatype_name_len, obj->code_page TSRMLS_CC);
|
||||
|
||||
V_VT(&vargs[1]) = VT_BSTR;
|
||||
V_BSTR(&vargs[1]) = php_com_string_to_olestring(assembly_name, assembly_name_len, obj->code_page TSRMLS_CC);
|
||||
|
||||
hr = IDispatch_Invoke(stuff->dotnet_domain, stuff->create_instance, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
|
||||
DISPATCH_METHOD, ¶ms, &retval, NULL, NULL);
|
||||
oletype = php_com_string_to_olestring(datatype_name, datatype_name_len, obj->code_page TSRMLS_CC);
|
||||
oleassembly = php_com_string_to_olestring(assembly_name, assembly_name_len, obj->code_page TSRMLS_CC);
|
||||
where = "CreateInstance";
|
||||
hr = stuff->dotnet_domain->lpVtbl->CreateInstance(stuff->dotnet_domain, oleassembly, oletype, &unk);
|
||||
efree(oletype);
|
||||
efree(oleassembly);
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
/* retval should now be an IUnknown/IDispatch representation of an IObjectHandle interface */
|
||||
if ((V_VT(&retval) == VT_UNKNOWN || V_VT(&retval) == VT_DISPATCH) &&
|
||||
SUCCEEDED(IUnknown_QueryInterface(V_UNKNOWN(&retval), &IID_IObjectHandle, &handle))) {
|
||||
VARIANT unwrapped;
|
||||
VARIANT unwrapped;
|
||||
IObjectHandle *handle = NULL;
|
||||
|
||||
if (SUCCEEDED(IObjectHandle_Unwrap(handle, &unwrapped))) {
|
||||
/* unwrapped is now the dispatch pointer we want */
|
||||
V_DISPATCH(&obj->v) = V_DISPATCH(&unwrapped);
|
||||
V_VT(&obj->v) = VT_DISPATCH;
|
||||
where = "QI: IObjectHandle";
|
||||
hr = IUnknown_QueryInterface(unk, &IID_IObjectHandle, &handle);
|
||||
|
||||
/* get its type-info */
|
||||
IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &obj->typeinfo);
|
||||
if (SUCCEEDED(hr)) {
|
||||
where = "IObjectHandle_Unwrap";
|
||||
hr = IObjectHandle_Unwrap(handle, &unwrapped);
|
||||
if (SUCCEEDED(hr)) {
|
||||
|
||||
ret = SUCCESS;
|
||||
if (V_VT(&unwrapped) == VT_UNKNOWN) {
|
||||
where = "Unwrapped, QI for IDispatch";
|
||||
hr = IUnknown_QueryInterface(V_UNKNOWN(&unwrapped), &IID_IDispatch, &V_DISPATCH(&obj->v));
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
V_VT(&obj->v) = VT_DISPATCH;
|
||||
|
||||
/* get its type-info */
|
||||
IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &obj->typeinfo);
|
||||
ret = SUCCESS;
|
||||
}
|
||||
} else if (V_VT(&unwrapped) == VT_DISPATCH) {
|
||||
/* unwrapped is now the dispatch pointer we want */
|
||||
V_DISPATCH(&obj->v) = V_DISPATCH(&unwrapped);
|
||||
V_VT(&obj->v) = VT_DISPATCH;
|
||||
|
||||
/* get its type-info */
|
||||
IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &obj->typeinfo);
|
||||
|
||||
ret = SUCCESS;
|
||||
} else {
|
||||
/* shouldn't happen, but let's be ready for it */
|
||||
VariantClear(&unwrapped);
|
||||
hr = E_INVALIDARG;
|
||||
}
|
||||
}
|
||||
IObjectHandle_Release(handle);
|
||||
}
|
||||
VariantClear(&retval);
|
||||
IUnknown_Release(unk);
|
||||
}
|
||||
|
||||
VariantClear(&vargs[0]);
|
||||
VariantClear(&vargs[1]);
|
||||
|
||||
if (ret == FAILURE) {
|
||||
php_com_throw_exception(hr, "Failed to instantiate .Net object" TSRMLS_CC);
|
||||
char buf[1024];
|
||||
char *err = php_win_err(hr);
|
||||
snprintf(buf, sizeof(buf), "Failed to instantiate .Net object [%s] [0x%08x] %s", where, hr, err);
|
||||
if (err)
|
||||
LocalFree(err);
|
||||
php_com_throw_exception(hr, buf TSRMLS_CC);
|
||||
ZVAL_NULL(object);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ PHP_MINIT_FUNCTION(com_dotnet)
|
||||
INIT_CLASS_ENTRY(ce, "com_exception", NULL);
|
||||
php_com_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(), NULL TSRMLS_CC);
|
||||
php_com_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
|
||||
php_com_exception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED;
|
||||
// php_com_exception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED;
|
||||
|
||||
INIT_CLASS_ENTRY(ce, "com_safearray_proxy", NULL);
|
||||
php_com_saproxy_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
|
||||
|
||||
@@ -286,11 +286,19 @@ static void function_dtor(void *pDest)
|
||||
}
|
||||
}
|
||||
|
||||
static PHP_FUNCTION(com_method_handler)
|
||||
{
|
||||
Z_OBJ_HANDLER_P(getThis(), call_method)(
|
||||
((zend_internal_function*)EG(function_state_ptr)->function)->function_name,
|
||||
INTERNAL_FUNCTION_PARAM_PASSTHRU);
|
||||
}
|
||||
|
||||
static union _zend_function *com_method_get(zval *object, char *name, int len TSRMLS_DC)
|
||||
{
|
||||
zend_internal_function f, *fptr = NULL;
|
||||
php_com_dotnet_object *obj;
|
||||
union _zend_function *func;
|
||||
DISPID dummy;
|
||||
|
||||
obj = CDNO_FETCH(object);
|
||||
|
||||
@@ -298,6 +306,10 @@ static union _zend_function *com_method_get(zval *object, char *name, int len TS
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (FAILED(php_com_get_id_of_name(obj, name, len, &dummy TSRMLS_CC))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* check cache */
|
||||
if (obj->method_cache == NULL || FAILURE == zend_hash_find(obj->method_cache, name, len, (void**)&fptr)) {
|
||||
f.type = ZEND_OVERLOADED_FUNCTION;
|
||||
@@ -306,7 +318,10 @@ static union _zend_function *com_method_get(zval *object, char *name, int len TS
|
||||
f.scope = obj->ce;
|
||||
f.fn_flags = 0;
|
||||
f.function_name = estrndup(name, len);
|
||||
f.handler = PHP_FN(com_method_handler);
|
||||
|
||||
fptr = &f;
|
||||
|
||||
if (obj->typeinfo) {
|
||||
/* look for byref params */
|
||||
ITypeComp *comp;
|
||||
@@ -346,6 +361,9 @@ static union _zend_function *com_method_get(zval *object, char *name, int len TS
|
||||
case DESCKIND_TYPECOMP:
|
||||
ITypeComp_Release(bindptr.lptcomp);
|
||||
break;
|
||||
|
||||
case DESCKIND_NONE:
|
||||
break;
|
||||
}
|
||||
if (TI) {
|
||||
ITypeInfo_Release(TI);
|
||||
@@ -356,21 +374,27 @@ static union _zend_function *com_method_get(zval *object, char *name, int len TS
|
||||
}
|
||||
}
|
||||
|
||||
/* save this method in the cache */
|
||||
if (!obj->method_cache) {
|
||||
ALLOC_HASHTABLE(obj->method_cache);
|
||||
zend_hash_init(obj->method_cache, 2, NULL, function_dtor, 0);
|
||||
}
|
||||
if (fptr) {
|
||||
/* save this method in the cache */
|
||||
if (!obj->method_cache) {
|
||||
ALLOC_HASHTABLE(obj->method_cache);
|
||||
zend_hash_init(obj->method_cache, 2, NULL, function_dtor, 0);
|
||||
}
|
||||
|
||||
zend_hash_update(obj->method_cache, name, len, &f, sizeof(f), (void**)&fptr);
|
||||
zend_hash_update(obj->method_cache, name, len, &f, sizeof(f), (void**)&fptr);
|
||||
}
|
||||
}
|
||||
|
||||
/* duplicate this into a new chunk of emalloc'd memory,
|
||||
* since the engine will efree it */
|
||||
func = emalloc(sizeof(*fptr));
|
||||
memcpy(func, fptr, sizeof(*fptr));
|
||||
if (fptr) {
|
||||
/* duplicate this into a new chunk of emalloc'd memory,
|
||||
* since the engine will efree it */
|
||||
func = emalloc(sizeof(*fptr));
|
||||
memcpy(func, fptr, sizeof(*fptr));
|
||||
|
||||
return func;
|
||||
return func;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int com_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
|
||||
|
||||
@@ -227,34 +227,35 @@ void php_com_typelibrary_dtor(void *pDest)
|
||||
PHPAPI ITypeLib *php_com_load_typelib_via_cache(char *search_string,
|
||||
int codepage, int *cached TSRMLS_DC)
|
||||
{
|
||||
ITypeLib **TL;
|
||||
ITypeLib **TLp;
|
||||
ITypeLib *TL;
|
||||
char *name_dup;
|
||||
int l;
|
||||
|
||||
l = strlen(search_string);
|
||||
|
||||
if (zend_ts_hash_find(&php_com_typelibraries, search_string, l+1,
|
||||
(void**)&TL) == SUCCESS) {
|
||||
(void**)&TLp) == SUCCESS) {
|
||||
*cached = 1;
|
||||
/* add a reference for the caller */
|
||||
ITypeLib_AddRef(*TL);
|
||||
return *TL;
|
||||
ITypeLib_AddRef(*TLp);
|
||||
return *TLp;
|
||||
}
|
||||
|
||||
*cached = 0;
|
||||
name_dup = estrndup(search_string, l);
|
||||
*TL = php_com_load_typelib(name_dup, codepage TSRMLS_CC);
|
||||
TL = php_com_load_typelib(name_dup, codepage TSRMLS_CC);
|
||||
efree(name_dup);
|
||||
|
||||
if (*TL) {
|
||||
if (TL) {
|
||||
if (SUCCESS == zend_ts_hash_update(&php_com_typelibraries,
|
||||
search_string, l+1, (void*)*TL, sizeof(ITypeLib*), NULL)) {
|
||||
search_string, l+1, (void*)TL, sizeof(ITypeLib*), NULL)) {
|
||||
/* add a reference for the hash table */
|
||||
ITypeLib_AddRef(*TL);
|
||||
ITypeLib_AddRef(TL);
|
||||
}
|
||||
}
|
||||
|
||||
return *TL;
|
||||
return TL;
|
||||
}
|
||||
|
||||
ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj, char *dispname, int sink TSRMLS_DC)
|
||||
|
||||
@@ -799,7 +799,8 @@ PHP_FUNCTION(variant_date_from_timestamp)
|
||||
}
|
||||
|
||||
VariantInit(&res);
|
||||
tmv = gmtime(×tamp);
|
||||
tzset();
|
||||
tmv = localtime(×tamp);
|
||||
memset(&systime, 0, sizeof(systime));
|
||||
|
||||
systime.wDay = tmv->tm_mday;
|
||||
|
||||
@@ -296,12 +296,16 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex(
|
||||
} else if (wFlags & DISPATCH_PROPERTYPUT) {
|
||||
zend_update_property(Z_OBJCE_P(disp->object), disp->object, Z_STRVAL_PP(name), Z_STRLEN_PP(name)+1, *params[0] TSRMLS_CC);
|
||||
} else if (wFlags & DISPATCH_METHOD) {
|
||||
if (SUCCESS == call_user_function_ex(EG(function_table), &disp->object, *name,
|
||||
&retval, pdp->cArgs, params, 1, NULL TSRMLS_CC)) {
|
||||
ret = S_OK;
|
||||
} else {
|
||||
zend_try {
|
||||
if (SUCCESS == call_user_function_ex(EG(function_table), &disp->object, *name,
|
||||
&retval, pdp->cArgs, params, 1, NULL TSRMLS_CC)) {
|
||||
ret = S_OK;
|
||||
} else {
|
||||
ret = DISP_E_EXCEPTION;
|
||||
}
|
||||
} zend_catch {
|
||||
ret = DISP_E_EXCEPTION;
|
||||
}
|
||||
} zend_end_try();
|
||||
} else {
|
||||
trace("Don't know how to handle this invocation %08x\n", wFlags);
|
||||
}
|
||||
|
||||
@@ -1286,6 +1286,10 @@ PHP_FUNCTION(cpdf_setdash)
|
||||
convert_to_long_ex(arg2);
|
||||
convert_to_long_ex(arg3);
|
||||
|
||||
if (!pdf->currentMemStream) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
snprintf(buffer, BUFFERLEN, "[%d %d] 0", (int) Z_LVAL_PP(arg2), (int) Z_LVAL_PP(arg3));
|
||||
cpdf_setdash(pdf, buffer);
|
||||
|
||||
|
||||
+7
-1
@@ -97,7 +97,13 @@ PHP_MINFO_FUNCTION(ctype)
|
||||
return; \
|
||||
switch (Z_TYPE_P(c)) { \
|
||||
case IS_LONG: \
|
||||
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
|
||||
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; \
|
||||
|
||||
+31
-10
@@ -220,6 +220,9 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_UNRESTRICTED_AUTH);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FTP_USE_EPRT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_HTTP200ALIASES);
|
||||
REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFMODSINCE);
|
||||
REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFUNMODSINCE);
|
||||
REGISTER_CURL_CONSTANT(CURL_TIMECOND_LASTMOD);
|
||||
|
||||
#if LIBCURL_VERSION_NUM > 0x070a05 /* CURLOPT_HTTPAUTH is available since curl 7.10.6 */
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_HTTPAUTH);
|
||||
@@ -231,7 +234,11 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_ANY);
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_ANYSAFE);
|
||||
#endif
|
||||
|
||||
|
||||
#if LIBCURL_VERSION_NUM > 0x070a06 /* CURLOPT_PROXYAUTH is available since curl 7.10.7 */
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXYAUTH);
|
||||
#endif
|
||||
|
||||
/* Constants effecting the way CURLOPT_CLOSEPOLICY works */
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_TRAFFIC);
|
||||
@@ -424,6 +431,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
PHPWRITE(data, length);
|
||||
break;
|
||||
case PHP_CURL_FILE:
|
||||
fflush(t->fp);
|
||||
return fwrite(data, size, nmemb, t->fp);
|
||||
case PHP_CURL_RETURN:
|
||||
smart_str_appendl(&t->buf, data, (int) length);
|
||||
@@ -794,6 +802,7 @@ PHP_FUNCTION(curl_init)
|
||||
curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20); /* prevent infinite redirects */
|
||||
#if defined(ZTS)
|
||||
curl_easy_setopt(ch->cp, CURLOPT_NOSIGNAL, 1);
|
||||
#endif
|
||||
@@ -912,6 +921,9 @@ PHP_FUNCTION(curl_setopt)
|
||||
case CURLOPT_FTP_USE_EPRT:
|
||||
#if LIBCURL_VERSION_NUM > 0x070a05 /* CURLOPT_HTTPAUTH is available since curl 7.10.6 */
|
||||
case CURLOPT_HTTPAUTH:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM > 0x070a06 /* CURLOPT_PROXYAUTH is available since curl 7.10.7 */
|
||||
case CURLOPT_PROXYAUTH:
|
||||
#endif
|
||||
case CURLOPT_UNRESTRICTED_AUTH:
|
||||
case CURLOPT_PORT:
|
||||
@@ -1326,10 +1338,13 @@ PHP_FUNCTION(curl_getinfo)
|
||||
switch (option) {
|
||||
case CURLINFO_EFFECTIVE_URL:
|
||||
case CURLINFO_CONTENT_TYPE: {
|
||||
char *s_code;
|
||||
char *s_code = NULL;
|
||||
|
||||
curl_easy_getinfo(ch->cp, option, &s_code);
|
||||
RETURN_STRING(s_code, 1);
|
||||
if (curl_easy_getinfo(ch->cp, option, &s_code) == CURLE_OK && s_code) {
|
||||
RETURN_STRING(s_code, 1);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CURLINFO_HTTP_CODE:
|
||||
@@ -1338,10 +1353,13 @@ PHP_FUNCTION(curl_getinfo)
|
||||
case CURLINFO_FILETIME:
|
||||
case CURLINFO_SSL_VERIFYRESULT:
|
||||
case CURLINFO_REDIRECT_COUNT: {
|
||||
long code;
|
||||
long code = 0;
|
||||
|
||||
curl_easy_getinfo(ch->cp, option, &code);
|
||||
RETURN_LONG(code);
|
||||
if (curl_easy_getinfo(ch->cp, option, &code) == CURLE_OK) {
|
||||
RETURN_LONG(code);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CURLINFO_TOTAL_TIME:
|
||||
@@ -1356,10 +1374,13 @@ PHP_FUNCTION(curl_getinfo)
|
||||
case CURLINFO_CONTENT_LENGTH_UPLOAD:
|
||||
case CURLINFO_STARTTRANSFER_TIME:
|
||||
case CURLINFO_REDIRECT_TIME: {
|
||||
double code;
|
||||
double code = 0.0;
|
||||
|
||||
curl_easy_getinfo(ch->cp, option, &code);
|
||||
RETURN_DOUBLE(code);
|
||||
if (curl_easy_getinfo(ch->cp, option, &code) == CURLE_OK) {
|
||||
RETURN_DOUBLE(code);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -299,7 +299,7 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename,
|
||||
curl_easy_setopt(curlstream->curl, CURLOPT_PROGRESSDATA, stream);
|
||||
curl_easy_setopt(curlstream->curl, CURLOPT_NOPROGRESS, 0);
|
||||
|
||||
curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, "PHP/" PHP_VERSION);
|
||||
curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, FG(user_agent) ? FG(user_agent) : "PHP/" PHP_VERSION);
|
||||
|
||||
/* TODO: read cookies and options from context */
|
||||
|
||||
|
||||
+5
-2
@@ -11,8 +11,11 @@ AC_DEFUN(PHP_DBA_STD_BEGIN,[
|
||||
AC_DEFUN(PHP_TEMP_LDFLAGS,[
|
||||
old_LDFLAGS=$LDFLAGS
|
||||
LDFLAGS="$1 $LDFLAGS"
|
||||
$2
|
||||
old_LIBS=$LIBS
|
||||
LIBS="$2 $LIBS"
|
||||
$3
|
||||
LDFLAGS=$old_LDFLAGS
|
||||
LIBS=$old_LIBS
|
||||
])
|
||||
|
||||
dnl Assign INCLUDE/LFLAGS from PREFIX
|
||||
@@ -169,7 +172,7 @@ dnl parameters(version, library list, function)
|
||||
AC_DEFUN(PHP_DBA_DB_CHECK,[
|
||||
for LIB in $2; do
|
||||
if test -f $THIS_PREFIX/lib/lib$LIB.a -o -f $THIS_PREFIX/lib/lib$LIB.$SHLIB_SUFFIX_NAME; then
|
||||
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib -l$LIB,[
|
||||
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib, -l$LIB,[
|
||||
AC_TRY_LINK([
|
||||
#include "$THIS_INCLUDE"
|
||||
],[
|
||||
|
||||
@@ -14,7 +14,7 @@ magic_quotes_runtime=1
|
||||
require_once('test.inc');
|
||||
echo "database handler: $handler\n";
|
||||
// print md5 checksum of test.cdb which is generated by cdb_make program
|
||||
var_dump(md5(implode('',file(dirname(__FILE__).'/test.cdb'))));
|
||||
var_dump(md5_file(dirname(__FILE__).'/test.cdb'));
|
||||
if (($db_make=dba_open($db_file, "n", $handler))!==FALSE) {
|
||||
dba_insert("1", "1", $db_make);
|
||||
dba_insert("2", "2", $db_make);
|
||||
@@ -26,7 +26,7 @@ magic_quotes_runtime=1
|
||||
// dba_replace cdb_make doesn't know replace
|
||||
dba_close($db_make);
|
||||
// write md5 checksum of generated database file
|
||||
var_dump(md5(implode('',file($db_file))));
|
||||
var_dump(md5_file($db_file));
|
||||
// no need to test created database: this is done by dba_cdb_read.phpt
|
||||
} else {
|
||||
echo "Error creating database\n";
|
||||
@@ -34,5 +34,5 @@ magic_quotes_runtime=1
|
||||
?>
|
||||
--EXPECT--
|
||||
database handler: cdb_make
|
||||
string(32) "723d19f39c1b15b3b455dd64323148d1"
|
||||
string(32) "723d19f39c1b15b3b455dd64323148d1"
|
||||
string(32) "12fc5ba2b9dcfef2480e5324eeb5f3e5"
|
||||
string(32) "12fc5ba2b9dcfef2480e5324eeb5f3e5"
|
||||
+26
-6
@@ -88,8 +88,10 @@ ZEND_GET_MODULE(dio)
|
||||
static void _dio_close_fd(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
php_fd_t *f = (php_fd_t *) rsrc->ptr;
|
||||
close(f->fd);
|
||||
free(f);
|
||||
if (f) {
|
||||
close(f->fd);
|
||||
free(f);
|
||||
}
|
||||
}
|
||||
|
||||
#define RDIOC(c) REGISTER_LONG_CONSTANT(#c, c, CONST_CS | CONST_PERSISTENT)
|
||||
@@ -158,10 +160,13 @@ PHP_MINFO_FUNCTION(dio)
|
||||
php_info_print_table_end();
|
||||
}
|
||||
|
||||
static void new_php_fd(php_fd_t **f, int fd)
|
||||
static int new_php_fd(php_fd_t **f, int fd)
|
||||
{
|
||||
*f = malloc(sizeof(php_fd_t));
|
||||
if (!(*f = malloc(sizeof(php_fd_t)))) {
|
||||
return 0;
|
||||
}
|
||||
(*f)->fd = fd;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* {{{ proto resource dio_open(string filename, int flags[, int mode])
|
||||
@@ -194,7 +199,10 @@ PHP_FUNCTION(dio_open)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
new_php_fd(&f, fd);
|
||||
|
||||
if (!new_php_fd(&f, fd)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, f, le_fd);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -215,6 +223,11 @@ PHP_FUNCTION(dio_read)
|
||||
|
||||
ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
|
||||
|
||||
if (bytes <= 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0.");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
data = emalloc(bytes + 1);
|
||||
res = read(f->fd, data, bytes);
|
||||
if (res <= 0) {
|
||||
@@ -244,6 +257,11 @@ PHP_FUNCTION(dio_write)
|
||||
return;
|
||||
}
|
||||
|
||||
if (trunc_len < 0 || trunc_len > data_len) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater or equal to zero and less then the length of the specified string.");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
|
||||
|
||||
res = write(f->fd, data, trunc_len ? trunc_len : data_len);
|
||||
@@ -426,7 +444,9 @@ PHP_FUNCTION(dio_fcntl)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
new_php_fd(&new_f, fcntl(f->fd, cmd, Z_LVAL_P(arg)));
|
||||
if (!new_php_fd(&new_f, fcntl(f->fd, cmd, Z_LVAL_P(arg)))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, new_f, le_fd);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
this module is experimental,
|
||||
its functions may change their names
|
||||
or move to extension all together
|
||||
so do not rely to much on them
|
||||
you have been warned!
|
||||
+5
-5
@@ -88,7 +88,7 @@ PHP_METHOD(domattr, __construct)
|
||||
/* }}} end DOMAttr::__construct */
|
||||
|
||||
|
||||
/* {{{ proto name string
|
||||
/* {{{ name string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-1112119403
|
||||
Since:
|
||||
@@ -114,7 +114,7 @@ int dom_attr_name_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto specified boolean
|
||||
/* {{{ specified boolean
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-862529273
|
||||
Since:
|
||||
@@ -131,7 +131,7 @@ int dom_attr_specified_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto value string
|
||||
/* {{{ value string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-221662474
|
||||
Since:
|
||||
@@ -200,7 +200,7 @@ int dom_attr_value_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto ownerElement DOMElement
|
||||
/* {{{ ownerElement DOMElement
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Attr-ownerElement
|
||||
Since: DOM Level 2
|
||||
@@ -236,7 +236,7 @@ int dom_attr_owner_element_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto schemaTypeInfo DOMTypeInfo
|
||||
/* {{{ schemaTypeInfo DOMTypeInfo
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Attr-schemaTypeInfo
|
||||
Since: DOM Level 3
|
||||
|
||||
@@ -44,7 +44,7 @@ zend_function_entry php_dom_characterdata_class_functions[] = {
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/* {{{ proto data string
|
||||
/* {{{ data string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-72AB8359
|
||||
Since:
|
||||
@@ -105,7 +105,7 @@ int dom_characterdata_data_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto length long
|
||||
/* {{{ length long
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-7D61178C
|
||||
Since:
|
||||
@@ -140,7 +140,7 @@ int dom_characterdata_length_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto string dom_characterdata_substring_data(long offset, long count);
|
||||
/* {{{ proto string dom_characterdata_substring_data(int offset, int count);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6531BCCF
|
||||
Since:
|
||||
*/
|
||||
@@ -215,7 +215,7 @@ PHP_FUNCTION(dom_characterdata_append_data)
|
||||
/* }}} end dom_characterdata_append_data */
|
||||
|
||||
|
||||
/* {{{ proto void dom_characterdata_insert_data(long offset, string arg);
|
||||
/* {{{ proto void dom_characterdata_insert_data(int offset, string arg);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3EDB695F
|
||||
Since:
|
||||
*/
|
||||
@@ -264,7 +264,7 @@ PHP_FUNCTION(dom_characterdata_insert_data)
|
||||
/* }}} end dom_characterdata_insert_data */
|
||||
|
||||
|
||||
/* {{{ proto void dom_characterdata_delete_data(long offset, long count);
|
||||
/* {{{ proto void dom_characterdata_delete_data(int offset, int count);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-7C603781
|
||||
Since:
|
||||
*/
|
||||
@@ -320,7 +320,7 @@ PHP_FUNCTION(dom_characterdata_delete_data)
|
||||
/* }}} end dom_characterdata_delete_data */
|
||||
|
||||
|
||||
/* {{{ proto void dom_characterdata_replace_data(long offset, long count, string arg);
|
||||
/* {{{ proto void dom_characterdata_replace_data(int offset, int count, string arg);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-E5CBA7FB
|
||||
Since:
|
||||
*/
|
||||
|
||||
+28
-28
@@ -88,7 +88,7 @@ zend_function_entry php_dom_document_class_functions[] = {
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/* {{{ proto docType DOMDocumentType
|
||||
/* {{{ docType DOMDocumentType
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-B63ED1A31
|
||||
Since:
|
||||
@@ -124,7 +124,7 @@ int dom_document_doctype_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto implementation DOMImplementation
|
||||
/* {{{ implementation DOMImplementation
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1B793EBA
|
||||
Since:
|
||||
@@ -140,7 +140,7 @@ int dom_document_implementation_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto documentElement DOMElement
|
||||
/* {{{ documentElement DOMElement
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-87CD092
|
||||
Since:
|
||||
@@ -174,7 +174,7 @@ int dom_document_document_element_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto actualEncoding string
|
||||
/* {{{ actualEncoding string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-actualEncoding
|
||||
Since: DOM Level 3
|
||||
@@ -195,7 +195,7 @@ int dom_document_actual_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto encoding string
|
||||
/* {{{ encoding string
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-encoding
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -268,7 +268,7 @@ int dom_document_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto standalone boolean
|
||||
/* {{{ standalone boolean
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-standalone
|
||||
Since: DOM Level 3
|
||||
@@ -334,7 +334,7 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto version string
|
||||
/* {{{ version string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-version
|
||||
Since: DOM Level 3
|
||||
@@ -399,7 +399,7 @@ int dom_document_version_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto strictErrorChecking boolean
|
||||
/* {{{ strictErrorChecking boolean
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-strictErrorChecking
|
||||
Since: DOM Level 3
|
||||
@@ -444,7 +444,7 @@ int dom_document_strict_error_checking_write(dom_object *obj, zval *newval TSRML
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto formatOutput boolean
|
||||
/* {{{ formatOutput boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_format_output_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -486,7 +486,7 @@ int dom_document_format_output_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto validateOnParse boolean
|
||||
/* {{{ validateOnParse boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_validate_on_parse_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -529,7 +529,7 @@ int dom_document_validate_on_parse_write(dom_object *obj, zval *newval TSRMLS_DC
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto resolveExternals boolean
|
||||
/* {{{ resolveExternals boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_resolve_externals_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -572,7 +572,7 @@ int dom_document_resolve_externals_write(dom_object *obj, zval *newval TSRMLS_DC
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto preserveWhiteSpace boolean
|
||||
/* {{{ preserveWhiteSpace boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_preserve_whitespace_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -615,7 +615,7 @@ int dom_document_preserve_whitespace_write(dom_object *obj, zval *newval TSRMLS_
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto substituteEntities boolean
|
||||
/* {{{ substituteEntities boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_substitue_entities_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -658,7 +658,7 @@ int dom_document_substitue_entities_write(dom_object *obj, zval *newval TSRMLS_D
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto documentURI string
|
||||
/* {{{ documentURI string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-documentURI
|
||||
Since: DOM Level 3
|
||||
@@ -724,7 +724,7 @@ int dom_document_document_uri_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto config DOMConfiguration
|
||||
/* {{{ config DOMConfiguration
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-config
|
||||
Since: DOM Level 3
|
||||
@@ -1016,7 +1016,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name)
|
||||
php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC);
|
||||
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
||||
local = xmlCharStrndup(name, name_len);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, NULL);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, NULL TSRMLS_CC);
|
||||
}
|
||||
/* }}} end dom_document_get_elements_by_tag_name */
|
||||
|
||||
@@ -1063,7 +1063,7 @@ PHP_FUNCTION(dom_document_import_node)
|
||||
/* }}} end dom_document_import_node */
|
||||
|
||||
|
||||
/* {{{ proto DOMElement dom_document_create_element_ns(string namespaceURI, string qualifiedName);
|
||||
/* {{{ proto DOMElement dom_document_create_element_ns(string namespaceURI, string qualifiedName [,string value]);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrElNS
|
||||
Since: DOM Level 2
|
||||
*/
|
||||
@@ -1073,13 +1073,13 @@ PHP_FUNCTION(dom_document_create_element_ns)
|
||||
xmlDocPtr docp;
|
||||
xmlNodePtr nodep = NULL;
|
||||
xmlNsPtr nsptr = NULL;
|
||||
int ret, uri_len = 0, name_len = 0;
|
||||
char *uri, *name;
|
||||
int ret, uri_len = 0, name_len = 0, value_len = 0;
|
||||
char *uri, *name, *value = NULL;
|
||||
char *localname = NULL, *prefix = NULL;
|
||||
int errorcode;
|
||||
dom_object *intern;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s|s", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1089,7 +1089,7 @@ PHP_FUNCTION(dom_document_create_element_ns)
|
||||
|
||||
if (errorcode == 0) {
|
||||
if (xmlValidateName((xmlChar *) localname, 0) == 0) {
|
||||
nodep = xmlNewDocNode (docp, NULL, localname, NULL);
|
||||
nodep = xmlNewDocNode (docp, NULL, localname, value);
|
||||
if (nodep != NULL && uri != NULL) {
|
||||
nsptr = xmlSearchNsByHref (nodep->doc, nodep, uri);
|
||||
if (nsptr == NULL) {
|
||||
@@ -1216,7 +1216,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name_ns)
|
||||
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
||||
local = xmlCharStrndup(name, name_len);
|
||||
nsuri = xmlCharStrndup(uri, uri_len);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri TSRMLS_CC);
|
||||
}
|
||||
/* }}} end dom_document_get_elements_by_tag_name_ns */
|
||||
|
||||
@@ -1544,7 +1544,7 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) {
|
||||
}
|
||||
/* }}} end dom_parser_document */
|
||||
|
||||
/* {{{ proto boolean|DOMNode dom_document_load(string source);
|
||||
/* {{{ proto DOMNode dom_document_load(string source);
|
||||
URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-load
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -1554,7 +1554,7 @@ PHP_METHOD(domdocument, load)
|
||||
}
|
||||
/* }}} end dom_document_load */
|
||||
|
||||
/* {{{ proto boolean|DOMNode dom_document_loadxml(string source);
|
||||
/* {{{ proto DOMNode dom_document_loadxml(string source);
|
||||
URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-loadXML
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -1564,7 +1564,7 @@ PHP_METHOD(domdocument, loadXML)
|
||||
}
|
||||
/* }}} end dom_document_loadxml */
|
||||
|
||||
/* {{{ proto long dom_document_save(string file);
|
||||
/* {{{ proto int dom_document_save(string file);
|
||||
Convenience method to save to file
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_save)
|
||||
@@ -2022,7 +2022,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||
}
|
||||
}
|
||||
|
||||
/* {{{ proto boolean|DOMNode dom_document_load_html_file(string source);
|
||||
/* {{{ proto DOMNode dom_document_load_html_file(string source);
|
||||
Since: DOM extended
|
||||
*/
|
||||
PHP_METHOD(domdocument, loadHTMLFile)
|
||||
@@ -2031,7 +2031,7 @@ PHP_METHOD(domdocument, loadHTMLFile)
|
||||
}
|
||||
/* }}} end dom_document_load_html_file */
|
||||
|
||||
/* {{{ proto boolean|DOMNode dom_document_load_html(string source);
|
||||
/* {{{ proto DOMNode dom_document_load_html(string source);
|
||||
Since: DOM extended
|
||||
*/
|
||||
PHP_METHOD(domdocument, loadHTML)
|
||||
@@ -2040,7 +2040,7 @@ PHP_METHOD(domdocument, loadHTML)
|
||||
}
|
||||
/* }}} end dom_document_load_html */
|
||||
|
||||
/* {{{ proto long dom_document_save_html_file(string file);
|
||||
/* {{{ proto int dom_document_save_html_file(string file);
|
||||
Convenience method to save to file as html
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_save_html_file)
|
||||
|
||||
@@ -38,7 +38,7 @@ zend_function_entry php_dom_documenttype_class_functions[] = {
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/* {{{ proto name string
|
||||
/* {{{ name string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1844763134
|
||||
Since:
|
||||
@@ -64,7 +64,7 @@ int dom_documenttype_name_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto entities DOMNamedNodeMap
|
||||
/* {{{ entities DOMNamedNodeMap
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1788794630
|
||||
Since:
|
||||
@@ -88,7 +88,7 @@ int dom_documenttype_entities_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
entityht = (xmlHashTable *) doctypep->entities;
|
||||
|
||||
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
||||
dom_namednode_iter(obj, XML_ENTITY_NODE, intern, entityht, NULL, NULL);
|
||||
dom_namednode_iter(obj, XML_ENTITY_NODE, intern, entityht, NULL, NULL TSRMLS_CC);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ int dom_documenttype_entities_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto notations DOMNamedNodeMap
|
||||
/* {{{ notations DOMNamedNodeMap
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D46829EF
|
||||
Since:
|
||||
@@ -121,7 +121,7 @@ int dom_documenttype_notations_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
notationht = (xmlHashTable *) doctypep->notations;
|
||||
|
||||
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
||||
dom_namednode_iter(obj, XML_NOTATION_NODE, intern, notationht, NULL, NULL);
|
||||
dom_namednode_iter(obj, XML_NOTATION_NODE, intern, notationht, NULL, NULL TSRMLS_CC);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ int dom_documenttype_notations_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto publicId string
|
||||
/* {{{ publicId string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-publicId
|
||||
Since: DOM Level 2
|
||||
@@ -160,7 +160,7 @@ int dom_documenttype_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto systemId string
|
||||
/* {{{ systemId string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-systemId
|
||||
Since: DOM Level 2
|
||||
@@ -189,7 +189,7 @@ int dom_documenttype_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto internalSubset string
|
||||
/* {{{ internalSubset string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-internalSubset
|
||||
Since: DOM Level 2
|
||||
|
||||
+6
-6
@@ -41,7 +41,7 @@ zend_function_entry php_dom_domerror_class_functions[] = {
|
||||
|
||||
/* {{{ attribute protos, not implemented yet */
|
||||
|
||||
/* {{{ proto severity unsigned short
|
||||
/* {{{ severity unsigned short
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-severity
|
||||
Since:
|
||||
@@ -57,7 +57,7 @@ int dom_domerror_severity_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto message string
|
||||
/* {{{ message string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-message
|
||||
Since:
|
||||
@@ -73,7 +73,7 @@ int dom_domerror_message_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto type string
|
||||
/* {{{ type string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-type
|
||||
Since:
|
||||
@@ -89,7 +89,7 @@ int dom_domerror_type_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto relatedException object
|
||||
/* {{{ relatedException object
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-relatedException
|
||||
Since:
|
||||
@@ -105,7 +105,7 @@ int dom_domerror_related_exception_read(dom_object *obj, zval **retval TSRMLS_DC
|
||||
|
||||
|
||||
|
||||
/* {{{ proto relatedData domobject
|
||||
/* {{{ relatedData domobject
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-relatedData
|
||||
Since:
|
||||
@@ -121,7 +121,7 @@ int dom_domerror_related_data_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto location domlocator
|
||||
/* {{{ location domlocator
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-location
|
||||
Since:
|
||||
|
||||
@@ -42,7 +42,7 @@ zend_function_entry php_dom_domimplementationlist_class_functions[] = {
|
||||
|
||||
/* {{{ attribute protos, not implemented yet */
|
||||
|
||||
/* {{{ proto length unsigned long
|
||||
/* {{{ length unsigned long
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationList-length
|
||||
Since:
|
||||
@@ -59,7 +59,7 @@ int dom_domimplementationlist_length_read(dom_object *obj, zval **retval TSRMLS_
|
||||
|
||||
|
||||
|
||||
/* {{{ proto domdomimplementation dom_domimplementationlist_item(unsigned long index);
|
||||
/* {{{ proto domdomimplementation dom_domimplementationlist_item(int index);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationList-item
|
||||
Since:
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,7 @@ zend_function_entry php_dom_domlocator_class_functions[] = {
|
||||
|
||||
/* {{{ attribute protos, not implemented yet */
|
||||
|
||||
/* {{{ proto line_number long
|
||||
/* {{{ line_number long
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-line-number
|
||||
Since:
|
||||
@@ -57,7 +57,7 @@ int dom_domlocator_line_number_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto column_number long
|
||||
/* {{{ column_number long
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-column-number
|
||||
Since:
|
||||
@@ -73,7 +73,7 @@ int dom_domlocator_column_number_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto offset long
|
||||
/* {{{ offset long
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-offset
|
||||
Since:
|
||||
@@ -89,7 +89,7 @@ int dom_domlocator_offset_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto related_node node
|
||||
/* {{{ related_node node
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-node
|
||||
Since:
|
||||
@@ -105,7 +105,7 @@ int dom_domlocator_related_node_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto uri string
|
||||
/* {{{ uri string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-uri
|
||||
Since:
|
||||
|
||||
@@ -42,7 +42,7 @@ zend_function_entry php_dom_domstringlist_class_functions[] = {
|
||||
|
||||
/* {{{ attribute protos, not implemented yet */
|
||||
|
||||
/* {{{ proto length unsigned long
|
||||
/* {{{ length unsigned long
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMStringList-length
|
||||
Since:
|
||||
@@ -59,7 +59,7 @@ int dom_domstringlist_length_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto domstring dom_domstringlist_item(unsigned long index);
|
||||
/* {{{ proto domstring dom_domstringlist_item(int index);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMStringList-item
|
||||
Since:
|
||||
*/
|
||||
|
||||
+4
-4
@@ -137,7 +137,7 @@ PHP_METHOD(domelement, __construct)
|
||||
}
|
||||
/* }}} end DOMElement::__construct */
|
||||
|
||||
/* {{{ proto tagName string
|
||||
/* {{{ tagName string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-104682815
|
||||
Since:
|
||||
@@ -174,7 +174,7 @@ int dom_element_tag_name_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto schemaTypeInfo typeinfo
|
||||
/* {{{ schemaTypeInfo typeinfo
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Element-schemaTypeInfo
|
||||
Since: DOM Level 3
|
||||
@@ -455,7 +455,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name)
|
||||
php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC);
|
||||
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
||||
local = xmlCharStrndup(name, name_len);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, NULL);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, NULL TSRMLS_CC);
|
||||
}
|
||||
/* }}} end dom_element_get_elements_by_tag_name */
|
||||
|
||||
@@ -777,7 +777,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name_ns)
|
||||
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
||||
local = xmlCharStrndup(name, name_len);
|
||||
nsuri = xmlCharStrndup(uri, uri_len);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri TSRMLS_CC);
|
||||
|
||||
}
|
||||
/* }}} end dom_element_get_elements_by_tag_name_ns */
|
||||
|
||||
+6
-6
@@ -39,7 +39,7 @@ zend_function_entry php_dom_entity_class_functions[] = {
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/* {{{ proto publicId string
|
||||
/* {{{ publicId string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-D7303025
|
||||
Since:
|
||||
@@ -69,7 +69,7 @@ int dom_entity_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto systemId string
|
||||
/* {{{ systemId string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-D7C29F3E
|
||||
Since:
|
||||
@@ -99,7 +99,7 @@ int dom_entity_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto notationName string
|
||||
/* {{{ notationName string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-6ABAEB38
|
||||
Since:
|
||||
@@ -132,7 +132,7 @@ int dom_entity_notation_name_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto actualEncoding string
|
||||
/* {{{ actualEncoding string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-actualEncoding
|
||||
Since: DOM Level 3
|
||||
@@ -153,7 +153,7 @@ int dom_entity_actual_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto encoding string
|
||||
/* {{{ encoding string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-encoding
|
||||
Since: DOM Level 3
|
||||
@@ -174,7 +174,7 @@ int dom_entity_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto version string
|
||||
/* {{{ version string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-version
|
||||
Since: DOM Level 3
|
||||
|
||||
@@ -46,7 +46,7 @@ zend_function_entry php_dom_namednodemap_class_functions[] = {
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/* {{{ proto length int
|
||||
/* {{{ length int
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6D0FB19E
|
||||
Since:
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ zend_function_entry php_dom_namelist_class_functions[] = {
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/* {{{ proto length int
|
||||
/* {{{ length int
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-length
|
||||
Since:
|
||||
|
||||
+18
-18
@@ -72,7 +72,7 @@ static void dom_reconcile_ns(xmlDocPtr doc, xmlNodePtr nodep) {
|
||||
}
|
||||
}
|
||||
|
||||
/* {{{ proto nodeName string
|
||||
/* {{{ nodeName string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-F68D095
|
||||
Since:
|
||||
@@ -164,7 +164,7 @@ int dom_node_node_name_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto nodeValue string
|
||||
/* {{{ nodeValue string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-F68D080
|
||||
Since:
|
||||
@@ -260,7 +260,7 @@ int dom_node_node_value_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto nodeType int
|
||||
/* {{{ nodeType int
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-111237558
|
||||
Since:
|
||||
@@ -292,7 +292,7 @@ int dom_node_node_type_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto parentNode DomNode
|
||||
/* {{{ parentNode DomNode
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1060184317
|
||||
Since:
|
||||
@@ -327,7 +327,7 @@ int dom_node_parent_node_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto childNodes DomNodeList
|
||||
/* {{{ childNodes DomNodeList
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1451460987
|
||||
Since:
|
||||
@@ -351,7 +351,7 @@ int dom_node_child_nodes_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
} else {
|
||||
php_dom_create_interator(*retval, DOM_NODELIST TSRMLS_CC);
|
||||
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
||||
dom_namednode_iter(obj, XML_ELEMENT_NODE, intern, NULL, NULL, NULL);
|
||||
dom_namednode_iter(obj, XML_ELEMENT_NODE, intern, NULL, NULL, NULL TSRMLS_CC);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
@@ -361,7 +361,7 @@ int dom_node_child_nodes_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto firstChild DomNode
|
||||
/* {{{ firstChild DomNode
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-169727388
|
||||
Since:
|
||||
@@ -399,7 +399,7 @@ int dom_node_first_child_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto lastChild DomNode
|
||||
/* {{{ lastChild DomNode
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-61AD09FB
|
||||
Since:
|
||||
@@ -437,7 +437,7 @@ int dom_node_last_child_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto previousSibling DomNode
|
||||
/* {{{ previousSibling DomNode
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-640FB3C8
|
||||
Since:
|
||||
@@ -472,7 +472,7 @@ int dom_node_previous_sibling_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto nextSibling DomNode
|
||||
/* {{{ nextSibling DomNode
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6AC54C2F
|
||||
Since:
|
||||
@@ -507,7 +507,7 @@ int dom_node_next_sibling_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto attributes DomNamedNodeMap
|
||||
/* {{{ attributes DomNamedNodeMap
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-84CF096
|
||||
Since:
|
||||
@@ -529,7 +529,7 @@ int dom_node_attributes_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
if (nodep->type == XML_ELEMENT_NODE) {
|
||||
php_dom_create_interator(*retval, DOM_NAMEDNODEMAP TSRMLS_CC);
|
||||
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
||||
dom_namednode_iter(obj, XML_ATTRIBUTE_NODE, intern, NULL, NULL, NULL);
|
||||
dom_namednode_iter(obj, XML_ATTRIBUTE_NODE, intern, NULL, NULL, NULL TSRMLS_CC);
|
||||
} else {
|
||||
ZVAL_NULL(*retval);
|
||||
}
|
||||
@@ -541,7 +541,7 @@ int dom_node_attributes_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto ownerDocument DomDocument
|
||||
/* {{{ ownerDocument DomDocument
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-node-ownerDoc
|
||||
Since:
|
||||
@@ -583,7 +583,7 @@ int dom_node_owner_document_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto namespaceUri string
|
||||
/* {{{ namespaceUri string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-NodeNSname
|
||||
Since: DOM Level 2
|
||||
@@ -628,7 +628,7 @@ int dom_node_namespace_uri_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto prefix string
|
||||
/* {{{ prefix string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-NodeNSPrefix
|
||||
Since: DOM Level 2
|
||||
@@ -752,7 +752,7 @@ int dom_node_prefix_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto localName string
|
||||
/* {{{ localName string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-NodeNSLocalN
|
||||
Since: DOM Level 2
|
||||
@@ -783,7 +783,7 @@ int dom_node_local_name_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto baseURI string
|
||||
/* {{{ baseURI string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-baseURI
|
||||
Since: DOM Level 3
|
||||
@@ -817,7 +817,7 @@ int dom_node_base_uri_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto textContent string
|
||||
/* {{{ textContent string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-textContent
|
||||
Since: DOM Level 3
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ zend_function_entry php_dom_nodelist_class_functions[] = {
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/* {{{ proto length int
|
||||
/* {{{ length int
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-203510337
|
||||
Since:
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ zend_function_entry php_dom_notation_class_functions[] = {
|
||||
|
||||
/* {{{ attribute protos, not implemented yet */
|
||||
|
||||
/* {{{ proto publicId string
|
||||
/* {{{ publicId string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-54F2B4D0
|
||||
Since:
|
||||
@@ -71,7 +71,7 @@ int dom_notation_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto systemId string
|
||||
/* {{{ systemId string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-E8AAB1D0
|
||||
Since:
|
||||
|
||||
+30
-8
@@ -35,6 +35,7 @@
|
||||
#define PHP_XPTR 2
|
||||
|
||||
zend_object_handlers dom_object_handlers;
|
||||
zend_object_handlers dom_ze1_object_handlers;
|
||||
|
||||
static HashTable classes;
|
||||
|
||||
@@ -233,6 +234,7 @@ zval *dom_read_property(zval *object, zval *member, int type TSRMLS_DC)
|
||||
} else {
|
||||
std_hnd = zend_get_std_object_handlers();
|
||||
retval = std_hnd->read_property(object, member, type TSRMLS_CC);
|
||||
retval->refcount = 1;
|
||||
}
|
||||
|
||||
if (member == &tmp_member) {
|
||||
@@ -333,7 +335,7 @@ zend_object_value dom_objects_store_clone_obj(zval *zobject TSRMLS_DC)
|
||||
obj = &EG(objects_store).object_buckets[handle].bucket.obj;
|
||||
|
||||
if (obj->clone == NULL) {
|
||||
zend_error(E_CORE_ERROR, "Trying to clone uncloneable object of class %s", Z_OBJCE_P(zobject)->name);
|
||||
php_error(E_ERROR, "Trying to clone an uncloneable object of class %s", Z_OBJCE_P(zobject)->name);
|
||||
}
|
||||
|
||||
obj->clone(obj->object, &new_object TSRMLS_CC);
|
||||
@@ -346,11 +348,26 @@ zend_object_value dom_objects_store_clone_obj(zval *zobject TSRMLS_DC)
|
||||
return retval;
|
||||
}
|
||||
|
||||
zend_object_value dom_objects_ze1_clone_obj(zval *zobject TSRMLS_DC)
|
||||
{
|
||||
php_error(E_ERROR, "Cannot clone object of class %s due to 'zend.ze1_compatibility_mode'", Z_OBJCE_P(zobject)->name);
|
||||
/* Return zobject->value.obj just to satisfy compiler */
|
||||
return zobject->value.obj;
|
||||
}
|
||||
|
||||
static zend_function_entry dom_functions[] = {
|
||||
PHP_FE(dom_import_simplexml, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
static zend_object_handlers* dom_get_obj_handlers(TSRMLS_D) {
|
||||
if (EG(ze1_compatibility_mode)) {
|
||||
return &dom_ze1_object_handlers;
|
||||
} else {
|
||||
return &dom_object_handlers;
|
||||
}
|
||||
}
|
||||
|
||||
zend_module_entry dom_module_entry = {
|
||||
STANDARD_MODULE_HEADER,
|
||||
"dom",
|
||||
@@ -379,12 +396,17 @@ PHP_MINIT_FUNCTION(dom)
|
||||
dom_object_handlers.get_property_ptr_ptr = NULL;
|
||||
dom_object_handlers.clone_obj = dom_objects_store_clone_obj;
|
||||
|
||||
memcpy(&dom_ze1_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
dom_ze1_object_handlers.read_property = dom_read_property;
|
||||
dom_ze1_object_handlers.write_property = dom_write_property;
|
||||
dom_ze1_object_handlers.get_property_ptr_ptr = NULL;
|
||||
dom_ze1_object_handlers.clone_obj = dom_objects_ze1_clone_obj;
|
||||
|
||||
zend_hash_init(&classes, 0, NULL, NULL, 1);
|
||||
|
||||
INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions);
|
||||
dom_domexception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(), NULL TSRMLS_CC);
|
||||
dom_domexception_class_entry->ce_flags |= ZEND_ACC_FINAL;
|
||||
dom_domexception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED;
|
||||
zend_declare_property_long(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC);
|
||||
|
||||
REGISTER_DOM_CLASS(ce, "DOMStringList", NULL, php_dom_domstringlist_class_functions, dom_domstringlist_class_entry);
|
||||
@@ -806,7 +828,7 @@ void dom_objects_free_storage(void *object TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns)
|
||||
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns TSRMLS_DC)
|
||||
{
|
||||
dom_nnodemap_object *mapptr;
|
||||
zval *baseobj = NULL;
|
||||
@@ -817,7 +839,7 @@ void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xml
|
||||
baseobj->type = IS_OBJECT;
|
||||
baseobj->is_ref = 1;
|
||||
baseobj->value.obj.handle = basenode->handle;
|
||||
baseobj->value.obj.handlers = &dom_object_handlers;
|
||||
baseobj->value.obj.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||
zval_copy_ctor(baseobj);
|
||||
}
|
||||
mapptr->baseobjptr = baseobj;
|
||||
@@ -897,7 +919,7 @@ zend_object_value dom_objects_new(zend_class_entry *class_type TSRMLS_DC)
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t)dom_objects_free_storage, dom_objects_clone TSRMLS_CC);
|
||||
intern->handle = retval.handle;
|
||||
retval.handlers = &dom_object_handlers;
|
||||
retval.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -914,7 +936,7 @@ zend_object_value dom_xpath_objects_new(zend_class_entry *class_type TSRMLS_DC)
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t)dom_xpath_objects_free_storage, dom_objects_clone TSRMLS_CC);
|
||||
intern->handle = retval.handle;
|
||||
retval.handlers = &dom_object_handlers;
|
||||
retval.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -978,7 +1000,7 @@ zend_object_value dom_nnodemap_objects_new(zend_class_entry *class_type TSRMLS_D
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, dom_nnodemap_object_dtor, (zend_objects_free_object_storage_t)dom_nnodemap_objects_free_storage, dom_objects_clone TSRMLS_CC);
|
||||
intern->handle = retval.handle;
|
||||
retval.handlers = &dom_object_handlers;
|
||||
retval.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -1015,7 +1037,7 @@ zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wrapper_in, zval *
|
||||
return_value->type = IS_OBJECT;
|
||||
return_value->is_ref = 1;
|
||||
return_value->value.obj.handle = intern->handle;
|
||||
return_value->value.obj.handlers = &dom_object_handlers;
|
||||
return_value->value.obj.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||
zval_copy_ctor(return_value);
|
||||
*found = 1;
|
||||
return return_value;
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ int dom_has_feature(char *feature, char *version);
|
||||
int dom_node_is_read_only(xmlNodePtr node);
|
||||
int dom_node_children_valid(xmlNodePtr node);
|
||||
void php_dom_create_interator(zval *return_value, int ce_type TSRMLS_DC);
|
||||
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns);
|
||||
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns TSRMLS_DC);
|
||||
xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID);
|
||||
xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index);
|
||||
xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index);
|
||||
|
||||
@@ -82,7 +82,7 @@ PHP_METHOD(domprocessinginstruction, __construct)
|
||||
}
|
||||
/* }}} end DOMProcessingInstruction::__construct */
|
||||
|
||||
/* {{{ proto target string
|
||||
/* {{{ target string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-1478689192
|
||||
Since:
|
||||
@@ -108,7 +108,7 @@ int dom_processinginstruction_target_read(dom_object *obj, zval **retval TSRMLS_
|
||||
|
||||
|
||||
|
||||
/* {{{ proto data string
|
||||
/* {{{ data string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-837822393
|
||||
Since:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
Bug # 28721: (appendChild() and insertBefore() unset DOMText)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.php'); ?>
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function print_node(DomNode $node) {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Bug # 28817: (properties in extended class)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class z extends domDocument{
|
||||
/** variable can have name */
|
||||
public $p_array;
|
||||
public $p_variable;
|
||||
|
||||
function __construct(){
|
||||
$this->p_array[] = 'bonus';
|
||||
$this->p_array[] = 'vir';
|
||||
$this->p_array[] = 'semper';
|
||||
$this->p_array[] = 'tiro';
|
||||
|
||||
$this->p_variable = 'Cessante causa cessat effectus';
|
||||
}
|
||||
}
|
||||
|
||||
$z=new z();
|
||||
var_dump($z->p_array);
|
||||
var_dump($z->p_variable);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(5) "bonus"
|
||||
[1]=>
|
||||
string(3) "vir"
|
||||
[2]=>
|
||||
string(6) "semper"
|
||||
[3]=>
|
||||
string(4) "tiro"
|
||||
}
|
||||
string(30) "Cessante causa cessat effectus"
|
||||
@@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
Test 2: getElementsByTagName() / getElementsByTagNameNS()
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.php'); ?>
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xml = <<<HERE
|
||||
|
||||
@@ -3,7 +3,7 @@ Test 4: Streams Test
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
array_search('compress.zlib', stream_get_wrappers()) || die('skip compress.zlib wrapper is not available');
|
||||
array_search('compress.zlib', stream_get_wrappers()) or die('skip compress.zlib wrapper is not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -23,7 +23,7 @@ function adjustDoctype($xml) {
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html><head><title>Hello world</title></head><body><p>
|
||||
This is a not well-formed<br/>
|
||||
html files with undeclared entities
|
||||
html files with undeclared entities 
|
||||
</p></body></html>
|
||||
--- save as HTML
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
|
||||
@@ -3,7 +3,7 @@ Test: Xinclude and Streams
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
array_search('compress.zlib', stream_get_wrappers()) || die('skip compress.zlib wrapper is not available');
|
||||
array_search('compress.zlib', stream_get_wrappers()) or die('skip compress.zlib wrapper is not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ PHP_METHOD(domtext, __construct)
|
||||
}
|
||||
/* }}} end DOMText::__construct */
|
||||
|
||||
/* {{{ proto wholeText string
|
||||
/* {{{ wholeText string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-wholeText
|
||||
Since: DOM Level 3
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ zend_function_entry php_dom_typeinfo_class_functions[] = {
|
||||
|
||||
/* {{{ attribute protos, not implemented yet */
|
||||
|
||||
/* {{{ proto type_name string
|
||||
/* {{{ type_name string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#TypeInfo-typeName
|
||||
Since:
|
||||
@@ -57,7 +57,7 @@ int dom_typeinfo_type_name_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
|
||||
|
||||
/* {{{ proto type_namespace string
|
||||
/* {{{ type_namespace string
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#TypeInfo-typeNamespace
|
||||
Since:
|
||||
|
||||
@@ -43,7 +43,7 @@ zend_function_entry php_dom_userdatahandler_class_functions[] = {
|
||||
/* {{{ attribute protos, not implemented yet */
|
||||
|
||||
|
||||
/* {{{ proto dom_void dom_userdatahandler_handle(unsigned short operation, string key, domobject data, node src, node dst);
|
||||
/* {{{ proto dom_void dom_userdatahandler_handle(short operation, string key, domobject data, node src, node dst);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-handleUserDataEvent
|
||||
Since:
|
||||
*/
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ PHP_METHOD(domxpath, __construct)
|
||||
}
|
||||
/* }}} end DOMXPath::__construct */
|
||||
|
||||
/* {{{ proto document DOMDocument*/
|
||||
/* {{{ document DOMDocument*/
|
||||
int dom_xpath_document_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
{
|
||||
xmlDoc *docp = NULL;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
enchant
|
||||
Pierre-Alain Joye, Ilia Alshanetsky
|
||||
@@ -1,36 +0,0 @@
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
PHP_ARG_WITH(enchant,for ENCHANT support,
|
||||
[ --with-enchant[=DIR] Include enchant support.
|
||||
GNU Aspell version 1.1.3 or higher required.])
|
||||
|
||||
if test "$PHP_ENCHANT" != "no"; then
|
||||
PHP_NEW_EXTENSION(enchant, enchant.c, $ext_shared)
|
||||
if test "$PHP_ENCHANT" != "yes"; then
|
||||
ENCHANT_SEARCH_DIRS=$PHP_ENCHANT
|
||||
else
|
||||
ENCHANT_SEARCH_DIRS="/usr/local /usr"
|
||||
fi
|
||||
for i in $ENCHANT_SEARCH_DIRS; do
|
||||
if test -f $i/include/enchant/enchant.h; then
|
||||
ENCHANT_DIR=$i
|
||||
ENCHANT_INCDIR=$i/include/enchant
|
||||
elif test -f $i/include/enchant.h; then
|
||||
ENCHANT_DIR=$i
|
||||
ENCHANT_INCDIR=$i/include
|
||||
fi
|
||||
done
|
||||
|
||||
if test -z "$ENCHANT_DIR"; then
|
||||
AC_MSG_ERROR(Cannot find enchant)
|
||||
fi
|
||||
|
||||
ENCHANT_LIBDIR=$ENCHANT_DIR/lib
|
||||
|
||||
AC_DEFINE(HAVE_ENCHANT,1,[ ])
|
||||
PHP_SUBST(ENCHANT_SHARED_LIBADD)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(enchant, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD)
|
||||
PHP_ADD_INCLUDE($ENCHANT_INCDIR)
|
||||
fi
|
||||
@@ -1,9 +0,0 @@
|
||||
// $Id$
|
||||
// vim:ft=javascript
|
||||
|
||||
ARG_ENABLE("enchant", "Enchant Support", "no");
|
||||
|
||||
if (PHP_ENCHANT == "yes") {
|
||||
EXTENSION("enchant", "enchant.c");
|
||||
AC_DEFINE('HAVE_ENCHANT', 1, 'Have Enchant support', false);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
$tag = 'en_US';
|
||||
$r = enchant_broker_init();
|
||||
$bprovides = enchant_broker_describe($r);
|
||||
echo "Current broker provides the following backend(s):\n";
|
||||
print_r($bprovides);
|
||||
|
||||
|
||||
if (enchant_broker_dict_exists($r,$tag)) {
|
||||
$d = enchant_broker_request_dict($r, $tag);
|
||||
$dprovides = enchant_dict_describe($d);
|
||||
echo "dictionary $tag provides:\n";
|
||||
$spellerrors = enchant_dict_check($d, "soong");
|
||||
print_r($dprovides);
|
||||
echo "found $spellerrors spell errors\n";
|
||||
if ($spellerrors) {
|
||||
$suggs = enchant_dict_suggest($d, "soong");
|
||||
echo "Suggestions for 'soong':";
|
||||
print_r($suggs);
|
||||
}
|
||||
enchant_broker_free_dict($d);
|
||||
} else {
|
||||
}
|
||||
enchant_broker_free($r);
|
||||
?>
|
||||
@@ -1,731 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/3_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Pierre-Alain Joye <paj@pearfr.org> |
|
||||
| Ilia Alshanetsky <ilia@prohost.org> |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "enchant.h"
|
||||
#include "php.h"
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_enchant.h"
|
||||
|
||||
|
||||
typedef EnchantBroker * EnchantBrokerPtr;
|
||||
typedef struct _broker_struct enchant_broker;
|
||||
typedef struct _dict_struct enchant_dict;
|
||||
|
||||
typedef enchant_broker * enchant_brokerPtr;
|
||||
typedef enchant_dict * enchant_dictPtr;
|
||||
|
||||
typedef struct _broker_struct {
|
||||
EnchantBroker *pbroker;
|
||||
enchant_dict **dict;
|
||||
unsigned int dictcnt;
|
||||
zval *rsrc_id;
|
||||
} _enchant_broker;
|
||||
|
||||
typedef struct _dict_struct {
|
||||
unsigned int id;
|
||||
EnchantDict *pdict;
|
||||
enchant_broker *pbroker;
|
||||
zval *rsrc_id;
|
||||
enchant_dict *next;
|
||||
enchant_dict *prev;
|
||||
} _enchant_dict;
|
||||
|
||||
|
||||
/* True global resources - no need for thread safety here */
|
||||
static int le_enchant_broker;
|
||||
static int le_enchant_dict;
|
||||
|
||||
/* If you declare any globals in php_enchant.h uncomment this:*/
|
||||
/*ZEND_DECLARE_MODULE_GLOBALS(enchant)*/
|
||||
|
||||
/* {{{ enchant_functions[]
|
||||
*
|
||||
* Every user visible function must have an entry in enchant_functions[].
|
||||
*/
|
||||
function_entry enchant_functions[] = {
|
||||
PHP_FE(enchant_broker_init, NULL)
|
||||
PHP_FE(enchant_broker_free, NULL)
|
||||
PHP_FE(enchant_broker_get_error, NULL)
|
||||
PHP_FE(enchant_broker_request_dict, NULL)
|
||||
PHP_FE(enchant_broker_request_pwl_dict, NULL)
|
||||
PHP_FE(enchant_broker_free_dict, NULL)
|
||||
PHP_FE(enchant_broker_dict_exists, NULL)
|
||||
PHP_FE(enchant_broker_set_ordering, NULL)
|
||||
PHP_FE(enchant_broker_describe, NULL)
|
||||
PHP_FE(enchant_dict_check, NULL)
|
||||
PHP_FE(enchant_dict_suggest, NULL)
|
||||
PHP_FE(enchant_dict_add_to_personal, NULL)
|
||||
PHP_FE(enchant_dict_add_to_session, NULL)
|
||||
PHP_FE(enchant_dict_is_in_session, NULL)
|
||||
PHP_FE(enchant_dict_store_replacement, NULL)
|
||||
PHP_FE(enchant_dict_get_error, NULL)
|
||||
PHP_FE(enchant_dict_describe, NULL)
|
||||
PHP_FE(enchant_dict_quick_check, third_arg_force_ref)
|
||||
|
||||
{NULL, NULL, NULL} /* Must be the last line in enchant_functions[] */
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/* {{{ enchant_module_entry
|
||||
*/
|
||||
zend_module_entry enchant_module_entry = {
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
STANDARD_MODULE_HEADER,
|
||||
#endif
|
||||
"enchant",
|
||||
enchant_functions,
|
||||
PHP_MINIT(enchant),
|
||||
PHP_MSHUTDOWN(enchant),
|
||||
NULL, /* Replace with NULL if there's nothing to do at request start */
|
||||
NULL, /* Replace with NULL if there's nothing to do at request end */
|
||||
PHP_MINFO(enchant),
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
"0.1", /* Replace with version number for your extension */
|
||||
#endif
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
#ifdef COMPILE_DL_ENCHANT
|
||||
ZEND_GET_MODULE(enchant)
|
||||
#endif
|
||||
|
||||
static void
|
||||
enumerate_providers_fn (const char * const name,
|
||||
const char * const desc,
|
||||
const char * const file,
|
||||
void * ud)
|
||||
{
|
||||
zval *zdesc = (zval *) ud;
|
||||
zval *tmp_array;
|
||||
|
||||
MAKE_STD_ZVAL(tmp_array);
|
||||
array_init(tmp_array);
|
||||
|
||||
add_assoc_string(tmp_array, "name", (char *)name, 1);
|
||||
add_assoc_string(tmp_array, "desc", (char *)desc, 1);
|
||||
add_assoc_string(tmp_array, "file", (char *)file, 1);
|
||||
|
||||
if (Z_TYPE_P(zdesc)!=IS_ARRAY) {
|
||||
array_init(zdesc);
|
||||
}
|
||||
|
||||
add_next_index_zval(zdesc, tmp_array);
|
||||
}
|
||||
|
||||
static void
|
||||
describe_dict_fn (const char * const lang,
|
||||
const char * const name,
|
||||
const char * const desc,
|
||||
const char * const file,
|
||||
void * ud)
|
||||
{
|
||||
zval *zdesc = (zval *) ud;
|
||||
array_init(zdesc);
|
||||
add_assoc_string(zdesc, "lang", (char *)lang, 1);
|
||||
add_assoc_string(zdesc, "name", (char *)name, 1);
|
||||
add_assoc_string(zdesc, "desc", (char *)desc, 1);
|
||||
add_assoc_string(zdesc, "file", (char *)file, 1);
|
||||
}
|
||||
|
||||
static void php_enchant_broker_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
if (rsrc->ptr) {
|
||||
enchant_broker *broker = (enchant_broker *)rsrc->ptr;
|
||||
if (broker) {
|
||||
if (broker->pbroker) {
|
||||
if (broker->dictcnt && broker->dict) {
|
||||
if (broker->dict) {
|
||||
int total, tofree;
|
||||
tofree = total = broker->dictcnt-1;
|
||||
do {
|
||||
zend_list_delete(Z_RESVAL_P(broker->dict[total]->rsrc_id));
|
||||
efree(broker->dict[total]);
|
||||
total--;
|
||||
} while (total>=0);
|
||||
}
|
||||
efree(broker->dict);
|
||||
broker->dict = NULL;
|
||||
}
|
||||
enchant_broker_free(broker->pbroker);
|
||||
}
|
||||
efree(broker);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void php_enchant_dict_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
if (rsrc->ptr) {
|
||||
enchant_dict *pdict = (enchant_dict *)rsrc->ptr;
|
||||
if (pdict) {
|
||||
if (pdict->pdict && pdict->pbroker) {
|
||||
enchant_broker_free_dict(pdict->pbroker->pbroker, pdict->pdict);
|
||||
}
|
||||
if (pdict->id) {
|
||||
pdict->pbroker->dict[pdict->id-1]->next = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* {{{ PHP_MINIT_FUNCTION
|
||||
*/
|
||||
PHP_MINIT_FUNCTION(enchant)
|
||||
{
|
||||
le_enchant_broker = zend_register_list_destructors_ex(php_enchant_broker_free, NULL, "enchant broker", module_number);
|
||||
le_enchant_dict = zend_register_list_destructors_ex(php_enchant_dict_free, NULL, "enchant dict", module_number);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MSHUTDOWN_FUNCTION
|
||||
*/
|
||||
PHP_MSHUTDOWN_FUNCTION(enchant)
|
||||
{
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MINFO_FUNCTION
|
||||
*/
|
||||
static void __enumerate_providers_fn (const char * const name,
|
||||
const char * const desc,
|
||||
const char * const file,
|
||||
void * ud)
|
||||
{
|
||||
php_info_print_table_row(3, name, desc, file);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MINFO_FUNCTION
|
||||
*/
|
||||
PHP_MINFO_FUNCTION(enchant)
|
||||
{
|
||||
EnchantBroker *pbroker;
|
||||
|
||||
pbroker = enchant_broker_init();
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_header(2, "enchant support", "enabled");
|
||||
php_info_print_table_row(2, "Version", "@version@");
|
||||
php_info_print_table_row(2, "Revision", "$Revision$");
|
||||
php_info_print_table_end();
|
||||
|
||||
php_info_print_table_start();
|
||||
enchant_broker_describe(pbroker, __enumerate_providers_fn, NULL);
|
||||
php_info_print_table_end();
|
||||
enchant_broker_free(pbroker);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#define PHP_ENCHANT_GET_BROKER \
|
||||
ZEND_FETCH_RESOURCE(pbroker, enchant_broker *, &broker, -1, "enchant_broker", le_enchant_broker); \
|
||||
if (!pbroker || !pbroker->pbroker) { \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "Resource broker invalid"); \
|
||||
RETURN_FALSE; \
|
||||
}
|
||||
|
||||
#define PHP_ENCHANT_GET_DICT \
|
||||
ZEND_FETCH_RESOURCE(pdict, enchant_dict *, &dict, -1, "enchant dict", le_enchant_dict); \
|
||||
if (!pdict || !pdict->pdict) { \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "Invalid dictionary resource."); \
|
||||
RETURN_FALSE; \
|
||||
}
|
||||
|
||||
/* {{{ proto resource enchant_broker_init()
|
||||
create a new broker object capable of requesting */
|
||||
PHP_FUNCTION(enchant_broker_init)
|
||||
{
|
||||
enchant_broker *broker;
|
||||
EnchantBroker *pbroker;
|
||||
|
||||
if (ZEND_NUM_ARGS()) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
pbroker = enchant_broker_init();
|
||||
|
||||
if (pbroker) {
|
||||
broker = (enchant_broker *) emalloc(sizeof(enchant_broker));
|
||||
broker->pbroker = pbroker;
|
||||
broker->dict = NULL;
|
||||
broker->dictcnt = 0;
|
||||
ZEND_REGISTER_RESOURCE(return_value, broker, le_enchant_broker);
|
||||
broker->rsrc_id = return_value;
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto boolean enchant_free(resource broker)
|
||||
Destroys the broker object and its dictionnaries */
|
||||
PHP_FUNCTION(enchant_broker_free)
|
||||
{
|
||||
zval *broker;
|
||||
enchant_broker *pbroker;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
PHP_ENCHANT_GET_BROKER;
|
||||
|
||||
zend_list_delete(Z_RESVAL_P(broker));
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string enchant_broker_get_error(resource broker)
|
||||
Returns the last error of the broker */
|
||||
PHP_FUNCTION(enchant_broker_get_error)
|
||||
{
|
||||
zval *broker;
|
||||
enchant_broker *pbroker;
|
||||
char *msg;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_BROKER;
|
||||
|
||||
msg = enchant_broker_get_error(pbroker->pbroker);
|
||||
if (msg) {
|
||||
RETURN_STRING((char *)msg, 1);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource enchant_broker_request_dict(resource broker, string tag)
|
||||
create a new dictionary using tag, the non-empty language tag you wish to request
|
||||
a dictionary for ("en_US", "de_DE", ...) */
|
||||
PHP_FUNCTION(enchant_broker_request_dict)
|
||||
{
|
||||
zval *broker;
|
||||
enchant_broker *pbroker;
|
||||
enchant_dict *dict;
|
||||
EnchantDict *d;
|
||||
char *tag;
|
||||
int taglen;
|
||||
int pos;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_BROKER;
|
||||
|
||||
d = enchant_broker_request_dict(pbroker->pbroker, (const char *)tag);
|
||||
if (d) {
|
||||
if (pbroker->dictcnt) {
|
||||
pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
|
||||
pos = pbroker->dictcnt++;
|
||||
} else {
|
||||
pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
|
||||
pos = 0;
|
||||
pbroker->dictcnt++;
|
||||
}
|
||||
|
||||
dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
|
||||
dict->id = pos;
|
||||
dict->pbroker = pbroker;
|
||||
dict->pdict = d;
|
||||
dict->rsrc_id = return_value;
|
||||
dict->prev = pos ? pbroker->dict[pos-1] : NULL;
|
||||
dict->next = NULL;
|
||||
pbroker->dict[pos] = dict;
|
||||
|
||||
if (pos) {
|
||||
pbroker->dict[pos-1]->next = dict;
|
||||
}
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource enchant_broker_request_pwl_dict(resource dict, string filename)
|
||||
creates a dictionary using a PWL file. A PWL file is personal word file one word per line.
|
||||
It must exist before the call.*/
|
||||
PHP_FUNCTION(enchant_broker_request_pwl_dict)
|
||||
{
|
||||
zval *broker;
|
||||
enchant_broker *pbroker;
|
||||
enchant_dict *dict;
|
||||
EnchantDict *d;
|
||||
char *pwl;
|
||||
int pwllen;
|
||||
int pos;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &pwl, &pwllen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if ((PG(safe_mode) && (!php_checkuid(pwl, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(pwl TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_BROKER;
|
||||
|
||||
d = enchant_broker_request_pwl_dict(pbroker->pbroker, (const char *)pwl);
|
||||
if (d) {
|
||||
if (pbroker->dictcnt) {
|
||||
pos = pbroker->dictcnt++;
|
||||
pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
|
||||
} else {
|
||||
pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
|
||||
pos = 0;
|
||||
pbroker->dictcnt++;
|
||||
}
|
||||
dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
|
||||
dict->id = pos;
|
||||
dict->pbroker = pbroker;
|
||||
dict->pdict = d;
|
||||
dict->rsrc_id = return_value;
|
||||
dict->prev = pos?pbroker->dict[pos-1]:NULL;
|
||||
dict->next = NULL;
|
||||
pbroker->dict[pos] = dict;
|
||||
if (pos) {
|
||||
pbroker->dict[pos-1]->next = dict;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource enchant_broker_free_dict(resource dict)
|
||||
Free the dictionary resource */
|
||||
PHP_FUNCTION(enchant_broker_free_dict)
|
||||
{
|
||||
zval *dict;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
zend_list_delete(Z_RESVAL_P(dict));
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool enchant_broker_dict_exists(resource broker, string tag)
|
||||
Wether a dictionary exists or not. Using non-empty tag */
|
||||
PHP_FUNCTION(enchant_broker_dict_exists)
|
||||
{
|
||||
zval *broker;
|
||||
char *tag;
|
||||
int taglen;
|
||||
enchant_broker * pbroker;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_BROKER;
|
||||
|
||||
RETURN_BOOL(enchant_broker_dict_exists(pbroker->pbroker, tag));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool enchant_broker_set_ordering(resource broker, string tag, string ordering)
|
||||
Declares a preference of dictionaries to use for the language
|
||||
described/referred to by 'tag'. The ordering is a comma delimited
|
||||
list of provider names. As a special exception, the "*" tag can
|
||||
be used as a language tag to declare a default ordering for any
|
||||
language that does not explictly declare an ordering. */
|
||||
|
||||
PHP_FUNCTION(enchant_broker_set_ordering)
|
||||
{
|
||||
zval *broker;
|
||||
char *pordering;
|
||||
int porderinglen;
|
||||
char *ptag;
|
||||
int ptaglen;
|
||||
enchant_broker * pbroker;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &broker, &ptag, &ptaglen, &pordering, &porderinglen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_BROKER;
|
||||
|
||||
enchant_broker_set_ordering(pbroker->pbroker, ptag, pordering);
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array enchant_broker_describe(resource broker)
|
||||
Enumerates the Enchant providers and tells
|
||||
you some rudimentary information about them. The same info is provided through phpinfo() */
|
||||
PHP_FUNCTION(enchant_broker_describe)
|
||||
{
|
||||
EnchantBrokerDescribeFn describetozval = enumerate_providers_fn;
|
||||
zval *broker;
|
||||
enchant_broker * pbroker;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_BROKER;
|
||||
|
||||
enchant_broker_describe(pbroker->pbroker, describetozval, (void *)return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool enchant_dict_quick_check(resource dict, string word [, array &suggestions])
|
||||
If the word is correctly spelled return true, otherwise return false, if suggestions variable
|
||||
is provided, fill it with spelling alternatives. */
|
||||
PHP_FUNCTION(enchant_dict_quick_check)
|
||||
{
|
||||
zval *dict, *sugg = NULL;
|
||||
char *word;
|
||||
int wordlen;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|z/", &dict, &word, &wordlen, &sugg) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (sugg) {
|
||||
zval_dtor(sugg);
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
if (enchant_dict_check(pdict->pdict, word, wordlen) > 0) {
|
||||
if (!sugg && ZEND_NUM_ARGS() == 2) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
int n_sugg;
|
||||
char **suggs;
|
||||
|
||||
array_init(sugg);
|
||||
|
||||
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
|
||||
if (suggs && n_sugg) {
|
||||
int i;
|
||||
for (i = 0; i < n_sugg; i++) {
|
||||
add_next_index_string(sugg, suggs[i], 1);
|
||||
}
|
||||
enchant_dict_free_suggestions(pdict->pdict, suggs);
|
||||
}
|
||||
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool enchant_dict_check(resource dict, string word)
|
||||
If the word is correctly spelled return true, otherwise return false */
|
||||
PHP_FUNCTION(enchant_dict_check)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
int wordlen;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
RETURN_BOOL(!enchant_dict_check(pdict->pdict, word, wordlen));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array enchant_dict_suggest(resource dict, string word)
|
||||
Will return a list of values if any of those pre-conditions are not met.*/
|
||||
PHP_FUNCTION(enchant_dict_suggest)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
int wordlen;
|
||||
char **suggs;
|
||||
enchant_dict *pdict;
|
||||
int n_sugg;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
|
||||
if (suggs && n_sugg) {
|
||||
int i;
|
||||
|
||||
array_init(return_value);
|
||||
for (i = 0; i < n_sugg; i++) {
|
||||
add_next_index_string(return_value, suggs[i], 1);
|
||||
}
|
||||
|
||||
enchant_dict_free_suggestions(pdict->pdict, suggs);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void enchant_dict_add_to_personal(resource dict, string word)
|
||||
add 'word' to personal word list */
|
||||
PHP_FUNCTION(enchant_dict_add_to_personal)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
int wordlen;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
enchant_dict_add_to_personal(pdict->pdict, word, wordlen);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void enchant_dict_add_to_session(resource dict, string word)
|
||||
add 'word' to this spell-checking session */
|
||||
PHP_FUNCTION(enchant_dict_add_to_session)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
int wordlen;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
enchant_dict_add_to_session(pdict->pdict, word, wordlen);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool enchant_dict_is_in_session(resource dict, string word)
|
||||
whether or not 'word' exists in this spelling-session */
|
||||
PHP_FUNCTION(enchant_dict_is_in_session)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
int wordlen;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
RETURN_BOOL(enchant_dict_is_in_session(pdict->pdict, word, wordlen));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void enchant_dict_store_replacement(resource dict, string mis, string cor)
|
||||
add a correction for 'mis' using 'cor'.
|
||||
Notes that you replaced @mis with @cor, so it's possibly more likely
|
||||
that future occurrences of @mis will be replaced with @cor. So it might
|
||||
bump @cor up in the suggestion list.*/
|
||||
PHP_FUNCTION(enchant_dict_store_replacement)
|
||||
{
|
||||
zval *dict;
|
||||
char *mis, *cor;
|
||||
int mislen, corlen;
|
||||
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &dict, &mis, &mislen, &cor, &corlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
enchant_dict_store_replacement(pdict->pdict, mis, mislen, cor, corlen);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string enchant_dict_get_error(resource dict)
|
||||
Returns the last error of the current spelling-session */
|
||||
PHP_FUNCTION(enchant_dict_get_error)
|
||||
{
|
||||
zval *dict;
|
||||
enchant_dict *pdict;
|
||||
char *msg;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
msg = enchant_dict_get_error(pdict->pdict);
|
||||
if (msg) {
|
||||
RETURN_STRING((char *)msg, 1);
|
||||
}
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array enchant_dict_describe(resource dict)
|
||||
Describes an individual dictionary 'dict' */
|
||||
PHP_FUNCTION(enchant_dict_describe)
|
||||
{
|
||||
zval *dict;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
enchant_dict_describe(pdict->pdict, describe_dict_fn, (void *)return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
@@ -1,73 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE package SYSTEM "../pear/package.dtd">
|
||||
<package>
|
||||
<name>enchant</name>
|
||||
<summary>libenchant binder, support near all spelling tools</summary>
|
||||
<maintainers>
|
||||
<maintainer>
|
||||
<user>pajoye</user>
|
||||
<name>Pierre-Alain Joye</name>
|
||||
<email>paj@pearfr.org</email>
|
||||
<role>lead</role>
|
||||
</maintainer>
|
||||
<maintainer>
|
||||
<user>iliaa</user>
|
||||
<name>Ilia Alshanetsky</name>
|
||||
<email>ilia@php.net</email>
|
||||
<role>developer</role>
|
||||
</maintainer>
|
||||
</maintainers>
|
||||
<description>Enchant is a binder for libenchant. Libenchant provides a common
|
||||
API for many spell libraries:
|
||||
- aspell/pspell (intended to replace ispell)
|
||||
- hspell (hebrew)
|
||||
- ispell
|
||||
- myspell (OpenOffice project, mozilla)
|
||||
- uspell (primarily Yiddish, Hebrew, and Eastern European languages)
|
||||
A plugin system allows to add custom spell support.
|
||||
see www.abisource.com/enchant/</description>
|
||||
<license>PHP</license>
|
||||
<release>
|
||||
<state>beta</state>
|
||||
<version>0.2.1</version>
|
||||
<date>2004-03-11</date>
|
||||
<notes>- Fix possible leak in suggestions result
|
||||
- Move to beta status</notes>
|
||||
<filelist>
|
||||
<file role="src" name="config.m4"/>
|
||||
<file role="src" name="config.w32"/>
|
||||
<file role="src" name="enchant.c"/>
|
||||
<file role="src" name="php_enchant.h"/>
|
||||
<file role="doc" name="CREDITS"/>
|
||||
<dir name="docs" role="doc">
|
||||
<dir name="examples">
|
||||
<file name="example1.php"/>
|
||||
</dir>
|
||||
</dir>
|
||||
</filelist>
|
||||
<configureoptions>
|
||||
<configureoption name="with-enchant" default="shared" prompt="libenchant prefix?"/>
|
||||
</configureoptions>
|
||||
<deps>
|
||||
<dep type="php" rel="ge" version="5" />
|
||||
</deps>
|
||||
</release>
|
||||
<changelog>
|
||||
<release>
|
||||
<state>alpha</state>
|
||||
<version>0.2.0</version>
|
||||
<notes>- Add Ilia Alshanetsky as maintainer
|
||||
- Cleanup sources codes (ilia)
|
||||
- Add enchant_dict_quick_check (ilia)</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version>0.1</version>
|
||||
<state>alpha</state>
|
||||
<date>2003-03-08</date>
|
||||
<notes>Initial release</notes>
|
||||
</release>
|
||||
</changelog>
|
||||
</package>
|
||||
<!--
|
||||
vim:et:ts=1:sw=1
|
||||
-->
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2003 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/3_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Pierre-Alain Joye <paj@pearfr.org> |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef PHP_ENCHANT_H
|
||||
#define PHP_ENCHANT_H
|
||||
|
||||
extern zend_module_entry enchant_module_entry;
|
||||
#define phpext_enchant_ptr &enchant_module_entry
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_ENCHANT_API __declspec(dllexport)
|
||||
#else
|
||||
#define PHP_ENCHANT_API
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
#include "TSRM.h"
|
||||
#endif
|
||||
|
||||
static void php_enchant_broker_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
static void php_enchant_dict_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
|
||||
PHP_MINIT_FUNCTION(enchant);
|
||||
PHP_MSHUTDOWN_FUNCTION(enchant);
|
||||
PHP_MINFO_FUNCTION(enchant);
|
||||
|
||||
PHP_FUNCTION(enchant_broker_init);
|
||||
PHP_FUNCTION(enchant_broker_free);
|
||||
PHP_FUNCTION(enchant_broker_get_error);
|
||||
PHP_FUNCTION(enchant_broker_request_dict);
|
||||
PHP_FUNCTION(enchant_broker_request_pwl_dict);
|
||||
PHP_FUNCTION(enchant_broker_free_dict);
|
||||
PHP_FUNCTION(enchant_broker_dict_exists);
|
||||
PHP_FUNCTION(enchant_broker_set_ordering);
|
||||
PHP_FUNCTION(enchant_broker_describe);
|
||||
|
||||
PHP_FUNCTION(enchant_dict_check);
|
||||
PHP_FUNCTION(enchant_dict_suggest);
|
||||
PHP_FUNCTION(enchant_dict_add_to_personal);
|
||||
PHP_FUNCTION(enchant_dict_add_to_session);
|
||||
PHP_FUNCTION(enchant_dict_is_in_session);
|
||||
PHP_FUNCTION(enchant_dict_store_replacement);
|
||||
PHP_FUNCTION(enchant_dict_get_error);
|
||||
PHP_FUNCTION(enchant_dict_describe);
|
||||
PHP_FUNCTION(enchant_dict_quick_check);
|
||||
|
||||
#ifdef ZTS
|
||||
#define ENCHANT_G(v) TSRMG(enchant_globals_id, zend_enchant_globals *, v)
|
||||
#else
|
||||
#define ENCHANT_G(v) (enchant_globals.v)
|
||||
#endif
|
||||
|
||||
#endif /* PHP_ENCHANT_H */
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
*/
|
||||
|
||||
@@ -270,7 +270,7 @@ sopno stopst;
|
||||
/* figure out what it matched */
|
||||
switch (OP(m->g->strip[ss])) {
|
||||
case OEND:
|
||||
assert(nope);
|
||||
assert(PHP_REGEX_NOPE);
|
||||
break;
|
||||
case OCHAR:
|
||||
sp++;
|
||||
@@ -286,7 +286,7 @@ sopno stopst;
|
||||
break;
|
||||
case OBACK_:
|
||||
case O_BACK:
|
||||
assert(nope);
|
||||
assert(PHP_REGEX_NOPE);
|
||||
break;
|
||||
/* cases where length of match is hard to find */
|
||||
case OQUEST_:
|
||||
@@ -389,7 +389,7 @@ sopno stopst;
|
||||
case OOR1:
|
||||
case OOR2:
|
||||
case O_CH:
|
||||
assert(nope);
|
||||
assert(PHP_REGEX_NOPE);
|
||||
break;
|
||||
case OLPAREN:
|
||||
i = OPND(m->g->strip[ss]);
|
||||
@@ -402,7 +402,7 @@ sopno stopst;
|
||||
m->pmatch[i].rm_eo = sp - m->offp;
|
||||
break;
|
||||
default: /* uh oh */
|
||||
assert(nope);
|
||||
assert(PHP_REGEX_NOPE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -606,12 +606,12 @@ sopno lev; /* PLUS nesting level */
|
||||
return(NULL);
|
||||
break;
|
||||
default: /* uh oh */
|
||||
assert(nope);
|
||||
assert(PHP_REGEX_NOPE);
|
||||
break;
|
||||
}
|
||||
|
||||
/* "can't happen" */
|
||||
assert(nope);
|
||||
assert(PHP_REGEX_NOPE);
|
||||
/* NOTREACHED */
|
||||
return((unsigned char *)NULL); /* dummy */
|
||||
}
|
||||
@@ -914,7 +914,7 @@ register states aft; /* states already known reachable after */
|
||||
FWD(aft, aft, 1);
|
||||
break;
|
||||
default: /* ooooops... */
|
||||
assert(nope);
|
||||
assert(PHP_REGEX_NOPE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Loaded 100 of 564 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user