mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-12 03:30:50 +00:00
Compare commits
1353
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ab1f1c0e5 | ||
|
|
f4b832d277 | ||
|
|
c55f8b96c9 | ||
|
|
39fcedd78c | ||
|
|
75687f2f11 | ||
|
|
5f8a57efec | ||
|
|
b8b0a6ac27 | ||
|
|
5c2d995f0b | ||
|
|
4fb28d67b6 | ||
|
|
8a21e6bcbe | ||
|
|
3686d84a68 | ||
|
|
ce98c73f82 | ||
|
|
6bd64164d5 | ||
|
|
74efc41fc3 | ||
|
|
657ce39a28 | ||
|
|
97a29e07c9 | ||
|
|
bc033a67db | ||
|
|
515e8c2c0e | ||
|
|
63a566c65a | ||
|
|
14ea586525 | ||
|
|
727ef4b94f | ||
|
|
dd969337a0 | ||
|
|
aef2b692c1 | ||
|
|
035cf39d34 | ||
|
|
4adfb80edc | ||
|
|
491a2f5219 | ||
|
|
913578add9 | ||
|
|
64349569de | ||
|
|
18f2ffeead | ||
|
|
cc4b274a58 | ||
|
|
4214a056a1 | ||
|
|
4cb97fa3b9 | ||
|
|
1dcef1e4ea | ||
|
|
5b0b5b6ed5 | ||
|
|
5704fcb29d | ||
|
|
38933514e1 | ||
|
|
d863d52a5d | ||
|
|
db9da7b423 | ||
|
|
d032a8e6f6 | ||
|
|
f09884ad54 | ||
|
|
26f3ec7c03 | ||
|
|
4345f8a0b5 | ||
|
|
180cce6f63 | ||
|
|
131acf55f7 | ||
|
|
02c1e81a54 | ||
|
|
d28ef151e0 | ||
|
|
f4eff912d9 | ||
|
|
35cc422378 | ||
|
|
ff4cc2c6e2 | ||
|
|
51a29e57f8 | ||
|
|
b197b8d104 | ||
|
|
84eaf5e1c8 | ||
|
|
558cce8323 | ||
|
|
3bfee898db | ||
|
|
0c509e5cf8 | ||
|
|
ae9de3ed37 | ||
|
|
79f5dcf7d6 | ||
|
|
b26e4a97c9 | ||
|
|
936923a3b6 | ||
|
|
2c96b5856f | ||
|
|
cd9f1f828e | ||
|
|
883e3395f0 | ||
|
|
92a6f2c344 | ||
|
|
ef72a765bf | ||
|
|
737b6f8b13 | ||
|
|
678613b9d8 | ||
|
|
f9f46598a9 | ||
|
|
9b405fa636 | ||
|
|
db8bb9f23c | ||
|
|
b11d1eb440 | ||
|
|
5d1040309c | ||
|
|
3fa179752a | ||
|
|
1066633281 | ||
|
|
70ea4df4af | ||
|
|
9b81440b76 | ||
|
|
f22f8adedd | ||
|
|
0ba80e7943 | ||
|
|
2f4035c833 | ||
|
|
36c4708a84 | ||
|
|
068be1721f | ||
|
|
c8ef634f1b | ||
|
|
437ea23723 | ||
|
|
6a1f79bf8d | ||
|
|
216e81db96 | ||
|
|
a7b9d5590b | ||
|
|
3cb1db985e | ||
|
|
8460372395 | ||
|
|
f026dae4f2 | ||
|
|
6dd36a0df6 | ||
|
|
7b7f46aa2d | ||
|
|
363a8b69c9 | ||
|
|
751d155b96 | ||
|
|
ff3774d1ee | ||
|
|
89aa330637 | ||
|
|
9fff2f7bbe | ||
|
|
480d2b5624 | ||
|
|
8e29c1e9ee | ||
|
|
d95a4e2c19 | ||
|
|
836e8af6ff | ||
|
|
7c8dc40fe3 | ||
|
|
126e776bb1 | ||
|
|
b847333273 | ||
|
|
9f456af68b | ||
|
|
9b17045bdd | ||
|
|
94737d086f | ||
|
|
15515da8a2 | ||
|
|
1ec143228a | ||
|
|
9a1f3b48a9 | ||
|
|
ecd484ac21 | ||
|
|
9789e43af1 | ||
|
|
1b35f3bcfc | ||
|
|
27018c0ff0 | ||
|
|
3c03232b35 | ||
|
|
8e4a4d2d60 | ||
|
|
8b95f1005f | ||
|
|
6ebc57505c | ||
|
|
bd1ac39821 | ||
|
|
49cc65cdae | ||
|
|
7a3c3e85ad | ||
|
|
543d76185d | ||
|
|
71028d46cf | ||
|
|
7decb9dae5 | ||
|
|
c1626365f9 | ||
|
|
552ee2a247 | ||
|
|
055709538c | ||
|
|
250aded265 | ||
|
|
42486196ad | ||
|
|
fe94f59427 | ||
|
|
75b47ad142 | ||
|
|
38472b48d7 | ||
|
|
b74a38968a | ||
|
|
e5f4a7541d | ||
|
|
990e2612cc | ||
|
|
a702dc02f9 | ||
|
|
2258453ba3 | ||
|
|
84ed9d387f | ||
|
|
91c6db000f | ||
|
|
2b615c3ba4 | ||
|
|
d46f919bc1 | ||
|
|
49c3d762ee | ||
|
|
686380b824 | ||
|
|
52b711521f | ||
|
|
935347ee42 | ||
|
|
6adebbf162 | ||
|
|
c08d1ad74c | ||
|
|
2c93a6ac2d | ||
|
|
6a42e63dee | ||
|
|
41d93ca3fd | ||
|
|
ab38ad27a5 | ||
|
|
56986a4ab8 | ||
|
|
8b34428167 | ||
|
|
b49f07a92d | ||
|
|
2605bd4b30 | ||
|
|
1d062f3f6e | ||
|
|
66d7578c36 | ||
|
|
648648ff1b | ||
|
|
d9f641aa34 | ||
|
|
e3fdc42dfa | ||
|
|
df6f8ba35a | ||
|
|
a1cc1fddd8 | ||
|
|
886ad91adf | ||
|
|
08978fc3f4 | ||
|
|
86a884e538 | ||
|
|
d9763dd63a | ||
|
|
5476706142 | ||
|
|
a9b9c68b8a | ||
|
|
46c3d99a9c | ||
|
|
3705cd3f6d | ||
|
|
63de1783fa | ||
|
|
b99a07a935 | ||
|
|
e7bb6187eb | ||
|
|
9c462b0d01 | ||
|
|
c247b8081e | ||
|
|
7b03b7571b | ||
|
|
288d96229e | ||
|
|
67122717a4 | ||
|
|
74de59dff1 | ||
|
|
80f4a863f9 | ||
|
|
fa58a95035 | ||
|
|
734708319f | ||
|
|
1f14640b3e | ||
|
|
03b5cb6775 | ||
|
|
e7ef5041d5 | ||
|
|
8e40864770 | ||
|
|
c07cf5c2a5 | ||
|
|
b4d9b70c6e | ||
|
|
ad1cb8205b | ||
|
|
8d8f148d98 | ||
|
|
34feef0d6b | ||
|
|
3f9f54dcca | ||
|
|
99639f5812 | ||
|
|
4bffed7769 | ||
|
|
949d0d7002 | ||
|
|
bfb066ee96 | ||
|
|
71355c7917 | ||
|
|
f8cb29d636 | ||
|
|
ce75d26996 | ||
|
|
31a74b4aec | ||
|
|
896faf0b34 | ||
|
|
77111db912 | ||
|
|
3c01151a08 | ||
|
|
286d420740 | ||
|
|
90e15c04c9 | ||
|
|
8b99a7385d | ||
|
|
e6e19800dc | ||
|
|
0c5e2d2439 | ||
|
|
3898513fbd | ||
|
|
8dce85c2f2 | ||
|
|
6687828100 | ||
|
|
222fe23275 | ||
|
|
f4299a90e2 | ||
|
|
29cd309944 | ||
|
|
0fd809a770 | ||
|
|
7ff5198c53 | ||
|
|
16344800b2 | ||
|
|
f70e998794 | ||
|
|
94cfe03da5 | ||
|
|
bb9a36cad1 | ||
|
|
c45f699830 | ||
|
|
bef4389b5d | ||
|
|
8a8741a1fe | ||
|
|
80d8e554d3 | ||
|
|
8a33c1cace | ||
|
|
f43b57190c | ||
|
|
f1397d5339 | ||
|
|
e858d27888 | ||
|
|
7f66d5e99a | ||
|
|
9190271cef | ||
|
|
2afc5d6924 | ||
|
|
2b88417b8c | ||
|
|
8d030236d6 | ||
|
|
088c7a6044 | ||
|
|
ce4c65a60d | ||
|
|
d30044c969 | ||
|
|
3ee263e348 | ||
|
|
5a67b295e6 | ||
|
|
35f82bcd6b | ||
|
|
9ed2694ce0 | ||
|
|
540471fc09 | ||
|
|
f289014922 | ||
|
|
c0273c47d7 | ||
|
|
1436374c40 | ||
|
|
cc196f5b54 | ||
|
|
ef64e8336f | ||
|
|
534b0f7e06 | ||
|
|
06cdf297a8 | ||
|
|
b91a66699c | ||
|
|
7cd6ccc0ec | ||
|
|
7c4daf11c0 | ||
|
|
dc613f099c | ||
|
|
ac39c13b1c | ||
|
|
feee0f5a08 | ||
|
|
15b5b127da | ||
|
|
0d559f17cd | ||
|
|
6cacbd75e7 | ||
|
|
4f3eaaa854 | ||
|
|
d2da63f629 | ||
|
|
3d741d71c6 | ||
|
|
6f5fc0be54 | ||
|
|
18f7a8ca61 | ||
|
|
559d611a86 | ||
|
|
6083eb1030 | ||
|
|
ee111cf9c8 | ||
|
|
a25ccbec2e | ||
|
|
9950eaecd7 | ||
|
|
a3ef7170b1 | ||
|
|
8c1f1f15c5 | ||
|
|
09f96051dd | ||
|
|
66be507ac3 | ||
|
|
983e41b7be | ||
|
|
506eec88b4 | ||
|
|
062713a58d | ||
|
|
199b95c8d6 | ||
|
|
f1f5a325c1 | ||
|
|
a4a8f6719b | ||
|
|
e39fbeae16 | ||
|
|
2d6842b103 | ||
|
|
3eded520ef | ||
|
|
2cbd22b9c8 | ||
|
|
4af0eeded6 | ||
|
|
e184ed1ed3 | ||
|
|
2ea46ef6cc | ||
|
|
6affe84ee7 | ||
|
|
4312c5f9e0 | ||
|
|
d5a1d55901 | ||
|
|
affac19132 | ||
|
|
e7aa85c011 | ||
|
|
9a17664431 | ||
|
|
a975676399 | ||
|
|
0722546b20 | ||
|
|
48475a52af | ||
|
|
312a226707 | ||
|
|
857a051616 | ||
|
|
72c05b07d5 | ||
|
|
41b21156cc | ||
|
|
e65ae0e7fd | ||
|
|
4b8709ef5c | ||
|
|
48697c5f5c | ||
|
|
8dd296dd7d | ||
|
|
f17f3371be | ||
|
|
c1f93729b8 | ||
|
|
2aaa2cc409 | ||
|
|
631f476abe | ||
|
|
a72dce7da9 | ||
|
|
fc3906e93a | ||
|
|
a2f95abb6d | ||
|
|
3744720899 | ||
|
|
23c0362aec | ||
|
|
29312b2ec8 | ||
|
|
4f0eab7f6c | ||
|
|
9f3362933a | ||
|
|
fcd83424cf | ||
|
|
e68a9c6bfa | ||
|
|
1e5e73e0ae | ||
|
|
c44f5ec495 | ||
|
|
37dec69a7c | ||
|
|
08615c6f68 | ||
|
|
ae82e1ccf2 | ||
|
|
39f3075500 | ||
|
|
15f0f8ae23 | ||
|
|
df92e90d50 | ||
|
|
3dd9845e98 | ||
|
|
3c06e3c4bb | ||
|
|
95d99c9ba9 | ||
|
|
42b9349d8b | ||
|
|
57d908ea1f | ||
|
|
b278435074 | ||
|
|
fde1575ba2 | ||
|
|
5598d6f0b1 | ||
|
|
898099adba | ||
|
|
de46a16e43 | ||
|
|
dd714b617c | ||
|
|
80ccb3f7f7 | ||
|
|
ca476ecaa4 | ||
|
|
6f84c93e45 | ||
|
|
a9fe559f60 | ||
|
|
55d9b2ad9c | ||
|
|
f78f4364a0 | ||
|
|
2e3fbf41f9 | ||
|
|
8b40f3c231 | ||
|
|
a6d9db7dc1 | ||
|
|
5fc1552c04 | ||
|
|
3ca8006a8d | ||
|
|
bc6f6d9e83 | ||
|
|
f705826052 | ||
|
|
e6f95ee99b | ||
|
|
79f0345166 | ||
|
|
6d7be11454 | ||
|
|
12cfb76b65 | ||
|
|
62f57095a0 | ||
|
|
98bda8de71 | ||
|
|
1c7f015c4d | ||
|
|
abe67fdb83 | ||
|
|
4d1daeb9bd | ||
|
|
821458c4d6 | ||
|
|
80a58cd23c | ||
|
|
6cc12e1450 | ||
|
|
975ed901aa | ||
|
|
5ccdb1d352 | ||
|
|
788b1552a7 | ||
|
|
78e4644fa1 | ||
|
|
88c66d4859 | ||
|
|
66411756dd | ||
|
|
3a1b1142fe | ||
|
|
d672226d6f | ||
|
|
035c6c83e6 | ||
|
|
b893e59095 | ||
|
|
0515870902 | ||
|
|
8b4b057518 | ||
|
|
7d479f4abb | ||
|
|
2bc39cfebc | ||
|
|
90cbb8e02b | ||
|
|
3942e2a8bd | ||
|
|
98a7a1ba1f | ||
|
|
d247632b5b | ||
|
|
5664afaadc | ||
|
|
f341f630d3 | ||
|
|
88c6758d4e | ||
|
|
4f78737000 | ||
|
|
e202deaec4 | ||
|
|
23db803b34 | ||
|
|
13fb78bab1 | ||
|
|
13ed1f43c1 | ||
|
|
95ee25ace6 | ||
|
|
ad6607332b | ||
|
|
412cca6f6f | ||
|
|
8f26c3f326 | ||
|
|
8ee38d9d75 | ||
|
|
58abda0e58 | ||
|
|
43eb67855f | ||
|
|
b1d60772d8 | ||
|
|
da8b28cf1c | ||
|
|
d3ea04bb66 | ||
|
|
4396a984a8 | ||
|
|
6fbe1dbcae | ||
|
|
43f34af575 | ||
|
|
65429fbaac | ||
|
|
ea83d64507 | ||
|
|
a345d2ce86 | ||
|
|
878fb495fe | ||
|
|
1a082a349c | ||
|
|
26d0435146 | ||
|
|
34c165a274 | ||
|
|
db9d9523a6 | ||
|
|
70941fe41b | ||
|
|
f111b84e05 | ||
|
|
61cad20c12 | ||
|
|
b1976de01b | ||
|
|
81b5aabb33 | ||
|
|
a8d6e94635 | ||
|
|
5f8982d048 | ||
|
|
352e52716a | ||
|
|
2c5764d46f | ||
|
|
e982012daf | ||
|
|
f8fb5e5d98 | ||
|
|
ef537403e6 | ||
|
|
afa2c22e9c | ||
|
|
f34c1ee368 | ||
|
|
5695709fb7 | ||
|
|
16f8af514f | ||
|
|
962216c201 | ||
|
|
e06c1d7c7e | ||
|
|
92843788fa | ||
|
|
1251756d54 | ||
|
|
78f108d31a | ||
|
|
9382ddec52 | ||
|
|
a332f826a7 | ||
|
|
bddb9539f7 | ||
|
|
f1e32a8c82 | ||
|
|
0bdd62c8ac | ||
|
|
bc26250413 | ||
|
|
db44b1086c | ||
|
|
c4b7501956 | ||
|
|
e475621f2c | ||
|
|
488b76b95d | ||
|
|
2c9ed05832 | ||
|
|
c20a1c1be6 | ||
|
|
3d000d9521 | ||
|
|
411725b01c | ||
|
|
eb4754441f | ||
|
|
0f20565919 | ||
|
|
48e54e0c7a | ||
|
|
de64d45439 | ||
|
|
a67459f581 | ||
|
|
2eccd95ca4 | ||
|
|
b87194e0c6 | ||
|
|
02293b6bee | ||
|
|
e74c6b1674 | ||
|
|
702e243d98 | ||
|
|
2ace2ccd00 | ||
|
|
c8896a38ae | ||
|
|
288871505b | ||
|
|
6fce86d5ed | ||
|
|
5a81882c03 | ||
|
|
9ba2c90e16 | ||
|
|
ab94fecde3 | ||
|
|
b1085a21e5 | ||
|
|
3a0e43cb54 | ||
|
|
dceb1e7814 | ||
|
|
93a58dbed2 | ||
|
|
54ca6f05b1 | ||
|
|
d0433b6d1c | ||
|
|
2fba036202 | ||
|
|
fa15d6069c | ||
|
|
2830e45fe7 | ||
|
|
deeb3407ff | ||
|
|
b1322f570c | ||
|
|
7d2334f48d | ||
|
|
8a7f7d5cae | ||
|
|
b0a803d127 | ||
|
|
2c05c7e0ac | ||
|
|
b5dc4f7ce0 | ||
|
|
f0df3f5f82 | ||
|
|
dc5e38cf19 | ||
|
|
97be9bc1d5 | ||
|
|
91a6ed234d | ||
|
|
8ea8ebd2de | ||
|
|
43825a76bb | ||
|
|
1bbdd3bce1 | ||
|
|
3a97065f87 | ||
|
|
9a8854b5b1 | ||
|
|
ed03a30603 | ||
|
|
4fc273adda | ||
|
|
31391b8df3 | ||
|
|
963226543b | ||
|
|
194e17cd11 | ||
|
|
cc0b737e51 | ||
|
|
43a2fe1cd8 | ||
|
|
75b32c64ff | ||
|
|
e9c09b86e1 | ||
|
|
8b0ac98fe4 | ||
|
|
fc412af04a | ||
|
|
51ef66ed67 | ||
|
|
d6adcc98b5 | ||
|
|
3be12d1d9b | ||
|
|
4ccb92fcd0 | ||
|
|
0a682c6d70 | ||
|
|
26578c386d | ||
|
|
7ab89b02c4 | ||
|
|
b60aedc275 | ||
|
|
f8055473a4 | ||
|
|
2f08cb119c | ||
|
|
dc9fc4155e | ||
|
|
688cdc581d | ||
|
|
66a2690700 | ||
|
|
edcd5d08b6 | ||
|
|
e2b0768e96 | ||
|
|
6b8670b267 | ||
|
|
c62fdf8f11 | ||
|
|
fd42c6afba | ||
|
|
c06c27af73 | ||
|
|
43bd681c34 | ||
|
|
610bc7a194 | ||
|
|
2fa4b31386 | ||
|
|
6719d80101 | ||
|
|
1ffea56325 | ||
|
|
2928fcbb2c | ||
|
|
ae9f65537e | ||
|
|
eff53313f5 | ||
|
|
cb6e751008 | ||
|
|
10fe28c8ab | ||
|
|
6a5bcfef8d | ||
|
|
374a351444 | ||
|
|
1f6f91035e | ||
|
|
a3368ababa | ||
|
|
5ee719bae0 | ||
|
|
8b53a129f7 | ||
|
|
cd0fb34562 | ||
|
|
4a99c5ee5c | ||
|
|
44b68122c2 | ||
|
|
609271e651 | ||
|
|
2890b57e46 | ||
|
|
dc107bf495 | ||
|
|
5da651fcd2 | ||
|
|
475796a0d7 | ||
|
|
afd6890a78 | ||
|
|
059cbc13d3 | ||
|
|
2384eb7d62 | ||
|
|
ae13c5c551 | ||
|
|
b3d49ab0e4 | ||
|
|
89a0e85251 | ||
|
|
ca38506fb7 | ||
|
|
c278bfc448 | ||
|
|
e967627ad6 | ||
|
|
f197cf3630 | ||
|
|
6586cf7216 | ||
|
|
2977edaacd | ||
|
|
18ccd87eb9 | ||
|
|
db75202426 | ||
|
|
35ace375a9 | ||
|
|
201aeb2bb5 | ||
|
|
9290bf04e8 | ||
|
|
90544a10ee | ||
|
|
92535e9fa6 | ||
|
|
77318b5186 | ||
|
|
42ec547950 | ||
|
|
550550f746 | ||
|
|
71d341e2c0 | ||
|
|
72fc6bc4b1 | ||
|
|
991e30668f | ||
|
|
f73ee14bd9 | ||
|
|
76fcdc1afb | ||
|
|
0b2af004c1 | ||
|
|
19cfee427f | ||
|
|
cf65fad63a | ||
|
|
aecd5b89ee | ||
|
|
c767809b2f | ||
|
|
c2da7dc4a9 | ||
|
|
deea4d7f2c | ||
|
|
d98c96fc6c | ||
|
|
b31c3e04bc | ||
|
|
27d63c5b8d | ||
|
|
801cadc3b8 | ||
|
|
a575980813 | ||
|
|
adc9e9b587 | ||
|
|
4b5527ef2a | ||
|
|
1beb9b21e5 | ||
|
|
43f1b676bb | ||
|
|
43b3da1396 | ||
|
|
4c4c34aaeb | ||
|
|
035ffebe16 | ||
|
|
8d8903b8d3 | ||
|
|
db388374ed | ||
|
|
f8b0353fec | ||
|
|
701b1a548e | ||
|
|
4fdf886f5c | ||
|
|
626c663b26 | ||
|
|
24b033170f | ||
|
|
c24a1e3022 | ||
|
|
8064e685be | ||
|
|
2b8e0d43e9 | ||
|
|
4d60dbb9ef | ||
|
|
798ec79319 | ||
|
|
884cb737f0 | ||
|
|
5db38caece | ||
|
|
cc0c2ea603 | ||
|
|
efd46d53b5 | ||
|
|
95dff71df7 | ||
|
|
02e25f0a1e | ||
|
|
3ead31449f | ||
|
|
5c90e7a78f | ||
|
|
6852a1e704 | ||
|
|
fc05a725eb | ||
|
|
030e873758 | ||
|
|
1ed249ddbc | ||
|
|
1f852425d1 | ||
|
|
86bd61aace | ||
|
|
28575499df | ||
|
|
65da5375ea | ||
|
|
c0efc001af | ||
|
|
8a54c2929f | ||
|
|
86959aaf62 | ||
|
|
7e1fb1c7b7 | ||
|
|
583b24b682 | ||
|
|
d682cf90cf | ||
|
|
d3dfc03108 | ||
|
|
454d13652e | ||
|
|
009b5575fa | ||
|
|
4c9c90eea2 | ||
|
|
6c5d688dee | ||
|
|
7a2d291d50 | ||
|
|
73dbeb6f6f | ||
|
|
b266763335 | ||
|
|
d5478b94a6 | ||
|
|
fe72ba4684 | ||
|
|
8f4109e8cb | ||
|
|
29c090934b | ||
|
|
a90e5f5a6b | ||
|
|
67e663efbf | ||
|
|
d5f1b1b60f | ||
|
|
c232516005 | ||
|
|
db4021bc7c | ||
|
|
e8922acc53 | ||
|
|
2aefe30f18 | ||
|
|
d9c26ab299 | ||
|
|
c1872382ac | ||
|
|
96a04d4ab7 | ||
|
|
88d4de1da9 | ||
|
|
cb37652ca5 | ||
|
|
b5e6cabb8e | ||
|
|
0130405168 | ||
|
|
dbe9e0bfc2 | ||
|
|
d7acbbe2c3 | ||
|
|
e638a3d354 | ||
|
|
8d86cc6efe | ||
|
|
c06ad9f9c0 | ||
|
|
a10c309e63 | ||
|
|
7bdfc6fbe8 | ||
|
|
8a5402c232 | ||
|
|
1a247ba1d8 | ||
|
|
872da0aa0a | ||
|
|
a92fa9b2bc | ||
|
|
7904bff7ad | ||
|
|
7e88a009d2 | ||
|
|
67b53c04eb | ||
|
|
eea391830a | ||
|
|
4d54d1919c | ||
|
|
6b934d9243 | ||
|
|
e9eb586106 | ||
|
|
7a43e77e58 | ||
|
|
d37016f26d | ||
|
|
8d66ae62e9 | ||
|
|
262bcc637d | ||
|
|
cdc5600880 | ||
|
|
01850714ee | ||
|
|
ce6dde342b | ||
|
|
0cee8df65e | ||
|
|
838a7a9566 | ||
|
|
de8ff3170e | ||
|
|
8a06f6635e | ||
|
|
26a315308d | ||
|
|
689252082c | ||
|
|
405142087c | ||
|
|
b26fbe41b1 | ||
|
|
925ff7f2b2 | ||
|
|
1f40bd4cd9 | ||
|
|
3c98893a01 | ||
|
|
bb5398c687 | ||
|
|
1f3cd999e5 | ||
|
|
96a8cc1a44 | ||
|
|
8d88fb8bf3 | ||
|
|
692d30b7be | ||
|
|
aa9098cd46 | ||
|
|
99687096ca | ||
|
|
f0c30a0662 | ||
|
|
f3d2d4c630 | ||
|
|
ffd40bf495 | ||
|
|
70a60c43ab | ||
|
|
91b3f7b570 | ||
|
|
de894ef098 | ||
|
|
27fb33e8b7 | ||
|
|
49b44d537f | ||
|
|
06111162cf | ||
|
|
e4ebe9f1ff | ||
|
|
251c275305 | ||
|
|
d557151ce7 | ||
|
|
3bf9d3d82f | ||
|
|
08fe09e9d2 | ||
|
|
42cce22f2d | ||
|
|
6e9e37be3a | ||
|
|
a7bea2f140 | ||
|
|
6fab353df1 | ||
|
|
116671a8fb | ||
|
|
13682462c7 | ||
|
|
012840d145 | ||
|
|
3629062ab6 | ||
|
|
6a0dce93af | ||
|
|
009b8470eb | ||
|
|
c7239f2b00 | ||
|
|
5f5bbfd3f3 | ||
|
|
fb487bc38d | ||
|
|
28f5a1e6e9 | ||
|
|
60f7b32e4d | ||
|
|
ece41debc9 | ||
|
|
5b0e540882 | ||
|
|
b46e7d76b4 | ||
|
|
4cf3fd2752 | ||
|
|
62fb3d63c5 | ||
|
|
78b881f389 | ||
|
|
f04497bab2 | ||
|
|
3a50a0322f | ||
|
|
bf59a8db85 | ||
|
|
10ee55abf5 | ||
|
|
89bd184ea0 | ||
|
|
a0bbfb590c | ||
|
|
af1c7070f7 | ||
|
|
16da751e3b | ||
|
|
1bceefb2da | ||
|
|
2965b8c1fc | ||
|
|
2ebefcf3b9 | ||
|
|
26389258bb | ||
|
|
17ef8dba77 | ||
|
|
8b8d3d35c2 | ||
|
|
f2fbed70fd | ||
|
|
f46dbef810 | ||
|
|
9ce638248d | ||
|
|
a1c2b86701 | ||
|
|
91880600c7 | ||
|
|
5541451085 | ||
|
|
62feefddc7 | ||
|
|
89ea50a588 | ||
|
|
e78b61542d | ||
|
|
1ac3aa7e08 | ||
|
|
20505d8483 | ||
|
|
b244f61139 | ||
|
|
0c79e85ede | ||
|
|
1c7e920a9e | ||
|
|
1f470ecca6 | ||
|
|
0ebee4d29f | ||
|
|
98a8ea2203 | ||
|
|
a58e996039 | ||
|
|
1fa1b9a60c | ||
|
|
c4ee7a403e | ||
|
|
377d88cec0 | ||
|
|
0786889de0 | ||
|
|
27744e892a | ||
|
|
744d1fc1ea | ||
|
|
43c7615c51 | ||
|
|
ee63d3400a | ||
|
|
c6bed4ce3d | ||
|
|
d452cf054e | ||
|
|
73b5401fc9 | ||
|
|
dc7d5df048 | ||
|
|
4039c24ad5 | ||
|
|
3db3d65d2e | ||
|
|
56e6d6ae77 | ||
|
|
3e91f4fadc | ||
|
|
3c6bf08a47 | ||
|
|
4eb7611155 | ||
|
|
758b775d34 | ||
|
|
bd15cd8ef9 | ||
|
|
a9bae61ca3 | ||
|
|
6db3f409d8 | ||
|
|
2eabb14dc7 | ||
|
|
516b8bc723 | ||
|
|
362140868d | ||
|
|
b055912861 | ||
|
|
8a705b8cd9 | ||
|
|
94d789e5d7 | ||
|
|
d21db564a3 | ||
|
|
147ae17bad | ||
|
|
bf3de43044 | ||
|
|
2d91428732 | ||
|
|
9edfe2e4d3 | ||
|
|
69ae8f1903 | ||
|
|
c4c4626551 | ||
|
|
e3e28c8f59 | ||
|
|
cf1e1e0ddd | ||
|
|
38f3435f06 | ||
|
|
15ac0567f9 | ||
|
|
cb9991d9db | ||
|
|
ffd256654d | ||
|
|
73b5ff0389 | ||
|
|
95d19651f3 | ||
|
|
f512ec4331 | ||
|
|
eb38ca844b | ||
|
|
6d9c04e823 | ||
|
|
6f7cf88a98 | ||
|
|
279b468bf7 | ||
|
|
c8280238de | ||
|
|
be52d66f4b | ||
|
|
061cd20400 | ||
|
|
7e42c73a50 | ||
|
|
ba670f561e | ||
|
|
5fb05df977 | ||
|
|
d1199bd2c7 | ||
|
|
39e47f5a98 | ||
|
|
99a71e4418 | ||
|
|
dd01c11ee3 | ||
|
|
51e2a6b84e | ||
|
|
5a34b26972 | ||
|
|
bfef93878c | ||
|
|
9d4c81e925 | ||
|
|
6b0196b652 | ||
|
|
9a4500d056 | ||
|
|
e1c448e8be | ||
|
|
0916fd50c0 | ||
|
|
d85b39e532 | ||
|
|
23a942c795 | ||
|
|
0729948990 | ||
|
|
6a8a5767c2 | ||
|
|
6693d112d2 | ||
|
|
8ec9e5bca0 | ||
|
|
21f2b9277f | ||
|
|
b0468809ff | ||
|
|
cdae7d9b7c | ||
|
|
f9d71bc3fb | ||
|
|
fe000a7391 | ||
|
|
b77c39ea65 | ||
|
|
448e9d49cc | ||
|
|
deb81174b0 | ||
|
|
23c65b60a0 | ||
|
|
6cfba2a3ea | ||
|
|
0ddd124d1d | ||
|
|
c033288573 | ||
|
|
158d34c9a5 | ||
|
|
e014d58e46 | ||
|
|
eb9390771c | ||
|
|
ab0acab993 | ||
|
|
ad2113e635 | ||
|
|
622fe4d488 | ||
|
|
32b196e4f7 | ||
|
|
bb2d4e3126 | ||
|
|
d05661abd2 | ||
|
|
2e79759f50 | ||
|
|
a491db4e2d | ||
|
|
f1ce7daccd | ||
|
|
f3b1bc8bc2 | ||
|
|
315c894da8 | ||
|
|
f61dfce39c | ||
|
|
db1fe4b060 | ||
|
|
9c610ae87f | ||
|
|
1b78716661 | ||
|
|
524b089127 | ||
|
|
1eda5996cc | ||
|
|
f78cf8ee67 | ||
|
|
6bcd0ae557 | ||
|
|
76ccb015e8 | ||
|
|
958675c067 | ||
|
|
e42ab2c95f | ||
|
|
1df380da5a | ||
|
|
b46354b7bc | ||
|
|
929ae94c64 | ||
|
|
f8e78a00f2 | ||
|
|
0002bae3bf | ||
|
|
17352812a3 | ||
|
|
03f7406711 | ||
|
|
8f01638bf6 | ||
|
|
2c275bf793 | ||
|
|
4582d38519 | ||
|
|
0a8677167d | ||
|
|
9002e37e4e | ||
|
|
78fb121a61 | ||
|
|
b08e6310fb | ||
|
|
d58240d0f5 | ||
|
|
d1a1ef3d9b | ||
|
|
f45555e62f | ||
|
|
a16eadb1ef | ||
|
|
6320f1aa3e | ||
|
|
483fc4c73a | ||
|
|
7d2a912335 | ||
|
|
810dd37b90 | ||
|
|
926d1506e0 | ||
|
|
a46c6157de | ||
|
|
cc17f92947 | ||
|
|
49c66ea47e | ||
|
|
ad72c064bc | ||
|
|
ba2bc65d31 | ||
|
|
e261d310a0 | ||
|
|
c6a957e012 | ||
|
|
e4ace6cde6 | ||
|
|
88d408ee11 | ||
|
|
3bdddb4910 | ||
|
|
da5a79d185 | ||
|
|
ed50e0e155 | ||
|
|
0215031834 | ||
|
|
91985677a6 | ||
|
|
0098833e86 | ||
|
|
1a92100ce1 | ||
|
|
975ebe3524 | ||
|
|
d330072db9 | ||
|
|
563c0670e5 | ||
|
|
8092460830 | ||
|
|
c3edc73ecc | ||
|
|
30df2b3073 | ||
|
|
38ab8708f2 | ||
|
|
2f59bb576d | ||
|
|
bc631cce3e | ||
|
|
a965a1759f | ||
|
|
bcb426a207 | ||
|
|
d6cecfc213 | ||
|
|
0edb79a3d4 | ||
|
|
75095ce66c | ||
|
|
891443e15f | ||
|
|
b285fae0bc | ||
|
|
60812553d4 | ||
|
|
75aa3cfc51 | ||
|
|
311fe215aa | ||
|
|
3a386f8684 | ||
|
|
30042dc883 | ||
|
|
4f6c17b4f5 | ||
|
|
16ef3439f4 | ||
|
|
97fea0931c | ||
|
|
96763e8372 | ||
|
|
f88c25b60e | ||
|
|
11e733ce29 | ||
|
|
7c161fe069 | ||
|
|
9938137725 | ||
|
|
639a36a3dd | ||
|
|
47f3851a00 | ||
|
|
373fc12bb1 | ||
|
|
d477d490b2 | ||
|
|
8828af0bd5 | ||
|
|
ca5fdbf537 | ||
|
|
236bcdb514 | ||
|
|
55d84825c1 | ||
|
|
9c5580c7d4 | ||
|
|
7c6b7baac9 | ||
|
|
7343b4da7a | ||
|
|
c403d6846b | ||
|
|
e929389eeb | ||
|
|
567f6c7a27 | ||
|
|
d4bee942d6 | ||
|
|
5275b60398 | ||
|
|
8d88df3437 | ||
|
|
6e4e8e94d9 | ||
|
|
5abba5ee0e | ||
|
|
23fea6461d | ||
|
|
919e7e9f69 | ||
|
|
e302d6a5e8 | ||
|
|
fdd6f08aec | ||
|
|
4c69a970d3 | ||
|
|
f037e5b2da | ||
|
|
a7d71f9708 | ||
|
|
b14cb5c3ff | ||
|
|
88713e4d8d | ||
|
|
671b46a0db | ||
|
|
e8f195c427 | ||
|
|
0f835fdf28 | ||
|
|
3b8f3cc439 | ||
|
|
8f9813031e | ||
|
|
1f9629d466 | ||
|
|
2547f86060 | ||
|
|
a4f9a16225 | ||
|
|
2ee197b4c6 | ||
|
|
87d7284e46 | ||
|
|
d504c7ca4f | ||
|
|
2bbbec107b | ||
|
|
d5e22e2a29 | ||
|
|
21b9a2ca2a | ||
|
|
d1a2dbfd9d | ||
|
|
3b52256bd1 | ||
|
|
4d90ca0aea | ||
|
|
2e890a36d4 | ||
|
|
5830ffeb48 | ||
|
|
7a03473347 | ||
|
|
9f61e47c24 | ||
|
|
b06440bceb | ||
|
|
517bd3018c | ||
|
|
de963ce9c6 | ||
|
|
c86c9f52b4 | ||
|
|
78747bd2df | ||
|
|
61d4f7fe65 | ||
|
|
176cd90bd7 | ||
|
|
ff2bc83c08 | ||
|
|
6963ac4050 | ||
|
|
eede70a84f | ||
|
|
71dca8c23e | ||
|
|
b5d77099fe | ||
|
|
6ee9f04f87 | ||
|
|
645a98ef99 | ||
|
|
fd07b94b0f | ||
|
|
9a6fe9631e | ||
|
|
d4b86e1c5b | ||
|
|
d07cfabce4 | ||
|
|
b07b4c6029 | ||
|
|
4585ae9fb1 | ||
|
|
1c3b3ad8f3 | ||
|
|
bdb4cb5271 | ||
|
|
1ab4c740b5 | ||
|
|
186605c62f | ||
|
|
bbe7050e71 | ||
|
|
c41913db4d | ||
|
|
3ed4cc33ac | ||
|
|
d7536a8a5f | ||
|
|
2da75a405f | ||
|
|
a0acfe4375 | ||
|
|
0a543a9014 | ||
|
|
da0c69d7b9 | ||
|
|
5569abe1ee | ||
|
|
92390db7e6 | ||
|
|
ff5e95b9e3 | ||
|
|
a5828bbfa9 | ||
|
|
b8cf53d8a5 | ||
|
|
1bc80e6048 | ||
|
|
2e153ddae1 | ||
|
|
fc1abec531 | ||
|
|
8d8e26577d | ||
|
|
c8751fc8a5 | ||
|
|
e4df7dc7bf | ||
|
|
f6dfcb5641 | ||
|
|
afa9e65ff4 | ||
|
|
6a2d84ba06 | ||
|
|
3c64473b71 | ||
|
|
198e6f3ea7 | ||
|
|
14152e7ca6 | ||
|
|
acb7d69ff7 | ||
|
|
95ff1ab10f | ||
|
|
059f1cc922 | ||
|
|
12eef9d6d6 | ||
|
|
79e6063a5e | ||
|
|
25d4500a86 | ||
|
|
b7ba9e007d | ||
|
|
33fc6e2d5f | ||
|
|
4bfa51ad89 | ||
|
|
8a156d9a39 | ||
|
|
6883b92116 | ||
|
|
903c831be5 | ||
|
|
a4c905ff16 | ||
|
|
4f10dd7985 | ||
|
|
167ea5e6e6 | ||
|
|
a1b11f0755 | ||
|
|
e121eaaef5 | ||
|
|
5ec58914fe | ||
|
|
f0c5631778 | ||
|
|
d930a72cd7 | ||
|
|
1b0f00d67f | ||
|
|
3a044786f8 | ||
|
|
42b5521af5 | ||
|
|
24b54b866f | ||
|
|
dbc9a93fba | ||
|
|
54905782b6 | ||
|
|
91606e5264 | ||
|
|
032b263129 | ||
|
|
d082fb373d | ||
|
|
b9edf7c17c | ||
|
|
b54ce06e96 | ||
|
|
fe0bfa6dbb | ||
|
|
472a5b029c | ||
|
|
9fe46a52d4 | ||
|
|
a219643b2b | ||
|
|
9a5fdae381 | ||
|
|
7101179c8d | ||
|
|
8820474d4a | ||
|
|
e7e88a25d1 | ||
|
|
03fbbb098c | ||
|
|
38cacba117 | ||
|
|
536c96969b | ||
|
|
c661449ebf | ||
|
|
17765221df | ||
|
|
0935217091 | ||
|
|
e55315a375 | ||
|
|
fe03f6f4c2 | ||
|
|
3151916113 | ||
|
|
f12896d23b | ||
|
|
04439c305b | ||
|
|
83df136d28 | ||
|
|
9b8886410d | ||
|
|
8d07a0178f | ||
|
|
dda004bcfb | ||
|
|
55b600d03c | ||
|
|
1ecd31b66c | ||
|
|
00ef03186e | ||
|
|
383691eec2 | ||
|
|
7c4a0cc6cf | ||
|
|
0a143cf655 | ||
|
|
dc8386e30d | ||
|
|
efb83df9f9 | ||
|
|
79c27f0cd2 | ||
|
|
b417b96fb8 | ||
|
|
f6d73d73fb | ||
|
|
f14ada19ac | ||
|
|
e46decaa32 | ||
|
|
0cb6a31906 | ||
|
|
b0300e26df | ||
|
|
bf81c36cb3 | ||
|
|
72c7ae080b | ||
|
|
1a68fe49cb | ||
|
|
92f1248a49 | ||
|
|
f7306ce010 | ||
|
|
d4197ea703 | ||
|
|
22dc6f2a3b | ||
|
|
d44ee0670f | ||
|
|
2f9b7b8737 | ||
|
|
c52b0e935c | ||
|
|
9e8a2e5ba9 | ||
|
|
f8907afacc | ||
|
|
84e163a900 | ||
|
|
e29994166a | ||
|
|
c57ed1b93b | ||
|
|
498f7fd90f | ||
|
|
69c7346f0e | ||
|
|
f7e7b42d4b | ||
|
|
cb386234ea | ||
|
|
b080ddb867 | ||
|
|
642eab8b46 | ||
|
|
a95fb10461 | ||
|
|
2567b428b2 | ||
|
|
bf0ab08fb8 | ||
|
|
409b87d41e | ||
|
|
4861c0cf99 | ||
|
|
357dfd5f14 | ||
|
|
b2b50ab525 | ||
|
|
5c1c22764a | ||
|
|
6bba521dd3 | ||
|
|
cc747779ce | ||
|
|
819ea51d00 | ||
|
|
392e1edee8 | ||
|
|
217059fdc7 | ||
|
|
5595973ea9 | ||
|
|
567c10ba4c | ||
|
|
17209a7088 | ||
|
|
d340c5b2bf | ||
|
|
619702157b | ||
|
|
67b9fb4912 | ||
|
|
452c41ec9e | ||
|
|
560606d210 | ||
|
|
0fdc143d9e | ||
|
|
29f5dbe10b | ||
|
|
ab48027b3e | ||
|
|
4684d5f405 | ||
|
|
828aed1f40 | ||
|
|
5dd2b6e2fd | ||
|
|
a4a1543753 | ||
|
|
08a521572f | ||
|
|
942f34e126 | ||
|
|
efdc50c175 | ||
|
|
e6c7f6f22c | ||
|
|
f824bf94f3 | ||
|
|
43baccbf05 | ||
|
|
64c7c88af0 | ||
|
|
b9c4dc4a05 | ||
|
|
563ffb8984 | ||
|
|
1164abcdab | ||
|
|
9a8c9439e8 | ||
|
|
176bf835e4 | ||
|
|
b3745665dd | ||
|
|
821ea15431 | ||
|
|
43c2025ac2 | ||
|
|
c93ec77f15 | ||
|
|
36c27603b1 | ||
|
|
b392fe4497 | ||
|
|
f7fcf3a701 | ||
|
|
23f1b515a6 | ||
|
|
c614a9ed3d | ||
|
|
1424e42326 | ||
|
|
6cc6e1e668 | ||
|
|
2ccffc5600 | ||
|
|
5cd46bb2e0 | ||
|
|
fb610787ff | ||
|
|
d1d848c171 | ||
|
|
1c6bfcaa33 | ||
|
|
0378e545a0 | ||
|
|
0aca825435 | ||
|
|
30562acbb2 | ||
|
|
2186ced3a6 | ||
|
|
d7149ba8fc | ||
|
|
b781720b36 | ||
|
|
151c872bc9 | ||
|
|
2a0a07b883 | ||
|
|
b0970f1421 | ||
|
|
e2efa0196f | ||
|
|
05af99cd35 | ||
|
|
739716883b | ||
|
|
521084f661 | ||
|
|
b693782c36 | ||
|
|
c7b55925a1 | ||
|
|
b073c312b3 | ||
|
|
57d971d2ef | ||
|
|
d697a558ac | ||
|
|
5d451c9885 | ||
|
|
dc9769ea96 | ||
|
|
70c581b820 | ||
|
|
7b73aee40f | ||
|
|
41562f6ca2 | ||
|
|
d5e5e376ab | ||
|
|
b8763a6f8c | ||
|
|
13ff183225 | ||
|
|
bc596544a1 | ||
|
|
2121989d4d | ||
|
|
cda7f49324 | ||
|
|
08073a5c60 | ||
|
|
820d28affe | ||
|
|
e2d51050ea | ||
|
|
ef9fc2e66a | ||
|
|
f03a871d93 | ||
|
|
61c62cf854 | ||
|
|
6738cda17c | ||
|
|
9e7da02d3b | ||
|
|
cae9763d0a | ||
|
|
36412eb5de | ||
|
|
faa5031f25 | ||
|
|
bd4eb1bf78 | ||
|
|
580d41b3af | ||
|
|
dd094d1866 | ||
|
|
ca5eb34608 | ||
|
|
8a4da944ba | ||
|
|
398b65ed2f | ||
|
|
0fabddb745 | ||
|
|
55c5c68769 | ||
|
|
f20e9fa298 | ||
|
|
d3ceaeb4e8 | ||
|
|
a97b1e2341 | ||
|
|
3e62bd0867 | ||
|
|
43c2bc364f | ||
|
|
8ade27507a | ||
|
|
146dffb930 | ||
|
|
a3b9652564 | ||
|
|
93311d9301 | ||
|
|
1f30f907b9 | ||
|
|
b78f77575b | ||
|
|
5296d29b59 | ||
|
|
bd4150ed80 | ||
|
|
766de15694 | ||
|
|
ff7a694e0f | ||
|
|
30dc0813cb | ||
|
|
3b4f80a035 | ||
|
|
1c10503029 | ||
|
|
f0ea3478cb | ||
|
|
f9d913537b | ||
|
|
1ffed2e53f | ||
|
|
e140b35b04 | ||
|
|
4757104e45 | ||
|
|
95347cd868 | ||
|
|
9350a23b8f | ||
|
|
8ab1c2aa44 | ||
|
|
66187ec2dc | ||
|
|
b017d9b01d | ||
|
|
ee1eaf9fbb | ||
|
|
bafecffb7c | ||
|
|
d1f29d7bb1 | ||
|
|
d14b3a86cf | ||
|
|
9b137805c8 | ||
|
|
01672af8f0 | ||
|
|
902100a692 | ||
|
|
9b3df86e8d | ||
|
|
8fd65b9f16 | ||
|
|
abeb4bd2e5 | ||
|
|
929424032e | ||
|
|
acf13f82c1 | ||
|
|
3d0ab1236f | ||
|
|
c9aa94fc6f | ||
|
|
01e5a18c4a | ||
|
|
108633e1ab | ||
|
|
22aed399e7 | ||
|
|
91997ed31c | ||
|
|
e0f91d3c48 | ||
|
|
e28fc0f85e | ||
|
|
7a3c7ef930 | ||
|
|
b87aa1f67b | ||
|
|
4829b93fb2 | ||
|
|
ba4a1f2df2 | ||
|
|
adb79869df | ||
|
|
718f323edc | ||
|
|
4340c57ece | ||
|
|
9037bedb9e | ||
|
|
df54bca0a0 | ||
|
|
cf70755a05 | ||
|
|
fd4de85836 | ||
|
|
e5bd800aeb | ||
|
|
7e34d46573 | ||
|
|
b96e13a99d | ||
|
|
f25c5f09f0 | ||
|
|
d7d89bcf68 | ||
|
|
c902ad74f0 | ||
|
|
1ffbcc5ecf | ||
|
|
a000bdd93e | ||
|
|
de7d47c3fd | ||
|
|
d87fa22532 | ||
|
|
e74c4e0a45 | ||
|
|
d921a2a5ea | ||
|
|
b8624e7e08 | ||
|
|
d3aff0f6ee | ||
|
|
a0bf4ac47d | ||
|
|
807b49aa2f | ||
|
|
15b1e4ba9c | ||
|
|
244c9ff3c9 | ||
|
|
353f84c190 | ||
|
|
0e12954669 | ||
|
|
25363e0744 | ||
|
|
1543904d71 | ||
|
|
ea315a2e70 | ||
|
|
b02df6f4ac | ||
|
|
c6202789a4 | ||
|
|
48d6d5e531 | ||
|
|
e245e33f1f | ||
|
|
9a22911392 | ||
|
|
03724a70e9 | ||
|
|
c53f80fb23 | ||
|
|
d311622203 | ||
|
|
12a74c513d | ||
|
|
8f6394365c | ||
|
|
feff3512f4 | ||
|
|
06aa7a4d19 | ||
|
|
844788a4b8 | ||
|
|
591aba3c89 | ||
|
|
85255d9ee5 | ||
|
|
6bc04c0858 | ||
|
|
fd7cf8dd7c | ||
|
|
15cde2d531 | ||
|
|
3fd258f06b | ||
|
|
c8b294afa3 | ||
|
|
e9da242ed4 | ||
|
|
b732d8da35 | ||
|
|
b1b4afa64e | ||
|
|
ef18947e5a | ||
|
|
77c52275a1 | ||
|
|
c1a8854993 | ||
|
|
9e083d2de1 | ||
|
|
7cde1eb66b | ||
|
|
6f902a3177 | ||
|
|
f909ff9ed0 | ||
|
|
6435c3e962 | ||
|
|
290fc10af7 | ||
|
|
ea48c0c46a | ||
|
|
3510482971 | ||
|
|
fe7b5a3434 | ||
|
|
b87834a12d | ||
|
|
9395f0e6e2 | ||
|
|
2b4c2a2ff5 | ||
|
|
891dfed091 | ||
|
|
2d8ca548e2 | ||
|
|
3cc6655f3a | ||
|
|
24187f2e05 | ||
|
|
2b9e767822 | ||
|
|
84cdabcec0 | ||
|
|
2b6bafb269 | ||
|
|
d62fbbd5a8 | ||
|
|
0a6878cc02 | ||
|
|
7fe3b91c67 | ||
|
|
0dab84d065 | ||
|
|
db33d810f3 | ||
|
|
04c3f8403f |
No files matched your search
@@ -1,218 +0,0 @@
|
||||
PHP Coding Standards
|
||||
====================
|
||||
|
||||
|
||||
This file lists several standards that any programmer, adding or changing
|
||||
code in PHP, should follow. Since this file was added at a very late
|
||||
stage of the development of PHP v3.0, the code base does not (yet) fully
|
||||
follow it, but it's going in that general direction. Since we are now
|
||||
well into the version 4 releases, many sections have been recoded to use
|
||||
these rules.
|
||||
|
||||
|
||||
Code Implementation
|
||||
-------------------
|
||||
|
||||
[1] Functions that are given pointers to resources should not free them
|
||||
|
||||
For instance, function int mail(char *to, char *from) should NOT free
|
||||
to and/or from.
|
||||
Exceptions:
|
||||
|
||||
- The function's designated behavior is freeing that resource. E.g. efree()
|
||||
- The function is given a boolean argument, that controls whether or not
|
||||
the function may free its arguments (if true - the function must free its
|
||||
arguments, if false - it must not)
|
||||
- Low-level parser routines, that are tightly integrated with the token
|
||||
cache and the bison code for minimum memory copying overhead.
|
||||
|
||||
[2] Functions that are tightly integrated with other functions within the
|
||||
same module, and rely on each other non-trivial behavior, should be
|
||||
documented as such and declared 'static'. They should be avoided if
|
||||
possible.
|
||||
|
||||
[3] Use definitions and macros whenever possible, so that constants have
|
||||
meaningful names and can be easily manipulated. The only exceptions
|
||||
to this rule are 0 and 1, when used as false and true (respectively).
|
||||
Any other use of a numeric constant to specify different behavior
|
||||
or actions should be done through a #define.
|
||||
|
||||
[4] When writing functions that deal with strings, be sure to remember
|
||||
that PHP holds the length property of each string, and that it
|
||||
shouldn't be calculated with strlen(). Write your functions in a such
|
||||
a way so that they'll take advantage of the length property, both
|
||||
for efficiency and in order for them to be binary-safe.
|
||||
Functions that change strings and obtain their new lengths while
|
||||
doing so, should return that new length, so it doesn't have to be
|
||||
recalculated with strlen() (e.g. php_addslashes())
|
||||
|
||||
[5] Use php_error() to report any errors/warnings during code execution.
|
||||
Use descriptive error messages, and try to avoid using identical
|
||||
error strings for different stages of an error. For example,
|
||||
if in order to obtain a URL you have to parse the URL, connect,
|
||||
and retreive the text, assuming something can go wrong at each
|
||||
of these stages, don't report an error "Unable to get URL"
|
||||
on all of them, but instead, write something like "Unable
|
||||
to parse URL", "Unable to connect to URL server" and "Unable
|
||||
to fetch URL text", respectively.
|
||||
|
||||
[6] NEVER USE strncat(). If you're absolutely sure you know what you're doing,
|
||||
check its man page again, and only then, consider using it, and even then,
|
||||
try avoiding it.
|
||||
|
||||
|
||||
Naming Conventions
|
||||
------------------
|
||||
|
||||
[1] Function names for user-level functions should be enclosed with in
|
||||
the PHP_FUNCTION() macro. They should be in lowercase, with words
|
||||
underscore delimited, with care taken to minimize the letter count.
|
||||
Abbreviations should not be used when they greatly decrease the
|
||||
readability of the function name itself.
|
||||
|
||||
Good:
|
||||
'mcrypt_enc_self_test'
|
||||
'mysql_list_fields'
|
||||
|
||||
Ok:
|
||||
'mcrypt_module_get_algo_supported_key_sizes'
|
||||
(could be 'mcrypt_mod_get_algo_sup_key_sizes'?)
|
||||
'get_html_translation_table'
|
||||
(could be 'html_get_trans_table'?)
|
||||
|
||||
Bad:
|
||||
'hw_GetObjectByQueryCollObj'
|
||||
'pg_setclientencoding'
|
||||
'jf_n_s_i'
|
||||
|
||||
|
||||
[2] If they are part of a "parent set" of functions, that parent should
|
||||
be included in the user function name, and should be clearly related
|
||||
to the parent program or function family. This should be in the form
|
||||
of parent_*.
|
||||
|
||||
A family of 'foo' functions, for example:
|
||||
Good:
|
||||
'foo_select_bar'
|
||||
'foo_insert_baz'
|
||||
'foo_delete_baz'
|
||||
|
||||
Bad:
|
||||
'fooselect_bar'
|
||||
'fooinsertbaz'
|
||||
'delete_foo_baz'
|
||||
|
||||
[3] Function names used by user functions should be prefixed
|
||||
with "_php_", and followed by a word or an underscore-delimited list of
|
||||
words, in lowercase letters, that describes the function. If applicable,
|
||||
they should be declared 'static'.
|
||||
|
||||
[4] Variable names must be meaningful. One letter variable names must be
|
||||
avoided, except for places where the variable has no real meaning or
|
||||
a trivial meaning (e.g. for (i=0; i<100; i++) ...).
|
||||
|
||||
[5] Variable names should be in lowercase; Use underscores to seperate
|
||||
between words.
|
||||
|
||||
|
||||
Syntax and indentation
|
||||
----------------------
|
||||
|
||||
[1] Never use C++ style comments (i.e. // comment). Always use C-style
|
||||
comments instead. PHP is written in C, and is aimed at compiling
|
||||
under any ANSI-C compliant compiler. Even though many compilers
|
||||
accept C++-style comments in C code, you have to ensure that your
|
||||
code would compile with other compilers as well.
|
||||
The only exception to this rule is code that is Win32-specific,
|
||||
because the Win32 port is MS-Visual C++ specific, and this compiler
|
||||
is known to accept C++-style comments in C code.
|
||||
|
||||
[2] Use K&R-style. Of course, we can't and don't want to
|
||||
force anybody to use a style he or she is not used to, but,
|
||||
at the very least, when you write code that goes into the core
|
||||
of PHP or one of its standard modules, please maintain the K&R
|
||||
style. This applies to just about everything, starting with
|
||||
indentation and comment styles and up to function decleration
|
||||
syntax.
|
||||
|
||||
[3] Be generous with whitespace and braces. Always prefer:
|
||||
|
||||
if (foo) {
|
||||
bar;
|
||||
}
|
||||
|
||||
to:
|
||||
|
||||
if(foo)bar;
|
||||
|
||||
Keep one empty line between the variable decleration section and
|
||||
the statements in a block, as well as between logical statement
|
||||
groups in a block. Maintain at least one empty line between
|
||||
two functions, preferably two.
|
||||
|
||||
[4] When indenting, use the tab character. A tab is expected to represent
|
||||
four spaces. It is important to maintain consistency in indenture so
|
||||
that definitions, comments, and control structures line up correctly.
|
||||
|
||||
Documentation and Folding Hooks
|
||||
-------------------------------
|
||||
|
||||
In order to make sure that the online documentation stays in line with
|
||||
the code, each user-level function should have its user-level function
|
||||
prototype before it along with a brief one-line description of what the
|
||||
function does. It would look like this:
|
||||
|
||||
/* {{{ proto int abs(int number)
|
||||
Return the absolute value of the number */
|
||||
PHP_FUNCTION(abs)
|
||||
{
|
||||
...
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
The {{{ symbols are the default folding symbols for the folding mode in
|
||||
Emacs and vim (set fdm=marker). Folding is very useful when dealing with
|
||||
large files because you can scroll through the file quickly and just unfold
|
||||
the function you wish to work on. The }}} at the end of each function marks
|
||||
the end of the fold, and should be on a separate line.
|
||||
|
||||
The "proto" keyword there is just a helper for the doc/genfuncsummary script
|
||||
which generates a full function summary. Having this keyword in front of the
|
||||
function prototypes allows us to put folds elsewhere in the code without
|
||||
messing up the function summary.
|
||||
|
||||
Optional arguments are written like this:
|
||||
|
||||
/* {{{ proto object imap_header(int stream_id, int msg_no [, int from_length [, int subject_length [, string default_host]]])
|
||||
Returns a header object with the defined parameters. */
|
||||
|
||||
And yes, please keep the prototype on a single line, even if that line
|
||||
is massive.
|
||||
|
||||
New and Experimental Functions
|
||||
-----------------------------------
|
||||
To reduce the problems normally associated with the first public
|
||||
implementation of a new set of functions, it has been suggested
|
||||
that the first implementation include a file labeled 'EXPERIMENTAL'
|
||||
in the function directory, and that the functions follow the
|
||||
standard prefixing conventions during their initial implementation.
|
||||
|
||||
The file labelled 'EXPERIMENTAL' should include the following
|
||||
information:
|
||||
Any authoring infomration (known bugs, future directions of the module).
|
||||
Ongoing status notes which may not be appropriate for CVS comments.
|
||||
|
||||
Aliases & Legacy Documentation
|
||||
-----------------------------------
|
||||
You may also have some deprecated aliases with close to duplicate
|
||||
names, for example, somedb_select_result and somedb_selectresult. For
|
||||
documentation puposes, these will only be documented by the most
|
||||
current name, with the aliases listed in the documentation for
|
||||
the parent function. For ease of reference, user-functions with
|
||||
completely different names, that alias to the same function (such as
|
||||
highlight_file and show_source), will be separately documented. The
|
||||
proto should still be included, describing which function is aliased.
|
||||
|
||||
Backwards compatible functions and names should be maintained as long
|
||||
as the code can be reasonably be kept as part of the codebase. See
|
||||
/phpdoc/README for me information on documentation.
|
||||
@@ -1,2 +0,0 @@
|
||||
For the list of people who've put work into PHP 4.0, please see
|
||||
http://www.php.net/credits.php
|
||||
Binary file not shown.
Binary file not shown.
-426
@@ -1,426 +0,0 @@
|
||||
List of PHP maintainers
|
||||
=======================
|
||||
|
||||
Maintenance legend
|
||||
------------------
|
||||
Supported: Someone is actually paid to look after this.
|
||||
Maintained: Someone actually looks after it.
|
||||
Odd Fixes: It has a maintainer but they don't have time to do
|
||||
much other than throw the odd patch in. See below.
|
||||
Orphan: No current maintainer [but maybe you could take the
|
||||
role as you write your new code].
|
||||
Obsolete: Old code. Something tagged obsolete generally means
|
||||
it has been replaced by a better system and you
|
||||
should be using that.
|
||||
Unknown: Not known at this time.
|
||||
|
||||
Status legend
|
||||
-------------
|
||||
Working: Working under both Windows and Unix.
|
||||
Windows: Working only under Windows.
|
||||
Unix: Working only under Unix.
|
||||
Experimental: Under development or initial release.
|
||||
Not Working: Not working.
|
||||
Unknown: Status unknown.
|
||||
|
||||
|
||||
== Server APIs ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: aolserver
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: apache
|
||||
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cgi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: fhttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: isapi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: nsapi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: phttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pi3web
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: roxen
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: servlet
|
||||
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: thttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
== Database extensions ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dba
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dbase
|
||||
PRIMARY MAINTAINER: Jim Winstead <jimw@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: filepro
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: hyperwave
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: informix
|
||||
PRIMARY MAINTAINER: Danny Heijl <Danny.Heijl@cevi.be>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ingres_ii
|
||||
PRIMARY MAINTAINER: David Hénot <henot@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: interbase
|
||||
PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: msql
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mssql
|
||||
PRIMARY MAINTAINER: Frank M. Kromann <fmk@swwwing.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Tested on phpts and isapi versions
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mysql
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pgsql
|
||||
PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sybase
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Not Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sybase_ct
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: oci8
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: odbc
|
||||
PRIMARY MAINTAINER: Andreas Karajannis <Karajannis@gmd.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Working except for persistent connections
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: oracle
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Using the new OCI8 driver is encouraged where possible.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
== Other extensions ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: aspell
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
COMMENT: For aspell .27 and greater, check out the pspell extension
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: bcmath
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: bz2
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: calendar
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: com
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cpdf
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: crack
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.5
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: curl
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cybercash
|
||||
PRIMARY MAINTAINER: Evan Klinger <evan715@sirius.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: domxml
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dotnet
|
||||
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: exif
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: fdf
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ftp
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: gd
|
||||
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: gettext
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: gmp
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: icap
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Obsolete
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: imap
|
||||
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: java
|
||||
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ldap
|
||||
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mcal
|
||||
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mcrypt
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mhash
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: muscat
|
||||
PRIMARY MAINTAINER: Sam Liddicott <sam@ananova.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.5
|
||||
COMMENT: Not tested against windows, only core API completed, rest under development
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: openssl
|
||||
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pcre
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@ispi.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pdf
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pfpro
|
||||
PRIMARY MAINTAINER: David Croft <david@infotrek.co.uk>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: posix
|
||||
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: printer
|
||||
PRIMARY MAINTAINER: Daniel Beulshausen <daniel@php4win.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.4
|
||||
COMMENT: Only for Win32
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pspell
|
||||
PRIMARY MAINTAINER: Vlad Krupin <phpdevel@echospace.com>
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: qtdom
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: readline
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: recode
|
||||
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sablot
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: satellite
|
||||
PRIMARY MAINTAINER: David Eriksson <eriksson@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: session
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: shmop
|
||||
PRIMARY MAINTAINER: Unknown
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: snmp
|
||||
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sockets
|
||||
PRIMARY MAINTAINER: Chris Vandomelen <chrisv@b0rked.dhs.org>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: swf
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Depreciated (Use the ming swf extension instead)
|
||||
COMMENT: Only for Unix (won't change)
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sysvsem
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sysvshm
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: vpopmail
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.5
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: wddx
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@ispi.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xml
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: yaz
|
||||
PRIMARY MAINTAINER: Adam Dickmeiss <adam@indexdata.dk>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: yp
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: zlib
|
||||
PRIMARY MAINTAINER: Stefan Roehrich <sr@linux.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: zziplib
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.5
|
||||
-------------------------------------------------------------------------------
|
||||
# iptc?
|
||||
@@ -1,406 +0,0 @@
|
||||
Installation Instructions for PHP 4.0
|
||||
-------------------------------------
|
||||
|
||||
For the impatient here is a quick set of steps that will build PHP as
|
||||
first a dynamic Apache module (DSO) for Apache 1.3.x with MySQL support
|
||||
and then a static module. A more verbose explanation follows.
|
||||
|
||||
For installing PHP on other web servers, refer to one of the following
|
||||
files:
|
||||
|
||||
sapi/aolserver/README
|
||||
sapi/pi3web/README
|
||||
sapi/servlet/README
|
||||
sapi/thttpd/README
|
||||
README.Zeus
|
||||
|
||||
Note! Only install either the static module or the dynamic one. Do not
|
||||
install both.
|
||||
|
||||
Note 2! If you are recompiling PHP to add new extensions or upgrading
|
||||
something like GD, remove the config.cache file before you re-run
|
||||
configure.
|
||||
|
||||
Note 3! If you are on Linux and have installed shared libraries, make
|
||||
sure the location of these shared libraries are listed in your
|
||||
/etc/ld.so.conf file. For example, if you have:
|
||||
|
||||
/usr/local/lib/mysql/libmysqlclient.so
|
||||
|
||||
Make sure /etc/ld.so.conf contains:
|
||||
|
||||
/usr/local/lib/mysql
|
||||
|
||||
Then run ldconfig.
|
||||
|
||||
If you want both PHP 3 and 4 modules in the same Apache server, check the
|
||||
bottom of this file for instructions.
|
||||
|
||||
INSTALLATION WITH THE ZEUS WEB SERVER:
|
||||
--Please see the 'README.Zeus' file included in this distribution
|
||||
|
||||
|
||||
QUICK INSTALL (DSO)
|
||||
|
||||
For this to work your Apache httpd must have mod_so enabled.
|
||||
Check using httpd -l. You should see something like:
|
||||
|
||||
Compiled-in modules:
|
||||
http_core.c
|
||||
mod_so.c
|
||||
|
||||
Chances are you will see a lot more modules than these two. That's ok,
|
||||
as long as mod_so.c shows up you can proceed with the following steps:
|
||||
|
||||
$ gunzip -c php-4.0.x.tar.gz | tar xf -
|
||||
$ cd php-4.0.x
|
||||
$ ./configure --with-mysql --with-apxs
|
||||
$ make
|
||||
$ make install
|
||||
|
||||
If you get an error telling you that the apxs script could not be found,
|
||||
look for it on your system and if you find it, provide the full path to it
|
||||
as: --with-apxs=/path/to/apxs
|
||||
|
||||
Next you must copy php.ini-dist to the appropriate place (normally
|
||||
/usr/local/lib/php.ini) and edit it as necessary to set PHP options.
|
||||
|
||||
The only thing left to do is to edit your httpd.conf file and make sure the
|
||||
PHP 4 mime type is there and uncommented. You need a line that looks like
|
||||
this:
|
||||
|
||||
AddType application/x-httpd-php .php
|
||||
|
||||
Then restart your server (apachectl restart) and you should be able to
|
||||
serve up PHP files now. Make a test file called test.php and put some
|
||||
PHP tags in it. Like <?phpinfo()?>, for example.
|
||||
|
||||
|
||||
QUICK INSTALL (Static)
|
||||
|
||||
$ gunzip -c apache_1.3.x.tar.gz | tar xf -
|
||||
$ cd apache_1.3.x
|
||||
$ ./configure
|
||||
$ cd ..
|
||||
|
||||
$ gunzip -c php-4.0.x.tar.gz | tar xf -
|
||||
$ cd php-4.0.x
|
||||
$ ./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars
|
||||
$ make
|
||||
$ make install
|
||||
|
||||
$ cd ../apache_1.3.x
|
||||
$ ./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a
|
||||
(The above line is correct! Yes, we know libphp4.a does not exist at this
|
||||
stage. It isn't supposed to. It will be created.)
|
||||
$ make
|
||||
(you should now have an httpd binary which you can copy to your Apache bin dir if
|
||||
is is your first install then you need to "make install" as well)
|
||||
$ cd ../php-4.0.x
|
||||
$ cp php.ini-dist /usr/local/lib/php.ini
|
||||
You can edit /usr/local/lib/php.ini file to set PHP options.
|
||||
Edit your httpd.conf or srm.conf file and add:
|
||||
AddType application/x-httpd-php .php
|
||||
|
||||
|
||||
VERBOSE INSTALL
|
||||
|
||||
Chances are you are reading this because the quick install steps above
|
||||
did not work for you. If this is the case, congratulations, you are
|
||||
among the elite few that actually reads documentation. It really is
|
||||
not a difficult install and once you have done it once you will fly
|
||||
through it.
|
||||
|
||||
Installing PHP can be done in four simple steps:
|
||||
|
||||
1. Unpack your distribution file.
|
||||
|
||||
You will have downloaded a file named something like php-4.0.x.tar.gz.
|
||||
Unzip this file with a command like: gunzip php-4.0.x.tar.gz
|
||||
|
||||
Next you have to untar it with: tar -xvf php-4.0.x.tar
|
||||
|
||||
This will create a php-4.0.x directory. cd into this new directory.
|
||||
|
||||
2a. Configure PHP (Dynamic Module) - Skip to 2b if you wish to build
|
||||
a static module
|
||||
|
||||
You now have to choose the options you would like. There are quite
|
||||
a few of them. To see a list, type: ./configure --help
|
||||
|
||||
The only options that you are likely to want to use are the ones in
|
||||
the last section entitled, "--enable and --with options recognized:"
|
||||
|
||||
A popular choice is to build the Apache module version. In order to
|
||||
build PHP as a dynamic module for Apache-1.3.x you have to first have
|
||||
Apache installed. Assuming Apache is already installed, make sure
|
||||
the shared object module is enabled. To check this, type: httpd -l
|
||||
You should see something like:
|
||||
|
||||
Compiled-in modules:
|
||||
http_core.c
|
||||
mod_so.c
|
||||
|
||||
You will most likely have a lot more modules than what is shown here.
|
||||
As long as mod_so.c shows up in the list, PHP should be happy.
|
||||
|
||||
Now, type: ./configure --with-mysql --with-apxs
|
||||
|
||||
If you get an error telling you that the apxs script could not be found,
|
||||
look for it on your system and if you find it, provide the full path to it
|
||||
as: --with-apxs=/path/to/apxs
|
||||
|
||||
You might also want other flags on this configure line. --with-mysql
|
||||
is just an example.
|
||||
|
||||
There are a few things that can go wrong during this configure step.
|
||||
The most common is that you have asked for an option and that the
|
||||
configure script can not find the files required to enable this
|
||||
option in PHP. Chances are you can provide the full path to the
|
||||
base directory under which the related files were installed. For
|
||||
example, if you have installed the GD library in /opt/gd which means
|
||||
that /opt/gd/include has your GD header files and /opt/gd/lib contains
|
||||
your GD library files, you would use --with-gd=/opt/gd
|
||||
|
||||
Skip to step 3 for compilation and installation instructions.
|
||||
|
||||
2b. Configure PHP (Static Module) - Skip if you performed 2a
|
||||
|
||||
You now have to choose the options you would like. There are quite
|
||||
a few of them. To see a list, type: ./configure --help
|
||||
|
||||
The only options that you are likely to want to use are the ones in
|
||||
the last section entitled, "--enable and --with options recognized:"
|
||||
|
||||
A popular choice is to build the Apache module version. You need
|
||||
to know where the source code directory for your Apache server is
|
||||
located. Then use an option like: --with-apache=/usr/local/src/apache
|
||||
if that is your Apache source code directory. If you only specify
|
||||
--with-apache, then it will default to look for your Apache source
|
||||
in /usr/local/etc/httpd.
|
||||
|
||||
NOTE: The directory you specify should be the top-level of the
|
||||
unpacked Apache (or Stronghold) distribution. The configure program
|
||||
will automatically look for httpd.h in different directories under that
|
||||
location depending on which version of Apache, including Stronghold,
|
||||
you are running.
|
||||
|
||||
For MySQL support, since newer versions of MySQL installs its various
|
||||
components under /usr/local, this is the default. If you have
|
||||
changed the location you can specify it with: --with-mysql=/opt/local
|
||||
for example. Otherwise just use: --with-mysql
|
||||
|
||||
*NOTE* If you are using Apache 1.3b6 or later, you should run the
|
||||
Apache Configure script at least once before compiling PHP. It
|
||||
doesn't matter how you have Apache configured at this point.
|
||||
|
||||
Skip to step 3b at this point.
|
||||
|
||||
3. Compile and install the files. Simply type: make install
|
||||
|
||||
3a. Dynamic Module Installation
|
||||
|
||||
Nothing else is needed here. Proceed to step 4a.
|
||||
|
||||
3b. Static Module Installation
|
||||
|
||||
For the Apache module version this will copy the appropriate files
|
||||
to the src/modules/php4 directory in your Apache distribution if
|
||||
you are using Apache 1.3.x. If you are still running Apache 1.2.x
|
||||
these files will be copied directly to the main src directory.
|
||||
|
||||
For Apache 1.3b6 and later, you can use the new APACI configuration
|
||||
mechanism. To automatically build Apache with PHP support, use:
|
||||
|
||||
cd apache_1.3.x
|
||||
./configure --prefix=/<path>/apache \
|
||||
--activate-module=src/modules/php4/libphp4.a
|
||||
make
|
||||
make install
|
||||
|
||||
If you do not wish to use this new configuration tool, the old
|
||||
install procedure (src/Configure) will work fine.
|
||||
|
||||
If you are using the old Apache ./Configure script, you will have to
|
||||
edit the Apache src/Configuration file manually. If you do not have
|
||||
this file, copy Configuration.tmpl to Configuration.
|
||||
|
||||
For Apache 1.3.x add:
|
||||
|
||||
AddModule modules/php4/libphp4.a
|
||||
|
||||
For Apache 1.3.x don't do anything else. Just add this line and then
|
||||
run "./Configure" followed by "make".
|
||||
|
||||
For Apache 1.2.x add:
|
||||
|
||||
Module php4_module mod_php4.o
|
||||
|
||||
For Apache 1.2.x you will also have to look in the libphp4.module file,
|
||||
which was copied to the src directory. The EXTRA_LIBS line in the Apache
|
||||
Configuration file needs to be set to use the same libs as specified on
|
||||
the LIBS line in libphp4.module. You also need to make sure to add
|
||||
"-L." to the beginning of the EXTRA_LIBS line.
|
||||
|
||||
So, as an example, your EXTRA_LIBS line might look like:
|
||||
|
||||
EXTRA_LIBS=-L. -lphp4 -lgdbm -ldb -L/usr/local/mysql/lib -lmysqlclient
|
||||
|
||||
NOTE: You should not enclose the EXTRA_LIBS line in double-quotes, as it
|
||||
is in the libphp4.module file.
|
||||
|
||||
Also, look at the RULE_WANTHSREGEX setting in the libphp4.module file
|
||||
and set the WANTHSREGEX directive accordingly in your Configuration file.
|
||||
This last step applies to versions of Apache prior to 1.3b3.
|
||||
|
||||
This is a bit of a hassle, but should serve as incentive to move to
|
||||
Apache 1.3.x where this step has been eliminated.
|
||||
|
||||
Once you are satisfied with your Configuration settings, type: ./Configure
|
||||
If you get errors, chances are that you forgot a library or made a typo
|
||||
somewhere. Re-edit Configuration and try again. If it goes well,
|
||||
type: make
|
||||
|
||||
Assuming it compiles without errors, proceed to step 4b.
|
||||
|
||||
4a. Setting up the server. (Dynamic Module)
|
||||
|
||||
The make install command in step 3 should have done most of your
|
||||
work for you. It actually edits your httpd.conf file and tries to
|
||||
enable the dynamic PHP module. To verify this, look for a line that
|
||||
looks like this:
|
||||
|
||||
LoadModule php4_module libexec/libphp4.so
|
||||
|
||||
The actual path before the libphp4.so part might differ slightly. This
|
||||
is likely fine. If you are paranoid you can examine the output from the
|
||||
make install step to see where the libphp4.so file was actually put and
|
||||
place the full path to this file on this LoadModule line.
|
||||
|
||||
If somewhere in your httpd.conf file you have a ClearModuleList line
|
||||
then you also need this line:
|
||||
|
||||
AddModule mod_php4.c
|
||||
|
||||
And finally you need to tell Apache which file extension should trigger
|
||||
PHP. You do this by creating a special mime type and associating it
|
||||
with an extension. We suggest using:
|
||||
|
||||
AddType application/x-httpd-php .php
|
||||
|
||||
You are however free to use any extension you wish, including .html.
|
||||
|
||||
Note! If a line has a # at the beginning, then it is commented out
|
||||
and you need to remove the # for that line to take effect.
|
||||
|
||||
Finally you need to copy php.ini-dist to the appropriate place
|
||||
(normally /usr/local/lib/php.ini) and edit if necessary.
|
||||
|
||||
Once you have made these changes you should be ready to restart your
|
||||
server and try it out. Type: apachectl restart
|
||||
|
||||
4b. Setting up the server. (Static Module)
|
||||
|
||||
You should now have a new httpd binary. Shut down your existing server,
|
||||
if you have one, and copy this new binary overtop of it. Perhaps make
|
||||
a backup of your previous one first. Then edit your conf/httpd.conf file
|
||||
and add the line:
|
||||
|
||||
AddType application/x-httpd-php .php
|
||||
|
||||
There is also an interesting feature which can be quite instructive and
|
||||
helpful while debugging. That is the option of having colour syntax
|
||||
highlighting. To enable this, add the following line:
|
||||
|
||||
AddType application/x-httpd-php-source .phps
|
||||
|
||||
Any file ending in .phps will now be displayed with full colour syntax
|
||||
highlighting instead of being executed.
|
||||
|
||||
Note that on some older server setups, the AddType lines are in the
|
||||
conf/srm.conf file instead of conf/httpd.conf.
|
||||
|
||||
Note! If a line has a # at the beginning, then it is commented out
|
||||
and you need to remove the # for that line to take effect.
|
||||
|
||||
When you are finished making changes to your httpd.conf file, you need
|
||||
to copy php.ini-dist to the appropriate place (normally
|
||||
/usr/local/lib/php.ini) and edit if necessary. You can then
|
||||
start up your server.
|
||||
|
||||
5. Testing it all worked
|
||||
|
||||
Create a test file named test.php in your web tree somewhere and
|
||||
put some test PHP tags in it. <?phpinfo()?> is a good first test.
|
||||
This tag tells PHP to do a braindump and tells you all sorts of things
|
||||
about itself.
|
||||
|
||||
|
||||
WHY DISABLING -fPIC WORKS ON LINUX
|
||||
|
||||
From: Martin v. Loewis <martin@loewis.home.cs.tu-berlin.de>
|
||||
To: glibc-linux@ricardo.ecn.wfu.edu
|
||||
Subject: Re: Shared library -shared vs. -fpic
|
||||
|
||||
[In reply to Kaz Kylheku <kaz@ashi.footprints.net>]
|
||||
|
||||
> PIC stands for Position-Independent Code.
|
||||
|
||||
Correct.
|
||||
|
||||
> Code isn't position-independent (or ``relocatable'') cannot be
|
||||
> loaded at an arbitrary address;
|
||||
|
||||
Wrong.
|
||||
|
||||
> it requires some references to be patched at load time.
|
||||
|
||||
Correct.
|
||||
|
||||
> Shared libraries need to be relocatable because it's not known
|
||||
> beforehand what address they will be loaded at
|
||||
|
||||
Correct, depending on the meaning of "relocatable". PIC code typically
|
||||
does not contain relocations; that's why its position-independent.
|
||||
|
||||
> Just because you don't specify -fPIC doesn't mean that the compiler
|
||||
> won't emit position-independent code; the option prevents it from
|
||||
> emitting position-dependent code in situations where it otherwise
|
||||
> would.
|
||||
|
||||
Correct. However, a non-trivial shared library typically won't be
|
||||
position-independent unless explicitly compiled with
|
||||
-fPIC. Linux/glibc indeed does not require a shared library to be
|
||||
position-independent; instead, it will perform the relocations in the
|
||||
binary, even if they refer to code pages. As a result, those relocated
|
||||
pages won't be shared across processes, anymore.
|
||||
|
||||
Regards,
|
||||
Martin
|
||||
|
||||
USING PHP 3 AND PHP 4 AS CONCURRENT APACHE MODULES
|
||||
|
||||
Recent operating systems provide the ability to perform versioning and
|
||||
scoping. This features make it possible to let PHP 3 and PHP 4 run as
|
||||
concurrent modules in one Apache server.
|
||||
|
||||
This feature is known to work on the following platforms:
|
||||
|
||||
- Linux with recent binutils (binutils 2.9.1.0.25 tested)
|
||||
- Solaris 2.5 or better
|
||||
- FreeBSD (3.2, 4.0 tested)
|
||||
- IRIX64 6.5
|
||||
|
||||
To enable it, configure PHP 3 and PHP 4 to use APXS (--with-apxs) and the
|
||||
necessary link extensions (--enable-versioning). Otherwise, all standard
|
||||
installations instructions apply. For example:
|
||||
|
||||
$ ./configure \
|
||||
--with-apxs=/apache/bin/apxs \
|
||||
--enable-versioning \
|
||||
--with-mysql \
|
||||
--enable-track-vars
|
||||
|
||||
If this also works on your platform or if you know a way to do it, please
|
||||
report it to our bug database at http://bugs.php.net
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 2.02
|
||||
Copyright (c) 1999, 2000 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, is permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
3. The name "PHP" must not be used to endorse or promote products
|
||||
derived from this software without prior permission from the
|
||||
PHP Group. This does not apply to add-on libraries or tools
|
||||
that work in conjunction with PHP. In such a case the PHP
|
||||
name may be used to indicate that the product supports PHP.
|
||||
|
||||
4. The PHP Group may publish revised and/or new versions of the
|
||||
license from time to time. Each version will be given a
|
||||
distinguishing version number.
|
||||
Once covered code has been published under a particular version
|
||||
of the license, you may always continue to use it under the
|
||||
terms of that version. You may also choose to use such covered
|
||||
code under the terms of any subsequent version of the license
|
||||
published by the PHP Group. No one other than the PHP Group has
|
||||
the right to modify the terms applicable to covered code created
|
||||
under this License.
|
||||
|
||||
5. Redistributions of any form whatsoever must retain the following
|
||||
acknowledgment:
|
||||
"This product includes PHP, freely available from
|
||||
http://www.php.net/".
|
||||
|
||||
6. The software incorporates the Zend Engine, a product of Zend
|
||||
Technologies, Ltd. ("Zend"). The Zend Engine is licensed to the
|
||||
PHP Association (pursuant to a grant from Zend that can be
|
||||
found at http://www.php.net/license/ZendGrant/) for
|
||||
distribution to you under this license agreement, only as a
|
||||
part of PHP. In the event that you separate the Zend Engine
|
||||
(or any portion thereof) from the rest of the software, or
|
||||
modify the Zend Engine, or any portion thereof, your use of the
|
||||
separated or modified Zend Engine software shall not be governed
|
||||
by this license, and instead shall be governed by the license
|
||||
set forth at http://www.zend.com/license/ZendLicense/.
|
||||
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
|
||||
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
|
||||
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--------------------------------------------------------------------
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals on behalf of the PHP Group.
|
||||
|
||||
The PHP Group can be contacted via Email at group@php.net.
|
||||
|
||||
For more information on the PHP Group and the PHP project,
|
||||
please see <http://www.php.net>.
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
|
||||
ZEND_DIR = $(srcdir)/Zend
|
||||
SUBDIRS = Zend main ext sapi $(TSRM_DIR) $(REGEX_DIR) . $(PEAR_DIR)
|
||||
|
||||
LTLIBRARY_NAME = libphp4.la
|
||||
LTLIBRARY_SOURCES = stub.c
|
||||
|
||||
LTLIBRARY_DEPENDENCIES = \
|
||||
Zend/libZend.la \
|
||||
sapi/$(PHP_SAPI)/libsapi.la \
|
||||
main/libmain.la \
|
||||
$(REGEX_LIB) \
|
||||
$(EXT_LTLIBS) \
|
||||
$(TSRM_LIB)
|
||||
|
||||
LTLIBRARY_LDFLAGS = -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS)
|
||||
LTLIBRARY_LIBADD = $(LTLIBRARY_DEPENDENCIES) $(EXTRA_LIBS)
|
||||
|
||||
PROGRAM_NAME = php
|
||||
PROGRAM_SOURCES = stub.c
|
||||
PROGRAM_LDADD = libphp4.la $(EXT_PROGRAM_LDADD)
|
||||
PROGRAM_LDFLAGS = -export-dynamic
|
||||
PROGRAM_DEPENDENCIES = $(PROGRAM_LDADD)
|
||||
|
||||
targets = $(LTLIBRARY_NAME) $(PHP_PROGRAM)
|
||||
|
||||
install_targets = install-sapi install-modules
|
||||
|
||||
include $(top_srcdir)/build/rules.mk
|
||||
include $(top_srcdir)/build/library.mk
|
||||
include $(top_srcdir)/build/program.mk
|
||||
|
||||
install-sapi:
|
||||
@$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
|
||||
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
|
||||
-@if test ! -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); then \
|
||||
for i in 0.0.0 0.0 0; do \
|
||||
if test -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME).$$i; then \
|
||||
$(LN_S) $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME).$$i $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); \
|
||||
break; \
|
||||
fi; \
|
||||
done; \
|
||||
fi
|
||||
$(INSTALL_IT)
|
||||
|
||||
install-modules:
|
||||
@test -d modules && \
|
||||
$(mkinstalldirs) $(INSTALL_ROOT)$(moduledir) && \
|
||||
echo "installing shared modules into $(moduledir)" && \
|
||||
rm -f modules/*.la && \
|
||||
cp modules/* $(INSTALL_ROOT)$(moduledir) >/dev/null 2>&1 || true
|
||||
|
||||
install-tester:
|
||||
-$(mkinstalldirs) $(datadir)
|
||||
$(INSTALL) -m 755 $(srcdir)/run-tests.php $(INSTALL_ROOT)$(datadir)
|
||||
|
||||
install-pear: install-modules
|
||||
(cd pear && $(MAKE) install)
|
||||
|
||||
install-su: install-pear install-tester
|
||||
|
||||
.NOEXPORT:
|
||||
@@ -1,105 +0,0 @@
|
||||
This is the first file you should be reading after you get your CVS account.
|
||||
We'll assume you're basically familiar with CVS, but feel free to post
|
||||
your questions on the mailing list.
|
||||
|
||||
PHP is developed through the efforts of a large number of people.
|
||||
Collaboration is a Good Thing(tm), and CVS lets us do this. Thus, following
|
||||
some basic rules with regards to CVS usage will:
|
||||
|
||||
a. Make everybody happier, especially those responsible for maintaining
|
||||
the CVS itself.
|
||||
b. Keep the changes consistently well documented and easily trackable.
|
||||
c. Prevent some of those 'Oops' moments.
|
||||
d. Increase the general level of good will on planet Earth.
|
||||
|
||||
|
||||
Having said that, here are the organizational rules:
|
||||
|
||||
1. Respect other people working on the project.
|
||||
|
||||
2. Discuss any significant changes on the list before committing.
|
||||
|
||||
3. Look at EXTENSIONS file to see who is the primary maintainer of
|
||||
the code you want to contribute to.
|
||||
|
||||
4. If you "strongly disagree" about something another person did, don't
|
||||
start fighting publicly - take it up in private email.
|
||||
|
||||
5. If you don't know how to do something, ask first!
|
||||
|
||||
6. Test your changes before committing them. We mean it. Really.
|
||||
|
||||
|
||||
The next few rules are more of a technical nature.
|
||||
|
||||
1. DO NOT TOUCH ChangeLog! It is automagically updated from the commit
|
||||
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.
|
||||
|
||||
3. Do not commit multiple file and dump all messages in one commit. If you
|
||||
modified several unrelated files, commit each group separately and
|
||||
provide a nice commit message for each one. See example below.
|
||||
|
||||
4. Do write your commit message in such a way that it makes sense even
|
||||
without the corresponding diff. One should be able to look at it, and
|
||||
immediately know what was modified. Definitely include the function name
|
||||
in the message as shown below.
|
||||
|
||||
5. In your commit messages, keep each line shorter than 80 characters. And
|
||||
try to align your lines vertically, if they wrap. It looks bad otherwise.
|
||||
|
||||
6. If you modified a function that is callable from PHP, prepend PHP to
|
||||
the function name as shown below.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
a memory leak in php_trim(). Don't commit both of these at once. Commit them
|
||||
separately and try to make sure your commit messages look something like the
|
||||
following.
|
||||
|
||||
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!
|
||||
@- Memory leak in trim() function has finally been fixed. (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.
|
||||
|
||||
If you don't see your messages in ChangeLog and NEWS 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.
|
||||
|
||||
You can use LXR (http://lxr.php.net/) and Bonsai (http://bonsai.php.net/)
|
||||
to look at PHP CVS repository in various ways.
|
||||
|
||||
To receive daily updates to ChangeLog and NEWS, send an empty message to
|
||||
php-cvs-daily-subscribe@lists.php.net.
|
||||
|
||||
Happy hacking,
|
||||
|
||||
PHP Team
|
||||
-184
@@ -1,184 +0,0 @@
|
||||
|
||||
WHAT IT IS
|
||||
|
||||
It's a tool for automatically creating the basic framework for a PHP module
|
||||
and writing C code handling arguments passed to your functions from a simple
|
||||
configuration file. See an example at the end of this file.
|
||||
|
||||
HOW TO USE IT
|
||||
|
||||
Very simple. First, cd do directory ext/ in PHP 4 sources. If you just need
|
||||
the basic framework and will be writing all the code in your functions
|
||||
yourself, you can now do
|
||||
|
||||
./ext_skel --extname=module_name
|
||||
|
||||
and everything you need is placed in directory module_name. In fact, if you
|
||||
don't need to test the existence of any external header files, libraries or
|
||||
functions in them, the module is already almost ready to be compiled in PHP.
|
||||
Just remove 3 comments in your_module_name/config.m4, cd back up to PHP
|
||||
sources top directory, and do
|
||||
|
||||
./buildconf; ./configure --enable-module_name; make
|
||||
|
||||
But if you already have planned the overall scheme of your module, what
|
||||
functions it will contain, their return types and the arguments they take
|
||||
(a very good idea) and don't want to bother yourself with creating function
|
||||
definitions and handling arguments passed yourself, it's time to create a
|
||||
function definitions file, which you will give as an argument to ext_skel
|
||||
with option
|
||||
|
||||
--proto=filename.
|
||||
|
||||
FORMAT OF FUNCTION DEFINITIONS FILE
|
||||
|
||||
All the definitions must be on one line. In it's simplest form, it's just
|
||||
the function name, ie.
|
||||
|
||||
my_function
|
||||
|
||||
but then you'll be left with an almost empty function body without any
|
||||
argument handling.
|
||||
|
||||
Arguments are given in parenthesis after the function name, and are of
|
||||
the form 'argument_type argument_name'. Arguments are separated from each
|
||||
other with a comma and optional space. Argument_type can be one of int,
|
||||
bool, double, float, string, array, object or mixed.
|
||||
|
||||
An optional argument is separated from the previous by an optional space,
|
||||
then '[' and of course comma and optional space, like all the other
|
||||
arguments. You should close a row of optional arguments with same amount of
|
||||
']'s as there where '['s. Currently, it does not harm if you forget to do it
|
||||
or there is a wrong amount of ']'s, but this may change in the future.
|
||||
|
||||
An additional short description may be added after the parameters.
|
||||
If present it will be filled into the 'proto' header comments in the stubs
|
||||
code and the <refpurpose> tag in the XML documentation.
|
||||
|
||||
An example:
|
||||
|
||||
my_function(int arg1, int arg2 [, int arg3 [, int arg4]]) this is my 1st
|
||||
|
||||
Arguments arg3 and arg4 are optional.
|
||||
|
||||
If possible, the function definition should also contain it's return type
|
||||
in front of the definition. It's not actually used for any C code generating
|
||||
purposes but PHP in-source documentation instead, and as such, very useful.
|
||||
It can be any of int, double, string, bool, array, object, resource, mixed
|
||||
or void.
|
||||
|
||||
The file must contain nothing else but function definitions, no comments or
|
||||
empty lines.
|
||||
|
||||
OTHER OPTIONS
|
||||
|
||||
--no-help
|
||||
|
||||
By default, ext_skel creates both comments in the source code and a test
|
||||
function to help first time module writers to get started and testing
|
||||
configuring and compiling their module. This option turns off all such things
|
||||
which may just annoy experienced PHP module coders. Especially useful with
|
||||
|
||||
--stubs=file
|
||||
|
||||
which will leave out also all module specific stuff and write just function
|
||||
stubs with function value declarations and passed argument handling, and
|
||||
function entries and definitions at the end of the file, for copying and
|
||||
pasting into an already existing module.
|
||||
|
||||
--assign-params
|
||||
--string-lens
|
||||
|
||||
By default, function proto 'void foo(string bar)' creates the following:
|
||||
...
|
||||
zval **bar;
|
||||
... (zend_get_parameters_ex() called in the middle...)
|
||||
convert_to_string_ex(bar);
|
||||
|
||||
Specifying both of these options changes the generated code to:
|
||||
...
|
||||
zval **bar_arg;
|
||||
int bar_len;
|
||||
char *bar = NULL;
|
||||
... (zend_get_parameters_ex() called in the middle...)
|
||||
convert_to_string_ex(bar_arg);
|
||||
bar = Z_STRVAL_PP(bar_arg);
|
||||
bar_len = Z_STRLEN_PP(bar_arg);
|
||||
|
||||
You shouldn't have to ask what happens if you leave --string-lens out. If you
|
||||
have to, it's questionable whether you should be reading this document.
|
||||
|
||||
--with-xml[=file]
|
||||
|
||||
Creates the basics for phpdoc .xml file.
|
||||
|
||||
--full-xml
|
||||
|
||||
Not implemented yet. When or if there will ever be created a framework for
|
||||
self-contained extensions to use phpdoc system for their documentation, this
|
||||
option enables it on the created xml file.
|
||||
|
||||
CURRENT LIMITATIONS, BUGS AND OTHER ODDITIES
|
||||
|
||||
Only arguments of types int, bool, double, float, string and array are
|
||||
handled. For other types you must write the code yourself. And for type
|
||||
mixed, it wouldn't even be possible to write anything, because only you
|
||||
know what to expect.
|
||||
|
||||
It can't handle correctly, and probably never will, variable list of
|
||||
of arguments. (void foo(int bar [, ...])
|
||||
|
||||
Don't trust the generated code too much. It tries to be useful in most of
|
||||
the situations you might encounter, but automatic code generation will never
|
||||
beat a programmer who knows the real situation at hand. ext_skel is generally
|
||||
best suited for quickly generating a wrapper for c-library functions you
|
||||
might want to have available in PHP too.
|
||||
|
||||
This program doesn't have a --help option. It has --no-help instead.
|
||||
|
||||
EXAMPLE
|
||||
|
||||
The following _one_ line
|
||||
|
||||
bool my_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
|
||||
will create this function definition for you (note that there are a few
|
||||
question marks to be replaced by you, and you must of course add your own
|
||||
value definitions too):
|
||||
|
||||
/* {{{ proto bool my_drawtext(resource image, string text, resource font, int x, int y[, int color])
|
||||
*/
|
||||
PHP_FUNCTION(my_drawtext)
|
||||
{
|
||||
zval **image, **text, **font, **x, **y, **color;
|
||||
int argc;
|
||||
int image_id = -1;
|
||||
int font_id = -1;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
if (argc < 5 || argc > 6 || zend_get_parameters_ex(argc, &image, &text, &font, &x, &y, &color) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(???, ???, image, image_id, "???", ???_rsrc_id);
|
||||
ZEND_FETCH_RESOURCE(???, ???, font, font_id, "???", ???_rsrc_id);
|
||||
|
||||
switch (argc) {
|
||||
case 6:
|
||||
convert_to_long_ex(color);
|
||||
/* Fall-through. */
|
||||
case 5:
|
||||
convert_to_long_ex(y);
|
||||
convert_to_long_ex(x);
|
||||
/* font: fetching resources already handled. */
|
||||
convert_to_string_ex(text);
|
||||
/* image: fetching resources already handled. */
|
||||
break;
|
||||
default:
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
php_error(E_WARNING, "my_drawtext: not yet implemented");
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
QNX4 Installation Notes
|
||||
-----------------------
|
||||
|
||||
NOTE: General installation instructions are in the INSTALL file
|
||||
|
||||
|
||||
1. To compile and test PHP3 you have to grab, compile and install:
|
||||
- GNU dbm library or another db library;
|
||||
- GNU bison (1.25 or later; 1.25 tested);
|
||||
- GNU flex (any version supporting -o and -P options; 2.5.4 tested);
|
||||
- GNU diffutils (any version supporting -w option; 2.7 tested);
|
||||
|
||||
2. To use CVS version you may need also:
|
||||
- GNU CVS (1.9 tested);
|
||||
- GNU autoconf (2.12 tested);
|
||||
- GNU m4 (1.3 or later preferable; 1.4 tested);
|
||||
|
||||
3. To run configure define -lunix in command line:
|
||||
LDFLAGS=-lunix ./configure
|
||||
|
||||
4. To use Sybase SQL Anywhere define ODBC_QNX and CUSTOM_ODBC_LIBS in
|
||||
command line and run configure with --with-custom-odbc:
|
||||
CFLAGS=-DODBC_QNX LDFLAGS=-lunix CUSTOM_ODBC_LIBS="-ldblib -lodbc" ./configure --with-custom-odbc=/usr/lib/sqlany50
|
||||
If you have SQL Anywhere version 5.5.00, then you have to add
|
||||
CFLAGS=-DSQLANY_BUG
|
||||
to workaround its SQLFreeEnv() bug. Other versions has not been tested,
|
||||
so try without this flag first.
|
||||
|
||||
5. To build the Apache module, you may have to hardcode an include path for
|
||||
alloc.h in your Apache base directory:
|
||||
- APACHE_DIRECTORY/src/httpd.h:
|
||||
change #include "alloc.h"
|
||||
to #include "APACHE_DIRECTORY/src/alloc.h"
|
||||
Unless you want to use system regex library, you have to hardcode also
|
||||
a path to regex.h:
|
||||
- APACHE_DIRECTORY/src/conf.h:
|
||||
change #include <regex.h>
|
||||
to #include "APACHE_DIRECTORY/src/regex/regex.h"
|
||||
I don't know so far why this required for QNX, may be it is Watcom
|
||||
compiler problem.
|
||||
|
||||
If you building Apache module with SQL Anywhere support, you'll get
|
||||
symbol conflict with BOOL. It is defined in Apache (httpd.h) and in
|
||||
SQL Anywhere (odbc.h). This has nothing to do with PHP, so you have to
|
||||
fix it yourself someway.
|
||||
|
||||
6. With above precautions, it should compile as is and pass regression
|
||||
tests completely:
|
||||
make
|
||||
make check
|
||||
make install
|
||||
|
||||
Don't bother me unless you really sure you made that all but it
|
||||
still doesn't work.
|
||||
|
||||
June 28, 1998
|
||||
Igor Kovalenko -- owl@infomarket.ru
|
||||
@@ -1,174 +0,0 @@
|
||||
$Id$
|
||||
=============================================================================
|
||||
|
||||
HOW TO CREATE A SELF-CONTAINED PHP EXTENSION
|
||||
|
||||
A self-contained extension can be distributed independently of
|
||||
the PHP source. To create such an extension, three things are
|
||||
required:
|
||||
|
||||
- Makefile template (Makefile.in)
|
||||
- Configuration file (config.m4)
|
||||
- Source code for your module
|
||||
|
||||
We will describe now how to create these and how to put things
|
||||
together.
|
||||
|
||||
PREPARING YOUR SYSTEM
|
||||
|
||||
While the result will run on any system, a developer's setup needs these
|
||||
tools:
|
||||
|
||||
GNU autoconf
|
||||
GNU automake
|
||||
GNU libtool
|
||||
GNU m4
|
||||
|
||||
All of these are available from
|
||||
|
||||
ftp://ftp.gnu.org/pub/gnu/
|
||||
|
||||
CONVERTING AN EXISTING EXTENSION
|
||||
|
||||
Just to show you how easy it is to create a self-contained
|
||||
extension, we will convert an embedded extension into a
|
||||
self-contained one. Install PHP and execute the following
|
||||
commands.
|
||||
|
||||
$ mkdir /tmp/newext
|
||||
$ cd /tmp/newext
|
||||
|
||||
You now have an empty directory. We will copy the files from
|
||||
the mysql extension:
|
||||
|
||||
$ cp -rp php-4.0.X/ext/mysql/* .
|
||||
|
||||
It is time to finish the module. Run:
|
||||
|
||||
$ phpize
|
||||
|
||||
You can now ship the contents of the directory - the extension
|
||||
can live completely on its own.
|
||||
|
||||
The user instructions boil down to
|
||||
|
||||
$ ./configure \
|
||||
[--with-php-config=/path/to/php-config] \
|
||||
[--with-mysql=MYSQL-DIR]
|
||||
$ make install
|
||||
|
||||
The MySQL module will either use the embedded MySQL client
|
||||
library or the MySQL installation in MYSQL-DIR.
|
||||
|
||||
|
||||
DEFINING THE NEW EXTENSION
|
||||
|
||||
Our demo extension is called "foobar".
|
||||
|
||||
It consists of two source files "foo.c" and "bar.c"
|
||||
(and any arbitrary amount of header files, but that is not
|
||||
important here).
|
||||
|
||||
The demo extension does not reference any external
|
||||
libraries (that is important, because the user does not
|
||||
need to specify anything).
|
||||
|
||||
|
||||
CREATING THE MAKEFILE TEMPLATE
|
||||
|
||||
The Makefile Template (Makefile.in) contains three lines:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
LTLIBRARY_SHARED_NAME = foobar.la
|
||||
LTLIBRARY_SOURCES = foo.c bar.c
|
||||
|
||||
include $(top_srcdir)/build/dynlib.mk
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
LTLIBRARY_SHARED_NAME specifies the name of the extension.
|
||||
It must be of the form `ext-name.la'.
|
||||
|
||||
LTLIBRARY_SOURCES specifies the names of the sources files. You can
|
||||
name an arbitrary number of source files here.
|
||||
|
||||
The final include directive includes the build rules (you usually
|
||||
don't need to care about what happens there). rules.mk and other
|
||||
files are installed by phpize which we will cover later.
|
||||
|
||||
|
||||
CREATING THE M4 CONFIGURATION FILE
|
||||
|
||||
The m4 configuration can perform additional checks. For a
|
||||
self-contained extension, you do not need more than a few
|
||||
macro calls.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PHP_ARG_ENABLE(foobar,whether to enable foobar,
|
||||
[ --enable-foobar Enable foobar])
|
||||
|
||||
if test "$PHP_FOOBAR" != "no"; then
|
||||
PHP_EXTENSION(foobar, $ext_shared)
|
||||
fi
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PHP_ARG_ENABLE will automatically set the correct variables, so
|
||||
that the extension will be enabled by PHP_EXTENSION in shared mode.
|
||||
|
||||
Please use always PHP_ARG_ENABLE or PHP_ARG_WITH. Even if you do not
|
||||
plan to distribute your module with PHP, these facilities allow you
|
||||
to integrate your module easily into the main PHP module framework.
|
||||
|
||||
CREATING SOURCE FILES
|
||||
|
||||
ext_skel can be of great help when creating the common code for all modules
|
||||
in PHP for you and also writing basic function definitions and C code for
|
||||
handling arguments passed to your functions. See README.EXT_SKEL for further
|
||||
information.
|
||||
|
||||
As for the rest, you are currently alone here. There are a lot of existing
|
||||
modules, use a simple module as a starting point and add your own code.
|
||||
|
||||
|
||||
CREATING THE SELF-CONTAINED EXTENSION
|
||||
|
||||
Put Makefile.in, config.m4 and the source files into one directory.
|
||||
Then run phpize (this is installed during make install by PHP 4.0).
|
||||
For example, if you configured PHP with --prefix=/php, you would run
|
||||
|
||||
$ /php/bin/phpize
|
||||
|
||||
This will automatically copy the necessary build files and create
|
||||
configure from your config.m4.
|
||||
|
||||
And that's it. You now have a self-contained extension.
|
||||
|
||||
INSTALLING A SELF-CONTAINED EXTENSION
|
||||
|
||||
An extension can be installed by running:
|
||||
|
||||
$ ./configure \
|
||||
[--with-php-config=/path/to/php-config]
|
||||
$ make install
|
||||
|
||||
ADDING SHARED MODULE SUPPORT TO A MODULE
|
||||
|
||||
In order to be useful, a self-contained extension must be loadable
|
||||
as a shared module. I will explain now how you can add shared module
|
||||
support to an existing module called foo.
|
||||
|
||||
1. In config.m4, use PHP_ARG_WITH/PHP_ARG_ENABLE. Then you will
|
||||
automatically be able to use --with-foo=shared or
|
||||
--enable-foo=shared.
|
||||
|
||||
2. In config.m4, use PHP_EXTENSION(foo, $ext_shared) to enable
|
||||
building the extension.
|
||||
|
||||
3. Add the following line to Makefile.in:
|
||||
|
||||
LTLIBRARY_SHARED_NAME = foo.la
|
||||
|
||||
4. Add the following lines to your C source file:
|
||||
|
||||
#ifdef COMPILE_DL_FOO
|
||||
ZEND_GET_MODULE(foo)
|
||||
#endif
|
||||
-243
@@ -1,243 +0,0 @@
|
||||
An Overview of the PHP Streams abstraction
|
||||
==========================================
|
||||
$Id$
|
||||
|
||||
Please send comments to: Wez Furlong <wez@thebrainroom.com>
|
||||
|
||||
Note: this doc is preliminary and is intended to give the reader an idea of
|
||||
how streams work and should be used.
|
||||
|
||||
Why Streams?
|
||||
============
|
||||
You may have noticed a shed-load of issock parameters flying around the PHP
|
||||
code; we don't want them - they are ugly and cumbersome and force you to
|
||||
special case sockets and files everytime you need to work with a "user-level"
|
||||
PHP file pointer.
|
||||
Streams take care of that and present the PHP extension coder with an ANSI
|
||||
stdio-alike API that looks much nicer and can be extended to support non file
|
||||
based data sources.
|
||||
|
||||
Using Streams
|
||||
=============
|
||||
Streams use a php_stream* parameter just as ANSI stdio (fread etc.) use a
|
||||
FILE* parameter.
|
||||
|
||||
The main functions are:
|
||||
|
||||
PHPAPI size_t php_stream_read(php_stream * stream, char * buf, size_t count);
|
||||
PHPAPI size_t php_stream_write(php_stream * stream, const char * buf, size_t
|
||||
count);
|
||||
PHPAPI int php_stream_eof(php_stream * stream);
|
||||
PHPAPI int php_stream_getc(php_stream * stream);
|
||||
PHPAPI char *php_stream_gets(php_stream * stream, char *buf, size_t maxlen);
|
||||
PHPAPI int php_stream_close(php_stream * stream);
|
||||
PHPAPI int php_stream_flush(php_stream * stream);
|
||||
PHPAPI int php_stream_seek(php_stream * stream, off_t offset, int whence);
|
||||
PHPAPI off_t php_stream_tell(php_stream * stream);
|
||||
|
||||
These (should) behave in the same way as the ANSI stdio functions with similar
|
||||
names: fread, fwrite, feof, fgetc, fgets, fclose, fflush, fseek, ftell.
|
||||
|
||||
Opening Streams
|
||||
===============
|
||||
Ultimately, I aim to implement an fopen_wrapper-like call to do this with
|
||||
minimum fuss.
|
||||
Currently, mostly for testing purposes, you can use php_stream_fopen to open a
|
||||
stream on a regular file.
|
||||
|
||||
PHPAPI php_stream * php_stream_fopen(const char * filename, const char *
|
||||
mode);
|
||||
|
||||
This call behaves just like fopen(), except it returns a stream instead of a
|
||||
FILE *
|
||||
|
||||
Casting Streams
|
||||
===============
|
||||
What if your extension needs to access the FILE* of a user level file pointer?
|
||||
You need to "cast" the stream into a FILE*, and this is how you do it:
|
||||
|
||||
FILE * fp;
|
||||
php_stream * stream; /* already opened */
|
||||
|
||||
if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, &fp, 1) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
The prototype is:
|
||||
|
||||
PHPAPI int php_stream_cast(php_stream * stream, int castas, void ** ret, int
|
||||
show_err);
|
||||
|
||||
The show_err parameter, if non-zero, will cause the function to display an
|
||||
appropriate error message of type E_WARNING if the cast fails.
|
||||
|
||||
castas can be one of the following values:
|
||||
PHP_STREAM_AS_STDIO - a stdio FILE*
|
||||
PHP_STREAM_AS_FD - a generic file descriptor
|
||||
PHP_STREAM_AS_SOCKETD - a socket descriptor
|
||||
|
||||
If you ask a socket stream for a FILE*, the abstraction will use fdopen to
|
||||
create it for you. Be warned that doing so may cause buffered data to be lost
|
||||
if you mix ANSI stdio calls on the FILE* with php stream calls on the stream.
|
||||
|
||||
If your system has the fopencookie function, php streams can synthesize a
|
||||
FILE* on top of any stream, which is useful for SSL sockets, memory based
|
||||
streams, data base streams etc. etc.
|
||||
NOTE: There might be situations where this is not desireable, and we need to
|
||||
provide a flag to inform the casting routine of this.
|
||||
|
||||
You can use:
|
||||
|
||||
PHPAPI int php_stream_can_cast(php_stream * stream, int castas)
|
||||
|
||||
to find out if a stream can be cast, without actually performing the cast, so
|
||||
to check if a stream is a socket you might use:
|
||||
|
||||
if (php_stream_can_cast(stream, PHP_STREAM_AS_SOCKETD) == SUCCESS) {
|
||||
/* it's a socket */
|
||||
}
|
||||
|
||||
|
||||
Stream Internals
|
||||
================
|
||||
|
||||
There are two main structures associated with a stream - the php_stream
|
||||
itself, which holds some state information (and possibly a buffer) and a
|
||||
php_stream_ops structure, which holds the "virtual method table" for the
|
||||
underlying implementation.
|
||||
|
||||
The php_streams ops struct consists of pointers to methods that implement
|
||||
read, write, close, flush, seek, gets and cast operations. Of these, an
|
||||
implementation need only implement write, read, close and flush. The gets
|
||||
method is intended to be used for non-buffered streams if there is an
|
||||
underlying method that can efficiently behave as fgets. The ops struct also
|
||||
contains a label for the implementation that will be used when printing error
|
||||
messages - the stdio implementation has a label of "STDIO" for example.
|
||||
|
||||
The idea is that a stream implementation defines a php_stream_ops struct, and
|
||||
associates it with a php_stream using php_stream_alloc.
|
||||
|
||||
As an example, the php_stream_fopen() function looks like this:
|
||||
|
||||
PHPAPI php_stream * php_stream_fopen(const char * filename, const char * mode)
|
||||
{
|
||||
FILE * fp = fopen(filename, mode);
|
||||
php_stream * ret;
|
||||
|
||||
if (fp) {
|
||||
ret = php_stream_alloc(&php_stream_stdio_ops, fp, 0, 0, mode);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
php_stream_stdio_ops is a php_stream_ops structure that can be used to handle
|
||||
FILE* based streams.
|
||||
|
||||
A socket based stream would use code similar to that above to create a stream
|
||||
to be passed back to fopen_wrapper (or it's yet to be implemented successor).
|
||||
|
||||
The prototype for php_stream_alloc is this:
|
||||
|
||||
PHPAPI php_stream * php_stream_alloc(php_stream_ops * ops, void * abstract,
|
||||
size_t bufsize, int persistent, const char * mode)
|
||||
|
||||
ops is a pointer to the implementation,
|
||||
abstract holds implementation specific data that is relevant to this instance
|
||||
of the stream,
|
||||
bufsize is the size of the buffer to use - if 0, then buffering at the stream
|
||||
level will be disabled (recommended for underlying sources that implement
|
||||
their own buffering - such a FILE*),
|
||||
persistent controls how the memory is to be allocated - persistently so that
|
||||
it lasts across requests, or non-persistently so that it is freed at the end
|
||||
of a request (it uses pemalloc),
|
||||
mode is the stdio-like mode of operation - php streams places no real meaning
|
||||
in the mode parameter, except that it checks for a 'w' in the string when
|
||||
attempting to write (this may change).
|
||||
|
||||
The mode parameter is passed on to fdopen/fopencookie when the stream is cast
|
||||
into a FILE*, so it should be compatible with the mode parameter of fopen().
|
||||
|
||||
Writing your own stream implementation
|
||||
======================================
|
||||
|
||||
First, you need to figure out what data you need to associate with the
|
||||
php_stream. For example, you might need a pointer to some memory for memory
|
||||
based streams, or if you were making a stream to read data from an RDBMS like
|
||||
mysql, you might want to store the connection and rowset handles.
|
||||
|
||||
The stream has a field called abstract that you can use to hold this data.
|
||||
If you need to store more than a single field of data, define a structure to
|
||||
hold it, allocate it (use pemalloc with the persistent flag set
|
||||
appropriately), and use the abstract pointer to refer to it.
|
||||
|
||||
For structured state you might have this:
|
||||
|
||||
struct my_state {
|
||||
MYSQL conn;
|
||||
MYSQL_RES * result;
|
||||
};
|
||||
|
||||
struct my_state * state = pemalloc(sizeof(struct my_state), persistent);
|
||||
|
||||
/* initialize the connection, and run a query, using the fields in state to
|
||||
* hold the results */
|
||||
|
||||
state->result = mysql_use_result(&state->conn);
|
||||
|
||||
/* now allocate the stream itself */
|
||||
stream = php_stream_alloc(&my_ops, state, 0, persistent, "r");
|
||||
|
||||
/* now stream->abstract == state */
|
||||
|
||||
Once you have that part figured out, you can write your implementation and
|
||||
define the your own php_stream_ops struct (we called it my_ops in the above
|
||||
example).
|
||||
|
||||
For example, for reading from this wierd mysql stream:
|
||||
|
||||
static size_t php_mysqlop_read(php_stream * stream, char * buf, size_t count)
|
||||
{
|
||||
struct my_state * state = (struct my_state*)stream->abstract;
|
||||
|
||||
if (buf == NULL && count == 0) {
|
||||
/* in this special case, php_streams is asking if we have reached the
|
||||
* end of file */
|
||||
if (... at end of file ...)
|
||||
return EOF;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* pull out some data from the stream and put it in buf */
|
||||
... mysql_fetch_row(state->result) ...
|
||||
/* we could do something strange, like format the data as XML here,
|
||||
and place that in the buf, but that brings in some complexities,
|
||||
such as coping with a buffer size too small to hold the data,
|
||||
so I won't even go in to how to do that here */
|
||||
}
|
||||
|
||||
Implement the other operations - remember that write, read, close and flush
|
||||
are all mandatory. The rest are optional. Declare your stream ops struct:
|
||||
|
||||
php_stream_ops my_ops = {
|
||||
php_mysqlop_write, php_mysqlop_read, php_mysqlop_close,
|
||||
php_mysqlop_flush, NULL, NULL, NULL,
|
||||
"Strange mySQL example"
|
||||
}
|
||||
|
||||
Thats it!
|
||||
|
||||
Take a look at the STDIO implementation in streams.c for more information
|
||||
about how these operations work.
|
||||
The main thing to remember is that in your close operation you need to release
|
||||
and free the resources you allocated for the abstract field. In the case of
|
||||
the example above, you need to use mysql_free_result on the rowset, close the
|
||||
connection and then use pefree to dispose of the struct you allocated.
|
||||
You may read the stream->persistent field to determine if your struct was
|
||||
allocated in persistent mode or not.
|
||||
|
||||
vim:tw=78
|
||||
-126
@@ -1,126 +0,0 @@
|
||||
Using PHP4 with the Zeus Web Server
|
||||
-----------------------------------
|
||||
|
||||
Zeus fully supports running PHP in combination with our
|
||||
webserver. There are three different interfaces that can be used to
|
||||
enable PHP:
|
||||
|
||||
* CGI
|
||||
* ISAPI
|
||||
* FastCGI
|
||||
|
||||
Of the three, we recommend using FastCGI, which has been tested and
|
||||
benchmarked as providing the best performance and reliability.
|
||||
|
||||
Full details of how to install PHP are available from our
|
||||
website, at:
|
||||
|
||||
http://support.zeus.com/products/php.html
|
||||
|
||||
If you have any problems, please check the support site for more
|
||||
up-to-date information and advice.
|
||||
|
||||
|
||||
Quick guide to installing FastCGI with Zeus
|
||||
-------------------------------------------
|
||||
|
||||
Step 1 - obtain and install FastCGI development kit.
|
||||
|
||||
Grab the package from:
|
||||
http://www.fastcgi.com/dist/devkit_2.2.0.tar.gz
|
||||
|
||||
Extract the package and follow the instructions:
|
||||
./configure
|
||||
make
|
||||
make export
|
||||
(run the last as root)
|
||||
|
||||
This will install to /usr/local/lib/libfcgi.a
|
||||
and /usr/local/include/*fcgi*
|
||||
|
||||
|
||||
|
||||
Step 2 - Compile PHP as FastCGI.
|
||||
|
||||
Compile as follows:
|
||||
./configure --with-fastcgi
|
||||
make
|
||||
|
||||
Note that PHP has many options to the configure script -
|
||||
e.g. --with-mysql. You will probably want to select your usual options
|
||||
before compiling; the above is just a bare minimum, for illustration.
|
||||
|
||||
After compilation finishes, you will be left with an executable
|
||||
program called 'php'. Copy this into your document root, under a
|
||||
dedicated FastCGI directory (e.g. $DOCROOT/fcgi-bin/php)
|
||||
|
||||
|
||||
Step 3 - configure Zeus
|
||||
|
||||
Four stages:
|
||||
- enable FastCGI
|
||||
- configure FastCGI
|
||||
- setup alias for FastCGI
|
||||
- setup alias for PHP
|
||||
|
||||
1) Using the admin server, go to the 'module configuration' page for
|
||||
your virtual server, and ensure that 'fastcgi' is enabled (select the
|
||||
tickbox to the left).
|
||||
|
||||
2) While we can run FastCGI's locally, there are known problems with
|
||||
some OS's (specifically, the communication between web server and
|
||||
FastCGI happens over a unix domain socket, and some OS's have trouble
|
||||
sustaining high connection rates over these sockets). So instead, we
|
||||
are going to set up the PHP FastCGI to run 'remotely' over localhost
|
||||
(this uses TCP sockets, which do not suffer this problem). Go to the
|
||||
'fastcgi configuration' page, and under 'add remote fastcgi':
|
||||
Add Remote FastCGI
|
||||
Docroot path /fcgi-bin/php
|
||||
Remote machine localhost:8002
|
||||
The first entry is where you saved PHP, above.
|
||||
The second entry is localhost:<any unused port>
|
||||
We will start the FastCGI listening on this port shortly.
|
||||
Click 'update' to commit these changes.
|
||||
|
||||
3) Go to the path mapping module and add an alias for FastCGI:
|
||||
Add Alias
|
||||
Docroot path /fcgi-bin
|
||||
Filesystem directory /path/to/docroot/fcgi-bin
|
||||
Alias type fastcgi
|
||||
Click 'update' to commit these changes
|
||||
|
||||
4) Also on the path mapping module, add a handler for PHP:
|
||||
Add handler
|
||||
File extension php
|
||||
Handler /fcgi-bin/php
|
||||
Click 'update' to commit these changes
|
||||
|
||||
Finally restart your virtual server for these changes to take effect.
|
||||
|
||||
|
||||
Step 4 - start PHP as a FastCGI runner
|
||||
|
||||
When you start PHP, it will pre-fork a given number of child processes
|
||||
to handle incoming PHP requests. Each process will handle a given
|
||||
number of requests before exiting (and being replaced by a newly
|
||||
forked process). You can control these two parameters by setting the
|
||||
following environment variables BEFORE starting the FastCGI runner:
|
||||
|
||||
PHP_FCGI_CHILDREN - the number of child processes to pre-fork. If not
|
||||
set, defaults to 8.
|
||||
|
||||
PHP_FCGI_MAX_REQUESTS - the number of requests each PHP child process
|
||||
handles before exiting. If not set, defaults to 500.
|
||||
|
||||
To start the FastCGI runner, execute '$ZEUSHOME/web/bin/fcgirunner
|
||||
8002 $DOCROOT/fcgi-bin/php'. Substitute the appropriate values for
|
||||
$ZEUSHOME and $DOCROOT; also substitute for 8002 the port you chose,
|
||||
above.
|
||||
|
||||
To stop the runner (e.g. to experiment with the above environment
|
||||
variables) you will need to manually stop and running PHP
|
||||
processes. (Use 'ps' and 'kill'). As it is PHP which is forking lots
|
||||
of children and not the runner, Zeus unfortunately cannot keep track
|
||||
of what processes are running, sorry. A typical command line may look
|
||||
like 'ps -efl | grep $DOCROOT/fcgi-bin/php | grep -v grep | awk
|
||||
'{print $4}' | xargs kill'
|
||||
-186
@@ -1,186 +0,0 @@
|
||||
Advisory on the PHP Release Cycle
|
||||
|
||||
|
||||
Copyright & Liciencing
|
||||
|
||||
This Document is (c) Copyright 2000,2001 by The PHP Group
|
||||
|
||||
This Document is distributed under the terms of the GNU General
|
||||
Public License as published by the Free Software Foundation;
|
||||
either version 2 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
|
||||
Table of Contents
|
||||
|
||||
1. Introduction
|
||||
2. Dealing with bugs
|
||||
2.1 As a QA Team Member
|
||||
2.2 As a Developer
|
||||
3. Releaseing another RC
|
||||
4. CVS During the Release Process
|
||||
4.1 Useful CVS Commands
|
||||
5 The Final Release
|
||||
6 Summary
|
||||
|
||||
|
||||
1. Introduction
|
||||
|
||||
This cycle should take place over roughly 10 days. When it is
|
||||
decided it is time for an Release to occur Andi/Zeev (Or
|
||||
Whoever) will tarball RC1, Tag & Branch CVS (see section 4)
|
||||
and then announce the RC on PHP-QA and PHP-DEV. At this
|
||||
point the build tracker and QA Bug System come into play.
|
||||
If you successfully build PHP then report it in the build
|
||||
tracker, If you then run and complete all the tests you
|
||||
should report this too in the build tracker when
|
||||
these features become avalible.
|
||||
|
||||
2. Dealing with Bugs
|
||||
|
||||
2.1 As a QA Team member
|
||||
|
||||
If you find a bug in an RC that you think is a showstopper
|
||||
then, even if it is a known bug, you should report it in the
|
||||
QA Bug system. This marks the bug for discussion at least,
|
||||
and preferably fixing before the actual release. This system
|
||||
is separate from the main bugs system so that important bugs
|
||||
dont get lost in the midst if lots of feature/change request
|
||||
in the approach to a release. It is imperitive where
|
||||
appropraite that as a QA'er a test script, Configure options
|
||||
and PHP.ini files are provided to enable the developer to
|
||||
reproduce the bug, this is an important part of our job. If
|
||||
you have a serious bug then you should also create a test
|
||||
script to be added to the tests dir of the php source so
|
||||
that at the end of the process to enable us to make sure bug
|
||||
does not return. It is not difficult to create these test
|
||||
scripts and a readme on it can be found in
|
||||
php4/tests/README.
|
||||
|
||||
|
||||
2.2 As a Developer
|
||||
|
||||
What should happen is that when a bug is reported it
|
||||
is send to php-dev and php-qa as with other bugs. We should
|
||||
have far stricter assignment system in this bug cycle rather
|
||||
than just leaving them. Once again bugs should be able to be
|
||||
marked as To Be Fixed Before release or moved to other bug
|
||||
system. (This is currently the Release Masters responsibility)
|
||||
|
||||
Then before the actual release the qa bugs system can be
|
||||
checked and if there are outstanding To Be Fixed Before
|
||||
release bugs the Developers can see this easyly rather than
|
||||
show stoppers being dismissed and not worried about.
|
||||
|
||||
When a bug is fixed the QAer who reported the bug is emailed
|
||||
and asked to test again and see if the bug is fixed.
|
||||
|
||||
3 Releasing another RC
|
||||
|
||||
If it is felt necessary that a 2nd RC is needed then it
|
||||
should be packaged as before and announced to both lists
|
||||
again. The testing process then starts again, the RC2 is
|
||||
added to the build tracker and QA'ers are asked to build and
|
||||
retest the scripts as appropriate, espectially if you
|
||||
reported a bug, you should test thourghly for your
|
||||
bug and make sure it no longer occurs. This will normally
|
||||
add anouther 3 days to the cycle, giving QA'ers time to
|
||||
build test and report back, then for developers to
|
||||
fix any problems.
|
||||
|
||||
4 CVS during the release process
|
||||
|
||||
At the point where the first RC is create a branch is
|
||||
formed. This branch is not altered form that point onward
|
||||
other than major bug fixes. Minor non important bug
|
||||
fixes should not be applied to this branch but to the main
|
||||
tree instead. Any major bug fixes should be applied to both
|
||||
trees. The developer should test and check the RC tree then
|
||||
also test and check the MAIN tree. This is their
|
||||
responsibility to make sure (as far as possible) that the
|
||||
bug fix works on both trees.
|
||||
|
||||
4.1 Useful CVS Commands
|
||||
|
||||
To create a Branch <Should only be done by person tarballing
|
||||
the RC (The Release Master)>:
|
||||
|
||||
$ cvs tag -b php_4_0_<Version>RC<NUMBER>
|
||||
IE:
|
||||
$ cvs tag -b php_4_0_1RC1
|
||||
|
||||
This should be executed in the PHP directory of an up to
|
||||
date checkout. Remember to also tag the Zend and TSRM repositories.
|
||||
|
||||
You can retrieve a branch in one of two ways: by checking it
|
||||
out fresh from the repository, or by switching an existing
|
||||
working copy over to the branch, I would suggest you
|
||||
checkout a new copy.
|
||||
|
||||
To check out a new copy:
|
||||
$ cvs checkout -r php_4_0_<Version>RC<NUMBER> php4
|
||||
IE:
|
||||
$ cvs checkout -r php_4_0_1RC1 php4
|
||||
|
||||
|
||||
To switch a working copy (Not recomended due to possible
|
||||
commiting to wrong branch)
|
||||
$ cvs update -r php_4_0_<Version>RC<NUMBER> php4
|
||||
IE:
|
||||
$ cvs update -r php_4_0_1RC1 php4
|
||||
|
||||
This should be done in the PHP4 directory itself.
|
||||
|
||||
To revert back to normal branch you should use the
|
||||
following:
|
||||
$ cvs update -A
|
||||
|
||||
To Commit to the branch you follow exactly the same
|
||||
procedure as normal
|
||||
$ cvs commit file.c
|
||||
|
||||
MAKE SURE YOU DO NOT COMMIT TO THE WRONG BRANCH.
|
||||
|
||||
5 The Final Release
|
||||
|
||||
When it is time to make the final release the following
|
||||
proceedure should be followed. The person who is tarballing
|
||||
the final release should check the QA bugs system and make
|
||||
sure there are no showstoppers left unfixed. If there are
|
||||
then bug the person the bug is assigned to until they fix
|
||||
it. If there are no more qa bugs then they should tag the
|
||||
branch as php_4_0_<Version> and tarball as usual. An email
|
||||
should be sent to PHP-GEN, PHP_DEV and PHP-QA about the new
|
||||
release and it should be added to php.net. The windows
|
||||
binaries and servelets should be built as soon as possible
|
||||
and added too, as should the windows installer.
|
||||
|
||||
6 Summary
|
||||
|
||||
Here is a summary of what a release cycle might look like:
|
||||
|
||||
Thurs: RC is agreed on and packaged, an email is sent to
|
||||
PHP_QA and PHP-DEV, the CVS is Branched and the
|
||||
Release Cycle Begins.
|
||||
|
||||
Mon: After a weekends testing most show stoppers should
|
||||
have been found (Hopefully) and the developers get to
|
||||
work on fixing them.
|
||||
|
||||
Thurs: A second RC is released if needed with the new bug
|
||||
fixes in and the QAers test again.
|
||||
|
||||
Sun: A review is made of all outstanding bugs and any show
|
||||
stoppers should be fixed. if there are no show
|
||||
stoppers then the final release is packaged and
|
||||
released on the monday morning on php.net
|
||||
|
||||
Mon: Release is made.
|
||||
|
||||
|
||||
James
|
||||
--
|
||||
James Moore
|
||||
PHP QA Team
|
||||
jmoore@php.net
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
Things to do or at least think about doing in the future. Name in
|
||||
parenthesis means that person has taken on this project.
|
||||
|
||||
Zend
|
||||
----
|
||||
* allow foreach ($array as $k => &$val) syntax. right now we cannot
|
||||
traverse an array without copying each element.
|
||||
* allow foreach ($array as $k => list($a, $b)) syntax for multi
|
||||
dimensional arrays.
|
||||
* look at replacing c-lib call tolower().
|
||||
* make hash API functions work with HASH_OF() to save time.
|
||||
* native large number support (probably with GNU GMP)
|
||||
* Const'ify APIs. Right now, many functions leave parameters untouched,
|
||||
but don't declare those as const. This makes interaction with other
|
||||
interfaces difficult which pass const parameters to us.
|
||||
* add try..catch/throw exception handling
|
||||
|
||||
global
|
||||
------
|
||||
* when used in standalone (skell-script like) mode don't urldecode
|
||||
arguments passed to php. right now it's not possible to say
|
||||
/usr/local/bin/php somescript.php dog+cat.txt
|
||||
as "dog+cat.txt" will arrive in php as "dog cat.txt".
|
||||
* make everything on the language-level independent of your locale setings.
|
||||
* always build the standalone executable as well as the chosen SAPI
|
||||
target.
|
||||
* make sure all source files have the "right" copyright.
|
||||
* the following modules still use PHP3_TLS_*() macros (and thereby don't
|
||||
work in ZTS mode): ext/db/db.c, ext/gd/gd.c
|
||||
* make sure that all ZTS globals get destructed. Most ts_allocate_id()
|
||||
calls should have a dtor entry.
|
||||
* activate all extensions by default that don't rely on external
|
||||
dependices. (eg ftp)
|
||||
* --enable-all in configure. (--enable-shared=max ...)
|
||||
* make configure print out a summary when it's done (like XEmacs)
|
||||
* replace standard functions which work on static data with
|
||||
reentrancy-safe functions (DONE?).
|
||||
* on some platforms unimplemented function will just do nothing (e.g. symlink)
|
||||
they should print a warning or not even be defined!
|
||||
* implement javadoc based function docs template system.
|
||||
* use thread-safe resolver functions (either require BIND 8 or adns).
|
||||
* provide optional IPv6 support.
|
||||
* make SAPI conform to CGI/1.1. Currently, all SAPI modules
|
||||
define REMOTE_ADDR etc. themselves and reach only various level
|
||||
of compliance.
|
||||
* find a better way to implement script timeouts. SIGVTALRM is used
|
||||
by some POSIX threads implementations (i.e. OpenBSD) and is not
|
||||
available in ZTS mode.
|
||||
* add aliases to functions to conform to new naming conventions, e.g.
|
||||
str_to_upper().
|
||||
* see what functions might need to be changed to use HashPosition, so
|
||||
that the internal array pointer is not affected.
|
||||
|
||||
documentation
|
||||
-------------
|
||||
* add remarks in the documentation which functions are not implemented on win32.
|
||||
* add remarks in the documentation which functions are not binary-safe.
|
||||
* improve documentation for the sablotron extension
|
||||
* update curl documentation
|
||||
* write documentation for the bzip2 extension
|
||||
* write documentation for the zziplib extension
|
||||
|
||||
ext/curl
|
||||
--------
|
||||
* Use the cURL write handler to save data for use when returning data or outputting
|
||||
data.
|
||||
* Have a warning scheme for when people use unsupported features.
|
||||
|
||||
ext/dav
|
||||
--------
|
||||
* rewrite.
|
||||
|
||||
ext/oci8
|
||||
--------
|
||||
* all OCIFetch*() functions should return 0 for no more data and false on error.
|
||||
* have a flag that trims trailing spaces from CHAR fields on retrieval.
|
||||
* make allow_call_time_pass_reference=Off working.
|
||||
* for additional todo information, see oci8.c, in ext/oci8
|
||||
|
||||
ext/pcre
|
||||
--------
|
||||
* Allow user to set PCRE_NOTEMPTY, PCRE_ANCHORED at execution time, maybe
|
||||
* add option to preg_grep() to return entries that _don't_ match
|
||||
|
||||
ext/sablot
|
||||
----------
|
||||
* Re-write the error handling and reporting interface
|
||||
* Cleanup the underlying code a bit
|
||||
* Add proper support for the message handlers
|
||||
|
||||
ext/session
|
||||
-----------
|
||||
* maybe implement finer-grained session variables that could be
|
||||
locked individually.
|
||||
* write a network-transparent storage back-end with fallover
|
||||
facilities
|
||||
* provide a callback facility which is executed upon encountering
|
||||
an unknown classname during deserialization
|
||||
|
||||
ext/sockets
|
||||
-----------
|
||||
* Make the extension work on windows (Daniel Beulshausen)
|
||||
* Make the extension work with Solaris and the Sun GCC
|
||||
|
||||
ext/standard
|
||||
------------
|
||||
* add a version number to data serialized via serialize().
|
||||
* array_add(). (Andrei)
|
||||
* possibly modify parsing of GPC data to automatically create arrays if
|
||||
variable name is seen more than once.
|
||||
* implement regex-cache for url-functions.
|
||||
* stri_replace(). (Andrei)
|
||||
* move socket related functions to fsock.c.
|
||||
* NOT binary safe:
|
||||
strtok()
|
||||
basename()
|
||||
dirname()
|
||||
strrpos()
|
||||
strrchr()
|
||||
strip_tags()
|
||||
* rewrite win32 SMTP code to be useable for *ix to, maybe as a (default)
|
||||
module of its own (Hartmut)
|
||||
|
||||
ext/zziplib
|
||||
------------
|
||||
* more fully support the zziplib api
|
||||
|
||||
ext/wddx
|
||||
--------
|
||||
* See if we can support the remaining datatypes:
|
||||
dateTime
|
||||
binary
|
||||
recordset
|
||||
|
||||
http://www.wddx.org/WDDX_SDK_10a/7__References/WDDX_DTD.htm
|
||||
(Andrei)
|
||||
|
||||
* implement wddx_packet_as_javascript(). (Andrei)
|
||||
|
||||
other cool stuff
|
||||
----------------
|
||||
* PVM extension
|
||||
@@ -1,35 +0,0 @@
|
||||
* Change the odbc_fetch_into() function to require ALWAYS the first two
|
||||
parameters ($conn_id and $array), and make the third (row) be optional.
|
||||
|
||||
* Remove --with-openlink configure option (--with-iodbc replaces it).
|
||||
|
||||
* Always build CGI (--disable-cgi option to disable).
|
||||
|
||||
* Move most extensions and PEAR packages out of the PHP CVS tree,
|
||||
include them again during release packaging.
|
||||
|
||||
* Renaming functions, so that they all are conform to one standard form.
|
||||
|
||||
* Allow foreach($array as $key => &$value).
|
||||
|
||||
* Allow foreach($array as list($var1, $var2)).
|
||||
|
||||
* Clean up "$instance = &new object" syntax (default to the =& behaviour?).
|
||||
|
||||
* Allow to set a default value for call-by-reference-parameters. eg:
|
||||
function hallo (&$pallo = NULL) {}
|
||||
|
||||
* Change PHP error messages, so that they point to pages or sections in the
|
||||
PHP Manual.
|
||||
|
||||
* Fix Zend shallow copy issues with objects and arrays.
|
||||
|
||||
* Make all extensions thread-safe.
|
||||
|
||||
* Finish PHP streams abstraction, nuke all that issock stuff, implement SSL
|
||||
socket support. (wez)
|
||||
- ext/ftp/ -> all FILEs to streams
|
||||
- ext/bz2/ -> convert to stream impl.
|
||||
|
||||
* Using arg_separator.input to implode args in the CGI sapi extension
|
||||
and arg_separator.input to explode in php_build_argv().
|
||||
@@ -1,26 +0,0 @@
|
||||
Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
- Neither name of the copyright holders nor the names of their contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,6 +0,0 @@
|
||||
## process this file with automake to produce Makefile.am
|
||||
AUTOMAKE_OPTIONS=foreign
|
||||
noinst_LTLIBRARIES=libtsrm.la
|
||||
libtsrm_la_SOURCES = TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c
|
||||
|
||||
depend:
|
||||
@@ -1,2 +0,0 @@
|
||||
- Improve the lock in ts_resource_ex() in order to cover less code.
|
||||
This can probably be done by more careful hash table access
|
||||
-588
@@ -1,588 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Thread Safe Resource Manager |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski|
|
||||
| This source file is subject to the TSRM license, that is bundled |
|
||||
| with this package in the file LICENSE |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
#ifdef ZTS
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
typedef struct _tsrm_tls_entry tsrm_tls_entry;
|
||||
|
||||
struct _tsrm_tls_entry {
|
||||
void **storage;
|
||||
int count;
|
||||
THREAD_T thread_id;
|
||||
tsrm_tls_entry *next;
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
size_t size;
|
||||
ts_allocate_ctor ctor;
|
||||
ts_allocate_dtor dtor;
|
||||
} tsrm_resource_type;
|
||||
|
||||
|
||||
/* The memory manager table */
|
||||
static tsrm_tls_entry **tsrm_tls_table=NULL;
|
||||
static int tsrm_tls_table_size;
|
||||
static ts_rsrc_id id_count;
|
||||
|
||||
/* The resource sizes table */
|
||||
static tsrm_resource_type *resource_types_table=NULL;
|
||||
static int resource_types_table_size;
|
||||
|
||||
|
||||
static MUTEX_T tsmm_mutex; /* thread-safe memory manager mutex */
|
||||
|
||||
/* New thread handlers */
|
||||
static tsrm_thread_begin_func_t tsrm_new_thread_begin_handler;
|
||||
static tsrm_thread_end_func_t tsrm_new_thread_end_handler;
|
||||
|
||||
/* Debug support */
|
||||
int tsrm_error(int level, const char *format, ...);
|
||||
|
||||
/* Read a resource from a thread's resource storage */
|
||||
static int tsrm_error_level;
|
||||
static FILE *tsrm_error_file;
|
||||
|
||||
#if TSRM_DEBUG
|
||||
#define TSRM_ERROR(args) tsrm_error args
|
||||
#define TSRM_SAFE_RETURN_RSRC(array, offset, range) \
|
||||
{ \
|
||||
int unshuffled_offset = TSRM_UNSHUFFLE_RSRC_ID(offset); \
|
||||
\
|
||||
if (offset==0) { \
|
||||
return &array; \
|
||||
} else if ((unshuffled_offset)>=0 && (unshuffled_offset)<(range)) { \
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Successfully fetched resource id %d for thread id %ld - 0x%0.8X", \
|
||||
unshuffled_offset, (long) thread_resources->thread_id, array[unshuffled_offset])); \
|
||||
return array[unshuffled_offset]; \
|
||||
} else { \
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Resource id %d is out of range (%d..%d)", \
|
||||
unshuffled_offset, TSRM_SHUFFLE_RSRC_ID(0), TSRM_SHUFFLE_RSRC_ID(thread_resources->count-1))); \
|
||||
return NULL; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define TSRM_ERROR
|
||||
#define TSRM_SAFE_RETURN_RSRC(array, offset, range) \
|
||||
if (offset==0) { \
|
||||
return &array; \
|
||||
} else { \
|
||||
return array[TSRM_UNSHUFFLE_RSRC_ID(offset)]; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PTHREADS)
|
||||
/* Thread local storage */
|
||||
static pthread_key_t tls_key;
|
||||
#elif defined(TSRM_ST)
|
||||
static int tls_key;
|
||||
#elif defined(TSRM_WIN32)
|
||||
static DWORD tls_key;
|
||||
#endif
|
||||
|
||||
|
||||
/* Startup TSRM (call once for the entire process) */
|
||||
TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename)
|
||||
{
|
||||
#if defined(GNUPTH)
|
||||
pth_init();
|
||||
#elif defined(PTHREADS)
|
||||
pthread_key_create( &tls_key, 0 );
|
||||
#elif defined(TSRM_ST)
|
||||
st_init();
|
||||
st_key_create(&tls_key, 0);
|
||||
#elif defined(TSRM_WIN32)
|
||||
tls_key = TlsAlloc();
|
||||
#endif
|
||||
|
||||
tsrm_error_file = stderr;
|
||||
tsrm_error_set(debug_level, debug_filename);
|
||||
tsrm_tls_table_size = expected_threads;
|
||||
|
||||
tsrm_tls_table = (tsrm_tls_entry **) calloc(tsrm_tls_table_size, sizeof(tsrm_tls_entry *));
|
||||
if (!tsrm_tls_table) {
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate TLS table"));
|
||||
return 0;
|
||||
}
|
||||
id_count=0;
|
||||
|
||||
resource_types_table_size = expected_resources;
|
||||
resource_types_table = (tsrm_resource_type *) calloc(resource_types_table_size, sizeof(tsrm_resource_type));
|
||||
if (!resource_types_table) {
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate resource types table"));
|
||||
free(tsrm_tls_table);
|
||||
tsrm_tls_table = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsmm_mutex = tsrm_mutex_alloc();
|
||||
|
||||
tsrm_new_thread_begin_handler = tsrm_new_thread_end_handler = NULL;
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Started up TSRM, %d expected threads, %d expected resources", expected_threads, expected_resources));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Shutdown TSRM (call once for the entire process) */
|
||||
TSRM_API void tsrm_shutdown(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (tsrm_tls_table) {
|
||||
for (i=0; i<tsrm_tls_table_size; i++) {
|
||||
tsrm_tls_entry *p = tsrm_tls_table[i], *next_p;
|
||||
|
||||
while (p) {
|
||||
int j;
|
||||
|
||||
next_p = p->next;
|
||||
for (j=0; j<id_count; j++) {
|
||||
free(p->storage[j]);
|
||||
}
|
||||
free(p->storage);
|
||||
free(p);
|
||||
p = next_p;
|
||||
}
|
||||
}
|
||||
free(tsrm_tls_table);
|
||||
tsrm_tls_table = NULL;
|
||||
}
|
||||
if (resource_types_table) {
|
||||
free(resource_types_table);
|
||||
resource_types_table=NULL;
|
||||
}
|
||||
tsrm_mutex_free(tsmm_mutex);
|
||||
tsmm_mutex = NULL;
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Shutdown TSRM"));
|
||||
if (tsrm_error_file!=stderr) {
|
||||
fclose(tsrm_error_file);
|
||||
}
|
||||
#if defined(GNUPTH)
|
||||
pth_kill();
|
||||
#elif defined(PTHREADS)
|
||||
pthread_key_delete(tls_key);
|
||||
#elif defined(TSRM_WIN32)
|
||||
TlsFree(tls_key);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* allocates a new thread-safe-resource id */
|
||||
TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor)
|
||||
{
|
||||
int i;
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Obtaining a new resource id, %d bytes", size));
|
||||
|
||||
tsrm_mutex_lock(tsmm_mutex);
|
||||
|
||||
/* obtain a resource id */
|
||||
*rsrc_id = TSRM_SHUFFLE_RSRC_ID(id_count++);
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Obtained resource id %d", *rsrc_id));
|
||||
|
||||
/* store the new resource type in the resource sizes table */
|
||||
if (resource_types_table_size < id_count) {
|
||||
resource_types_table = (tsrm_resource_type *) realloc(resource_types_table, sizeof(tsrm_resource_type)*id_count);
|
||||
if (!resource_types_table) {
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate storage for resource"));
|
||||
*rsrc_id = 0;
|
||||
return 0;
|
||||
}
|
||||
resource_types_table_size = id_count;
|
||||
}
|
||||
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].size = size;
|
||||
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].ctor = ctor;
|
||||
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].dtor = dtor;
|
||||
|
||||
/* enlarge the arrays for the already active threads */
|
||||
for (i=0; i<tsrm_tls_table_size; i++) {
|
||||
tsrm_tls_entry *p = tsrm_tls_table[i];
|
||||
|
||||
while (p) {
|
||||
if (p->count < id_count) {
|
||||
int j;
|
||||
|
||||
p->storage = (void *) realloc(p->storage, sizeof(void *)*id_count);
|
||||
for (j=p->count; j<id_count; j++) {
|
||||
p->storage[j] = (void *) malloc(resource_types_table[j].size);
|
||||
if (resource_types_table[j].ctor) {
|
||||
resource_types_table[j].ctor(p->storage[j], &p->storage);
|
||||
}
|
||||
}
|
||||
p->count = id_count;
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Successfully allocated new resource id %d", *rsrc_id));
|
||||
return *rsrc_id;
|
||||
}
|
||||
|
||||
|
||||
static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_T thread_id)
|
||||
{
|
||||
int i;
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Creating data structures for thread %x", thread_id));
|
||||
(*thread_resources_ptr) = (tsrm_tls_entry *) malloc(sizeof(tsrm_tls_entry));
|
||||
(*thread_resources_ptr)->storage = (void **) malloc(sizeof(void *)*id_count);
|
||||
(*thread_resources_ptr)->count = id_count;
|
||||
(*thread_resources_ptr)->thread_id = thread_id;
|
||||
(*thread_resources_ptr)->next = NULL;
|
||||
|
||||
#if defined(PTHREADS)
|
||||
/* Set thread local storage to this new thread resources structure */
|
||||
pthread_setspecific(tls_key, (void *) *thread_resources_ptr);
|
||||
#elif defined(TSRM_ST)
|
||||
st_thread_setspecific(tls_key, (void *) *thread_resources_ptr);
|
||||
#elif defined(TSRM_WIN32)
|
||||
TlsSetValue(tls_key, (void *) *thread_resources_ptr);
|
||||
#endif
|
||||
|
||||
if (tsrm_new_thread_begin_handler) {
|
||||
tsrm_new_thread_begin_handler(thread_id, &((*thread_resources_ptr)->storage));
|
||||
}
|
||||
for (i=0; i<id_count; i++) {
|
||||
(*thread_resources_ptr)->storage[i] = (void *) malloc(resource_types_table[i].size);
|
||||
if (resource_types_table[i].ctor) {
|
||||
resource_types_table[i].ctor((*thread_resources_ptr)->storage[i], &(*thread_resources_ptr)->storage);
|
||||
}
|
||||
}
|
||||
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
|
||||
if (tsrm_new_thread_end_handler) {
|
||||
tsrm_new_thread_end_handler(thread_id, &((*thread_resources_ptr)->storage));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* fetches the requested resource for the current thread */
|
||||
TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
|
||||
{
|
||||
THREAD_T thread_id;
|
||||
int hash_value;
|
||||
tsrm_tls_entry *thread_resources;
|
||||
|
||||
if (!th_id) {
|
||||
#if defined(PTHREADS)
|
||||
/* Fast path for looking up the resources for the current
|
||||
* thread. Its used by just about every call to
|
||||
* ts_resource_ex(). This avoids the need for a mutex lock
|
||||
* and our hashtable lookup.
|
||||
*/
|
||||
thread_resources = pthread_getspecific(tls_key);
|
||||
#elif defined(TSRM_ST)
|
||||
thread_resources = st_thread_getspecific(tls_key);
|
||||
#elif defined(TSRM_WIN32)
|
||||
thread_resources = TlsGetValue(tls_key);
|
||||
#else
|
||||
thread_resources = NULL;
|
||||
#endif
|
||||
if (thread_resources) {
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for current thread %d", id, (long) thread_resources->thread_id));
|
||||
/* Read a specific resource from the thread's resources.
|
||||
* This is called outside of a mutex, so have to be aware about external
|
||||
* changes to the structure as we read it.
|
||||
*/
|
||||
TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
|
||||
}
|
||||
thread_id = tsrm_thread_id();
|
||||
} else {
|
||||
thread_id = *th_id;
|
||||
}
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for thread %ld", id, (long) thread_id));
|
||||
tsrm_mutex_lock(tsmm_mutex);
|
||||
|
||||
hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
|
||||
thread_resources = tsrm_tls_table[hash_value];
|
||||
|
||||
if (!thread_resources) {
|
||||
allocate_new_resource(&tsrm_tls_table[hash_value], thread_id);
|
||||
return ts_resource_ex(id, &thread_id);
|
||||
} else {
|
||||
do {
|
||||
if (thread_resources->thread_id == thread_id) {
|
||||
break;
|
||||
}
|
||||
if (thread_resources->next) {
|
||||
thread_resources = thread_resources->next;
|
||||
} else {
|
||||
allocate_new_resource(&thread_resources->next, thread_id);
|
||||
return ts_resource_ex(id, &thread_id);
|
||||
/*
|
||||
* thread_resources = thread_resources->next;
|
||||
* break;
|
||||
*/
|
||||
}
|
||||
} while (thread_resources);
|
||||
}
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
/* Read a specific resource from the thread's resources.
|
||||
* This is called outside of a mutex, so have to be aware about external
|
||||
* changes to the structure as we read it.
|
||||
*/
|
||||
TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
|
||||
}
|
||||
|
||||
|
||||
/* frees all resources allocated for the current thread */
|
||||
void ts_free_thread(void)
|
||||
{
|
||||
tsrm_tls_entry *thread_resources;
|
||||
int i;
|
||||
THREAD_T thread_id = tsrm_thread_id();
|
||||
int hash_value;
|
||||
tsrm_tls_entry *last=NULL;
|
||||
|
||||
tsrm_mutex_lock(tsmm_mutex);
|
||||
hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
|
||||
thread_resources = tsrm_tls_table[hash_value];
|
||||
|
||||
while (thread_resources) {
|
||||
if (thread_resources->thread_id == thread_id) {
|
||||
for (i=0; i<thread_resources->count; i++) {
|
||||
if (resource_types_table[i].dtor) {
|
||||
resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
|
||||
}
|
||||
}
|
||||
for (i=0; i<thread_resources->count; i++) {
|
||||
free(thread_resources->storage[i]);
|
||||
}
|
||||
free(thread_resources->storage);
|
||||
if (last) {
|
||||
last->next = thread_resources->next;
|
||||
} else {
|
||||
tsrm_tls_table[hash_value] = thread_resources->next;
|
||||
}
|
||||
#if defined(PTHREADS)
|
||||
pthread_setspecific(tls_key, 0);
|
||||
#elif defined(TSRM_WIN32)
|
||||
TlsSetValue(tls_key, 0);
|
||||
#endif
|
||||
free(thread_resources);
|
||||
break;
|
||||
}
|
||||
if (thread_resources->next) {
|
||||
last = thread_resources;
|
||||
}
|
||||
thread_resources = thread_resources->next;
|
||||
}
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
}
|
||||
|
||||
|
||||
/* deallocates all occurrences of a given id */
|
||||
void ts_free_id(ts_rsrc_id id)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Utility Functions
|
||||
*/
|
||||
|
||||
/* Obtain the current thread id */
|
||||
TSRM_API THREAD_T tsrm_thread_id(void)
|
||||
{
|
||||
#ifdef TSRM_WIN32
|
||||
return GetCurrentThreadId();
|
||||
#elif defined(GNUPTH)
|
||||
return pth_self();
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_self();
|
||||
#elif defined(NSAPI)
|
||||
return systhread_current();
|
||||
#elif defined(PI3WEB)
|
||||
return PIThread_getCurrent();
|
||||
#elif defined(TSRM_ST)
|
||||
return st_thread_self();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Allocate a mutex */
|
||||
TSRM_API MUTEX_T tsrm_mutex_alloc(void)
|
||||
{
|
||||
MUTEX_T mutexp;
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
mutexp = malloc(sizeof(CRITICAL_SECTION));
|
||||
InitializeCriticalSection(mutexp);
|
||||
#elif defined(GNUPTH)
|
||||
mutexp = (MUTEX_T) malloc(sizeof(*mutexp));
|
||||
pth_mutex_init(mutexp);
|
||||
#elif defined(PTHREADS)
|
||||
mutexp = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));
|
||||
pthread_mutex_init(mutexp,NULL);
|
||||
#elif defined(NSAPI)
|
||||
mutexp = crit_init();
|
||||
#elif defined(PI3WEB)
|
||||
mutexp = PIPlatform_allocLocalMutex();
|
||||
#elif defined(TSRM_ST)
|
||||
mutexp = st_mutex_new();
|
||||
#endif
|
||||
#ifdef THR_DEBUG
|
||||
printf("Mutex created thread: %d\n",mythreadid());
|
||||
#endif
|
||||
return( mutexp );
|
||||
}
|
||||
|
||||
|
||||
/* Free a mutex */
|
||||
TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
|
||||
{
|
||||
if (mutexp) {
|
||||
#ifdef TSRM_WIN32
|
||||
DeleteCriticalSection(mutexp);
|
||||
#elif defined(GNUPTH)
|
||||
free(mutexp);
|
||||
#elif defined(PTHREADS)
|
||||
pthread_mutex_destroy(mutexp);
|
||||
free(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
crit_terminate(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
PISync_delete(mutexp);
|
||||
#elif defined(TSRM_ST)
|
||||
st_mutex_destroy(mutexp);
|
||||
#endif
|
||||
}
|
||||
#ifdef THR_DEBUG
|
||||
printf("Mutex freed thread: %d\n",mythreadid());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Lock a mutex */
|
||||
TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp)
|
||||
{
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex locked thread: %ld", tsrm_thread_id()));
|
||||
#ifdef TSRM_WIN32
|
||||
EnterCriticalSection(mutexp);
|
||||
return 1;
|
||||
#elif defined(GNUPTH)
|
||||
return pth_mutex_acquire(mutexp, 0, NULL);
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_mutex_lock(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
return crit_enter(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
return PISync_lock(mutexp);
|
||||
#elif defined(TSRM_ST)
|
||||
return st_mutex_lock(mutexp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Unlock a mutex */
|
||||
TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
|
||||
{
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex unlocked thread: %ld", tsrm_thread_id()));
|
||||
#ifdef TSRM_WIN32
|
||||
LeaveCriticalSection(mutexp);
|
||||
return 1;
|
||||
#elif defined(GNUPTH)
|
||||
return pth_mutex_release(mutexp);
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_mutex_unlock(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
return crit_exit(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
return PISync_unlock(mutexp);
|
||||
#elif defined(TSRM_ST)
|
||||
return st_mutex_unlock(mutexp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler)
|
||||
{
|
||||
void *retval = (void *) tsrm_new_thread_begin_handler;
|
||||
|
||||
tsrm_new_thread_begin_handler = new_thread_begin_handler;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler)
|
||||
{
|
||||
void *retval = (void *) tsrm_new_thread_end_handler;
|
||||
|
||||
tsrm_new_thread_end_handler = new_thread_end_handler;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Debug support
|
||||
*/
|
||||
|
||||
#if TSRM_DEBUG
|
||||
int tsrm_error(int level, const char *format, ...)
|
||||
{
|
||||
if (level<=tsrm_error_level) {
|
||||
va_list args;
|
||||
int size;
|
||||
|
||||
fprintf(tsrm_error_file, "TSRM: ");
|
||||
va_start(args, format);
|
||||
size = vfprintf(tsrm_error_file, format, args);
|
||||
va_end(args);
|
||||
fprintf(tsrm_error_file, "\n");
|
||||
fflush(tsrm_error_file);
|
||||
return size;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void tsrm_error_set(int level, char *debug_filename)
|
||||
{
|
||||
tsrm_error_level = level;
|
||||
|
||||
#if TSRM_DEBUG
|
||||
if (tsrm_error_file!=stderr) { /* close files opened earlier */
|
||||
fclose(tsrm_error_file);
|
||||
}
|
||||
|
||||
if (debug_filename) {
|
||||
tsrm_error_file = fopen(debug_filename, "w");
|
||||
if (!tsrm_error_file) {
|
||||
tsrm_error_file = stderr;
|
||||
}
|
||||
} else {
|
||||
tsrm_error_file = stderr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* ZTS */
|
||||
-186
@@ -1,186 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="TSRM" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=TSRM - Win32 Debug_TS
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "TSRM.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "TSRM.mak" CFG="TSRM - Win32 Debug_TS"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "TSRM - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "TSRM - Win32 Release_TS" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "TSRM - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "TSRM - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "TSRM - Win32 Debug_TS"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "TSRM___Win32_Debug_TS"
|
||||
# PROP BASE Intermediate_Dir "TSRM___Win32_Debug_TS"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug_TS"
|
||||
# PROP Intermediate_Dir "Debug_TS"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "C:\Projects\TSRM" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=1 /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x40d /d "_DEBUG"
|
||||
# ADD RSC /l 0x40d /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "TSRM___Win32_Release_TS"
|
||||
# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release_TS"
|
||||
# PROP Intermediate_Dir "Release_TS"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
|
||||
# ADD BASE RSC /l 0x40d /d "NDEBUG"
|
||||
# ADD RSC /l 0x40d /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS_inline"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "TSRM___Win32_Release_TS_inline"
|
||||
# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS_inline"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release_TS_inline"
|
||||
# PROP Intermediate_Dir "Release_TS_inline"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "TSRM_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
|
||||
# ADD BASE RSC /l 0x40d /d "NDEBUG"
|
||||
# ADD RSC /l 0x40d /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TSDbg"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "TSRM___Win32_Release_TSDbg"
|
||||
# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TSDbg"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release_TSDbg"
|
||||
# PROP Intermediate_Dir "Release_TSDbg"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
|
||||
# ADD BASE RSC /l 0x40d /d "NDEBUG"
|
||||
# ADD RSC /l 0x40d /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "TSRM - Win32 Debug_TS"
|
||||
# Name "TSRM - Win32 Release_TS"
|
||||
# Name "TSRM - Win32 Release_TS_inline"
|
||||
# Name "TSRM - Win32 Release_TSDbg"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TSRM.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_strtok_r.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_virtual_cwd.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_win32.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\readdir.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TSRM.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_config.w32.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_config_common.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_strtok_r.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_virtual_cwd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_win32.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
-143
@@ -1,143 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Thread Safe Resource Manager |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski|
|
||||
| This source file is subject to the TSRM license, that is bundled |
|
||||
| with this package in the file LICENSE |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef TSRM_H
|
||||
#define TSRM_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "tsrm_config.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
# define TSRM_WIN32
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
# ifdef TSRM_EXPORTS
|
||||
# define TSRM_API __declspec(dllexport)
|
||||
# else
|
||||
# define TSRM_API __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# define TSRM_API
|
||||
#endif
|
||||
|
||||
/* Only compile multi-threading functions if we're in ZTS mode */
|
||||
#ifdef ZTS
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
# include <windows.h>
|
||||
#elif defined(GNUPTH)
|
||||
# include <pth.h>
|
||||
#elif defined(PTHREADS)
|
||||
# include <pthread.h>
|
||||
#elif defined(TSRM_ST)
|
||||
# include <st.h>
|
||||
#endif
|
||||
|
||||
typedef int ts_rsrc_id;
|
||||
|
||||
/* Define THREAD_T and MUTEX_T */
|
||||
#ifdef TSRM_WIN32
|
||||
# define THREAD_T DWORD
|
||||
# define MUTEX_T CRITICAL_SECTION *
|
||||
#elif defined(GNUPTH)
|
||||
# define THREAD_T pth_t
|
||||
# define MUTEX_T pth_mutex_t *
|
||||
#elif defined(PTHREADS)
|
||||
# define THREAD_T pthread_t
|
||||
# define MUTEX_T pthread_mutex_t *
|
||||
#elif defined(NSAPI)
|
||||
# define THREAD_T SYS_THREAD
|
||||
# define MUTEX_T CRITICAL
|
||||
#elif defined(PI3WEB)
|
||||
# define THREAD_T PIThread *
|
||||
# define MUTEX_T PISync *
|
||||
#elif defined(TSRM_ST)
|
||||
# define THREAD_T st_thread_t
|
||||
# define MUTEX_T st_mutex_t
|
||||
#endif
|
||||
|
||||
typedef void (*ts_allocate_ctor)(void *, void ***);
|
||||
typedef void (*ts_allocate_dtor)(void *, void ***);
|
||||
|
||||
#define THREAD_HASH_OF(thr,ts) (unsigned long)thr%(unsigned long)ts
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* startup/shutdown */
|
||||
TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename);
|
||||
TSRM_API void tsrm_shutdown(void);
|
||||
|
||||
/* allocates a new thread-safe-resource id */
|
||||
TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor);
|
||||
|
||||
/* fetches the requested resource for the current thread */
|
||||
TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id);
|
||||
#define ts_resource(id) ts_resource_ex(id, NULL)
|
||||
|
||||
/* frees all resources allocated for the current thread */
|
||||
TSRM_API void ts_free_thread(void);
|
||||
|
||||
/* deallocates all occurrences of a given id */
|
||||
TSRM_API void ts_free_id(ts_rsrc_id id);
|
||||
|
||||
|
||||
/* Debug support */
|
||||
#define TSRM_ERROR_LEVEL_ERROR 1
|
||||
#define TSRM_ERROR_LEVEL_CORE 2
|
||||
#define TSRM_ERROR_LEVEL_INFO 3
|
||||
|
||||
typedef void (*tsrm_thread_begin_func_t)(THREAD_T thread_id, void ***tsrm_ls);
|
||||
typedef void (*tsrm_thread_end_func_t)(THREAD_T thread_id, void ***tsrm_ls);
|
||||
|
||||
|
||||
TSRM_API int tsrm_error(int level, const char *format, ...);
|
||||
TSRM_API void tsrm_error_set(int level, char *debug_filename);
|
||||
|
||||
/* utility functions */
|
||||
TSRM_API THREAD_T tsrm_thread_id(void);
|
||||
TSRM_API MUTEX_T tsrm_mutex_alloc(void);
|
||||
TSRM_API void tsrm_mutex_free(MUTEX_T mutexp);
|
||||
TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp);
|
||||
TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp);
|
||||
|
||||
TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler);
|
||||
TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler);
|
||||
|
||||
#define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1)
|
||||
#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1)
|
||||
|
||||
#define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, NULL)
|
||||
#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
|
||||
#define TSRMLS_D void ***tsrm_ls
|
||||
#define TSRMLS_DC , TSRMLS_D
|
||||
#define TSRMLS_C tsrm_ls
|
||||
#define TSRMLS_CC , TSRMLS_C
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* non ZTS */
|
||||
|
||||
#define TSRMLS_FETCH()
|
||||
#define TSRMLS_D void
|
||||
#define TSRMLS_DC
|
||||
#define TSRMLS_C
|
||||
#define TSRMLS_CC
|
||||
|
||||
#endif /* ZTS */
|
||||
|
||||
#endif /* TSRM_H */
|
||||
@@ -1 +0,0 @@
|
||||
#undef PTHREADS
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
|
||||
])
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
# Makefile to generate build tools
|
||||
#
|
||||
# Standard usage:
|
||||
# make -f build.mk
|
||||
#
|
||||
# Written by Sascha Schumann
|
||||
#
|
||||
# $Id$
|
||||
|
||||
|
||||
LT_TARGETS = ltmain.sh ltconfig
|
||||
|
||||
config_h_in = tsrm_config.h.in
|
||||
|
||||
makefile_am_files = Makefile.am
|
||||
makefile_in_files = $(makefile_am_files:.am=.in)
|
||||
makefile_files = $(makefile_am_files:e.am=e)
|
||||
|
||||
targets = $(makefile_in_files) $(LT_TARGETS) configure $(config_h_in)
|
||||
|
||||
all: $(targets)
|
||||
|
||||
clean:
|
||||
rm -f $(targets)
|
||||
|
||||
$(LT_TARGETS):
|
||||
rm -f $(LT_TARGETS)
|
||||
libtoolize --automake $(AMFLAGS) -f
|
||||
|
||||
$(makefile_in_files): $(makefile_am_files)
|
||||
automake -a -i $(AMFLAGS) $(makefile_files)
|
||||
|
||||
aclocal.m4: configure.in acinclude.m4
|
||||
aclocal
|
||||
|
||||
$(config_h_in): configure.in acconfig.h
|
||||
# explicitly remove target since autoheader does not seem to work
|
||||
# correctly otherwise (timestamps are not updated)
|
||||
@rm -f $@
|
||||
autoheader
|
||||
|
||||
configure: aclocal.m4 configure.in
|
||||
autoconf
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
--copy)
|
||||
automake_flags=--copy
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
|
||||
libtoolize --force --automake $automake_flags
|
||||
|
||||
mv aclocal.m4 aclocal.m4.old 2>/dev/null
|
||||
aclocal
|
||||
if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
|
||||
echo "buildconf: keeping ${1}aclocal.m4"
|
||||
mv aclocal.m4.old aclocal.m4
|
||||
else
|
||||
echo "buildconf: created or modified ${1}aclocal.m4"
|
||||
fi
|
||||
|
||||
autoheader
|
||||
|
||||
automake --add-missing --include-deps $automake_flags
|
||||
|
||||
mv configure configure.old 2>/dev/null
|
||||
autoconf
|
||||
if cmp configure.old configure > /dev/null 2>&1; then
|
||||
echo "buildconf: keeping ${1}configure"
|
||||
mv configure.old configure
|
||||
else
|
||||
echo "buildconf: created or modified ${1}configure"
|
||||
fi
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl Minimalistic configure.in for TSRM.
|
||||
dnl
|
||||
|
||||
AC_INIT(TSRM.c)
|
||||
AM_INIT_AUTOMAKE(TSRM, 1.0, nodefine)
|
||||
AM_CONFIG_HEADER(tsrm_config.h)
|
||||
|
||||
sinclude(tsrm.m4)
|
||||
|
||||
TSRM_BASIC_CHECKS
|
||||
TSRM_THREADS_CHECKS
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
if test "$enable_debug" != "yes"; then
|
||||
AM_SET_LIBTOOL_VARIABLE([--silent])
|
||||
fi
|
||||
|
||||
dnl TSRM_PTHREAD
|
||||
|
||||
AC_CHECK_HEADERS(
|
||||
utime.h \
|
||||
dirent.h \
|
||||
stdarg.h \
|
||||
alloca.h \
|
||||
unistd.h \
|
||||
limits.h
|
||||
)
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
@@ -1,44 +0,0 @@
|
||||
#ifndef READDIR_H
|
||||
#define READDIR_H
|
||||
|
||||
|
||||
/*
|
||||
* Structures and types used to implement opendir/readdir/closedir
|
||||
* on Windows 95/NT.
|
||||
*/
|
||||
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
/* struct dirent - same as Unix */
|
||||
|
||||
struct dirent {
|
||||
long d_ino; /* inode (always 1 in WIN32) */
|
||||
off_t d_off; /* offset to this dirent */
|
||||
unsigned short d_reclen; /* length of d_name */
|
||||
char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */
|
||||
};
|
||||
|
||||
|
||||
/* typedef DIR - not the same as Unix */
|
||||
typedef struct {
|
||||
long handle; /* _findfirst/_findnext handle */
|
||||
short offset; /* offset into directory */
|
||||
short finished; /* 1 if there are not more files */
|
||||
struct _finddata_t fileinfo; /* from _findfirst/_findnext */
|
||||
char *dir; /* the dir we are reading */
|
||||
struct dirent dent; /* the dirent to return */
|
||||
} DIR;
|
||||
|
||||
/* Function prototypes */
|
||||
DIR *opendir(const char *);
|
||||
struct dirent *readdir(DIR *);
|
||||
int readdir_r(DIR *, struct dirent *, struct dirent **);
|
||||
int closedir(DIR *);
|
||||
void rewinddir(DIR *);
|
||||
|
||||
|
||||
#endif /* READDIR_H */
|
||||
-157
@@ -1,157 +0,0 @@
|
||||
dnl Copyright (c) 1999, 2000 Sascha Schumann. All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
dnl modification, are permitted provided that the following conditions
|
||||
dnl are met:
|
||||
dnl
|
||||
dnl 1. Redistributions of source code must retain the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer.
|
||||
dnl
|
||||
dnl 2. Redistributions in binary form must reproduce the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer in
|
||||
dnl the documentation and/or other materials provided with the
|
||||
dnl distribution.
|
||||
dnl
|
||||
dnl THIS SOFTWARE IS PROVIDED BY SASCHA SCHUMANN ``AS IS'' AND ANY
|
||||
dnl EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
dnl PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SASCHA SCHUMANN OR
|
||||
dnl HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
dnl NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
dnl STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
dnl OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
dnl
|
||||
dnl PTHREADS_FLAGS
|
||||
dnl
|
||||
dnl Set some magic defines to achieve POSIX threads conformance
|
||||
dnl
|
||||
AC_DEFUN(PTHREADS_FLAGS,[
|
||||
if test -z "$host_alias"; then
|
||||
AC_MSG_ERROR(host_alias is not set. Make sure to run config.guess)
|
||||
fi
|
||||
case "$host_alias" in
|
||||
*solaris*)
|
||||
PTHREAD_FLAGS="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT";;
|
||||
*freebsd*)
|
||||
PTHREAD_FLAGS="-D_REENTRANT -D_THREAD_SAFE";;
|
||||
*linux*)
|
||||
PTHREAD_FLAGS="-D_REENTRANT";;
|
||||
*aix*)
|
||||
PTHREAD_FLAGS="-D_THREAD_SAFE";;
|
||||
*irix*)
|
||||
PTHREAD_FLAGS="-D_POSIX_THREAD_SAFE_FUNCTIONS";;
|
||||
*hpux*)
|
||||
PTHREAD_FLAGS="-D_REENTRANT";;
|
||||
*sco*)
|
||||
PTHREAD_FLAGS="-D_REENTRANT";;
|
||||
dnl Solves sigwait() problem, creates problems with u_long etc.
|
||||
dnl PTHREAD_FLAGS="-D_REENTRANT -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE_EXTENDED=1";;
|
||||
esac
|
||||
|
||||
if test -n "$PTHREAD_FLAGS"; then
|
||||
CPPFLAGS="$CPPFLAGS $PTHREAD_FLAGS"
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl PTHREADS_CHECK_COMPILE
|
||||
dnl
|
||||
dnl Check whether the current setup can use POSIX threads calls
|
||||
dnl
|
||||
AC_DEFUN(PTHREADS_CHECK_COMPILE, [
|
||||
AC_TRY_RUN( [
|
||||
#include <pthread.h>
|
||||
#include <stddef.h>
|
||||
|
||||
void *thread_routine(void *data) {
|
||||
return data;
|
||||
}
|
||||
|
||||
int main() {
|
||||
pthread_t thd;
|
||||
pthread_mutexattr_t mattr;
|
||||
int data = 1;
|
||||
pthread_mutexattr_init(&mattr);
|
||||
return pthread_create(&thd, NULL, thread_routine, &data);
|
||||
} ], [
|
||||
pthreads_working="yes"
|
||||
], [
|
||||
pthreads_working="no"
|
||||
], pthreads_working="no" ) ] )dnl
|
||||
dnl
|
||||
dnl PTHREADS_CHECK()
|
||||
dnl
|
||||
dnl Try to find a way to enable POSIX threads
|
||||
dnl
|
||||
dnl Magic flags
|
||||
dnl -kthread gcc (FreeBSD)
|
||||
dnl -Kthread UDK cc (UnixWare)
|
||||
dnl -mt WorkShop cc (Solaris)
|
||||
dnl -mthreads gcc (AIX)
|
||||
dnl -pthread gcc (Linux, FreeBSD, NetBSD, OpenBSD)
|
||||
dnl -pthreads gcc (Solaris)
|
||||
dnl -qthreaded AIX cc V5
|
||||
dnl -threads gcc (HP-UX)
|
||||
dnl
|
||||
AC_DEFUN(PTHREADS_CHECK,[
|
||||
|
||||
save_CFLAGS="$CFLAGS"
|
||||
save_LIBS="$LIBS"
|
||||
PTHREADS_ASSIGN_VARS
|
||||
PTHREADS_CHECK_COMPILE
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
AC_CACHE_CHECK(for pthreads_cflags,ac_cv_pthreads_cflags,[
|
||||
ac_cv_pthreads_cflags=""
|
||||
if test "$pthreads_working" != "yes"; then
|
||||
for flag in -kthread -pthread -pthreads -mthreads -Kthread -threads -mt -qthreaded; do
|
||||
ac_save="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $flag"
|
||||
PTHREADS_CHECK_COMPILE
|
||||
CFLAGS="$ac_save"
|
||||
if test "$pthreads_working" = "yes"; then
|
||||
ac_cv_pthreads_cflags="$flag"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[
|
||||
ac_cv_pthreads_lib=""
|
||||
if test "$pthreads_working" != "yes"; then
|
||||
for lib in pthread pthreads c_r; do
|
||||
ac_save="$LIBS"
|
||||
LIBS="$LIBS -l$lib"
|
||||
PTHREADS_CHECK_COMPILE
|
||||
LIBS="$ac_save"
|
||||
if test "$pthreads_working" = "yes"; then
|
||||
ac_cv_pthreads_lib="$lib"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
if test "$pthreads_working" = "yes"; then
|
||||
threads_result="POSIX Threads found"
|
||||
else
|
||||
threads_result="POSIX Threads not found"
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl
|
||||
AC_DEFUN(PTHREADS_ASSIGN_VARS,[
|
||||
if test -n "$ac_cv_pthreads_lib"; then
|
||||
LIBS="$LIBS -l$ac_cv_pthreads_lib"
|
||||
fi
|
||||
|
||||
if test -n "$ac_cv_pthreads_cflags"; then
|
||||
CFLAGS="$CFLAGS $ac_cv_pthreads_cflags"
|
||||
fi
|
||||
])dnl
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
|
||||
dnl TSRM_CHECK_GCC_ARG(ARG, ACTION-IF-FOUND, ACTION-IF-NOT_FOUND)
|
||||
AC_DEFUN(TSRM_CHECK_GCC_ARG,[
|
||||
gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
|
||||
AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
|
||||
echo 'void somefunc() { };' > conftest.c
|
||||
cmd='$CC $1 -c conftest.c'
|
||||
if eval $cmd 2>&1 | egrep -e $1 >/dev/null ; then
|
||||
ac_result=no
|
||||
else
|
||||
ac_result=yes
|
||||
fi
|
||||
eval $gcc_arg_name=$ac_result
|
||||
rm -f conftest.*
|
||||
])
|
||||
if eval test "\$$gcc_arg_name" = "yes"; then
|
||||
$2
|
||||
else
|
||||
:
|
||||
$3
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN(TSRM_BASIC_CHECKS,[
|
||||
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
dnl AC_REQUIRE([AM_PROG_CC_STDC])dnl
|
||||
AC_REQUIRE([AC_PROG_CC_C_O])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
|
||||
AC_CHECK_HEADERS(stdarg.h)
|
||||
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN(TSRM_CHECK_PTH,[
|
||||
|
||||
AC_MSG_CHECKING(for GNU Pth)
|
||||
PTH_PREFIX="`$1 --prefix`"
|
||||
if test -z "$PTH_PREFIX"; then
|
||||
AC_MSG_RESULT(Please check your Pth installation)
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS `$1 --cflags`"
|
||||
LDFLAGS="$LDFLAGS `$1 --ldflags`"
|
||||
LIBS="$LIBS `$1 --libs`"
|
||||
|
||||
AC_DEFINE(GNUPTH, 1, [Whether you use GNU Pth])
|
||||
AC_MSG_RESULT(yes - installed in $PTH_PREFIX)
|
||||
|
||||
])
|
||||
|
||||
AC_DEFUN(TSRM_CHECK_ST,[
|
||||
if test -r "$1/include/st.h"; then
|
||||
CPPFLAGS="$CPPFLAGS -I$1/include"
|
||||
LDFLAGS="$LDFLAGS -L$1/lib"
|
||||
elif test -r "$1/st.h"; then
|
||||
CPPFLAGS="$CPPFLAGS -I$1"
|
||||
LDFLAGS="$LDFLAGS -L$1"
|
||||
fi
|
||||
AC_CHECK_HEADERS(st.h,[ ],[
|
||||
AC_MSG_ERROR([Sorry[,] I was unable to locate the State Threads header file. Please specify the prefix using --with-tsrm-st=/prefix])
|
||||
])
|
||||
LIBS="$LIBS -lst"
|
||||
AC_MSG_CHECKING(for SGI's State Threads)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(TSRM_ST, 1, [ ])
|
||||
])
|
||||
|
||||
sinclude(threads.m4)
|
||||
sinclude(TSRM/threads.m4)
|
||||
|
||||
AC_DEFUN(TSRM_CHECK_PTHREADS,[
|
||||
|
||||
PTHREADS_CHECK
|
||||
|
||||
if test "$pthreads_working" != "yes"; then
|
||||
AC_MSG_ERROR(Your system seems to lack POSIX threads.)
|
||||
fi
|
||||
|
||||
AC_DEFINE(PTHREADS, 1, Whether to use Pthreads)
|
||||
|
||||
AC_MSG_CHECKING(for POSIX threads)
|
||||
AC_MSG_RESULT(yes)
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN(TSRM_THREADS_CHECKS,[
|
||||
|
||||
dnl For the thread implementations, we always use --with-*
|
||||
dnl to maintain consistency
|
||||
|
||||
AC_ARG_WITH(tsrm-pth,
|
||||
[ --with-tsrm-pth[=pth-config] Use GNU Pth.],[
|
||||
TSRM_PTH=$withval
|
||||
],[
|
||||
TSRM_PTH=no
|
||||
])
|
||||
|
||||
AC_ARG_WITH(tsrm-st,
|
||||
[ --with-tsrm-st],[
|
||||
TSRM_ST=$withval
|
||||
],[
|
||||
TSRM_ST=no
|
||||
])
|
||||
|
||||
AC_ARG_WITH(tsrm-pthreads,
|
||||
[ --with-tsrm-pthreads Use POSIX threads (default)],[
|
||||
TSRM_PTHREADS=$withval
|
||||
],[
|
||||
TSRM_PTHREADS=yes
|
||||
])
|
||||
|
||||
test "$TSRM_PTH" = "yes" && TSRM_PTH=pth-config
|
||||
|
||||
if test "$TSRM_PTH" != "no"; then
|
||||
TSRM_CHECK_PTH($TSRM_PTH)
|
||||
elif test "$TSRM_ST" != "no"; then
|
||||
TSRM_CHECK_ST($TSRM_ST)
|
||||
elif test "$TSRM_PTHREADS" != "no"; then
|
||||
TSRM_CHECK_PTHREADS
|
||||
fi
|
||||
|
||||
])
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifndef TSRM_CONFIG_W32_H
|
||||
#define TSRM_CONFIG_W32_H
|
||||
|
||||
#define HAVE_UTIME 1
|
||||
#define HAVE_ALLOCA 1
|
||||
|
||||
#undef inline
|
||||
#ifdef ZEND_WIN32_FORCE_INLINE
|
||||
# define inline __forceinline
|
||||
#else
|
||||
# define inline
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,47 +0,0 @@
|
||||
#ifndef TSRM_CONFIG_COMMON_H
|
||||
#define TSRM_CONFIG_COMMON_H
|
||||
|
||||
#if WINNT|WIN32
|
||||
# define TSRM_WIN32
|
||||
#endif
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
# include "tsrm_config.h"
|
||||
# include <sys/param.h>
|
||||
#else
|
||||
# include "tsrm_config.w32.h"
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
# ifdef PATH_MAX
|
||||
# define MAXPATHLEN PATH_MAX
|
||||
# else
|
||||
# define MAXPATHLEN 256
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2))
|
||||
# define tsrm_do_alloca(p) alloca(p)
|
||||
# define tsrm_free_alloca(p)
|
||||
#else
|
||||
# define tsrm_do_alloca(p) malloc(p)
|
||||
# define tsrm_free_alloca(p) free(p)
|
||||
#endif
|
||||
|
||||
#endif /* TSRM_CONFIG_COMMON_H */
|
||||
@@ -1,63 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "tsrm_config_common.h"
|
||||
#include "tsrm_strtok_r.h"
|
||||
|
||||
static inline int in_character_class(char ch, const char *delim)
|
||||
{
|
||||
while (*delim) {
|
||||
if (*delim == ch) {
|
||||
return 1;
|
||||
}
|
||||
delim++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *tsrm_strtok_r(char *s, const char *delim, char **last)
|
||||
{
|
||||
char *token;
|
||||
|
||||
if (s == NULL) {
|
||||
s = *last;
|
||||
}
|
||||
|
||||
while (*s && in_character_class(*s, delim)) {
|
||||
s++;
|
||||
}
|
||||
if (!*s) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
token = s;
|
||||
|
||||
while (*s && !in_character_class(*s, delim)) {
|
||||
s++;
|
||||
}
|
||||
if (!*s) {
|
||||
*last = s;
|
||||
} else {
|
||||
*s = '\0';
|
||||
*last = s + 1;
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
main()
|
||||
{
|
||||
char foo[] = "/foo/bar//\\barbara";
|
||||
char *last;
|
||||
char *token;
|
||||
|
||||
token = tsrm_strtok_r(foo, "/\\", &last);
|
||||
while (token) {
|
||||
printf ("Token = '%s'\n", token);
|
||||
token = tsrm_strtok_r(NULL, "/\\", &last);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef TSRM_STRTOK_R
|
||||
#define TSRM_STRTOK_R
|
||||
|
||||
char *tsrm_strtok_r(char *s, const char *delim, char **last);
|
||||
|
||||
#endif
|
||||
@@ -1,773 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 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/2_02.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. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Sascha Schumann <sascha@schumann.cx> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "tsrm_virtual_cwd.h"
|
||||
#include "tsrm_strtok_r.h"
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include <io.h>
|
||||
#include "tsrm_win32.h"
|
||||
#endif
|
||||
|
||||
#define VIRTUAL_CWD_DEBUG 0
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
/* Only need mutex for popen() in Windows because it doesn't chdir() on UNIX */
|
||||
#if defined(TSRM_WIN32) && defined(ZTS)
|
||||
MUTEX_T cwd_mutex;
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
static ts_rsrc_id cwd_globals_id;
|
||||
#else
|
||||
static virtual_cwd_globals cwd_globals;
|
||||
#endif
|
||||
|
||||
cwd_state main_cwd_state; /* True global */
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(mode) ((mode) & _S_IFDIR)
|
||||
#endif
|
||||
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(mode) ((mode) & _S_IFREG)
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#define tsrm_strtok_r(a,b,c) strtok((a),(b))
|
||||
#define TOKENIZER_STRING "/\\"
|
||||
|
||||
static int php_check_dots(const char *element, int n)
|
||||
{
|
||||
while (n-- > 0) if (element[n] != '.') break;
|
||||
|
||||
return (n != -1);
|
||||
}
|
||||
|
||||
#define IS_DIRECTORY_UP(element, len) \
|
||||
(len >= 2 && !php_check_dots(element, len))
|
||||
|
||||
#define IS_DIRECTORY_CURRENT(element, len) \
|
||||
(len == 1 && ptr[0] == '.')
|
||||
|
||||
|
||||
#else
|
||||
#define TOKENIZER_STRING "/"
|
||||
#endif
|
||||
|
||||
|
||||
/* default macros */
|
||||
|
||||
#ifndef IS_DIRECTORY_UP
|
||||
#define IS_DIRECTORY_UP(element, len) \
|
||||
(len == 2 && memcmp(element, "..", 2) == 0)
|
||||
#endif
|
||||
|
||||
#ifndef IS_DIRECTORY_CURRENT
|
||||
#define IS_DIRECTORY_CURRENT(element, len) \
|
||||
(len == 1 && ptr[0] == '.')
|
||||
#endif
|
||||
|
||||
/* define this to check semantics */
|
||||
#define IS_DIR_OK(s) (1)
|
||||
|
||||
#ifndef IS_DIR_OK
|
||||
#define IS_DIR_OK(state) (php_is_dir_ok(state) == 0)
|
||||
#endif
|
||||
|
||||
|
||||
#define CWD_STATE_COPY(d, s) \
|
||||
(d)->cwd_length = (s)->cwd_length; \
|
||||
(d)->cwd = (char *) malloc((s)->cwd_length+1); \
|
||||
memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1);
|
||||
|
||||
#define CWD_STATE_FREE(s) \
|
||||
free((s)->cwd);
|
||||
|
||||
static int php_is_dir_ok(const cwd_state *state)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
if (stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode))
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int php_is_file_ok(const cwd_state *state)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
if (stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode))
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void cwd_globals_ctor(virtual_cwd_globals *cwd_globals TSRMLS_DC)
|
||||
{
|
||||
CWD_STATE_COPY(&cwd_globals->cwd, &main_cwd_state);
|
||||
}
|
||||
|
||||
static void cwd_globals_dtor(virtual_cwd_globals *cwd_globals TSRMLS_DC)
|
||||
{
|
||||
CWD_STATE_FREE(&cwd_globals->cwd);
|
||||
}
|
||||
|
||||
static char *tsrm_strndup(const char *s, size_t length)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = (char *) malloc(length+1);
|
||||
if (!p) {
|
||||
return (char *)NULL;
|
||||
}
|
||||
if (length) {
|
||||
memcpy(p,s,length);
|
||||
}
|
||||
p[length]=0;
|
||||
return p;
|
||||
}
|
||||
|
||||
CWD_API void virtual_cwd_startup(void)
|
||||
{
|
||||
char cwd[MAXPATHLEN];
|
||||
char *result;
|
||||
|
||||
result = getcwd(cwd, sizeof(cwd));
|
||||
if (!result) {
|
||||
cwd[0] = '\0';
|
||||
}
|
||||
main_cwd_state.cwd = strdup(cwd);
|
||||
main_cwd_state.cwd_length = strlen(cwd);
|
||||
|
||||
#ifdef ZTS
|
||||
ts_allocate_id(&cwd_globals_id, sizeof(virtual_cwd_globals), (ts_allocate_ctor) cwd_globals_ctor, (ts_allocate_dtor) cwd_globals_dtor);
|
||||
#else
|
||||
cwd_globals_ctor(&cwd_globals TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
#if defined(TSRM_WIN32) && defined(ZTS)
|
||||
cwd_mutex = tsrm_mutex_alloc();
|
||||
#endif
|
||||
}
|
||||
|
||||
CWD_API void virtual_cwd_shutdown(void)
|
||||
{
|
||||
#ifndef ZTS
|
||||
cwd_globals_dtor(&cwd_globals TSRMLS_CC);
|
||||
#endif
|
||||
#if defined(TSRM_WIN32) && defined(ZTS)
|
||||
tsrm_mutex_free(cwd_mutex);
|
||||
#endif
|
||||
|
||||
free(main_cwd_state.cwd); /* Don't use CWD_STATE_FREE because the non global states will probably use emalloc()/efree() */
|
||||
}
|
||||
|
||||
CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC)
|
||||
{
|
||||
cwd_state *state;
|
||||
|
||||
state = &CWDG(cwd);
|
||||
|
||||
if (state->cwd_length == 0) {
|
||||
char *retval;
|
||||
|
||||
*length = 1;
|
||||
retval = (char *) malloc(2);
|
||||
retval[0] = DEFAULT_SLASH;
|
||||
retval[1] = '\0';
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
/* If we have something like C: */
|
||||
if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') {
|
||||
char *retval;
|
||||
|
||||
*length = state->cwd_length+1;
|
||||
retval = (char *) malloc(*length+1);
|
||||
memcpy(retval, state->cwd, *length);
|
||||
retval[*length-1] = DEFAULT_SLASH;
|
||||
retval[*length] = '\0';
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
*length = state->cwd_length;
|
||||
return strdup(state->cwd);
|
||||
}
|
||||
|
||||
|
||||
/* Same semantics as UNIX getcwd() */
|
||||
CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC)
|
||||
{
|
||||
size_t length;
|
||||
char *cwd;
|
||||
|
||||
cwd = virtual_getcwd_ex(&length TSRMLS_CC);
|
||||
|
||||
if (buf == NULL) {
|
||||
return cwd;
|
||||
}
|
||||
if (length > size-1) {
|
||||
free(cwd);
|
||||
errno = ERANGE; /* Is this OK? */
|
||||
return NULL;
|
||||
}
|
||||
memcpy(buf, cwd, length+1);
|
||||
free(cwd);
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* Resolve path relatively to state and put the real path into state */
|
||||
/* returns 0 for ok, 1 for error */
|
||||
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path)
|
||||
{
|
||||
int path_length = strlen(path);
|
||||
char *ptr, *path_copy;
|
||||
char *tok = NULL;
|
||||
int ptr_length;
|
||||
cwd_state *old_state;
|
||||
int ret = 0;
|
||||
int copy_amount = -1;
|
||||
char *free_path;
|
||||
unsigned char is_absolute = 0;
|
||||
#ifndef TSRM_WIN32
|
||||
char resolved_path[MAXPATHLEN];
|
||||
#endif
|
||||
|
||||
if (path_length == 0)
|
||||
return (0);
|
||||
|
||||
#if !defined(TSRM_WIN32) && !defined(__BEOS__)
|
||||
if (IS_ABSOLUTE_PATH(path, path_length)) {
|
||||
if (realpath(path, resolved_path)) {
|
||||
path = resolved_path;
|
||||
path_length = strlen(path);
|
||||
}
|
||||
} else { /* Concat current directory with relative path and then run realpath() on it */
|
||||
char *tmp;
|
||||
char *ptr;
|
||||
|
||||
ptr = tmp = (char *) malloc(state->cwd_length+path_length+sizeof("/"));
|
||||
if (!tmp) {
|
||||
return 1;
|
||||
}
|
||||
memcpy(ptr, state->cwd, state->cwd_length);
|
||||
ptr += state->cwd_length;
|
||||
*ptr++ = DEFAULT_SLASH;
|
||||
memcpy(ptr, path, path_length);
|
||||
ptr += path_length;
|
||||
*ptr = '\0';
|
||||
if (realpath(tmp, resolved_path)) {
|
||||
path = resolved_path;
|
||||
path_length = strlen(path);
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
#endif
|
||||
free_path = path_copy = tsrm_strndup(path, path_length);
|
||||
|
||||
old_state = (cwd_state *) malloc(sizeof(cwd_state));
|
||||
CWD_STATE_COPY(old_state, state);
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path);
|
||||
#endif
|
||||
if (IS_ABSOLUTE_PATH(path_copy, path_length)) {
|
||||
copy_amount = COPY_WHEN_ABSOLUTE;
|
||||
is_absolute = 1;
|
||||
#ifdef TSRM_WIN32
|
||||
} else if (IS_UNC_PATH(path_copy, path_length)) {
|
||||
copy_amount = 2;
|
||||
is_absolute = 1;
|
||||
} else if (IS_SLASH(path_copy[0])) {
|
||||
copy_amount = 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (copy_amount != -1) {
|
||||
state->cwd = (char *) realloc(state->cwd, copy_amount + 1);
|
||||
if (copy_amount) {
|
||||
if (is_absolute) {
|
||||
memcpy(state->cwd, path_copy, copy_amount);
|
||||
path_copy += copy_amount;
|
||||
} else {
|
||||
memcpy(state->cwd, old_state->cwd, copy_amount);
|
||||
}
|
||||
}
|
||||
state->cwd[copy_amount] = '\0';
|
||||
state->cwd_length = copy_amount;
|
||||
}
|
||||
|
||||
|
||||
ptr = tsrm_strtok_r(path_copy, TOKENIZER_STRING, &tok);
|
||||
while (ptr) {
|
||||
ptr_length = strlen(ptr);
|
||||
|
||||
if (IS_DIRECTORY_UP(ptr, ptr_length)) {
|
||||
char save;
|
||||
|
||||
save = DEFAULT_SLASH;
|
||||
|
||||
#define PREVIOUS state->cwd[state->cwd_length - 1]
|
||||
|
||||
while (IS_ABSOLUTE_PATH(state->cwd, state->cwd_length) &&
|
||||
!IS_SLASH(PREVIOUS)) {
|
||||
save = PREVIOUS;
|
||||
PREVIOUS = '\0';
|
||||
state->cwd_length--;
|
||||
}
|
||||
|
||||
if (!IS_ABSOLUTE_PATH(state->cwd, state->cwd_length)) {
|
||||
state->cwd[state->cwd_length++] = save;
|
||||
state->cwd[state->cwd_length] = '\0';
|
||||
} else {
|
||||
PREVIOUS = '\0';
|
||||
state->cwd_length--;
|
||||
}
|
||||
} else if (!IS_DIRECTORY_CURRENT(ptr, ptr_length)) {
|
||||
state->cwd = (char *) realloc(state->cwd, state->cwd_length+ptr_length+1+1);
|
||||
#ifdef TSRM_WIN32
|
||||
/* Windows 9x will consider C:\\Foo as a network path. Avoid it. */
|
||||
if (state->cwd[state->cwd_length-1]!='\\' && state->cwd[state->cwd_length-1]!='/') {
|
||||
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
|
||||
}
|
||||
#else
|
||||
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
|
||||
#endif
|
||||
memcpy(&state->cwd[state->cwd_length], ptr, ptr_length+1);
|
||||
state->cwd_length += ptr_length;
|
||||
}
|
||||
ptr = tsrm_strtok_r(NULL, TOKENIZER_STRING, &tok);
|
||||
}
|
||||
|
||||
if (state->cwd_length == COPY_WHEN_ABSOLUTE) {
|
||||
state->cwd = (char *) realloc(state->cwd, state->cwd_length+1+1);
|
||||
state->cwd[state->cwd_length] = DEFAULT_SLASH;
|
||||
state->cwd[state->cwd_length+1] = '\0';
|
||||
state->cwd_length++;
|
||||
}
|
||||
|
||||
if (verify_path && verify_path(state)) {
|
||||
CWD_STATE_FREE(state);
|
||||
|
||||
*state = *old_state;
|
||||
|
||||
ret = 1;
|
||||
} else {
|
||||
CWD_STATE_FREE(old_state);
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
free(old_state);
|
||||
|
||||
free(free_path);
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd);
|
||||
#endif
|
||||
return (ret);
|
||||
}
|
||||
|
||||
CWD_API int virtual_chdir(const char *path TSRMLS_DC)
|
||||
{
|
||||
return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok)?-1:0;
|
||||
}
|
||||
|
||||
CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_DC)
|
||||
{
|
||||
int length = strlen(path);
|
||||
char *temp;
|
||||
int retval;
|
||||
|
||||
if (length == 0) {
|
||||
return 1; /* Can't cd to empty string */
|
||||
}
|
||||
while(--length >= 0 && !IS_SLASH(path[length])) {
|
||||
}
|
||||
|
||||
if (length == -1) {
|
||||
/* No directory only file name */
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (length == COPY_WHEN_ABSOLUTE && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */
|
||||
length++;
|
||||
}
|
||||
temp = (char *) tsrm_do_alloca(length+1);
|
||||
memcpy(temp, path, length);
|
||||
temp[length] = 0;
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
fprintf (stderr, "Changing directory to %s\n", temp);
|
||||
#endif
|
||||
retval = p_chdir(temp TSRMLS_CC);
|
||||
tsrm_free_alloca(temp);
|
||||
return retval;
|
||||
}
|
||||
|
||||
CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
retval = virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
if (!retval) {
|
||||
int len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length;
|
||||
memcpy(real_path, new_state.cwd, len);
|
||||
real_path[len] = '\0';
|
||||
return real_path;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
retval = virtual_file_ex(&new_state, path, verify_path);
|
||||
|
||||
*filepath = new_state.cwd;
|
||||
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
CWD_API int virtual_filepath(const char *path, char **filepath TSRMLS_DC)
|
||||
{
|
||||
return virtual_filepath_ex(path, filepath, php_is_file_ok TSRMLS_CC);
|
||||
}
|
||||
|
||||
CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
FILE *f;
|
||||
|
||||
if (path[0] == '\0') { /* Fail to open empty path */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
f = fopen(new_state.cwd, mode);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return f;
|
||||
}
|
||||
|
||||
#if HAVE_UTIME
|
||||
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int ret;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, filename, NULL);
|
||||
|
||||
ret = utime(new_state.cwd, buf);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int ret;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, filename, NULL);
|
||||
|
||||
ret = chmod(new_state.cwd, mode);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int ret;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, filename, NULL);
|
||||
|
||||
ret = chown(new_state.cwd, owner, group);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int f;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
if (flags & O_CREAT) {
|
||||
mode_t mode;
|
||||
va_list arg;
|
||||
|
||||
va_start(arg, flags);
|
||||
mode = va_arg(arg, mode_t);
|
||||
va_end(arg);
|
||||
|
||||
f = open(new_state.cwd, flags, mode);
|
||||
} else {
|
||||
f = open(new_state.cwd, flags);
|
||||
}
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return f;
|
||||
}
|
||||
|
||||
CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int f;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
f = creat(new_state.cwd, mode);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return f;
|
||||
}
|
||||
|
||||
CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC)
|
||||
{
|
||||
cwd_state old_state;
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&old_state, &CWDG(cwd));
|
||||
virtual_file_ex(&old_state, oldname, NULL);
|
||||
oldname = old_state.cwd;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, newname, NULL);
|
||||
newname = new_state.cwd;
|
||||
|
||||
retval = rename(oldname, newname);
|
||||
|
||||
CWD_STATE_FREE(&old_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
retval = stat(new_state.cwd, buf);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
|
||||
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
retval = lstat(new_state.cwd, buf);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
CWD_API int virtual_unlink(const char *path TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL);
|
||||
|
||||
retval = unlink(new_state.cwd);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, pathname, NULL);
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
retval = mkdir(new_state.cwd);
|
||||
#else
|
||||
retval = mkdir(new_state.cwd, mode);
|
||||
#endif
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, pathname, NULL);
|
||||
|
||||
retval = rmdir(new_state.cwd);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
DIR *opendir(const char *name);
|
||||
#endif
|
||||
|
||||
CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
DIR *retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, pathname, NULL);
|
||||
|
||||
retval = opendir(new_state.cwd);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
|
||||
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
|
||||
{
|
||||
int command_length;
|
||||
char *command_line;
|
||||
char *ptr;
|
||||
FILE *retval;
|
||||
|
||||
command_length = strlen(command);
|
||||
|
||||
ptr = command_line = (char *) malloc(command_length + sizeof("cd ; ") + CWDG(cwd).cwd_length+1);
|
||||
if (!command_line) {
|
||||
return NULL;
|
||||
}
|
||||
memcpy(ptr, "cd ", sizeof("cd ")-1);
|
||||
ptr += sizeof("cd ")-1;
|
||||
|
||||
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++ = ' ';
|
||||
*ptr++ = ';';
|
||||
*ptr++ = ' ';
|
||||
|
||||
memcpy(ptr, command, command_length+1);
|
||||
retval = popen(command_line, type);
|
||||
|
||||
free(command_line);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* On Windows the trick of prepending "cd cwd; " doesn't work so we need to perform
|
||||
a real chdir() and mutex it
|
||||
*/
|
||||
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
|
||||
{
|
||||
char prev_cwd[MAXPATHLEN];
|
||||
char *getcwd_result;
|
||||
FILE *retval;
|
||||
|
||||
getcwd_result = getcwd(prev_cwd, MAXPATHLEN);
|
||||
if (!getcwd_result) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef ZTS
|
||||
tsrm_mutex_lock(cwd_mutex);
|
||||
#endif
|
||||
|
||||
chdir(CWDG(cwd).cwd);
|
||||
retval = popen(command, type);
|
||||
chdir(prev_cwd);
|
||||
|
||||
#ifdef ZTS
|
||||
tsrm_mutex_unlock(cwd_mutex);
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -1,215 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 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/2_02.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. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Sascha Schumann <sascha@schumann.cx> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef VIRTUAL_CWD_H
|
||||
#define VIRTUAL_CWD_H
|
||||
|
||||
#include "TSRM.h"
|
||||
#include "tsrm_config_common.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_UTIME_H
|
||||
#include <utime.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include "readdir.h"
|
||||
#include <sys/utime.h>
|
||||
/* mode_t isn't defined on Windows */
|
||||
typedef unsigned short mode_t;
|
||||
|
||||
#define DEFAULT_SLASH '\\'
|
||||
#define DEFAULT_DIR_SEPARATOR ';'
|
||||
#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
|
||||
#define COPY_WHEN_ABSOLUTE 2
|
||||
#define IS_ABSOLUTE_PATH(path, len) \
|
||||
(len >= 2 && isalpha(path[0]) && path[1] == ':')
|
||||
#define IS_UNC_PATH(path, len) \
|
||||
(len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1]))
|
||||
|
||||
#else
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#define DEFAULT_SLASH '/'
|
||||
#define DEFAULT_DIR_SEPARATOR ':'
|
||||
#define IS_SLASH(c) ((c) == '/')
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef COPY_WHEN_ABSOLUTE
|
||||
#define COPY_WHEN_ABSOLUTE 0
|
||||
#endif
|
||||
|
||||
#ifndef IS_ABSOLUTE_PATH
|
||||
#define IS_ABSOLUTE_PATH(path, len) \
|
||||
(IS_SLASH(path[0]))
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_EXPORTS
|
||||
#define CWD_EXPORTS
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
# ifdef CWD_EXPORTS
|
||||
# define CWD_API __declspec(dllexport)
|
||||
# else
|
||||
# define CWD_API __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
#define CWD_API
|
||||
#endif
|
||||
|
||||
typedef struct _cwd_state {
|
||||
char *cwd;
|
||||
int cwd_length;
|
||||
} cwd_state;
|
||||
|
||||
typedef int (*verify_path_func)(const cwd_state *);
|
||||
|
||||
CWD_API void virtual_cwd_startup(void);
|
||||
CWD_API void virtual_cwd_shutdown(void);
|
||||
CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC);
|
||||
CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC);
|
||||
CWD_API int virtual_chdir(const char *path TSRMLS_DC);
|
||||
CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_DC);
|
||||
CWD_API int virtual_filepath(const char *path, char **filepath TSRMLS_DC);
|
||||
CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC);
|
||||
CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC);
|
||||
CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC);
|
||||
CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...);
|
||||
CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC);
|
||||
CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC);
|
||||
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC);
|
||||
#ifndef TSRM_WIN32
|
||||
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC);
|
||||
#endif
|
||||
CWD_API int virtual_unlink(const char *path TSRMLS_DC);
|
||||
CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC);
|
||||
CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC);
|
||||
CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC);
|
||||
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC);
|
||||
#if HAVE_UTIME
|
||||
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC);
|
||||
#endif
|
||||
CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC);
|
||||
#ifndef TSRM_WIN32
|
||||
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path);
|
||||
|
||||
typedef struct _virtual_cwd_globals {
|
||||
cwd_state cwd;
|
||||
} virtual_cwd_globals;
|
||||
|
||||
#ifdef ZTS
|
||||
# define CWDG(v) TSRMG(cwd_globals_id, virtual_cwd_globals *, v)
|
||||
#else
|
||||
# define CWDG(v) (cwd_globals.v)
|
||||
#endif
|
||||
|
||||
/* The actual macros to be used in programs using TSRM
|
||||
* If the program defines VIRTUAL_DIR it will use the
|
||||
* virtual_* functions
|
||||
*/
|
||||
|
||||
#ifdef VIRTUAL_DIR
|
||||
|
||||
#define VCWD_GETCWD(buff, size) virtual_getcwd(buff, size TSRMLS_CC)
|
||||
#define VCWD_FOPEN(path, mode) virtual_fopen(path, mode TSRMLS_CC)
|
||||
/* Because open() has two modes, we have to macros to replace it */
|
||||
#define VCWD_OPEN(path, flags) virtual_open(path TSRMLS_CC, flags)
|
||||
#define VCWD_OPEN_MODE(path, flags, mode) virtual_open(path TSRMLS_CC, flags, mode)
|
||||
#define VCWD_CREAT(path, mode) virtual_creat(path, mode TSRMLS_CC)
|
||||
#define VCWD_CHDIR(path) virtual_chdir(path TSRMLS_CC)
|
||||
#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, virtual_chdir TSRMLS_CC)
|
||||
#define VCWD_GETWD(buf)
|
||||
#define VCWD_REALPATH(path, real_path) virtual_realpath(path, real_path TSRMLS_CC)
|
||||
#define VCWD_RENAME(oldname, newname) virtual_rename(oldname, newname TSRMLS_CC)
|
||||
#define VCWD_STAT(path, buff) virtual_stat(path, buff TSRMLS_CC)
|
||||
#ifdef TSRM_WIN32
|
||||
#define VCWD_LSTAT(path, buff) virtual_stat(path, buff TSRMLS_CC)
|
||||
#else
|
||||
#define VCWD_LSTAT(path, buff) virtual_lstat(path, buff TSRMLS_CC)
|
||||
#endif
|
||||
#define VCWD_UNLINK(path) virtual_unlink(path TSRMLS_CC)
|
||||
#define VCWD_MKDIR(pathname, mode) virtual_mkdir(pathname, mode TSRMLS_CC)
|
||||
#define VCWD_RMDIR(pathname) virtual_rmdir(pathname TSRMLS_CC)
|
||||
#define VCWD_OPENDIR(pathname) virtual_opendir(pathname TSRMLS_CC)
|
||||
#define VCWD_POPEN(command, type) virtual_popen(command, type TSRMLS_CC)
|
||||
#if HAVE_UTIME
|
||||
#define VCWD_UTIME(path, time) virtual_utime(path, time TSRMLS_CC)
|
||||
#endif
|
||||
#define VCWD_CHMOD(path, mode) virtual_chmod(path, mode TSRMLS_CC)
|
||||
#ifndef TSRM_WIN32
|
||||
#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group TSRMLS_CC)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define VCWD_GETCWD(buff, size) getcwd(buff, size)
|
||||
#define VCWD_FOPEN(path, mode) fopen(path, mode)
|
||||
#define VCWD_OPEN(path, flags) open(path, flags)
|
||||
#define VCWD_OPEN_MODE(path, flags, mode) open(path, flags, mode)
|
||||
#define VCWD_CREAT(path, mode) creat(path, mode)
|
||||
#define VCWD_RENAME(oldname, newname) rename(oldname, newname)
|
||||
#define VCWD_CHDIR(path) chdir(path)
|
||||
#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, chdir)
|
||||
#define VCWD_GETWD(buf) getwd(buf)
|
||||
#define VCWD_STAT(path, buff) stat(path, buff)
|
||||
#define VCWD_LSTAT(path, buff) lstat(path, buff)
|
||||
#define VCWD_UNLINK(path) unlink(path)
|
||||
#define VCWD_MKDIR(pathname, mode) mkdir(pathname, mode)
|
||||
#define VCWD_RMDIR(pathname) rmdir(pathname)
|
||||
#define VCWD_OPENDIR(pathname) opendir(pathname)
|
||||
#define VCWD_POPEN(command, type) popen(command, type)
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
#define VCWD_REALPATH(path, real_path) realpath(path, real_path)
|
||||
#else
|
||||
#define VCWD_REALPATH(path, real_path) strcpy(real_path, path)
|
||||
#endif
|
||||
|
||||
#if HAVE_UTIME
|
||||
#define VCWD_UTIME(path, time) utime(path, time)
|
||||
#endif
|
||||
#define VCWD_CHMOD(path, mode) chmod(path, mode)
|
||||
#ifndef TSRM_WIN32
|
||||
#define VCWD_CHOWN(path, owner, group) chown(path, owner, group)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* VIRTUAL_CWD_H */
|
||||
@@ -1,359 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 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/2_02.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. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Daniel Beulshausen <daniel@php4win.de> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <process.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include <windows.h>
|
||||
#include "tsrm_win32.h"
|
||||
|
||||
#ifdef ZTS
|
||||
static ts_rsrc_id win32_globals_id;
|
||||
#else
|
||||
static tsrm_win32_globals win32_globals;
|
||||
#endif
|
||||
|
||||
static void tsrm_win32_ctor(tsrm_win32_globals *globals TSRMLS_DC)
|
||||
{
|
||||
globals->process = NULL;
|
||||
globals->shm = NULL;
|
||||
globals->process_size = 0;
|
||||
globals->shm_size = 0;
|
||||
globals->comspec = _strdup((GetVersion()<0x80000000)?"cmd.exe":"command.com");
|
||||
}
|
||||
|
||||
static void tsrm_win32_dtor(tsrm_win32_globals *globals TSRMLS_DC)
|
||||
{
|
||||
shm_pair *ptr;
|
||||
|
||||
if (globals->process) {
|
||||
free(globals->process);
|
||||
}
|
||||
|
||||
if (globals->shm) {
|
||||
for (ptr = globals->shm; ptr < (globals->shm + globals->shm_size); ptr++) {
|
||||
UnmapViewOfFile(ptr->addr);
|
||||
CloseHandle(ptr->segment);
|
||||
UnmapViewOfFile(ptr->descriptor);
|
||||
CloseHandle(ptr->info);
|
||||
}
|
||||
free(globals->shm);
|
||||
}
|
||||
|
||||
free(globals->comspec);
|
||||
}
|
||||
|
||||
TSRM_API void tsrm_win32_startup(void)
|
||||
{
|
||||
#ifdef ZTS
|
||||
ts_allocate_id(&win32_globals_id, sizeof(tsrm_win32_globals), (ts_allocate_ctor)tsrm_win32_ctor, (ts_allocate_ctor)tsrm_win32_dtor);
|
||||
#else
|
||||
tsrm_win32_ctor(&win32_globals TSRMLS_CC);
|
||||
#endif
|
||||
}
|
||||
|
||||
TSRM_API void tsrm_win32_shutdown(void)
|
||||
{
|
||||
#ifndef ZTS
|
||||
tsrm_win32_dtor(&win32_globals TSRMLS_CC);
|
||||
#endif
|
||||
}
|
||||
|
||||
static process_pair *process_get(FILE *stream TSRMLS_DC)
|
||||
{
|
||||
process_pair *ptr;
|
||||
process_pair *newptr;
|
||||
|
||||
for (ptr = TWG(process); ptr < (TWG(process) + TWG(process_size)); ptr++) {
|
||||
if (ptr->stream == stream) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr < (TWG(process) + TWG(process_size))) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
newptr = (process_pair*)realloc((void*)TWG(process), (TWG(process_size)+1)*sizeof(process_pair));
|
||||
if (newptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TWG(process) = newptr;
|
||||
ptr = newptr + TWG(process_size);
|
||||
TWG(process_size)++;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static shm_pair *shm_get(int key, void *addr)
|
||||
{
|
||||
shm_pair *ptr;
|
||||
shm_pair *newptr;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
for (ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) {
|
||||
if (!ptr->descriptor) {
|
||||
continue;
|
||||
}
|
||||
if (!addr && ptr->descriptor->shm_perm.key == key) {
|
||||
break;
|
||||
} else if (ptr->addr == addr) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr < (TWG(shm) + TWG(shm_size))) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
newptr = (shm_pair*)realloc((void*)TWG(shm), (TWG(shm_size)+1)*sizeof(shm_pair));
|
||||
if (newptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TWG(shm) = newptr;
|
||||
ptr = newptr + TWG(shm_size);
|
||||
TWG(shm_size)++;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static HANDLE dupHandle(HANDLE fh, BOOL inherit) {
|
||||
HANDLE copy, self = GetCurrentProcess();
|
||||
if (!DuplicateHandle(self, fh, self, ©, 0, inherit, DUPLICATE_SAME_ACCESS|DUPLICATE_CLOSE_SOURCE)) {
|
||||
return NULL;
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
TSRM_API FILE *popen(const char *command, const char *type)
|
||||
{
|
||||
FILE *stream = NULL;
|
||||
int fno, str_len = strlen(type), read, mode;
|
||||
STARTUPINFO startup;
|
||||
PROCESS_INFORMATION process;
|
||||
SECURITY_ATTRIBUTES security;
|
||||
HANDLE in, out;
|
||||
char *cmd;
|
||||
process_pair *proc;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
security.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
security.bInheritHandle = TRUE;
|
||||
security.lpSecurityDescriptor = NULL;
|
||||
|
||||
if (!str_len || !CreatePipe(&in, &out, &security, 2048L)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(&startup, 0, sizeof(STARTUPINFO));
|
||||
memset(&process, 0, sizeof(PROCESS_INFORMATION));
|
||||
|
||||
startup.cb = sizeof(STARTUPINFO);
|
||||
startup.dwFlags = STARTF_USESTDHANDLES;
|
||||
startup.hStdError = GetStdHandle(STD_ERROR_HANDLE);
|
||||
|
||||
read = (type[0] == 'r') ? TRUE : FALSE;
|
||||
mode = ((str_len == 2) && (type[1] == 'b')) ? O_BINARY : O_TEXT;
|
||||
|
||||
|
||||
if (read) {
|
||||
in = dupHandle(in, FALSE);
|
||||
startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
|
||||
startup.hStdOutput = out;
|
||||
} else {
|
||||
out = dupHandle(out, FALSE);
|
||||
startup.hStdInput = in;
|
||||
startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
}
|
||||
|
||||
cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c "));
|
||||
sprintf(cmd, "%s /c %s", TWG(comspec), command);
|
||||
if (!CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, NORMAL_PRIORITY_CLASS, NULL, NULL, &startup, &process)) {
|
||||
return NULL;
|
||||
}
|
||||
free(cmd);
|
||||
|
||||
CloseHandle(process.hThread);
|
||||
proc = process_get(NULL TSRMLS_CC);
|
||||
|
||||
if (read) {
|
||||
fno = _open_osfhandle((long)in, _O_RDONLY | mode);
|
||||
CloseHandle(out);
|
||||
} else {
|
||||
fno = _open_osfhandle((long)out, _O_WRONLY | mode);
|
||||
CloseHandle(in);
|
||||
}
|
||||
|
||||
stream = _fdopen(fno, type);
|
||||
proc->prochnd = process.hProcess;
|
||||
proc->stream = stream;
|
||||
return stream;
|
||||
}
|
||||
|
||||
TSRM_API int pclose(FILE *stream)
|
||||
{
|
||||
DWORD termstat = 0;
|
||||
process_pair *process;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if ((process = process_get(stream TSRMLS_CC)) == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
fflush(process->stream);
|
||||
fclose(process->stream);
|
||||
|
||||
WaitForSingleObject(process->prochnd, INFINITE);
|
||||
GetExitCodeProcess(process->prochnd, &termstat);
|
||||
process->stream = NULL;
|
||||
CloseHandle(process->prochnd);
|
||||
|
||||
return termstat;
|
||||
}
|
||||
|
||||
TSRM_API int shmget(int key, int size, int flags)
|
||||
{
|
||||
shm_pair *shm;
|
||||
char shm_segment[26], shm_info[29];
|
||||
HANDLE shm_handle, info_handle;
|
||||
BOOL created = FALSE;
|
||||
|
||||
if (size < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
sprintf(shm_segment, "TSRM_SHM_SEGMENT:%d", key);
|
||||
sprintf(shm_info, "TSRM_SHM_DESCRIPTOR:%d", key);
|
||||
|
||||
shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment);
|
||||
info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
|
||||
|
||||
if ((!shm_handle && !info_handle)) {
|
||||
if (flags & IPC_EXCL) {
|
||||
return -1;
|
||||
}
|
||||
if (flags & IPC_CREAT) {
|
||||
shm_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, size, shm_segment);
|
||||
info_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(shm->descriptor), shm_info);
|
||||
created = TRUE;
|
||||
}
|
||||
if ((!shm_handle || !info_handle)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
shm = shm_get(key, NULL);
|
||||
shm->segment = shm_handle;
|
||||
shm->info = info_handle;
|
||||
shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
|
||||
|
||||
if (created) {
|
||||
shm->descriptor->shm_perm.key = key;
|
||||
shm->descriptor->shm_segsz = size;
|
||||
shm->descriptor->shm_ctime = time(NULL);
|
||||
shm->descriptor->shm_cpid = getpid();
|
||||
shm->descriptor->shm_perm.mode = flags;
|
||||
|
||||
shm->descriptor->shm_perm.cuid = shm->descriptor->shm_perm.cgid= 0;
|
||||
shm->descriptor->shm_perm.gid = shm->descriptor->shm_perm.uid = 0;
|
||||
shm->descriptor->shm_atime = shm->descriptor->shm_dtime = 0;
|
||||
shm->descriptor->shm_lpid = shm->descriptor->shm_nattch = 0;
|
||||
shm->descriptor->shm_perm.mode = shm->descriptor->shm_perm.seq = 0;
|
||||
}
|
||||
|
||||
if (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz ) {
|
||||
CloseHandle(shm->segment);
|
||||
UnmapViewOfFile(shm->descriptor);
|
||||
CloseHandle(shm->info);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
TSRM_API void *shmat(int key, const void *shmaddr, int flags)
|
||||
{
|
||||
shm_pair *shm = shm_get(key, NULL);
|
||||
|
||||
if (!shm->segment) {
|
||||
return (void*)-1;
|
||||
}
|
||||
|
||||
shm->descriptor->shm_atime = time(NULL);
|
||||
shm->descriptor->shm_lpid = getpid();
|
||||
shm->descriptor->shm_nattch++;
|
||||
|
||||
shm->addr = MapViewOfFileEx(shm->segment, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
|
||||
|
||||
return shm->addr;
|
||||
}
|
||||
|
||||
TSRM_API int shmdt(const void *shmaddr)
|
||||
{
|
||||
shm_pair *shm = shm_get(0, (void*)shmaddr);
|
||||
|
||||
if (!shm->segment) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
shm->descriptor->shm_dtime = time(NULL);
|
||||
shm->descriptor->shm_lpid = getpid();
|
||||
shm->descriptor->shm_nattch--;
|
||||
|
||||
return UnmapViewOfFile(shm->addr) ? 0 : -1;
|
||||
}
|
||||
|
||||
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf) {
|
||||
shm_pair *shm = shm_get(key, NULL);
|
||||
|
||||
if (!shm->segment) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (cmd) {
|
||||
case IPC_STAT:
|
||||
memcpy(buf, shm->descriptor, sizeof(struct shmid_ds));
|
||||
return 0;
|
||||
|
||||
case IPC_SET:
|
||||
shm->descriptor->shm_ctime = time(NULL);
|
||||
shm->descriptor->shm_perm.uid = buf->shm_perm.uid;
|
||||
shm->descriptor->shm_perm.gid = buf->shm_perm.gid;
|
||||
shm->descriptor->shm_perm.mode = buf->shm_perm.mode;
|
||||
return 0;
|
||||
|
||||
case IPC_RMID:
|
||||
if (shm->descriptor->shm_nattch < 1) {
|
||||
shm->descriptor->shm_perm.key = -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 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/2_02.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. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Daniel Beulshausen <daniel@php4win.de> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef TSRM_WIN32_H
|
||||
#define TSRM_WIN32_H
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include <windows.h>
|
||||
|
||||
struct ipc_perm {
|
||||
int key;
|
||||
unsigned short uid;
|
||||
unsigned short gid;
|
||||
unsigned short cuid;
|
||||
unsigned short cgid;
|
||||
unsigned short mode;
|
||||
unsigned short seq;
|
||||
};
|
||||
|
||||
struct shmid_ds {
|
||||
struct ipc_perm shm_perm;
|
||||
int shm_segsz;
|
||||
time_t shm_atime;
|
||||
time_t shm_dtime;
|
||||
time_t shm_ctime;
|
||||
unsigned short shm_cpid;
|
||||
unsigned short shm_lpid;
|
||||
short shm_nattch;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
FILE *stream;
|
||||
HANDLE prochnd;
|
||||
} process_pair;
|
||||
|
||||
typedef struct {
|
||||
void *addr;
|
||||
HANDLE info;
|
||||
HANDLE segment;
|
||||
struct shmid_ds *descriptor;
|
||||
} shm_pair;
|
||||
|
||||
typedef struct {
|
||||
process_pair *process;
|
||||
shm_pair *shm;
|
||||
int process_size;
|
||||
int shm_size;
|
||||
char *comspec;
|
||||
} tsrm_win32_globals;
|
||||
|
||||
#ifdef ZTS
|
||||
# define TWG(v) TSRMG(win32_globals_id, tsrm_win32_globals *, v)
|
||||
#else
|
||||
# define TWG(v) (win32_globals.v)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define IPC_PRIVATE 0
|
||||
#define IPC_CREAT 00001000
|
||||
#define IPC_EXCL 00002000
|
||||
#define IPC_NOWAIT 00004000
|
||||
|
||||
#define IPC_RMID 0
|
||||
#define IPC_SET 1
|
||||
#define IPC_STAT 2
|
||||
#define IPC_INFO 3
|
||||
|
||||
#define SHM_R PAGE_READONLY
|
||||
#define SHM_W PAGE_READWRITE
|
||||
|
||||
#define SHM_RDONLY FILE_MAP_READ
|
||||
#define SHM_RND FILE_MAP_WRITE
|
||||
#define SHM_REMAP FILE_MAP_COPY
|
||||
|
||||
|
||||
TSRM_API void tsrm_win32_startup(void);
|
||||
TSRM_API void tsrm_win32_shutdown(void);
|
||||
|
||||
TSRM_API FILE *popen(const char *command, const char *type);
|
||||
TSRM_API int pclose(FILE *stream);
|
||||
|
||||
TSRM_API int shmget(int key, int size, int flags);
|
||||
TSRM_API void *shmat(int key, const void *shmaddr, int flags);
|
||||
TSRM_API int shmdt(const void *shmaddr);
|
||||
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf);
|
||||
|
||||
#endif
|
||||
+50
-110
@@ -1,116 +1,56 @@
|
||||
---------------------------------------------------------------------------
|
||||
The Zend License, version 0.92
|
||||
Copyright (C) 1999-2001 Zend Technologies Ltd.
|
||||
---------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------
|
||||
The Zend Engine License, version 2.00
|
||||
Copyright (c) 1999-2002 Zend Technologies Ltd. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
The Zend scripting engine library is a product of Zend Technologies Ltd.
|
||||
It may be used and/or distributed under the terms of the Q Public
|
||||
License (QPL) version 1.0, enclosed below.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, is permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
For more information about Zend please visit http://www.zend.com/
|
||||
For license related questions please mail license@zend.com
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
3. The names "Zend" and "Zend Engine" must not be used to endorse
|
||||
or promote products derived from this software without prior
|
||||
permission from Zend Technologies Ltd. For written permission,
|
||||
please contact license@zend.com.
|
||||
|
||||
4. Zend Technologies Ltd. may publish revised and/or new versions
|
||||
of the license from time to time. Each version will be given a
|
||||
distinguishing version number.
|
||||
Once covered code has been published under a particular version
|
||||
of the license, you may always continue to use it under the
|
||||
terms of that version. You may also choose to use such covered
|
||||
code under the terms of any subsequent version of the license
|
||||
published by Zend Technologies Ltd. No one other than Zend
|
||||
Technologies Ltd. has the right to modify the terms applicable
|
||||
to covered code created under this License.
|
||||
|
||||
===========================================================================
|
||||
5. Redistributions of any form whatsoever must retain the following
|
||||
acknowledgment:
|
||||
"This product includes the Zend Engine, freely available at
|
||||
http://www.zend.com"
|
||||
|
||||
THE Q PUBLIC LICENSE
|
||||
version 1.0
|
||||
6. All advertising materials mentioning features or use of this
|
||||
software must display the following acknowledgment:
|
||||
"The Zend Engine is freely available at http://www.zend.com"
|
||||
|
||||
Copyright (C) 1999 Troll Tech AS, Norway.
|
||||
Everyone is permitted to copy and
|
||||
distribute this license document.
|
||||
THIS SOFTWARE IS PROVIDED BY ZEND TECHNOLOGIES LTD. ``AS IS'' AND
|
||||
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ZEND
|
||||
TECHNOLOGIES LTD. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
The intent of this license is to establish freedom to share and change the
|
||||
software regulated by this license under the open source model.
|
||||
|
||||
This license applies to any software containing a notice placed by the
|
||||
copyright holder saying that it may be distributed under the terms of
|
||||
the Q Public License version 1.0. Such software is herein referred to as
|
||||
the Software. This license covers modification and distribution of the
|
||||
Software, use of third-party application programs based on the Software,
|
||||
and development of free software which uses the Software.
|
||||
|
||||
Granted Rights
|
||||
|
||||
1. You are granted the non-exclusive rights set forth in this license
|
||||
provided you agree to and comply with any and all conditions in this
|
||||
license. Whole or partial distribution of the Software, or software
|
||||
items that link with the Software, in any form signifies acceptance of
|
||||
this license.
|
||||
|
||||
2. You may copy and distribute the Software in unmodified form provided
|
||||
that the entire package, including - but not restricted to - copyright,
|
||||
trademark notices and disclaimers, as released by the initial developer
|
||||
of the Software, is distributed.
|
||||
|
||||
3. You may make modifications to the Software and distribute your
|
||||
modifications, in a form that is separate from the Software, such as
|
||||
patches. The following restrictions apply to modifications:
|
||||
|
||||
a. Modifications must not alter or remove any copyright notices in
|
||||
the Software.
|
||||
|
||||
b. When modifications to the Software are released under this
|
||||
license, a non-exclusive royalty-free right is granted to the
|
||||
initial developer of the Software to distribute your modification
|
||||
in future versions of the Software provided such versions remain
|
||||
available under these terms in addition to any other license(s) of
|
||||
the initial developer.
|
||||
|
||||
4. You may distribute machine-executable forms of the Software or
|
||||
machine-executable forms of modified versions of the Software, provided
|
||||
that you meet these restrictions:
|
||||
|
||||
a. You must include this license document in the distribution.
|
||||
|
||||
b. You must ensure that all recipients of the machine-executable forms
|
||||
are also able to receive the complete machine-readable source code
|
||||
to the distributed Software, including all modifications, without
|
||||
any charge beyond the costs of data transfer, and place prominent
|
||||
notices in the distribution explaining this.
|
||||
|
||||
c. You must ensure that all modifications included in the
|
||||
machine-executable forms are available under the terms of this
|
||||
license.
|
||||
|
||||
5. You may use the original or modified versions of the Software to
|
||||
compile, link and run application programs legally developed by you
|
||||
or by others.
|
||||
|
||||
6. You may develop application programs, reusable components and other
|
||||
software items that link with the original or modified versions of the
|
||||
Software. These items, when distributed, are subject to the following
|
||||
requirements:
|
||||
|
||||
a. You must ensure that all recipients of machine-executable forms of
|
||||
these items are also able to receive and use the complete
|
||||
machine-readable source code to the items without any charge
|
||||
beyond the costs of data transfer.
|
||||
|
||||
b. You must explicitly license all recipients of your items to use
|
||||
and re-distribute original and modified versions of the items in
|
||||
both machine-executable and source code forms. The recipients must
|
||||
be able to do so without any charges whatsoever, and they must be
|
||||
able to re-distribute to anyone they choose.
|
||||
|
||||
|
||||
c. If the items are not available to the general public, and the
|
||||
initial developer of the Software requests a copy of the items,
|
||||
then you must supply one.
|
||||
|
||||
Limitations of Liability
|
||||
|
||||
In no event shall the initial developers or copyright holders be liable
|
||||
for any damages whatsoever, including - but not restricted to - lost
|
||||
revenue or profits or other direct, indirect, special, incidental or
|
||||
consequential damages, even if they have been advised of the possibility
|
||||
of such damages, except to the extent invariable law, if any, provides
|
||||
otherwise.
|
||||
|
||||
No Warranty
|
||||
|
||||
The Software and this license document are provided AS IS with NO WARRANTY
|
||||
OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
===========================================================================
|
||||
--------------------------------------------------------------------
|
||||
+2
-2
@@ -13,7 +13,7 @@ libZend_la_SOURCES=\
|
||||
zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
|
||||
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_objects.c
|
||||
zend_ini.c zend_qsort.c zend_objects.c
|
||||
|
||||
libZend_la_LDFLAGS = @EXTRA_LIBS@
|
||||
|
||||
@@ -45,5 +45,5 @@ zend_ini_parser.h: zend_ini_parser.c
|
||||
depend:
|
||||
|
||||
zend_execute.lo: $(srcdir)/zend_execute.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(INLINE_CFLAGS) -c $(srcdir)/zend_execute.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(INLINE_CFLAGS) -c $(srcdir)/zend_execute.c
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
Revamped object model using object handles
|
||||
===========================================
|
||||
|
||||
Background
|
||||
----------
|
||||
|
||||
In the Zend Engine 1.0 (and its predecessor the PHP 3 scripting
|
||||
engine) the object model's design is that instantiated objects are
|
||||
language values. This means that when programmers are performing
|
||||
operations, such variable assignment and passing parameters to
|
||||
functions, objects are handled very similarly to the way other
|
||||
primitive types are handled such as integers and strings.
|
||||
Semantically this means that the whole object is being copied. The
|
||||
approach Java takes is different where one refers to objects by handle
|
||||
and not by value (one can think of a handle as an objects' ID).
|
||||
|
||||
Need
|
||||
----
|
||||
|
||||
Unfortunately, the approach taken up to now has severely limited the
|
||||
Zend Engine's object oriented model, both feature and simplicity
|
||||
wise. One of the main problems with the former approach is that object
|
||||
instantiation and duplication is very hard to control, a problem which
|
||||
can not only lead to inefficient development but also often to strange
|
||||
run-time behavior. Changing the object model to a handle oriented
|
||||
model will allow the addressing of many needs such as destructors,
|
||||
de-referencing method return values, tight control of object
|
||||
duplication and more.
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
The proposed object model is very much influenced by the Java
|
||||
model. In general, when you create a new object you will be getting a
|
||||
handle to the object instead of the object itself. When this handle is
|
||||
sent to functions, assigned and copied it is only the handle which is
|
||||
copied/sent/assigned. The object itself is never copied nor
|
||||
duplicated. This results in all handles of this object to always point
|
||||
at the same object making it a very consistent solution and saving
|
||||
unnecessary duplication and confusing behavior.
|
||||
|
||||
Functionality
|
||||
-------------
|
||||
|
||||
After this change the basic use of objects will be almost identical to
|
||||
previous versions of the scripting engine. However, you won't bump
|
||||
into awkward and confusing copying & destructing of objects. In order
|
||||
to create and use a new object instance you will do the following:
|
||||
$object = new MyClass(); $object->method();
|
||||
|
||||
The previous code will assign $object the handle of a new instance of
|
||||
the class MyClass and call one of its methods.
|
||||
|
||||
|
||||
Consider the following code:
|
||||
|
||||
1 class MyClass
|
||||
2 {
|
||||
3 function setMember($value)
|
||||
4 {
|
||||
5 $this->member = $value;
|
||||
6 }
|
||||
7
|
||||
8 function getMember()
|
||||
9 {
|
||||
10 return $this->member;
|
||||
11 }
|
||||
12 }
|
||||
13
|
||||
14 function foo($obj)
|
||||
15 {
|
||||
16 $obj->setMember("foo");
|
||||
17 }
|
||||
18
|
||||
19 $object = new MyClass();
|
||||
20 $object->setMember("bar");
|
||||
21 foo($object);
|
||||
22 print $object->getMember();
|
||||
|
||||
Without the new Java-like handles, at line 20 the objects' data member
|
||||
member is set to the string value of "bar". Because of the internal
|
||||
representation of objects in the Zend Engine 1.0, the object is marked
|
||||
as a reference, and when it is sent by value to the function foo, it
|
||||
is duplicated (!). Therefore, the call to foo() on line 21 will
|
||||
result in the $obj->setMember("foo") call being called on a duplicate
|
||||
of $object. Line 22 will then result in "bar" being printed.
|
||||
|
||||
This is how the scripting engine has worked until today. Most
|
||||
developers are probably unaware of the fact that they aren't always
|
||||
talking to the same object but often duplicates; others may have
|
||||
realized this can usually be solved by always passing objects by
|
||||
reference (unless a replica is actually desired, which is uncommon).
|
||||
|
||||
The new object model will allow for a much more intuitive
|
||||
implementation of the code. On line 21, the object's handle (ID) is
|
||||
passed to foo() by value. Inside foo(), the object is fetched
|
||||
according to this handle and, therefore, the setMember() method is
|
||||
called on the originally instantiated object and not a copy. Line 22
|
||||
will therefore result in "foo" being printed. This approach gives
|
||||
developers tighter control of when objects are created and duplicated.
|
||||
An additional not-as-important benefit is that the object handle will
|
||||
be passed to foo() by value, which most probably will also save
|
||||
unnecessary duplication of the value containing the ID itself and thus
|
||||
additionally improving run-time performance.
|
||||
|
||||
This was just a simple description of why the new object model solves
|
||||
awkward behavior and makes object handling much easier, intuitive and
|
||||
efficient. The importance of this change goes far beyond what is
|
||||
mentioned in this section as you will see in further sections which
|
||||
describe new features with a majority of them being based on this
|
||||
change.
|
||||
|
||||
Compatibility Notes
|
||||
--------------------
|
||||
|
||||
Many PHP programmers aren't even aware of the copying quirks of the
|
||||
current object model and, therefore, there is a relatively good chance
|
||||
that the amount of PHP applications that will work out of the box or
|
||||
after a very small amount of modifications would be high.
|
||||
|
||||
To simplify migration, version 2.0 will support an optional
|
||||
'auto-clone' feature, which will perform a cloning of the object
|
||||
whenever it would have been copied in version 1.0. Optionally, it
|
||||
will also be possible to request that the engine will emit an E_NOTICE
|
||||
message whenever such an automatic clone occurs, in order to allow
|
||||
developers to gradually migrate to the version 2.0-style behavior
|
||||
(without automatic clones).
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
The new object model is not dependent on other features. Many of the
|
||||
other Zend Engine 2.0 features, such as the $foo->bar()->barbara()
|
||||
syntax, destructors and others completely rely on this new object
|
||||
model.
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
Title: Zend 2.0 Namespaces
|
||||
Version: $Revision$
|
||||
Status: draft
|
||||
Maintainer: Stig S. Bakken <ssb@fast.no>
|
||||
Created: 2001-09-08
|
||||
Modified: 2001-09-08
|
||||
|
||||
|
||||
1. Background/Need
|
||||
==================
|
||||
|
||||
PHP and Zend 1.0 have come to a point where a lot of reusable code is
|
||||
being written; from simple functions and classes to entire application
|
||||
frameworks. It is becoming increasingly difficult to avoid symbol
|
||||
name collisions with the current scoping methods.
|
||||
|
||||
The symbol scopes available in Zend 1.0 are the global scope, the
|
||||
class scope and the function scope. All scopes but classes may
|
||||
contain variables, only the class and global scopes may contain
|
||||
functions, while only the global scope may contain constants and
|
||||
classes. This means that all of Zend 1.0's scoping methods are
|
||||
inherently limited for solving symbol name collision problems.
|
||||
|
||||
|
||||
2. Overview
|
||||
===========
|
||||
|
||||
Namespaces in Zend 2.0 provide a way to manage the symbol collision
|
||||
problem by making it possible to define multiple symbol tables able to
|
||||
contain all types of symbols. Zend will get the notion of a current
|
||||
namespace, defaulting to the current global one. The current name
|
||||
space may be changed on a file-by-file basis. Symbols in other name
|
||||
spaces than the current one may be referenced using a new namespace
|
||||
operator. It will be possible to "import" symbols from one namespace
|
||||
into another.
|
||||
|
||||
|
||||
3. Functionality
|
||||
================
|
||||
|
||||
3.1. Namespace Syntax
|
||||
=====================
|
||||
|
||||
The namespace operator ":" is used to refer to symbols in other
|
||||
namespaces than the current one:
|
||||
|
||||
Class: Namespace:class
|
||||
Function: Namespace:function
|
||||
Static method: Namespace:class::method
|
||||
Variable: $Namespace:variable
|
||||
Constant: Namespace:CONSTANT
|
||||
Class variable: $Namespace:class::variable
|
||||
|
||||
To refer to symbols in the global namespace, symbols are prefixed with
|
||||
only the namespace operator:
|
||||
|
||||
Class: :class
|
||||
Function: :function
|
||||
Static method: :class::method
|
||||
Variable: $:variable
|
||||
Constant: :CONSTANT
|
||||
Class variable: $:class::variable
|
||||
|
||||
Note: $:variable will effectively be just another syntax for
|
||||
$GLOBALS['variable'].
|
||||
|
||||
A namespace may have a name containing a ":", it is always the last
|
||||
":" character in the symbol qualifier that is the actual namespace
|
||||
operator:
|
||||
|
||||
Class: Name:Space:class
|
||||
Function: Name:Space:function
|
||||
Static method: Name:Space:class::method
|
||||
Variable: $Name:Space:variable
|
||||
Constant: Name:Space:CONSTANT
|
||||
Class variable: $Name:Space:class::variable
|
||||
|
||||
(Here, the ":" between "Name" and "Space" is part of the name, it is
|
||||
the one after "Space" that is the namespace operator.)
|
||||
|
||||
|
||||
3.2. Defining Namespaces
|
||||
========================
|
||||
|
||||
Individual files may define a namespace that will apply to the entire
|
||||
file. If no "namespace" operator occurs in the file, it will be in
|
||||
the global namespace:
|
||||
|
||||
1 namespace HTML;
|
||||
2
|
||||
3 class Form {
|
||||
4 function Form() {
|
||||
5 // constructor
|
||||
6 }
|
||||
7 // ...
|
||||
8 }
|
||||
|
||||
Or with the "nested" name syntax:
|
||||
|
||||
1 namespace HTML:Form;
|
||||
2
|
||||
3 class Image {
|
||||
4 var $src;
|
||||
5 function Image($src) {
|
||||
6 $this->src = $src;
|
||||
7 }
|
||||
8 // ...
|
||||
9 }
|
||||
|
||||
Code executed within the "HTML" namespace may refer to the Form class
|
||||
as just "Form". Code executed from within other namespaces has to
|
||||
refer to it as "HTML:Form". The "namespace" statement must occur
|
||||
before any other statements in the file.
|
||||
|
||||
# [ssb 2001-09-08]:
|
||||
# Should it be possible to "add" symbols to a namespace by including a
|
||||
# second file with the same namespace statement?
|
||||
|
||||
|
||||
3.3. Importing Symbols
|
||||
======================
|
||||
|
||||
It is possible to import symbols from another namespace into the
|
||||
current one with the "import" statement:
|
||||
|
||||
import * from HTML; // all symbols
|
||||
|
||||
import Form from HTML; // single symbols
|
||||
|
||||
import Form,Table from HTML; // multiple symbols
|
||||
|
||||
There is a potential for name clashes between symols of different
|
||||
types that have the same qualifier syntax. These are resolved in this
|
||||
order: class, function, constant.
|
||||
|
||||
Optionally, the symbol type may be explicitly given to import (as
|
||||
"class", "function", "variable" or "constant"):
|
||||
|
||||
import class Form from HTML;
|
||||
|
||||
And finally, you may import all symbols of a given type:
|
||||
|
||||
import constant * from HTML:Table;
|
||||
|
||||
The namespace with its symbols must already be defined before using
|
||||
"import".
|
||||
|
||||
|
||||
4. Compatibility Notes
|
||||
======================
|
||||
|
||||
Old code that does not take advantage of namespaces will run without
|
||||
modifications.
|
||||
|
||||
|
||||
5. Dependencies
|
||||
===============
|
||||
|
||||
The class variable syntax depends on this class variables being
|
||||
implemented in the new ZE2 object model.
|
||||
|
||||
|
||||
6. Acknowledgements
|
||||
===================
|
||||
|
||||
Andi Gutmans <andi@zend.com> and Zeev Suraski <zeev@zend.com> for
|
||||
initial ZE2 namespaces proposal
|
||||
|
||||
Dean Hall <php@apt7.com> for the initial symbol qualification syntax
|
||||
@@ -0,0 +1,72 @@
|
||||
Title: Loose type requirements for functions
|
||||
Version: $Revision$
|
||||
Status: draft
|
||||
Maintainer: Brian Moon <brianm@dealnews.com>
|
||||
Created: 2001-09-17
|
||||
Modified: 2001-09-17
|
||||
|
||||
|
||||
1. Background/Need
|
||||
==================
|
||||
|
||||
Many internal function of PHP will reject parameters because of their
|
||||
type (the array and variable function come to mind). For userland
|
||||
this is not an easy task as there is no uniform way to do it. An
|
||||
addition to the engine for requiring loose types would allow
|
||||
delevopers to know that the data passed to their functions is of the
|
||||
correct type and reduce the need for duplicating the same code in
|
||||
every function to check for the type of data.
|
||||
|
||||
|
||||
2. Overview
|
||||
===========
|
||||
|
||||
Loose typing mostly means evaluating the contents of the variable and
|
||||
not the type of the variable itself. The requirements for this would
|
||||
and should work much like several of the is_* functions do now.
|
||||
|
||||
The typing of parameters would be optional and those not typed would
|
||||
simply continue to be treated as they are now.
|
||||
|
||||
3. Functionality
|
||||
================
|
||||
|
||||
3.1. Allowed Types
|
||||
==================
|
||||
|
||||
Only loose types should be needed to ensure the data is usable by the
|
||||
function. Duplicating the functionallity of is_scalar, is_resource,
|
||||
is_array and is_object should give developers all the information they
|
||||
need to use a variable correctly.
|
||||
|
||||
3.2. Syntax
|
||||
===========
|
||||
|
||||
The current function syntax should be expanded to allow typing of
|
||||
variables inline in a C style.
|
||||
|
||||
function foo ($var){
|
||||
}
|
||||
|
||||
could be changed to require an array such as:
|
||||
|
||||
function foo (array $var){
|
||||
}
|
||||
|
||||
3.3. Errors
|
||||
===========
|
||||
|
||||
Mis-matches in type should be reported as fatal errors and should halt
|
||||
the execution of a script as that function can not be run and code
|
||||
following could not reliably run.
|
||||
|
||||
|
||||
4. Compatibility Notes
|
||||
======================
|
||||
|
||||
Old code that does not take advantage of this will run without
|
||||
modifications.
|
||||
|
||||
|
||||
|
||||
|
||||
+245
-101
@@ -1,112 +1,256 @@
|
||||
Improvements
|
||||
------------
|
||||
Changes in the Zend Engine 2.0
|
||||
|
||||
Zend was designed from the ground up for increased speed,
|
||||
reduced memory consumption and more reliable execution. We dare
|
||||
say it meets all of these goals and does so pretty well. Beyond
|
||||
that, there are several improvements in the language engine
|
||||
features:
|
||||
* New object model.
|
||||
|
||||
* References support. $foo = &$a; would make $foo and $a be two
|
||||
names to the same variable. This works with arrays as well,
|
||||
on either side; e.g., $foo = &$a[7]; would make $foo and $a[7]
|
||||
be two names to the same variable. Changing one would change
|
||||
the other and vice versa.
|
||||
* Object overloading support. This feature allows various OO
|
||||
libraries to use the OO notation of PHP to access their
|
||||
functionality. Right now, no use is made of that feature,
|
||||
but we'd have a COM module ready by the time PHP 4.0 is released.
|
||||
A CORBA module would probably follow.
|
||||
* include() and eval() are now functions, and not statements.
|
||||
That means they return a value. The default return value from
|
||||
include() and eval() is 1, so that you can do if (include())
|
||||
without further coding. The return value may be changed by
|
||||
returning a value from the global scope of the included file
|
||||
or the evaluated string. For example, if 'return 7;' is executed
|
||||
in the global scope of foo.inc, include("foo.inc") would evaluate
|
||||
to 7.
|
||||
* Automatic resource deallocation. Several people have been bitten
|
||||
by the fact that PHP 3.0 had no concept of reference counting.
|
||||
Zend adds full reference counting for every value in the system,
|
||||
including resources. As soon as a resource is no longer referenced
|
||||
from any variable, it is automatically destroyed to save memory
|
||||
and resources. The most obvious example for the advantage in this
|
||||
is a loop that has an SQL query inside it, something like
|
||||
'$result = sql_query(...);'. In PHP 3.0, every iteration resulted
|
||||
in another SQL result-set allocated in the memory, and all of the
|
||||
result sets weren't destroyed until the end of the script's execution.
|
||||
In Zend, as soon as we overwrite an old result set with a new one,
|
||||
the old result set which is no longer referenced, is destroyed.
|
||||
* Full support for nesting arrays and objects within each other, in
|
||||
as many levels as you want.
|
||||
* Boolean type. true and false are now constants of type boolean.
|
||||
Comparing any other value to them would convert that value to a
|
||||
boolean first, and conduct the comparison later. That means, for
|
||||
example, that 5==true would evaluate to true (in PHP 3.0, true
|
||||
was nothing but a constant for the integer value of 1, so 5==true
|
||||
was identical to 5==1, which was false).
|
||||
* Runtime binding of function names. This complex name has a simple
|
||||
explanation - you can now call functions before they're declared!
|
||||
* Added here-docs support.
|
||||
* Added foreach. Two syntaxes supported:
|
||||
foreach(array_expr as $val) statement
|
||||
foreach(array_expr as $key => $val) statement
|
||||
* A true unset() implementation. A variable or element that is unset(), is now
|
||||
sent to oblivion in its entirely, no trace remains from it.
|
||||
* Output buffering support! Use ob_start() to begin output buffering, ob_end_flush()
|
||||
to end buffering and send out the buffered contents, ob_end_clean() to end buffering
|
||||
without sending the buffered contents, and ob_get_contents() to retreive the current
|
||||
contents of the output buffer.
|
||||
Header information (header(), content type, cookies) are not buffered. By turning
|
||||
on output buffering, you can effectively send header information all throughout your
|
||||
file, regardless of whether you've emitted body output or not.
|
||||
* Full variable reference within quoted strings:
|
||||
${expr} - full indirect reference support for scalar variables
|
||||
{variable} - full variable support
|
||||
For example:
|
||||
$foo[5]["bar"] = "foobar";
|
||||
print "{$foo[5]["bar"]}"; // would print "foobar"
|
||||
* Ability to call member functions of other classes from within member functions or from
|
||||
the global scope. You can now, for example, override a parent function with a child function,
|
||||
and call the parent function from it.
|
||||
* Runtime information for classes (class name, parent, available functions, etc.).
|
||||
* Much more efficient syntax highlighter - runs much quicker, performs more reliably, and
|
||||
generates much tighter HTML.
|
||||
* A full-featured debugger has been integrated with the language (supports breakpoints,
|
||||
expression evaluation, step-in/over, function call backtrace, and more).
|
||||
The Zend Engine's handling of objects has been completely
|
||||
changed in order to allow for new features, but also to increase
|
||||
its performance.
|
||||
|
||||
Objects were handled in previous versions like primitive types
|
||||
(for instance integers and strings). The drawback of this method
|
||||
is, that semantically the whole object was copied when a
|
||||
variable was assigned or parameters were passed to a method. The
|
||||
new approach refers to objects by handle and not by value (one
|
||||
can think of a handle as an objects' ID).
|
||||
|
||||
Incompatabilities
|
||||
-----------------
|
||||
Many PHP programmers aren't even aware of the copying quirks of
|
||||
the old object model and, therefore, there is a relatively good
|
||||
chance that the amount of PHP applications that will work out of
|
||||
the box or after a very small amount of modifications would be
|
||||
high.
|
||||
|
||||
Zend claims 100% compatability with the engine of PHP 3.0, and is
|
||||
shamelessly lying about it. Here's why:
|
||||
To simplify migration, the Zend Engine 2.0 supports an optional
|
||||
'auto-clone' feature, which performs a cloning of the object
|
||||
whenever it would have been copied in version 1.0. Optionally,
|
||||
it emits an E_NOTICE message whenever such an automatic clone
|
||||
occurs, in order to allow developers to gradually migrate to the
|
||||
version 2.0-style behavior (without automatic clones).
|
||||
|
||||
* static variable initializers only accept scalar values
|
||||
(in PHP 3.0 they accepted any valid expression). The impact
|
||||
should be somewhere in between void and non existent, since
|
||||
initializing a static variable with anything but a simple
|
||||
static value makes no sense at all.
|
||||
* delete statement.
|
||||
|
||||
* The scope of break and continue is local to that of an
|
||||
include()'d file or an eval()'d string. The impact should
|
||||
be somewhat smaller of the one above.
|
||||
The Zend Engine 1.0 had no means to force deletion of an object
|
||||
if there are still references to it. The newly introduces delete
|
||||
statement calls the object’s destructor and frees it even if the
|
||||
object is referenced by some other places in the engine. Other
|
||||
references to the deleted object become stale and trying to
|
||||
access them results in a fatal error.
|
||||
|
||||
* return statement from a require()'d file no longer works. It
|
||||
hardly worked in PHP 3.0, so the impact should be fairly small.
|
||||
If you want this functionality - use include() instead.
|
||||
Note that if you have a user-defined function delete() in an old
|
||||
script, this script will yield a parser error with the Zend
|
||||
Engine 2.0, since 'delete' is now a reserved word.
|
||||
|
||||
* unset() is no longer a function, but a statement. It was never
|
||||
documented as a function so the impact should be no bigger than
|
||||
nada.
|
||||
* Exceptions.
|
||||
|
||||
* The following letter combination is not supported within encapsulated
|
||||
strings: "{$". If you have a string that includes this letter
|
||||
combination, for example, print "{$somevar"; (which printed the
|
||||
letter { and the contents of the variable $somevar in PHP 3.0),
|
||||
it will result in a parse error under Zend. In this case, you
|
||||
would have to change the code to print "\{$somevar";
|
||||
This incompatability is due to the full variable reference
|
||||
within quoted strings feature added in Zend.
|
||||
|
||||
The Zend Engine 1.0 had no exception handling. The Zend Engine 2.0
|
||||
introduces a exception model similar to that of other programming
|
||||
languages.
|
||||
|
||||
Example
|
||||
|
||||
try {
|
||||
code
|
||||
|
||||
if (failure) {
|
||||
throw new MyException(Failure);
|
||||
}
|
||||
|
||||
code
|
||||
} catch ($exception) {
|
||||
handle exception
|
||||
|
||||
throw $exception; // Re-throw exception.
|
||||
}
|
||||
|
||||
Old code that does not use exceptions will run without
|
||||
modifications.
|
||||
|
||||
* Namespaces.
|
||||
|
||||
The Zend Engine 1.0 provided only three scopes: the global
|
||||
scope, the class scope and the function scope. All scopes but
|
||||
classes could contain variables, only the class and global
|
||||
scopes could contain functions, while only the global scope
|
||||
could contain constants and classes. This means that all of the
|
||||
Zend Engine 1.0's scoping methods were inherently limited for
|
||||
solving symbol name collision problems.
|
||||
|
||||
The Zend Engine 2.0 introduces the concept of namespaces to
|
||||
manage the symbol collision problem by making it possible to
|
||||
define multiple symbol tables able to contain all types of
|
||||
symbols. The Zend Engine is aware of a current namespace,
|
||||
defaulting to the current global one. The current namespace may
|
||||
be changed on a file-by-file basis. Symbols in other namespaces
|
||||
than the current one may be referenced using a new namespace
|
||||
operator. It is possible to "import" symbols from one namespace
|
||||
into another.
|
||||
|
||||
Old code that does not take advantage of namespaces will run
|
||||
without modifications.
|
||||
|
||||
* Static member variables of static classes can now be
|
||||
initialized.
|
||||
|
||||
<?php
|
||||
class foo
|
||||
{
|
||||
static $my_static = 5;
|
||||
}
|
||||
|
||||
print foo::$my_static;
|
||||
?>
|
||||
|
||||
* Class constants.
|
||||
|
||||
<?php
|
||||
class foo
|
||||
{
|
||||
const hey = "hello";
|
||||
}
|
||||
|
||||
print foo::hey;
|
||||
?>
|
||||
|
||||
Changes in the Zend Engine 1.0
|
||||
|
||||
The Zend Engine was designed from the ground up for increased speed,
|
||||
reduced memory consumption and more reliable execution. We dare say
|
||||
it meets all of these goals and does so pretty well. Beyond that,
|
||||
there are several improvements in the language engine features:
|
||||
|
||||
* References support.
|
||||
|
||||
$foo = &$a; would make $foo and $a be two names to the same
|
||||
variable. This works with arrays as well, on either side; e.g.,
|
||||
$foo = &$a[7]; would make $foo and $a[7] be two names to the
|
||||
same variable. Changing one would change the other and vice
|
||||
versa.
|
||||
|
||||
* Object overloading support.
|
||||
|
||||
This feature allows various OO libraries to use the OO notation
|
||||
of PHP to access their functionality. Right now, no use is made
|
||||
of that feature, but we'd have a COM module ready by the time
|
||||
PHP 4.0 is released. A CORBA module would probably follow.
|
||||
|
||||
* include() and eval() are now functions, and not statements.
|
||||
|
||||
That means they return a value. The default return value from
|
||||
include() and eval() is 1, so that you can do if (include())
|
||||
without further coding. The return value may be changed by
|
||||
returning a value from the global scope of the included file or
|
||||
the evaluated string. For example, if 'return 7;' is executed in
|
||||
the global scope of foo.inc, include("foo.inc") would evaluate
|
||||
to 7.
|
||||
|
||||
* Automatic resource deallocation.
|
||||
|
||||
Several people have been bitten by the fact that PHP 3.0 had no
|
||||
concept of reference counting. The Zend Engine adds full
|
||||
reference counting for every value in the system, including
|
||||
resources. As soon as a resource is no longer referenced from
|
||||
any variable, it is automatically destroyed to save memory and
|
||||
resources. The most obvious example for the advantage in this is
|
||||
a loop that has an SQL query inside it, something like '$result
|
||||
= sql_query(...);'. In PHP 3.0, every iteration resulted in
|
||||
another SQL result-set allocated in the memory, and all of the
|
||||
result sets weren't destroyed until the end of the script's
|
||||
execution. With the Zend Engine, as soon as we overwrite an old
|
||||
result set with a new one, the old result set which is no longer
|
||||
referenced, is destroyed.
|
||||
|
||||
* Full support for nesting arrays and objects within each other,
|
||||
in as many levels as you want.
|
||||
|
||||
* true and false are now constants of type boolean.
|
||||
|
||||
Comparing any other value to them would convert that value to a
|
||||
boolean first, and conduct the comparison later. That means, for
|
||||
example, that 5==true would evaluate to true (in PHP 3.0, true
|
||||
was nothing but a constant for the integer value of 1, so
|
||||
5==true was identical to 5==1, which was false).
|
||||
|
||||
* Runtime binding of function names.
|
||||
|
||||
This complex name has a simple explanation - you can now call
|
||||
functions before they're declared!
|
||||
|
||||
* Added here-docs support.
|
||||
|
||||
* Added foreach.
|
||||
|
||||
Two syntaxes supported:
|
||||
|
||||
foreach(array_expr as $val) statement
|
||||
foreach(array_expr as $key => $val) statement
|
||||
|
||||
* A true unset() implementation.
|
||||
|
||||
A variable or element that is unset(), is now sent to oblivion
|
||||
in its entirely, no trace remains from it.
|
||||
|
||||
* Output buffering support.
|
||||
|
||||
Use ob_start() to begin output buffering, ob_end_flush() to end
|
||||
buffering and send out the buffered contents, ob_end_clean() to
|
||||
end buffering without sending the buffered contents, and
|
||||
ob_get_contents() to retreive the current contents of the output
|
||||
buffer. Header information (header(), content type, cookies) are
|
||||
not buffered. By turning on output buffering, you can
|
||||
effectively send header information all throughout your file,
|
||||
regardless of whether you've emitted body output or not.
|
||||
|
||||
* Full variable reference within quoted strings:
|
||||
|
||||
${expr} - full indirect reference support for scalar
|
||||
variables
|
||||
{variable} - full variable support
|
||||
|
||||
For example:
|
||||
|
||||
$foo[5]["bar"] = "foobar";
|
||||
print "{$foo[5]["bar"]}"; // would print "foobar"
|
||||
|
||||
* Ability to call member functions of other classes from within
|
||||
member functions or from the global scope.
|
||||
|
||||
You can now, for example, override a parent function with a
|
||||
child function, and call the parent function from it.
|
||||
|
||||
* Runtime information for classes (class name, parent, available
|
||||
functions, etc.).
|
||||
|
||||
* Much more efficient syntax highlighter - runs much quicker,
|
||||
performs more reliably, and generates much tighter HTML.
|
||||
|
||||
* A full-featured debugger has been integrated with the language
|
||||
(supports breakpoints, expression evaluation, step-in/over,
|
||||
function call backtrace, and more).
|
||||
|
||||
The Zend Engine claims 100% compatability with the engine of PHP
|
||||
3.0, and is shamelessly lying about it. Here's why:
|
||||
|
||||
* Static variable initializers only accept scalar values
|
||||
(in PHP 3.0 they accepted any valid expression). The impact
|
||||
should be somewhere in between void and non existent, since
|
||||
initializing a static variable with anything but a simple
|
||||
static value makes no sense at all.
|
||||
|
||||
* The scope of break and continue is local to that of an
|
||||
include()'d file or an eval()'d string. The impact should
|
||||
be somewhat smaller of the one above.
|
||||
|
||||
* The return statement no longer works from a require()'d file. It
|
||||
hardly worked in PHP 3.0, so the impact should be fairly small. If
|
||||
you want this functionality - use include() instead.
|
||||
|
||||
* unset() is no longer a function, but a statement.
|
||||
|
||||
* The following letter combination is not supported within
|
||||
encapsulated strings: "{$". If you have a string that includes
|
||||
this letter combination, for example, print "{$somevar"; (which
|
||||
printed the letter { and the contents of the variable $somevar in
|
||||
PHP 3.0), it will result in a parse error with the Zend Engine.
|
||||
In this case, you would have to change the code to print
|
||||
"\{$somevar"; This incompatability is due to the full variable
|
||||
reference within quoted strings feature added in the Zend
|
||||
Engine.
|
||||
@@ -183,6 +183,10 @@ SOURCE=.\zend_llist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_objects.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_opcode.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -195,6 +199,10 @@ SOURCE=.\zend_ptr_stack.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_qsort.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_sprintf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -307,6 +315,10 @@ SOURCE=.\zend_ptr_stack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_qsort.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_stack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
+20
-1
@@ -1,3 +1,8 @@
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl This file contains Zend specific autoconf functions.
|
||||
dnl
|
||||
|
||||
AC_DEFUN(LIBZEND_BISON_CHECK,[
|
||||
|
||||
@@ -5,7 +10,7 @@ if test "$YACC" != "bison -y"; then
|
||||
AC_MSG_WARN(You will need bison if you want to regenerate the Zend parser.)
|
||||
else
|
||||
AC_MSG_CHECKING(bison version)
|
||||
set `bison --version| sed -e 's/^GNU Bison version //' -e 's/\./ /'`
|
||||
set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /'`
|
||||
if test "${1}" = "1" -a "${2}" -lt "28"; then
|
||||
AC_MSG_WARN(You will need bison 1.28 if you want to regenerate the Zend parser (found ${1}.${2}).)
|
||||
fi
|
||||
@@ -21,6 +26,7 @@ AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AC_PROG_CC_C_O])
|
||||
AC_REQUIRE([AC_PROG_LEX])
|
||||
AC_REQUIRE([AC_HEADER_STDC])
|
||||
AC_REQUIRE([AC_PROG_LIBTOOL])
|
||||
|
||||
LIBZEND_BISON_CHECK
|
||||
|
||||
@@ -54,6 +60,19 @@ AC_TYPE_SIGNAL
|
||||
AC_CHECK_LIB(dl, dlopen, [LIBS="-ldl $LIBS"])
|
||||
AC_CHECK_FUNC(dlopen,[AC_DEFINE(HAVE_LIBDL, 1,[ ])])
|
||||
|
||||
dnl
|
||||
dnl Ugly hack to check if dlsym() requires a leading underscore in symbol name.
|
||||
dnl
|
||||
AC_MSG_CHECKING([whether dlsym() requires a leading underscore in symbol names])
|
||||
_LT_AC_TRY_DLOPEN_SELF([
|
||||
AC_MSG_RESULT(no)
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, 1, [Define if dlsym() requires a leading underscore in symbol names. ])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
], [])
|
||||
|
||||
dnl This is required for QNX and may be some BSD derived systems
|
||||
AC_CHECK_TYPE( uint, unsigned int )
|
||||
AC_CHECK_TYPE( ulong, unsigned long )
|
||||
|
||||
@@ -228,6 +228,10 @@ SOURCE=.\zend_ptr_stack.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_qsort.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_sprintf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -368,6 +372,10 @@ SOURCE=.\zend_ptr_stack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_qsort.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_stack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
+72
-44
@@ -98,7 +98,7 @@ class istream;
|
||||
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
|
||||
|
||||
/* Special action meaning "start processing a new file". */
|
||||
#define YY_NEW_FILE yyrestart( yyin TSRMLS_CC )
|
||||
#define YY_NEW_FILE yyrestart( SCNG(yy_in) TSRMLS_CC )
|
||||
|
||||
#define YY_END_OF_BUFFER_CHAR 0
|
||||
|
||||
@@ -214,6 +214,7 @@ struct yy_buffer_state
|
||||
|
||||
%- Standard (non-C++) definition
|
||||
#define yy_current_buffer SCNG(current_buffer)
|
||||
#define yy_hold_char SCNG(_yy_hold_char)
|
||||
%*
|
||||
|
||||
/* We provide macros for accessing buffer states in case in the
|
||||
@@ -225,9 +226,12 @@ struct yy_buffer_state
|
||||
|
||||
%- Standard (non-C++) definition
|
||||
/* yy_hold_char holds the character lost when yytext is formed. */
|
||||
|
||||
#if 0
|
||||
static char yy_hold_char;
|
||||
|
||||
static int yy_n_chars; /* number of characters read into yy_ch_buf */
|
||||
#endif
|
||||
|
||||
/* Points to current character in buffer. */
|
||||
#define yy_c_buf_p SCNG(c_buf_p)
|
||||
@@ -249,7 +253,8 @@ static int yy_n_chars; /* number of characters read into yy_ch_buf */
|
||||
/* Flag which is used to allow yywrap()'s to do buffer switches
|
||||
* instead of setting up a fresh yyin. A bit of a hack ...
|
||||
*/
|
||||
static int yy_did_buffer_switch_on_eof;
|
||||
/* static int yy_did_buffer_switch_on_eof; */
|
||||
#define yy_did_buffer_switch_on_eof SCNG(_yy_did_buffer_switch_on_eof)
|
||||
|
||||
void yyrestart YY_PROTO(( FILE *input_file TSRMLS_DC ));
|
||||
|
||||
@@ -276,14 +281,14 @@ static void yy_flex_free YY_PROTO(( void * ));
|
||||
#define yy_set_interactive(is_interactive) \
|
||||
{ \
|
||||
if ( ! yy_current_buffer ) \
|
||||
yy_current_buffer = yy_create_buffer( SCNG(yyin), YY_BUF_SIZE TSRMLS_CC ); \
|
||||
yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \
|
||||
yy_current_buffer->yy_is_interactive = is_interactive; \
|
||||
}
|
||||
|
||||
#define yy_set_bol(at_bol) \
|
||||
{ \
|
||||
if ( ! yy_current_buffer ) \
|
||||
yy_current_buffer = yy_create_buffer( SCNG(yyin), YY_BUF_SIZE TSRMLS_CC ); \
|
||||
yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \
|
||||
yy_current_buffer->yy_at_bol = at_bol; \
|
||||
}
|
||||
|
||||
@@ -296,6 +301,18 @@ static void yy_flex_free YY_PROTO(( void * ));
|
||||
#define yytext SCNG(yy_text)
|
||||
#undef yytext_ptr
|
||||
#define yytext_ptr SCNG(yy_text)
|
||||
#undef yyin
|
||||
#define yyin SCNG(yy_in)
|
||||
#undef yyout
|
||||
#define yyout SCNG(yy_out)
|
||||
#undef yy_last_accepting_state
|
||||
#define yy_last_accepting_state SCNG(_yy_last_accepting_state)
|
||||
#undef yy_last_accepting_cpos
|
||||
#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos)
|
||||
#undef yy_more_flag
|
||||
#define yy_more_flag SCNG(_yy_more_flag)
|
||||
#undef yy_more_len
|
||||
#define yy_more_len SCNG(_yy_more_len)
|
||||
|
||||
|
||||
%- Standard (non-C++) definition
|
||||
@@ -321,6 +338,17 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
|
||||
%% code to copy yytext_ptr to yytext[] goes here, if %array
|
||||
yy_c_buf_p = yy_cp;
|
||||
|
||||
#undef yyleng
|
||||
#undef yytext
|
||||
#undef yytext_ptr
|
||||
#undef yyin
|
||||
#undef yyout
|
||||
#undef yy_last_accepting_state
|
||||
#undef yy_last_accepting_cpos
|
||||
#undef yy_more_flag
|
||||
#undef yy_more_len
|
||||
|
||||
|
||||
%% data tables for the DFA and the user's section 1 definitions go here
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
@@ -406,7 +434,7 @@ YY_MALLOC_DECL
|
||||
/* This used to be an fputs(), but since the string might contain NUL's,
|
||||
* we now use fwrite().
|
||||
*/
|
||||
#define ECHO (void) fwrite( yytext, yyleng, 1, SCNG(yyout) )
|
||||
#define ECHO (void) fwrite( yytext, yyleng, 1, SCNG(yy_out) )
|
||||
%+ C++ definition
|
||||
#define ECHO LexerOutput( yytext, yyleng )
|
||||
%*
|
||||
@@ -491,23 +519,23 @@ YY_DECL
|
||||
if ( ! yy_start )
|
||||
yy_start = 1; /* first start state */
|
||||
|
||||
if ( ! SCNG(yyin) )
|
||||
if ( ! SCNG(yy_in) )
|
||||
%-
|
||||
SCNG(yyin) = stdin;
|
||||
SCNG(yy_in) = stdin;
|
||||
%+
|
||||
SCNG(yyin) = &cin;
|
||||
SCNG(yy_in) = &cin;
|
||||
%*
|
||||
|
||||
if ( ! SCNG(yyout) )
|
||||
if ( ! SCNG(yy_out) )
|
||||
%-
|
||||
SCNG(yyout) = stdout;
|
||||
SCNG(yy_out) = stdout;
|
||||
%+
|
||||
SCNG(yyout) = &cout;
|
||||
SCNG(yy_out) = &cout;
|
||||
%*
|
||||
|
||||
if ( ! yy_current_buffer )
|
||||
yy_current_buffer =
|
||||
yy_create_buffer( SCNG(yyin), YY_BUF_SIZE TSRMLS_CC );
|
||||
yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC );
|
||||
|
||||
yy_load_buffer_state(TSRMLS_C);
|
||||
}
|
||||
@@ -561,8 +589,8 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
* this is the first action (other than possibly a
|
||||
* back-up) that will match for the new input source.
|
||||
*/
|
||||
yy_n_chars = yy_current_buffer->yy_n_chars;
|
||||
yy_current_buffer->yy_input_file = yyin;
|
||||
SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars;
|
||||
yy_current_buffer->yy_input_file = SCNG(yy_in);
|
||||
yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
|
||||
}
|
||||
|
||||
@@ -573,7 +601,7 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
* end-of-buffer state). Contrast this with the test
|
||||
* in input().
|
||||
*/
|
||||
if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
|
||||
if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] )
|
||||
{ /* This was really a NUL. */
|
||||
yy_state_type yy_next_state;
|
||||
|
||||
@@ -652,7 +680,7 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
|
||||
case EOB_ACT_LAST_MATCH:
|
||||
yy_c_buf_p =
|
||||
&yy_current_buffer->yy_ch_buf[yy_n_chars];
|
||||
&yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)];
|
||||
|
||||
yy_current_state = yy_get_previous_state(TSRMLS_C);
|
||||
|
||||
@@ -673,8 +701,8 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
%+
|
||||
yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
|
||||
{
|
||||
SCNG(yyin) = arg_yyin;
|
||||
SCNG(yyout) = arg_yyout;
|
||||
SCNG(yy_in) = arg_yyin;
|
||||
SCNG(yy_out) = arg_yyout;
|
||||
yy_c_buf_p = 0;
|
||||
yy_init = 1;
|
||||
yy_start = 0;
|
||||
@@ -715,37 +743,37 @@ void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
|
||||
}
|
||||
|
||||
if ( new_out )
|
||||
SCNG(yyout) = new_out;
|
||||
SCNG(yy_out) = new_out;
|
||||
}
|
||||
|
||||
int yyFlexLexer::LexerInput( char* buf, int max_size )
|
||||
{
|
||||
if ( SCNG(yyin)->eof() || SCNG(yyin)->fail() )
|
||||
if ( SCNG(yy_in)->eof() || SCNG(yy_in)->fail() )
|
||||
return 0;
|
||||
|
||||
if (yy_current_buffer->yy_is_interactive) {
|
||||
SCNG(yyin)->get( buf[0] );
|
||||
SCNG(yy_in)->get( buf[0] );
|
||||
|
||||
if ( SCNG(yyin)->eof() )
|
||||
if ( SCNG(yy_in)->eof() )
|
||||
return 0;
|
||||
|
||||
if ( SCNG(yyin)->bad() )
|
||||
if ( SCNG(yy_in)->bad() )
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
(void) SCNG(yyin)->read( buf, max_size );
|
||||
(void) SCNG(yy_in)->read( buf, max_size );
|
||||
|
||||
if ( SCNG(yyin)->bad() )
|
||||
if ( SCNG(yy_in)->bad() )
|
||||
return -1;
|
||||
else
|
||||
return SCNG(yyin)->gcount();
|
||||
return SCNG(yy_in)->gcount();
|
||||
}
|
||||
}
|
||||
|
||||
void yyFlexLexer::LexerOutput( const char* buf, int size )
|
||||
{
|
||||
(void) SCNG(yyout)->write( buf, size );
|
||||
(void) SCNG(yy_out)->write( buf, size );
|
||||
}
|
||||
%*
|
||||
|
||||
@@ -768,7 +796,7 @@ int yyFlexLexer::yy_get_next_buffer(TSRMLS_D)
|
||||
register int number_to_move, i;
|
||||
int ret_val;
|
||||
|
||||
if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
|
||||
if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] )
|
||||
YY_FATAL_ERROR(
|
||||
"fatal flex scanner internal error--end of buffer missed" );
|
||||
|
||||
@@ -803,7 +831,7 @@ int yyFlexLexer::yy_get_next_buffer(TSRMLS_D)
|
||||
/* don't do the read, it's not guaranteed to return an EOF,
|
||||
* just force an EOF
|
||||
*/
|
||||
yy_current_buffer->yy_n_chars = yy_n_chars = 0;
|
||||
yy_current_buffer->yy_n_chars = SCNG(yy_n_chars) = 0;
|
||||
|
||||
else
|
||||
{
|
||||
@@ -857,17 +885,17 @@ int yyFlexLexer::yy_get_next_buffer(TSRMLS_D)
|
||||
|
||||
/* Read in more data. */
|
||||
YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
|
||||
yy_n_chars, num_to_read );
|
||||
SCNG(yy_n_chars), num_to_read );
|
||||
|
||||
yy_current_buffer->yy_n_chars = yy_n_chars;
|
||||
yy_current_buffer->yy_n_chars = SCNG(yy_n_chars);
|
||||
}
|
||||
|
||||
if ( yy_n_chars == 0 )
|
||||
if ( SCNG(yy_n_chars) == 0 )
|
||||
{
|
||||
if ( number_to_move == YY_MORE_ADJ )
|
||||
{
|
||||
ret_val = EOB_ACT_END_OF_FILE;
|
||||
yyrestart( SCNG(yyin) TSRMLS_CC );
|
||||
yyrestart( SCNG(yy_in) TSRMLS_CC );
|
||||
}
|
||||
|
||||
else
|
||||
@@ -881,9 +909,9 @@ int yyFlexLexer::yy_get_next_buffer(TSRMLS_D)
|
||||
else
|
||||
ret_val = EOB_ACT_CONTINUE_SCAN;
|
||||
|
||||
yy_n_chars += number_to_move;
|
||||
yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
|
||||
yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
|
||||
SCNG(yy_n_chars) += number_to_move;
|
||||
yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
|
||||
yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
|
||||
|
||||
yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
|
||||
|
||||
@@ -964,7 +992,7 @@ void yyFlexLexer::yyunput( int c, register char* yy_bp TSRMLS_DC )
|
||||
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
|
||||
{ /* need to shift things up to make room */
|
||||
/* +2 for EOB chars. */
|
||||
register int number_to_move = yy_n_chars + 2;
|
||||
register int number_to_move = SCNG(yy_n_chars) + 2;
|
||||
register char *dest = &yy_current_buffer->yy_ch_buf[
|
||||
yy_current_buffer->yy_buf_size + 2];
|
||||
register char *source =
|
||||
@@ -976,7 +1004,7 @@ void yyFlexLexer::yyunput( int c, register char* yy_bp TSRMLS_DC )
|
||||
yy_cp += (int) (dest - source);
|
||||
yy_bp += (int) (dest - source);
|
||||
yy_current_buffer->yy_n_chars =
|
||||
yy_n_chars = yy_current_buffer->yy_buf_size;
|
||||
SCNG(yy_n_chars) = yy_current_buffer->yy_buf_size;
|
||||
|
||||
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
|
||||
YY_FATAL_ERROR( "flex scanner push-back overflow" );
|
||||
@@ -1018,7 +1046,7 @@ int yyFlexLexer::yyinput(TSRMLS_D)
|
||||
* If this occurs *before* the EOB characters, then it's a
|
||||
* valid NUL; if not, then we've hit the end of the buffer.
|
||||
*/
|
||||
if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
|
||||
if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] )
|
||||
/* This was really a NUL. */
|
||||
*yy_c_buf_p = '\0';
|
||||
|
||||
@@ -1041,7 +1069,7 @@ int yyFlexLexer::yyinput(TSRMLS_D)
|
||||
*/
|
||||
|
||||
/* Reset buffer status. */
|
||||
yyrestart( SCNG(yyin) TSRMLS_CC );
|
||||
yyrestart( SCNG(yy_in) TSRMLS_CC );
|
||||
|
||||
/* fall through */
|
||||
|
||||
@@ -1088,7 +1116,7 @@ void yyFlexLexer::yyrestart( istream* input_file TSRMLS_DC )
|
||||
%*
|
||||
{
|
||||
if ( ! yy_current_buffer )
|
||||
yy_current_buffer = yy_create_buffer( SCNG(yyin), YY_BUF_SIZE TSRMLS_CC );
|
||||
yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC );
|
||||
|
||||
yy_init_buffer( yy_current_buffer, input_file TSRMLS_CC );
|
||||
yy_load_buffer_state(TSRMLS_C);
|
||||
@@ -1117,7 +1145,7 @@ void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer TSRMLS_DC )
|
||||
/* Flush out information for old buffer. */
|
||||
*yy_c_buf_p = yy_hold_char;
|
||||
yy_current_buffer->yy_buf_pos = yy_c_buf_p;
|
||||
yy_current_buffer->yy_n_chars = yy_n_chars;
|
||||
yy_current_buffer->yy_n_chars = SCNG(yy_n_chars);
|
||||
}
|
||||
|
||||
yy_current_buffer = new_buffer;
|
||||
@@ -1145,9 +1173,9 @@ void ***tsrm_ls;
|
||||
void yyFlexLexer::yy_load_buffer_state()
|
||||
%*
|
||||
{
|
||||
yy_n_chars = yy_current_buffer->yy_n_chars;
|
||||
SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars;
|
||||
yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
|
||||
SCNG(yyin) = yy_current_buffer->yy_input_file;
|
||||
SCNG(yy_in) = yy_current_buffer->yy_input_file;
|
||||
yy_hold_char = *yy_c_buf_p;
|
||||
}
|
||||
|
||||
|
||||
+44
-35
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -28,9 +28,9 @@
|
||||
#include "zend_ini.h"
|
||||
|
||||
#ifdef ZTS
|
||||
# define GLOBAL_FUNCTION_TABLE global_function_table
|
||||
# define GLOBAL_CLASS_TABLE global_class_table
|
||||
# define GLOBAL_CONSTANTS_TABLE global_constants_table
|
||||
# define GLOBAL_FUNCTION_TABLE &global_main_class.function_table
|
||||
# define GLOBAL_CLASS_TABLE &global_main_class.class_table
|
||||
# define GLOBAL_CONSTANTS_TABLE &global_main_class.constants_table
|
||||
# define GLOBAL_AUTO_GLOBALS_TABLE global_auto_globals_table
|
||||
#else
|
||||
# define GLOBAL_FUNCTION_TABLE CG(function_table)
|
||||
@@ -61,9 +61,7 @@ static int (*zend_get_configuration_directive_p)(char *name, uint name_length, z
|
||||
ZEND_API int compiler_globals_id;
|
||||
ZEND_API int executor_globals_id;
|
||||
ZEND_API int alloc_globals_id;
|
||||
HashTable *global_function_table;
|
||||
HashTable *global_class_table;
|
||||
HashTable *global_constants_table;
|
||||
zend_class_entry global_main_class;
|
||||
HashTable *global_auto_globals_table;
|
||||
#endif
|
||||
|
||||
@@ -84,7 +82,8 @@ static void print_hash(HashTable *ht, int indent)
|
||||
zval **tmp;
|
||||
char *string_key;
|
||||
HashPosition iterator;
|
||||
unsigned long num_key, str_len;
|
||||
ulong num_key;
|
||||
uint str_len;
|
||||
int i;
|
||||
|
||||
for (i=0; i<indent; i++) {
|
||||
@@ -247,7 +246,12 @@ static void register_standard_class(void)
|
||||
zend_standard_class_def.name = zend_strndup("stdClass", zend_standard_class_def.name_length);
|
||||
zend_standard_class_def.parent = NULL;
|
||||
zend_hash_init_ex(&zend_standard_class_def.default_properties, 0, NULL, ZVAL_PTR_DTOR, 1, 0);
|
||||
zend_standard_class_def.static_members = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init_ex(zend_standard_class_def.static_members, 0, NULL, ZVAL_PTR_DTOR, 1, 0);
|
||||
zend_hash_init_ex(&zend_standard_class_def.constants_table, 0, NULL, ZVAL_PTR_DTOR, 1, 0);
|
||||
zend_hash_init_ex(&zend_standard_class_def.class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
|
||||
zend_hash_init_ex(&zend_standard_class_def.function_table, 0, NULL, ZEND_FUNCTION_DTOR, 1, 0);
|
||||
zend_standard_class_def.constructor = NULL;
|
||||
zend_standard_class_def.handle_function_call = NULL;
|
||||
zend_standard_class_def.handle_property_get = NULL;
|
||||
zend_standard_class_def.handle_property_set = NULL;
|
||||
@@ -275,22 +279,18 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS
|
||||
|
||||
compiler_globals->compiled_filename = NULL;
|
||||
|
||||
compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
|
||||
compiler_globals->function_table = &compiler_globals->main_class.function_table;
|
||||
zend_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
|
||||
zend_hash_copy(compiler_globals->function_table, global_function_table, NULL, &tmp_func, sizeof(zend_function));
|
||||
zend_hash_copy(compiler_globals->function_table, GLOBAL_FUNCTION_TABLE, NULL, &tmp_func, sizeof(zend_function));
|
||||
|
||||
compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
|
||||
compiler_globals->class_table = &compiler_globals->main_class.class_table;
|
||||
zend_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
|
||||
zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry));
|
||||
zend_hash_copy(compiler_globals->class_table, GLOBAL_CLASS_TABLE, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry));
|
||||
|
||||
zend_set_default_compile_time_values(TSRMLS_C);
|
||||
|
||||
CG(interactive) = 0;
|
||||
|
||||
compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
|
||||
zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry));
|
||||
|
||||
compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, 0);
|
||||
zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, NULL, NULL, sizeof(void *) /* empty element */);
|
||||
@@ -299,13 +299,11 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS
|
||||
|
||||
static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS_DC)
|
||||
{
|
||||
if (compiler_globals->function_table != global_function_table) {
|
||||
if (compiler_globals->function_table != GLOBAL_FUNCTION_TABLE) {
|
||||
zend_hash_destroy(compiler_globals->function_table);
|
||||
free(compiler_globals->function_table);
|
||||
}
|
||||
if (compiler_globals->class_table != global_class_table) {
|
||||
if (compiler_globals->class_table != GLOBAL_CLASS_TABLE) {
|
||||
zend_hash_destroy(compiler_globals->class_table);
|
||||
free(compiler_globals->class_table);
|
||||
}
|
||||
if (compiler_globals->auto_globals != global_auto_globals_table) {
|
||||
zend_hash_destroy(compiler_globals->auto_globals);
|
||||
@@ -316,9 +314,9 @@ static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS
|
||||
|
||||
static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS_DC)
|
||||
{
|
||||
if (global_constants_table) {
|
||||
if (GLOBAL_CONSTANTS_TABLE) {
|
||||
zend_startup_constants(TSRMLS_C);
|
||||
zend_copy_constants(EG(zend_constants), global_constants_table);
|
||||
zend_copy_constants(EG(zend_constants), GLOBAL_CONSTANTS_TABLE);
|
||||
}
|
||||
zend_init_rsrc_plist(TSRMLS_C);
|
||||
EG(lambda_count)=0;
|
||||
@@ -368,6 +366,11 @@ static void scanner_globals_ctor(zend_scanner_globals *scanner_globals_p TSRMLS_
|
||||
scanner_globals_p->init = 1;
|
||||
scanner_globals_p->start = 0;
|
||||
scanner_globals_p->current_buffer = NULL;
|
||||
scanner_globals_p->yy_in = NULL;
|
||||
scanner_globals_p->yy_out = NULL;
|
||||
scanner_globals_p->_yy_more_flag = 0;
|
||||
scanner_globals_p->_yy_more_len = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -418,12 +421,15 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
|
||||
zend_version_info = strdup(ZEND_CORE_VERSION_INFO);
|
||||
zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO)-1;
|
||||
|
||||
GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable));
|
||||
GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable));
|
||||
#ifndef ZTS
|
||||
GLOBAL_FUNCTION_TABLE = &compiler_globals.main_class.function_table;
|
||||
GLOBAL_CLASS_TABLE = &compiler_globals.main_class.class_table;
|
||||
#endif
|
||||
GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
|
||||
zend_hash_init_ex(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
|
||||
zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, NULL, 1, 0);
|
||||
|
||||
register_standard_class();
|
||||
zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0);
|
||||
zend_init_rsrc_list_dtors();
|
||||
@@ -434,7 +440,6 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
|
||||
zval_used_for_init.type = IS_NULL;
|
||||
|
||||
#ifdef ZTS
|
||||
global_constants_table = NULL;
|
||||
ts_allocate_id(&compiler_globals_id, sizeof(zend_compiler_globals), (ts_allocate_ctor) compiler_globals_ctor, (ts_allocate_dtor) compiler_globals_dtor);
|
||||
ts_allocate_id(&executor_globals_id, sizeof(zend_executor_globals), (ts_allocate_ctor) executor_globals_ctor, (ts_allocate_dtor) executor_globals_dtor);
|
||||
ts_allocate_id(&language_scanner_globals_id, sizeof(zend_scanner_globals), (ts_allocate_ctor) scanner_globals_ctor, NULL);
|
||||
@@ -443,11 +448,10 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
|
||||
executor_globals = ts_resource(executor_globals_id);
|
||||
tsrm_ls = ts_resource_ex(0, NULL);
|
||||
compiler_globals_dtor(compiler_globals, tsrm_ls);
|
||||
compiler_globals->function_table = GLOBAL_FUNCTION_TABLE;
|
||||
compiler_globals->class_table = GLOBAL_CLASS_TABLE;
|
||||
*compiler_globals->function_table = *GLOBAL_FUNCTION_TABLE;
|
||||
*compiler_globals->class_table = *GLOBAL_CLASS_TABLE;
|
||||
compiler_globals->auto_globals = GLOBAL_AUTO_GLOBALS_TABLE;
|
||||
zend_startup_constants(tsrm_ls);
|
||||
GLOBAL_CONSTANTS_TABLE = EG(zend_constants);
|
||||
#else
|
||||
zend_hash_init_ex(CG(auto_globals), 8, NULL, NULL, 1, 0);
|
||||
scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC);
|
||||
@@ -486,10 +490,10 @@ void zend_shutdown(TSRMLS_D)
|
||||
#endif
|
||||
zend_destroy_rsrc_list_dtors();
|
||||
zend_hash_destroy(&module_registry);
|
||||
#ifndef ZTS
|
||||
zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
|
||||
free(GLOBAL_FUNCTION_TABLE);
|
||||
zend_hash_destroy(GLOBAL_CLASS_TABLE);
|
||||
free(GLOBAL_CLASS_TABLE);
|
||||
#endif
|
||||
zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE);
|
||||
free(GLOBAL_AUTO_GLOBALS_TABLE);
|
||||
zend_shutdown_extensions(TSRMLS_C);
|
||||
@@ -787,12 +791,13 @@ ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ..
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_execute_scripts(int type TSRMLS_DC, int file_count, ...)
|
||||
ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...)
|
||||
{
|
||||
va_list files;
|
||||
int i;
|
||||
zend_file_handle *file_handle;
|
||||
zend_op_array *orig_op_array = EG(active_op_array);
|
||||
zval *local_retval=NULL;
|
||||
|
||||
va_start(files, file_count);
|
||||
for (i=0; i<file_count; i++) {
|
||||
@@ -803,10 +808,14 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, int file_count, ...)
|
||||
EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDE TSRMLS_CC);
|
||||
zend_destroy_file_handle(file_handle TSRMLS_CC);
|
||||
if (EG(active_op_array)) {
|
||||
EG(return_value_ptr_ptr) = retval ? retval : &local_retval;
|
||||
zend_execute(EG(active_op_array) TSRMLS_CC);
|
||||
zval_ptr_dtor(EG(return_value_ptr_ptr));
|
||||
EG(return_value_ptr_ptr) = &EG(global_return_value_ptr);
|
||||
EG(global_return_value_ptr) = NULL;
|
||||
if (EG(exception)) {
|
||||
zval_ptr_dtor(&EG(exception));
|
||||
} else if (!retval) {
|
||||
zval_ptr_dtor(EG(return_value_ptr_ptr));
|
||||
local_retval = NULL;
|
||||
}
|
||||
destroy_op_array(EG(active_op_array));
|
||||
efree(EG(active_op_array));
|
||||
} else if (type==ZEND_REQUIRE) {
|
||||
|
||||
+44
-12
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -17,6 +17,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
@@ -40,6 +41,9 @@
|
||||
#ifdef ZEND_WIN32
|
||||
# include "zend_config.w32.h"
|
||||
# define ZEND_PATHS_SEPARATOR ';'
|
||||
#elif defined(__riscos__)
|
||||
# include "zend_config.h"
|
||||
# define ZEND_PATHS_SEPARATOR ';'
|
||||
#else
|
||||
# include "zend_config.h"
|
||||
# define ZEND_PATHS_SEPARATOR ':'
|
||||
@@ -71,7 +75,11 @@
|
||||
|
||||
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
|
||||
# define DL_UNLOAD dlclose
|
||||
# define DL_FETCH_SYMBOL dlsym
|
||||
# if defined(DLSYM_NEEDS_UNDERSCORE)
|
||||
# define DL_FETCH_SYMBOL(h,s) dlsym((h), "_" ## s)
|
||||
# else
|
||||
# define DL_FETCH_SYMBOL dlsym
|
||||
# endif
|
||||
# define DL_HANDLE void *
|
||||
# define ZEND_EXTENSIONS_SUPPORT 1
|
||||
#elif defined(ZEND_WIN32)
|
||||
@@ -85,8 +93,19 @@
|
||||
# define ZEND_EXTENSIONS_SUPPORT 0
|
||||
#endif
|
||||
|
||||
#if HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
/* AIX requires this to be the first thing in the file. */
|
||||
#ifndef __GNUC__
|
||||
# if HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
# else
|
||||
# ifndef alloca /* predefined by HP cc +Olibcalls */
|
||||
char *alloca ();
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32))
|
||||
@@ -164,6 +183,7 @@ typedef unsigned short zend_ushort;
|
||||
#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval *this_ptr, int return_value_used TSRMLS_DC
|
||||
#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, this_ptr, return_value_used TSRMLS_CC
|
||||
|
||||
|
||||
/*
|
||||
* zval
|
||||
*/
|
||||
@@ -177,24 +197,28 @@ typedef struct _zend_object {
|
||||
|
||||
typedef unsigned int zend_object_handle;
|
||||
|
||||
typedef struct _zend_object_handlers zend_object_handlers;
|
||||
|
||||
typedef struct _zend_object_value {
|
||||
zend_object_handle handle;
|
||||
zend_object_handlers *handlers;
|
||||
} zend_object_value;
|
||||
|
||||
typedef zend_object *(*get_address_t)(zend_object_handle handle); /* Don't return zval ** so that we can't change it */
|
||||
typedef zval **(*get_property_address_t)(zend_object_handle handle, zval *offset, int type);
|
||||
typedef void (*add_ref_t)(zend_object_handle handle);
|
||||
typedef void (*del_ref_t)(zend_object_handle handle);
|
||||
typedef void (*delete_obj_t)(zend_object_handle handle);
|
||||
typedef zend_object_value (*clone_obj_t)(zend_object_handle handle);
|
||||
|
||||
typedef struct _zend_object_handlers {
|
||||
struct _zend_object_handlers {
|
||||
get_address_t get_address;
|
||||
get_property_address_t get_property_address;
|
||||
add_ref_t add_ref;
|
||||
del_ref_t del_ref;
|
||||
delete_obj_t delete_obj;
|
||||
} zend_object_handlers;
|
||||
|
||||
typedef struct _zend_object_value {
|
||||
zend_object_handle handle;
|
||||
zend_object_handlers handlers;
|
||||
} zend_object_value;
|
||||
clone_obj_t clone_obj;
|
||||
};
|
||||
|
||||
#include "zend_objects.h"
|
||||
|
||||
@@ -248,6 +272,9 @@ typedef struct _zend_overloaded_element {
|
||||
/* excpt.h on Digital Unix 4.0 defines function_table */
|
||||
#undef function_table
|
||||
|
||||
/* A lot of stuff needs shifiting around in order to include zend_compile.h here */
|
||||
union _zend_function;
|
||||
|
||||
struct _zend_class_entry {
|
||||
char type;
|
||||
char *name;
|
||||
@@ -258,8 +285,13 @@ struct _zend_class_entry {
|
||||
|
||||
HashTable function_table;
|
||||
HashTable default_properties;
|
||||
HashTable class_table;
|
||||
HashTable *static_members;
|
||||
HashTable constants_table;
|
||||
zend_function_entry *builtin_functions;
|
||||
|
||||
union _zend_function *constructor;
|
||||
|
||||
/* handlers */
|
||||
void (*handle_function_call)(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
|
||||
zval (*handle_property_get)(zend_property_reference *property_reference);
|
||||
|
||||
+23
-8
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -286,7 +286,7 @@ static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec)
|
||||
case IS_DOUBLE:
|
||||
case IS_BOOL:
|
||||
convert_to_double_ex(arg);
|
||||
*p = Z_LVAL_PP(arg);
|
||||
*p = Z_DVAL_PP(arg);
|
||||
break;
|
||||
|
||||
case IS_ARRAY:
|
||||
@@ -436,7 +436,7 @@ static int zend_parse_arg(int arg_num, zval **arg, va_list *va, char **spec, int
|
||||
expected_type = zend_parse_arg_impl(arg, va, spec);
|
||||
if (expected_type) {
|
||||
if (!quiet) {
|
||||
sprintf(buf, "%s() expects argument %d to be %s, %s given",
|
||||
sprintf(buf, "%s() expects parameter %d to be %s, %s given",
|
||||
get_active_function_name(TSRMLS_C), arg_num, expected_type,
|
||||
zend_zval_type_name(*arg));
|
||||
zend_error(E_WARNING, buf);
|
||||
@@ -481,7 +481,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl
|
||||
|
||||
default:
|
||||
if (!quiet) {
|
||||
zend_error(E_WARNING, "%s(): bad type specifier while parsing arguments", get_active_function_name(TSRMLS_C));
|
||||
zend_error(E_WARNING, "%s(): bad type specifier while parsing parameters", get_active_function_name(TSRMLS_C));
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -493,7 +493,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl
|
||||
|
||||
if (num_args < min_num_args || num_args > max_num_args) {
|
||||
if (!quiet) {
|
||||
sprintf(buf, "%s() requires %s %d argument%s, %d given",
|
||||
sprintf(buf, "%s() expects %s %d parameter%s, %d given",
|
||||
get_active_function_name(TSRMLS_C),
|
||||
min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most",
|
||||
num_args < min_num_args ? min_num_args : max_num_args,
|
||||
@@ -508,7 +508,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl
|
||||
arg_count = (ulong) *p;
|
||||
|
||||
if (num_args > arg_count) {
|
||||
zend_error(E_WARNING, "%s(): could not obtain arguments for parsing",
|
||||
zend_error(E_WARNING, "%s(): could not obtain parameters for parsing",
|
||||
get_active_function_name(TSRMLS_C));
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -572,6 +572,7 @@ ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type
|
||||
|
||||
if (!class_type->constants_updated) {
|
||||
zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
zend_hash_apply_with_argument(class_type->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
class_type->constants_updated = 1;
|
||||
}
|
||||
|
||||
@@ -1215,8 +1216,11 @@ ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_
|
||||
*class_entry->refcount = 1;
|
||||
class_entry->constants_updated = 0;
|
||||
zend_hash_init(&class_entry->default_properties, 0, NULL, ZVAL_PTR_DTOR, 1);
|
||||
class_entry->static_members = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init(class_entry->static_members, 0, NULL, ZVAL_PTR_DTOR, 1);
|
||||
zend_hash_init(&class_entry->constants_table, 0, NULL, ZVAL_PTR_DTOR, 1);
|
||||
zend_hash_init(&class_entry->function_table, 0, NULL, ZEND_FUNCTION_DTOR, 1);
|
||||
|
||||
zend_hash_init(&class_entry->class_table, 10, NULL, ZEND_CLASS_DTOR, 1);
|
||||
|
||||
if (class_entry->builtin_functions) {
|
||||
zend_register_functions(class_entry->builtin_functions, &class_entry->function_table, MODULE_PERSISTENT TSRMLS_CC);
|
||||
@@ -1384,3 +1388,14 @@ zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callabl
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
ZEND_API char *zend_get_module_version(char *module_name)
|
||||
{
|
||||
zend_module_entry *module;
|
||||
|
||||
if (zend_hash_find(&module_registry, module_name, strlen(module_name) + 1,
|
||||
(void**)&module) == FAILURE) {
|
||||
return NULL;
|
||||
}
|
||||
return module->version;
|
||||
}
|
||||
+5
-2
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -87,6 +87,7 @@
|
||||
class_container.name = strdup(class_name); \
|
||||
class_container.name_length = sizeof(class_name)-1; \
|
||||
class_container.builtin_functions = functions; \
|
||||
class_container.constructor = NULL; \
|
||||
class_container.handle_function_call = NULL; \
|
||||
class_container.handle_property_get = NULL; \
|
||||
class_container.handle_property_set = NULL; \
|
||||
@@ -97,6 +98,7 @@
|
||||
class_container.name = strdup(class_name); \
|
||||
class_container.name_length = sizeof(class_name)-1; \
|
||||
class_container.builtin_functions = functions; \
|
||||
class_container.constructor = NULL; \
|
||||
class_container.handle_function_call = handle_fcall; \
|
||||
class_container.handle_property_get = handle_propget; \
|
||||
class_container.handle_property_set = handle_propset; \
|
||||
@@ -137,6 +139,7 @@ ZEND_API int zend_disable_function(char *function_name, uint function_name_lengt
|
||||
|
||||
ZEND_API void zend_wrong_param_count(TSRMLS_D);
|
||||
ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name);
|
||||
ZEND_API char *zend_get_module_version(char *module_name);
|
||||
|
||||
#define getThis() (this_ptr)
|
||||
|
||||
|
||||
+3
-3
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -406,7 +406,7 @@ ZEND_API void start_memory_manager(TSRMLS_D)
|
||||
AG(phead) = AG(head) = NULL;
|
||||
|
||||
#if MEMORY_LIMIT
|
||||
AG(memory_limit) = 1<<30; /* rediculous limit, effectively no limit */
|
||||
AG(memory_limit) = 1<<30; /* ridiculous limit, effectively no limit */
|
||||
AG(allocated_memory) = 0;
|
||||
AG(memory_exhausted) = 0;
|
||||
AG(allocated_memory_peak) = 0;
|
||||
|
||||
+2
-2
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -127,12 +127,17 @@ int zend_startup_builtin_functions(TSRMLS_D)
|
||||
}
|
||||
|
||||
|
||||
/* {{{ proto string zend_version(void)
|
||||
Get the version of the Zend Engine */
|
||||
ZEND_FUNCTION(zend_version)
|
||||
{
|
||||
RETURN_STRINGL(ZEND_VERSION, sizeof(ZEND_VERSION)-1, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto int func_num_args(void)
|
||||
Get the number of arguments that were passed to the function */
|
||||
ZEND_FUNCTION(func_num_args)
|
||||
{
|
||||
void **p;
|
||||
@@ -152,8 +157,11 @@ ZEND_FUNCTION(func_num_args)
|
||||
RETURN_LONG(-1);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto mixed func_get_arg(int arg_num)
|
||||
Get the $arg_num'th argument that was passed to the function */
|
||||
ZEND_FUNCTION(func_get_arg)
|
||||
{
|
||||
void **p;
|
||||
@@ -190,8 +198,11 @@ ZEND_FUNCTION(func_get_arg)
|
||||
*return_value = *arg;
|
||||
zval_copy_ctor(return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto array func_get_args()
|
||||
Get an array of the arguments that were passed to the function */
|
||||
ZEND_FUNCTION(func_get_args)
|
||||
{
|
||||
void **p;
|
||||
@@ -224,6 +235,7 @@ ZEND_FUNCTION(func_get_args)
|
||||
zend_hash_next_index_insert(return_value->value.ht, &element, sizeof(zval *), NULL);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto int strlen(string str)
|
||||
@@ -240,6 +252,7 @@ ZEND_NAMED_FUNCTION(zend_if_strlen)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto int strcmp(string str1, string str2)
|
||||
Binary safe string comparison */
|
||||
ZEND_FUNCTION(strcmp)
|
||||
@@ -255,6 +268,7 @@ ZEND_FUNCTION(strcmp)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto int strncmp(string str1, string str2, int len)
|
||||
Binary safe string comparison */
|
||||
ZEND_FUNCTION(strncmp)
|
||||
@@ -271,6 +285,7 @@ ZEND_FUNCTION(strncmp)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto int strcasecmp(string str1, string str2)
|
||||
Binary safe case-insensitive string comparison */
|
||||
ZEND_FUNCTION(strcasecmp)
|
||||
@@ -286,6 +301,7 @@ ZEND_FUNCTION(strcasecmp)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto int strncasecmp(string str1, string str2, int len)
|
||||
Binary safe string comparison */
|
||||
ZEND_FUNCTION(strncasecmp)
|
||||
@@ -302,6 +318,9 @@ ZEND_FUNCTION(strncasecmp)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto array each(array arr)
|
||||
Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element */
|
||||
ZEND_FUNCTION(each)
|
||||
{
|
||||
zval **array, *entry, **entry_ptr, *tmp;
|
||||
@@ -352,7 +371,11 @@ ZEND_FUNCTION(each)
|
||||
(*inserted_pointer)->refcount++;
|
||||
zend_hash_move_forward(target_hash);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto int error_reporting(int new_error_level=null)
|
||||
Return the current error_reporting level, and if an argument was passed - change to the new level */
|
||||
ZEND_FUNCTION(error_reporting)
|
||||
{
|
||||
zval **arg;
|
||||
@@ -376,7 +399,11 @@ ZEND_FUNCTION(error_reporting)
|
||||
|
||||
RETVAL_LONG(old_error_reporting);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool define(string constant_name, mixed value, case_sensitive=true)
|
||||
Define a new constant */
|
||||
ZEND_FUNCTION(define)
|
||||
{
|
||||
zval **var, **val, **non_cs;
|
||||
@@ -432,8 +459,11 @@ ZEND_FUNCTION(define)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool define(string constant_name)
|
||||
Check whether a constant exists */
|
||||
ZEND_FUNCTION(defined)
|
||||
{
|
||||
zval **var;
|
||||
@@ -451,6 +481,8 @@ ZEND_FUNCTION(defined)
|
||||
RETURN_LONG(0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto string get_class(object object)
|
||||
Retrieves the class name */
|
||||
@@ -471,6 +503,7 @@ ZEND_FUNCTION(get_class)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto string get_parent_class(mixed object)
|
||||
Retrieves the parent class name for object or class. */
|
||||
ZEND_FUNCTION(get_parent_class)
|
||||
@@ -498,6 +531,7 @@ ZEND_FUNCTION(get_parent_class)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool is_subclass_of(object object, string class_name)
|
||||
Returns true if the object has this class as one of its parents */
|
||||
ZEND_FUNCTION(is_subclass_of)
|
||||
@@ -529,6 +563,7 @@ ZEND_FUNCTION(is_subclass_of)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto array get_class_vars(string class_name)
|
||||
Returns an array of default properties of the class */
|
||||
ZEND_FUNCTION(get_class_vars)
|
||||
@@ -561,6 +596,7 @@ ZEND_FUNCTION(get_class_vars)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto array get_object_vars(object obj)
|
||||
Returns an array of object properties */
|
||||
ZEND_FUNCTION(get_object_vars)
|
||||
@@ -582,6 +618,7 @@ ZEND_FUNCTION(get_object_vars)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto array get_class_methods(mixed class)
|
||||
Returns an array of method names for class or class instance. */
|
||||
ZEND_FUNCTION(get_class_methods)
|
||||
@@ -622,6 +659,7 @@ ZEND_FUNCTION(get_class_methods)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool method_exists(object object, string method)
|
||||
Checks if the class method exists */
|
||||
ZEND_FUNCTION(method_exists)
|
||||
@@ -648,6 +686,7 @@ ZEND_FUNCTION(method_exists)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool class_exists(string classname)
|
||||
Checks if the class exists */
|
||||
ZEND_FUNCTION(class_exists)
|
||||
@@ -671,6 +710,7 @@ ZEND_FUNCTION(class_exists)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool function_exists(string function_name)
|
||||
Checks if the function exists */
|
||||
ZEND_FUNCTION(function_exists)
|
||||
@@ -694,6 +734,8 @@ ZEND_FUNCTION(function_exists)
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto void leak(int num_bytes=3)
|
||||
Cause an intentional memory leak, for testing/debugging purposes */
|
||||
ZEND_FUNCTION(leak)
|
||||
{
|
||||
int leakbytes=3;
|
||||
@@ -708,6 +750,7 @@ ZEND_FUNCTION(leak)
|
||||
|
||||
emalloc(leakbytes);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
#ifdef ZEND_TEST_EXCEPTIONS
|
||||
@@ -815,7 +858,6 @@ ZEND_FUNCTION(set_error_handler)
|
||||
/* }}} */
|
||||
|
||||
|
||||
|
||||
/* {{{ proto void restore_error_handler(void)
|
||||
Restores the previously defined error handler function */
|
||||
ZEND_FUNCTION(restore_error_handler)
|
||||
@@ -842,6 +884,7 @@ static int copy_class_name(zend_class_entry *ce, int num_args, va_list args, zen
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* {{{ proto array get_declared_classes(void)
|
||||
Returns an array of all declared classes. */
|
||||
ZEND_FUNCTION(get_declared_classes)
|
||||
@@ -855,6 +898,7 @@ ZEND_FUNCTION(get_declared_classes)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
static int copy_function_name(zend_function *func, int num_args, va_list args, zend_hash_key *hash_key)
|
||||
{
|
||||
zval *internal_ar = va_arg(args, zval *),
|
||||
@@ -873,6 +917,7 @@ static int copy_function_name(zend_function *func, int num_args, va_list args, z
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* {{{ proto array get_defined_functions(void)
|
||||
Returns an array of all defined functions */
|
||||
ZEND_FUNCTION(get_defined_functions)
|
||||
@@ -905,6 +950,7 @@ ZEND_FUNCTION(get_defined_functions)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto array get_defined_vars(void)
|
||||
Returns an associative array of names and values of all currently defined variable names (variables in the current scope) */
|
||||
ZEND_FUNCTION(get_defined_vars)
|
||||
@@ -918,8 +964,8 @@ ZEND_FUNCTION(get_defined_vars)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#define LAMBDA_TEMP_FUNCNAME "__lambda_func"
|
||||
|
||||
#define LAMBDA_TEMP_FUNCNAME "__lambda_func"
|
||||
/* {{{ proto string create_function(string args, string code)
|
||||
Creates an anonymous function, and returns its name (funny, eh?) */
|
||||
ZEND_FUNCTION(create_function)
|
||||
@@ -1028,6 +1074,7 @@ static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* {{{ proto array get_loaded_extensions(void)
|
||||
Return an array containing names of loaded extensions */
|
||||
ZEND_FUNCTION(get_loaded_extensions)
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
+294
-71
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -81,6 +81,7 @@ void zend_init_compiler_data_structures(TSRMLS_D)
|
||||
CG(handle_op_arrays) = 1;
|
||||
CG(in_compilation) = 0;
|
||||
init_compiler_declarables(TSRMLS_C);
|
||||
CG(throw_list) = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -230,9 +231,9 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, int op TSRM
|
||||
if (varname->op_type == IS_CONST
|
||||
&& varname->u.constant.type == IS_STRING
|
||||
&& zend_hash_exists(CG(auto_globals), varname->u.constant.value.str.val, varname->u.constant.value.str.len+1)) {
|
||||
opline_ptr->op2.u.fetch_type = ZEND_FETCH_GLOBAL;
|
||||
opline_ptr->extended_value = ZEND_FETCH_GLOBAL;
|
||||
} else {
|
||||
opline_ptr->op2.u.fetch_type = ZEND_FETCH_LOCAL;
|
||||
opline_ptr->extended_value = ZEND_FETCH_LOCAL;
|
||||
}
|
||||
|
||||
if (bp) {
|
||||
@@ -247,6 +248,19 @@ void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC)
|
||||
fetch_simple_variable_ex(result, varname, bp, ZEND_FETCH_W TSRMLS_CC);
|
||||
}
|
||||
|
||||
void zend_do_fetch_static_member(znode *class TSRMLS_DC)
|
||||
{
|
||||
zend_llist *fetch_list_ptr;
|
||||
zend_llist_element *le;
|
||||
zend_op *opline_ptr;
|
||||
|
||||
zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
|
||||
le = fetch_list_ptr->head;
|
||||
|
||||
opline_ptr = (zend_op *)le->data;
|
||||
opline_ptr->op2 = *class;
|
||||
opline_ptr->extended_value = ZEND_FETCH_STATIC_MEMBER;
|
||||
}
|
||||
|
||||
void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC)
|
||||
{
|
||||
@@ -572,6 +586,9 @@ void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC)
|
||||
opline->extended_value = arg_offset;
|
||||
break;
|
||||
case BP_VAR_UNSET:
|
||||
if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use [] for unsetting");
|
||||
}
|
||||
opline->opcode += 12; /* 3+3+3+3 */
|
||||
break;
|
||||
}
|
||||
@@ -722,6 +739,9 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
|
||||
|
||||
if (is_method) {
|
||||
zend_hash_update(&CG(active_class_entry)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array));
|
||||
if ((CG(active_class_entry)->name_length == (uint) name_len) && (!memcmp(CG(active_class_entry)->name, name, name_len))) {
|
||||
CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
|
||||
}
|
||||
} else {
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
@@ -758,6 +778,8 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
|
||||
|
||||
zend_stack_push(&CG(foreach_copy_stack), (void *) &switch_entry.cond, sizeof(znode));
|
||||
}
|
||||
function_token->throw_list = CG(throw_list);
|
||||
CG(throw_list) = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -771,6 +793,8 @@ void zend_do_end_function_declaration(znode *function_token TSRMLS_DC)
|
||||
/* Pop the switch and foreach seperators */
|
||||
zend_stack_del_top(&CG(switch_cond_stack));
|
||||
zend_stack_del_top(&CG(foreach_copy_stack));
|
||||
|
||||
CG(throw_list) = function_token->throw_list;
|
||||
}
|
||||
|
||||
|
||||
@@ -811,10 +835,7 @@ int zend_do_begin_function_call(znode *function_name TSRMLS_DC)
|
||||
|
||||
zend_str_tolower(function_name->u.constant.value.str.val, function_name->u.constant.value.str.len);
|
||||
if (zend_hash_find(CG(function_table), function_name->u.constant.value.str.val, function_name->u.constant.value.str.len+1, (void **) &function)==FAILURE) {
|
||||
znode tmp = *function_name;
|
||||
|
||||
zval_copy_ctor(&tmp.u.constant);
|
||||
zend_do_begin_dynamic_function_call(&tmp TSRMLS_CC);
|
||||
zend_do_begin_dynamic_function_call(function_name TSRMLS_CC);
|
||||
return 1; /* Dynamic */
|
||||
}
|
||||
|
||||
@@ -840,13 +861,19 @@ int zend_do_begin_function_call(znode *function_name TSRMLS_DC)
|
||||
|
||||
void zend_do_begin_method_call(znode *object, znode *function_name TSRMLS_DC)
|
||||
{
|
||||
zend_op *opline;
|
||||
zend_op *last_op;
|
||||
int last_op_number;
|
||||
unsigned char *ptr = NULL;
|
||||
|
||||
zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC);
|
||||
zend_do_begin_variable_parse(TSRMLS_C);
|
||||
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
last_op_number = get_next_op_number(CG(active_op_array))-1;
|
||||
last_op = &CG(active_op_array)->opcodes[last_op_number];
|
||||
last_op->opcode = ZEND_INIT_FCALL_BY_NAME;
|
||||
last_op->extended_value = ZEND_MEMBER_FUNC_CALL;
|
||||
|
||||
/*opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_INIT_FCALL_BY_NAME;
|
||||
opline->extended_value = ZEND_MEMBER_FUNC_CALL;
|
||||
opline->op1 = *object;
|
||||
@@ -856,6 +883,7 @@ void zend_do_begin_method_call(znode *object, znode *function_name TSRMLS_DC)
|
||||
|
||||
|
||||
*function_name = opline->result;
|
||||
*/
|
||||
/*
|
||||
if (function_name->op_type == IS_CONST) {
|
||||
zval_copy_ctor(&function_name->u.constant);
|
||||
@@ -883,6 +911,54 @@ void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC)
|
||||
}
|
||||
|
||||
|
||||
void do_fetch_class(znode *result, znode *class_entry, znode *class_name TSRMLS_DC)
|
||||
{
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
opline->opcode = ZEND_FETCH_CLASS;
|
||||
if (class_entry) {
|
||||
opline->op1 = *class_entry;
|
||||
} else {
|
||||
SET_UNUSED(opline->op1);
|
||||
}
|
||||
zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len);
|
||||
if ((class_name->u.constant.value.str.len == (sizeof("self") - 1)) &&
|
||||
!memcmp(class_name->u.constant.value.str.val, "self", sizeof("self"))) {
|
||||
SET_UNUSED(opline->op2);
|
||||
opline->extended_value = ZEND_FETCH_CLASS_SELF;
|
||||
zval_dtor(&class_name->u.constant);
|
||||
} else if ((class_name->u.constant.value.str.len == (sizeof("main") - 1)) &&
|
||||
!memcmp(class_name->u.constant.value.str.val, "main", sizeof("main"))) {
|
||||
SET_UNUSED(opline->op2);
|
||||
opline->extended_value = ZEND_FETCH_CLASS_MAIN;
|
||||
zval_dtor(&class_name->u.constant);
|
||||
} else {
|
||||
opline->op2 = *class_name;
|
||||
}
|
||||
opline->result.u.var = get_temporary_variable(CG(active_op_array));
|
||||
opline->result.op_type = IS_CONST; /* FIXME: Hack so that INIT_FCALL_BY_NAME still knows this is a class */
|
||||
*result = opline->result;
|
||||
}
|
||||
|
||||
|
||||
void do_fetch_class_name(znode *result, znode *class_name_entry, znode *class_name TSRMLS_DC)
|
||||
{
|
||||
zend_uint length;
|
||||
|
||||
if (!result) {
|
||||
result = class_name_entry;
|
||||
} else {
|
||||
*result = *class_name_entry;
|
||||
}
|
||||
|
||||
length = 1 + result->u.constant.value.str.len + class_name->u.constant.value.str.len;
|
||||
result->u.constant.value.str.val = erealloc(result->u.constant.value.str.val, length+1);
|
||||
memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len], ":", sizeof(":")-1);
|
||||
memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len+1], class_name->u.constant.value.str.val, class_name->u.constant.value.str.len+1);
|
||||
STR_FREE(class_name->u.constant.value.str.val);
|
||||
result->u.constant.value.str.len = length;
|
||||
}
|
||||
|
||||
void zend_do_begin_class_member_function_call(znode *class_name, znode *function_name TSRMLS_DC)
|
||||
{
|
||||
unsigned char *ptr = NULL;
|
||||
@@ -891,8 +967,10 @@ void zend_do_begin_class_member_function_call(znode *class_name, znode *function
|
||||
opline->opcode = ZEND_INIT_FCALL_BY_NAME;
|
||||
zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len);
|
||||
if ((class_name->u.constant.value.str.len == sizeof("parent")-1)
|
||||
&& !memcmp(class_name->u.constant.value.str.val, "parent", sizeof("parent")-1)
|
||||
&& CG(active_ce_parent_class_name).value.str.val) {
|
||||
&& !memcmp(class_name->u.constant.value.str.val, "parent", sizeof("parent")-1)) {
|
||||
if (!CG(active_ce_parent_class_name).value.str.val) {
|
||||
zend_error(E_COMPILE_ERROR, "No parent class available");
|
||||
}
|
||||
efree(class_name->u.constant.value.str.val);
|
||||
class_name->u.constant.value.str.len = CG(active_ce_parent_class_name).value.str.len;
|
||||
class_name->u.constant.value.str.val = estrndup(CG(active_ce_parent_class_name).value.str.val, class_name->u.constant.value.str.len);
|
||||
@@ -900,7 +978,6 @@ void zend_do_begin_class_member_function_call(znode *class_name, znode *function
|
||||
opline->op1 = *class_name;
|
||||
opline->op2 = *function_name;
|
||||
opline->extended_value = ZEND_MEMBER_FUNC_CALL;
|
||||
zval_copy_ctor(&opline->op2.u.constant);
|
||||
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
|
||||
}
|
||||
|
||||
@@ -909,17 +986,29 @@ void zend_do_end_function_call(znode *function_name, znode *result, znode *argum
|
||||
{
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
if (function_name->op_type==IS_CONST && !is_method && !is_dynamic_fcall) {
|
||||
if (!is_method && !is_dynamic_fcall && function_name->op_type==IS_CONST) {
|
||||
opline->opcode = ZEND_DO_FCALL;
|
||||
opline->op1 = *function_name;
|
||||
} else {
|
||||
opline->opcode = ZEND_DO_FCALL_BY_NAME;
|
||||
SET_UNUSED(opline->op1);
|
||||
}
|
||||
opline->op1 = *function_name;
|
||||
|
||||
opline->result.u.var = get_temporary_variable(CG(active_op_array));
|
||||
opline->result.op_type = IS_VAR;
|
||||
*result = opline->result;
|
||||
SET_UNUSED(opline->op2);
|
||||
opline->op2.u.constant.value.lval = is_method;
|
||||
|
||||
/* Check how much this is really needed
|
||||
opline->op2.u.constant.value.lval = is_method;
|
||||
*/
|
||||
if (CG(throw_list) != NULL) {
|
||||
long op_number = get_next_op_number(CG(active_op_array))-1;
|
||||
zend_llist_add_element(CG(throw_list), &op_number);
|
||||
} else {
|
||||
opline->op2.u.opline_num = -1;
|
||||
}
|
||||
|
||||
zend_stack_del_top(&CG(function_call_stack));
|
||||
opline->extended_value = argument_list->u.constant.value.lval;
|
||||
}
|
||||
@@ -1089,6 +1178,74 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC)
|
||||
}
|
||||
|
||||
|
||||
void zend_do_try(znode *try_token TSRMLS_DC)
|
||||
{
|
||||
try_token->throw_list = (void *) CG(throw_list);
|
||||
CG(throw_list) = (zend_llist *) emalloc(sizeof(zend_llist));
|
||||
zend_llist_init(CG(throw_list), sizeof(long), NULL, 0);
|
||||
/* Initialize try backpatch list used to backpatch throw, do_fcall */
|
||||
}
|
||||
|
||||
static void throw_list_applier(long *opline_num, long *catch_opline)
|
||||
{
|
||||
zend_op *opline;
|
||||
TSRMLS_FETCH(); /* Pass this by argument */
|
||||
|
||||
opline = &CG(active_op_array)->opcodes[*opline_num];
|
||||
|
||||
/* Backpatch the opline of the catch statement */
|
||||
switch (opline->opcode) {
|
||||
case ZEND_DO_FCALL:
|
||||
case ZEND_DO_FCALL_BY_NAME:
|
||||
case ZEND_THROW:
|
||||
opline->op2.u.opline_num = *catch_opline;
|
||||
break;
|
||||
default:
|
||||
zend_error(E_ERROR, "Bad opcode in throw list");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void zend_do_begin_catch(znode *try_token, znode *catch_var TSRMLS_DC)
|
||||
{
|
||||
long catch_op_number = get_next_op_number(CG(active_op_array));
|
||||
zend_op *opline;
|
||||
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_CATCH;
|
||||
opline->op1 = *catch_var;
|
||||
SET_UNUSED(opline->op2);
|
||||
|
||||
zend_llist_apply_with_argument(CG(throw_list), (llist_apply_with_arg_func_t) throw_list_applier, &catch_op_number TSRMLS_CC);
|
||||
zend_llist_destroy(CG(throw_list));
|
||||
efree(CG(throw_list));
|
||||
CG(throw_list) = (void *) try_token->throw_list;
|
||||
|
||||
try_token->u.opline_num = catch_op_number;
|
||||
}
|
||||
|
||||
void zend_do_end_catch(znode *try_token TSRMLS_DC)
|
||||
{
|
||||
CG(active_op_array)->opcodes[try_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
|
||||
}
|
||||
|
||||
void zend_do_throw(znode *expr TSRMLS_DC)
|
||||
{
|
||||
zend_op *opline;
|
||||
long throw_op_number = get_next_op_number(CG(active_op_array));
|
||||
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_THROW;
|
||||
opline->op1 = *expr;
|
||||
SET_UNUSED(opline->op2);
|
||||
|
||||
if (CG(throw_list) != NULL) {
|
||||
zend_llist_add_element(CG(throw_list), &throw_op_number);
|
||||
} else {
|
||||
opline->op2.u.opline_num = -1;
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void function_add_ref(zend_function *function)
|
||||
{
|
||||
if (function->type == ZEND_USER_FUNCTION) {
|
||||
@@ -1128,6 +1285,9 @@ void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce)
|
||||
|
||||
/* Perform inheritance */
|
||||
zend_hash_merge(&ce->default_properties, &parent_ce->default_properties, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0);
|
||||
/* STATIC_MEMBERS_FIXME */
|
||||
zend_hash_merge(ce->static_members, parent_ce->static_members, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0);
|
||||
zend_hash_merge(&ce->constants_table, &parent_ce->constants_table, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0);
|
||||
zend_hash_merge(&ce->function_table, &parent_ce->function_table, (void (*)(void *)) function_add_ref, &tmp_zend_function, sizeof(zend_function), 0);
|
||||
ce->parent = parent_ce;
|
||||
if (!ce->handle_property_get)
|
||||
@@ -1149,8 +1309,18 @@ ZEND_API int do_bind_function_or_class(zend_op *opline, HashTable *function_tabl
|
||||
zend_hash_find(function_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void *) &function);
|
||||
if (zend_hash_add(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, function, sizeof(zend_function), NULL)==FAILURE) {
|
||||
int error_level = compile_time ? E_COMPILE_ERROR : E_ERROR;
|
||||
zend_function *function;
|
||||
|
||||
zend_error(error_level, "Cannot redeclare %s()", opline->op2.u.constant.value.str.val);
|
||||
if (zend_hash_find(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void *) &function)==SUCCESS
|
||||
&& function->type==ZEND_USER_FUNCTION
|
||||
&& ((zend_op_array *) function)->last>0) {
|
||||
zend_error(error_level, "Cannot redeclare %s() (previously declared in %s:%d)",
|
||||
opline->op2.u.constant.value.str.val,
|
||||
((zend_op_array *) function)->filename,
|
||||
((zend_op_array *) function)->opcodes[0].lineno);
|
||||
} else {
|
||||
zend_error(error_level, "Cannot redeclare %s()", opline->op2.u.constant.value.str.val);
|
||||
}
|
||||
return FAILURE;
|
||||
} else {
|
||||
(*function->op_array.refcount)++;
|
||||
@@ -1224,6 +1394,8 @@ ZEND_API int do_bind_function_or_class(zend_op *opline, HashTable *function_tabl
|
||||
(*ce->refcount)--;
|
||||
zend_hash_destroy(&ce->function_table);
|
||||
zend_hash_destroy(&ce->default_properties);
|
||||
zend_hash_destroy(ce->static_members);
|
||||
zend_hash_destroy(&ce->constants_table);
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
@@ -1536,30 +1708,34 @@ void zend_do_default_before_statement(znode *case_list, znode *default_token TSR
|
||||
}
|
||||
|
||||
|
||||
void zend_do_begin_class_declaration(znode *class_name, znode *parent_class_name TSRMLS_DC)
|
||||
void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znode *parent_class_name TSRMLS_DC)
|
||||
{
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
zend_op *opline;
|
||||
int runtime_inheritance = 0;
|
||||
zend_class_entry new_class_entry;
|
||||
|
||||
if (CG(active_class_entry)) {
|
||||
zend_error(E_COMPILE_ERROR, "Class declarations may not be nested");
|
||||
return;
|
||||
}
|
||||
CG(class_entry).type = ZEND_USER_CLASS;
|
||||
CG(class_entry).name = class_name->u.constant.value.str.val;
|
||||
CG(class_entry).name_length = class_name->u.constant.value.str.len;
|
||||
CG(class_entry).refcount = (int *) emalloc(sizeof(int));
|
||||
*CG(class_entry).refcount = 1;
|
||||
CG(class_entry).constants_updated = 0;
|
||||
class_token->u.previously_active_class_entry = CG(active_class_entry);
|
||||
new_class_entry.type = ZEND_USER_CLASS;
|
||||
new_class_entry.name = class_name->u.constant.value.str.val;
|
||||
new_class_entry.name_length = class_name->u.constant.value.str.len;
|
||||
new_class_entry.refcount = (int *) emalloc(sizeof(int));
|
||||
*new_class_entry.refcount = 1;
|
||||
new_class_entry.constants_updated = 0;
|
||||
|
||||
zend_str_tolower(CG(class_entry).name, CG(class_entry).name_length);
|
||||
zend_str_tolower(new_class_entry.name, new_class_entry.name_length);
|
||||
|
||||
zend_hash_init(&CG(class_entry).function_table, 10, NULL, ZEND_FUNCTION_DTOR, 0);
|
||||
zend_hash_init(&CG(class_entry).default_properties, 10, NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_init(&new_class_entry.function_table, 10, NULL, ZEND_FUNCTION_DTOR, 0);
|
||||
zend_hash_init(&new_class_entry.class_table, 10, NULL, ZEND_CLASS_DTOR, 0);
|
||||
zend_hash_init(&new_class_entry.default_properties, 10, NULL, ZVAL_PTR_DTOR, 0);
|
||||
new_class_entry.static_members = (HashTable *) emalloc(sizeof(HashTable));
|
||||
zend_hash_init(new_class_entry.static_members, 10, NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_init(&new_class_entry.constants_table, 10, NULL, ZVAL_PTR_DTOR, 0);
|
||||
|
||||
CG(class_entry).handle_function_call = NULL;
|
||||
CG(class_entry).handle_property_set = NULL;
|
||||
CG(class_entry).handle_property_get = NULL;
|
||||
new_class_entry.constructor = NULL;
|
||||
|
||||
new_class_entry.handle_function_call = NULL;
|
||||
new_class_entry.handle_property_set = NULL;
|
||||
new_class_entry.handle_property_get = NULL;
|
||||
|
||||
/* code for inheritance from parent class */
|
||||
if (parent_class_name) {
|
||||
@@ -1571,29 +1747,46 @@ void zend_do_begin_class_declaration(znode *class_name, znode *parent_class_name
|
||||
CG(active_ce_parent_class_name).value.str.val = estrndup(parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len);
|
||||
CG(active_ce_parent_class_name).value.str.len = parent_class_name->u.constant.value.str.len;
|
||||
|
||||
if (zend_hash_find(CG(class_table), parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len+1, (void **) &parent_class)==SUCCESS) {
|
||||
if (zend_hash_find(CG(active_class_entry)?&CG(active_class_entry)->class_table:CG(class_table), parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len+1, (void **) &parent_class)==SUCCESS) {
|
||||
/* copy functions */
|
||||
zend_hash_copy(&CG(class_entry).function_table, &parent_class->function_table, (copy_ctor_func_t) function_add_ref, &tmp_zend_function, sizeof(zend_function));
|
||||
zend_hash_copy(&new_class_entry.function_table, &parent_class->function_table, (copy_ctor_func_t) function_add_ref, &tmp_zend_function, sizeof(zend_function));
|
||||
|
||||
/* copy default properties */
|
||||
zend_hash_copy(&CG(class_entry).default_properties, &parent_class->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
zend_hash_copy(&new_class_entry.default_properties, &parent_class->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
|
||||
/* copy static members */
|
||||
zend_hash_copy(new_class_entry.static_members, parent_class->static_members, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
|
||||
/* copy constants */
|
||||
zend_hash_copy(&new_class_entry.constants_table, &parent_class->constants_table, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
|
||||
new_class_entry.constructor = parent_class->constructor;
|
||||
|
||||
/* copy overloaded handlers */
|
||||
CG(class_entry).handle_function_call = parent_class->handle_function_call;
|
||||
CG(class_entry).handle_property_get = parent_class->handle_property_get;
|
||||
CG(class_entry).handle_property_set = parent_class->handle_property_set;
|
||||
new_class_entry.handle_function_call = parent_class->handle_function_call;
|
||||
new_class_entry.handle_property_get = parent_class->handle_property_get;
|
||||
new_class_entry.handle_property_set = parent_class->handle_property_set;
|
||||
|
||||
CG(class_entry).parent = parent_class;
|
||||
new_class_entry.parent = parent_class;
|
||||
|
||||
zval_dtor(&parent_class_name->u.constant);
|
||||
} else {
|
||||
runtime_inheritance = 1;
|
||||
CG(class_entry).parent = NULL;
|
||||
new_class_entry.parent = NULL;
|
||||
}
|
||||
} else {
|
||||
CG(class_entry).parent = NULL;
|
||||
new_class_entry.parent = NULL;
|
||||
}
|
||||
|
||||
if (CG(active_class_entry)) {
|
||||
if (runtime_inheritance) {
|
||||
zend_error(E_ERROR, "Only first level classes can inherit from undefined classes");
|
||||
}
|
||||
zend_hash_update(&CG(active_class_entry)->class_table, new_class_entry.name, new_class_entry.name_length+1, &new_class_entry, sizeof(zend_class_entry), (void **) &CG(active_class_entry));
|
||||
return;
|
||||
}
|
||||
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_DECLARE_FUNCTION_OR_CLASS;
|
||||
opline->op1.op_type = IS_CONST;
|
||||
build_runtime_defined_function_key(&opline->op1.u.constant, &class_name->u.constant, opline TSRMLS_CC);
|
||||
@@ -1603,32 +1796,32 @@ void zend_do_begin_class_declaration(znode *class_name, znode *parent_class_name
|
||||
if (runtime_inheritance) {
|
||||
char *full_class_name;
|
||||
|
||||
opline->op2.u.constant.value.str.len = parent_class_name->u.constant.value.str.len+1+CG(class_entry).name_length;
|
||||
opline->op2.u.constant.value.str.len = parent_class_name->u.constant.value.str.len+1+new_class_entry.name_length;
|
||||
full_class_name = opline->op2.u.constant.value.str.val = (char *) emalloc(opline->op2.u.constant.value.str.len+1);
|
||||
|
||||
memcpy(full_class_name, parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len);
|
||||
full_class_name += parent_class_name->u.constant.value.str.len;
|
||||
full_class_name[0] = ':';
|
||||
full_class_name++;
|
||||
memcpy(full_class_name, CG(class_entry).name, CG(class_entry).name_length);
|
||||
memcpy(full_class_name, new_class_entry.name, new_class_entry.name_length);
|
||||
zval_dtor(&parent_class_name->u.constant);
|
||||
full_class_name += CG(class_entry).name_length;
|
||||
full_class_name += new_class_entry.name_length;
|
||||
full_class_name[0] = 0;
|
||||
opline->extended_value = ZEND_DECLARE_INHERITED_CLASS;
|
||||
} else {
|
||||
opline->op2.u.constant.value.str.val = estrndup(CG(class_entry).name, CG(class_entry).name_length);
|
||||
opline->op2.u.constant.value.str.len = CG(class_entry).name_length;
|
||||
opline->op2.u.constant.value.str.val = estrndup(new_class_entry.name, new_class_entry.name_length);
|
||||
opline->op2.u.constant.value.str.len = new_class_entry.name_length;
|
||||
opline->extended_value = ZEND_DECLARE_CLASS;
|
||||
}
|
||||
|
||||
zend_hash_update(CG(class_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, &CG(class_entry), sizeof(zend_class_entry), (void **) &CG(active_class_entry));
|
||||
zend_hash_update(CG(class_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, &new_class_entry, sizeof(zend_class_entry), (void **) &CG(active_class_entry));
|
||||
}
|
||||
|
||||
|
||||
void zend_do_end_class_declaration(TSRMLS_D)
|
||||
void zend_do_end_class_declaration(znode *class_token TSRMLS_DC)
|
||||
{
|
||||
do_inherit_parent_constructor(CG(active_class_entry));
|
||||
CG(active_class_entry) = NULL;
|
||||
CG(active_class_entry) = class_token->u.previously_active_class_entry;
|
||||
if (CG(active_ce_parent_class_name).value.str.val) {
|
||||
efree(CG(active_ce_parent_class_name).value.str.val);
|
||||
CG(active_ce_parent_class_name).value.str.val = NULL;
|
||||
@@ -1636,7 +1829,7 @@ void zend_do_end_class_declaration(TSRMLS_D)
|
||||
}
|
||||
|
||||
|
||||
void zend_do_declare_property(znode *var_name, znode *value TSRMLS_DC)
|
||||
void zend_do_declare_property(znode *var_name, znode *value, int declaration_type TSRMLS_DC)
|
||||
{
|
||||
if (value) {
|
||||
zval *property;
|
||||
@@ -1644,7 +1837,17 @@ void zend_do_declare_property(znode *var_name, znode *value TSRMLS_DC)
|
||||
ALLOC_ZVAL(property);
|
||||
|
||||
*property = value->u.constant;
|
||||
zend_hash_update(&CG(active_class_entry)->default_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
|
||||
switch (declaration_type) {
|
||||
case T_VAR:
|
||||
zend_hash_update(&CG(active_class_entry)->default_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
|
||||
break;
|
||||
case T_STATIC:
|
||||
zend_hash_update(CG(active_class_entry)->static_members, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
|
||||
break;
|
||||
case T_CONST:
|
||||
zend_hash_update(&CG(active_class_entry)->constants_table, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
FREE_PNODE(var_name);
|
||||
}
|
||||
@@ -1685,7 +1888,7 @@ void zend_do_pop_object(znode *object TSRMLS_DC)
|
||||
}
|
||||
|
||||
|
||||
void zend_do_begin_new_object(znode *new_token, znode *class_name TSRMLS_DC)
|
||||
void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC)
|
||||
{
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
unsigned char *ptr = NULL;
|
||||
@@ -1693,7 +1896,7 @@ void zend_do_begin_new_object(znode *new_token, znode *class_name TSRMLS_DC)
|
||||
opline->opcode = ZEND_NEW;
|
||||
opline->result.op_type = IS_VAR;
|
||||
opline->result.u.var = get_temporary_variable(CG(active_op_array));
|
||||
opline->op1 = *class_name;
|
||||
opline->op1 = *class_type;
|
||||
SET_UNUSED(opline->op2);
|
||||
|
||||
new_token->u.opline_num = get_next_op_number(CG(active_op_array));
|
||||
@@ -1702,26 +1905,21 @@ void zend_do_begin_new_object(znode *new_token, znode *class_name TSRMLS_DC)
|
||||
opline->op1 = (opline-1)->result;
|
||||
SET_UNUSED(opline->op2);
|
||||
|
||||
if (class_name->op_type == IS_CONST) {
|
||||
zval_copy_ctor(&class_name->u.constant);
|
||||
}
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_INIT_FCALL_BY_NAME;
|
||||
opline->op1 = (opline-2)->result;
|
||||
opline->op2 = *class_name;
|
||||
SET_UNUSED(opline->op2);
|
||||
opline->extended_value = ZEND_MEMBER_FUNC_CALL | ZEND_CTOR_CALL;
|
||||
|
||||
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(unsigned char *));
|
||||
}
|
||||
|
||||
|
||||
void zend_do_end_new_object(znode *result, znode *class_name, znode *new_token, znode *argument_list TSRMLS_DC)
|
||||
void zend_do_end_new_object(znode *result, znode *new_token, znode *argument_list TSRMLS_DC)
|
||||
{
|
||||
znode ctor_result;
|
||||
|
||||
if (class_name->op_type == IS_CONST) {
|
||||
zval_copy_ctor(&class_name->u.constant);
|
||||
}
|
||||
zend_do_end_function_call(class_name, &ctor_result, argument_list, 1, 0 TSRMLS_CC);
|
||||
zend_do_end_function_call(NULL, &ctor_result, argument_list, 1, 0 TSRMLS_CC);
|
||||
zend_do_free(&ctor_result TSRMLS_CC);
|
||||
|
||||
CG(active_op_array)->opcodes[new_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
|
||||
@@ -1729,22 +1927,32 @@ void zend_do_end_new_object(znode *result, znode *class_name, znode *new_token,
|
||||
}
|
||||
|
||||
|
||||
void zend_do_fetch_constant(znode *result, znode *constant_name, int mode TSRMLS_DC)
|
||||
void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode TSRMLS_DC)
|
||||
{
|
||||
switch (mode) {
|
||||
case ZEND_CT:
|
||||
*result = *constant_name;
|
||||
if (constant_container) {
|
||||
do_fetch_class_name(NULL, constant_container, constant_name TSRMLS_CC);
|
||||
*result = *constant_container;
|
||||
} else {
|
||||
*result = *constant_name;
|
||||
}
|
||||
result->u.constant.type = IS_CONSTANT;
|
||||
break;
|
||||
case ZEND_RT: {
|
||||
case ZEND_RT:
|
||||
{
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
opline->opcode = ZEND_FETCH_CONSTANT;
|
||||
opline->result.op_type = IS_TMP_VAR;
|
||||
opline->result.u.var = get_temporary_variable(CG(active_op_array));
|
||||
opline->op1 = *constant_name;
|
||||
if (constant_container) {
|
||||
opline->op1 = *constant_container;
|
||||
} else {
|
||||
SET_UNUSED(opline->op1);
|
||||
}
|
||||
opline->op2 = *constant_name;
|
||||
*result = opline->result;
|
||||
SET_UNUSED(opline->op2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1768,6 +1976,7 @@ void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC)
|
||||
opline->extended_value = ZEND_DO_FCALL;
|
||||
SET_UNUSED(opline->op2);
|
||||
|
||||
/* FIXME: exception support not added to this op2 */
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_DO_FCALL;
|
||||
opline->result.u.var = get_temporary_variable(CG(active_op_array));
|
||||
@@ -1979,7 +2188,7 @@ void zend_do_fetch_global_or_static_variable(znode *varname, znode *static_assig
|
||||
opline->result.u.var = get_temporary_variable(CG(active_op_array));
|
||||
opline->op1 = *varname;
|
||||
SET_UNUSED(opline->op2);
|
||||
opline->op2.u.fetch_type = fetch_type;
|
||||
opline->extended_value = fetch_type;
|
||||
result = opline->result;
|
||||
|
||||
if (varname->op_type == IS_CONST) {
|
||||
@@ -2238,6 +2447,20 @@ void zend_do_end_heredoc(TSRMLS_D)
|
||||
}
|
||||
|
||||
|
||||
void do_namespace(znode *namespace TSRMLS_DC)
|
||||
{
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
opline->opcode = ZEND_NAMESPACE;
|
||||
if (namespace) {
|
||||
opline->op1 = *namespace;
|
||||
} else {
|
||||
SET_UNUSED(opline->op1);
|
||||
}
|
||||
SET_UNUSED(opline->op2);
|
||||
}
|
||||
|
||||
|
||||
void zend_do_exit(znode *result, znode *message TSRMLS_DC)
|
||||
{
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
+37
-21
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -27,16 +27,12 @@
|
||||
# include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <iostream.h>
|
||||
#endif
|
||||
|
||||
#include "zend_llist.h"
|
||||
|
||||
#define DEBUG_ZEND 0
|
||||
|
||||
#define FREE_PNODE(znode) zval_dtor(&znode->u.constant);
|
||||
#define FREE_OP(op, should_free) if (should_free) zval_dtor(&Ts[(op)->u.var].tmp_var);
|
||||
#define FREE_OP(Ts, op, should_free) if (should_free) zval_dtor(&Ts[(op)->u.var].tmp_var);
|
||||
|
||||
#define SET_UNUSED(op) (op).op_type = IS_UNUSED
|
||||
|
||||
@@ -48,13 +44,14 @@ typedef struct _zend_op_array zend_op_array;
|
||||
|
||||
typedef struct _znode {
|
||||
int op_type;
|
||||
zend_llist *throw_list; /* Try and save this space later on */
|
||||
union {
|
||||
zval constant;
|
||||
|
||||
zend_uint var;
|
||||
zend_uint opline_num; /* Needs to be signed */
|
||||
zend_uint fetch_type;
|
||||
zend_op_array *op_array;
|
||||
zend_class_entry *previously_active_class_entry; /* Used at compile-time */
|
||||
struct {
|
||||
zend_uint var; /* dummy */
|
||||
zend_uint type;
|
||||
@@ -175,9 +172,6 @@ typedef struct _zend_file_handle {
|
||||
union {
|
||||
int fd;
|
||||
FILE *fp;
|
||||
#ifdef __cplusplus
|
||||
istream *is;
|
||||
#endif
|
||||
} handle;
|
||||
zend_bool free_filename;
|
||||
} zend_file_handle;
|
||||
@@ -238,6 +232,7 @@ void zend_do_fetch_globals(znode *varname TSRMLS_DC);
|
||||
void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC);
|
||||
void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC);
|
||||
void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC);
|
||||
void zend_do_fetch_static_member(znode *class TSRMLS_DC);
|
||||
void zend_do_print(znode *result, znode *arg TSRMLS_DC);
|
||||
void zend_do_echo(znode *arg TSRMLS_DC);
|
||||
typedef int (*unary_op_type)(zval *, zval *);
|
||||
@@ -277,9 +272,17 @@ void zend_do_receive_arg(int op, znode *var, znode *offset, znode *initializatio
|
||||
int zend_do_begin_function_call(znode *function_name TSRMLS_DC);
|
||||
void zend_do_begin_method_call(znode *object, znode *function_name TSRMLS_DC);
|
||||
void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC);
|
||||
void do_fetch_class(znode *result, znode *class_entry, znode *class_name TSRMLS_DC);
|
||||
void do_fetch_class_name(znode *result, znode *class_entry, znode *class_name TSRMLS_DC);
|
||||
void zend_do_begin_class_member_function_call(znode *class_name, znode *function_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_try(znode *try_token TSRMLS_DC);
|
||||
void zend_do_begin_catch(znode *try_token, znode *catch_var TSRMLS_DC);
|
||||
void zend_do_end_catch(znode *try_token TSRMLS_DC);
|
||||
void zend_do_throw(znode *expr TSRMLS_DC);
|
||||
|
||||
ZEND_API int do_bind_function_or_class(zend_op *opline, HashTable *function_table, HashTable *class_table, int compile_time);
|
||||
void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce);
|
||||
void zend_do_early_binding(TSRMLS_D);
|
||||
@@ -300,9 +303,9 @@ void zend_do_case_before_statement(znode *case_list, znode *case_token, znode *c
|
||||
void zend_do_case_after_statement(znode *result, znode *case_token TSRMLS_DC);
|
||||
void zend_do_default_before_statement(znode *case_list, znode *default_token TSRMLS_DC);
|
||||
|
||||
void zend_do_begin_class_declaration(znode *class_name, znode *parent_class_name TSRMLS_DC);
|
||||
void zend_do_end_class_declaration(TSRMLS_D);
|
||||
void zend_do_declare_property(znode *var_name, znode *value TSRMLS_DC);
|
||||
void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znode *parent_class_name TSRMLS_DC);
|
||||
void zend_do_end_class_declaration(znode *class_token TSRMLS_DC);
|
||||
void zend_do_declare_property(znode *var_name, znode *value, int declaration_type TSRMLS_DC);
|
||||
|
||||
void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS_DC);
|
||||
|
||||
@@ -311,10 +314,10 @@ void zend_do_push_object(znode *object TSRMLS_DC);
|
||||
void zend_do_pop_object(znode *object TSRMLS_DC);
|
||||
|
||||
|
||||
void zend_do_begin_new_object(znode *new_token, znode *class_name TSRMLS_DC);
|
||||
void zend_do_end_new_object(znode *result, znode *class_name, znode *new_token, znode *argument_list TSRMLS_DC);
|
||||
void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC);
|
||||
void zend_do_end_new_object(znode *result, znode *new_token, znode *argument_list TSRMLS_DC);
|
||||
|
||||
void zend_do_fetch_constant(znode *result, znode *constant_name, int mode TSRMLS_DC);
|
||||
void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode TSRMLS_DC);
|
||||
|
||||
void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC);
|
||||
|
||||
@@ -343,6 +346,8 @@ void zend_do_declare_end(TSRMLS_D);
|
||||
|
||||
void zend_do_end_heredoc(TSRMLS_D);
|
||||
|
||||
void do_namespace(znode *namespace TSRMLS_DC);
|
||||
|
||||
void zend_do_exit(znode *result, znode *message TSRMLS_DC);
|
||||
|
||||
void zend_do_begin_silence(znode *strudel_token TSRMLS_DC);
|
||||
@@ -367,7 +372,7 @@ ZEND_API void function_add_ref(zend_function *function);
|
||||
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC);
|
||||
ZEND_API zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC);
|
||||
ZEND_API zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC);
|
||||
ZEND_API int zend_execute_scripts(int type TSRMLS_DC, int file_count, ...);
|
||||
ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...);
|
||||
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC);
|
||||
ZEND_API void init_op_array(zend_op_array *op_array, int type, int initial_ops_size TSRMLS_DC);
|
||||
ZEND_API void destroy_op_array(zend_op_array *op_array);
|
||||
@@ -530,15 +535,26 @@ int zendlex(znode *zendlval TSRMLS_DC);
|
||||
|
||||
#define ZEND_SEND_VAR_NO_REF 106
|
||||
|
||||
#define ZEND_CATCH 107
|
||||
#define ZEND_THROW 108
|
||||
|
||||
#define ZEND_NAMESPACE 109
|
||||
#define ZEND_FETCH_CLASS 110
|
||||
/* end of block */
|
||||
|
||||
|
||||
|
||||
|
||||
/* global/local fetches */
|
||||
#define ZEND_FETCH_GLOBAL 0
|
||||
#define ZEND_FETCH_LOCAL 1
|
||||
#define ZEND_FETCH_STATIC 2
|
||||
#define ZEND_FETCH_GLOBAL 0
|
||||
#define ZEND_FETCH_LOCAL 1
|
||||
#define ZEND_FETCH_STATIC 2
|
||||
#define ZEND_FETCH_STATIC_MEMBER 3
|
||||
|
||||
/* class fetches */
|
||||
#define ZEND_FETCH_CLASS_DEFAULT 0
|
||||
#define ZEND_FETCH_CLASS_SELF 1
|
||||
#define ZEND_FETCH_CLASS_MAIN 2
|
||||
|
||||
/* unset types */
|
||||
#define ZEND_UNSET_REG 0
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
+17
-10
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -58,9 +58,9 @@ void zend_copy_constants(HashTable *target, HashTable *source)
|
||||
static int clean_non_persistent_constant(zend_constant *c TSRMLS_DC)
|
||||
{
|
||||
if (c->flags & CONST_PERSISTENT) {
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
|
||||
} else {
|
||||
return ZEND_HASH_APPLY_REMOVE;
|
||||
return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ int zend_startup_constants(TSRMLS_D)
|
||||
DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
|
||||
#endif
|
||||
|
||||
EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable));
|
||||
EG(zend_constants) = &CG(main_class).constants_table;
|
||||
|
||||
if (zend_hash_init(EG(zend_constants), 20, NULL, ZEND_CONSTANT_DTOR, 1)==FAILURE) {
|
||||
return FAILURE;
|
||||
@@ -153,14 +153,17 @@ void zend_register_standard_constants(TSRMLS_D)
|
||||
int zend_shutdown_constants(TSRMLS_D)
|
||||
{
|
||||
zend_hash_destroy(EG(zend_constants));
|
||||
free(EG(zend_constants));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void clean_non_persistent_constants(TSRMLS_D)
|
||||
{
|
||||
zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC);
|
||||
if (EG(full_tables_cleanup)) {
|
||||
zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC);
|
||||
} else {
|
||||
zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -216,9 +219,12 @@ ZEND_API void zend_register_string_constant(char *name, uint name_len, char *str
|
||||
ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC)
|
||||
{
|
||||
zend_constant *c;
|
||||
char *lookup_name = estrndup(name, name_len);
|
||||
char *lookup_name;
|
||||
int retval;
|
||||
|
||||
lookup_name = do_alloca(name_len+1);
|
||||
memcpy(lookup_name, name, name_len+1);
|
||||
|
||||
zend_str_tolower(lookup_name, name_len);
|
||||
|
||||
if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) {
|
||||
@@ -232,8 +238,9 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC
|
||||
} else {
|
||||
retval=0;
|
||||
}
|
||||
|
||||
efree(lookup_name);
|
||||
|
||||
free_alloca(lookup_name);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
+2
-2
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
+614
-449
File diff suppressed because it is too large.
Load diff
+3
-2
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -44,6 +44,7 @@ typedef union _temp_variable {
|
||||
} data;
|
||||
|
||||
unsigned char type;
|
||||
zend_class_entry *class_entry;
|
||||
} EA;
|
||||
} temp_variable;
|
||||
|
||||
|
||||
+75
-21
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -93,9 +93,9 @@ static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC)
|
||||
static int is_not_internal_function(zend_function *function TSRMLS_DC)
|
||||
{
|
||||
if (function->type == ZEND_INTERNAL_FUNCTION) {
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
|
||||
} else {
|
||||
return ZEND_HASH_APPLY_REMOVE;
|
||||
return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,9 +103,9 @@ static int is_not_internal_function(zend_function *function TSRMLS_DC)
|
||||
static int is_not_internal_class(zend_class_entry *ce TSRMLS_DC)
|
||||
{
|
||||
if (ce->type == ZEND_INTERNAL_CLASS) {
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
|
||||
} else {
|
||||
return ZEND_HASH_APPLY_REMOVE;
|
||||
return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,8 +121,7 @@ void init_executor(TSRMLS_D)
|
||||
#if 0&&ZEND_DEBUG
|
||||
original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv);
|
||||
#endif
|
||||
EG(return_value_ptr_ptr) = &EG(global_return_value_ptr);
|
||||
EG(global_return_value_ptr) = NULL;
|
||||
EG(return_value_ptr_ptr) = NULL;
|
||||
|
||||
EG(symtable_cache_ptr) = EG(symtable_cache)-1;
|
||||
EG(symtable_cache_limit)=EG(symtable_cache)+SYMTABLE_CACHE_SIZE-1;
|
||||
@@ -137,7 +136,7 @@ void init_executor(TSRMLS_D)
|
||||
|
||||
zend_hash_init(&EG(symbol_table), 50, NULL, ZVAL_PTR_DTOR, 0);
|
||||
EG(active_symbol_table) = &EG(symbol_table);
|
||||
|
||||
|
||||
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator TSRMLS_CC);
|
||||
EG(opline_ptr) = NULL;
|
||||
EG(garbage_ptr) = 0;
|
||||
@@ -152,9 +151,19 @@ void init_executor(TSRMLS_D)
|
||||
|
||||
EG(orig_error_reporting) = EG(error_reporting);
|
||||
zend_objects_init(&EG(objects), 1024);
|
||||
|
||||
EG(full_tables_cleanup) = 0;
|
||||
#ifdef ZEND_WIN32
|
||||
EG(timed_out) = 0;
|
||||
#endif
|
||||
|
||||
EG(exception) = NULL;
|
||||
|
||||
EG(namespace) = NULL;
|
||||
|
||||
EG(main_class_ptr) = &CG(main_class);
|
||||
CG(main_class).static_members = &EG(symbol_table);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -181,8 +190,13 @@ void shutdown_executor(TSRMLS_D)
|
||||
zend_ptr_stack_destroy(&EG(argument_stack));
|
||||
|
||||
/* Destroy all op arrays */
|
||||
zend_hash_reverse_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC);
|
||||
if (EG(full_tables_cleanup)) {
|
||||
zend_hash_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC);
|
||||
zend_hash_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC);
|
||||
} else {
|
||||
zend_hash_reverse_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC);
|
||||
}
|
||||
} zend_end_try();
|
||||
|
||||
/* The regular list must be destroyed after the main symbol table and
|
||||
@@ -280,6 +294,7 @@ ZEND_API int zend_is_true(zval *op)
|
||||
return i_zend_is_true(op);
|
||||
}
|
||||
|
||||
#include "../TSRM/tsrm_strtok_r.h"
|
||||
|
||||
ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
|
||||
{
|
||||
@@ -295,26 +310,60 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
|
||||
|
||||
refcount = p->refcount;
|
||||
|
||||
if (!zend_get_constant(p->value.str.val, p->value.str.len, &const_value TSRMLS_CC)) {
|
||||
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
|
||||
p->value.str.val,
|
||||
p->value.str.val);
|
||||
p->type = IS_STRING;
|
||||
if (!inline_change) {
|
||||
zval_copy_ctor(p);
|
||||
if (strchr(p->value.str.val, ':')) {
|
||||
char *cur, *temp;
|
||||
char *last;
|
||||
zend_class_entry *ce;
|
||||
zval **value;
|
||||
|
||||
last = tsrm_strtok_r(p->value.str.val, ":", &temp);
|
||||
|
||||
if (zend_hash_find(EG(class_table), last, strlen(last)+1, &ce) == FAILURE) {
|
||||
zend_error(E_ERROR, "Invalid class! Improve this error message");
|
||||
}
|
||||
} else {
|
||||
|
||||
for(;;) {
|
||||
cur = tsrm_strtok_r(NULL, ":", &temp);
|
||||
if (!cur) {
|
||||
break;
|
||||
}
|
||||
if (zend_hash_find(EG(class_table), last, strlen(last)+1, &ce) == FAILURE) {
|
||||
zend_error(E_ERROR, "Invalid class! Improve this error message");
|
||||
}
|
||||
last = cur;
|
||||
}
|
||||
if (zend_hash_find(&ce->constants_table, last, strlen(last)+1, (void **) &value) == FAILURE) {
|
||||
zend_error(E_ERROR, "Invalid class! Improve this error message");
|
||||
}
|
||||
const_value = **value;
|
||||
zval_copy_ctor(&const_value);
|
||||
if (inline_change) {
|
||||
STR_FREE(p->value.str.val);
|
||||
}
|
||||
*p = const_value;
|
||||
} else {
|
||||
if (!zend_get_constant(p->value.str.val, p->value.str.len, &const_value TSRMLS_CC)) {
|
||||
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
|
||||
p->value.str.val,
|
||||
p->value.str.val);
|
||||
p->type = IS_STRING;
|
||||
if (!inline_change) {
|
||||
zval_copy_ctor(p);
|
||||
}
|
||||
} else {
|
||||
if (inline_change) {
|
||||
STR_FREE(p->value.str.val);
|
||||
}
|
||||
*p = const_value;
|
||||
}
|
||||
}
|
||||
INIT_PZVAL(p);
|
||||
p->refcount = refcount;
|
||||
} else if (p->type == IS_CONSTANT_ARRAY) {
|
||||
zval **element;
|
||||
char *str_index;
|
||||
ulong str_index_len, num_index;
|
||||
uint str_index_len;
|
||||
ulong num_index;
|
||||
|
||||
SEPARATE_ZVAL(pp);
|
||||
p = *pp;
|
||||
@@ -605,6 +654,7 @@ void execute_new_code(TSRMLS_D)
|
||||
{
|
||||
zend_op *opline, *end;
|
||||
zend_op *ret_opline;
|
||||
zval *local_retval=NULL;
|
||||
|
||||
if (!CG(interactive)
|
||||
|| CG(active_op_array)->backpatch_count>0
|
||||
@@ -638,9 +688,13 @@ void execute_new_code(TSRMLS_D)
|
||||
opline++;
|
||||
}
|
||||
|
||||
EG(return_value_ptr_ptr) = &local_retval;
|
||||
EG(active_op_array) = CG(active_op_array);
|
||||
zend_execute(CG(active_op_array) TSRMLS_CC);
|
||||
zval_ptr_dtor(EG(return_value_ptr_ptr));
|
||||
if (local_retval) {
|
||||
zval_ptr_dtor(&local_retval);
|
||||
}
|
||||
|
||||
CG(active_op_array)->last--; /* get rid of that ZEND_RETURN */
|
||||
CG(active_op_array)->start_op = CG(active_op_array)->opcodes+CG(active_op_array)->last;
|
||||
}
|
||||
|
||||
@@ -5,18 +5,18 @@
|
||||
|
||||
static inline void zend_pzval_lock_func(zval *z)
|
||||
{
|
||||
((z)->refcount++);
|
||||
z->refcount++;
|
||||
}
|
||||
|
||||
#define PZVAL_UNLOCK(z) zend_pzval_unlock_func(z TSRMLS_CC)
|
||||
|
||||
static inline void zend_pzval_unlock_func(zval *z TSRMLS_DC)
|
||||
{
|
||||
((z)->refcount--);
|
||||
if (!(z)->refcount) {
|
||||
(z)->refcount = 1;
|
||||
(z)->is_ref = 0;
|
||||
EG(garbage)[EG(garbage_ptr)++] = (z);
|
||||
z->refcount--;
|
||||
if (!z->refcount) {
|
||||
z->refcount = 1;
|
||||
z->is_ref = 0;
|
||||
EG(garbage)[EG(garbage_ptr)++] = z;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -51,23 +51,23 @@ int zend_load_extension(char *path)
|
||||
/* allow extension to proclaim compatibility with any Zend version */
|
||||
if (extension_version_info->zend_extension_api_no != ZEND_EXTENSION_API_NO &&(!new_extension->api_no_check || new_extension->api_no_check(ZEND_EXTENSION_API_NO) != SUCCESS)) {
|
||||
if (extension_version_info->zend_extension_api_no > ZEND_EXTENSION_API_NO) {
|
||||
fprintf(stderr, "%s requires Zend Engine API version %d\n"
|
||||
"The installed Zend Engine API version is %d\n\n",
|
||||
fprintf(stderr, "%s requires Zend Engine API version %d.\n"
|
||||
"The Zend Engine API version %d which is installed, is outdated.\n\n",
|
||||
new_extension->name,
|
||||
extension_version_info->zend_extension_api_no,
|
||||
ZEND_EXTENSION_API_NO);
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
} else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) {
|
||||
fprintf(stderr, "%s designed to be used with the Zend Engine API %d is outdated\n"
|
||||
"It requires a more recent version of the Zend Engine\n"
|
||||
"The installed Zend Engine API version is %d\n"
|
||||
"Contact %s at %s for a later version of this module.\n\n",
|
||||
fprintf(stderr, "%s requires Zend Engine API version %d.\n"
|
||||
"The Zend Engine API version %d which is installed, is newer.\n"
|
||||
"Contact %s at %s for a later version of %s.\n\n",
|
||||
new_extension->name,
|
||||
extension_version_info->zend_extension_api_no,
|
||||
ZEND_EXTENSION_API_NO,
|
||||
new_extension->author,
|
||||
new_extension->URL);
|
||||
new_extension->URL,
|
||||
new_extension->name);
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
+21
-20
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -36,10 +36,6 @@
|
||||
/*#undef ZTS*/
|
||||
|
||||
#ifdef ZTS
|
||||
#ifdef __cplusplus
|
||||
class ZendFlexLexer;
|
||||
class ZendIniFlexLexer;
|
||||
#endif
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API extern int compiler_globals_id;
|
||||
@@ -70,7 +66,7 @@ struct _zend_compiler_globals {
|
||||
zend_stack object_stack;
|
||||
zend_stack declare_stack;
|
||||
|
||||
zend_class_entry class_entry, *active_class_entry;
|
||||
zend_class_entry *active_class_entry;
|
||||
zval active_ce_parent_class_name;
|
||||
|
||||
/* variables for list() compilation */
|
||||
@@ -89,6 +85,7 @@ struct _zend_compiler_globals {
|
||||
|
||||
zend_op_array *active_op_array;
|
||||
|
||||
zend_class_entry main_class;
|
||||
HashTable *function_table; /* function symbol table */
|
||||
HashTable *class_table; /* class table */
|
||||
|
||||
@@ -113,13 +110,7 @@ struct _zend_compiler_globals {
|
||||
|
||||
zend_llist open_files;
|
||||
|
||||
#if defined(ZTS) && defined(__cplusplus)
|
||||
ZendFlexLexer *ZFL;
|
||||
ZendIniFlexLexer *ini_scanner;
|
||||
#else
|
||||
void *ZFL;
|
||||
void *ini_parser;
|
||||
#endif
|
||||
zend_llist *throw_list;
|
||||
|
||||
struct _zend_ini_parser_param *ini_parser_param;
|
||||
|
||||
@@ -141,9 +132,6 @@ struct _zend_executor_globals {
|
||||
zend_function_state *function_state_ptr;
|
||||
zend_ptr_stack arg_types_stack;
|
||||
|
||||
/* for global return() support */
|
||||
zval *global_return_value_ptr;
|
||||
|
||||
/* symbol table cache */
|
||||
HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
|
||||
HashTable **symtable_cache_limit;
|
||||
@@ -168,12 +156,16 @@ struct _zend_executor_globals {
|
||||
HashTable *class_table; /* class table */
|
||||
HashTable *zend_constants; /* constants table */
|
||||
|
||||
zend_class_entry *namespace;
|
||||
zend_class_entry *main_class_ptr;
|
||||
|
||||
long precision;
|
||||
|
||||
int ticks_count;
|
||||
|
||||
zend_bool in_execution;
|
||||
zend_bool bailout_set;
|
||||
zend_bool full_tables_cleanup;
|
||||
|
||||
/* for extended information support */
|
||||
zend_bool no_extensions;
|
||||
@@ -203,6 +195,7 @@ struct _zend_executor_globals {
|
||||
|
||||
HashTable ini_directives;
|
||||
zend_objects objects;
|
||||
zval *exception;
|
||||
|
||||
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
|
||||
};
|
||||
@@ -232,16 +225,24 @@ struct _zend_alloc_globals {
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
struct _zend_scanner_globals {
|
||||
FILE *yyin;
|
||||
FILE *yyout;
|
||||
FILE *yy_in;
|
||||
FILE *yy_out;
|
||||
int yy_leng;
|
||||
char *yy_text;
|
||||
struct yy_buffer_state *current_buffer;
|
||||
char *c_buf_p;
|
||||
int init;
|
||||
int start;
|
||||
char _yy_hold_char;
|
||||
int yy_n_chars;
|
||||
int _yy_did_buffer_switch_on_eof;
|
||||
int _yy_last_accepting_state; /* Must be of the same type as yy_state_type,
|
||||
* if for whatever reason it's no longer int!
|
||||
*/
|
||||
char *_yy_last_accepting_cpos;
|
||||
int _yy_more_flag;
|
||||
int _yy_more_len;
|
||||
};
|
||||
|
||||
#endif /* ZEND_GLOBALS_H */
|
||||
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
+9
-9
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -1023,7 +1023,7 @@ ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos)
|
||||
|
||||
|
||||
/* This function should be made binary safe */
|
||||
ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos)
|
||||
ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos)
|
||||
{
|
||||
Bucket *p;
|
||||
|
||||
@@ -1088,7 +1088,7 @@ ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosi
|
||||
|
||||
|
||||
ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
|
||||
compare_func_t compar, int renumber)
|
||||
compare_func_t compar, int renumber TSRMLS_DC)
|
||||
{
|
||||
Bucket **arTmp;
|
||||
Bucket *p;
|
||||
@@ -1111,7 +1111,7 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
|
||||
i++;
|
||||
}
|
||||
|
||||
(*sort_func)((void *) arTmp, i, sizeof(Bucket *), compar);
|
||||
(*sort_func)((void *) arTmp, i, sizeof(Bucket *), compar TSRMLS_CC);
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
ht->pListHead = arTmp[0];
|
||||
@@ -1212,7 +1212,7 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
|
||||
}
|
||||
}
|
||||
}
|
||||
result = compar(p1->pData, pData2);
|
||||
result = compar(p1->pData, pData2 TSRMLS_CC);
|
||||
if (result!=0) {
|
||||
HASH_UNPROTECT_RECURSION(ht1);
|
||||
HASH_UNPROTECT_RECURSION(ht2);
|
||||
@@ -1230,7 +1230,7 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_hash_minmax(HashTable *ht, int (*compar) (const void *, const void *), int flag, void **pData)
|
||||
ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC)
|
||||
{
|
||||
Bucket *p, *res;
|
||||
|
||||
@@ -1244,11 +1244,11 @@ ZEND_API int zend_hash_minmax(HashTable *ht, int (*compar) (const void *, const
|
||||
res = p = ht->pListHead;
|
||||
while ((p = p->pListNext)) {
|
||||
if (flag) {
|
||||
if (compar(&res, &p) < 0) { /* max */
|
||||
if (compar(&res, &p TSRMLS_CC) < 0) { /* max */
|
||||
res = p;
|
||||
}
|
||||
} else {
|
||||
if (compar(&res, &p) > 0) { /* min */
|
||||
if (compar(&res, &p TSRMLS_CC) > 0) { /* min */
|
||||
res = p;
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -34,8 +34,8 @@
|
||||
#define HASH_DEL_INDEX 1
|
||||
|
||||
typedef ulong (*hash_func_t)(char *arKey, uint nKeyLength);
|
||||
typedef int (*compare_func_t)(const void *, const void *);
|
||||
typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t);
|
||||
typedef int (*compare_func_t)(const void *, const void * TSRMLS_DC);
|
||||
typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t TSRMLS_DC);
|
||||
typedef void (*dtor_func_t)(void *pDest);
|
||||
typedef void (*copy_ctor_func_t)(void *pElement);
|
||||
|
||||
@@ -154,7 +154,7 @@ ZEND_API ulong zend_hash_next_free_element(HashTable *ht);
|
||||
/* traversing */
|
||||
ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos);
|
||||
ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos);
|
||||
ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos);
|
||||
ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos);
|
||||
@@ -179,9 +179,9 @@ ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos
|
||||
ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size);
|
||||
ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite);
|
||||
ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, zend_bool (*pReplaceOrig)(void *orig, void *p_new));
|
||||
ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber);
|
||||
ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC);
|
||||
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC);
|
||||
ZEND_API int zend_hash_minmax(HashTable *ht, int (*compar)(const void *, const void *), int flag, void **pData);
|
||||
ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_hash_num_elements(HashTable *ht);
|
||||
|
||||
|
||||
+63
-2
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -173,6 +173,67 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
|
||||
zend_printf("</code>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
ZEND_API void zend_strip(TSRMLS_D)
|
||||
{
|
||||
zval token;
|
||||
int token_type;
|
||||
|
||||
token.type = 0;
|
||||
while ((token_type=lex_scan(&token TSRMLS_CC))) {
|
||||
switch (token_type) {
|
||||
case T_COMMENT:
|
||||
token.type = 0;
|
||||
break;
|
||||
|
||||
case T_WHITESPACE:
|
||||
if (token.type) {
|
||||
putchar(' ');
|
||||
token.type = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (token_type) {
|
||||
case 349:
|
||||
break;
|
||||
|
||||
default: {
|
||||
char c, *ptr=LANG_SCNG(yy_text), *end=LANG_SCNG(yy_text)+LANG_SCNG(yy_leng);
|
||||
while (ptr<end) {
|
||||
c = *ptr++;
|
||||
putchar(c);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (token.type == IS_STRING) {
|
||||
switch (token_type) {
|
||||
case T_OPEN_TAG:
|
||||
case T_OPEN_TAG_WITH_ECHO:
|
||||
case T_CLOSE_TAG:
|
||||
case T_WHITESPACE:
|
||||
case T_COMMENT:
|
||||
break;
|
||||
|
||||
default:
|
||||
efree(token.value.str.val);
|
||||
break;
|
||||
}
|
||||
} else if (token_type == T_END_HEREDOC) {
|
||||
zend_bool has_semicolon=(strchr(token.value.str.val, ';')?1:0);
|
||||
|
||||
efree(token.value.str.val);
|
||||
if (has_semicolon) {
|
||||
/* the following semicolon was unput(), ignore it */
|
||||
lex_scan(&token TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
token.type = 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -40,6 +40,7 @@ typedef struct _zend_syntax_highlighter_ini {
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC);
|
||||
ZEND_API void zend_strip(TSRMLS_D);
|
||||
ZEND_API int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC);
|
||||
ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC);
|
||||
ZEND_API void zend_html_putc(char c);
|
||||
|
||||
+2
-2
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
+2
-2
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
+5
-4
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_qsort.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_ini.h"
|
||||
#include "zend_alloc.h"
|
||||
@@ -97,7 +98,7 @@ ZEND_API int zend_copy_ini_directives(TSRMLS_D)
|
||||
}
|
||||
|
||||
|
||||
static int ini_key_compare(const void *a, const void *b)
|
||||
static int ini_key_compare(const void *a, const void *b TSRMLS_DC)
|
||||
{
|
||||
Bucket *f;
|
||||
Bucket *s;
|
||||
@@ -119,7 +120,7 @@ static int ini_key_compare(const void *a, const void *b)
|
||||
|
||||
ZEND_API void zend_ini_sort_entries(TSRMLS_D)
|
||||
{
|
||||
zend_hash_sort(&EG(ini_directives), qsort, ini_key_compare, 0);
|
||||
zend_hash_sort(&EG(ini_directives), zend_qsort, ini_key_compare, 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+2
-2
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
@@ -1,18 +1,6 @@
|
||||
#ifndef _ZEND_INI_SCANNER_H
|
||||
#define _ZEND_INI_SCANNER_H
|
||||
|
||||
#if defined(ZTS) && defined(__cplusplus)
|
||||
class ZendIniFlexLexer : public yyFlexLexer
|
||||
{
|
||||
public:
|
||||
virtual ~ZendIniFlexLexer();
|
||||
int lex_scan(zval *zendlval);
|
||||
void BeginState(int state);
|
||||
|
||||
char *filename;
|
||||
};
|
||||
#endif /* ZTS && __cplusplus */
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
int zend_ini_scanner_get_lineno(TSRMLS_D);
|
||||
char *zend_ini_scanner_get_filename(TSRMLS_D);
|
||||
|
||||
+12
-74
@@ -5,10 +5,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -17,33 +17,25 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#define yyleng SCNG(yy_leng)
|
||||
#define yytext SCNG(yy_text)
|
||||
#define yytext_ptr SCNG(yy_text)
|
||||
#define yyin SCNG(yy_in)
|
||||
#define yyout SCNG(yy_out)
|
||||
#define yy_last_accepting_state SCNG(_yy_last_accepting_state)
|
||||
#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos)
|
||||
#define yy_more_flag SCNG(_yy_more_flag)
|
||||
#define yy_more_len SCNG(_yy_more_len)
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_globals.h"
|
||||
#include "zend_ini_parser.h"
|
||||
#include "zend_ini_scanner.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef HAVE_STDIOSTR_H
|
||||
# include <stdiostr.h>
|
||||
# endif
|
||||
# ifdef HAVE_STDIOSTREAM_H
|
||||
# include <stdiostream.h>
|
||||
# endif
|
||||
# ifdef ZEND_WIN32
|
||||
# include <strstrea.h>
|
||||
# else
|
||||
# include <strstream.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#undef YYSTYPE
|
||||
#define YYSTYPE zval
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define YY_DECL int ZendIniFlexLexer::lex_scan(zval *ini_lval TSRMLS_DC)
|
||||
#else
|
||||
#define YY_DECL int ini_lex(zval *ini_lval TSRMLS_DC)
|
||||
#endif
|
||||
|
||||
/* Globals Macros */
|
||||
#define SCNG INI_SCNG
|
||||
@@ -54,7 +46,6 @@ ZEND_API zend_scanner_globals ini_scanner_globals;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
static char *ini_filename;
|
||||
|
||||
void init_ini_scanner()
|
||||
@@ -74,40 +65,6 @@ char *zend_ini_scanner_get_filename(TSRMLS_D)
|
||||
return ini_filename;
|
||||
}
|
||||
|
||||
#else /* ZTS */
|
||||
|
||||
int zend_ini_scanner_get_lineno(TSRMLS_D)
|
||||
{
|
||||
return CG(ini_scanner)->lineno();
|
||||
}
|
||||
|
||||
char *zend_ini_scanner_get_filename(TSRMLS_D)
|
||||
{
|
||||
return CG(ini_scanner)->filename;
|
||||
}
|
||||
|
||||
int ini_lex(zval *ini_lval)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
return CG(ini_scanner)->lex_scan(ini_lval);
|
||||
}
|
||||
|
||||
ZendIniFlexLexer::~ZendIniFlexLexer()
|
||||
{
|
||||
if (yy_start_stack) {
|
||||
yy_flex_free(yy_start_stack);
|
||||
}
|
||||
}
|
||||
|
||||
int yyFlexLexer::yylex()
|
||||
{
|
||||
fprintf(stderr, "Error: yyFlexLexer::yylex() called\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC)
|
||||
{
|
||||
@@ -125,22 +82,10 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
if (!fp) {
|
||||
return FAILURE;
|
||||
}
|
||||
fh->handle.is = new istdiostream(fp);
|
||||
fh->type = ZEND_HANDLE_STDIOSTREAM;
|
||||
|
||||
CG(ini_scanner) = new ZendIniFlexLexer;
|
||||
CG(ini_scanner)->switch_streams(fh->handle.is, &cout);
|
||||
CG(ini_scanner)->filename = fh->filename;
|
||||
#else
|
||||
init_ini_scanner();
|
||||
yyin = fp;
|
||||
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC);
|
||||
ini_filename = fh->filename;
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -151,13 +96,6 @@ void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC)
|
||||
case ZEND_HANDLE_FP:
|
||||
fclose(fh->handle.fp);
|
||||
break;
|
||||
#ifdef __cplusplus
|
||||
case ZEND_HANDLE_STDIOSTREAM: {
|
||||
TSRMLS_FETCH();
|
||||
delete CG(ini_scanner);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+78
-30
@@ -5,10 +5,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -105,6 +105,9 @@
|
||||
%token T_FUNCTION
|
||||
%token T_CONST
|
||||
%token T_RETURN
|
||||
%token T_TRY
|
||||
%token T_CATCH
|
||||
%token T_THROW
|
||||
%token T_USE
|
||||
%token T_GLOBAL
|
||||
%token T_STATIC
|
||||
@@ -112,6 +115,7 @@
|
||||
%token T_UNSET
|
||||
%token T_ISSET
|
||||
%token T_EMPTY
|
||||
%token T_NAMESPACE
|
||||
%token T_CLASS
|
||||
%token T_EXTENDS
|
||||
%token T_OBJECT_OPERATOR
|
||||
@@ -201,7 +205,12 @@ unticked_statement:
|
||||
| T_FOREACH '(' expr_without_variable T_AS { zend_do_foreach_begin(&$1, &$3, &$2, &$4, 0 TSRMLS_CC); } w_cvar foreach_optional_arg ')' { zend_do_foreach_cont(&$6, &$7, &$4 TSRMLS_CC); } foreach_statement { zend_do_foreach_end(&$1, &$2 TSRMLS_CC); }
|
||||
| T_DECLARE { zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(TSRMLS_C); }
|
||||
| ';' /* empty statement */
|
||||
| T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}'
|
||||
T_CATCH '(' T_VARIABLE ')' { zend_do_begin_catch(&$1, &$8 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
|
||||
| T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); }
|
||||
| T_DELETE cvar ';' { zend_do_end_variable_parse(BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&$1, ZEND_UNSET_OBJ TSRMLS_CC); }
|
||||
| T_NAMESPACE namespace_class_entry ';' { do_namespace(&$2 TSRMLS_CC); }
|
||||
| T_NAMESPACE ';' { do_namespace(NULL TSRMLS_CC); }
|
||||
;
|
||||
|
||||
unset_variables:
|
||||
@@ -229,8 +238,8 @@ unticked_declaration_statement:
|
||||
'(' parameter_list ')' '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
|
||||
| T_OLD_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 0, $3.op_type TSRMLS_CC); }
|
||||
parameter_list '(' inner_statement_list ')' ';' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
|
||||
| T_CLASS T_STRING { zend_do_begin_class_declaration(&$2, NULL TSRMLS_CC); } '{' class_statement_list '}' { zend_do_end_class_declaration(TSRMLS_C); }
|
||||
| T_CLASS T_STRING T_EXTENDS T_STRING { zend_do_begin_class_declaration(&$2, &$4 TSRMLS_CC); } '{' class_statement_list '}' { zend_do_end_class_declaration(TSRMLS_C); }
|
||||
| T_CLASS T_STRING { zend_do_begin_class_declaration(&$1, &$2, NULL TSRMLS_CC); } '{' class_statement_list '}' { zend_do_end_class_declaration(&$1 TSRMLS_CC); }
|
||||
| T_CLASS T_STRING T_EXTENDS T_STRING { zend_do_begin_class_declaration(&$1, &$2, &$4 TSRMLS_CC); } '{' class_statement_list '}' { zend_do_end_class_declaration(&$1 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
@@ -378,12 +387,14 @@ class_statement_list:
|
||||
|
||||
|
||||
class_statement:
|
||||
T_VAR class_variable_decleration ';'
|
||||
class_variable_decleration ';'
|
||||
| class_constant_decleration ';'
|
||||
| T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 1, $3.op_type TSRMLS_CC); } '('
|
||||
parameter_list ')' '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
|
||||
| T_OLD_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 1, $3.op_type TSRMLS_CC); }
|
||||
parameter_list '(' inner_statement_list ')' ';' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
|
||||
|
||||
| T_CLASS T_STRING { zend_do_begin_class_declaration(&$1, &$2, NULL TSRMLS_CC); } '{' class_statement_list '}' { zend_do_end_class_declaration(&$1 TSRMLS_CC); }
|
||||
| T_CLASS T_STRING T_EXTENDS T_STRING { zend_do_begin_class_declaration(&$1, &$2, &$4 TSRMLS_CC); } '{' class_statement_list '}' { zend_do_end_class_declaration(&$1 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
is_reference:
|
||||
@@ -391,12 +402,21 @@ is_reference:
|
||||
| '&' { $$.op_type = ZEND_RETURN_REF; }
|
||||
|
||||
class_variable_decleration:
|
||||
class_variable_decleration ',' T_VARIABLE { zend_do_declare_property(&$3, NULL TSRMLS_CC); }
|
||||
| class_variable_decleration ',' T_VARIABLE '=' static_scalar { zend_do_declare_property(&$3, &$5 TSRMLS_CC); }
|
||||
| T_VARIABLE { zend_do_declare_property(&$1, NULL TSRMLS_CC); }
|
||||
| T_VARIABLE '=' static_scalar { zend_do_declare_property(&$1, &$3 TSRMLS_CC); }
|
||||
class_variable_decleration ',' T_VARIABLE { zend_do_declare_property(&$3, NULL, $1.op_type TSRMLS_CC); }
|
||||
| class_variable_decleration ',' T_VARIABLE '=' static_scalar { zend_do_declare_property(&$3, &$5, $1.op_type TSRMLS_CC); }
|
||||
| class_decleration_type T_VARIABLE { $$ = $1; zend_do_declare_property(&$2, NULL, $1.op_type TSRMLS_CC); }
|
||||
| class_decleration_type T_VARIABLE '=' static_scalar { $$ = $1; zend_do_declare_property(&$2, &$4, $1.op_type TSRMLS_CC); }
|
||||
;
|
||||
|
||||
class_decleration_type:
|
||||
T_VAR { $$.op_type = T_VAR; }
|
||||
| T_STATIC { $$.op_type = T_STATIC; }
|
||||
;
|
||||
|
||||
class_constant_decleration:
|
||||
| T_CONST ',' T_STRING '=' static_scalar { zend_do_declare_property(&$3, &$5, T_CONST TSRMLS_CC); }
|
||||
| T_CONST T_STRING '=' static_scalar { zend_do_declare_property(&$2, &$4, T_CONST TSRMLS_CC); }
|
||||
;
|
||||
|
||||
echo_expr_list:
|
||||
| echo_expr_list ',' expr { zend_do_echo(&$3 TSRMLS_CC); }
|
||||
@@ -414,14 +434,13 @@ non_empty_for_expr:
|
||||
| expr { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
expr_without_variable:
|
||||
T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' '=' expr { zend_do_list_end(&$$, &$7 TSRMLS_CC); }
|
||||
| cvar '=' expr { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
| cvar '=' '&' w_cvar { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); }
|
||||
| cvar '=' '&' function_call { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); }
|
||||
| cvar '=' '&' T_NEW static_or_variable_string { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$5, &$4, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
| T_NEW static_or_variable_string { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$1, &$2 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$2, &$1, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| cvar '=' '&' T_NEW new_class_entry { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
| T_NEW new_class_entry { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$1, &$2 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$1, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| cvar T_PLUS_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| cvar T_MINUS_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
| cvar T_MUL_EQUAL expr { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 TSRMLS_CC); }
|
||||
@@ -490,19 +509,37 @@ 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); }
|
||||
| T_STRING T_PAAMAYIM_NEKUDOTAYIM static_or_variable_string '(' { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
| parse_class_entry static_or_variable_string '(' { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_class_member_function_call(&$1, &$2 TSRMLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { zend_do_end_function_call(&$3, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
')' { zend_do_end_function_call(&$2, &$$, &$5, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| cvar_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);}
|
||||
|
||||
;
|
||||
|
||||
parse_class_entry:
|
||||
parse_class_entry T_STRING T_PAAMAYIM_NEKUDOTAYIM { do_fetch_class(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
| T_STRING T_PAAMAYIM_NEKUDOTAYIM { do_fetch_class(&$$, NULL, &$1 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
parse_class_name_entry:
|
||||
parse_class_name_entry T_STRING T_PAAMAYIM_NEKUDOTAYIM { do_fetch_class_name(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
| T_STRING T_PAAMAYIM_NEKUDOTAYIM { $$ = $1; }
|
||||
;
|
||||
|
||||
namespace_class_entry:
|
||||
parse_class_entry T_STRING { do_fetch_class(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
| T_STRING { do_fetch_class(&$$, NULL, &$1 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
new_class_entry:
|
||||
parse_class_entry static_or_variable_string { do_fetch_class(&$$, &$1, &$2 TSRMLS_CC); }
|
||||
| static_or_variable_string { do_fetch_class(&$$, NULL, &$1 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
static_or_variable_string:
|
||||
T_STRING { $$ = $1; }
|
||||
| r_cvar { $$ = $1; }
|
||||
| r_cvar_without_static_member { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
@@ -530,16 +567,18 @@ common_scalar:
|
||||
|
||||
static_scalar: /* compile-time evaluated scalars */
|
||||
common_scalar { $$ = $1; }
|
||||
| T_STRING { zend_do_fetch_constant(&$$, &$1, ZEND_CT TSRMLS_CC); }
|
||||
| T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT TSRMLS_CC); }
|
||||
| '+' static_scalar { $$ = $1; }
|
||||
| '-' static_scalar { zval minus_one; minus_one.type = IS_LONG; minus_one.value.lval = -1; mul_function(&$2.u.constant, &$2.u.constant, &minus_one TSRMLS_CC); $$ = $2; }
|
||||
| T_ARRAY '(' static_array_pair_list ')' { $$ = $3; $$.u.constant.type = IS_CONSTANT_ARRAY; }
|
||||
| parse_class_name_entry T_STRING { zend_do_fetch_constant(&$$, &$1, &$2, ZEND_CT TSRMLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
scalar:
|
||||
T_STRING { zend_do_fetch_constant(&$$, &$1, ZEND_RT TSRMLS_CC); }
|
||||
T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT TSRMLS_CC); }
|
||||
| T_STRING_VARNAME { $$ = $1; }
|
||||
| parse_class_entry T_STRING { zend_do_fetch_constant(&$$, &$1, &$2, ZEND_RT TSRMLS_CC); }
|
||||
| common_scalar { $$ = $1; }
|
||||
| '"' encaps_list '"' { $$ = $2; }
|
||||
| '\'' encaps_list '\'' { $$ = $2; }
|
||||
@@ -584,10 +623,28 @@ rw_cvar:
|
||||
cvar { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); $$ = $1; }
|
||||
;
|
||||
|
||||
r_cvar_without_static_member:
|
||||
variable { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); $$ = $1; }
|
||||
;
|
||||
|
||||
cvar:
|
||||
cvar_without_objects { $$ = $1; }
|
||||
| cvar_without_objects T_OBJECT_OPERATOR { zend_do_push_object(&$1 TSRMLS_CC); } ref_list { $$ = $4; }
|
||||
variable { $$ = $1; }
|
||||
| static_member {$$ = $1; }
|
||||
;
|
||||
|
||||
static_member:
|
||||
parse_class_entry variable { $$ = $2; zend_do_fetch_static_member(&$1 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
variable:
|
||||
variable_property '(' { zend_do_begin_method_call(NULL, &$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);}
|
||||
| variable_property { $$ = $1; }
|
||||
| cvar_without_objects { $$ = $1; }
|
||||
;
|
||||
|
||||
variable_property:
|
||||
variable T_OBJECT_OPERATOR { zend_do_push_object(&$1 TSRMLS_CC); } object_property { $$ = $4; }
|
||||
;
|
||||
|
||||
|
||||
@@ -614,19 +671,10 @@ dim_offset:
|
||||
| expr { $$ = $1; }
|
||||
;
|
||||
|
||||
ref_list:
|
||||
object_property { $$ = $1; }
|
||||
| ref_list T_OBJECT_OPERATOR { zend_do_push_object(&$1 TSRMLS_CC); } object_property { $$ = $4; }
|
||||
;
|
||||
|
||||
object_property:
|
||||
object_dim_list { $$ = $1; }
|
||||
| cvar_without_objects { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); } { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);}
|
||||
| cvar_without_objects '(' { znode tmp_znode; zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_begin_method_call(&tmp_znode, &$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);}
|
||||
| variable_name '(' { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_begin_method_call(&tmp_znode, &$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);}
|
||||
|
||||
;
|
||||
|
||||
object_dim_list:
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -21,27 +21,10 @@
|
||||
#ifndef ZEND_SCANNER_H
|
||||
#define ZEND_SCANNER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
class ZendFlexLexer : public yyFlexLexer
|
||||
{
|
||||
public:
|
||||
virtual ~ZendFlexLexer();
|
||||
int lex_scan(zval *zendlval TSRMLS_DC);
|
||||
void BeginState(int state);
|
||||
};
|
||||
|
||||
#endif /* ZTS */
|
||||
|
||||
|
||||
typedef struct _zend_lex_state {
|
||||
#ifndef __cplusplus
|
||||
YY_BUFFER_STATE buffer_state;
|
||||
int state;
|
||||
FILE *in;
|
||||
#else
|
||||
ZendFlexLexer *ZFL;
|
||||
istream *input_file;
|
||||
#endif
|
||||
uint lineno;
|
||||
char *filename;
|
||||
} zend_lex_state;
|
||||
|
||||
+34
-170
@@ -6,10 +6,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -19,6 +19,16 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#define yyleng SCNG(yy_leng)
|
||||
#define yytext SCNG(yy_text)
|
||||
#define yytext_ptr SCNG(yy_text)
|
||||
#define yyin SCNG(yy_in)
|
||||
#define yyout SCNG(yy_out)
|
||||
#define yy_last_accepting_state SCNG(_yy_last_accepting_state)
|
||||
#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos)
|
||||
#define yy_more_flag SCNG(_yy_more_flag)
|
||||
#define yy_more_len SCNG(_yy_more_len)
|
||||
|
||||
%}
|
||||
|
||||
%x ST_IN_SCRIPTING
|
||||
@@ -49,21 +59,6 @@
|
||||
#include "zend_variables.h"
|
||||
#include "zend_operators.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <fstream.h>
|
||||
# ifdef HAVE_STDIOSTR_H
|
||||
# include <stdiostr.h>
|
||||
# endif
|
||||
# ifdef HAVE_STDIOSTREAM_H
|
||||
# include <stdiostream.h>
|
||||
# endif
|
||||
# ifdef ZEND_WIN32
|
||||
# include <strstrea.h>
|
||||
# else
|
||||
# include <strstream.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
# include <stdarg.h>
|
||||
#endif
|
||||
@@ -72,11 +67,7 @@
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define YY_DECL int ZendFlexLexer::lex_scan(zval *zendlval TSRMLS_DC)
|
||||
#else
|
||||
#define YY_DECL int lex_scan(zval *zendlval TSRMLS_DC)
|
||||
#endif
|
||||
|
||||
#define ECHO { ZEND_WRITE( yytext, yyleng ); }
|
||||
|
||||
@@ -149,13 +140,9 @@ END_EXTERN_C()
|
||||
|
||||
static inline void save_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
|
||||
{
|
||||
#ifndef __cplusplus
|
||||
memcpy(&lex_state->buffer_state, &YY_CURRENT_BUFFER, sizeof(YY_BUFFER_STATE));
|
||||
lex_state->in = yyin;
|
||||
lex_state->in = SCNG(yy_in);
|
||||
lex_state->state = YYSTATE;
|
||||
#else
|
||||
lex_state->ZFL = CG(ZFL);
|
||||
#endif
|
||||
lex_state->filename = zend_get_compiled_filename(TSRMLS_C);
|
||||
lex_state->lineno = CG(zend_lineno);
|
||||
}
|
||||
@@ -163,7 +150,6 @@ static inline void save_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
|
||||
|
||||
static inline void restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
|
||||
{
|
||||
#ifndef __cplusplus
|
||||
YY_BUFFER_STATE original_buffer_state = YY_CURRENT_BUFFER;
|
||||
|
||||
if (lex_state->buffer_state) {
|
||||
@@ -173,12 +159,8 @@ static inline void restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
|
||||
}
|
||||
|
||||
yy_delete_buffer(original_buffer_state TSRMLS_CC);
|
||||
yyin = lex_state->in;
|
||||
SCNG(yy_in) = lex_state->in;
|
||||
BEGIN(lex_state->state);
|
||||
#else
|
||||
delete((ZendFlexLexer *) CG(ZFL));
|
||||
CG(ZFL) = lex_state->ZFL;
|
||||
#endif
|
||||
CG(zend_lineno) = lex_state->lineno;
|
||||
zend_restore_compiled_filename(lex_state->filename TSRMLS_CC);
|
||||
}
|
||||
@@ -198,17 +180,6 @@ ZEND_API void zend_file_handle_dtor(zend_file_handle *fh)
|
||||
* which doesn't really contain open files, but references to their names/paths
|
||||
*/
|
||||
break;
|
||||
#ifdef __cplusplus
|
||||
case ZEND_HANDLE_FSTREAM:
|
||||
delete ((ifstream *) fh->handle.is);
|
||||
break;
|
||||
case ZEND_HANDLE_STDIOSTREAM:
|
||||
istdiostream *pstdiostream = (istdiostream *) fh->handle.is;
|
||||
|
||||
fclose(pstdiostream->rdbuf()->stdiofile());
|
||||
delete pstdiostream;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
if (fh->opened_path) {
|
||||
efree(fh->opened_path);
|
||||
@@ -228,12 +199,6 @@ int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2)
|
||||
case ZEND_HANDLE_FP:
|
||||
return fh1->handle.fp==fh2->handle.fp;
|
||||
break;
|
||||
#ifdef __cplusplus
|
||||
case ZEND_HANDLE_FSTREAM:
|
||||
case ZEND_HANDLE_STDIOSTREAM:
|
||||
return fh1->handle.is==fh2->handle.is;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -249,7 +214,6 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
|
||||
{
|
||||
char *file_path=NULL;
|
||||
|
||||
#ifndef __cplusplus
|
||||
switch (file_handle->type) {
|
||||
case ZEND_HANDLE_FILENAME:
|
||||
file_handle->handle.fp = zend_fopen(file_handle->filename, &file_handle->opened_path);
|
||||
@@ -270,49 +234,9 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
|
||||
zend_llist_add_element(&CG(open_files), file_handle);
|
||||
}
|
||||
/* Reset the scanner for scanning the new file */
|
||||
yyin = file_handle->handle.fp;
|
||||
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC);
|
||||
SCNG(yy_in) = file_handle->handle.fp;
|
||||
yy_switch_to_buffer(yy_create_buffer(SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC);
|
||||
BEGIN(INITIAL);
|
||||
#else
|
||||
switch (file_handle->type) {
|
||||
case ZEND_HANDLE_FD:
|
||||
file_handle->handle.is = new ifstream(file_handle->handle.fd);
|
||||
file_handle->type = ZEND_HANDLE_FSTREAM;
|
||||
break;
|
||||
case ZEND_HANDLE_FILENAME:
|
||||
{
|
||||
file_handle->handle.fp = zend_fopen(file_handle->filename, &file_handle->opened_path);
|
||||
if (!file_handle->handle.fp) {
|
||||
return FAILURE;
|
||||
}
|
||||
file_handle->handle.is = new istdiostream(file_handle->handle.fp);
|
||||
file_handle->type = ZEND_HANDLE_STDIOSTREAM;
|
||||
break;
|
||||
}
|
||||
case ZEND_HANDLE_FP:
|
||||
if (file_handle->handle.fp==stdin) {
|
||||
file_handle->handle.is = &cin;
|
||||
} else {
|
||||
if (!file_handle->handle.fp) {
|
||||
return FAILURE;
|
||||
}
|
||||
file_handle->handle.is = new istdiostream(file_handle->handle.fp);
|
||||
file_handle->type = ZEND_HANDLE_STDIOSTREAM;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (file_handle->handle.is->fail()) {
|
||||
delete file_handle->handle.is;
|
||||
return FAILURE;
|
||||
}
|
||||
if (file_handle->handle.is != &cin) {
|
||||
zend_llist_add_element(&CG(open_files), file_handle);
|
||||
}
|
||||
|
||||
CG(ZFL) = new ZendFlexLexer;
|
||||
CG(ZFL)->switch_streams(file_handle->handle.is, &cout);
|
||||
#endif
|
||||
|
||||
if (file_handle->opened_path) {
|
||||
file_path = file_handle->opened_path;
|
||||
@@ -418,28 +342,19 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC)
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifndef __cplusplus
|
||||
static inline int prepare_string_for_scanning(zval *str, char *filename TSRMLS_DC)
|
||||
#else
|
||||
static inline int prepare_string_for_scanning(zval *str, istrstream **input_stream, char *filename TSRMLS_DC)
|
||||
#endif
|
||||
{
|
||||
#ifndef __cplusplus
|
||||
/* enforce two trailing NULLs for flex... */
|
||||
STR_REALLOC(str->value.str.val, str->value.str.len+2);
|
||||
|
||||
str->value.str.val[str->value.str.len+1]=0;
|
||||
|
||||
yyin=NULL;
|
||||
SCNG(yy_in)=NULL;
|
||||
yy_scan_buffer(str->value.str.val, str->value.str.len+2 TSRMLS_CC);
|
||||
#else
|
||||
*input_stream = new istrstream(str->value.str.val, str->value.str.len);
|
||||
CG(ZFL) = new ZendFlexLexer;
|
||||
|
||||
CG(ZFL)->switch_streams(*input_stream, &cout);
|
||||
#endif
|
||||
zend_set_compiled_filename(filename TSRMLS_CC);
|
||||
CG(zend_lineno) = 1;
|
||||
CG(increment_lineno) = 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -453,9 +368,6 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
|
||||
zval tmp;
|
||||
int compiler_result;
|
||||
zend_bool original_in_compilation = CG(in_compilation);
|
||||
#ifdef __cplusplus
|
||||
istrstream *input_stream;
|
||||
#endif
|
||||
|
||||
if (source_string->value.str.len==0) {
|
||||
efree(op_array);
|
||||
@@ -470,21 +382,13 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
|
||||
source_string = &tmp;
|
||||
|
||||
save_lexical_state(&original_lex_state TSRMLS_CC);
|
||||
#ifndef __cplusplus
|
||||
if (prepare_string_for_scanning(source_string, filename TSRMLS_CC)==FAILURE) {
|
||||
#else
|
||||
if (prepare_string_for_scanning(source_string, &input_stream, filename TSRMLS_CC)==FAILURE) {
|
||||
#endif
|
||||
efree(op_array);
|
||||
retval = NULL;
|
||||
} else {
|
||||
init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
|
||||
CG(active_op_array) = op_array;
|
||||
#ifndef __cplusplus
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
#else
|
||||
CG(ZFL)->BeginState(ST_IN_SCRIPTING);
|
||||
#endif
|
||||
compiler_result = zendparse(TSRMLS_C);
|
||||
|
||||
if (compiler_result==1) {
|
||||
@@ -499,9 +403,6 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
|
||||
}
|
||||
restore_lexical_state(&original_lex_state TSRMLS_CC);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
delete input_stream;
|
||||
#endif
|
||||
zval_dtor(&tmp);
|
||||
CG(in_compilation) = original_in_compilation;
|
||||
return retval;
|
||||
@@ -533,73 +434,20 @@ int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_
|
||||
{
|
||||
zend_lex_state original_lex_state;
|
||||
zval tmp = *str;
|
||||
#ifdef __cplusplus
|
||||
istrstream *input_stream;
|
||||
#endif
|
||||
|
||||
str = &tmp;
|
||||
zval_copy_ctor(str);
|
||||
save_lexical_state(&original_lex_state TSRMLS_CC);
|
||||
#ifndef __cplusplus
|
||||
if (prepare_string_for_scanning(str, str_name TSRMLS_CC)==FAILURE) {
|
||||
#else
|
||||
if (prepare_string_for_scanning(str, &input_stream, str_name TSRMLS_CC)==FAILURE) {
|
||||
#endif
|
||||
return FAILURE;
|
||||
}
|
||||
zend_highlight(syntax_highlighter_ini TSRMLS_CC);
|
||||
restore_lexical_state(&original_lex_state TSRMLS_CC);
|
||||
#ifdef __cplusplus
|
||||
delete input_stream;
|
||||
#endif
|
||||
zval_dtor(str);
|
||||
return SUCCESS;
|
||||
}
|
||||
END_EXTERN_C()
|
||||
|
||||
#ifdef __cplusplus
|
||||
BEGIN_EXTERN_C()
|
||||
int lex_scan(zval *zendlval TSRMLS_DC)
|
||||
{
|
||||
return CG(ZFL)->lex_scan(zendlval TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
const char *zend_get_zendtext(TSRMLS_D)
|
||||
{
|
||||
return CG(ZFL)->YYText();
|
||||
}
|
||||
|
||||
|
||||
int zend_get_zendleng(TSRMLS_D)
|
||||
{
|
||||
return CG(ZFL)->YYLeng();
|
||||
}
|
||||
END_EXTERN_C()
|
||||
|
||||
|
||||
void ZendFlexLexer::BeginState(int state)
|
||||
{
|
||||
BEGIN(state);
|
||||
}
|
||||
|
||||
|
||||
ZendFlexLexer::~ZendFlexLexer()
|
||||
{
|
||||
if (yy_start_stack) {
|
||||
yy_flex_free(yy_start_stack);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int yyFlexLexer::yylex()
|
||||
{
|
||||
fprintf(stderr, "Error: yyFlexLexer::yylex() called\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
LNUM [0-9]+
|
||||
@@ -643,6 +491,18 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
return T_RETURN;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"try" {
|
||||
return T_TRY;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"catch" {
|
||||
return T_CATCH;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"throw" {
|
||||
return T_THROW;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"if" {
|
||||
return T_IF;
|
||||
}
|
||||
@@ -731,6 +591,10 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
return T_PRINT;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"namespace" {
|
||||
return T_NAMESPACE;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"class" {
|
||||
return T_CLASS;
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
|
||||
+2
-6
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -58,10 +58,6 @@ typedef struct _zend_rsrc_list_dtors_entry {
|
||||
ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number);
|
||||
ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_func_t pld, char *type_name, int module_number);
|
||||
|
||||
enum list_entry_type {
|
||||
LE_DB=1000
|
||||
};
|
||||
|
||||
void list_entry_destructor(void *ptr);
|
||||
void plist_entry_destructor(void *ptr);
|
||||
|
||||
|
||||
+46
-35
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -20,13 +20,15 @@
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_llist.h"
|
||||
#include "zend_qsort.h"
|
||||
|
||||
ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent)
|
||||
{
|
||||
l->head = NULL;
|
||||
l->tail = NULL;
|
||||
l->size = size;
|
||||
l->dtor = dtor;
|
||||
l->head = NULL;
|
||||
l->tail = NULL;
|
||||
l->count = 0;
|
||||
l->size = size;
|
||||
l->dtor = dtor;
|
||||
l->persistent = persistent;
|
||||
}
|
||||
|
||||
@@ -44,6 +46,8 @@ ZEND_API void zend_llist_add_element(zend_llist *l, void *element)
|
||||
}
|
||||
l->tail = tmp;
|
||||
memcpy(tmp->data, element, l->size);
|
||||
|
||||
++l->count;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,36 +64,41 @@ ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element)
|
||||
}
|
||||
l->head = tmp;
|
||||
memcpy(tmp->data, element, l->size);
|
||||
|
||||
++l->count;
|
||||
}
|
||||
|
||||
|
||||
#define DEL_LLIST_ELEMENT(current, l) \
|
||||
if (current->prev) {\
|
||||
current->prev->next = current->next;\
|
||||
if ((current)->prev) {\
|
||||
(current)->prev->next = (current)->next;\
|
||||
} else {\
|
||||
l->head = current->next;\
|
||||
(l)->head = (current)->next;\
|
||||
}\
|
||||
if (current->next) {\
|
||||
current->next->prev = current->prev;\
|
||||
if ((current)->next) {\
|
||||
(current)->next->prev = (current)->prev;\
|
||||
} else {\
|
||||
l->tail = current->prev;\
|
||||
(l)->tail = (current)->prev;\
|
||||
}\
|
||||
if (l->dtor) {\
|
||||
l->dtor(current->data);\
|
||||
pefree(current, l->persistent);\
|
||||
}
|
||||
if ((l)->dtor) {\
|
||||
(l)->dtor((current)->data);\
|
||||
pefree((current), (l)->persistent);\
|
||||
}\
|
||||
--l->count;
|
||||
|
||||
|
||||
ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2))
|
||||
{
|
||||
zend_llist_element *current=l->head;
|
||||
zend_llist_element *next;
|
||||
|
||||
while (current) {
|
||||
next = current->next;
|
||||
if (compare(current->data, element)) {
|
||||
DEL_LLIST_ELEMENT(current, l);
|
||||
break;
|
||||
}
|
||||
current = current->next;
|
||||
current = next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +115,8 @@ ZEND_API void zend_llist_destroy(zend_llist *l)
|
||||
pefree(current, l->persistent);
|
||||
current = next;
|
||||
}
|
||||
|
||||
l->count = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,17 +127,27 @@ ZEND_API void zend_llist_clean(zend_llist *l)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_llist_remove_tail(zend_llist *l)
|
||||
ZEND_API void *zend_llist_remove_tail(zend_llist *l)
|
||||
{
|
||||
zend_llist_element *old_tail;
|
||||
void *data;
|
||||
|
||||
if ((old_tail = l->tail)) {
|
||||
if (l->tail->prev) {
|
||||
l->tail->prev->next = NULL;
|
||||
}
|
||||
|
||||
data = old_tail->data;
|
||||
|
||||
l->tail = l->tail->prev;
|
||||
pefree(old_tail, l->persistent);
|
||||
|
||||
--l->count;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -167,22 +188,18 @@ ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func)
|
||||
ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC)
|
||||
{
|
||||
int list_size=0, i;
|
||||
size_t i;
|
||||
|
||||
zend_llist_element **elements;
|
||||
zend_llist_element *element, **ptr;
|
||||
|
||||
for (element=l->head; element; element=element->next) {
|
||||
list_size++;
|
||||
}
|
||||
|
||||
if (list_size == 0) {
|
||||
if (l->count <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
elements = (zend_llist_element **) emalloc(list_size*sizeof(zend_llist_element *));
|
||||
elements = (zend_llist_element **) emalloc(l->count * sizeof(zend_llist_element *));
|
||||
|
||||
ptr = &elements[0];
|
||||
|
||||
@@ -190,12 +207,12 @@ ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func)
|
||||
*ptr++ = element;
|
||||
}
|
||||
|
||||
qsort(elements, list_size, sizeof(zend_llist_element *), (int (*)(const void *, const void *)) comp_func);
|
||||
zend_qsort(elements, l->count, sizeof(zend_llist_element *), (compare_func_t) comp_func TSRMLS_CC);
|
||||
|
||||
l->head = elements[0];
|
||||
elements[0]->prev = NULL;
|
||||
|
||||
for (i=1; i<list_size; i++) {
|
||||
for (i = 1; i < l->count; i++) {
|
||||
elements[i]->prev = elements[i-1];
|
||||
elements[i-1]->next = elements[i];
|
||||
}
|
||||
@@ -230,13 +247,7 @@ ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_ar
|
||||
|
||||
ZEND_API int zend_llist_count(zend_llist *l)
|
||||
{
|
||||
zend_llist_element *element;
|
||||
int element_count=0;
|
||||
|
||||
for (element=l->head; element; element=element->next) {
|
||||
element_count++;
|
||||
}
|
||||
return element_count;
|
||||
return l->count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+6
-5
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -30,7 +30,7 @@ typedef struct _zend_llist_element {
|
||||
} zend_llist_element;
|
||||
|
||||
typedef void (*llist_dtor_func_t)(void *);
|
||||
typedef int (*llist_compare_func_t)(const zend_llist_element *, const zend_llist_element *);
|
||||
typedef int (*llist_compare_func_t)(const zend_llist_element *, const zend_llist_element * TSRMLS_DC);
|
||||
typedef void (*llist_apply_with_args_func_t)(void *data, int num_args, va_list args TSRMLS_DC);
|
||||
typedef void (*llist_apply_with_arg_func_t)(void *data, void *arg TSRMLS_DC);
|
||||
typedef void (*llist_apply_func_t)(void * TSRMLS_DC);
|
||||
@@ -38,6 +38,7 @@ typedef void (*llist_apply_func_t)(void * TSRMLS_DC);
|
||||
typedef struct _zend_llist {
|
||||
zend_llist_element *head;
|
||||
zend_llist_element *tail;
|
||||
size_t count;
|
||||
size_t size;
|
||||
llist_dtor_func_t dtor;
|
||||
unsigned char persistent;
|
||||
@@ -53,14 +54,14 @@ ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element);
|
||||
ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2));
|
||||
ZEND_API void zend_llist_destroy(zend_llist *l);
|
||||
ZEND_API void zend_llist_clean(zend_llist *l);
|
||||
ZEND_API void zend_llist_remove_tail(zend_llist *l);
|
||||
ZEND_API void *zend_llist_remove_tail(zend_llist *l);
|
||||
ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src);
|
||||
ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC);
|
||||
ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data));
|
||||
ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC);
|
||||
ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...);
|
||||
ZEND_API int zend_llist_count(zend_llist *l);
|
||||
ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func);
|
||||
ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC);
|
||||
|
||||
/* traversal */
|
||||
ZEND_API void *zend_llist_get_first_ex(zend_llist *l, zend_llist_position *pos);
|
||||
|
||||
+13
-7
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -36,24 +36,32 @@ ZEND_API extern unsigned char first_arg_force_ref[];
|
||||
ZEND_API extern unsigned char second_arg_force_ref[];
|
||||
ZEND_API extern unsigned char third_arg_force_ref[];
|
||||
|
||||
#define ZEND_MODULE_API_NO 20001222
|
||||
#define ZEND_MODULE_API_NO 20010927
|
||||
#ifdef ZTS
|
||||
#define USING_ZTS 1
|
||||
#else
|
||||
#define USING_ZTS 0
|
||||
#endif
|
||||
|
||||
#define STANDARD_MODULE_PROPERTIES_EX 0, 0, 0, NULL, 0, ZEND_DEBUG, USING_ZTS, ZEND_MODULE_API_NO
|
||||
#define STANDARD_MODULE_HEADER sizeof(zend_module_entry), ZEND_MODULE_API_NO, ZEND_DEBUG, USING_ZTS
|
||||
|
||||
#define STANDARD_MODULE_PROPERTIES_EX 0, 0, 0, NULL, 0
|
||||
|
||||
#define STANDARD_MODULE_PROPERTIES \
|
||||
NULL, NULL, STANDARD_MODULE_PROPERTIES_EX
|
||||
|
||||
#define NO_VERSION_YET NULL
|
||||
|
||||
#define MODULE_PERSISTENT 1
|
||||
#define MODULE_TEMPORARY 2
|
||||
|
||||
typedef struct _zend_module_entry zend_module_entry;
|
||||
|
||||
struct _zend_module_entry {
|
||||
unsigned short size;
|
||||
unsigned int zend_api;
|
||||
unsigned char zend_debug;
|
||||
unsigned char zts;
|
||||
char *name;
|
||||
zend_function_entry *functions;
|
||||
int (*module_startup_func)(INIT_FUNC_ARGS);
|
||||
@@ -61,6 +69,7 @@ struct _zend_module_entry {
|
||||
int (*request_startup_func)(INIT_FUNC_ARGS);
|
||||
int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS);
|
||||
void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS);
|
||||
char *version;
|
||||
int (*global_startup_func)(void);
|
||||
int (*global_shutdown_func)(void);
|
||||
int globals_id;
|
||||
@@ -68,9 +77,6 @@ struct _zend_module_entry {
|
||||
unsigned char type;
|
||||
void *handle;
|
||||
int module_number;
|
||||
unsigned char zend_debug;
|
||||
unsigned char zts;
|
||||
unsigned int zend_api;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+24
-2
@@ -9,7 +9,8 @@ static zend_object_handlers zoh = {
|
||||
NULL,
|
||||
zend_objects_add_ref,
|
||||
zend_objects_del_ref,
|
||||
zend_objects_delete_obj
|
||||
zend_objects_delete_obj,
|
||||
zend_objects_clone_obj
|
||||
};
|
||||
|
||||
void zend_objects_init(zend_objects *objects, zend_uint init_size)
|
||||
@@ -50,7 +51,7 @@ zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class
|
||||
(*object)->ce = class_type;
|
||||
|
||||
retval.handle = handle;
|
||||
retval.handlers = zoh;
|
||||
retval.handlers = &zoh;
|
||||
#if ZEND_DEBUG_OBJECTS
|
||||
fprintf(stderr, "Allocated object id #%d\n", handle);
|
||||
#endif
|
||||
@@ -125,3 +126,24 @@ void zend_objects_del_ref(zend_object_handle handle)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
zend_object_value zend_objects_clone_obj(zend_object_handle handle)
|
||||
{
|
||||
zend_object_value retval;
|
||||
zend_object *old_object;
|
||||
zend_object *new_object;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (!EG(objects).object_buckets[handle].valid) {
|
||||
zend_error(E_ERROR, "Trying to clone invalid object");
|
||||
}
|
||||
|
||||
old_object = &EG(objects).object_buckets[handle].bucket.obj.object;
|
||||
retval = zend_objects_new(&new_object, old_object->ce);
|
||||
ALLOC_HASHTABLE(new_object->properties);
|
||||
zend_hash_init(new_object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref, (void *) NULL /* Not used anymore */, sizeof(zval *));
|
||||
|
||||
return retval;
|
||||
}
|
||||
+2
-1
@@ -30,5 +30,6 @@ zend_object *zend_objects_get_address(zend_object_handle handle);
|
||||
void zend_objects_add_ref(zend_object_handle handle);
|
||||
void zend_objects_del_ref(zend_object_handle handle);
|
||||
void zend_objects_delete_obj(zend_object_handle handle);
|
||||
zend_object_value zend_objects_clone_obj(zend_object_handle handle);
|
||||
|
||||
#endif /* ZEND_OBJECTS_H */
|
||||
#endif /* ZEND_OBJECTS_H */
|
||||
+10
-2
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -117,12 +117,20 @@ ZEND_API void destroy_zend_class(zend_class_entry *ce)
|
||||
efree(ce->refcount);
|
||||
zend_hash_destroy(&ce->function_table);
|
||||
zend_hash_destroy(&ce->default_properties);
|
||||
zend_hash_destroy(ce->static_members);
|
||||
efree(ce->static_members);
|
||||
zend_hash_destroy(&ce->constants_table);
|
||||
zend_hash_destroy(&ce->class_table);
|
||||
break;
|
||||
case ZEND_INTERNAL_CLASS:
|
||||
free(ce->name);
|
||||
free(ce->refcount);
|
||||
zend_hash_destroy(&ce->function_table);
|
||||
zend_hash_destroy(&ce->default_properties);
|
||||
zend_hash_destroy(ce->static_members);
|
||||
free(ce->static_members);
|
||||
zend_hash_destroy(&ce->constants_table);
|
||||
zend_hash_destroy(&ce->class_table);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+42
-9
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -514,10 +514,19 @@ ZEND_API void convert_to_array(zval *op)
|
||||
case IS_ARRAY:
|
||||
return;
|
||||
break;
|
||||
/* OBJECTS_FIXME */
|
||||
/* OBJECTS_OPTIMIZE */
|
||||
case IS_OBJECT:
|
||||
op->type = IS_ARRAY;
|
||||
op->value.ht = Z_OBJPROP_P(op);
|
||||
{
|
||||
zval *tmp;
|
||||
HashTable *ht;
|
||||
|
||||
ALLOC_HASHTABLE(ht);
|
||||
zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_copy(ht, Z_OBJPROP_P(op), (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
zval_dtor(op);
|
||||
op->type = IS_ARRAY;
|
||||
op->value.ht = ht;
|
||||
}
|
||||
return;
|
||||
case IS_NULL:
|
||||
ALLOC_HASHTABLE(op->value.ht);
|
||||
@@ -1005,7 +1014,11 @@ ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2)
|
||||
ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2)
|
||||
{
|
||||
int length = op1->value.str.len + op2->value.str.len;
|
||||
result->value.str.val = (char *) erealloc(op1->value.str.val, length+1);
|
||||
if (op1->value.str.val == empty_string) {
|
||||
result->value.str.val = (char *) emalloc(length+1);
|
||||
} else {
|
||||
result->value.str.val = (char *) erealloc(op1->value.str.val, length+1);
|
||||
}
|
||||
memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len);
|
||||
result->value.str.val[length] = 0;
|
||||
result->value.str.len = length;
|
||||
@@ -1240,7 +1253,6 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
}
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
/* OBJECTS_FIXME */
|
||||
if (Z_OBJCE_P(op1) != Z_OBJCE_P(op2)) {
|
||||
result->value.lval = 0;
|
||||
} else {
|
||||
@@ -1442,7 +1454,13 @@ ZEND_API int increment_function(zval *op1)
|
||||
{
|
||||
switch (op1->type) {
|
||||
case IS_LONG:
|
||||
if(op1->value.lval == LONG_MAX) {
|
||||
/* switch to double */
|
||||
double d = (double)op1->value.lval;
|
||||
ZVAL_DOUBLE(op1, d+1);
|
||||
} else {
|
||||
op1->value.lval++;
|
||||
}
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
op1->value.dval = op1->value.dval + 1;
|
||||
@@ -1458,8 +1476,14 @@ ZEND_API int increment_function(zval *op1)
|
||||
|
||||
switch (is_numeric_string(strval, op1->value.str.len, &lval, &dval, 0)) {
|
||||
case IS_LONG:
|
||||
if(lval == LONG_MAX) {
|
||||
/* switch to double */
|
||||
double d = (double)lval;
|
||||
ZVAL_DOUBLE(op1, d+1);
|
||||
} else {
|
||||
op1->value.lval = lval+1;
|
||||
op1->type = IS_LONG;
|
||||
}
|
||||
efree(strval);
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
@@ -1491,21 +1515,31 @@ ZEND_API int decrement_function(zval *op1)
|
||||
|
||||
switch (op1->type) {
|
||||
case IS_LONG:
|
||||
if(op1->value.lval == LONG_MIN) {
|
||||
double d = (double)op1->value.lval;
|
||||
ZVAL_DOUBLE(op1, d-1);
|
||||
} else {
|
||||
op1->value.lval--;
|
||||
}
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
op1->value.dval = op1->value.dval - 1;
|
||||
break;
|
||||
case IS_STRING: /* Like perl we only support string increment */
|
||||
if (op1->value.str.len==0) { /* consider as 0 */
|
||||
if (op1->value.str.len == 0) { /* consider as 0 */
|
||||
STR_FREE(op1->value.str.val);
|
||||
op1->value.lval = -1;
|
||||
op1->type = IS_LONG;
|
||||
break;
|
||||
} else if (is_numeric_string(op1->value.str.val, op1->value.str.len, &lval, NULL, 0)==IS_LONG) { /* long */
|
||||
STR_FREE(op1->value.str.val);
|
||||
if(lval == LONG_MIN) {
|
||||
double d = (double)lval;
|
||||
ZVAL_DOUBLE(op1, d-1);
|
||||
} else {
|
||||
op1->value.lval = lval-1;
|
||||
op1->type = IS_LONG;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -1695,7 +1729,6 @@ ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC)
|
||||
|
||||
ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC)
|
||||
{
|
||||
/* OBJECTS_FIXME */
|
||||
if (Z_OBJCE_P(o1) != Z_OBJCE_P(o2)) {
|
||||
result->value.lval = 1; /* Comparing objects of different types is pretty much meaningless */
|
||||
result->type = IS_LONG;
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.92 of the Zend license, |
|
||||
| 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 at through the world-wide-web at |
|
||||
| http://www.zend.com/license/0_92.txt. |
|
||||
| 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. |
|
||||
@@ -232,7 +232,7 @@ ZEND_API int zend_atoi(const char *str, int str_len);
|
||||
#define Z_STRVAL(zval) (zval).value.str.val
|
||||
#define Z_STRLEN(zval) (zval).value.str.len
|
||||
#define Z_ARRVAL(zval) (zval).value.ht
|
||||
#define Z_OBJ(zval) (zval).value.obj.handlers.get_address((zval).value.obj.handle)
|
||||
#define Z_OBJ(zval) (zval).value.obj.handlers->get_address((zval).value.obj.handle)
|
||||
#define Z_OBJPROP(zval) Z_OBJ(zval)->properties
|
||||
#define Z_OBJCE(zval) Z_OBJ(zval)->ce
|
||||
#define Z_RESVAL(zval) (zval).value.lval
|
||||
|
||||
Loaded 100 of 1740 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user