mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-08 09:47:30 +00:00
Compare commits
1011
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2828fec881 | ||
|
|
4bfcb29c46 | ||
|
|
c791d60ad9 | ||
|
|
3516ee485a | ||
|
|
11781bdaa8 | ||
|
|
da536e8a32 | ||
|
|
5d2206d3af | ||
|
|
3d8bd038d2 | ||
|
|
26b123b7f9 | ||
|
|
daa7982110 | ||
|
|
78f8d04e63 | ||
|
|
720d32f581 | ||
|
|
7ceaa82d30 | ||
|
|
1e6c159422 | ||
|
|
9b09f412bf | ||
|
|
a7d6450ea1 | ||
|
|
fd87bb3321 | ||
|
|
1701a9e22f | ||
|
|
9f2e9c5140 | ||
|
|
6c40fa15b6 | ||
|
|
4f3f4699ea | ||
|
|
125300b563 | ||
|
|
0487650536 | ||
|
|
6393ab1486 | ||
|
|
53aea140df | ||
|
|
edabed5604 | ||
|
|
37d7d08482 | ||
|
|
f95edc016b | ||
|
|
65ee58da41 | ||
|
|
4f2dd59e24 | ||
|
|
7ef3076a56 | ||
|
|
4b8a100ec9 | ||
|
|
104de20298 | ||
|
|
96ab2781ab | ||
|
|
6b5f0dde77 | ||
|
|
f81c6b18f4 | ||
|
|
d172a6b581 | ||
|
|
48c3643753 | ||
|
|
2c73cc3b29 | ||
|
|
b56086ae33 | ||
|
|
1a6f498b8c | ||
|
|
7c7fe83615 | ||
|
|
9a1edceb46 | ||
|
|
f09d8b68ab | ||
|
|
2aa4138668 | ||
|
|
1570c5b30e | ||
|
|
f2fe56ff69 | ||
|
|
bbe27ffae9 | ||
|
|
ecc1aa80e7 | ||
|
|
a36fa329a2 | ||
|
|
1207465e59 | ||
|
|
5d10addd01 | ||
|
|
dcf9114329 | ||
|
|
30569aac45 | ||
|
|
3cb1eb0471 | ||
|
|
07e0885519 | ||
|
|
42c586b97c | ||
|
|
33d27f5bfe | ||
|
|
05585132ca | ||
|
|
98037c425d | ||
|
|
b55a6c9185 | ||
|
|
91ec4763fd | ||
|
|
e2f17b298c | ||
|
|
7297f5196e | ||
|
|
2dda8d7f97 | ||
|
|
2639ab7d03 | ||
|
|
41cf3b96db | ||
|
|
698459ea93 | ||
|
|
afeb7704c9 | ||
|
|
01c2701a0f | ||
|
|
eb3d12c6dd | ||
|
|
338405d343 | ||
|
|
ba290e05a8 | ||
|
|
6aefb8bae3 | ||
|
|
3ee8c8f0da | ||
|
|
620d013499 | ||
|
|
e1a84e442e | ||
|
|
447eb3b031 | ||
|
|
2c32cc81dd | ||
|
|
e9e7bc6db3 | ||
|
|
48ffdd79f7 | ||
|
|
739132e58d | ||
|
|
e3246872e3 | ||
|
|
7d0715d53d | ||
|
|
741ca16711 | ||
|
|
a7af382874 | ||
|
|
5aa3eff94f | ||
|
|
d69ec49dc6 | ||
|
|
e1b5df4b55 | ||
|
|
fc478e5935 | ||
|
|
879bfc7a34 | ||
|
|
d49b53b5e1 | ||
|
|
c4bc4871ee | ||
|
|
07d691174b | ||
|
|
bb8046c4a9 | ||
|
|
348b2f0730 | ||
|
|
71ffa09f41 | ||
|
|
88322d2ea0 | ||
|
|
a99ccfc6ef | ||
|
|
c6840056a9 | ||
|
|
15d87d2452 | ||
|
|
6b79bbe842 | ||
|
|
cd0dd562f0 | ||
|
|
ad671669ce | ||
|
|
55b31d5103 | ||
|
|
9bee15a080 | ||
|
|
3bea592273 | ||
|
|
9d0d2e5a69 | ||
|
|
09628fd51e | ||
|
|
4215a17639 | ||
|
|
075146773f | ||
|
|
41308d4b43 | ||
|
|
980c803cd7 | ||
|
|
1b2c932cc2 | ||
|
|
7af5579e3f | ||
|
|
7d77a63342 | ||
|
|
fe0fbdc5b6 | ||
|
|
221c80d26d | ||
|
|
8f51f72dc6 | ||
|
|
bc781c94ed | ||
|
|
c901d4c528 | ||
|
|
ac7768adbf | ||
|
|
736f4831a5 | ||
|
|
f6f0f285cc | ||
|
|
97c496fc9d | ||
|
|
fff675c448 | ||
|
|
46783929a3 | ||
|
|
7c2f1384d4 | ||
|
|
b81789eb1e | ||
|
|
68e32f6ac3 | ||
|
|
24eb90c524 | ||
|
|
ae64b9096e | ||
|
|
0cdb7d6a29 | ||
|
|
2b2bda778e | ||
|
|
4199c6d6a0 | ||
|
|
9c754da0fc | ||
|
|
1b6fae101a | ||
|
|
b0c60bd249 | ||
|
|
d9f6ea2fc3 | ||
|
|
8de073782c | ||
|
|
cd8d7c7c8a | ||
|
|
cb2ab20a11 | ||
|
|
974f278257 | ||
|
|
244cc30c14 | ||
|
|
a30af3e355 | ||
|
|
ecc51ad6de | ||
|
|
1d3b055eba | ||
|
|
a100c51f51 | ||
|
|
e4252b8092 | ||
|
|
830be36b56 | ||
|
|
58cb2362c6 | ||
|
|
9dd45ec800 | ||
|
|
270be258d3 | ||
|
|
63a48afcd5 | ||
|
|
028cf1a368 | ||
|
|
76bef75836 | ||
|
|
84aa8cce64 | ||
|
|
33f30aee64 | ||
|
|
2c2e4c463f | ||
|
|
8bf949b5d6 | ||
|
|
beceb905cd | ||
|
|
083b2df569 | ||
|
|
6d0fa9bdae | ||
|
|
00238ad1ba | ||
|
|
b291b0902d | ||
|
|
6c856de82d | ||
|
|
6cdea551cc | ||
|
|
64ed8f7141 | ||
|
|
78d420e9fe | ||
|
|
f110b97975 | ||
|
|
c927593c6d | ||
|
|
d3e8858413 | ||
|
|
5bae591f88 | ||
|
|
de1acfe33a | ||
|
|
3ccb07f34b | ||
|
|
84656f113e | ||
|
|
f5bfd16b0b | ||
|
|
c640f3d8c8 | ||
|
|
7ae27b5bcd | ||
|
|
64dae03eea | ||
|
|
a5a07063d2 | ||
|
|
925d48dae6 | ||
|
|
dc7cffcd43 | ||
|
|
d9f52fe0a7 | ||
|
|
57323801f8 | ||
|
|
e6fadabf43 | ||
|
|
56402ec375 | ||
|
|
f857a77e2f | ||
|
|
9a910ed353 | ||
|
|
7ac7537776 | ||
|
|
0de0ad6348 | ||
|
|
f78caff762 | ||
|
|
b33d0fd7e7 | ||
|
|
3843821d11 | ||
|
|
adbf932744 | ||
|
|
f9b0f60098 | ||
|
|
57f0f15b9f | ||
|
|
968d6d9f8d | ||
|
|
2ab934bfc2 | ||
|
|
8c63ef0605 | ||
|
|
4c285ecdf5 | ||
|
|
575d8541db | ||
|
|
58bb4adae1 | ||
|
|
63f7648fdc | ||
|
|
a7e3a952e7 | ||
|
|
dbe9e99213 | ||
|
|
76cf93994c | ||
|
|
6b82192bf7 | ||
|
|
72f675be50 | ||
|
|
3ff606a934 | ||
|
|
acb9cae36d | ||
|
|
2d1b6f0801 | ||
|
|
f8fdee1c66 | ||
|
|
07e30106b9 | ||
|
|
bf8c6dbd99 | ||
|
|
e0e331967f | ||
|
|
ea28db8625 | ||
|
|
40de81a5d9 | ||
|
|
a04521b4f2 | ||
|
|
ced8e51328 | ||
|
|
b64eaf737b | ||
|
|
8d1de13aef | ||
|
|
e78fc33c35 | ||
|
|
5fdd45695b | ||
|
|
2bc33cbba1 | ||
|
|
851ee7b598 | ||
|
|
c1853b5628 | ||
|
|
e19abb96dd | ||
|
|
8a9d0fa9eb | ||
|
|
353a2d38d8 | ||
|
|
a064237fc0 | ||
|
|
d1b1e3513f | ||
|
|
951f65f6ed | ||
|
|
afb16a5818 | ||
|
|
18579a5f64 | ||
|
|
e3daad2d67 | ||
|
|
99a2aa0f80 | ||
|
|
3b7d588f40 | ||
|
|
e5cfc70f7d | ||
|
|
715dc6b23a | ||
|
|
3335c8ea0d | ||
|
|
4518351648 | ||
|
|
5a3e983fa4 | ||
|
|
614b4b781e | ||
|
|
fbe571a43a | ||
|
|
cbcf7c66bc | ||
|
|
bc29ceef1b | ||
|
|
101e1f4c0f | ||
|
|
dd14884877 | ||
|
|
fc268e1c7e | ||
|
|
3736b9b7ce | ||
|
|
8a7784d462 | ||
|
|
7af3ce63a6 | ||
|
|
9bb36e9cfe | ||
|
|
a6dc6b88d2 | ||
|
|
3b142d5a3d | ||
|
|
51aa31b671 | ||
|
|
35b3b03fe4 | ||
|
|
af58c35f5c | ||
|
|
8a15917de1 | ||
|
|
a316ff791c | ||
|
|
459ed2b1ad | ||
|
|
7201cdac96 | ||
|
|
538e1cd230 | ||
|
|
bd07cce770 | ||
|
|
36cf6cf22a | ||
|
|
68b0f0b418 | ||
|
|
1671424a5f | ||
|
|
064a4ea88a | ||
|
|
e20424e45f | ||
|
|
a6a09f7e98 | ||
|
|
916f2f2927 | ||
|
|
58a6d48014 | ||
|
|
dc09865f4a | ||
|
|
f17bbb9014 | ||
|
|
4e6c2b468c | ||
|
|
2c91f1d91b | ||
|
|
d66fad5fcd | ||
|
|
e7e2af5d78 | ||
|
|
b5b1117760 | ||
|
|
c5724cbd14 | ||
|
|
42736999bc | ||
|
|
91d7ba7610 | ||
|
|
da648c0fb1 | ||
|
|
2a39219142 | ||
|
|
30c131c8ae | ||
|
|
4ea29a808d | ||
|
|
f5ffc630aa | ||
|
|
68de8a2842 | ||
|
|
527a7429bc | ||
|
|
eaebc48e5e | ||
|
|
1db7f1a910 | ||
|
|
2a43afd2ce | ||
|
|
5fc8562b5d | ||
|
|
582f6d032e | ||
|
|
895cab2838 | ||
|
|
138dd94c8d | ||
|
|
b7fe07d8dc | ||
|
|
e883283590 | ||
|
|
75f62dc415 | ||
|
|
762158aa65 | ||
|
|
2beb929311 | ||
|
|
0fa438a22a | ||
|
|
549dfc78e2 | ||
|
|
db2594ff13 | ||
|
|
3e6bce59b3 | ||
|
|
fec59d3b4d | ||
|
|
d22cbad17d | ||
|
|
ce6faf02f6 | ||
|
|
05e4d7bb33 | ||
|
|
078c3ce198 | ||
|
|
f03ad4c7d6 | ||
|
|
8f29babc8e | ||
|
|
fa7605f289 | ||
|
|
2b2b3147de | ||
|
|
4dc22e32b6 | ||
|
|
fa764cb027 | ||
|
|
be66f224b0 | ||
|
|
c37ceccb54 | ||
|
|
fdce4ae1da | ||
|
|
81b5402a16 | ||
|
|
f40a16bac9 | ||
|
|
9b85ba490e | ||
|
|
d4fb7d9e37 | ||
|
|
5a288ffdc8 | ||
|
|
a80609c773 | ||
|
|
f0febf044f | ||
|
|
3b037ebbe9 | ||
|
|
44947bf563 | ||
|
|
fb7a4b6486 | ||
|
|
dc933fc50b | ||
|
|
909590ba7b | ||
|
|
cccd2445ee | ||
|
|
82563bde60 | ||
|
|
03d33b2f88 | ||
|
|
6fcf8aa12c | ||
|
|
0fadd053fa | ||
|
|
c43c235427 | ||
|
|
2a6da7814c | ||
|
|
6ec1acbe32 | ||
|
|
5f62c347c7 | ||
|
|
3a9cb0220c | ||
|
|
81d901b14d | ||
|
|
db1e0bc820 | ||
|
|
cdce334c56 | ||
|
|
cc26d0e609 | ||
|
|
6abe9c34d9 | ||
|
|
81f5522210 | ||
|
|
743935ca8e | ||
|
|
cef4df1fee | ||
|
|
cb2a2ea9d3 | ||
|
|
1a33277e3d | ||
|
|
d894cf44d8 | ||
|
|
ff9407b56b | ||
|
|
e88d121be1 | ||
|
|
fdc1b9262d | ||
|
|
da155aae1c | ||
|
|
5baaa716dc | ||
|
|
8ee9fd5768 | ||
|
|
52308cd368 | ||
|
|
7aa981f5b7 | ||
|
|
f6164dbf3a | ||
|
|
0e3f5a69f7 | ||
|
|
8788f30c12 | ||
|
|
ad0076ee53 | ||
|
|
e9cb3539ad | ||
|
|
cab8290b8e | ||
|
|
eb5c6da5a4 | ||
|
|
d189972737 | ||
|
|
745c5efc37 | ||
|
|
dbb24c2e0e | ||
|
|
6132bc3111 | ||
|
|
377d7d599d | ||
|
|
6dd7254b39 | ||
|
|
c2b8a4667b | ||
|
|
012e1abb4f | ||
|
|
c56116029d | ||
|
|
d6169276dd | ||
|
|
9fbbc53008 | ||
|
|
daca96353e | ||
|
|
baa75917c8 | ||
|
|
a010baa18d | ||
|
|
063051d6ac | ||
|
|
22ba66b7f6 | ||
|
|
6f3b0f799b | ||
|
|
7bbd454143 | ||
|
|
e0fff74d41 | ||
|
|
e08182156e | ||
|
|
8b51ad8157 | ||
|
|
081da5006e | ||
|
|
2f92fc0326 | ||
|
|
73b9beff19 | ||
|
|
eef062572a | ||
|
|
aa485e9161 | ||
|
|
72aa9e2e2b | ||
|
|
2a44f45cbe | ||
|
|
45386d8af4 | ||
|
|
d00b516f84 | ||
|
|
c42305c54e | ||
|
|
9ece796086 | ||
|
|
900850497d | ||
|
|
03e16899bc | ||
|
|
2d185cc7e2 | ||
|
|
973f679df0 | ||
|
|
fe4efa91c3 | ||
|
|
2e690ac4b5 | ||
|
|
2397e5d419 | ||
|
|
1f02914005 | ||
|
|
49d98c5a3f | ||
|
|
258d427647 | ||
|
|
3e5f7a806f | ||
|
|
88ed2002da | ||
|
|
d5fc465a67 | ||
|
|
6a2b28ba51 | ||
|
|
335078b4fd | ||
|
|
a6aacfd2b6 | ||
|
|
17f725d21a | ||
|
|
26a7fe78f2 | ||
|
|
db400222ff | ||
|
|
650986c8d1 | ||
|
|
bd031b0422 | ||
|
|
30e80d1a8c | ||
|
|
8ba3889572 | ||
|
|
e205a6749d | ||
|
|
d819da4897 | ||
|
|
fa7cba7d5d | ||
|
|
adde17749b | ||
|
|
3b36670df1 | ||
|
|
aa4e00b33c | ||
|
|
d1169e735e | ||
|
|
d4f24f19ad | ||
|
|
320541430b | ||
|
|
36416f1109 | ||
|
|
98b6ddda90 | ||
|
|
6ec7163796 | ||
|
|
f3ef2ff1d0 | ||
|
|
d41af4b7eb | ||
|
|
18962f1993 | ||
|
|
c471c77c58 | ||
|
|
df86725019 | ||
|
|
226f75e0f3 | ||
|
|
acddd0f13c | ||
|
|
3eac45ea80 | ||
|
|
31c8ec4c80 | ||
|
|
5fa6882567 | ||
|
|
8139b776e9 | ||
|
|
bc50e68a1b | ||
|
|
7f8e11d6d3 | ||
|
|
2b8c85bd0b | ||
|
|
8052667684 | ||
|
|
af56b0f936 | ||
|
|
43a466a076 | ||
|
|
2b97cb1f88 | ||
|
|
c3151f742b | ||
|
|
943a911485 | ||
|
|
d035af4af1 | ||
|
|
138d601ab1 | ||
|
|
bb190f8565 | ||
|
|
8def18813f | ||
|
|
57882d58e1 | ||
|
|
63a845f2f6 | ||
|
|
f88464ee6d | ||
|
|
cd74a455dd | ||
|
|
62fc2f5f7f | ||
|
|
d92c591514 | ||
|
|
467523bac5 | ||
|
|
2ca5404046 | ||
|
|
5d62d88ece | ||
|
|
14463b1ba8 | ||
|
|
a22d6b980e | ||
|
|
27f1799b68 | ||
|
|
117a2fba07 | ||
|
|
5d4579a1f4 | ||
|
|
80f1ce5eed | ||
|
|
8eec7a022f | ||
|
|
8c4411b5da | ||
|
|
f86fb810a0 | ||
|
|
336392ea6c | ||
|
|
7719f86292 | ||
|
|
bdbdaa4369 | ||
|
|
215a88ade1 | ||
|
|
a916379c21 | ||
|
|
96bfbc7904 | ||
|
|
c50cd2df99 | ||
|
|
4bf413e358 | ||
|
|
be14ccadf1 | ||
|
|
8c43c5f708 | ||
|
|
0d560de1b7 | ||
|
|
9f106c61ec | ||
|
|
d6595d628c | ||
|
|
d47d83511a | ||
|
|
54d210427a | ||
|
|
f8bac0f8ad | ||
|
|
6b16188db0 | ||
|
|
4b062fdfec | ||
|
|
963a004481 | ||
|
|
99fd17df63 | ||
|
|
da9faa2c3a | ||
|
|
1798a0183a | ||
|
|
c1f75b6fda | ||
|
|
83de88e90c | ||
|
|
2bb01b6f81 | ||
|
|
3b1843bc9f | ||
|
|
f6ad4b09c1 | ||
|
|
f7072fbf87 | ||
|
|
2fb5e56123 | ||
|
|
95c9e3014a | ||
|
|
b331ead5bf | ||
|
|
3d45dd58b8 | ||
|
|
b484f40c31 | ||
|
|
a3464b7c11 | ||
|
|
7ed4923441 | ||
|
|
835b0d8823 | ||
|
|
2a64925a67 | ||
|
|
e5da9fc10a | ||
|
|
f3d179ff99 | ||
|
|
230846f6dd | ||
|
|
04b2c1d422 | ||
|
|
fd4650b540 | ||
|
|
4b023c157a | ||
|
|
bc1e4a5a10 | ||
|
|
d8a9548cb2 | ||
|
|
b886985d63 | ||
|
|
34b3dc9b47 | ||
|
|
82806ea254 | ||
|
|
e9b28fe29c | ||
|
|
f5dbfbae84 | ||
|
|
ed97964fbe | ||
|
|
c329da5d25 | ||
|
|
c5fd7244dd | ||
|
|
5b0ae2dff3 | ||
|
|
605756de7f | ||
|
|
d5dc2cd22c | ||
|
|
a821a185e4 | ||
|
|
2f79ba1abf | ||
|
|
19a2a02f8e | ||
|
|
f830cf7d15 | ||
|
|
f8f8defb42 | ||
|
|
2db1d61718 | ||
|
|
421414df03 | ||
|
|
ed06a70f7f | ||
|
|
a1b42e3f5e | ||
|
|
89f139d3b0 | ||
|
|
bbce669cea | ||
|
|
8b2fe60467 | ||
|
|
e49aafcf57 | ||
|
|
e586468a4e | ||
|
|
92f986787b | ||
|
|
dbfeaabb16 | ||
|
|
c7a606c4a3 | ||
|
|
1b4b5c4a88 | ||
|
|
1ecca4b8e8 | ||
|
|
cf757f7c89 | ||
|
|
b6315d1c9b | ||
|
|
9108abc287 | ||
|
|
3cad348509 | ||
|
|
a3a60dd4e7 | ||
|
|
66a48f2131 | ||
|
|
1225d0307b | ||
|
|
0f99eeb29f | ||
|
|
aea7498779 | ||
|
|
c4b7426ec1 | ||
|
|
d57ffd3646 | ||
|
|
250d803c31 | ||
|
|
4ea6d477ec | ||
|
|
63f2cc9fe9 | ||
|
|
52ec64359c | ||
|
|
f153896de5 | ||
|
|
5f12a05aa3 | ||
|
|
aba3ea97cd | ||
|
|
88029643d0 | ||
|
|
31da7331fe | ||
|
|
577340bb9f | ||
|
|
cf4a2c3bfc | ||
|
|
b5dd397459 | ||
|
|
f78d4f1a56 | ||
|
|
a88b37788e | ||
|
|
70dc46892a | ||
|
|
9c970e1910 | ||
|
|
e058cccfc1 | ||
|
|
bcc1337d8c | ||
|
|
274f3aa727 | ||
|
|
33507acca5 | ||
|
|
03d2a11e27 | ||
|
|
6ebb2c80e0 | ||
|
|
941bdd57a3 | ||
|
|
e9c646e7dd | ||
|
|
873763473f | ||
|
|
52463124be | ||
|
|
b219d491b9 | ||
|
|
b7ee45e13c | ||
|
|
7068d4a201 | ||
|
|
24a21ca2e1 | ||
|
|
c1dc4efc3b | ||
|
|
0eb1498fa8 | ||
|
|
dfce358a5b | ||
|
|
7401ef12fb | ||
|
|
3fe94e5b37 | ||
|
|
62a9f2137c | ||
|
|
cd789db6f2 | ||
|
|
741b816136 | ||
|
|
7a167cd0c1 | ||
|
|
f1f4e6f478 | ||
|
|
a5138d2724 | ||
|
|
e10e4dbe10 | ||
|
|
96434e4899 | ||
|
|
83cdc9476d | ||
|
|
3b5972ed4a | ||
|
|
1f985ede74 | ||
|
|
5d0a7599a9 | ||
|
|
16ec4608ac | ||
|
|
36947fc45a | ||
|
|
064a16c7b2 | ||
|
|
66f850e5b7 | ||
|
|
d73c638526 | ||
|
|
ff29e85724 | ||
|
|
0062ae6218 | ||
|
|
033858e13d | ||
|
|
cf58b7ef16 | ||
|
|
6155d91e7a | ||
|
|
4f545f9c6b | ||
|
|
72f6e823f9 | ||
|
|
7b98592282 | ||
|
|
e115fdc6d6 | ||
|
|
cbcd462d46 | ||
|
|
97107dc440 | ||
|
|
0eb500cef5 | ||
|
|
57b22c8b64 | ||
|
|
3165710b77 | ||
|
|
912f17d278 | ||
|
|
ee7032f069 | ||
|
|
84bb91d762 | ||
|
|
05f6cf54f0 | ||
|
|
7b58930456 | ||
|
|
13c3c4012e | ||
|
|
1250c43a39 | ||
|
|
1652802641 | ||
|
|
d62a739cca | ||
|
|
9df57a2263 | ||
|
|
080105f79f | ||
|
|
9b4d71205b | ||
|
|
a08e3925b1 | ||
|
|
87ba08d1d0 | ||
|
|
58a0ae7b35 | ||
|
|
ac94c83867 | ||
|
|
9e862c11ec | ||
|
|
d56ae4f670 | ||
|
|
be8b9778e0 | ||
|
|
9dc0842e58 | ||
|
|
00cb03bd49 | ||
|
|
e3a70c1f04 | ||
|
|
c57c0e9cd5 | ||
|
|
f33c22c055 | ||
|
|
be9dc58cfe | ||
|
|
17bbbf2963 | ||
|
|
b57dc27595 | ||
|
|
4fe8fe715e | ||
|
|
6f06b11679 | ||
|
|
fb407676a2 | ||
|
|
0fe7fe30b5 | ||
|
|
672e38da93 | ||
|
|
286fef1ce4 | ||
|
|
9cb2cf1393 | ||
|
|
59a539f6ad | ||
|
|
27fc61c4dc | ||
|
|
3facf7cb7c | ||
|
|
7eef22472c | ||
|
|
d79292d52b | ||
|
|
0bc950bcd5 | ||
|
|
db6ce2f2a9 | ||
|
|
4e08c66771 | ||
|
|
a37a5e5c4a | ||
|
|
39691bed9e | ||
|
|
5a4c63db53 | ||
|
|
ed8a7dff62 | ||
|
|
d886b84ef4 | ||
|
|
b0bfa458b5 | ||
|
|
d2c16bf5bd | ||
|
|
b9fb0b8e4d | ||
|
|
53f98a66cf | ||
|
|
695b4f4d5e | ||
|
|
1fb61df8a5 | ||
|
|
67296f0704 | ||
|
|
df0906f7c0 | ||
|
|
5eaed486e1 | ||
|
|
0b873a7899 | ||
|
|
52ac2e67c1 | ||
|
|
49b01a4b3d | ||
|
|
cefca57c9c | ||
|
|
97ea66a045 | ||
|
|
853d6c6206 | ||
|
|
89a56a139b | ||
|
|
6c2c3a9587 | ||
|
|
d470b4cfe0 | ||
|
|
a4d20864a6 | ||
|
|
3031862b24 | ||
|
|
dc8d4f89c7 | ||
|
|
f04567b09e | ||
|
|
fbeeb8f29c | ||
|
|
43d93b6533 | ||
|
|
6bc6dacf5c | ||
|
|
e22cce0dda | ||
|
|
0997fcdc2b | ||
|
|
ceeb9b38ba | ||
|
|
702829709c | ||
|
|
9fd708a313 | ||
|
|
473d1d7cf1 | ||
|
|
ba88c0c47c | ||
|
|
24dff20afa | ||
|
|
dc5ed5a3fb | ||
|
|
3e98dc5edc | ||
|
|
0b77132507 | ||
|
|
957616cd2d | ||
|
|
d7ed9c1455 | ||
|
|
74a9ed7b3f | ||
|
|
ea0f19850e | ||
|
|
928e322038 | ||
|
|
8f48b83df4 | ||
|
|
4079f914bd | ||
|
|
14a8e9b6c3 | ||
|
|
60fcac8f2a | ||
|
|
5ba4b3311d | ||
|
|
bfbe86187e | ||
|
|
bc415d5a88 | ||
|
|
91cf2e59c4 | ||
|
|
17a36c37d1 | ||
|
|
a0b94fccbb | ||
|
|
cd901e8586 | ||
|
|
ae6f852cb6 | ||
|
|
ade1117ebd | ||
|
|
324593224d | ||
|
|
2c42111694 | ||
|
|
a793fea1f7 | ||
|
|
c5d8c389a5 | ||
|
|
465c94ce18 | ||
|
|
842b5ee941 | ||
|
|
6f1c611868 | ||
|
|
54fa0e5d16 | ||
|
|
aee864e9d8 | ||
|
|
2740382c2c | ||
|
|
c8b2bf0a1d | ||
|
|
537cc54acd | ||
|
|
9e67cded5e | ||
|
|
95af652d2b | ||
|
|
18742324b3 | ||
|
|
1401cd52fc | ||
|
|
9a66ffbaee | ||
|
|
9a4031ad64 | ||
|
|
a5ab6b9638 | ||
|
|
7071131f81 | ||
|
|
bc004fb062 | ||
|
|
fcaf734f94 | ||
|
|
e6257bc388 | ||
|
|
5dbe924660 | ||
|
|
7e0ee50ed4 | ||
|
|
8baa86ed51 | ||
|
|
064f75fd1b | ||
|
|
5dd7f27f0b | ||
|
|
202135bfac | ||
|
|
0e1f8ed58e | ||
|
|
75bc4593ff | ||
|
|
23917484ad | ||
|
|
91371c4340 | ||
|
|
9dd66bc2ae | ||
|
|
bc3686c14a | ||
|
|
95e2e023fb | ||
|
|
d90ea1a136 | ||
|
|
e22a1a08a5 | ||
|
|
d843632629 | ||
|
|
a877f6d380 | ||
|
|
66476011dd | ||
|
|
1aaf98e54b | ||
|
|
cef5243b64 | ||
|
|
a74b342612 | ||
|
|
8423f8f1d3 | ||
|
|
92905543f1 | ||
|
|
2493f68018 | ||
|
|
1245356128 | ||
|
|
9b56453566 | ||
|
|
7375ca5588 | ||
|
|
48de4ce0dd | ||
|
|
b9d3a80709 | ||
|
|
3cd0af11ee | ||
|
|
0f195a79cd | ||
|
|
c55a67657f | ||
|
|
7c4a08381e | ||
|
|
7942eaf381 | ||
|
|
050cb7cfe3 | ||
|
|
df6134bc42 | ||
|
|
9c51acdc17 | ||
|
|
5c09d8e616 | ||
|
|
1e54412bdc | ||
|
|
8ffbed7d7e | ||
|
|
c62ffa7e01 | ||
|
|
77baa4ebb4 | ||
|
|
12a76342ed | ||
|
|
5ed41f31af | ||
|
|
5883d6c221 | ||
|
|
22d720e00c | ||
|
|
a1a41504c7 | ||
|
|
23a1d3fb91 | ||
|
|
6b890309ef | ||
|
|
7d1ee82d79 | ||
|
|
10710c046d | ||
|
|
4ebb4060f9 | ||
|
|
1db171deb8 | ||
|
|
11fc109ca6 | ||
|
|
c4442ed7c5 | ||
|
|
ac9c0d03e0 | ||
|
|
9cace18e10 | ||
|
|
0704064cdf | ||
|
|
ef7a4db341 | ||
|
|
6955cacb21 | ||
|
|
5974d84bc6 | ||
|
|
a156a47187 | ||
|
|
2d78e4779e | ||
|
|
ecc1dce8f5 | ||
|
|
d558f56ba0 | ||
|
|
4aeb630539 | ||
|
|
3b195581db | ||
|
|
bec518a62d | ||
|
|
8036c5fbf1 | ||
|
|
c09e7de63a | ||
|
|
d0d3316128 | ||
|
|
992e6a429d | ||
|
|
208e81696f | ||
|
|
1ab3e00bc0 | ||
|
|
f6971f17a9 | ||
|
|
125275b084 | ||
|
|
6ecc81c097 | ||
|
|
e06a1ed265 | ||
|
|
3b516557f2 | ||
|
|
8dd4a63366 | ||
|
|
cd07879f2d | ||
|
|
1e9ce9528d | ||
|
|
5a5806e02a | ||
|
|
0818d96c97 | ||
|
|
05d24c6022 | ||
|
|
09946676d2 | ||
|
|
6f7c0edee3 | ||
|
|
f53afa6edd | ||
|
|
b2c5ef42d3 | ||
|
|
bce60f0fe6 | ||
|
|
94cde33459 | ||
|
|
43c9b540d7 | ||
|
|
5be8dd9712 | ||
|
|
f9cdc88471 | ||
|
|
a458b4f6bd | ||
|
|
01575b9d9d | ||
|
|
7440bc50da | ||
|
|
806dfc2a76 | ||
|
|
8a2f6371fe | ||
|
|
1aa2c5c0b4 | ||
|
|
cad2318a54 | ||
|
|
551fe7780b | ||
|
|
327fc20243 | ||
|
|
af3f73f7a3 | ||
|
|
77cdb5f483 | ||
|
|
916692f4ad | ||
|
|
e109756121 | ||
|
|
09d047f8b1 | ||
|
|
2c0ad3ee25 | ||
|
|
2a78f92804 | ||
|
|
ff37732997 | ||
|
|
f582bec9db | ||
|
|
f9f82960d9 | ||
|
|
a297b95c9d | ||
|
|
f67a9bdc52 | ||
|
|
96660d9a8c | ||
|
|
71c71a4732 | ||
|
|
7d013383e9 | ||
|
|
5d75ccdcff | ||
|
|
3789ac7ea0 | ||
|
|
f9d169c812 | ||
|
|
3a3e18728c | ||
|
|
d9144155f5 | ||
|
|
72c2d04d72 | ||
|
|
8335a61d74 | ||
|
|
1ee30e61fc | ||
|
|
942f409292 | ||
|
|
1573412776 | ||
|
|
23280d0a75 | ||
|
|
937270f319 | ||
|
|
7d34d425be | ||
|
|
751709a469 | ||
|
|
065636be85 | ||
|
|
08c6298af9 | ||
|
|
f06cb4deb6 | ||
|
|
2873f446f2 | ||
|
|
7aad231327 | ||
|
|
a9f9ae7920 | ||
|
|
48e350a94d | ||
|
|
dcc16af80c | ||
|
|
a6e4ef3e31 | ||
|
|
9b3c1ca2c3 | ||
|
|
43ed903949 | ||
|
|
52fcaa443b | ||
|
|
763ed6a4fb | ||
|
|
4908dbdf36 | ||
|
|
f8fe0ad29c | ||
|
|
a9d3d0832a | ||
|
|
02f9dc6460 | ||
|
|
9003b9a261 | ||
|
|
bb74a94fa5 | ||
|
|
f68609b50f | ||
|
|
8489ea5414 | ||
|
|
c5af324ec3 | ||
|
|
7a87fcbbda | ||
|
|
37fe04b887 | ||
|
|
b84ce5a06a | ||
|
|
9e4c7bd56c | ||
|
|
54468d2e75 | ||
|
|
b7c30c1bdf | ||
|
|
84e9ea1726 | ||
|
|
b227e385cc | ||
|
|
5033ee7d69 | ||
|
|
9deab4118d | ||
|
|
a2d8219e2c | ||
|
|
edf17b2a8f | ||
|
|
7d9c4da459 | ||
|
|
dd03a7a2f3 | ||
|
|
7dee737fb4 | ||
|
|
aac5a43123 | ||
|
|
269877fdf3 | ||
|
|
6094128afe | ||
|
|
b515f34dd1 | ||
|
|
3912318923 | ||
|
|
1390eadc14 | ||
|
|
1ae9891e7e | ||
|
|
cc5e008b72 | ||
|
|
5e8c322859 | ||
|
|
f432c05c3f | ||
|
|
342c6e0b23 | ||
|
|
2e8fb4e329 | ||
|
|
593e603e4b | ||
|
|
1e2474b18c | ||
|
|
f4f53c850a | ||
|
|
4f7b0a0ccd | ||
|
|
af88aa5474 | ||
|
|
74fb12efd5 | ||
|
|
257de2bade | ||
|
|
2127ede122 | ||
|
|
8cf2d74b76 | ||
|
|
b32b2831d8 | ||
|
|
3d631c4ca0 | ||
|
|
fa76f0c903 | ||
|
|
39f9487ee1 | ||
|
|
76ceb9ad44 | ||
|
|
7c2155c1ad | ||
|
|
e1e2226b92 | ||
|
|
d86ed8207c | ||
|
|
3fcc6511f6 | ||
|
|
533f135987 | ||
|
|
ad9b13eb9e | ||
|
|
1dff49ec83 | ||
|
|
3ca6d6113a | ||
|
|
714f450a00 | ||
|
|
0666083907 | ||
|
|
15be5f0b4a | ||
|
|
39a7f4c306 | ||
|
|
b06c5731fc | ||
|
|
4213b5d6b6 | ||
|
|
483caf3669 | ||
|
|
4869bd3bfc | ||
|
|
3b53a8ad0f | ||
|
|
1c23f75627 | ||
|
|
4b98f345d1 | ||
|
|
bb6dff9c67 | ||
|
|
4472d05025 | ||
|
|
2e9886de3c | ||
|
|
e3d2234b80 | ||
|
|
79f9f0ce88 | ||
|
|
7685b44c4b | ||
|
|
7656c77c38 | ||
|
|
4fd1d5b81b | ||
|
|
d40e88a016 | ||
|
|
e95ebe0453 | ||
|
|
f92db069c3 | ||
|
|
651e232f04 | ||
|
|
906dc43ed7 | ||
|
|
f8ef66d1a4 | ||
|
|
b6f5873260 | ||
|
|
011813cce8 | ||
|
|
763061bbea | ||
|
|
3e58450513 | ||
|
|
5cb576d81a | ||
|
|
2d7b9b038d | ||
|
|
43c0e94ac9 | ||
|
|
0a6e9ddd7f | ||
|
|
3edb99e8ac | ||
|
|
6a97e1662d | ||
|
|
9d8e0db38f | ||
|
|
f2d5ca7482 | ||
|
|
17bdb70823 | ||
|
|
9d1a9331b3 | ||
|
|
a12d0a1c1c | ||
|
|
22335a4ec7 | ||
|
|
893160fcbe | ||
|
|
135da4b4fc | ||
|
|
d0738c2bc3 | ||
|
|
9bc17ac6b2 | ||
|
|
d1d96d04c6 | ||
|
|
18402e05b9 | ||
|
|
882bbf6f45 | ||
|
|
694d94983b | ||
|
|
aceaabceff | ||
|
|
d94f3e22ae | ||
|
|
d9c4871592 | ||
|
|
a6043d3e1e | ||
|
|
573b46022c | ||
|
|
f70a4db647 |
No files matched your search
@@ -0,0 +1,149 @@
|
||||
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.
|
||||
This is an initial version - it'll most probably grow as time passes.
|
||||
|
||||
|
||||
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. _php3_addslashes())
|
||||
|
||||
[5] Use php3_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 functions implementation should be prefixed with
|
||||
"php3_", and followed by a word or an underscore-delimited list of words,
|
||||
in lowercase letters, that describes the function.
|
||||
|
||||
[2] Function names used by user functions implementations should be prefixed
|
||||
with "_php3_", 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'.
|
||||
|
||||
[3] 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++) ...).
|
||||
|
||||
[4] 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 she's 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.
|
||||
|
||||
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 */
|
||||
void php3_abs(INTERNAL_FUNCTION_PARAMETERS) {
|
||||
...
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
The {{{ symbols are the default folding symbols for the folding mode in
|
||||
Emacs. vim will soon have support for folding as well. 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]]])
|
||||
|
||||
And yes, please keep everything on a single line, even if that line is massive.
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
For the list of people who've put work into PHP 4.0, please see
|
||||
http://www.php.net/version4/credits.php
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
PHP 4.0 CHANGE LOG ChangeLog
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
|
||||
August 9 1999, Version 4.0 Beta 2
|
||||
- Fixed a problem when sending HTTP/1.x header lines using header() (Zeev)
|
||||
- Win32 builds now include the ODBC module built-in (Zeev)
|
||||
- Fixed SYSV-SHM interface (Thies).
|
||||
- Updated hyperwave module, made it thread safe
|
||||
- Updated pdflib module, version 0.6 of pdflib no longer supported
|
||||
- Updated fdf module
|
||||
- Built-in phpinfo() links are now turned off by default. They can be turned
|
||||
on using the allow_builtin_links INI directive (Zeev)
|
||||
- Changed phpinfo() to list modules that have no info function (Zeev)
|
||||
- Modified array_walk() function so that the userland callback is passed
|
||||
a key and possible user data in addition to the value (Andrey)
|
||||
- Fixed ldap_search(), ldap_read() and ldap_list() (Zeev)
|
||||
- Fixed Apache information in phpinfo() (sam@breakfree.com)
|
||||
- Improved register_shutdown_function() - you may now supply arguments that
|
||||
will be passed to the shutdown function (Zeev)
|
||||
- Improved call_user_func() and call_user_method() - they now support passing
|
||||
arguments by reference (Zeev)
|
||||
- Fixed usort() and uksort() (Zeev)
|
||||
- Fixed md5() in the Apache module (Thies)
|
||||
- Introduced build process for dynamic modules (Stig)
|
||||
- Improved ISAPI module to supprt large server variables (Zeev)
|
||||
- Imported PHP 3.0 fixes for problem with PHP as a dynamic module and Redhat
|
||||
libc2.1 in zlib module (Stefan)
|
||||
- Fixed sybase_fetch_object() (Zeev)
|
||||
- Made the IMAP module work with PHP 4.0 (Zeev)
|
||||
- Fixed a problem with include()/require() of URLs (Sascha, Zeev)
|
||||
- Fixed a bug in implode() that caused it to corrupt its arguments (Zeev)
|
||||
- Added get_class($obj), get_parent_class($obj) and method_exists($obj,"name")
|
||||
(Andi & Zeev)
|
||||
- Fixed various inheritance problems (Andi & Zeev, Zend library)
|
||||
- Children now inherit their parent's constructor, if they do not supply a
|
||||
constructor of their own.
|
||||
- Fixed runtime inheritence of classes (parent methods/properties were
|
||||
overriding their children) (Zeev, Zend library)
|
||||
- Fixed backwards incompatibility with the "new" operator (Andi, Zend library)
|
||||
- Fixed bugs in uksort() and ksort() sort ordering (Andrey)
|
||||
- Fixed a memory leak when using assignment-op operators with lvalue of type
|
||||
string (Zeev, Zend library)
|
||||
- Fixed a problem in inheritence from classes that are defined in include()d
|
||||
files (Zeev, Zend library)
|
||||
- Fixed a problem with the PHP error handler that could result in a crash
|
||||
on certain operating systems (Zeev)
|
||||
- Apache php_flag values only recognized 'On' (case sensitive) - changed
|
||||
to case insensitive (Zeev)
|
||||
- Fixed a memory leak with switch statement containing return statements
|
||||
(Andi & Zeev, Zend library)
|
||||
- Fixed a crash problem in switch statements that had a string offset
|
||||
as a conditional (Andi & Zeev, Zend library)
|
||||
- Imported PHP 3.0 fixes for rand() and mt_rand() (Rasmus)
|
||||
- Added function entries for strip_tags() and similar_text() (Andrey)
|
||||
- Fixed a bug in WDDX that would cause a crash if a number was passed in
|
||||
instead of a variable name (Andrey)
|
||||
- Ported strtotime() function from PHP 3.0 (Andrey)
|
||||
- Merged in gdttf stuff from php3 (Sascha)
|
||||
- buildconf now checks your installation (Stig)
|
||||
- XML module now built dynamically with --with-xml=shared (Stig)
|
||||
- Added a check for freetype.h - fixed build on RedHat 6.0 (Zeev)
|
||||
- Fixed array_walk() to work in PHP 4.0 (Andrey)
|
||||
- Ported all remaining date() format options from PHP 3.0 (Andrey)
|
||||
- $php_errormsg now works (Andrey)
|
||||
- Added locale support for Perl Compatible Regexp functions (Andrey)
|
||||
- Informix module ported (Danny)
|
||||
- Removed --with-shared-apache (Sascha)
|
||||
- Added patch for reverse lookup table in base64_decode (Sascha)
|
||||
Submitted by bfranklin@dct.com
|
||||
- Merged in php3 version of str_replace (Sascha)
|
||||
- Added DBA module (Sascha)
|
||||
- Added session id detection within REQUEST_URI (Sascha)
|
||||
- Merged in HP-UX/ANSI compatibility switch from php3 (Sascha)
|
||||
- Fixed rpath handling for utilitites built during Apache build (Sascha)
|
||||
- Added missing E_ error level constants (Zeev, Zend library)
|
||||
- Fixed a bug in sending multiple HTTP Cookies under Apache (Zeev)
|
||||
- Fixed implicit connect on the MySQL, mSQL, PostgreSQL and Sybase
|
||||
modules (Zeev)
|
||||
- Gave PHP 4.0's SNMP extension all the functionality of PHP 3.0.12 (SteveL)
|
||||
|
||||
|
||||
July 19 1999, Version 4.0 Beta 1
|
||||
- First public beta of PHP 4.0
|
||||
+860
@@ -0,0 +1,860 @@
|
||||
PHP 3.0 CHANGE LOG ChangeLog
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
|
||||
December 24 1998, Version 3.0.6
|
||||
- Fix GetImageSize() to work with non-standard jpg images
|
||||
- Add Mersenne Twister functions (mt_rand, mt_srand, etc)
|
||||
- Add str_replace() function
|
||||
- Add chunk_split() function
|
||||
- Fixed a bug in the memory limit code, in cases where $php_errormsg was
|
||||
also used.
|
||||
- Add iptcparse() function
|
||||
- Adobe FDF supported
|
||||
- getallheaders() NULL string fix <michale@utko.fee.vutbr.cz>
|
||||
- Add all configuration directives to phpinfo() page
|
||||
- Functions pack() and unpack() rewritten to be binary and buffer overrun
|
||||
safe and behave like the Perl functions for all implemented format codes.
|
||||
- Ensured that msql_error() will not return error messages generated by
|
||||
previously-run scripts.
|
||||
- Add base_convert() function
|
||||
- Make sprintf() and printf() output binary safe
|
||||
- Made gzgetc binary safe
|
||||
- Add convert_cyr_string() and quoted_printable_decode() functions
|
||||
- Fix ldap_free_result() core dump bug
|
||||
- Add support for current OpenLDAP-2.0-devel library
|
||||
- Add php3_asp_tags directive so it can be set from Apache config files
|
||||
- Added UTF-8 support in the XML extension
|
||||
- Make rand(min,max) safer on older platforms where the low-order bits have
|
||||
short cycles.
|
||||
- Added new pdf (Portable Document Format) module
|
||||
- Added an XML parsing extension using James Clark's "expat" library
|
||||
- Optimized parts of the token cache code.
|
||||
- Terminate on out-of-memory errors. Until now, PHP could crash in out of
|
||||
memory situations (clean-up, no real effect).
|
||||
- Unterminated comments in include files were being reported with the wrong line
|
||||
number. Fixed.
|
||||
- Added ImageCopy() and ImageColorDeallocate(). ImageCopy() is about
|
||||
20% faster than ImageCopyResized(). ImageColorDeallocate() marks
|
||||
palette entries free for reuse (by <mka@satama.com>).
|
||||
- In the CGI version, it was impossible to access resources (e.g. SQL links,
|
||||
images) from user-defined shutdown functions. Fixed.
|
||||
- Added optional third parameter to strpos() to specify the offset to
|
||||
start searching from.
|
||||
- Fixed a crash bug in unset() when unsetting illegal variables (rare).
|
||||
- Made ImageInterlace and ImageTransparentColor parameters optional, and made
|
||||
them return the current/new settings.
|
||||
- Optimized GetImageSize() <thies@digicol.de>.
|
||||
- Made odbc_autocommit() without args return status
|
||||
- Added connect workaround for OpenLink ODBC
|
||||
- Added minimal InterBase support. Tested only on 4.0 & Linux.
|
||||
- Fixed some memory leaks and bogus error messages in the URL handler of
|
||||
the various file open functions. Should only affect error handling
|
||||
in bad URLs.
|
||||
|
||||
October 5 1998 Version 3.0.5
|
||||
- mysql_field_flags now reports all MySQL flags and the result is suitable
|
||||
for automatic parsing. Compatibility warning: The result format has
|
||||
changed. If you have scripts parsing the result of this function, you
|
||||
may need to adapt them.
|
||||
- Made nl2br() binary safe (not that it's of much use).
|
||||
- Fixed a bug in the API function getThis(). It affected mostly the dir
|
||||
functions, if nested within objects.
|
||||
- Fixed a problem in require() in conjunction with switch(), and in some other
|
||||
cases. Also fixed an identical problem with the call_user_function() API
|
||||
function.
|
||||
- Removed -lpthread when compiling with MySQL support. It caused various
|
||||
serious problems when compiled into Apache.
|
||||
- Add serialize() and unserialize() functions from jkl@njet.net
|
||||
- Fix in_addr_t check for systems with in_addr_t in netinet/in.h
|
||||
- Add atan2() function
|
||||
|
||||
September 22 1998 Version 3.0.4
|
||||
- Added uksort() - array key sort using a user defined comparison function.
|
||||
- Added 'j' support to date() - generates the day of the month, without
|
||||
possible leading zeros.
|
||||
- Added support for multiple crypt() encryptions if the system supports it
|
||||
- Added optional support for ASP-style <% %> and <%= tags
|
||||
- Fixed data loss problems with very large numeric array indices on 64-bit
|
||||
platforms (e.g. DEC UNIX).
|
||||
- 2 cursor_type parameters for ifx_query() and ifx_prepare changed
|
||||
to 1 (bitmask). Added a few constants for use in Informix module.
|
||||
- Added php3.ini option ifx.charasvarchar. If set, trailing blanks
|
||||
are stripped from fixed-length char columns. (Makes life easier
|
||||
for people using Informix SE.)
|
||||
- Static SNMP module which compiles with ucd-snmp 3.5.2
|
||||
- fixed imap_header & header_info from crashing when a header line
|
||||
is > 1024 characters.
|
||||
- Added patch for rfc822_parse_adr to return an array of objects instead
|
||||
of a single object.
|
||||
- Informix Online 7.x & SE 7.x support now fairly complete and stable
|
||||
- Add dbase_get_record_with_names() function
|
||||
- Added a special case for open_basedir. When open_basedir is set to "."
|
||||
the directory in which the script is stored will be used as basedir.
|
||||
- Include alloca.c in the distribution for platforms without alloca().
|
||||
- Improved stripping of URL passwords from error messages - the length of the
|
||||
username/password isn't obvious now, and all protocols are handled properly
|
||||
(most importantly, http).
|
||||
- Copying objects that had member functions with static variables produced
|
||||
undetermined results. Fixed.
|
||||
- Added function lstat() and cleaned up the status functions,
|
||||
added tests for file status functions (this may break on some plattforms)
|
||||
- Fixed is_link() - it was returning always false.
|
||||
- Fixed apache_note() - it was corrupting memory.
|
||||
- New Function. void get_meta_tags(string filename); Parses filename until
|
||||
closing head tag and turns all meta tags into variables prefixed with 'meta_'.
|
||||
The below meta tag would produce $meta_test="some string here"
|
||||
<meta name="test" content="some string here">
|
||||
- Generalized some internal functions in order to better support calling
|
||||
user-level functions from C code. Fixes a few sporadic problems related
|
||||
to constructors inside eval() and more.
|
||||
- Fixed an endless loop in explode(), strstr() and strpos() in case of an
|
||||
invalid empty delimiter.
|
||||
- rand() now accepts two optional arguments, which denote the requested range
|
||||
of the generated number. E.g., rand(3,7) would generate a random number
|
||||
between 3 and 7.
|
||||
- Added M_PI constant.
|
||||
- Added deg2rad() and rad2deg() for converting radians<->degrees.
|
||||
- ImageArc() misbehaved when given negative angles, fixed.
|
||||
- Fixed a bug in ereg() that may have caused buglets under some circumstances.
|
||||
- Added imap_status
|
||||
- Shutdown functions, registered via register_shutdown_function(), could never
|
||||
generate output in the Apache module version. Fixed.
|
||||
- Brought IMAP docs into sync with acutal imap code
|
||||
- imap_fetchstructure now takes in optional flags
|
||||
- Fix potential core dumps in imap_append and imap_fetchtext_full
|
||||
- Fix problem in SetCookie() function related to long cookies
|
||||
- Add uasort() function to go along with usort (like sort() and asort())
|
||||
- Add port number to Host header as per section 14.23 of the HTTP 1.1 RFC
|
||||
- Fix imap_reopen to only take 2 arguments with an optional 3rd flags arg
|
||||
- Add optional 2nd argument to imap_close
|
||||
- Add CL_EXPUNGE flag to imap_open() flags
|
||||
- Fix 4th arg on imap_append(). It was getting converted to a long by mistake.
|
||||
- Fix shutdown warning in the LDAP module
|
||||
- *COMPATIBILITY WARNING* imap_fetchstructure() "parametres" object and property
|
||||
name changed to "parameters" to match the documentation and to be consistent
|
||||
with the rest of the API.
|
||||
- Delete uploaded temporary files automatically at the end of a request
|
||||
- Add upload_max_filesize and correponsing php3_upload_max_filesize directive
|
||||
to control the maximum size of an uploaded file. Setting this to 0 would
|
||||
completely eliminate file uploads.
|
||||
- Force $PHP_SELF to PATH_INFO value when running in CGI FORCE_CGI_REDIRECT mode
|
||||
- Add apache_lookup_uri() function which does an internal sub-request lookup
|
||||
and returns an object containing the request_rec fields for the URI. (Yes,
|
||||
you have to be a bit of a gearhead to figure this one out)
|
||||
- Fix a few signed char problems causing functions like ucfirst() not to work
|
||||
correctly with non-English charsets
|
||||
- md5() function not binary safe - fixed
|
||||
|
||||
August 15 1998 Version 3.0.3
|
||||
- Changed the name of fopen_basedir to open_basedir, to be a little more
|
||||
accurate about what it does.
|
||||
- Added Hyperwave module
|
||||
- Added config-option (php3_)enable_dl <on/off>. This enables/disables the
|
||||
dl() function. In safe-mode dl() is always disabled.
|
||||
- Auto-prepended files were crashing under some circumstances - fixed.
|
||||
- Win32 mail fixes provided by walton@nordicdms.com
|
||||
- Comparing between arrays and/or objects now generates a warning (it always
|
||||
returns false, as it used to; no comparison is made)
|
||||
- Fixed a bug in the syntax highlighting code, that made ending-double-quotes
|
||||
appear twice under certain circumstances.
|
||||
- Fix bug in filetype() function related to symlinks
|
||||
- Started integrating Informix SE support to PHP configure/makefile setup.
|
||||
- gdttf roundoff fixes from ellson@lucent.com
|
||||
- Added initial Informix SE support files from Danny Heijl - This code still
|
||||
needs to be integrated into the PHP configure/makefile setup and the code
|
||||
itself needs more work.
|
||||
- return in the global scope now terminates the execution of the current file.
|
||||
- Added the ability to register shutdown function(s), via
|
||||
register_shutdown_function($function_name).
|
||||
- Clean up const warnings
|
||||
- Add write support to ftp fopen wrappers
|
||||
- Add strspn() and strcspn() functions
|
||||
- On systems without strerror use Apache version if compiling as Apache module
|
||||
- The PHP start tag was being ignored under some circumstances - fixed.
|
||||
- The db, dbase and filepro functions are now Safe-Mode aware.
|
||||
- Added config-option (php3_)fopen_basedir <path>. This limits the directory-
|
||||
tree scripts can open files in to <path>.
|
||||
- Fixed pg_loreadall that didn't always return all the contents in a PostgreSQL
|
||||
large object. Also, doesn't pass through anything if method is HEAD.
|
||||
- configure fix to create target Apache module dir
|
||||
- Fix core dump in imageTTFtext() function
|
||||
- Added static IMAP support
|
||||
- Syntax highlighting was generating additional whitespace - fixed.
|
||||
- Added ucwords. Works like ucfirst, but works on all words within a string.
|
||||
- Added array_walk() - apply user function to every element of an array
|
||||
- Added usort() - array sort that accepts a user defined comparison function!
|
||||
- Added the ability to call user-level functions and object methods on demand
|
||||
from the C source using a completely generalized, slick API function.
|
||||
Miracles do happen every once in a while.
|
||||
- Added constructors. Don't even squeek about destructors! :) (we mean that)
|
||||
- Make pg_lowrite() binary safe
|
||||
- Fixed mod_charset option in ./setup
|
||||
- Fixed rewinddir() and dir()::rewind() under Win32 (they didn't work before).
|
||||
- Add Win32 COM support! By-name referencing is supported using the IDispatch
|
||||
interface (automation). Available functions - COM_Load(), COM_Invoke(),
|
||||
COM_PropGet() and COM_PropSet().
|
||||
|
||||
July 20 1998 Version 3.0.2a
|
||||
- Fix a quirk in the configuration file parser, the endless fountain of joy
|
||||
and fun.
|
||||
- Fix a bug in the API function add_method() that made dir() crash.
|
||||
|
||||
July 18 1998 Version 3.0.2
|
||||
- Compile cleanups for *BSD
|
||||
- Add support for the OpenLink ODBC Drivers
|
||||
- Add PHP_SELF, PHP_AUTH_* and HTTP_*_VARS PHP variables to phpinfo() output
|
||||
- Add workaround for broken makes
|
||||
- Add Apache 1.3.1 support (some Apache header files were moved around)
|
||||
- Added apache_note() function.
|
||||
- Fix order of system libraries and detect libresolv correctly
|
||||
- Fixed a bug in the Sybase-DB module. Several numeric field types were
|
||||
getting truncated when having large values.
|
||||
- Added testpages for unified odbc
|
||||
- Fix php -s seg fault when filename was missing
|
||||
- Made getdate() without args default to current time
|
||||
- Added ImageColorResolve() and some fixes to the freetype support.
|
||||
- Added strcasecmp()
|
||||
- Added error_prepend_string and error_append_string .ini and .conf directives
|
||||
to make it possible to configure the look of error messages displayed by PHP
|
||||
to some extent
|
||||
- Added E_ERROR, E_WARNING, E_NOTICE, E_PARSE and E_ALL constants, that can be
|
||||
used in conjunction with error_reporting()
|
||||
(e.g. error_reporting(E_ERROR|E_WARNING|E_NOTICE);
|
||||
- Fixed a crash problem with classes that contained function(s) with default
|
||||
values.
|
||||
- Fixed a problem in the browscap module. Browscap files weren't being read
|
||||
properly.
|
||||
- Fix -L path in libphp4.module to make ApacheSSL compile without errors
|
||||
- Fix StripSlashes so it correctly decodes a \0 to a NUL
|
||||
|
||||
July 04 1998 Version 3.0.1
|
||||
- echo/print of empty strings don't trigger sending the header anymore.
|
||||
- Implemented shift left and shift right operators (<< and >>)
|
||||
- Compile fix for cc on HP-UX.
|
||||
- Look for beta-version Solid libraries as well.
|
||||
- Make GD module show more info in phpinfo().
|
||||
- Compile fix for NextStep 3.0.
|
||||
- Fix for Oracle extension on OSF/1.
|
||||
- Fix gd 1.3 bug in ImageColorAt().
|
||||
- pg_loread() hopefully handles binary data now.
|
||||
- Turned off some warnings in dns.c
|
||||
- Added ImageTTFBBox() and made ImageTTFText() return bounding box.
|
||||
- Added constants for Ora_Bind()'s modes.
|
||||
- Renamed all hash_*() routines to _php3_hash_*() to avoid clashes with other
|
||||
libraries.
|
||||
- Changed uodbc default LONG behaviour: longreadlen 4096 bytes, binmode 1.
|
||||
The module now actually uses the php.ini settings.
|
||||
- New PostgreSQL functions: pg_fetch_row(), pg_fetch_array()
|
||||
and pg_fetch_object()
|
||||
- Fix a segmentation fault when calling invalid functions in certain
|
||||
circumstances
|
||||
- Fix bug that caused link-related functions to not pay attention to
|
||||
run-time safe mode setting (it was using whatever was set at compile time).
|
||||
- Fix bug in exec() function when used in safe mode
|
||||
|
||||
June 6 1998 Version 3.0
|
||||
- Add checkdnsrr function (check availability DNS records)
|
||||
- Add getmxrr function (get MX hostnames and weights)
|
||||
- Fixed bug in nl2br() function
|
||||
- Fix for an RC5 related problem in the Sybase module, when dealing
|
||||
with very long data types.
|
||||
- Speed up string concatenation by roughly a factor of 2
|
||||
- Add escape-handling to date function
|
||||
- Make base64 functions binary safe
|
||||
- Add strrpos function to complement strpos function added in RC5
|
||||
- Add ltrim function (strips only at the start of string)
|
||||
- Add rtrim as an alias to chop() for completeness sake
|
||||
- Add trim function (similar to chop, except it strips at the start as well)
|
||||
- Added 2 optional args to fsockopen function - errno and errstr
|
||||
- Fixed bug in split() function related to leading matches
|
||||
- Fixed problem in error_log() function (thanks to Jan Legenhausen)
|
||||
- empty("0") was returning true - fixed
|
||||
- Removed the old sybsql module. Use the new sybase_*() functions instead.
|
||||
- Several fixes to the configuration file parser
|
||||
- LDAP fixes - fixed return values on several functions
|
||||
|
||||
May 23 1998 Version 3.0RC5
|
||||
- The BC math library functions now compile in by default.
|
||||
- Fixed a bug in virtual() and other types of SSI's (e.g. <!--#exec). Under
|
||||
certain circumstances, this used to result in random problems.
|
||||
- Fixed a bug in virtual(). It was misbehaving if it was called before any
|
||||
other output.
|
||||
- Added mysql.default_port, mysql.default_host, mysql.default_user and
|
||||
mysql.default_password ini-file directives.
|
||||
- Improved handling of the MySQL default port. It now honors /etc/services
|
||||
and $MYSQL_TCP_PORT.
|
||||
- Fixed a crash in opening of broken ftp:// URLs, and improved error reporting
|
||||
in opening of URLs.
|
||||
- Fixed several non-critical scanner issues with syntax highlighting mode and
|
||||
the <script language=php> tag.
|
||||
- Fixed fseek on windows. (windows only): fseek will not return proper results
|
||||
on files opened as text mode. PHP uses binary mode as the default for file
|
||||
operations, but this can be overiden by fopen. Do not open files in text
|
||||
mode and use fseek on them!
|
||||
- Add strpos() function
|
||||
- Added zlib module, requires zlib >= 1.0.9
|
||||
- Improved the module API implementation. Dynamic modules may now register
|
||||
persistent resources (not that it makes much sense, but at least PHP
|
||||
won't crash). The API itself remains unchanged.
|
||||
- bcmod() wasn't always behaving like modulus should behave (it was behaving
|
||||
exactly like GNU bc's % operator). Fixed.
|
||||
- Changed the Sybase-DB module to always return strings, instead of auto-typing
|
||||
result sets. This was done for consistency with the other database modules,
|
||||
and in order to avoid overflows due to the platform-dependant limitations
|
||||
of the numeric data types of PHP. You can turn compatability mode on using
|
||||
the sybase.compatability_mode directive in the php3.ini file.
|
||||
- Fixed problems with the TINYINT field in the Sybase-CT module.
|
||||
- Applied some small speed optimizations to the Sybase-DB module querying code.
|
||||
- Added 'numeric' and 'type' properties to the object returned by
|
||||
sybase_fetch_field().
|
||||
- The 'new' operator doesn't accept all expressions anymore. Instead, it
|
||||
accepts a class name, or a variable reference (scalar, array element, etc).
|
||||
- Add ora_numcols() function
|
||||
- Add ora_do() and ora_fetch_into() functions to Oracle driver
|
||||
- Add persistent connection support to Oracle driver
|
||||
- Make Oracle driver clean up open connections and open cursors automatically
|
||||
- Added fread() and fwrite() that properly handle binary data.
|
||||
- Add Ora_ColumnSize() to Oracle code
|
||||
- The string "0" means FALSE again. This was done in order to maintain type
|
||||
conversion consistency.
|
||||
- Added solid_fetch_prev() for fetching the previous result row from Solid.
|
||||
- Huge integers are now automatically converted to floating point numbers
|
||||
(that have a wider range).
|
||||
- Floating point numbers are now displayed using scientific notation when
|
||||
they're extremely big or extremely small. The 'precision' php3.ini directive
|
||||
no longer designates the number of decimal digits, but rather, the maximum
|
||||
number of significant digits required.
|
||||
- Added support for scientific notation for floating point numbers (e.g. 1E7)
|
||||
throughout the entire language.
|
||||
- Fixed a potential/probable memory corruption problem with HEAD request
|
||||
handling.
|
||||
- Using un-encapsulated strings now generates a NOTICE-level warning
|
||||
(e.g. $a = foo; instead of $a = "foo";)
|
||||
- Added defined("name") function to check if a certain constant is defined
|
||||
or not.
|
||||
- Support new Apache mechanism for setting SERVER_SUBVERSION
|
||||
- Added PHP_OS and PHP_VERSION constants
|
||||
- Added the ability to define constants in runtime! Constants are script-wide,
|
||||
(there's no scope, once the constant is defined, it's valid everywhere).
|
||||
Syntax is define("name", $value [, $case_insensitive]). 'name' can be any name
|
||||
that is a valid variable name, *without* the $ prefix. 'value' can be
|
||||
any *scalar* value. If the optional 'case_insensitive' parameter is 1,
|
||||
then the constant is created case-insensitive (the default is case
|
||||
sensitive). Note: define() is currently *NOT* supported in preprocessed
|
||||
scripts.
|
||||
- Added general support for constants. The Syslog constants (e.g.
|
||||
LOG_ERR, LOG_CRIT, etc.) should be accessed as constants from now on (that
|
||||
is, without a $ prefix). You can still set define_syslog_variables to On
|
||||
in the php3.ini file if you want to define the various $ variables. The
|
||||
default for this directive in the php3.ini-dist file has been changed to
|
||||
Off.
|
||||
- The configuration file path variable now expands . and .. into their
|
||||
respective directories. You can obtain the path of the php3.ini file
|
||||
that was used by printing get_cfg_var("cfg_file_path").
|
||||
- Fixed a crash-recovery parser crash ($a=7; $a[3]+=5;)
|
||||
- Add gmmktime() function
|
||||
- Fixed a crash with implode() and empty arrays.
|
||||
- Fixed a bug that, under fairly rare circumstances, caused PHP not to
|
||||
recognize if(), require() and other statements as statements, and
|
||||
to complain about them as being unsupported functions.
|
||||
- Beautified php3.ini-dist and added more comments to it. Also changed
|
||||
the behavior of the configuration file parser to be brighter about
|
||||
the various constants (TRUE/FALSE/ON/OFF etc).
|
||||
- Fixed a bug in openlog() - the specified device name was being mangled.
|
||||
- Memory leaks were sometimes reported erroneously - fixed.
|
||||
- Improved the convertor to handle some quirks of the PHP/FI 2 parser with
|
||||
comments.
|
||||
- Fixed number_format() to properly handle negative numbers, and optimized it
|
||||
a bit.
|
||||
- Fixed static variables inside class member functions. Note that using such
|
||||
static variables inside member functions usually defeats the purpose of
|
||||
objects, so it is not recommended.
|
||||
- Fixed a bug in fpassthru() (the file was being closed twice).
|
||||
- Added strftime().
|
||||
- Add set_socket_blocking() function to control blocking on socket fd's
|
||||
- The sendmail_path in php3.ini was being ignored - fixed.
|
||||
- Fixed a bug with file upload, with files that contained the MIME boundary
|
||||
inside them.
|
||||
- Fixed a bug with form variables of type array, with spaces in their
|
||||
index (e.g. name="foo[bar bar]").
|
||||
- gd-1.3 autodetect and support
|
||||
- Year 2000 compliance is now togglable from the php3.ini file. Setting PHP
|
||||
to be y2k compliant effects the way it creates cookies, and means it'll
|
||||
NOT work with many browsers out there that are not y2k compliant! For
|
||||
that reason, the default for this option is off.
|
||||
- safe mode / fix from monti@vesatec.com
|
||||
- Integrated the FreeType support in the GD extension.
|
||||
- Added --with-gd=DIR and --without-gd options to configure
|
||||
|
||||
April 18 1998 Version 3.0 Release Candidate 4
|
||||
- Auto-prepended and auto-appended files were reporting the wrong filename
|
||||
in errors and in __FILE__ - fixed.
|
||||
- Fix GPC problem related to mixed scalar and array vars with the same name
|
||||
- Made putenv() Apache-safe. Environment variables may no longer leak in
|
||||
between requests.
|
||||
- The trailing semicolon is no longer required in class declarations.
|
||||
- Fixed a memory leak in the (array) and (object) operators under certain
|
||||
conditions.
|
||||
- <script> tags weren't working unless short tags were enabled - Fixed.
|
||||
- Fixed a bug in certain array indices that weren't treated as numbers
|
||||
even though they looked like numbers (e.g. "10", "20").
|
||||
- Changes to support renamed API functions in Apache-1.3
|
||||
- Fixed the -p and -e command line switches
|
||||
- Fix a segfault when calling command line version without parameters
|
||||
- Fix for feof() when used on a socket
|
||||
- Fix off-by-one error in fgets() when used on a socket
|
||||
- Fix bug in ImageSetPixel() (Thanks to ecain@Phosphor.net)
|
||||
|
||||
March 31 1998 Version 3.0 Release Candidate 3
|
||||
- Tiny bugfix for magic_quotes_sybase
|
||||
- Fix Apache build problems introduced in RC2
|
||||
- $a["0"]==$a[0] fix
|
||||
- Apache-1.3 build changes to support 100% automatic builds and shared library
|
||||
module builds. See INSTALL file.
|
||||
|
||||
March 30 1998 Version 3.0 Release Candidate 2
|
||||
- Changed the socket implementation under UNIX to not use FILE pointers, in
|
||||
order to work around the buggy Solaris libc (and possibly buggy libc's
|
||||
in other platforms).
|
||||
- Fixed a bug in min() and max() with certain arrays.
|
||||
- *WARNING* Move Apache 1.3 php3 file install to src/modules/php4 instead of
|
||||
src/modules/extra. Make sure you change your AddModule line correctly
|
||||
in your Apache Configuration file. This change is to take advantage of
|
||||
new Apache-1.3 configuration mechanism which makes it easier to build an
|
||||
Apache server with PHP automatically enabled. It will also help building
|
||||
a shared library module version of PHP soon.
|
||||
- Fixed a crash bug with auto-appended files.
|
||||
- Made --enable-discard-path work on all Unix servers #!/path/php CGI scripts
|
||||
should now work everywhere. I have tested on Apache, WN and Netscape 2.0
|
||||
- Made $a["123"] and $a[123] be identical. $a["0123"] is still different,
|
||||
though.
|
||||
- Added 'precision' ini directive, to set the number of decimal digits
|
||||
displayed for floating point numbers (default - 6).
|
||||
- Made integer/integer divisions evaluate to floating point numbers when
|
||||
applicable (e.g., 5/2==2.5(float), but 4/2==2(int))
|
||||
- Get rid of reliance on tied streams and move all socket reads and writes
|
||||
to recv/send calls
|
||||
- Cleaned up head.c a bit and fixed CGI SetCookie order problem
|
||||
- Changed default variable parsing order to Get-Cookie-Post (GPC)
|
||||
- Fixed setup so it has all configure options and defaults.
|
||||
- Added optional decimal point and thousands seperator to number_format()
|
||||
e.g., number_format(1500,2,',','.') == 1.500,00
|
||||
- Fixed cgi bug in windows that prevented files from being parsed on many
|
||||
systems and servers.
|
||||
|
||||
March 23 1998 Version 3.0 Release Candidate
|
||||
- Added support for the Raima database (ALPHA)
|
||||
- Fixed a bug in persistent PostgreSQL links and the connection-string method.
|
||||
- Added EXTENSION_STATUS file, that specifies the stability and status of
|
||||
every module in the distribution.
|
||||
- Added optional parameters to user functions with default values, variables
|
||||
that are forced to be passed by reference and variables that can be
|
||||
optionally passed by reference. The ini file directive
|
||||
'ignore_missing_userfunc_args' is no longer supported.
|
||||
- Added fhttpd support (by Alex Belits)
|
||||
- Improved performance by approximately 20-30%.
|
||||
- Added mysql_error(), mysql_errno() (if available) and msql_error().
|
||||
Errors coming back from the database backend no longer issue warnings.
|
||||
Instead, use these functions to retreive the error.
|
||||
- Patched count(), each(), prev(), next(), reset() and end() to work around
|
||||
the implementation side effects of unset(). As far as the users are
|
||||
concerned, this should be transparent now (even though it's slower now,
|
||||
until it's thoroughly fixed in 3.1).
|
||||
- Added number_format(). number_format(2499,2)=='2,499.00'.
|
||||
- error_reporting() now sets the error reporting level to the supplied
|
||||
argument, without any interpretations.
|
||||
- Fixed a lookahead parser bug that occured under rare circumstances.
|
||||
- Change the comparison operators to compare numeric strings as numbers. If
|
||||
you want to compare them as strings, you can use the new C-like strcmp()
|
||||
- Fixed Ora_GetColumn() bug when fetching strings
|
||||
- Added Ora_ColumnName() and Ora_ColumnType()
|
||||
- Preliminary LONG and LONG RAW support in Oracle extension
|
||||
- Add \123 and \xAB style octal and hex escapes to "" and `` strings
|
||||
- Add "-c" command line flag for specifying path to php3.ini file
|
||||
- Improved list() so that elements can be skipped, for example:
|
||||
list($name,,,$realname) = explode(":",fgets($passwd_file));
|
||||
- Fixed a tiny bug in the hash initialization which caused excessive use of
|
||||
memory. Report and fix by short@k332.feld.cvut.cz
|
||||
- Fixed strtolower() and strtoupper() to work with 8-bit chars
|
||||
- Fixed to compile and run on SunOS 4.1
|
||||
- Fixed a crash in soundex() of an empty string
|
||||
- Fixed parse_str() - it wasn't always defining the right variables,
|
||||
and didn't work with arrays.
|
||||
- Made [m,My]SQL create/drop database functions return success status
|
||||
- Fixed some memory leak/crash problems in the Adabas module
|
||||
- Added each() in order to allow for easy and correct array traversing.
|
||||
- Make Apache module version respect LOCALE setting
|
||||
- Add support for Apache 1.3b6+ ap_config.h file
|
||||
- Fixed a nasty corruption bug in eval() and show_source() that resulted in
|
||||
script termination (e.g. eval("exit();").
|
||||
- Fixed a syntax highlighting problem with keywords used as variable
|
||||
names.
|
||||
- Fixed a possible crash and/or file descriptor leak
|
||||
- Fixed line number being off by one in #! shell style execution
|
||||
- Made it possible to disable auto_prepend/append with "none" filename
|
||||
- Allow safe CGI calling through #!php style scripts
|
||||
|
||||
March 2 1998 Version 3.0b6
|
||||
- Made [s]printf handle %ld
|
||||
- Changed CGI version to only open regular files as input script
|
||||
- Added ignore_missing_userfunc_args directive to suppress warnings messages
|
||||
about missing arguments to user-defined functions
|
||||
- Added Postgres function - pg_cmdtuples(), by Vladimir Litovka
|
||||
- Disabled command line options if used as CGI
|
||||
- Changed CGI version to use PATH_TRANSLATED as the script file name
|
||||
- Link with solid shared library instead of static one
|
||||
- Fixed a crash with functions that aren't being called correctly
|
||||
- Fixed file descriptor leak in auto-prepend/append
|
||||
- Imap module is usable. See README in dl/imap.
|
||||
|
||||
February 24 1998 Version 3.0b5
|
||||
- Made the URL aware file functions be enabled by default
|
||||
- Fixed an unlikely crash bug in the parser, with uninitialized array elements
|
||||
which are refered to as objects.
|
||||
- Fixed several fields that were being incorrectly read in Sybase CT.
|
||||
- Fix Apache-1.3 related SIGHUP problem which was preventing php3.ini from
|
||||
getting re-read on a SIGHUP
|
||||
- *** WARNING *** Downwards incompatible change: The plus operator (+) is not
|
||||
longer overloaded as concatenation for strings. Instead, it converts its
|
||||
arguments to numbers and performs numeric addition.
|
||||
- Add Stig and Tin's bdf2gdfont script to extra/gd directory
|
||||
- Added join() as an alias to implode()
|
||||
- Made implode() accept arguments in the order used by explode() as well
|
||||
- Made $php_errormsg local in function calls
|
||||
- Fixed Apache configuration directive bugs
|
||||
- Added a number of .ini directives to Apache .conf directive list
|
||||
- Fixed a 'memory leak' with strtok()
|
||||
- echo/print now handle binary data correctly.
|
||||
- NEW now accepts any expression for the class name argument.
|
||||
- Add ImageDashedLine() GD function
|
||||
- Add arg_separator .ini directive so the '&' GET method separator can be
|
||||
changed to ';' for example. Corresponding php3_arg_separator Apache .conf
|
||||
directive works as well.
|
||||
- Walked around an implementation side effect of switch(). <? switch(expr) { ?>
|
||||
now works.
|
||||
- Added memory caching, resulting in a significant performance boost
|
||||
- Added support for for(): .. endfor; loops
|
||||
- Added a new predicate - empty($var). Returns true if $var is not set,
|
||||
or is FALSE. Returns false otherwise.
|
||||
- Added is_integer() (same as is_long()) and is_real() (same as is_double()).
|
||||
- Added sizeof() as an alias to the count() function
|
||||
- Added --enable-force-cgi-redirect, to prevent the CGI from working if
|
||||
someone directly accesses PHP not through Apache's CGI redirect
|
||||
(off by default).
|
||||
- Fixed marking of deleted dBase records. Noticed by Simon Gornall
|
||||
<simon@oyster.co.uk>.
|
||||
- Fixed fixed "%%" bug in [s]printf
|
||||
- Fixed a UMR (initialized memory read) in the Oracle code
|
||||
- Potential fix for mysql-related SIGPIPE problem which caused httpd to spin
|
||||
- Made PHP responsive to the Apache link status (stop executing if the link
|
||||
dies).
|
||||
- Fixed a crash bug with StrongHold and secure pages
|
||||
- Fixed StrongHold installation
|
||||
- Optimized the function call sequence a bit.
|
||||
- Fixed Sybase/CT date/datetime/money fields work to correctly.
|
||||
- Fixed Apache module startup problems - php3_module_startup should only be
|
||||
called once.
|
||||
- Fixed ord() with characters >127
|
||||
- Fixed bug in file_exists() function
|
||||
- Fixed stripslashes() to remove the escaping quote (instead of backslash)
|
||||
in case magic_quotes_sybase is true.
|
||||
- Also make echo and print automatically remove trailing decimal zeros.
|
||||
- Added htmlentities(), currently handling only ISO-8859-1 entities
|
||||
- "0" is no longer considered false, the only string which is false is the
|
||||
empty string "".
|
||||
- Added 'true' and 'false' keywords
|
||||
- Added 'xor' (logical exclusive or)
|
||||
- Automatic conversion from double to string removes decimal trailing zeros.
|
||||
- Added arsort() and rsort() to sort in descending order.
|
||||
- Turned on "XLATOPT_NOCNV" by default for uODBC/Solid.
|
||||
- Added support for a port number in the mysql_(p)connect() functions
|
||||
- Fixed a file descriptor leak in the configuration parser.
|
||||
- Fixed a few buglets with syntax highlighting with certain language keywords
|
||||
- Added functions to control minimum severity level of Sybase messages to
|
||||
display.
|
||||
- Added highlight_string() - behaves like highlight_file(), only instead
|
||||
of highlighting a file, it syntax highlights the contents of its
|
||||
argument.
|
||||
- Renamed show_source() to highlight_file(). show_source() is still
|
||||
supported for downwards compatability.
|
||||
- Fixed a bug in class inheritence - member functions with upper case
|
||||
letters in their names couldn't be redefined.
|
||||
- Made chown(), chgrp() and chmod() return TRUE/FALSE instead of 0/-1.
|
||||
|
||||
February 02 1998 Version 3.0b4
|
||||
- Fixed a segfault bug in one of the unified ODBC error messages.
|
||||
- Set default file modes to binary on Win32 (solved a lot of bs)
|
||||
- Fixed file copy on Win32
|
||||
- MIME file uploads fixed on Win32
|
||||
- Added contributed icons by Colin Viebrock (undex extra/icons)
|
||||
- Fixed the debugger enough to call it "beta code".
|
||||
- Fixed some leaks in the Oracle module, tidied up the code a bit.
|
||||
- Added __FILE__ and __LINE__ which evaluate to the currently parsed file
|
||||
and currently parsed line respectively.
|
||||
- Added ImageColorAt(), ImageColorSet(), ImageColorsForIndex(), and
|
||||
ImageColorsTotal() to allow manipulating the palette of GIF images.
|
||||
- Rename '--enable-url-includes' option to '--enable-url-fopen-wrapper' to
|
||||
better describe what it does, and pay attention to the setting.
|
||||
- Added optional parameter to the file(), readfile() and fopen() functions
|
||||
to look for files located in the include path.
|
||||
- Fixed bug that allowed the file() and readfile() to open files in the
|
||||
include path inadvertantly.
|
||||
- Fixed a (documented) bug in printf()/sprintf() with hard limited strings
|
||||
and alignment (e.g. %-.20s).
|
||||
- Optimized several quoted string routines.
|
||||
- Added error_log ini directive to select where errors get logged when
|
||||
log_errors is turned on or the error_log() function is used.
|
||||
- Added the ability to direct errors to log files instead of or in addition
|
||||
to the script output. Use the new display_errors and log_errors
|
||||
php3.ini directives.
|
||||
- Made environment variables uneraseable by POST/GET/Cookie variables.
|
||||
- Fixed a bug in the elseif() construct. The expression was being evaluated
|
||||
even if a previous if/elseif already evaluated to true and got executed.
|
||||
- Fixed a bug in the exit code parameter of system()
|
||||
- Tighten up all exec() related functions in safe mode
|
||||
- Added error_log() function to log messages to the server error log, or
|
||||
stderr for the CGI version.
|
||||
- Added support for a general memory limit of scripts.
|
||||
- Fixed a segfault bug that occured under certain circumstances with shell
|
||||
escapes ($foo = `...`)
|
||||
- Made keywords be valid property names of objects.
|
||||
- Fixed a segfault bug when creating new objects of an unknown class.
|
||||
- Fixed a problem with the maximum execution time limit, that may have
|
||||
prevented this feature from working on certain platforms.
|
||||
- PHP would now warn you with E_NOTICE about unknown escape characters,
|
||||
e.g. "\f". It would still be considered as a backslash followed by f,
|
||||
but the proper way of writing this is "\\f" or '\f'.
|
||||
- Added support for ${...} inside encapsulated strings. Supported: ${foo},
|
||||
${foo[bar]}, ${foo[0]}, ${$foo[$bar]}, ${$foo->bar} and ${$foo}
|
||||
- Fixed a bug in automatic persistent link reconnect of the Sybase/DB module.
|
||||
Thanks to Steve Willer for finding that 'stealth' bug!
|
||||
- Fixed a crash bug in the GET/POST/Cookie parser in case of regular
|
||||
and array variables with the same name.
|
||||
- Added round() function.
|
||||
- Can't use encapsed strings as variable names anymore, ie. $"blah blah".
|
||||
- Fixed bug in gethostby*() functions that resulted in a core dump.
|
||||
(Noticed by torben@coastnet.com.)
|
||||
- Fixed bug in dbase_get_record that prevented number and date fields
|
||||
from being properly decoded. (Thanks again to colins@infofind.com.)
|
||||
- Make dbase_get_record include a 'deleted' field that indicates whether
|
||||
that record had been marked for deletion.
|
||||
- Fixed bug in dbase library that stomped on the deleted flag of the first
|
||||
record in the file if it was set. (Thanks to colins@infofind.com.)
|
||||
- Fixed putenv() to not report a memory leak and possibly prevent a bug
|
||||
from that memory being freed.
|
||||
- Added setlocale()
|
||||
- Added pg_fieldisnull() (by Stephan Duehr)
|
||||
- Changed pg_exec() to always return a result identifier on succees
|
||||
- Solid linking fixes (tries to find the right library)
|
||||
- Fixed a but with date() and the 'w' element.
|
||||
- Tried to eliminate unimportant memory leak notifications.
|
||||
- Made min() and max() backwards compatible and able to handle doubles.
|
||||
- Add fgetc() function
|
||||
- Fixed bug in getmyuid(), getmyinode() and getlastmod(). Thanks to
|
||||
khim@sch57.msk.ru for pointing this out.
|
||||
- Fixed http:// URL includes with no path specified send request for /.
|
||||
- Added GetAllHeaders() (Apache-only)
|
||||
- Added workaround that made the Image text functions 8-bit clean
|
||||
- Made snmp internally compilable for Win32 (not the unix one though),
|
||||
only adds 2k to binary size, so no reason not to have it there.
|
||||
- Fixed ldap loading on Win32
|
||||
- Fixed MySQL Info function on Win32 platform
|
||||
- Fixed compilation of syntax highlighting mode
|
||||
|
||||
January 17 1998 Version 3.0b3
|
||||
- Added mysql support under windows ;) happy happy joy joy
|
||||
- Fixed dbase.dll for Win32 to actualy load now.
|
||||
- Enhanced the convertor to recognize ?> as a php-close-block as well.
|
||||
- Fixed potential SetCookie() core dumps
|
||||
- Changed print to be an expression instead of a statement. That means you can
|
||||
now do stuff like foobar() or print("Unable to foobar!"). echo has NOT been
|
||||
changed.
|
||||
- Removed the flex optimization flags to reduce the size of the scanner
|
||||
- Added memory leak logging into apache log files (apache module only)
|
||||
- Fixed a nasty bug in one of the internal stacks. This may have caused
|
||||
random crashes in several occassions.
|
||||
- Fixed bug in ImageGif() making it hang sometimes
|
||||
- Added ImageLoadFont(), ImageFontWidth() and ImageFontHeight()
|
||||
- error_reporting() now returns the old error reporting level
|
||||
- Fixed url includes/opens not working under Win32
|
||||
- Fixed errorneous handling of multipart/form-data input
|
||||
- Added rawurlencode(), rawurldecode() and changed urlencode() and urldecode()
|
||||
a bit too.
|
||||
- Fixed a bug in [s]printf, sign was forgotten for doubles.
|
||||
- Fixed a segfault bug in pg_fieldprtlen(), and made it accept field names
|
||||
in addition to field offsets.
|
||||
- Made the setup script a little more user-friendly.
|
||||
- Added is_long(), is_double(), is_string(), is_array() and is_object()
|
||||
- Fixed a bug in freeing of mSQL results.
|
||||
- Improved pg_exec() to properly return true or false with queries that don't
|
||||
return rows (i.e. insert, update, create, etc)
|
||||
- Added get_cfg_var() to enable checking cfg file directives from within
|
||||
a script.
|
||||
- Fixed a bug with urlencode() and characters 0x80-0xff
|
||||
- Changed the behaviour of ereg_replace to more intuitive. The
|
||||
backslashes other than valid existing back references in the second
|
||||
argument are no more evaluated as escape sequences.
|
||||
- Fixed a bug in the configuration file loader and safe mode.
|
||||
- Fixed a bug with configuration variables taken from the environment.
|
||||
- Added <script language=php> </script> as PHP open/close tags, to allow
|
||||
the use of editors such as Microsoft Frontpage.
|
||||
- Fixed a bug in the default php3.ini directory - it wasn't defaulting to
|
||||
/usr/local/lib properly.
|
||||
- Added support for \r\n line endings
|
||||
- Fixed a bug that may have prevented POST method variables from working
|
||||
with certain scripts when using the CGI version.
|
||||
- Convertor: Added support for single-quoted strings
|
||||
- Fixed segfault bug in the Adabas module, with queries that don't return
|
||||
rows (update, insert, etc).
|
||||
|
||||
December 22 1997 Version 3.0b2
|
||||
- Changed variable type conversions that do not specify base to always use
|
||||
base 10. "010" is no more 8, it is 10. Use intval ($x, 0) to get C-style
|
||||
octal and hex numbers recognized.
|
||||
- Fixed a possible segfault bug in several functions, when using the concat
|
||||
operator and possibly other operators/functions.
|
||||
- # is no longer accepted as a comment in php3.ini. Use ; instead.
|
||||
- Added browscap support
|
||||
- Configuration file directives are now case-sensitive
|
||||
- Fixed msql_tablename() and msql_dbname()
|
||||
- Added a PHP/FI 2.0 -> PHP 3.0 convertor
|
||||
- Added support for shell/perl-style single quotes
|
||||
- Added support for execution of external programs using backquotes ($a=`ls -l`)
|
||||
- fixed mail() on windows, also fixed memory leaks in mail on windows
|
||||
- added sendmail_from to handle return route on windows
|
||||
- Changed the way the config file is searched. The file name is now
|
||||
php3.ini (hardcoded), and it'll be looked for in: local directory, $PHPRC
|
||||
and builtin path designated by ./configure under UNIX or Windows directory
|
||||
under Windows.
|
||||
- Fixed ereg_replace replacing empty matches and a one off buffer overflow
|
||||
- Fixed File upload on windows platform
|
||||
- Fixed a bug that caused 'HTTP/1.1 100 Continue' messages with
|
||||
Internet Explorer 4.0 and certain scripts that receive POST variables
|
||||
- Get/POST/Cookie data variables are from now *ALWAYS* strings. If you want
|
||||
to use them in integer/real context, you must explicitly change their types.
|
||||
This was done in order to avoid possible loss of data when doing these
|
||||
conversions automatically.
|
||||
- Variables named as keywords are now allowed (e.g. $function, $class, etc)
|
||||
- Fixed a problem with msql() and mysql() with NULL fields
|
||||
- Fixed a segfault bug with class declarations
|
||||
- Fixed bugs with FOR loops and include() from within eval()
|
||||
- Changed include() to be executed conditionally. PHP-3.0 efficient
|
||||
unconditional include is now require()
|
||||
|
||||
December 08 1997 Version 3.0b1
|
||||
- Switched to public beta test phase
|
||||
- Generalized unset() and isset() to work on any type of variables, including
|
||||
specific array indices or object properties (e.g., unset($a[4]) now works).
|
||||
- Added support for object references inside encapsulated strings
|
||||
(for example, 'echo "Username: $user->name"' now works)
|
||||
- Added arbitary precision math support (basic operations with
|
||||
unlimited range numbers, and support for unlimited decimal digits)
|
||||
- Apache module can now handle preprocessed scripts (by using:
|
||||
AddType application/x-httpd-php3-preprocessed .php3p
|
||||
in the Apache configuration)
|
||||
- Made settype() pass its first parameter by value. Improved it to be able
|
||||
to convert to arrays and objects (originally by Steve Willer)
|
||||
- Implemented CPU time limit on scripts when setitimer() is available
|
||||
- Computed field names in the Sybase/CT and Sybase/DB modules are now named
|
||||
computed, computed1, computed2, ...
|
||||
- Added Sybase/CT client/server message handlers and updated the Sybase/DB ones
|
||||
- Made the regexp function automatically take arguments by reference
|
||||
when necessary
|
||||
- Added builtin support for auto append and prepend in the parser level
|
||||
- Improved the Sybase/CT sybase_query(). Should be more stable now, and
|
||||
hopefully work with a wider range of queries. It's difficult to work
|
||||
without docs, though, so it may still not be 100% right...
|
||||
- Changed error messages to show error type, file and line with bold
|
||||
- Added support for autoprepend and autoprepend
|
||||
- Added some more warning flags if gcc is used
|
||||
|
||||
December 03 1997 Version 3.0a4
|
||||
- Improved the internal functions API - no need to explicitly pass
|
||||
parameters by reference to internal functions that specifically
|
||||
require them, e.g. sort(), ksort(), reset(), count(), etc.
|
||||
This is *STILL* downwards compatible with the previous alphas,
|
||||
in the sense that you can explicitly pass the arguments by reference
|
||||
if you want to.
|
||||
- use srandom/random instead of srand/rand if available
|
||||
- Added [m,My]sql_listfields() for downwards compatability
|
||||
- -p now replaces .php3 extension with .php3p (otherwise it adds .php3p)
|
||||
- Added C++ style comments (// comment)
|
||||
- Fixed # commenting to terminate at a close PHP tag
|
||||
- Added \0 back reference for full string match to *reg*_replace and
|
||||
added backslash escaping to replace string
|
||||
- Fixed a few bugs in the Sybase DB-library module.
|
||||
- Added Sybase CT-library support. It should be considered experimental.
|
||||
Syntax is identical to the one of the DB-library. Allows people to
|
||||
connect to MS-SQL servers from Linux without having to pay for a
|
||||
library!
|
||||
- Beautified phpinfo()
|
||||
- Add ImageColorClosest() and ImageColorExact() GD functions
|
||||
- Make all .ini directives work as Apache .conf directives as well
|
||||
- Added PHP2-like File() function with PHP3 URL support
|
||||
- Upgraded the Sybase interface. It's practically MySQL compatible now!
|
||||
Among other things, added sybase_fetch_array() and sybase_fetch_object().
|
||||
- Fixed problem in multi dimensional array handling and self modifying
|
||||
operators (+=, -=, etc).
|
||||
- Safe Mode file open implementation
|
||||
- SVR3 portability problem fix
|
||||
|
||||
November 23 1997 Version 3.0a3
|
||||
- Made the global statement behave like PHP 2 with undefined variables
|
||||
- Added msql_fetch_object() and msql_fetch_array()
|
||||
- Switched between the 1st and 2nd parameters to explode(), so that it acts
|
||||
like split()
|
||||
- Fixed passthru(), exec() and system() functions
|
||||
- Implemented second optional parameter to intval() to specify conversion base
|
||||
(The default is to assume you want to do a base 10 conversion.)
|
||||
- Implemented SQL safe mode for MySQL
|
||||
- Read UploadTmpDir from php3.ini instead of apache conf files
|
||||
- Added mysql_fetch_object() and mysql_fetch_array()
|
||||
- Changed function->old_function. function is now an alias to cfunction.
|
||||
- Split the magic_quotes directive to get/post/data and other
|
||||
- Added generic copy() function
|
||||
- Added a $GLOBALS[] array, which contains all global variables
|
||||
- Fix broken getimagesize() function
|
||||
- Made mysql_fetch_field() and msql_fetch_field() optionally accept a 2nd argument
|
||||
- Fixed mysql_data_seek() and msql_data_seek()
|
||||
- Changed list assignment to list(...) and array init to array(...)
|
||||
- Made <?php_track_vars?> work
|
||||
- cgi when not in debug mode uses regular malloc(), free() functions now
|
||||
- Added preliminary support for perl-style list assignments
|
||||
- Fixed a bug in mysql_result() and msql_result() when specifying table
|
||||
- renamed internal error-handling function and levels
|
||||
- Added basename and dirname functions similar to sh counterparts
|
||||
- Added base64_encode() and base64_decode()
|
||||
- Support Basic authorization for http url includes
|
||||
- Added parse_url() function to extract url components
|
||||
- Made it possible to use anonymous ftp on URL includes
|
||||
- Fixed url includes to handle different URLs better
|
||||
- Fixed mysql_field*() functions
|
||||
- Made mysql_connect() smarter, after a mysql_close() (applies to msql and pgsql too)
|
||||
|
||||
November 6 1997 Version 3.0a2
|
||||
- Fixed a segfault bug caused by non-persistent connect in [m,My,Postgres]SQL modules
|
||||
- Fix command line argument handling
|
||||
- Made empty array list assignments work ($a=({});)
|
||||
- Made '$' escaping optional when a variable name parsing isn't possible
|
||||
- Added support for mysql_[p]connect(host) and mysql_[p]connect(host,user)
|
||||
- New layout in phpinfo()
|
||||
- Update Oracle extension to use php3_list functions
|
||||
- Add includepath support
|
||||
- Add #!php shell script escape support
|
||||
- Change name of CGI/command line version from php3.cgi to php
|
||||
- Add SNMP extension
|
||||
- show_source() support
|
||||
- Parsing of command-line args for CGI version
|
||||
- Support for backreferences in ereg_replace
|
||||
- Support for hexadecimal numbers directly at the scanner level
|
||||
- Support octal numbers directly at the scanner level
|
||||
- Fixed problem with huge html files (with little or no php code)
|
||||
- Fix eval() empty string argument core dump
|
||||
- renamed 'install' to 'setup' to be more accurate and avoid name conflict
|
||||
- Fixed Oracle compilation
|
||||
- Fixed mSQL 1.0 compilation
|
||||
- Fixed a problem in the mSQL, MySQL and PostgresSQL drivers and NULL fields.
|
||||
- Fixed the GLOBAL statement to be able to declare an array.
|
||||
|
||||
October 29 1997 Version 3.0a1
|
||||
- Start with excellent new parser from Andi and Zeev
|
||||
@@ -0,0 +1,83 @@
|
||||
|
||||
|
||||
This is the ChangeLog from PHP3 as of Apr 12 1999.
|
||||
|
||||
Entries should be removed from this file, if you transfer changes
|
||||
over to PHP4.
|
||||
|
||||
============================================================================
|
||||
|
||||
?? 1999, Version 3.0.8
|
||||
- added Oracle-OCI8 persistent connections
|
||||
- fixed OCIDefineByName crash.
|
||||
- fixed some NULL-column related problems in OCI8-module.
|
||||
- Some Informix driver improvements.
|
||||
- PUT method support (mlemos@acm.org)
|
||||
- Fix parameter count problem in odbc_setoption()
|
||||
- Really fix implode() this time. The fix in 3.0.7 was bogus
|
||||
- Make fgetss() slightly smarter
|
||||
- Add strip_tags() which uses the fgetss state-machine but acts on a string
|
||||
|
||||
March 1 1999, Version 3.0.7
|
||||
- Added pdf_put_image and pdf_execute_image
|
||||
- Initial work on an ImageMagick module - doesn't do anything yet
|
||||
- Make configure script detect Netscape's LDAP SDK automagically
|
||||
- Fixed Oracle-OCI8 module for windows.
|
||||
- Add OCIRowCount function. (Number of affected rows for update-statements)
|
||||
- Add OCIDefineByName function.
|
||||
- Change the behaviour of open_basedir. It's now possible to supply more
|
||||
than one directory. open_basedir paths from parent directories are now
|
||||
automatically inherited.
|
||||
- fix rand() and mt_rand() to make the ranges work correctly
|
||||
- htmlspecialchars() and htmlentities() are now binary safe.
|
||||
- Add extract() function.
|
||||
- Oracle-OCI8 driver now supports BLOBS/CLOBS and IN/OUT binding of local php
|
||||
variables.
|
||||
- Clean up apxs build
|
||||
- Add INSTALL.REDHAT file to walk RedHat users through the install
|
||||
- Added optional second argument to mysql_fetch_array(); MYSQL_ASSOC will
|
||||
cause the resulting array to contain the associative indices only,
|
||||
MYSQL_NUM will cause the array to contain the numeric indices only (like
|
||||
mysql_fetch_row()) and MYSQL_BOTH would cause them both to be defined
|
||||
(default).
|
||||
- Backport the Zend debugging memory manager into the PHP 3.0.x tree.
|
||||
- Add function_exists() function.
|
||||
- Add another version of WDDX module
|
||||
(we need to pick a single implementation here)
|
||||
- Fixed includes for iODBC to support both the old and the new LGPL version
|
||||
- Fix implode() bug - When imploding an array that contained unset() elements
|
||||
it wasn't correctly skipping past these
|
||||
- Add connection_status() function. This returns the raw bitfield which
|
||||
indicates whether the script terminated due to a user abort, a timeout
|
||||
or normally. Note that if ignore_user_abort is enabled, then both the
|
||||
timeout state and the user abort state can be active
|
||||
- Add connection_timeout() function. This one can be called in a shutdown
|
||||
function to tell you if you got there because of a timeout
|
||||
- Add ignore_user_abort() function and .ini/.conf directive of same name
|
||||
- Fix connection abort detection code - It should now work reliably with
|
||||
Apache. Also added a user-level connection_aborted() function designed to
|
||||
let people check whether the user aborted the connection in a user-level
|
||||
shutdown function.
|
||||
- Add pfsockopen() function
|
||||
- Improvements in FreeType support: Macintosh fonts work, and non-antialiased
|
||||
output is considerably cleaner <mka@satama.com>
|
||||
- Fixed checkdate() function, range of valid years is now 0 to 32767
|
||||
- hw_insertdocument() returns object id now
|
||||
- Add pdf_open() warning in configure and documentation
|
||||
- Add diskfreespace() function
|
||||
- Added aspell support
|
||||
- Iptcparse would sometimes find a wrong tag.
|
||||
- Force var_dump() to output headers
|
||||
- Add optional 3th parameter to ora_fetchinto.
|
||||
- Serialize and var_dump no longer show array elements that
|
||||
have been unset.
|
||||
- Add IptcEmbed() function (can replace an APP13-Marker in a JPEG file)
|
||||
- Add OCI8 module for Windows
|
||||
- Fix bug in pdf_close() function
|
||||
- Add WDDX support (see http://www.wddx.org for more info)
|
||||
- Add similar_text() function
|
||||
- Constructors of parent classes weren't accessible to derived classes (as
|
||||
of 3.0.6). Fixed.
|
||||
- Introduce simple regex compilation cache
|
||||
|
||||
|
||||
@@ -0,0 +1,538 @@
|
||||
Functions:
|
||||
|
||||
Functions marked with 'u' do not work, or may not work correctly under windows.
|
||||
|
||||
basic_functions
|
||||
include
|
||||
_include
|
||||
isset
|
||||
|
||||
intval
|
||||
doubleval
|
||||
strval
|
||||
short_tags
|
||||
sleep
|
||||
u usleep
|
||||
ksort
|
||||
asort
|
||||
sort
|
||||
count
|
||||
chr
|
||||
ord
|
||||
flush
|
||||
end
|
||||
prev
|
||||
next
|
||||
reset
|
||||
current
|
||||
key
|
||||
gettype
|
||||
settype
|
||||
min
|
||||
max
|
||||
|
||||
addslashes
|
||||
chop
|
||||
pos
|
||||
|
||||
fsockopen
|
||||
getimagesize
|
||||
htmlspecialchars
|
||||
md5
|
||||
|
||||
parse_url
|
||||
|
||||
parse_str
|
||||
phpinfo
|
||||
phpversion
|
||||
strlen
|
||||
strtok
|
||||
strtoupper
|
||||
strtolower
|
||||
strchr
|
||||
basename
|
||||
dirname
|
||||
stripslashes
|
||||
strstr
|
||||
strrchr
|
||||
substr
|
||||
quotemeta
|
||||
urlencode
|
||||
urldecode
|
||||
ucfirst
|
||||
strtr
|
||||
sprintf
|
||||
printf
|
||||
|
||||
exec
|
||||
system
|
||||
escapeshellcmd
|
||||
passthru
|
||||
|
||||
soundex
|
||||
|
||||
rand
|
||||
srand
|
||||
getrandmax
|
||||
gethostbyaddr
|
||||
gethostbyname
|
||||
explode
|
||||
implode
|
||||
error_reporting
|
||||
clearstatcache
|
||||
|
||||
get_current_user
|
||||
getmyuid
|
||||
getmypid
|
||||
u getmyinode
|
||||
getlastmod
|
||||
|
||||
base64_decode
|
||||
base64_encode
|
||||
|
||||
abs
|
||||
ceil
|
||||
floor
|
||||
sin
|
||||
cos
|
||||
tan
|
||||
asin
|
||||
acos
|
||||
atan
|
||||
pi
|
||||
pow
|
||||
exp
|
||||
log
|
||||
log10
|
||||
sqrt
|
||||
bindec
|
||||
hexdec
|
||||
octdec
|
||||
decbin
|
||||
decoct
|
||||
dechex
|
||||
|
||||
getenv
|
||||
putenv
|
||||
|
||||
time
|
||||
mktime
|
||||
date
|
||||
gmdate
|
||||
getdate
|
||||
checkdate
|
||||
microtime
|
||||
uniqid
|
||||
|
||||
u linkinfo
|
||||
u readlink
|
||||
u symlink
|
||||
u link
|
||||
u unlink
|
||||
|
||||
|
||||
bcmath_functions
|
||||
bcadd
|
||||
bcsub
|
||||
bcmul
|
||||
bcdiv
|
||||
bcmod
|
||||
bcpow
|
||||
bcsqrt
|
||||
bcscale
|
||||
bccomp
|
||||
|
||||
dir_functions
|
||||
opendir
|
||||
closedir
|
||||
chdir
|
||||
rewinddir
|
||||
readdir
|
||||
dir
|
||||
|
||||
dl_functions
|
||||
dl(string module_name); dynamicly load a module
|
||||
|
||||
dns_functions
|
||||
gethostbyaddr
|
||||
gethostbyname
|
||||
|
||||
file_functions
|
||||
pclose
|
||||
popen
|
||||
readfile
|
||||
rewind
|
||||
rmdir
|
||||
umask
|
||||
fclose
|
||||
feof
|
||||
fgets
|
||||
fgetss
|
||||
fopen
|
||||
fpassthru
|
||||
fseek
|
||||
ftell
|
||||
fputs
|
||||
mkdir
|
||||
rename
|
||||
copy
|
||||
tempnam
|
||||
file
|
||||
|
||||
filestat_functions
|
||||
fileatime
|
||||
filectime
|
||||
u filegroup
|
||||
u fileinode
|
||||
filemtime
|
||||
u fileowner
|
||||
fileperms
|
||||
filesize
|
||||
filetype
|
||||
stat
|
||||
u chown
|
||||
u chgrp
|
||||
u chmod
|
||||
touch
|
||||
file_exists
|
||||
is_executable
|
||||
is_dir
|
||||
is_readable
|
||||
is_writeable
|
||||
u is_link
|
||||
|
||||
header_functions
|
||||
setcookie
|
||||
header
|
||||
|
||||
mail_functions
|
||||
mail
|
||||
|
||||
reg_functions
|
||||
ereg
|
||||
ereg_replace
|
||||
eregi
|
||||
eregi_replace
|
||||
split
|
||||
sql_regcase
|
||||
|
||||
syslog_functions (writes to event log on win NT)
|
||||
openlog
|
||||
syslog
|
||||
closelog
|
||||
|
||||
The following are optional modules and may or may not be compiled into php, or may be compiled as a loadable module.
|
||||
|
||||
odbc_functions (obsolete, use uodbc below)
|
||||
sqlconnect
|
||||
sqldisconnect
|
||||
sqlfetch
|
||||
sqlexecdirect
|
||||
sqlgetdata
|
||||
sqlfree
|
||||
sqlrowcount
|
||||
|
||||
uodbc_functions
|
||||
(int) odbc_autocommit($connection_id, $OnOff)
|
||||
(void) odbc_close($connection_id)
|
||||
(void) odbc_close_all(void)
|
||||
(int) odbc_commit($connection_id)
|
||||
(int) odbc_connect($dsn, $user, $password)
|
||||
(int) odbc_pconnect($dsn, $user, $password)
|
||||
(string) odbc_cursor($result_id)
|
||||
(int) odbc_do($connection_id, $query_string)
|
||||
(int) odbc_exec($connection_id, $query_string)
|
||||
(int) odbc_prepare($connection_id, $query_string)
|
||||
(int) odbc_execute($result_id, $array)
|
||||
(int) odbc_fetch_row($result_id, $row_number)
|
||||
(int) odbc_fetch_into($result_id, $row_number, $array_ptr)
|
||||
(int) odbc_field_len($result_id, $field_number)
|
||||
(string) odbc_field_name($result_id, $field_number)
|
||||
(string) odbc_field_type($result_id, $field)
|
||||
(int) odbc_free_result($result_id)
|
||||
(int) odbc_num_fields($result_id)
|
||||
(int) odbc_num_rows($result_id)
|
||||
(string) odbc_result($result_id, $field)
|
||||
(int) odbc_result_all($result_id, $format)
|
||||
(int) odbc_rollback($connection_id)
|
||||
|
||||
msql_functions
|
||||
msql_connect
|
||||
msql_pconnect
|
||||
msql_close
|
||||
msql_select_db
|
||||
msql_create_db
|
||||
msql_drop_db
|
||||
msql_query
|
||||
msql
|
||||
msql_list_dbs
|
||||
msql_list_tables
|
||||
msql_list_fields
|
||||
msql_result
|
||||
msql_num_rows
|
||||
msql_num_fields
|
||||
msql_fetch_row
|
||||
msql_fetch_array
|
||||
msql_fetch_object
|
||||
msql_data_seek
|
||||
msql_fetch_field
|
||||
msql_field_seek
|
||||
msql_free_result
|
||||
msql_fieldname
|
||||
msql_fieldtable
|
||||
msql_fieldlen
|
||||
msql_fieldtype
|
||||
msql_fieldflags
|
||||
msql_regcase
|
||||
/* for downwards compatability */
|
||||
msql_selectdb
|
||||
msql_createdb
|
||||
msql_dropdb
|
||||
msql_freeresult
|
||||
msql_numfields
|
||||
msql_numrows
|
||||
msql_listdbs
|
||||
msql_listtables
|
||||
msql_listfields
|
||||
msql_dbname
|
||||
msql_tablename
|
||||
|
||||
ldap_functions
|
||||
ldap_connect
|
||||
ldap_bind
|
||||
ldap_unbind
|
||||
ldap_read
|
||||
ldap_list
|
||||
ldap_search
|
||||
ldap_free_result
|
||||
ldap_count_entries
|
||||
ldap_first_entry
|
||||
ldap_next_entry
|
||||
ldap_get_entries
|
||||
ldap_free_entry
|
||||
ldap_first_attribute
|
||||
ldap_next_attribute
|
||||
ldap_get_attributes
|
||||
ldap_get_values
|
||||
ldap_get_dn
|
||||
ldap_dn2ufn
|
||||
ldap_add
|
||||
ldap_delete
|
||||
ldap_modify
|
||||
|
||||
gd_functions
|
||||
imagearc
|
||||
imagechar
|
||||
imagecharup
|
||||
imagecolorallocate
|
||||
imagecolorclosest
|
||||
imagecolorexact
|
||||
imagecolortransparent
|
||||
imagecopyresized
|
||||
imagecreate
|
||||
imagecreatefromgif
|
||||
imagedestroy
|
||||
imagefill
|
||||
imagefilledpolygon
|
||||
imagefilledrectangle
|
||||
imagefilltoborder
|
||||
imagegif
|
||||
imageinterlace
|
||||
imageline
|
||||
imagepolygon
|
||||
imagerectangle
|
||||
imagesetpixel
|
||||
imagestring
|
||||
imagestringup
|
||||
imagesx
|
||||
imagesy
|
||||
|
||||
filepro_functions
|
||||
filepro
|
||||
filepro_rowcount
|
||||
filepro_fieldname
|
||||
filepro_fieldtype
|
||||
filepro_fieldwidth
|
||||
filepro_fieldcount
|
||||
filepro_retrieve
|
||||
|
||||
dbm_functions
|
||||
dblist
|
||||
dbmopen
|
||||
dbmclose
|
||||
dbminsert
|
||||
dbmfetch
|
||||
dbmreplace
|
||||
dbmexists
|
||||
dbmdelete
|
||||
dbmfirstkey
|
||||
dbmnextkey
|
||||
|
||||
dbase_functions
|
||||
dbase_open
|
||||
dbase_create
|
||||
dbase_close
|
||||
dbase_numrecords
|
||||
dbase_numfields
|
||||
dbase_add_record
|
||||
dbase_get_record
|
||||
dbase_delete_record
|
||||
dbase_pack
|
||||
|
||||
calendar_functions
|
||||
jdtogregorian
|
||||
gregoriantojd
|
||||
jdtojulian
|
||||
juliantojd
|
||||
jdtojewish
|
||||
jewishtojd
|
||||
jdtofrench
|
||||
frenchtojd
|
||||
jddayofweek
|
||||
jdmonthname
|
||||
|
||||
adabas_functions
|
||||
(int) ada_afetch($result_id, $rownumber, $result array)
|
||||
(int) ada_autocommit($connection_id, $OnOff)
|
||||
(void) ada_close($connection_id)
|
||||
ada_closeall
|
||||
(int) ada_commit($connection_id)
|
||||
(int) ada_connect($dsn, $user, $password)
|
||||
(int) ada_exec($connection_id, $query_string)
|
||||
(int) ada_fetchrow($result_id, $row?number)
|
||||
ada_fieldlen
|
||||
(string) ada_fieldname($result_id, $field_number)
|
||||
(string) ada_fieldtype($result_id, $field)
|
||||
(int) ada_freeresult($result_id)
|
||||
(int) ada_numfields($result_id)
|
||||
(int) ada_numrows($result_id)
|
||||
(string) ada_result($result_id, $field)
|
||||
(int) ada_resultall($result_id, $format)
|
||||
(int) ada_rollback($connection_id)
|
||||
***(int) ada_fieldnum($result_id, $field_name) (this function is not in adabase.c
|
||||
|
||||
crypt_functions
|
||||
crypt
|
||||
|
||||
mysql_functions
|
||||
mysql_connect
|
||||
mysql_pconnect
|
||||
mysql_close
|
||||
mysql_select_db
|
||||
mysql_create_db
|
||||
mysql_drop_db
|
||||
mysql_query
|
||||
mysql
|
||||
mysql_list_dbs
|
||||
mysql_list_tables
|
||||
mysql_list_fields
|
||||
mysql_affected_rows
|
||||
mysql_insert_id
|
||||
mysql_result
|
||||
mysql_num_rows
|
||||
mysql_num_fields
|
||||
mysql_fetch_row
|
||||
mysql_fetch_array
|
||||
mysql_fetch_object
|
||||
mysql_data_seek
|
||||
mysql_fetch_lengths
|
||||
mysql_fetch_field
|
||||
mysql_field_seek
|
||||
mysql_free_result
|
||||
mysql_fieldname
|
||||
mysql_fieldtable
|
||||
mysql_fieldlen
|
||||
mysql_fieldtype
|
||||
mysql_fieldflags
|
||||
/* for downwards compatability */
|
||||
mysql_selectdb
|
||||
mysql_createdb
|
||||
mysql_dropdb
|
||||
mysql_freeresult
|
||||
mysql_numfields
|
||||
mysql_numrows
|
||||
mysql_listdbs
|
||||
mysql_listtables
|
||||
mysql_listfields
|
||||
mysql_dbname
|
||||
mysql_tablename
|
||||
|
||||
oracle_functions
|
||||
ora_close
|
||||
ora_commit
|
||||
ora_commitoff
|
||||
ora_commiton
|
||||
ora_error
|
||||
ora_errorcode
|
||||
ora_exec
|
||||
ora_fetch
|
||||
ora_getcolumn
|
||||
ora_logoff
|
||||
ora_logon
|
||||
ora_open
|
||||
ora_parse
|
||||
ora_rollback
|
||||
|
||||
pgsql_functions
|
||||
pg_connect
|
||||
pg_pconnect
|
||||
pg_close
|
||||
pg_dbname
|
||||
pg_errormessage
|
||||
pg_options
|
||||
pg_port
|
||||
pg_tty
|
||||
pg_host
|
||||
pg_exec
|
||||
pg_numrows
|
||||
pg_numfields
|
||||
pg_fieldname
|
||||
pg_fieldsize
|
||||
pg_fieldtype
|
||||
pg_fieldnum
|
||||
pg_result
|
||||
pg_fieldprtlen
|
||||
pg_getlastoid
|
||||
pg_freeresult
|
||||
pg_locreate
|
||||
pg_lounlink
|
||||
pg_loopen
|
||||
pg_loclose
|
||||
pg_loread
|
||||
pg_lowrite
|
||||
pg_loreadall
|
||||
|
||||
sybase_functions
|
||||
sybase_connect
|
||||
sybase_pconnect
|
||||
sybase_close
|
||||
sybase_select_db
|
||||
sybase_query
|
||||
sybase_free_result
|
||||
sybase_get_last_message
|
||||
sybase_num_rows
|
||||
sybase_num_fields
|
||||
sybase_fetch_row
|
||||
sybase_fetch_array
|
||||
sybase_fetch_object
|
||||
sybase_data_seek
|
||||
sybase_fetch_field
|
||||
sybase_field_seek
|
||||
sybase_result
|
||||
|
||||
sybase_old_functions
|
||||
sybsql_seek
|
||||
sybsql_exit
|
||||
sybsql_dbuse
|
||||
sybsql_query
|
||||
sybsql_isrow
|
||||
sybsql_result
|
||||
sybsql_connect
|
||||
sybsql_nextrow
|
||||
sybsql_numrows
|
||||
sybsql_getfield
|
||||
sybsql_numfields
|
||||
sybsql_fieldname
|
||||
sybsql_result_all
|
||||
sybsql_checkconnect
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
Installation Instructions for PHP 4.0
|
||||
-------------------------------------
|
||||
|
||||
For the impatient here is a quick set of steps that will build PHP
|
||||
as an Apache module for Apache 1.3.0 with MySQL support. A more verbose
|
||||
explanation follows.
|
||||
|
||||
|
||||
QUICK INSTALL
|
||||
|
||||
gunzip apache_1.3.x.tar.gz
|
||||
tar xvf apache_1.3.x.tar
|
||||
gunzip php-4.0.x.tar.gz
|
||||
tar xvf php-4.0.x.tar
|
||||
cd apache_1.3.x
|
||||
./configure --prefix=/www
|
||||
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)
|
||||
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
|
||||
|
||||
Installing PHP can be done in four simple steps:
|
||||
|
||||
1. Unpack your distribution file.
|
||||
|
||||
You will have downloaded a file named something like php4xn.tar.gz.
|
||||
Unzip this file with a command like: gunzip php4xn.tar.gz
|
||||
|
||||
Next you have to untar it with: tar -xvf php4xn.tar
|
||||
|
||||
This will create a php-4.0.x directory. cd into this new directory.
|
||||
|
||||
2. Configure PHP.
|
||||
|
||||
You now have to choose the options you would like. There are quite
|
||||
a few of them. To see a list, type: ./configure --help
|
||||
|
||||
You can also use the supplied 'setup' script, which will ask you
|
||||
a series of questions and automatically run the configure script
|
||||
for you.
|
||||
|
||||
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.
|
||||
|
||||
3. Compile and install the files. Simply type: make install
|
||||
|
||||
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
|
||||
|
||||
4. Setting up the server.
|
||||
|
||||
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/srm.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.
|
||||
|
||||
When you are finished making changes to your srm.conf file, you can
|
||||
start up your server.
|
||||
@@ -0,0 +1,70 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 2.01
|
||||
Copyright (c) 1999 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. Permission to freely distribute and use Zend as an integrated
|
||||
part of PHP is granted, under the conditions of version 0.91
|
||||
of the Zend License.
|
||||
The license is bundled with the Zend engine, and is available
|
||||
at http://www.zend.com/license/0_91.txt, or by contacting
|
||||
license@zend.com.
|
||||
|
||||
|
||||
|
||||
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 php-group@php.net.
|
||||
|
||||
For more information on the PHP Group and the PHP project,
|
||||
please see <http://www.php.net>.
|
||||
@@ -0,0 +1,20 @@
|
||||
Module Status
|
||||
------ ------
|
||||
MySQL Working
|
||||
COM Working
|
||||
WDDX Working
|
||||
PCRE Working
|
||||
DBA Working
|
||||
mcrypt Working
|
||||
mhash Working
|
||||
dbase Working
|
||||
aspell Working
|
||||
imap Working
|
||||
ldap Working
|
||||
oci8 Working (but no blob-support yet)
|
||||
oracle Working
|
||||
iptc Working
|
||||
informix Working
|
||||
zlib Working
|
||||
sysvshm Working
|
||||
odbc Working (except for persistent connections)
|
||||
+238
@@ -0,0 +1,238 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP HTML Embedded Scripting Language Version 4.0 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) 1997-1999 PHP Development Team (See Credits file) |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | This program is free software; you can redistribute it and/or modify |
|
||||
# | it under the terms of one of the following licenses: |
|
||||
# | |
|
||||
# | A) 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. |
|
||||
# | |
|
||||
# | B) the PHP License as published by the PHP Development Team and |
|
||||
# | included in the distribution in the file: LICENSE |
|
||||
# | |
|
||||
# | This program is distributed in the hope that it will be useful, |
|
||||
# | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
# | GNU General Public License for more details. |
|
||||
# | |
|
||||
# | You should have received a copy of both licenses referred to here. |
|
||||
# | If you did not, or have any questions about PHP licensing, please |
|
||||
# | contact core@php.net. |
|
||||
# +----------------------------------------------------------------------+
|
||||
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
bindir = @bindir@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ZEND_DIR = $(srcdir)/libzend
|
||||
SUBDIRS=libzend ext @TSRM_DIR@
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
LN_S = @LN_S@
|
||||
CC = @CC@
|
||||
AR = ar rc
|
||||
BINNAME = @BINNAME@
|
||||
INSTALL_IT = @INSTALL_IT@
|
||||
EXTRA_LIBS = @EXTRA_LIBS@
|
||||
EXT_LIBS = @EXT_LIBS@
|
||||
INCLUDES = @INCLUDES@
|
||||
INCLUDE = -I$(srcdir) -I. -I$(ZEND_DIR) -I$(srcdir)/TSRM $(INCLUDES)
|
||||
PROF_CFLAGS =
|
||||
CFLAGS_SHLIB = @CFLAGS_SHLIB@
|
||||
LDFLAGS_SHLIB = @LDFLAGS_SHLIB@
|
||||
LDFLAGS_SHLIB_EXPORT = @LDFLAGS_SHLIB_EXPORT@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CFLAGS = @CFLAGS@ $(CFLAGS_SHLIB) $(CPPFLAGS) $(INCLUDE) @DEBUG_CFLAGS@ @STRONGHOLD@ $(PROF_CFLAGS)
|
||||
LDFLAGS = @RPATHS@ @LDFLAGS@ $(LDFLAGS_SHLIB) $(LDFLAGS_SHLIB_EXPORT) -L$(ZEND_DIR)
|
||||
REGCFLAGS = $(CFLAGS)
|
||||
RANLIB = @RANLIB@
|
||||
YACC = @YACC@
|
||||
MAINT = @MAINT@
|
||||
APXS = @APXS@
|
||||
APXS_LDFLAGS = $(EXTRA_LIBS) $(LIBS)
|
||||
APXS_EXP = @APXS_EXP@
|
||||
WARNING_LEVEL = @WARNING_LEVEL@
|
||||
LEX_CFLAGS = -w$(WARNING_LEVEL) @LEX_CFLAGS@
|
||||
EXT_SHARED = @EXT_SHARED@
|
||||
|
||||
SOURCE = main.c internal_functions.c snprintf.c php3_sprintf.c \
|
||||
configuration-parser.c configuration-scanner.c request_info.c \
|
||||
safe_mode.c fopen-wrappers.c php3_realpath.c alloca.c output.c \
|
||||
php_ini.c SAPI.c cgi_main.c rfc1867.c dlist.c
|
||||
OBJS = main.o internal_functions.o snprintf.o php3_sprintf.o \
|
||||
configuration-parser.o configuration-scanner.o request_info.o \
|
||||
safe_mode.o fopen-wrappers.o php3_realpath.o alloca.o output.o \
|
||||
php_ini.o SAPI.o cgi_main.o rfc1867.o dlist.o
|
||||
|
||||
PHPLIBS = -Llibzend -lzend -Lext -lphpext
|
||||
LIBS = $(PHPLIBS) $(EXTRA_LIBS) @LIBS@
|
||||
|
||||
all: $(BINNAME)
|
||||
|
||||
all-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-depend-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
for subdir in $(SUBDIRS); do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) || fail=yes; \
|
||||
done && test -z "$$fail"
|
||||
|
||||
# CGI binary or fhttpd module
|
||||
php: all-recursive $(OBJS) @REGEX_LIB@ @FHTTPD_LIB@ @TSRM_LIB@
|
||||
$(CC) $(CFLAGS) -o $(BINNAME) $(LDFLAGS) $(OBJS) $(LIBS)
|
||||
|
||||
# Apache modules
|
||||
libphp4.a libmodphp4.a: all-recursive $(OBJS) @REGEX_LIB@
|
||||
$(AR) $@.tmp $(OBJS)
|
||||
$(srcdir)/scripts/armerge $@ $@.tmp ext/libphpext.a libzend/libzend.a @TSRM_LIB@
|
||||
@rm -f $@.tmp
|
||||
$(RANLIB) $(BINNAME)
|
||||
|
||||
# Apache modules
|
||||
libmodphp4-so.a: all-recursive $(OBJS) @REGEX_LIB@
|
||||
$(AR) $@.tmp $(OBJS)
|
||||
$(srcdir)/scripts/armerge $@ $@.tmp ext/libphpext.a libzend/libzend.a @TSRM_LIB@
|
||||
@rm -f $@.tmp
|
||||
$(RANLIB) libmodphp4-so.a
|
||||
|
||||
# Apache 1.3 shared module
|
||||
libphp4.so: $(srcdir)/mod_php4.c libmodphp4-so.a @REGEX_LIB@
|
||||
-@test -f ./mod_php4.c || test -L ./mod_php4.c || $(LN_S) $(srcdir)/mod_php4.c ./mod_php4.c
|
||||
-@test -f ./mod_php4.c || test -h ./mod_php4.c || $(LN_S) $(srcdir)/mod_php4.c ./mod_php4.c
|
||||
$(APXS) $(INCLUDE) -c -o libphp4.so @RPATHS@ ./mod_php4.c libmodphp4-so.a $(APXS_LDFLAGS) $(APXS_EXP)
|
||||
|
||||
regex/libregex.a:
|
||||
(cd regex; $(MAKE) lib)
|
||||
|
||||
configuration-parser.h configuration-parser.c: $(srcdir)/configuration-parser.y
|
||||
bison -p cfg -v -d $(srcdir)/configuration-parser.y -o configuration-parser.c
|
||||
|
||||
configuration-scanner.o: configuration-scanner.c
|
||||
$(CC) $(CFLAGS) $(LEX_CFLAGS) -c configuration-scanner.c
|
||||
|
||||
configuration-scanner.c: $(srcdir)/configuration-scanner.l
|
||||
flex -Pcfg -oconfiguration-scanner.c -i $(srcdir)/configuration-scanner.l
|
||||
|
||||
clean: clean-recursive
|
||||
-rm -f libphp4.a libmodphp4.a libphp4.so php *.o
|
||||
-rm -f test/php.desc test/php.in test/php.out test/php.test
|
||||
-rm -f test/a.tmp test/b.tmp test/test.dbm*
|
||||
|
||||
distclean: clean distclean-recursive
|
||||
-rm -f *-parser.[ch] *-scanner.c *.output
|
||||
-rm -f config.status config.cache config.log
|
||||
-rm -f Makefile Makefile.depend php_config.h build-defs.h
|
||||
-rm -f libphp4.module stamp-h buildconf.stamp
|
||||
-rm -f regex/*.o regex/*.a regex/*.ih
|
||||
-rm -f doc/checkdoc doc/funcparse doc/version.ent
|
||||
-rm -f do-conf test/test.log
|
||||
-rm -f doc/Makefile regex/Makefile
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
tar chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
|
||||
distdir:
|
||||
-rm -rf $(distdir)
|
||||
files=`echo *` ;\
|
||||
mkdir $(distdir) ;\
|
||||
for file in $$files ; do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file ; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
(cd $(distdir) ; $(MAKE) distclean)
|
||||
cd $(distdir)/libzend ;\
|
||||
flex -Pzend -ozend-scanner.c -i zend-scanner.l ;\
|
||||
bison -p zend -v -d zend-parser.y -o zend-parser.c
|
||||
cd $(distdir) ;\
|
||||
flex -Pcfg -oconfiguration-scanner.c -i configuration-scanner.l ;\
|
||||
bison -p cfg -v -d configuration-parser.y -o configuration-parser.c
|
||||
find $(distdir) -name CVS -o -name .cvsignore | xargs rm -rf
|
||||
|
||||
maintainer-clean-depend: maintainer-clean-depend-recursive
|
||||
|
||||
bench: $(BINNAME)
|
||||
./$(BINNAME) -c. tests/bench.phtml
|
||||
|
||||
# can't use a single rule for this because 'test' is a directory
|
||||
test: regression
|
||||
regression check: $(BINNAME)
|
||||
cd test && ./testall
|
||||
|
||||
config.status: configure
|
||||
./config.status --recheck
|
||||
|
||||
build-defs.h php_config.h: stamp-h
|
||||
stamp-h: php_config.h.in config.status
|
||||
CONFIG_FILES='build-defs.h stamp-h' ./config.status
|
||||
|
||||
Makefile: Makefile.in config.status
|
||||
CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
|
||||
|
||||
#
|
||||
# You must use '--enable-maintainer-mode' with configure to enable
|
||||
# these rules, which requires autoconf be installed.
|
||||
#
|
||||
configure: @MAINT@ configure.in aclocal.m4
|
||||
cd $(srcdir) && autoconf
|
||||
|
||||
php_config.h.in: @MAINT@ stamp-h.in
|
||||
stamp-h.in: configure.in aclocal.m4 acconfig.h
|
||||
cd ${srcdir} && autoheader && touch ${srcdir}/stamp-h.in
|
||||
|
||||
install: install-recursive $(BINNAME)
|
||||
$(INSTALL_IT)
|
||||
|
||||
install-recursive:
|
||||
if test "$(EXT_SHARED)" != ""; then \
|
||||
for dir in X $(EXT_SHARED); do \
|
||||
test -d ext/$$dir && (cd ext/$$dir; $(MAKE) install); \
|
||||
done; \
|
||||
fi
|
||||
|
||||
indent: clean
|
||||
indent -v -kr -cli4 -ts4 \
|
||||
-T pval -T HashTable -T Bucket -T Token -T TokenCache -T TokenCacheManager \
|
||||
-T switch_expr -T internal_function -T control_structure_data \
|
||||
-T MemoryHashTable -T MemoryBucket \
|
||||
-T pvalue_value -T Stack *.c *.h
|
||||
rm -f *~
|
||||
|
||||
.c.o:
|
||||
@rm -f $@
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
# @bn=`echo $@ | sed -e 's#functions/##'`; test -f $@ || \
|
||||
# (test "$@" != "$$bn" && test -f "$$bn" && mv $$bn $@)
|
||||
|
||||
parser-scanner: configuration-parser.c configuration-scanner.c
|
||||
|
||||
depend: parser-scanner
|
||||
$(CC) $(CFLAGS) -MM $(SOURCE) | perl -pe 's|regex/regex.h||;' > Makefile.depend
|
||||
$(CC) $(CFLAGS) -MM $(FUNCTIONS_SOURCE) | perl -pe 's|^(.+\.o)|functions/$$1|; s|regex/regex.h||;' >> Makefile.depend
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 4
|
||||
# End:
|
||||
@@ -0,0 +1,17 @@
|
||||
How to install PHP with the BCMath arbitrary precision math library?
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Due to license restrictions, the BC math library can no longer be distributed
|
||||
along with PHP. The BC math library is distributed under the restrictive
|
||||
GNU Public License, and PHP is no longer distributed under that license, but
|
||||
under a less restrictive license, the PHP License.
|
||||
|
||||
If you want to enable BC math support (recommended), all you have to do is
|
||||
simply download http://www.php.net/extra/number4.tar.gz, and untar it on the
|
||||
top level php4 directory.
|
||||
|
||||
A typical way of doing this would be (assuming that you have lynx):
|
||||
cd ~/php4
|
||||
lynx -dump -source http://www.php.net/extra/number4.tar.gz | gzip -d | tar xvf -
|
||||
|
||||
The PHP Group
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
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
|
||||
@@ -0,0 +1,4 @@
|
||||
## process this file with automake to produce Makefile.am
|
||||
AUTOMAKE_OPTIONS=foreign
|
||||
lib_LIBRARIES=libtsrm.a
|
||||
libtsrm_a_SOURCES = TSRM.c
|
||||
+392
@@ -0,0 +1,392 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Thread Safe Resource Manager |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to the Zend license, that is bundled |
|
||||
| with this package in the file LICENSE. If you did not receive a |
|
||||
| copy of the Zend license, please mail us at zend@zend.com so we can |
|
||||
| send you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "TSRM.h"
|
||||
#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;
|
||||
void (*ctor)(void *resource);
|
||||
void (*dtor)(void *resource);
|
||||
} tsrm_resource_type;
|
||||
|
||||
|
||||
/* The memory manager table */
|
||||
static tsrm_tls_entry **tsrm_tls_table;
|
||||
static int tsrm_tls_table_size;
|
||||
static ts_rsrc_id id_count;
|
||||
|
||||
/* The resource sizes table */
|
||||
static tsrm_resource_type *resource_types_table;
|
||||
static int resource_types_table_size;
|
||||
|
||||
|
||||
static MUTEX_T tsmm_mutex; /* thread-safe memory manager mutex */
|
||||
|
||||
/* Debug support */
|
||||
static int tsrm_debug(const char *format, ...);
|
||||
static int tsrm_debug_status;
|
||||
|
||||
|
||||
/* Startup TSRM (call once for the entire process) */
|
||||
TSRM_FUNC int tsrm_startup(int expected_threads, int expected_resources, int debug_status)
|
||||
{
|
||||
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) {
|
||||
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) {
|
||||
free(tsrm_tls_table);
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsmm_mutex = tsrm_mutex_alloc();
|
||||
|
||||
tsrm_debug_status = debug_status;
|
||||
|
||||
tsrm_debug("Started up TSRM, %d expected threads, %d expected resources\n", expected_threads, expected_resources);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Shutdown TSRM (call once for the entire process) */
|
||||
TSRM_FUNC void tsrm_shutdown()
|
||||
{
|
||||
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);
|
||||
}
|
||||
if (resource_types_table) {
|
||||
free(resource_types_table);
|
||||
}
|
||||
tsrm_mutex_free(tsmm_mutex);
|
||||
tsrm_debug("Shutdown TSRM\n");
|
||||
}
|
||||
|
||||
|
||||
/* allocates a new thread-safe-resource id */
|
||||
TSRM_FUNC ts_rsrc_id ts_allocate_id(size_t size, void (*ctor)(void *resource), void (*dtor)(void *resource))
|
||||
{
|
||||
ts_rsrc_id new_id;
|
||||
int i;
|
||||
|
||||
tsrm_debug("Obtaining a new resource id, %d bytes\n", size);
|
||||
|
||||
tsrm_mutex_lock(tsmm_mutex);
|
||||
|
||||
/* obtain a resource id */
|
||||
new_id = id_count++;
|
||||
tsrm_debug("Obtained resource id %d\n", new_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) {
|
||||
return -1;
|
||||
}
|
||||
resource_types_table_size = id_count;
|
||||
}
|
||||
resource_types_table[new_id].size = size;
|
||||
resource_types_table[new_id].ctor = ctor;
|
||||
resource_types_table[new_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->count = id_count;
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
|
||||
tsrm_debug("Successfully allocated new resource id %d\n", new_id);
|
||||
return new_id;
|
||||
}
|
||||
|
||||
|
||||
static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_T thread_id)
|
||||
{
|
||||
int i;
|
||||
|
||||
(*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;
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* fetches the requested resource for the current thread */
|
||||
void *ts_resource(ts_rsrc_id id)
|
||||
{
|
||||
THREAD_T thread_id = tsrm_thread_id();
|
||||
int hash_value;
|
||||
tsrm_tls_entry *thread_resources;
|
||||
void *resource;
|
||||
|
||||
tsrm_debug("Fetching resource id %d for thread %ld\n", 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);
|
||||
thread_resources = tsrm_tls_table[hash_value];
|
||||
} 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);
|
||||
thread_resources = thread_resources->next;
|
||||
break;
|
||||
}
|
||||
} while (thread_resources);
|
||||
}
|
||||
|
||||
resource = thread_resources->storage[id];
|
||||
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
|
||||
tsrm_debug("Successfully fetched resource id %d for thread id %ld - %x\n", id, (long) thread_id, (long) resource);
|
||||
return resource;
|
||||
}
|
||||
|
||||
|
||||
/* frees all resources allocated for the current thread */
|
||||
void ts_free_thread()
|
||||
{
|
||||
THREAD_T thread_id = tsrm_thread_id();
|
||||
int hash_value;
|
||||
tsrm_tls_entry *thread_resources;
|
||||
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) {
|
||||
int i;
|
||||
|
||||
for (i=0; i<thread_resources->count; i++) {
|
||||
if (resource_types_table[i].dtor) {
|
||||
resource_types_table[i].dtor(thread_resources->storage[i]);
|
||||
}
|
||||
free(thread_resources->storage[i]);
|
||||
}
|
||||
free(thread_resources->storage);
|
||||
if (last) {
|
||||
last->next = thread_resources->next;
|
||||
} else {
|
||||
tsrm_tls_table[hash_value]=NULL;
|
||||
}
|
||||
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_FUNC THREAD_T tsrm_thread_id(void)
|
||||
{
|
||||
#ifdef WIN32
|
||||
return GetCurrentThreadId();
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_self();
|
||||
#elif defined(NSAPI)
|
||||
return systhread_current();
|
||||
#elif defined(PI3WEB)
|
||||
return PIThread_getCurrent();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Allocate a mutex */
|
||||
TSRM_FUNC MUTEX_T tsrm_mutex_alloc( void )
|
||||
{
|
||||
MUTEX_T mutexp;
|
||||
|
||||
#ifdef WIN32
|
||||
mutexp = CreateMutex(NULL,FALSE,NULL);
|
||||
#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();
|
||||
#endif
|
||||
#ifdef THR_DEBUG
|
||||
printf("Mutex created thread: %d\n",mythreadid());
|
||||
#endif
|
||||
return( mutexp );
|
||||
}
|
||||
|
||||
|
||||
/* Free a mutex */
|
||||
TSRM_FUNC void tsrm_mutex_free( MUTEX_T mutexp )
|
||||
{
|
||||
if (mutexp) {
|
||||
#ifdef WIN32
|
||||
CloseHandle(mutexp);
|
||||
#elif defined(PTHREADS)
|
||||
free(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
crit_terminate(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
PISync_delete(mutexp)
|
||||
#endif
|
||||
}
|
||||
#ifdef THR_DEBUG
|
||||
printf("Mutex freed thread: %d\n",mythreadid());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Lock a mutex */
|
||||
TSRM_FUNC int tsrm_mutex_lock( MUTEX_T mutexp )
|
||||
{
|
||||
//tsrm_debug("Mutex locked thread: %ld\n",tsrm_thread_id());
|
||||
#ifdef WIN32
|
||||
return WaitForSingleObject(mutexp,1000);
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_mutex_lock(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
return crit_enter(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
return PISync_lock(mutexp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Unlock a mutex */
|
||||
TSRM_FUNC int tsrm_mutex_unlock( MUTEX_T mutexp )
|
||||
{
|
||||
//tsrm_debug("Mutex unlocked thread: %ld\n",tsrm_thread_id());
|
||||
#ifdef WIN32
|
||||
return ReleaseMutex(mutexp);
|
||||
#elif defined(PTHREADS)
|
||||
return pthread_mutex_unlock(mutexp);
|
||||
#elif defined(NSAPI)
|
||||
return crit_exit(mutexp);
|
||||
#elif defined(PI3WEB)
|
||||
return PISync_unlock(mutexp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Debug support
|
||||
*/
|
||||
|
||||
static int tsrm_debug(const char *format, ...)
|
||||
{
|
||||
if (tsrm_debug_status) {
|
||||
va_list args;
|
||||
int size;
|
||||
|
||||
va_start(args, format);
|
||||
size = vprintf(format, args);
|
||||
va_end(args);
|
||||
return size;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tsrm_debug_set(int status)
|
||||
{
|
||||
tsrm_debug_status = status;
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
# 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
|
||||
|
||||
# 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 "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D "_LIB" /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 "WIN32" /D "_MBCS" /D "_LIB" /D "TSRM_EXPORTS" /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"
|
||||
# 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
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TSRM.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Thread Safe Resource Manager |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to the Zend license, that is bundled |
|
||||
| with this package in the file LICENSE. If you did not receive a |
|
||||
| copy of the Zend license, please mail us at zend@zend.com so we can |
|
||||
| send you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _TSRM_H
|
||||
#define _TSRM_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "tsrm_config.h"
|
||||
#endif
|
||||
|
||||
#if WIN32||WINNT
|
||||
# include <windows.h>
|
||||
#elif defined(PTHREADS)
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
|
||||
typedef int ts_rsrc_id;
|
||||
|
||||
#if WIN32||WINNT
|
||||
# ifdef TSRM_EXPORTS
|
||||
# define TSRM_API __declspec(dllexport)
|
||||
# else
|
||||
# define TSRM_API __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# define TSRM_API
|
||||
#endif
|
||||
|
||||
|
||||
/* Define TSRM_FUNC */
|
||||
#ifdef __cplusplus
|
||||
#define TSRM_FUNC extern "C" TSRM_API
|
||||
#else
|
||||
#define TSRM_FUNC TSRM_API
|
||||
#endif
|
||||
|
||||
|
||||
/* Define THREAD_T and MUTEX_T */
|
||||
#if defined(WIN32)
|
||||
# define THREAD_T DWORD
|
||||
# define MUTEX_T void *
|
||||
#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 *
|
||||
#endif
|
||||
|
||||
|
||||
#define THREAD_HASH_OF(thr,ts) thr%ts
|
||||
|
||||
|
||||
/* startup/shutdown */
|
||||
TSRM_FUNC int tsrm_startup(int expected_threads, int expected_resources, int debug_status);
|
||||
TSRM_FUNC void tsrm_shutdown();
|
||||
|
||||
/* allocates a new thread-safe-resource id */
|
||||
TSRM_FUNC ts_rsrc_id ts_allocate_id(size_t size, void (*ctor)(void *resource), void (*dtor)(void *resource));
|
||||
|
||||
/* fetches the requested resource for the current thread */
|
||||
TSRM_FUNC void *ts_resource(ts_rsrc_id id);
|
||||
|
||||
/* frees all resources allocated for the current thread */
|
||||
TSRM_FUNC void ts_free_thread();
|
||||
|
||||
/* deallocates all occurrences of a given id */
|
||||
TSRM_FUNC void ts_free_id(ts_rsrc_id id);
|
||||
|
||||
|
||||
/* Debug support */
|
||||
TSRM_FUNC void tsrm_debug_set(int status);
|
||||
|
||||
/* utility functions */
|
||||
TSRM_FUNC THREAD_T tsrm_thread_id(void);
|
||||
TSRM_FUNC MUTEX_T tsrm_mutex_alloc(void);
|
||||
TSRM_FUNC void tsrm_mutex_free(MUTEX_T mutexp);
|
||||
TSRM_FUNC int tsrm_mutex_lock(MUTEX_T mutexp);
|
||||
TSRM_FUNC int tsrm_mutex_unlock(MUTEX_T mutexp);
|
||||
|
||||
#endif /* _TSRM_H */
|
||||
@@ -0,0 +1,7 @@
|
||||
#undef PTHREADS
|
||||
|
||||
#ifdef DEFINE_TSRM_VERSION
|
||||
# undef PACKAGE
|
||||
# undef VERSION
|
||||
#endif
|
||||
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
mv aclocal.m4 aclocal.m4.old 2>/dev/null
|
||||
aclocal
|
||||
if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
|
||||
echo keeping ${1}aclocal.m4
|
||||
mv aclocal.m4.old aclocal.m4
|
||||
else
|
||||
echo created or modified ${1}aclocal.m4
|
||||
fi
|
||||
|
||||
autoheader
|
||||
|
||||
automake --add-missing --include-deps
|
||||
|
||||
mv configure configure.old 2>/dev/null
|
||||
autoconf
|
||||
if cmp configure.old configure > /dev/null 2>&1; then
|
||||
echo keeping ${1}configure
|
||||
mv configure.old configure
|
||||
else
|
||||
echo created or modified ${1}configure
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl Minimalistic configure.in for TSRM.
|
||||
dnl
|
||||
|
||||
AC_INIT(TSRM.c)
|
||||
AM_INIT_AUTOMAKE(TSRM, 1.0)
|
||||
AM_CONFIG_HEADER(tsrm_config.h)
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CC_C_O
|
||||
AC_PROG_RANLIB
|
||||
|
||||
AC_CHECK_LIB(pthread, pthread_create, [
|
||||
AC_DEFINE(PTHREADS)
|
||||
LIBS="$LIBS -lpthread"
|
||||
],[
|
||||
AC_MSG_ERROR(You need pthreads to build TSRM.)
|
||||
])
|
||||
|
||||
AC_CHECK_HEADERS(stdarg.h)
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
// $Header$
|
||||
|
||||
// FlexLexer.h -- define interfaces for lexical analyzer classes generated
|
||||
// by flex
|
||||
|
||||
// Copyright (c) 1993 The Regents of the University of California.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This code is derived from software contributed to Berkeley by
|
||||
// Kent Williams and Tom Epperly.
|
||||
//
|
||||
// Redistribution and use in source and binary forms with or without
|
||||
// modification are permitted provided that: (1) source distributions retain
|
||||
// this entire copyright notice and comment, and (2) distributions including
|
||||
// binaries display the following acknowledgement: ``This product includes
|
||||
// software developed by the University of California, Berkeley and its
|
||||
// contributors'' in the documentation or other materials provided with the
|
||||
// distribution and in all advertising materials mentioning features or use
|
||||
// of this software. Neither the name of the University nor the names of
|
||||
// its contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
|
||||
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
// This file defines FlexLexer, an abstract class which specifies the
|
||||
// external interface provided to flex C++ lexer objects, and yyFlexLexer,
|
||||
// which defines a particular lexer class.
|
||||
//
|
||||
// If you want to create multiple lexer classes, you use the -P flag
|
||||
// to rename each yyFlexLexer to some other xxFlexLexer. You then
|
||||
// include <FlexLexer.h> in your other sources once per lexer class:
|
||||
//
|
||||
// #undef yyFlexLexer
|
||||
// #define yyFlexLexer xxFlexLexer
|
||||
// #include <FlexLexer.h>
|
||||
//
|
||||
// #undef yyFlexLexer
|
||||
// #define yyFlexLexer zzFlexLexer
|
||||
// #include <FlexLexer.h>
|
||||
// ...
|
||||
|
||||
#ifndef __FLEX_LEXER_H
|
||||
// Never included before - need to define base class.
|
||||
#define __FLEX_LEXER_H
|
||||
#include <iostream.h>
|
||||
|
||||
extern "C++" {
|
||||
|
||||
struct yy_buffer_state;
|
||||
typedef int yy_state_type;
|
||||
|
||||
class FlexLexer {
|
||||
public:
|
||||
virtual ~FlexLexer() { }
|
||||
|
||||
const char* YYText() { return yytext; }
|
||||
int YYLeng() { return yyleng; }
|
||||
|
||||
virtual void
|
||||
yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
|
||||
virtual struct yy_buffer_state*
|
||||
yy_create_buffer( istream* s, int size ) = 0;
|
||||
virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
|
||||
virtual void yyrestart( istream* s ) = 0;
|
||||
|
||||
virtual int yylex() = 0;
|
||||
|
||||
// Call yylex with new input/output sources.
|
||||
int yylex( istream* new_in, ostream* new_out = 0 )
|
||||
{
|
||||
switch_streams( new_in, new_out );
|
||||
return yylex();
|
||||
}
|
||||
|
||||
// Switch to new input/output streams. A nil stream pointer
|
||||
// indicates "keep the current one".
|
||||
virtual void switch_streams( istream* new_in = 0,
|
||||
ostream* new_out = 0 ) = 0;
|
||||
|
||||
int lineno() const { return yylineno; }
|
||||
|
||||
int debug() const { return yy_flex_debug; }
|
||||
void set_debug( int flag ) { yy_flex_debug = flag; }
|
||||
|
||||
protected:
|
||||
char* yytext;
|
||||
int yyleng;
|
||||
int yylineno; // only maintained if you use %option yylineno
|
||||
int yy_flex_debug; // only has effect with -d or "%option debug"
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
|
||||
// Either this is the first time through (yyFlexLexerOnce not defined),
|
||||
// or this is a repeated include to define a different flavor of
|
||||
// yyFlexLexer, as discussed in the flex man page.
|
||||
#define yyFlexLexerOnce
|
||||
|
||||
class yyFlexLexer : public FlexLexer {
|
||||
public:
|
||||
// arg_yyin and arg_yyout default to the cin and cout, but we
|
||||
// only make that assignment when initializing in yylex().
|
||||
yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 );
|
||||
|
||||
virtual ~yyFlexLexer();
|
||||
|
||||
void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
|
||||
struct yy_buffer_state* yy_create_buffer( istream* s, int size );
|
||||
void yy_delete_buffer( struct yy_buffer_state* b );
|
||||
void yyrestart( istream* s );
|
||||
|
||||
virtual int yylex();
|
||||
virtual void switch_streams( istream* new_in, ostream* new_out );
|
||||
|
||||
protected:
|
||||
virtual int LexerInput( char* buf, int max_size );
|
||||
virtual void LexerOutput( const char* buf, int size );
|
||||
virtual void LexerError( const char* msg );
|
||||
|
||||
void yyunput( int c, char* buf_ptr );
|
||||
int yyinput();
|
||||
|
||||
void yy_load_buffer_state();
|
||||
void yy_init_buffer( struct yy_buffer_state* b, istream* s );
|
||||
void yy_flush_buffer( struct yy_buffer_state* b );
|
||||
|
||||
int yy_start_stack_ptr;
|
||||
int yy_start_stack_depth;
|
||||
int* yy_start_stack;
|
||||
|
||||
void yy_push_state( int new_state );
|
||||
void yy_pop_state();
|
||||
int yy_top_state();
|
||||
|
||||
yy_state_type yy_get_previous_state();
|
||||
yy_state_type yy_try_NUL_trans( yy_state_type current_state );
|
||||
int yy_get_next_buffer();
|
||||
|
||||
istream* yyin; // input source for default LexerInput
|
||||
ostream* yyout; // output sink for default LexerOutput
|
||||
|
||||
struct yy_buffer_state* yy_current_buffer;
|
||||
|
||||
// yy_hold_char holds the character lost when yytext is formed.
|
||||
char yy_hold_char;
|
||||
|
||||
// Number of characters read into yy_ch_buf.
|
||||
int yy_n_chars;
|
||||
|
||||
// Points to current character in buffer.
|
||||
char* yy_c_buf_p;
|
||||
|
||||
int yy_init; // whether we need to initialize
|
||||
int yy_start; // start state number
|
||||
|
||||
// Flag which is used to allow yywrap()'s to do buffer switches
|
||||
// instead of setting up a fresh yyin. A bit of a hack ...
|
||||
int yy_did_buffer_switch_on_eof;
|
||||
|
||||
// The following are not always needed, but may be depending
|
||||
// on use of certain flex features (like REJECT or yymore()).
|
||||
|
||||
yy_state_type yy_last_accepting_state;
|
||||
char* yy_last_accepting_cpos;
|
||||
|
||||
yy_state_type* yy_state_buf;
|
||||
yy_state_type* yy_state_ptr;
|
||||
|
||||
char* yy_full_match;
|
||||
int* yy_full_state;
|
||||
int yy_full_lp;
|
||||
|
||||
int yy_lp;
|
||||
int yy_looking_for_trail_begin;
|
||||
|
||||
int yy_more_flag;
|
||||
int yy_more_len;
|
||||
int yy_more_offset;
|
||||
int yy_prev_more_offset;
|
||||
};
|
||||
|
||||
#endif
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
---------------------------------------------------------------------------
|
||||
The Zend License, version 0.91
|
||||
Copyright (C) 1999 Andi Gutmans & Zeev Suraski
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
The Zend scripting engine library is a product of Andi Gutmans and
|
||||
Zeev Suraski. It may be used and/or distributed under the terms of the
|
||||
Q Public License (QPL) version 1.0, enclosed below.
|
||||
|
||||
For more information about Zend please visit http://www.zend.com/
|
||||
For license related questions please mail license@zend.com
|
||||
|
||||
===========================================================================
|
||||
|
||||
THE Q PUBLIC LICENSE
|
||||
version 1.0
|
||||
|
||||
Copyright (C) 1999 Troll Tech AS, Norway.
|
||||
Everyone is permitted to copy and
|
||||
distribute this license document.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
===========================================================================
|
||||
@@ -0,0 +1,26 @@
|
||||
## Process this file with automake to produce Makefile.in -*- makefile -*-
|
||||
|
||||
#CLEANFILES = zend-parser.c zend-parser.h zend-scanner.c zend-parser.output
|
||||
|
||||
AUTOMAKE_OPTIONS=foreign
|
||||
noinst_LIBRARIES=libzend.a
|
||||
libzend_a_SOURCES=\
|
||||
zend-parser.y zend-scanner.l \
|
||||
zend_alloc.c zend_compile.c zend_constants.c \
|
||||
zend_execute.c zend_execute_API.c zend_highlight.c zend_llist.c \
|
||||
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
|
||||
|
||||
# automake isn't too clever about "non-standard" use of lex and yacc
|
||||
|
||||
zend-scanner.c: zend-scanner.l
|
||||
$(LEX) -Pzend -ozend-scanner.c -i $(srcdir)/zend-scanner.l
|
||||
|
||||
zend-scanner.cc: zend-scanner.l
|
||||
$(LEX) -+ -S$(srcdir)/flex.skl -Pzend -ozend-scanner.cc -i $(srcdir)/zend-scanner.l
|
||||
|
||||
zend-parser.h: zend-parser.c
|
||||
zend-parser.c: zend-parser.y
|
||||
$(YACC) -p zend -v -d $(srcdir)/zend-parser.y -o zend-parser.c
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
Improvements
|
||||
------------
|
||||
|
||||
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:
|
||||
|
||||
* 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).
|
||||
|
||||
|
||||
Incompatabilities
|
||||
-----------------
|
||||
|
||||
Zend 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 existant, 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.
|
||||
|
||||
* 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.
|
||||
|
||||
* 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.
|
||||
|
||||
* 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.
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
# Microsoft Developer Studio Generated Dependency File, included by ZendCore.mak
|
||||
|
||||
.\zend_alloc.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_llist.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\alloca.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_compile.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_llist.h"\
|
||||
".\modules.h"\
|
||||
".\zend_operators.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_API.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
".\zend_ini.h"\
|
||||
|
||||
|
||||
.\zend_constants.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend_constants.h"\
|
||||
".\zend_operators.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_execute.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend_constants.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_llist.h"\
|
||||
".\modules.h"\
|
||||
".\zend_operators.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_API.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
".\zend_ini.h"\
|
||||
|
||||
|
||||
.\zend_highlight.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_highlight.h"\
|
||||
".\zend_llist.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend-parser.tab.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_llist.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend_llist.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_opcode.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_llist.h"\
|
||||
".\modules.h"\
|
||||
".\zend_operators.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_API.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
".\zend_ini.h"\
|
||||
|
||||
|
||||
.\zend_operators.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_llist.h"\
|
||||
".\zend_operators.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_ptr_stack.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_stack.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_variables.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend_constants.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_llist.h"\
|
||||
".\modules.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_API.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
".\zend_ini.h"\
|
||||
".\zend_list.h"\
|
||||
|
||||
|
||||
.\zend.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend_operators.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_API.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\zend_compile.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend_constants.h"\
|
||||
".\zend_execute.h"\
|
||||
".\zend_llist.h"\
|
||||
".\modules.h"\
|
||||
".\zend_operators.h"\
|
||||
".\zend_ptr_stack.h"\
|
||||
".\zend_stack.h"\
|
||||
".\zend_variables.h"\
|
||||
".\zend.h"\
|
||||
".\zend_API.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_globals.h"\
|
||||
".\zend_hash.h"\
|
||||
".\zend_ini.h"\
|
||||
".\zend_list.h"\
|
||||
|
||||
|
||||
.\zend_hash.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
|
||||
|
||||
.\zend_ini.c : \
|
||||
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\zend_alloc.h"\
|
||||
".\config.w32.h"\
|
||||
".\zend.h"\
|
||||
".\zend_errors.h"\
|
||||
".\zend_hash.h"\
|
||||
".\zend_ini.h"\
|
||||
|
||||
|
||||
!IF "$(CFG)" == "ZendCore - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "ZendCore - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "ZendCore - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "ZendCore - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/* This is the default configuration file to read */
|
||||
#define USE_CONFIG_FILE 1
|
||||
|
||||
/* these are defined by automake */
|
||||
#undef PACKAGE
|
||||
#undef VERSION
|
||||
|
||||
/* define uint by configure if it is missed (QNX and BSD derived) */
|
||||
#undef uint
|
||||
|
||||
/* define ulong by configure if it is missed (most probably is) */
|
||||
#undef ulong
|
||||
|
||||
/* type check for in_addr_t */
|
||||
#undef in_addr_t
|
||||
|
||||
/* Define if you have dirent.h but opendir() resides in libc rather than in libdir */
|
||||
/* This will cause HAVE_DIRENT_H defined twice sometimes, but it should be problem */
|
||||
#define HAVE_DIRENT_H 0
|
||||
|
||||
/* Define if you have struct flock */
|
||||
#define HAVE_STRUCT_FLOCK 0
|
||||
|
||||
/* Define if you have the resolv library (-lresolv). */
|
||||
#define HAVE_LIBRESOLV 0
|
||||
|
||||
/* Undefine if you want stricter XML/SGML compliance by default */
|
||||
/* (this disables "<?expression?>" by default) */
|
||||
#define T_DEFAULT_SHORT_OPEN_TAG 1
|
||||
|
||||
/* Define both of these if you want the bundled REGEX library */
|
||||
#define REGEX 0
|
||||
#define HSREGEX 0
|
||||
|
||||
/* Define if you have libdl (used for dynamic linking) */
|
||||
#define HAVE_LIBDL 0
|
||||
|
||||
#undef ZEND_DEBUG
|
||||
|
||||
/* Define if you want to enable bc style precision math support */
|
||||
#define WITH_BCMATH 0
|
||||
|
||||
/* Define if you want to enable memory limit support */
|
||||
#define MEMORY_LIMIT 0
|
||||
|
||||
/* Define if you have broken sprintf function like SunOS 4 */
|
||||
#define BROKEN_SPRINTF 0
|
||||
|
||||
/* Define to compile Zend thread safe */
|
||||
#undef ZTS
|
||||
@@ -0,0 +1,20 @@
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl This file contains local autoconf functions.
|
||||
|
||||
dnl
|
||||
dnl Check for broken sprintf()
|
||||
dnl
|
||||
AC_DEFUN(AC_BROKEN_SPRINTF,[
|
||||
AC_MSG_CHECKING([for broken sprintf])
|
||||
AC_TRY_RUN([main() { char buf[20]; exit (sprintf(buf,"testing 123")!=11); }],[
|
||||
AC_DEFINE(BROKEN_SPRINTF,0)
|
||||
AC_MSG_RESULT(ok)
|
||||
],[
|
||||
AC_DEFINE(BROKEN_SPRINTF,1)
|
||||
AC_MSG_RESULT(broken)
|
||||
],[
|
||||
AC_DEFINE(BROKEN_SPRINTF,0)
|
||||
AC_MSG_RESULT(cannot check, guessing ok)
|
||||
])
|
||||
])
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef _CONFIG_UNIX_H
|
||||
#define _CONFIG_UNIX_H
|
||||
|
||||
#define ZEND_API
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIBDL
|
||||
# include <dlfcn.h>
|
||||
# define DL_LOAD(libname) dlopen(libname, RTLD_NOW)
|
||||
# define DL_UNLOAD dlclose
|
||||
# define DL_FETCH_SYMBOL dlsym
|
||||
# define DL_HANDLE void *
|
||||
# define ZEND_EXTENSIONS_SUPPORT 1
|
||||
#else
|
||||
# define DL_HANDLE void *
|
||||
# define ZEND_EXTENSIONS_SUPPORT 0
|
||||
#endif
|
||||
|
||||
#if BROKEN_SPRINTF
|
||||
int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#else
|
||||
# define zend_sprintf sprintf
|
||||
#endif
|
||||
|
||||
#if ZEND_DEBUG
|
||||
# define inline
|
||||
#endif
|
||||
|
||||
#endif /* _CONFIG_UNIX_H */
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ZEND_CONFIG_W32_H
|
||||
#define _ZEND_CONFIG_W32_H
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
typedef unsigned long ulong;
|
||||
typedef unsigned int uint;
|
||||
|
||||
#define HAVE_ALLOCA 1
|
||||
#include <malloc.h>
|
||||
|
||||
#define HAVE_DIRENT_H 0
|
||||
|
||||
#define HAVE_KILL 0
|
||||
#define HAVE_GETPID 1
|
||||
|
||||
#ifdef inline
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
#define zend_sprintf sprintf
|
||||
|
||||
/* Visual C++ doesn't really work with inline for C */
|
||||
#define inline
|
||||
|
||||
|
||||
#define DL_LOAD(libname) LoadLibrary(libname)
|
||||
#define DL_FETCH_SYMBOL GetProcAddress
|
||||
#define DL_UNLOAD FreeLibrary
|
||||
#define DL_HANDLE HMODULE
|
||||
#define ZEND_EXTENSIONS_SUPPORT 1
|
||||
|
||||
#ifdef LIBZEND_EXPORTS
|
||||
# define ZEND_API __declspec(dllexport)
|
||||
#else
|
||||
# define ZEND_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#endif /* _ZEND_CONFIG_W32_H */
|
||||
@@ -0,0 +1,154 @@
|
||||
dnl $Id$
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_INIT(zend.c)
|
||||
AM_INIT_AUTOMAKE(zend, 0.80A)
|
||||
AM_CONFIG_HEADER(zend_config.h)
|
||||
AM_SANITY_CHECK
|
||||
AM_MAINTAINER_MODE
|
||||
ZEND_VERSION=$VERSION
|
||||
|
||||
dnl We want this one before the checks, so the checks can modify CFLAGS.
|
||||
test -z "$CFLAGS" && auto_cflags=1
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_YACC
|
||||
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/\./ /'`
|
||||
if test "$1" = "1" -a "$2" -lt "25"; then
|
||||
AC_MSG_WARN(You will need bison 1.25 if you want to regenerate the Zend parser (found $1.$2).)
|
||||
fi
|
||||
AC_MSG_RESULT($1.$2 (ok))
|
||||
fi
|
||||
AC_PROG_CC
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_CC_C_O
|
||||
AM_PROG_LEX
|
||||
|
||||
dnl Hack to work around a Mac OS X cpp problem
|
||||
dnl Known versions needing this workaround are 5.3 and 5.4
|
||||
if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then
|
||||
CPPFLAGS="$CPPFLAGS -traditional-cpp"
|
||||
fi
|
||||
|
||||
dnl Ugly hack to get around a problem with gcc on AIX.
|
||||
if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \
|
||||
"`uname -sv`" = "AIX 4"; then
|
||||
CFLAGS=`echo $CFLAGS | sed -e 's/-g//'`
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary
|
||||
dnl and source packages. This should be harmless on other OSs.
|
||||
dnl
|
||||
if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
|
||||
CFLAGS="$CFLAGS -I/usr/pkg/include"
|
||||
LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB(c, dlopen, [
|
||||
# fake it
|
||||
AC_DEFINE(HAVE_LIBDL) ], [
|
||||
AC_CHECK_LIB(dl, dlopen, [
|
||||
LIBS="-ldl $LIBS"
|
||||
AC_DEFINE(HAVE_LIBDL) ], []) ])
|
||||
|
||||
dnl The sin may be in a library which need not be specifed
|
||||
dnl as well as res_search resides in libsocket
|
||||
AC_CHECK_LIB(c, sin, [:], [
|
||||
AC_CHECK_LIB(m, sin) ])
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
dnl In QNX opendir resides in libc but dirent.h is still required
|
||||
if test "`uname -s 2>/dev/null`" != "QNX"; then
|
||||
AC_HEADER_DIRENT
|
||||
else
|
||||
AC_CHECK_HEADERS(dirent.h)
|
||||
fi
|
||||
dnl QNX requires unix.h to allow functions in libunix to work properly
|
||||
AC_CHECK_HEADERS(fcntl.h unistd.h crypt.h sys/file.h memory.h pwd.h grp.h sys/socket.h sys/wait.h syslog.h string.h sys/varargs.h stdarg.h sys/resource.h sys/time.h signal.h netinet/in.h dlfcn.h limits.h sys/types.h sys/statvfs.h sys/statfs.h unix.h db.h ndbm.h)
|
||||
|
||||
dnl Checks for types
|
||||
AC_TYPE_SIZE_T
|
||||
|
||||
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 )
|
||||
|
||||
AC_CHECK_SIZEOF(void *, 4)
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS(memcpy memmove strdup strerror strcasecmp strstr flock lockf putenv tempnam usleep setlocale gettimeofday setvbuf srand48 lrand48 srandom random link symlink regcomp getlogin cuserid vsnprintf snprintf gcvt utime crypt setitimer rint unsetenv strftime setsockopt tzset statvfs statfs inet_aton getpid kill)
|
||||
AC_FUNC_UTIME_NULL
|
||||
AC_FUNC_ALLOCA
|
||||
AC_BROKEN_SPRINTF
|
||||
AC_REPLACE_FUNCS(getopt)
|
||||
|
||||
AC_MSG_CHECKING(whether to include debugging symbols)
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --disable-debug Compile without debugging symbols],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(ZEND_DEBUG,1)
|
||||
DEBUG_CFLAGS="-g"
|
||||
test -n "$GCC" && DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall"
|
||||
test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \
|
||||
DEBUG_CFLAGS="$DEBUG_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(ZEND_DEBUG,0)
|
||||
DEBUG_CFLAGS=""
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(ZEND_DEBUG,1)
|
||||
DEBUG_CFLAGS="-g"
|
||||
])
|
||||
AC_SUBST(DEBUG_CFLAGS)
|
||||
CFLAGS="$CFLAGS $DEBUG_CFLAGS"
|
||||
|
||||
AC_MSG_CHECKING(whether to enable a memory limit)
|
||||
AC_ARG_ENABLE(memory-limit,
|
||||
[ --enable-memory-limit Compile with memory limit support. ],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(MEMORY_LIMIT, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_DEFINE(MEMORY_LIMIT, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(MEMORY_LIMIT, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to build Zend thread-safe)
|
||||
AC_ARG_ENABLE(thread-safety,
|
||||
[ --enable-thread-safety Whether to build Zend thread-safe.],[
|
||||
AC_DEFINE(ZTS)
|
||||
AC_MSG_RESULT(yes)
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
AC_SUBST(TSRM_DIR)
|
||||
AC_SUBST(TSRM_LIB)
|
||||
|
||||
AC_SUBST(CFLAGS_SHLIB)
|
||||
AC_SUBST(LDFLAGS_SHLIB)
|
||||
AC_SUBST(LDFLAGS_SHLIB_EXPORT)
|
||||
|
||||
AC_OUTPUT(Makefile, [], [])
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 4
|
||||
# End:
|
||||
+1541
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,363 @@
|
||||
# Microsoft Developer Studio Project File - Name="libzend" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=libzend - Win32 Debug
|
||||
!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 "libzend.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 "libzend.mak" CFG="libzend - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "libzend - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "libzend - Win32 Debug" (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)" == "libzend - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# 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 "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# 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)" == "libzend - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /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 "_LIB" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=1 /FR /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
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "libzend - Win32 Release"
|
||||
# Name "libzend - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend-parser.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend-scanner.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_alloc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_API.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_compile.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_constants.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute_API.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_extensions.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_hash.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_highlight.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_indent.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_list.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_llist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_opcode.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_operators.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ptr_stack.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_sprintf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_stack.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_variables.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\config.w32.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FlexLexer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\modules.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend-parser.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend-scanner.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_alloc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_API.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_compile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_constants.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_errors.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_extensions.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_globals.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_hash.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_highlight.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_indent.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_list.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_llist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_operators.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ptr_stack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_stack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_variables.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Parsers"
|
||||
|
||||
# PROP Default_Filter "y"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend-parser.y"
|
||||
|
||||
!IF "$(CFG)" == "libzend - Win32 Release"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=".\zend-parser.y"
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend-parser.c -v -d -S "C:\Program Files\Cygnus\share\bison.simple" -p zend zend-parser.y
|
||||
|
||||
"$(InputDir)\zend-parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend-parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "libzend - Win32 Debug"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=".\zend-parser.y"
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend-parser.c -v -d -S "C:\Program Files\Cygnus\share\bison.simple" -p zend zend-parser.y
|
||||
|
||||
"$(InputDir)\zend-parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend-parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Scanners"
|
||||
|
||||
# PROP Default_Filter "l"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend-scanner.l"
|
||||
|
||||
!IF "$(CFG)" == "libzend - Win32 Release"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=".\zend-scanner.l"
|
||||
|
||||
"zend-scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -i -Pzend -ozend-scanner.c zend-scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "libzend - Win32 Debug"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=".\zend-scanner.l"
|
||||
|
||||
"zend-scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -i -Pzend -ozend-scanner.c zend-scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Text Files"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ZEND_BUGS
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ZEND_CHANGES
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ZEND_TODO
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resources"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend.ico
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,363 @@
|
||||
# Microsoft Developer Studio Project File - Name="libzendts" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=libzendts - 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 "libzendts.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 "libzendts.mak" CFG="libzendts - Win32 Debug_TS"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "libzendts - Win32 Release_TS" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "libzendts - Win32 Debug_TS" (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)" == "libzendts - Win32 Release_TS"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Output_Dir "Release_TS"
|
||||
# PROP BASE Intermediate_Dir "Release_TS"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 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_TS" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x40d /d "NDebug_TS"
|
||||
# ADD RSC /l 0x40d /d "NDebug_TS"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "libzendts - Win32 Debug_TS"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Output_Dir "Debug_TS"
|
||||
# PROP BASE Intermediate_Dir "Debug_TS"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Output_Dir "Debug_TS"
|
||||
# PROP Intermediate_Dir "Debug_TS"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug_TS" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug_TS" /D "_LIB" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D "ZTS" /D ZEND_DEBUG=1 /FR /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x40d /d "_Debug_TS"
|
||||
# ADD RSC /l 0x40d /d "_Debug_TS"
|
||||
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 "libzendts - Win32 Release_TS"
|
||||
# Name "libzendts - Win32 Debug_TS"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend-parser.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend-scanner.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_alloc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_API.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_compile.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_constants.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute_API.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_extensions.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_hash.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_highlight.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_indent.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_list.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_llist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_opcode.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_operators.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ptr_stack.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_sprintf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_stack.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_variables.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\config.w32.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FlexLexer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\modules.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend-parser.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend-scanner.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_alloc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_API.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_compile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_constants.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_errors.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_extensions.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_globals.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_hash.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_highlight.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_indent.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_list.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_llist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_operators.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ptr_stack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_stack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_variables.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Parsers"
|
||||
|
||||
# PROP Default_Filter "y"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend-parser.y"
|
||||
|
||||
!IF "$(CFG)" == "libzendts - Win32 Release_TS"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=".\zend-parser.y"
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend-parser.c -v -d -S "C:\Program Files\Cygnus\share\bison.simple" -p zend zend-parser.y
|
||||
|
||||
"$(InputDir)\zend-parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend-parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "libzendts - Win32 Debug_TS"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=.
|
||||
InputPath=".\zend-parser.y"
|
||||
|
||||
BuildCmds= \
|
||||
bison --output=zend-parser.c -v -d -S "C:\Program Files\Cygnus\share\bison.simple" -p zend zend-parser.y
|
||||
|
||||
"$(InputDir)\zend-parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(InputDir)\zend-parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Scanners"
|
||||
|
||||
# PROP Default_Filter "l"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend-scanner.l"
|
||||
|
||||
!IF "$(CFG)" == "libzendts - Win32 Release_TS"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=".\zend-scanner.l"
|
||||
|
||||
"zend-scanner.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -+ -i -Sflex.skl -Pzend -ozend-scanner.cpp zend-scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "libzendts - Win32 Debug_TS"
|
||||
|
||||
# Begin Custom Build
|
||||
InputPath=".\zend-scanner.l"
|
||||
|
||||
"zend-scanner.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
flex -+ -i -Sflex.skl -Pzend -ozend-scanner.cpp zend-scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Text Files"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LICENSE
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ZEND_BUGS
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ZEND_CHANGES
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resources"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend.ico
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,658 @@
|
||||
%{
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/*
|
||||
* LALR shift/reduce conflicts and how they are resolved:
|
||||
*
|
||||
* - 2 shift/reduce conflicts due to the dangeling elseif/else ambiguity. Solved by shift.
|
||||
* - 1 shift/reduce conflict due to arrays within encapsulated strings. Solved by shift.
|
||||
* - 1 shift/reduce conflict due to objects within encapsulated strings. Solved by shift.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "zend_compile.h"
|
||||
#include "zend.h"
|
||||
#include "zend_list.h"
|
||||
#include "zend_globals.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_variables.h"
|
||||
#include "zend_operators.h"
|
||||
|
||||
|
||||
#define YYERROR_VERBOSE
|
||||
|
||||
%}
|
||||
|
||||
%pure_parser
|
||||
%expect 4
|
||||
|
||||
%left T_INCLUDE T_EVAL
|
||||
%left ','
|
||||
%left T_LOGICAL_OR
|
||||
%left T_LOGICAL_XOR
|
||||
%left T_LOGICAL_AND
|
||||
%right T_PRINT
|
||||
%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL XT_OR_EQUAL T_SL_EQUAL T_SR_EQUAL
|
||||
%left '?' ':'
|
||||
%left T_BOOLEAN_OR
|
||||
%left T_BOOLEAN_AND
|
||||
%left '|'
|
||||
%left '^'
|
||||
%left '&'
|
||||
%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL
|
||||
%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
|
||||
%left T_SL T_SR
|
||||
%left '+' '-' '.'
|
||||
%left '*' '/' '%'
|
||||
%right '!' '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST '@'
|
||||
%right '['
|
||||
%nonassoc T_NEW
|
||||
%token T_EXIT
|
||||
%token T_IF
|
||||
%left T_ELSEIF
|
||||
%left T_ELSE
|
||||
%left T_ENDIF
|
||||
%token T_LNUMBER
|
||||
%token T_DNUMBER
|
||||
%token T_STRING
|
||||
%token T_STRING_VARNAME
|
||||
%token T_VARIABLE
|
||||
%token T_NUM_STRING
|
||||
%token T_INLINE_HTML
|
||||
%token T_CHARACTER
|
||||
%token T_BAD_CHARACTER
|
||||
%token T_ENCAPSED_AND_WHITESPACE
|
||||
%token T_CONSTANT_ENCAPSED_STRING
|
||||
%token T_ECHO
|
||||
%token T_DO
|
||||
%token T_WHILE
|
||||
%token T_ENDWHILE
|
||||
%token T_FOR
|
||||
%token T_ENDFOR
|
||||
%token T_FOREACH
|
||||
%token T_ENDFOREACH
|
||||
%token T_AS
|
||||
%token T_SWITCH
|
||||
%token T_ENDSWITCH
|
||||
%token T_CASE
|
||||
%token T_DEFAULT
|
||||
%token T_BREAK
|
||||
%token T_CONTINUE
|
||||
%token T_OLD_FUNCTION
|
||||
%token T_FUNCTION
|
||||
%token T_CONST
|
||||
%token T_RETURN
|
||||
%token T_REQUIRE
|
||||
%token T_GLOBAL
|
||||
%token T_STATIC
|
||||
%token T_VAR
|
||||
%token T_UNSET
|
||||
%token T_ISSET
|
||||
%token T_EMPTY
|
||||
%token T_CLASS
|
||||
%token T_EXTENDS
|
||||
%token T_OBJECT_OPERATOR
|
||||
%token T_DOUBLE_ARROW
|
||||
%token T_LIST
|
||||
%token T_ARRAY
|
||||
%token T_LINE
|
||||
%token T_FILE
|
||||
%token T_COMMENT
|
||||
%token T_ML_COMMENT
|
||||
%token T_OPEN_TAG
|
||||
%token T_OPEN_TAG_WITH_ECHO
|
||||
%token T_CLOSE_TAG
|
||||
%token T_WHITESPACE
|
||||
%token T_HEREDOC
|
||||
%token T_DOLLAR_OPEN_CURLY_BRACES
|
||||
%token T_CURLY_OPEN
|
||||
%token T_PAAMAYIM_NEKUDOTAYIM
|
||||
%token T_PHP_TRACK_VARS
|
||||
|
||||
%% /* Rules */
|
||||
|
||||
top_statement_list:
|
||||
top_statement_list { do_extended_info(CLS_C); } top_statement { ELS_FETCH(); HANDLE_INTERACTIVE(); }
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
|
||||
top_statement:
|
||||
statement
|
||||
| declaration_statement { do_early_binding(CLS_C); }
|
||||
;
|
||||
|
||||
|
||||
inner_statement_list:
|
||||
inner_statement_list { do_extended_info(CLS_C); } inner_statement { ELS_FETCH(); HANDLE_INTERACTIVE(); }
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
|
||||
inner_statement:
|
||||
statement
|
||||
| declaration_statement
|
||||
;
|
||||
|
||||
|
||||
statement:
|
||||
'{' inner_statement_list '}'
|
||||
| T_IF '(' expr ')' { do_if_cond(&$3, &$4 CLS_CC); } statement { do_if_after_statement(&$4, 1 CLS_CC); } elseif_list else_single { do_if_end(CLS_C); }
|
||||
| T_IF '(' expr ')' ':' { do_if_cond(&$3, &$4 CLS_CC); } inner_statement_list { do_if_after_statement(&$4, 1 CLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { do_if_end(CLS_C); }
|
||||
| T_WHILE '(' { $1.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' { do_while_cond(&$4, &$5 CLS_CC); } while_statement { do_while_end(&$1, &$5 CLS_CC); }
|
||||
| T_DO { $1.u.opline_num = get_next_op_number(CG(active_op_array)); do_do_while_begin(CLS_C); } statement T_WHILE '(' expr ')' ';' { do_do_while_end(&$1, &$6 CLS_CC); }
|
||||
| T_FOR
|
||||
'('
|
||||
for_expr
|
||||
';' { do_free(&$3 CLS_CC); $4.u.opline_num = get_next_op_number(CG(active_op_array)); }
|
||||
for_expr
|
||||
';' { do_for_cond(&$6, &$7 CLS_CC); }
|
||||
for_expr
|
||||
')' { do_free(&$9 CLS_CC); do_for_before_statement(&$4, &$7 CLS_CC); }
|
||||
for_statement { do_for_end(&$7 CLS_CC); }
|
||||
| T_SWITCH '(' expr ')' { do_switch_cond(&$3 CLS_CC); } switch_case_list { do_switch_end(&$6 CLS_CC); }
|
||||
| T_BREAK ';' { do_brk_cont(ZEND_BRK, NULL CLS_CC); }
|
||||
| T_BREAK expr ';' { do_brk_cont(ZEND_BRK, &$2 CLS_CC); }
|
||||
| T_CONTINUE ';' { do_brk_cont(ZEND_CONT, NULL CLS_CC); }
|
||||
| T_CONTINUE expr ';' { do_brk_cont(ZEND_CONT, &$2 CLS_CC); }
|
||||
| T_RETURN ';' { do_return(NULL CLS_CC); }
|
||||
| T_RETURN expr ';' { do_return(&$2 CLS_CC); }
|
||||
| T_GLOBAL global_var_list
|
||||
| T_STATIC static_var_list
|
||||
| T_ECHO echo_expr_list ';'
|
||||
| T_INLINE_HTML { do_echo(&$1 CLS_CC); }
|
||||
| expr ';' { do_free(&$1 CLS_CC); }
|
||||
| T_REQUIRE expr ';' { if ($2.op_type==IS_CONST && $2.u.constant.type==IS_STRING) { require_filename($2.u.constant.value.str.val CLS_CC); zval_dtor(&$2.u.constant); } else { do_include_or_eval(ZEND_INCLUDE, &$$, &$2 CLS_CC); } }
|
||||
| T_UNSET '(' r_cvar ')' ';' { do_unset(&$3 CLS_CC); }
|
||||
| T_FOREACH '(' expr T_AS { do_foreach_begin(&$1, &$3, &$2, &$4 CLS_CC); } w_cvar foreach_optional_arg ')' { do_foreach_cont(&$6, &$7, &$4 CLS_CC); } foreach_statement { do_foreach_end(&$1, &$2 CLS_CC); }
|
||||
| ';' /* empty statement */
|
||||
;
|
||||
|
||||
|
||||
declaration_statement:
|
||||
T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } T_STRING { do_begin_function_declaration(&$1, &$3, 0 CLS_CC); }
|
||||
'(' parameter_list ')' '{' inner_statement_list '}' { do_end_function_declaration(&$1 CLS_CC); }
|
||||
| T_OLD_FUNCTION { $1.u.opline_num = CG(zend_lineno); } T_STRING { do_begin_function_declaration(&$1, &$3, 0 CLS_CC); }
|
||||
parameter_list '(' inner_statement_list ')' ';' { do_end_function_declaration(&$1 CLS_CC); }
|
||||
| T_CLASS T_STRING { do_begin_class_declaration(&$2, NULL CLS_CC); } '{' class_statement_list '}' { do_end_class_declaration(CLS_C); }
|
||||
| T_CLASS T_STRING T_EXTENDS T_STRING { do_begin_class_declaration(&$2, &$4 CLS_CC); } '{' class_statement_list '}' { do_end_class_declaration(CLS_C); }
|
||||
;
|
||||
|
||||
|
||||
foreach_optional_arg:
|
||||
/* empty */ { $$.op_type = IS_UNUSED; }
|
||||
| T_DOUBLE_ARROW w_cvar { $$ = $2; }
|
||||
;
|
||||
|
||||
|
||||
for_statement:
|
||||
statement
|
||||
| ':' inner_statement_list T_ENDFOR ';'
|
||||
;
|
||||
|
||||
|
||||
foreach_statement:
|
||||
statement
|
||||
| ':' inner_statement_list T_ENDFOREACH ';'
|
||||
;
|
||||
|
||||
|
||||
switch_case_list:
|
||||
'{' case_list '}' { $$ = $2; }
|
||||
| '{' ';' case_list '}' { $$ = $3; }
|
||||
| ':' case_list T_ENDSWITCH ';' { $$ = $2; }
|
||||
| ':' ';' case_list T_ENDSWITCH ';' { $$ = $3; }
|
||||
;
|
||||
|
||||
|
||||
case_list:
|
||||
/* empty */ { $$.u.opline_num = -1; }
|
||||
| case_list T_CASE expr case_separator { do_case_before_statement(&$1, &$2, &$3 CLS_CC); } inner_statement_list { do_case_after_statement(&$$, &$2 CLS_CC); }
|
||||
| case_list T_DEFAULT case_separator { do_default_before_statement(&$1, &$2 CLS_CC); } inner_statement_list { do_case_after_statement(&$$, &$2 CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
case_separator:
|
||||
':'
|
||||
| ';'
|
||||
;
|
||||
|
||||
|
||||
while_statement:
|
||||
statement
|
||||
| ':' inner_statement_list T_ENDWHILE ';'
|
||||
;
|
||||
|
||||
|
||||
|
||||
elseif_list:
|
||||
/* empty */
|
||||
| elseif_list T_ELSEIF '(' expr ')' { do_if_cond(&$4, &$5 CLS_CC); } statement { do_if_after_statement(&$5, 0 CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
new_elseif_list:
|
||||
/* empty */
|
||||
| new_elseif_list T_ELSEIF '(' expr ')' ':' { do_if_cond(&$4, &$5 CLS_CC); } inner_statement_list { do_if_after_statement(&$5, 0 CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
else_single:
|
||||
/* empty */
|
||||
| T_ELSE statement
|
||||
;
|
||||
|
||||
|
||||
new_else_single:
|
||||
/* empty */
|
||||
| T_ELSE ':' inner_statement_list
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
parameter_list:
|
||||
non_empty_parameter_list
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
|
||||
non_empty_parameter_list:
|
||||
T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$1, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
|
||||
| '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_FORCE CLS_CC); }
|
||||
| T_CONST T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
|
||||
| T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$1, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$3, BYREF_NONE CLS_CC); }
|
||||
| T_VARIABLE '=' T_UNSET { znode tmp; fetch_simple_variable(&tmp, &$1, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
|
||||
| non_empty_parameter_list ',' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$3, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
|
||||
| non_empty_parameter_list ',' '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_FORCE CLS_CC); }
|
||||
| non_empty_parameter_list ',' T_CONST T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
|
||||
| non_empty_parameter_list ',' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$3, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$5, BYREF_NONE CLS_CC); }
|
||||
| non_empty_parameter_list ',' T_VARIABLE '=' T_UNSET { znode tmp; fetch_simple_variable(&tmp, &$3, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
function_call_parameter_list:
|
||||
non_empty_function_call_parameter_list { $$ = $1; }
|
||||
| /* empty */ { $$.u.constant.value.lval = 0; }
|
||||
;
|
||||
|
||||
|
||||
non_empty_function_call_parameter_list:
|
||||
expr_without_variable { $$.u.constant.value.lval = 1; do_pass_param(&$1, ZEND_SEND_VAL, $$.u.constant.value.lval CLS_CC); }
|
||||
| cvar { $$.u.constant.value.lval = 1; do_pass_param(&$1, ZEND_SEND_VAR, $$.u.constant.value.lval CLS_CC); }
|
||||
| '&' w_cvar { $$.u.constant.value.lval = 1; do_pass_param(&$2, ZEND_SEND_REF, $$.u.constant.value.lval CLS_CC); }
|
||||
| non_empty_function_call_parameter_list ',' expr_without_variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; do_pass_param(&$3, ZEND_SEND_VAL, $$.u.constant.value.lval CLS_CC); }
|
||||
| non_empty_function_call_parameter_list ',' cvar { $$.u.constant.value.lval=$1.u.constant.value.lval+1; do_pass_param(&$3, ZEND_SEND_VAR, $$.u.constant.value.lval CLS_CC); }
|
||||
| non_empty_function_call_parameter_list ',' '&' w_cvar { $$.u.constant.value.lval=$1.u.constant.value.lval+1; do_pass_param(&$4, ZEND_SEND_REF, $$.u.constant.value.lval CLS_CC); }
|
||||
;
|
||||
|
||||
global_var_list:
|
||||
global_var_list ',' global_var { do_fetch_global_or_static_variable(&$3, NULL, ZEND_FETCH_GLOBAL CLS_CC); }
|
||||
| global_var { do_fetch_global_or_static_variable(&$1, NULL, ZEND_FETCH_GLOBAL CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
global_var:
|
||||
T_VARIABLE { $$ = $1; }
|
||||
| '$' r_cvar { $$ = $2; }
|
||||
| '$' '{' expr '}' { $$ = $3; }
|
||||
;
|
||||
|
||||
|
||||
static_var_list:
|
||||
static_var_list ',' T_VARIABLE { do_fetch_global_or_static_variable(&$3, NULL, ZEND_FETCH_STATIC CLS_CC); }
|
||||
| static_var_list ',' T_VARIABLE '=' static_scalar { do_fetch_global_or_static_variable(&$3, &$5, ZEND_FETCH_STATIC CLS_CC); }
|
||||
| T_VARIABLE { do_fetch_global_or_static_variable(&$1, NULL, ZEND_FETCH_STATIC CLS_CC); }
|
||||
| T_VARIABLE '=' static_scalar { do_fetch_global_or_static_variable(&$1, &$3, ZEND_FETCH_STATIC CLS_CC); }
|
||||
|
||||
;
|
||||
|
||||
|
||||
class_statement_list:
|
||||
class_statement_list class_statement
|
||||
| /* empty */
|
||||
;
|
||||
|
||||
|
||||
class_statement:
|
||||
T_VAR class_variable_decleration ';'
|
||||
| T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } T_STRING { do_begin_function_declaration(&$1, &$3, 1 CLS_CC); } '('
|
||||
parameter_list ')' '{' inner_statement_list '}' { do_end_function_declaration(&$1 CLS_CC); }
|
||||
| T_OLD_FUNCTION { $1.u.opline_num = CG(zend_lineno); } T_STRING { do_begin_function_declaration(&$1, &$3, 1 CLS_CC); }
|
||||
parameter_list '(' inner_statement_list ')' ';' { do_end_function_declaration(&$1 CLS_CC); }
|
||||
|
||||
;
|
||||
|
||||
|
||||
class_variable_decleration:
|
||||
class_variable_decleration ',' T_VARIABLE { do_declare_property(&$3, NULL CLS_CC); }
|
||||
| class_variable_decleration ',' T_VARIABLE '=' static_scalar { do_declare_property(&$3, &$5 CLS_CC); }
|
||||
| T_VARIABLE { do_declare_property(&$1, NULL CLS_CC); }
|
||||
| T_VARIABLE '=' static_scalar { do_declare_property(&$1, &$3 CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
echo_expr_list:
|
||||
/* empty */
|
||||
| echo_expr_list ',' expr { do_echo(&$3 CLS_CC); }
|
||||
| expr { do_echo(&$1 CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
for_expr:
|
||||
/* empty */ { $$.op_type = IS_CONST; $$.u.constant.type = IS_BOOL; $$.u.constant.value.lval = 1; }
|
||||
| for_expr ',' { do_free(&$1 CLS_CC); } expr { $$ = $4; }
|
||||
| expr { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
expr_without_variable:
|
||||
T_LIST '(' { do_list_init(CLS_C); } assignment_list ')' '=' expr { do_list_end(&$$, &$7 CLS_CC); }
|
||||
| w_cvar '=' expr { do_assign(&$$, &$1, &$3 CLS_CC); }
|
||||
| w_cvar '=' '&' w_cvar { do_assign_ref(&$$, &$1, &$4 CLS_CC); }
|
||||
| T_NEW class_name { do_extended_fcall_begin(CLS_C); do_begin_new_object(&$1, &$2 CLS_CC); } ctor_arguments { do_end_new_object(&$$, &$2, &$1, &$4 CLS_CC); do_extended_fcall_end(CLS_C);}
|
||||
| rw_cvar T_PLUS_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 CLS_CC); }
|
||||
| rw_cvar T_MINUS_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 CLS_CC); }
|
||||
| rw_cvar T_MUL_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 CLS_CC); }
|
||||
| rw_cvar T_DIV_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_DIV, &$$, &$1, &$3 CLS_CC); }
|
||||
| rw_cvar T_CONCAT_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_CONCAT, &$$, &$1, &$3 CLS_CC); }
|
||||
| rw_cvar T_MOD_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_MOD, &$$, &$1, &$3 CLS_CC); }
|
||||
| rw_cvar T_AND_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_BW_AND, &$$, &$1, &$3 CLS_CC); }
|
||||
| rw_cvar T_OR_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_BW_OR, &$$, &$1, &$3 CLS_CC); }
|
||||
| rw_cvar XT_OR_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &$$, &$1, &$3 CLS_CC); }
|
||||
| rw_cvar T_SL_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 CLS_CC); }
|
||||
| rw_cvar T_SR_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 CLS_CC); }
|
||||
| rw_cvar T_INC { do_post_incdec(&$$, &$1, ZEND_POST_INC CLS_CC); }
|
||||
| T_INC rw_cvar { do_pre_incdec(&$$, &$2, ZEND_PRE_INC CLS_CC); }
|
||||
| rw_cvar T_DEC { do_post_incdec(&$$, &$1, ZEND_POST_DEC CLS_CC); }
|
||||
| T_DEC rw_cvar { do_pre_incdec(&$$, &$2, ZEND_PRE_DEC CLS_CC); }
|
||||
| expr T_BOOLEAN_OR { do_boolean_or_begin(&$1, &$2 CLS_CC); } expr { do_boolean_or_end(&$$, &$1, &$4, &$2 CLS_CC); }
|
||||
| expr T_BOOLEAN_AND { do_boolean_and_begin(&$1, &$2 CLS_CC); } expr { do_boolean_and_end(&$$, &$1, &$4, &$2 CLS_CC); }
|
||||
| expr T_LOGICAL_OR { do_boolean_or_begin(&$1, &$2 CLS_CC); } expr { do_boolean_or_end(&$$, &$1, &$4, &$2 CLS_CC); }
|
||||
| expr T_LOGICAL_AND { do_boolean_and_begin(&$1, &$2 CLS_CC); } expr { do_boolean_and_end(&$$, &$1, &$4, &$2 CLS_CC); }
|
||||
| expr T_LOGICAL_XOR expr { do_binary_op(ZEND_BOOL_XOR, &$$, &$1, &$3 CLS_CC); }
|
||||
| expr '|' expr { do_binary_op(ZEND_BW_OR, &$$, &$1, &$3 CLS_CC); }
|
||||
| expr '&' expr { do_binary_op(ZEND_BW_AND, &$$, &$1, &$3 CLS_CC); }
|
||||
| expr '^' expr { do_binary_op(ZEND_BW_XOR, &$$, &$1, &$3 CLS_CC); }
|
||||
| expr '.' expr { do_binary_op(ZEND_CONCAT,&$$,&$1,&$3 CLS_CC); }
|
||||
| expr '+' expr { do_binary_op(ZEND_ADD,&$$,&$1,&$3 CLS_CC); }
|
||||
| expr '-' expr { do_binary_op(ZEND_SUB,&$$,&$1,&$3 CLS_CC); }
|
||||
| expr '*' expr { do_binary_op(ZEND_MUL,&$$,&$1,&$3 CLS_CC); }
|
||||
| expr '/' expr { do_binary_op(ZEND_DIV,&$$,&$1,&$3 CLS_CC); }
|
||||
| expr '%' expr { do_binary_op(ZEND_MOD,&$$,&$1,&$3 CLS_CC); }
|
||||
| expr T_SL expr { do_binary_op(ZEND_SL, &$$, &$1, &$3 CLS_CC); }
|
||||
| expr T_SR expr { do_binary_op(ZEND_SR, &$$, &$1, &$3 CLS_CC); }
|
||||
| '+' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); do_binary_op(ZEND_ADD, &$$, &$1, &$2 CLS_CC); }
|
||||
| '-' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); do_binary_op(ZEND_SUB, &$$, &$1, &$2 CLS_CC); }
|
||||
| '!' expr { do_unary_op(ZEND_BOOL_NOT, &$$, &$2 CLS_CC); }
|
||||
| '~' expr { do_unary_op(ZEND_BW_NOT, &$$, &$2 CLS_CC); }
|
||||
| expr T_IS_EQUAL expr { do_binary_op(ZEND_IS_EQUAL, &$$, &$1, &$3 CLS_CC); }
|
||||
| expr T_IS_NOT_EQUAL expr { do_binary_op(ZEND_IS_NOT_EQUAL, &$$, &$1, &$3 CLS_CC); }
|
||||
| expr '<' expr { do_binary_op(ZEND_IS_SMALLER, &$$, &$1, &$3 CLS_CC); }
|
||||
| expr T_IS_SMALLER_OR_EQUAL expr { do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$1, &$3 CLS_CC); }
|
||||
| expr '>' expr { do_binary_op(ZEND_IS_SMALLER, &$$, &$3, &$1 CLS_CC); }
|
||||
| expr T_IS_GREATER_OR_EQUAL expr { do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$3, &$1 CLS_CC); }
|
||||
| '(' expr ')' { $$ = $2; }
|
||||
| expr '?' { do_begin_qm_op(&$1, &$2 CLS_CC); }
|
||||
expr ':' { do_qm_true(&$4, &$2, &$5 CLS_CC); }
|
||||
expr { do_qm_false(&$$, &$7, &$2, &$5 CLS_CC); }
|
||||
| T_STRING '(' { do_extended_fcall_begin(CLS_C); $2.u.opline_num = do_begin_function_call(&$1 CLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { do_end_function_call(&$1, &$$, &$4, 0, $2.u.opline_num CLS_CC); do_extended_fcall_end(CLS_C); }
|
||||
| r_cvar '(' { do_extended_fcall_begin(CLS_C); do_begin_dynamic_function_call(&$1 CLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { do_end_function_call(&$1, &$$, &$4, 0, 1 CLS_CC); do_extended_fcall_end(CLS_C);}
|
||||
| T_STRING T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { do_extended_fcall_begin(CLS_C); do_begin_class_member_function_call(&$1, &$3 CLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { do_end_function_call(&$3, &$$, &$6, 1, 1 CLS_CC); do_extended_fcall_end(CLS_C);}
|
||||
| internal_functions_in_yacc { $$ = $1; }
|
||||
| T_INT_CAST expr { do_cast(&$$, &$2, IS_LONG CLS_CC); }
|
||||
| T_DOUBLE_CAST expr { do_cast(&$$, &$2, IS_DOUBLE CLS_CC); }
|
||||
| T_STRING_CAST expr { do_cast(&$$, &$2, IS_STRING CLS_CC); }
|
||||
| T_ARRAY_CAST expr { do_cast(&$$, &$2, IS_ARRAY CLS_CC); }
|
||||
| T_OBJECT_CAST expr { do_cast(&$$, &$2, IS_OBJECT CLS_CC); }
|
||||
| T_BOOL_CAST expr { do_cast(&$$, &$2, IS_BOOL CLS_CC); }
|
||||
| T_EXIT exit_expr { do_exit(&$$, &$2 CLS_CC); }
|
||||
| '@' { do_begin_silence(&$1 CLS_CC); } expr { do_end_silence(&$1 CLS_CC); $$ = $3; }
|
||||
| scalar { $$ = $1; }
|
||||
| T_ARRAY '(' array_pair_list ')' { $$ = $3; }
|
||||
| '`' encaps_list '`' { do_shell_exec(&$$, &$2 CLS_CC); }
|
||||
| T_PRINT expr { do_print(&$$, &$2 CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
exit_expr:
|
||||
/* empty */ { $$.op_type = IS_UNUSED; }
|
||||
| '(' ')' { $$.op_type = IS_UNUSED; }
|
||||
| '(' expr ')' { $$ = $2; }
|
||||
;
|
||||
|
||||
|
||||
ctor_arguments:
|
||||
/* empty */ { $$.u.constant.value.lval=0; }
|
||||
| '(' function_call_parameter_list ')' { $$ = $2; }
|
||||
;
|
||||
|
||||
|
||||
class_name:
|
||||
T_STRING { $$ = $1; }
|
||||
| r_cvar { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
|
||||
common_scalar:
|
||||
T_LNUMBER { $$=$1; }
|
||||
| T_DNUMBER { $$=$1; }
|
||||
| T_CONSTANT_ENCAPSED_STRING { $$ = $1; }
|
||||
| T_LINE { $$ = $1; }
|
||||
| T_FILE { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
static_scalar: /* compile-time evaluated scalars */
|
||||
common_scalar { $$ = $1; }
|
||||
| T_STRING { do_fetch_constant(&$$, &$1, ZEND_CT CLS_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); $$ = $2; }
|
||||
| T_ARRAY '(' static_array_pair_list ')' { $$ = $3; }
|
||||
;
|
||||
|
||||
|
||||
scalar:
|
||||
T_STRING { do_fetch_constant(&$$, &$1, ZEND_RT CLS_CC); }
|
||||
| T_STRING_VARNAME { $$ = $1; }
|
||||
| common_scalar { $$ = $1; }
|
||||
| '"' encaps_list '"' { $$ = $2; }
|
||||
| '\'' encaps_list '\'' { $$ = $2; }
|
||||
| T_HEREDOC encaps_list T_HEREDOC { $$ = $2; do_end_heredoc(CLS_C); }
|
||||
;
|
||||
|
||||
|
||||
static_array_pair_list:
|
||||
/* empty */ { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); }
|
||||
| non_empty_static_array_pair_list { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
non_empty_static_array_pair_list:
|
||||
non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW static_scalar { do_add_static_array_element(&$$, &$3, &$5); }
|
||||
| non_empty_static_array_pair_list ',' static_scalar { do_add_static_array_element(&$$, NULL, &$3); }
|
||||
| static_scalar T_DOUBLE_ARROW static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); do_add_static_array_element(&$$, &$1, &$3); }
|
||||
| static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); do_add_static_array_element(&$$, NULL, &$1); }
|
||||
;
|
||||
|
||||
expr:
|
||||
r_cvar { $$ = $1; }
|
||||
| expr_without_variable { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
|
||||
r_cvar:
|
||||
cvar { do_end_variable_parse(BP_VAR_R CLS_CC); $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
w_cvar:
|
||||
cvar { do_end_variable_parse(BP_VAR_W CLS_CC); $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
rw_cvar:
|
||||
cvar { do_end_variable_parse(BP_VAR_RW CLS_CC); $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
cvar:
|
||||
cvar_without_objects { $$ = $1; }
|
||||
| cvar_without_objects T_OBJECT_OPERATOR { do_push_object(&$1 CLS_CC); } ref_list { $$ = $4; }
|
||||
;
|
||||
|
||||
|
||||
cvar_without_objects:
|
||||
reference_variable { $$ = $1; }
|
||||
| simple_indirect_reference reference_variable { do_indirect_references(&$$, &$1, &$2 CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
reference_variable:
|
||||
dim_list ']' { $$ = $1; }
|
||||
| compound_variable { do_fetch_globals(&$1 CLS_CC); do_begin_variable_parse(CLS_C); fetch_simple_variable(&$$, &$1, 1 CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
compound_variable:
|
||||
T_VARIABLE { $$ = $1; }
|
||||
| '$' '{' expr '}' { $$ = $3; }
|
||||
;
|
||||
|
||||
|
||||
dim_list:
|
||||
dim_list ']' '[' dim_offset { fetch_array_dim(&$$, &$1, &$4 CLS_CC); }
|
||||
| compound_variable { do_fetch_globals(&$1 CLS_CC); do_begin_variable_parse(CLS_C); } '[' dim_offset { fetch_array_begin(&$$, &$1, &$4 CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
dim_offset:
|
||||
/* empty */ { $$.op_type = IS_UNUSED; }
|
||||
| expr { $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
ref_list:
|
||||
object_property { $$ = $1; }
|
||||
| ref_list T_OBJECT_OPERATOR { do_push_object(&$1 CLS_CC); } object_property { $$ = $4; }
|
||||
;
|
||||
|
||||
object_property:
|
||||
scalar_object_property { znode tmp_znode; do_pop_object(&tmp_znode CLS_CC); do_fetch_property(&$$, &tmp_znode, &$1 CLS_CC); }
|
||||
| object_dim_list ']' { $$ = $1; }
|
||||
;
|
||||
|
||||
scalar_object_property:
|
||||
T_STRING { $$ = $1; }
|
||||
| '{' expr '}' { $$ = $2; }
|
||||
| cvar_without_objects { do_end_variable_parse(BP_VAR_R CLS_CC); $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
object_dim_list:
|
||||
object_dim_list ']' '[' dim_offset { fetch_array_dim(&$$, &$1, &$4 CLS_CC); }
|
||||
| T_STRING { znode tmp_znode, res; do_pop_object(&tmp_znode CLS_CC); do_fetch_property(&res, &tmp_znode, &$1 CLS_CC); $1 = res; } '[' dim_offset { fetch_array_dim(&$$, &$1, &$4 CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
simple_indirect_reference:
|
||||
'$' { $$.u.constant.value.lval = 1; }
|
||||
| simple_indirect_reference '$' { $$.u.constant.value.lval++; }
|
||||
;
|
||||
|
||||
assignment_list:
|
||||
assignment_list ',' assignment_list_element
|
||||
| assignment_list_element
|
||||
;
|
||||
|
||||
|
||||
assignment_list_element:
|
||||
w_cvar { do_add_list_element(&$1 CLS_CC); }
|
||||
| T_LIST '(' { do_new_list_begin(CLS_C); } assignment_list ')' { do_new_list_end(CLS_C); }
|
||||
| /* empty */ { do_add_list_element(NULL CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
array_pair_list:
|
||||
/* empty */ { do_init_array(&$$, NULL, NULL CLS_CC); }
|
||||
| non_empty_array_pair_list { $$ = $1; }
|
||||
;
|
||||
|
||||
non_empty_array_pair_list:
|
||||
non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr { do_add_array_element(&$$, &$5, &$3 CLS_CC); }
|
||||
| non_empty_array_pair_list ',' expr { do_add_array_element(&$$, &$3, NULL CLS_CC); }
|
||||
| expr T_DOUBLE_ARROW expr { do_init_array(&$$, &$3, &$1 CLS_CC); }
|
||||
| expr { do_init_array(&$$, &$1, NULL CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
encaps_list:
|
||||
encaps_list encaps_var { do_end_variable_parse(BP_VAR_R CLS_CC); do_add_variable(&$$, &$1, &$2 CLS_CC); }
|
||||
| encaps_list T_STRING { do_add_string(&$$, &$1, &$2 CLS_CC); }
|
||||
| encaps_list T_NUM_STRING { do_add_string(&$$, &$1, &$2 CLS_CC); }
|
||||
| encaps_list T_ENCAPSED_AND_WHITESPACE { do_add_string(&$$, &$1, &$2 CLS_CC); }
|
||||
| encaps_list T_CHARACTER { do_add_char(&$$, &$1, &$2 CLS_CC); }
|
||||
| encaps_list T_BAD_CHARACTER { do_add_string(&$$, &$1, &$2 CLS_CC); }
|
||||
| encaps_list '[' { $2.u.constant.value.chval = '['; do_add_char(&$$, &$1, &$2 CLS_CC); }
|
||||
| encaps_list ']' { $2.u.constant.value.chval = ']'; do_add_char(&$$, &$1, &$2 CLS_CC); }
|
||||
| encaps_list '{' { $2.u.constant.value.chval = '{'; do_add_char(&$$, &$1, &$2 CLS_CC); }
|
||||
| encaps_list '}' { $2.u.constant.value.chval = '}'; do_add_char(&$$, &$1, &$2 CLS_CC); }
|
||||
| encaps_list T_OBJECT_OPERATOR { znode tmp; $2.u.constant.value.chval = '-'; do_add_char(&tmp, &$1, &$2 CLS_CC); $2.u.constant.value.chval = '>'; do_add_char(&$$, &tmp, &$2 CLS_CC); }
|
||||
| /* empty */ { do_init_string(&$$ CLS_CC); }
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
encaps_var:
|
||||
T_VARIABLE { do_fetch_globals(&$1 CLS_CC); do_begin_variable_parse(CLS_C); fetch_simple_variable(&$$, &$1, 1 CLS_CC); }
|
||||
| T_VARIABLE '[' { do_begin_variable_parse(CLS_C); } encaps_var_offset ']' { do_fetch_globals(&$1 CLS_CC); fetch_array_begin(&$$, &$1, &$4 CLS_CC); }
|
||||
| T_VARIABLE T_OBJECT_OPERATOR T_STRING { do_begin_variable_parse(CLS_C); fetch_simple_variable(&$2, &$1, 1 CLS_CC); do_fetch_property(&$$, &$2, &$3 CLS_CC); }
|
||||
| T_DOLLAR_OPEN_CURLY_BRACES expr '}' { do_begin_variable_parse(CLS_C); fetch_simple_variable(&$$, &$2, 1 CLS_CC); }
|
||||
| T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' { do_begin_variable_parse(CLS_C); fetch_array_begin(&$$, &$2, &$4 CLS_CC); }
|
||||
| T_CURLY_OPEN cvar '}' { $$ = $2; }
|
||||
;
|
||||
|
||||
|
||||
encaps_var_offset:
|
||||
T_STRING { $$ = $1; }
|
||||
| T_NUM_STRING { $$ = $1; }
|
||||
| T_VARIABLE { fetch_simple_variable(&$$, &$1, 1 CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
internal_functions_in_yacc:
|
||||
T_ISSET '(' cvar ')' { do_isset_or_isempty(ZEND_ISSET, &$$, &$3 CLS_CC); }
|
||||
| T_EMPTY '(' cvar ')' { do_isset_or_isempty(ZEND_ISEMPTY, &$$, &$3 CLS_CC); }
|
||||
| T_INCLUDE expr { do_include_or_eval(ZEND_INCLUDE, &$$, &$2 CLS_CC); }
|
||||
| T_EVAL '(' expr ')' { do_include_or_eval(ZEND_EVAL, &$$, &$3 CLS_CC); }
|
||||
;
|
||||
|
||||
|
||||
%%
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _LANGUAGE_SCANNER_H
|
||||
#define _LANGUAGE_SCANNER_H
|
||||
|
||||
#ifdef ZTS
|
||||
class ZendFlexLexer : public yyFlexLexer
|
||||
{
|
||||
public:
|
||||
virtual ~ZendFlexLexer();
|
||||
int lex_scan(zval *zendlval CLS_DC);
|
||||
void BeginState(int state);
|
||||
};
|
||||
|
||||
#endif /* ZTS */
|
||||
|
||||
|
||||
#ifndef ZTS
|
||||
typedef struct _zend_lex_state {
|
||||
YY_BUFFER_STATE buffer_state;
|
||||
int state;
|
||||
uint return_offset;
|
||||
uint lineno;
|
||||
FILE *in;
|
||||
char *filename;
|
||||
} zend_lex_state;
|
||||
#else
|
||||
typedef struct _zend_lex_state {
|
||||
ZendFlexLexer *ZFL;
|
||||
istream *input_file;
|
||||
} zend_lex_state;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+1485
File diff suppressed because it is too large.
Load diff
+437
@@ -0,0 +1,437 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_operators.h"
|
||||
#include "zend_variables.h"
|
||||
#include "zend_extensions.h"
|
||||
#include "modules.h"
|
||||
#include "zend_constants.h"
|
||||
#include "zend_list.h"
|
||||
#include "zend_API.h"
|
||||
|
||||
#ifdef ZTS
|
||||
# define GLOBAL_FUNCTION_TABLE global_function_table
|
||||
# define GLOBAL_CLASS_TABLE global_class_table
|
||||
# define GLOBAL_CONSTANTS_TABLE global_constants_table
|
||||
#else
|
||||
# define GLOBAL_FUNCTION_TABLE CG(function_table)
|
||||
# define GLOBAL_CLASS_TABLE CG(class_table)
|
||||
# define GLOBAL_CONSTANTS_TABLE CG(zend_constants)
|
||||
#endif
|
||||
|
||||
/* true multithread-shared globals */
|
||||
ZEND_API zend_class_entry zend_standard_class_def;
|
||||
ZEND_API int (*zend_printf)(const char *format, ...);
|
||||
ZEND_API int (*zend_write)(const char *str, uint str_length);
|
||||
ZEND_API void (*zend_error)(int type, const char *format, ...);
|
||||
void (*zend_message_dispatcher)(long message, void *data);
|
||||
FILE *(*zend_fopen)(const char *filename);
|
||||
void (*zend_block_interruptions)();
|
||||
void (*zend_unblock_interruptions)();
|
||||
ZEND_API int (*zend_get_ini_entry)(char *name, uint name_length, zval *contents);
|
||||
|
||||
#ifdef ZTS
|
||||
ZEND_API int compiler_globals_id;
|
||||
ZEND_API int executor_globals_id;
|
||||
int alloc_globals_id;
|
||||
HashTable *global_function_table;
|
||||
HashTable *global_class_table;
|
||||
HashTable *global_constants_table;
|
||||
#endif
|
||||
|
||||
zend_utility_values zend_uv;
|
||||
|
||||
/* version information */
|
||||
static char *zend_version_info;
|
||||
static uint zend_version_info_length;
|
||||
#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski\n"
|
||||
|
||||
|
||||
#define PRINT_PVAL_INDENT 4
|
||||
|
||||
static void print_hash(HashTable *ht, int indent)
|
||||
{
|
||||
zval **tmp;
|
||||
char *string_key;
|
||||
unsigned long num_key;
|
||||
int i;
|
||||
|
||||
for (i=0; i<indent; i++) {
|
||||
ZEND_PUTS(" ");
|
||||
}
|
||||
ZEND_PUTS("(\n");
|
||||
indent += PRINT_PVAL_INDENT;
|
||||
zend_hash_internal_pointer_reset(ht);
|
||||
while (zend_hash_get_current_data(ht, (void **) &tmp) == SUCCESS) {
|
||||
for (i=0; i<indent; i++) {
|
||||
ZEND_PUTS(" ");
|
||||
}
|
||||
ZEND_PUTS("[");
|
||||
switch (zend_hash_get_current_key(ht, &string_key, &num_key)) {
|
||||
case HASH_KEY_IS_STRING:
|
||||
ZEND_PUTS(string_key);
|
||||
efree(string_key);
|
||||
break;
|
||||
case HASH_KEY_IS_LONG:
|
||||
zend_printf("%ld",num_key);
|
||||
break;
|
||||
}
|
||||
ZEND_PUTS("] => ");
|
||||
zend_print_zval_r(*tmp, indent+PRINT_PVAL_INDENT);
|
||||
ZEND_PUTS("\n");
|
||||
zend_hash_move_forward(ht);
|
||||
}
|
||||
indent -= PRINT_PVAL_INDENT;
|
||||
for (i=0; i<indent; i++) {
|
||||
ZEND_PUTS(" ");
|
||||
}
|
||||
ZEND_PUTS(")\n");
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy)
|
||||
{
|
||||
if (expr->type==IS_STRING) {
|
||||
*use_copy = 0;
|
||||
return;
|
||||
}
|
||||
switch (expr->type) {
|
||||
case IS_BOOL:
|
||||
#if 1
|
||||
if (expr->value.lval) {
|
||||
expr_copy->value.str.len = 1;
|
||||
expr_copy->value.str.val = estrndup("1", 1);
|
||||
} else {
|
||||
expr_copy->value.str.len = 0;
|
||||
expr_copy->value.str.val = empty_string;
|
||||
}
|
||||
#else
|
||||
if (expr->value.lval) {
|
||||
expr_copy->value.str.len = sizeof("true")-1;
|
||||
expr_copy->value.str.val = estrndup("true", expr_copy->value.str.len);
|
||||
} else {
|
||||
expr_copy->value.str.len = sizeof("false")-1;
|
||||
expr_copy->value.str.val = estrndup("false", expr_copy->value.str.len);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case IS_RESOURCE:
|
||||
expr_copy->value.str.val = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG);
|
||||
expr_copy->value.str.len = sprintf(expr_copy->value.str.val, "Resource id #%ld", expr->value.lval);
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
expr_copy->value.str.len = sizeof("Array")-1;
|
||||
expr_copy->value.str.val = estrndup("Array", expr_copy->value.str.len);
|
||||
break;
|
||||
case IS_OBJECT: {
|
||||
zval function_name;
|
||||
|
||||
function_name.value.str.len = sizeof("to_string")-1;
|
||||
function_name.value.str.val = estrndup("to_string", function_name.value.str.len);
|
||||
function_name.type = IS_STRING;
|
||||
|
||||
if (call_user_function(NULL, expr, &function_name, expr_copy, 0, NULL)==FAILURE) {
|
||||
expr_copy->value.str.len = sizeof("Object")-1;
|
||||
expr_copy->value.str.val = estrndup("Object", expr_copy->value.str.len);
|
||||
}
|
||||
efree(function_name.value.str.val);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
*expr_copy = *expr;
|
||||
zval_copy_ctor(expr_copy);
|
||||
convert_to_string(expr_copy);
|
||||
break;
|
||||
}
|
||||
expr_copy->type = IS_STRING;
|
||||
*use_copy = 1;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_print_zval(zval *expr, int indent)
|
||||
{
|
||||
zval expr_copy;
|
||||
int use_copy;
|
||||
|
||||
zend_make_printable_zval(expr, &expr_copy, &use_copy);
|
||||
if (use_copy) {
|
||||
expr = &expr_copy;
|
||||
}
|
||||
if (expr->value.str.len==0) { /* optimize away empty strings */
|
||||
if (use_copy) {
|
||||
zval_dtor(expr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
ZEND_WRITE(expr->value.str.val,expr->value.str.len);
|
||||
if (use_copy) {
|
||||
zval_dtor(expr);
|
||||
}
|
||||
return expr->value.str.len;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_print_zval_r(zval *expr, int indent)
|
||||
{
|
||||
switch(expr->type) {
|
||||
case IS_ARRAY:
|
||||
ZEND_PUTS("Array\n");
|
||||
print_hash(expr->value.ht,indent);
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
zend_printf("%s Object\n", expr->value.obj.ce->name);
|
||||
print_hash(expr->value.obj.properties, indent);
|
||||
break;
|
||||
default:
|
||||
zend_print_variable(expr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static FILE *zend_fopen_wrapper(const char *filename)
|
||||
{
|
||||
return fopen(filename, "r");
|
||||
}
|
||||
|
||||
|
||||
static void register_standard_class()
|
||||
{
|
||||
zend_standard_class_def.type = ZEND_INTERNAL_CLASS;
|
||||
zend_standard_class_def.name_length = sizeof("stdClass") - 1;
|
||||
zend_standard_class_def.name = zend_strndup("stdClass", zend_standard_class_def.name_length);
|
||||
zend_standard_class_def.parent = NULL;
|
||||
zend_hash_init(&zend_standard_class_def.default_properties, 0, NULL, PVAL_PTR_DTOR, 1);
|
||||
zend_hash_init(&zend_standard_class_def.function_table, 0, NULL, ZEND_FUNCTION_DTOR, 1);
|
||||
zend_standard_class_def.handle_function_call = NULL;
|
||||
zend_standard_class_def.handle_property_get = NULL;
|
||||
zend_standard_class_def.handle_property_set = NULL;
|
||||
zend_standard_class_def.refcount = (int *) malloc(sizeof(int));
|
||||
*zend_standard_class_def.refcount = 1;
|
||||
zend_hash_add(GLOBAL_CLASS_TABLE, "stdClass", sizeof("stdClass"), &zend_standard_class_def, sizeof(zend_class_entry), NULL);
|
||||
}
|
||||
|
||||
|
||||
#ifdef ZTS
|
||||
static void compiler_globals_ctor(zend_compiler_globals *compiler_globals)
|
||||
{
|
||||
zend_function tmp_func;
|
||||
zend_class_entry tmp_class;
|
||||
|
||||
compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1);
|
||||
zend_hash_copy(compiler_globals->function_table, global_function_table, NULL, &tmp_func, sizeof(zend_function));
|
||||
|
||||
compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1);
|
||||
zend_hash_copy(compiler_globals->class_table, global_class_table, zend_class_add_ref, &tmp_class, sizeof(zend_class_entry));
|
||||
}
|
||||
|
||||
|
||||
static void compiler_globals_dtor(zend_compiler_globals *compiler_globals)
|
||||
{
|
||||
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) {
|
||||
zend_hash_destroy(compiler_globals->class_table);
|
||||
free(compiler_globals->class_table);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void executor_globals_ctor(zend_executor_globals *executor_globals)
|
||||
{
|
||||
if (global_constants_table) {
|
||||
zend_startup_constants(executor_globals->zend_constants ELS_CC);
|
||||
zend_copy_constants(executor_globals->zend_constants, global_constants_table);
|
||||
}
|
||||
init_resource_plist(ELS_C);
|
||||
}
|
||||
|
||||
|
||||
static void executor_globals_dtor(zend_executor_globals *executor_globals)
|
||||
{
|
||||
zend_shutdown_constants(ELS_C);
|
||||
destroy_resource_plist();
|
||||
}
|
||||
|
||||
|
||||
static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
|
||||
{
|
||||
start_memory_manager();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
int zend_startup(zend_utility_functions *utility_functions, char **extensions)
|
||||
{
|
||||
#ifdef ZTS
|
||||
zend_compiler_globals *compiler_globals;
|
||||
zend_executor_globals *executor_globals;
|
||||
|
||||
alloc_globals_id = ts_allocate_id(sizeof(zend_alloc_globals), alloc_globals_ctor, NULL);
|
||||
#endif
|
||||
|
||||
start_memory_manager();
|
||||
|
||||
/* Set up utility functions and values */
|
||||
zend_error = utility_functions->error_function;
|
||||
zend_printf = utility_functions->printf_function;
|
||||
zend_write = utility_functions->write_function;
|
||||
zend_fopen = utility_functions->fopen_function;
|
||||
if (!zend_fopen) {
|
||||
zend_fopen = zend_fopen_wrapper;
|
||||
}
|
||||
zend_message_dispatcher = utility_functions->message_handler;
|
||||
zend_block_interruptions = utility_functions->block_interruptions;
|
||||
zend_unblock_interruptions = utility_functions->unblock_interruptions;
|
||||
zend_get_ini_entry = utility_functions->get_ini_entry;
|
||||
|
||||
zend_compile_files = compile_files;
|
||||
zend_execute = execute;
|
||||
|
||||
zend_llist_init(&zend_extensions, sizeof(zend_extension), (void (*)(void *)) zend_extension_dtor, 1);
|
||||
|
||||
/* set up version */
|
||||
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));
|
||||
zend_hash_init(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1);
|
||||
zend_hash_init(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1);
|
||||
register_standard_class();
|
||||
zend_hash_init(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1);
|
||||
zend_hash_init(&list_destructors, 50, NULL, NULL, 1);
|
||||
|
||||
#ifdef ZTS
|
||||
global_constants_table = NULL;
|
||||
compiler_globals_id = ts_allocate_id(sizeof(zend_compiler_globals), (void (*)(void *)) compiler_globals_ctor, (void (*)(void *)) compiler_globals_dtor);
|
||||
executor_globals_id = ts_allocate_id(sizeof(zend_executor_globals), (void (*)(void *)) executor_globals_ctor, (void (*)(void *)) executor_globals_dtor);
|
||||
compiler_globals = ts_resource(compiler_globals_id);
|
||||
executor_globals = ts_resource(executor_globals_id);
|
||||
compiler_globals_dtor(compiler_globals);
|
||||
compiler_globals->function_table = GLOBAL_FUNCTION_TABLE;
|
||||
compiler_globals->class_table = GLOBAL_CLASS_TABLE;
|
||||
zend_startup_constants(EG(zend_constants), executor_globals);
|
||||
GLOBAL_CONSTANTS_TABLE = EG(zend_constants);
|
||||
#else
|
||||
zend_startup_constants(EG(zend_constants));
|
||||
#endif
|
||||
zend_register_standard_constants(ELS_C);
|
||||
|
||||
#ifndef ZTS
|
||||
init_resource_plist(ELS_C);
|
||||
#endif
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void zend_shutdown()
|
||||
{
|
||||
#ifndef ZTS
|
||||
destroy_resource_plist();
|
||||
#endif
|
||||
zend_hash_destroy(&list_destructors);
|
||||
zend_hash_destroy(&module_registry);
|
||||
zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
|
||||
free(GLOBAL_FUNCTION_TABLE);
|
||||
zend_hash_destroy(GLOBAL_CLASS_TABLE);
|
||||
free(GLOBAL_CLASS_TABLE);
|
||||
zend_shutdown_extensions();
|
||||
free(zend_version_info);
|
||||
#ifndef ZTS
|
||||
zend_shutdown_constants(ELS_C);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void zend_set_utility_values(zend_utility_values *utility_values)
|
||||
{
|
||||
zend_uv = *utility_values;
|
||||
}
|
||||
|
||||
|
||||
/* this should be compatible with the standard zenderror */
|
||||
void zenderror(char *error)
|
||||
{
|
||||
zend_error(E_PARSE, error);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_bailout()
|
||||
{
|
||||
CLS_FETCH();
|
||||
ELS_FETCH();
|
||||
|
||||
CG(unclean_shutdown) = 1;
|
||||
longjmp(EG(bailout), FAILURE);
|
||||
}
|
||||
END_EXTERN_C()
|
||||
|
||||
|
||||
void zend_append_version_info(zend_extension *extension)
|
||||
{
|
||||
char *new_info;
|
||||
uint new_info_length;
|
||||
|
||||
new_info_length = sizeof(" with v, by \n")
|
||||
+ strlen(extension->name)
|
||||
+ strlen(extension->version)
|
||||
+ strlen(extension->copyright)
|
||||
+ strlen(extension->author);
|
||||
|
||||
new_info = (char *) malloc(new_info_length+1);
|
||||
|
||||
sprintf(new_info, " with %s v%s, %s, by %s\n", extension->name, extension->version, extension->copyright, extension->author);
|
||||
|
||||
zend_version_info = (char *) realloc(zend_version_info, zend_version_info_length+new_info_length+1);
|
||||
strcat(zend_version_info, new_info);
|
||||
zend_version_info_length += new_info_length;
|
||||
free(new_info);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *get_zend_version()
|
||||
{
|
||||
return zend_version_info;
|
||||
}
|
||||
|
||||
|
||||
void zend_activate(CLS_D ELS_DC)
|
||||
{
|
||||
init_compiler(CLS_C ELS_CC);
|
||||
init_executor(CLS_C ELS_CC);
|
||||
startup_scanner(CLS_C);
|
||||
}
|
||||
|
||||
void zend_deactivate(CLS_D ELS_DC)
|
||||
{
|
||||
zend_hash_apply(&module_registry, (int (*)(void *)) module_registry_cleanup);
|
||||
shutdown_scanner(CLS_C);
|
||||
shutdown_executor(ELS_C);
|
||||
shutdown_compiler(CLS_C);
|
||||
}
|
||||
+263
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ZEND_H
|
||||
#define _ZEND_H
|
||||
|
||||
#define ZEND_VERSION "0.90"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define BEGIN_EXTERN_C() extern "C" {
|
||||
#define END_EXTERN_C() }
|
||||
#else
|
||||
#define BEGIN_EXTERN_C()
|
||||
#define END_EXTERN_C()
|
||||
#endif
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
* general definitions
|
||||
*/
|
||||
|
||||
#if WINNT||WIN32
|
||||
#include "config.w32.h"
|
||||
#else
|
||||
#include "zend_config.h"
|
||||
#include "config.unix.h"
|
||||
#endif
|
||||
|
||||
#include "zend_errors.h"
|
||||
#include "zend_alloc.h"
|
||||
|
||||
/* this is a workaround for a bug in gcc */
|
||||
#if SIZEOF_VOID_P == 8 || (1)
|
||||
typedef unsigned int zend_bool;
|
||||
#else
|
||||
typedef unsigned char zend_bool;
|
||||
#endif
|
||||
|
||||
#undef SUCCESS
|
||||
#undef FAILURE
|
||||
#define SUCCESS 0
|
||||
#define FAILURE -1 /* this MUST stay a negative number, or it may effect functions! */
|
||||
|
||||
|
||||
#include "zend_hash.h"
|
||||
#include "zend_llist.h"
|
||||
|
||||
|
||||
#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, HashTable *list, HashTable *plist, zval *this_ptr
|
||||
#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, list, plist, this_ptr
|
||||
|
||||
/*
|
||||
* zval
|
||||
*/
|
||||
typedef struct _zval_struct zval;
|
||||
typedef struct _zend_class_entry zend_class_entry;
|
||||
|
||||
typedef union _zvalue_value {
|
||||
long lval; /* long value */
|
||||
double dval; /* double value */
|
||||
struct {
|
||||
char *val;
|
||||
int len;
|
||||
} str;
|
||||
char chval; /* char value */
|
||||
HashTable *ht; /* hash table value */
|
||||
struct {
|
||||
zend_class_entry *ce;
|
||||
HashTable *properties;
|
||||
} obj;
|
||||
} zvalue_value;
|
||||
|
||||
|
||||
struct _zval_struct {
|
||||
/* Variable information */
|
||||
zvalue_value value; /* value */
|
||||
unsigned char type; /* active type */
|
||||
struct {
|
||||
unsigned int locks:7;
|
||||
unsigned int is_ref:1;
|
||||
} EA;
|
||||
short refcount;
|
||||
};
|
||||
|
||||
|
||||
|
||||
typedef struct _zend_function_entry {
|
||||
char *fname;
|
||||
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
|
||||
unsigned char *func_arg_types;
|
||||
} zend_function_entry;
|
||||
|
||||
|
||||
typedef struct _zend_property_reference {
|
||||
int type; /* read, write or r/w */
|
||||
zval *object;
|
||||
zend_llist elements_list;
|
||||
} zend_property_reference;
|
||||
|
||||
|
||||
|
||||
typedef struct _zend_overloaded_element {
|
||||
int type; /* array offset or object proprety */
|
||||
zval element;
|
||||
} zend_overloaded_element;
|
||||
|
||||
|
||||
struct _zend_class_entry {
|
||||
char type;
|
||||
char *name;
|
||||
uint name_length;
|
||||
struct _zend_class_entry *parent;
|
||||
int *refcount;
|
||||
|
||||
HashTable function_table;
|
||||
HashTable default_properties;
|
||||
zend_function_entry *builtin_functions;
|
||||
|
||||
/* handlers */
|
||||
void (*handle_function_call)(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
|
||||
zval (*handle_property_get)(zend_property_reference *property_reference);
|
||||
int (*handle_property_set)(zend_property_reference *property_reference, zval *value);
|
||||
};
|
||||
|
||||
|
||||
|
||||
typedef struct _zend_utility_functions {
|
||||
void (*error_function)(int type, const char *format, ...);
|
||||
int (*printf_function)(const char *format, ...);
|
||||
int (*write_function)(const char *str, uint str_length);
|
||||
FILE *(*fopen_function)(const char *filename);
|
||||
void (*message_handler)(long message, void *data);
|
||||
void (*block_interruptions)();
|
||||
void (*unblock_interruptions)();
|
||||
int (*get_ini_entry)(char *name, uint name_length, zval *contents);
|
||||
} zend_utility_functions;
|
||||
|
||||
|
||||
typedef struct _zend_utility_values {
|
||||
unsigned char short_tags;
|
||||
unsigned char asp_tags;
|
||||
} zend_utility_values;
|
||||
|
||||
|
||||
#undef MIN
|
||||
#undef MAX
|
||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
|
||||
/* data types */
|
||||
#define IS_LONG 1
|
||||
#define IS_DOUBLE 2
|
||||
#define IS_STRING 3
|
||||
#define IS_ARRAY 4
|
||||
#define IS_OBJECT 5
|
||||
#define IS_BC 6 /* for parser internal use only */
|
||||
#define IS_BOOL 7
|
||||
#define IS_RESOURCE 8
|
||||
#define IS_CONSTANT 9
|
||||
#define IS_METHOD 10 /* for overloaded function calls */
|
||||
|
||||
int zend_startup(zend_utility_functions *utility_functions, char **extensions);
|
||||
void zend_shutdown();
|
||||
|
||||
void zend_set_utility_values(zend_utility_values *utility_values);
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_bailout();
|
||||
END_EXTERN_C()
|
||||
ZEND_API char *get_zend_version();
|
||||
|
||||
ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy);
|
||||
ZEND_API int zend_print_zval(zval *expr, int indent);
|
||||
ZEND_API void zend_print_zval_r(zval *expr, int indent);
|
||||
|
||||
ZEND_API extern char *empty_string;
|
||||
ZEND_API extern char *undefined_variable_string;
|
||||
|
||||
#define STR_FREE(ptr) if (ptr && ptr!=empty_string && ptr!=undefined_variable_string) { efree(ptr); }
|
||||
|
||||
|
||||
/* output support */
|
||||
#define ZEND_WRITE(str, str_len) zend_write((str), (str_len))
|
||||
#define ZEND_PUTS(str) zend_write((str), strlen((str)))
|
||||
#define ZEND_PUTC(c) zend_write(&(c), 1), (c)
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
extern ZEND_API int (*zend_printf)(const char *format, ...);
|
||||
extern ZEND_API int (*zend_write)(const char *str, uint str_length);
|
||||
extern ZEND_API void (*zend_error)(int type, const char *format, ...);
|
||||
extern FILE *(*zend_fopen)(const char *filename);
|
||||
extern void (*zend_block_interruptions)();
|
||||
extern void (*zend_unblock_interruptions)();
|
||||
extern void (*zend_message_dispatcher)(long message, void *data);
|
||||
extern ZEND_API int (*zend_get_ini_entry)(char *name, uint name_length, zval *contents);
|
||||
END_EXTERN_C()
|
||||
|
||||
|
||||
void zenderror(char *error);
|
||||
|
||||
extern ZEND_API zend_class_entry zend_standard_class_def;
|
||||
extern zend_utility_values zend_uv;
|
||||
|
||||
#define ZEND_UV(name) (zend_uv.name)
|
||||
|
||||
|
||||
#define HANDLE_BLOCK_INTERRUPTIONS() if (zend_block_interruptions) { zend_block_interruptions(); }
|
||||
#define HANDLE_UNBLOCK_INTERRUPTIONS() if (zend_unblock_interruptions) { zend_unblock_interruptions(); }
|
||||
|
||||
|
||||
/* Messages for applications of Zend */
|
||||
#define ZMSG_ENABLE_TRACK_VARS 1L
|
||||
#define ZMSG_FAILED_INCLUDE_FOPEN 2L
|
||||
#define ZMSG_FAILED_REQUIRE_FOPEN 3L
|
||||
#define ZMSG_FAILED_HIGHLIGHT_FOPEN 4L
|
||||
#define ZMSG_MEMORY_LEAK_DETECTED 5L
|
||||
#define ZMSG_MEMORY_LEAK_REPEATED 6L
|
||||
#define ZMSG_LOG_SCRIPT_NAME 7L
|
||||
|
||||
#define INIT_PZVAL(z) \
|
||||
(z)->refcount = 1; \
|
||||
(z)->EA.is_ref = 0; \
|
||||
(z)->EA.locks = 0;
|
||||
|
||||
#define MAKE_STD_ZVAL(zv) \
|
||||
zv = (zval *) emalloc(sizeof(zval)); \
|
||||
INIT_PZVAL(zv);
|
||||
|
||||
#define SEPARATE_ZVAL(ppzv) \
|
||||
{ \
|
||||
zval *orig_ptr = *(ppzv); \
|
||||
\
|
||||
if (orig_ptr->refcount>1) { \
|
||||
orig_ptr->refcount--; \
|
||||
*(ppzv) = (zval *) emalloc(sizeof(zval)); \
|
||||
**(ppzv) = *orig_ptr; \
|
||||
zval_copy_ctor(*(ppzv)); \
|
||||
(*(ppzv))->refcount=1; \
|
||||
(*(ppzv))->EA.is_ref = 0; \
|
||||
(*(ppzv))->EA.locks = 0; \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif /* _ZEND_H */
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
+771
@@ -0,0 +1,771 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_variables.h"
|
||||
#include "zend_execute.h"
|
||||
#include "zend_API.h"
|
||||
#include "modules.h"
|
||||
#include "zend_constants.h"
|
||||
#include "zend_operators.h"
|
||||
|
||||
#if HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
/* these variables are true statics/globals, and have to be mutex'ed on every access */
|
||||
static int module_count=0;
|
||||
HashTable list_destructors, module_registry;
|
||||
|
||||
/* this function doesn't check for too many parameters */
|
||||
ZEND_API int getParameters(int ht, int param_count,...)
|
||||
{
|
||||
void **p;
|
||||
int arg_count;
|
||||
va_list ptr;
|
||||
zval **param, *param_ptr;
|
||||
ELS_FETCH();
|
||||
ALS_FETCH();
|
||||
|
||||
p = EG(argument_stack).top_element-1;
|
||||
arg_count = (ulong) *p;
|
||||
|
||||
if (param_count>arg_count) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
va_start(ptr, param_count);
|
||||
|
||||
while (param_count>0) {
|
||||
param = va_arg(ptr, zval **);
|
||||
param_ptr = *(p-param_count);
|
||||
if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) {
|
||||
zval *new_tmp;
|
||||
|
||||
new_tmp = (zval *) emalloc(sizeof(zval));
|
||||
*new_tmp = *param_ptr;
|
||||
zval_copy_ctor(new_tmp);
|
||||
INIT_PZVAL(new_tmp);
|
||||
param_ptr = new_tmp;
|
||||
((zval *) *(p-param_count))->refcount--;
|
||||
*(p-param_count) = param_ptr;
|
||||
}
|
||||
*param = param_ptr;
|
||||
param_count--;
|
||||
}
|
||||
va_end(ptr);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int getParametersArray(int ht, int param_count, zval **argument_array)
|
||||
{
|
||||
void **p;
|
||||
int arg_count;
|
||||
zval *param_ptr;
|
||||
ELS_FETCH();
|
||||
|
||||
p = EG(argument_stack).top_element-1;
|
||||
arg_count = (ulong) *p;
|
||||
|
||||
if (param_count>arg_count) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
||||
while (param_count>0) {
|
||||
param_ptr = *(p-param_count);
|
||||
if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) {
|
||||
zval *new_tmp;
|
||||
|
||||
new_tmp = (zval *) emalloc(sizeof(zval));
|
||||
*new_tmp = *param_ptr;
|
||||
zval_copy_ctor(new_tmp);
|
||||
INIT_PZVAL(new_tmp);
|
||||
param_ptr = new_tmp;
|
||||
((zval *) *(p-param_count))->refcount--;
|
||||
*(p-param_count) = param_ptr;
|
||||
}
|
||||
*(argument_array++) = param_ptr;
|
||||
param_count--;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Zend-optimized Extended functions */
|
||||
/* this function doesn't check for too many parameters */
|
||||
ZEND_API int getParametersEx(int param_count,...)
|
||||
{
|
||||
void **p;
|
||||
int arg_count;
|
||||
va_list ptr;
|
||||
zval ***param;
|
||||
ELS_FETCH();
|
||||
|
||||
p = EG(argument_stack).top_element-1;
|
||||
arg_count = (ulong) *p;
|
||||
|
||||
if (param_count>arg_count) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
va_start(ptr, param_count);
|
||||
while (param_count>0) {
|
||||
param = va_arg(ptr, zval ***);
|
||||
*param = (zval **) p-(param_count--);
|
||||
}
|
||||
va_end(ptr);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int getParametersArrayEx(int param_count, zval ***argument_array)
|
||||
{
|
||||
void **p;
|
||||
int arg_count;
|
||||
ELS_FETCH();
|
||||
|
||||
p = EG(argument_stack).top_element-1;
|
||||
arg_count = (ulong) *p;
|
||||
|
||||
if (param_count>arg_count) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
while (param_count>0) {
|
||||
*(argument_array++) = (zval **) p-(param_count--);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int ParameterPassedByReference(int ht, uint n)
|
||||
{
|
||||
void **p;
|
||||
ulong arg_count;
|
||||
zval *arg;
|
||||
ELS_FETCH();
|
||||
|
||||
p = EG(argument_stack).elements+EG(argument_stack).top-1;
|
||||
arg_count = (ulong) *p;
|
||||
|
||||
if (n>arg_count) {
|
||||
return FAILURE;
|
||||
}
|
||||
arg = (zval *) *(p-arg_count+n-1);
|
||||
return PZVAL_IS_REF(arg);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void wrong_param_count()
|
||||
{
|
||||
zend_error(E_WARNING,"Wrong parameter count for %s()",get_active_function_name());
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int array_init(zval *arg)
|
||||
{
|
||||
arg->value.ht = (HashTable *) emalloc(sizeof(HashTable));
|
||||
if (!arg->value.ht || zend_hash_init(arg->value.ht, 0, NULL, PVAL_PTR_DTOR, 0)) {
|
||||
zend_error(E_CORE_ERROR, "Cannot allocate memory for array");
|
||||
return FAILURE;
|
||||
}
|
||||
arg->type = IS_ARRAY;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static void zval_update_const_and_ref(zval **p)
|
||||
{
|
||||
zval_update_constant(*p);
|
||||
zval_add_ref(p);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ZEND_API inline int object_init_ex(zval *arg, zend_class_entry *class_type)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
arg->value.obj.properties = (HashTable *) emalloc(sizeof(HashTable));
|
||||
zend_hash_init(arg->value.obj.properties, 0, NULL, PVAL_PTR_DTOR, 0);
|
||||
zend_hash_copy(arg->value.obj.properties, &class_type->default_properties, (void (*)(void *)) zval_update_const_and_ref, (void *) &tmp, sizeof(zval *));
|
||||
arg->type = IS_OBJECT;
|
||||
arg->value.obj.ce = class_type;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int object_init(zval *arg)
|
||||
{
|
||||
return object_init_ex(arg, &zend_standard_class_def);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_assoc_long(zval *arg, char *key, long n)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_LONG;
|
||||
tmp->value.lval = n;
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_assoc_double(zval *arg, char *key, double d)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_DOUBLE;
|
||||
tmp->value.dval = d;
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_assoc_string(zval *arg, char *key, char *str, int duplicate)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_STRING;
|
||||
tmp->value.str.len = strlen(str);
|
||||
if (duplicate) {
|
||||
tmp->value.str.val = estrndup(str,tmp->value.str.len);
|
||||
} else {
|
||||
tmp->value.str.val = str;
|
||||
}
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_assoc_stringl(zval *arg, char *key, char *str, uint length, int duplicate)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_STRING;
|
||||
tmp->value.str.len = length;
|
||||
if (duplicate) {
|
||||
tmp->value.str.val = estrndup(str,tmp->value.str.len);
|
||||
} else {
|
||||
tmp->value.str.val = str;
|
||||
}
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_assoc_function(zval *arg, char *key,void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS))
|
||||
{
|
||||
zend_error(E_WARNING, "add_assoc_function() is no longer supported");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_index_long(zval *arg, uint index, long n)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_LONG;
|
||||
tmp->value.lval = n;
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_index_double(zval *arg, uint index, double d)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_DOUBLE;
|
||||
tmp->value.dval = d;
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_index_string(zval *arg, uint index, char *str, int duplicate)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_STRING;
|
||||
tmp->value.str.len = strlen(str);
|
||||
if (duplicate) {
|
||||
tmp->value.str.val = estrndup(str,tmp->value.str.len);
|
||||
} else {
|
||||
tmp->value.str.val = str;
|
||||
}
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_index_stringl(zval *arg, uint index, char *str, uint length, int duplicate)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_STRING;
|
||||
tmp->value.str.len = length;
|
||||
if (duplicate) {
|
||||
tmp->value.str.val = estrndup(str,tmp->value.str.len);
|
||||
} else {
|
||||
tmp->value.str.val = str;
|
||||
}
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_next_index_long(zval *arg, long n)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_LONG;
|
||||
tmp->value.lval = n;
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_next_index_double(zval *arg, double d)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_DOUBLE;
|
||||
tmp->value.dval = d;
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_next_index_string(zval *arg, char *str, int duplicate)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_STRING;
|
||||
tmp->value.str.len = strlen(str);
|
||||
if (duplicate) {
|
||||
tmp->value.str.val = estrndup(str,tmp->value.str.len);
|
||||
} else {
|
||||
tmp->value.str.val = str;
|
||||
}
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *),NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_STRING;
|
||||
tmp->value.str.len = length;
|
||||
if (duplicate) {
|
||||
tmp->value.str.val = estrndup(str,tmp->value.str.len);
|
||||
} else {
|
||||
tmp->value.str.val = str;
|
||||
}
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *),NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_get_assoc_string(zval *arg, char *key, char *str, void **dest, int duplicate)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_STRING;
|
||||
tmp->value.str.len = strlen(str);
|
||||
if (duplicate) {
|
||||
tmp->value.str.val = estrndup(str,tmp->value.str.len);
|
||||
} else {
|
||||
tmp->value.str.val = str;
|
||||
}
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), dest);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_get_assoc_stringl(zval *arg, char *key, char *str, uint length, void **dest, int duplicate)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_STRING;
|
||||
tmp->value.str.len = length;
|
||||
if (duplicate) {
|
||||
tmp->value.str.val = estrndup(str,tmp->value.str.len);
|
||||
} else {
|
||||
tmp->value.str.val = str;
|
||||
}
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), dest);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_get_index_long(zval *arg, uint index, long l, void **dest)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_LONG;
|
||||
tmp->value.lval = l;
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),dest);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_get_index_double(zval *arg, uint index, double d, void **dest)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_DOUBLE;
|
||||
tmp->value.dval= d;
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),dest);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_get_index_string(zval *arg, uint index, char *str, void **dest, int duplicate)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_STRING;
|
||||
tmp->value.str.len = strlen(str);
|
||||
if (duplicate) {
|
||||
tmp->value.str.val = estrndup(str,tmp->value.str.len);
|
||||
} else {
|
||||
tmp->value.str.val = str;
|
||||
}
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),dest);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_get_index_stringl(zval *arg, uint index, char *str, uint length, void **dest, int duplicate)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_STRING;
|
||||
tmp->value.str.len = length;
|
||||
if (duplicate) {
|
||||
tmp->value.str.val = estrndup(str,tmp->value.str.len);
|
||||
} else {
|
||||
tmp->value.str.val = str;
|
||||
}
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),dest);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_property_long(zval *arg, char *key, long n)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_LONG;
|
||||
tmp->value.lval = n;
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_update(arg->value.obj.properties, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_property_double(zval *arg, char *key, double d)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_DOUBLE;
|
||||
tmp->value.dval = d;
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_update(arg->value.obj.properties, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_property_string(zval *arg, char *key, char *str, int duplicate)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_STRING;
|
||||
tmp->value.str.len = strlen(str);
|
||||
if (duplicate) {
|
||||
tmp->value.str.val = estrndup(str,tmp->value.str.len);
|
||||
} else {
|
||||
tmp->value.str.val = str;
|
||||
}
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_update(arg->value.obj.properties, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int add_property_stringl(zval *arg, char *key, char *str, uint length, int duplicate)
|
||||
{
|
||||
zval *tmp = (zval *) emalloc(sizeof(zval));
|
||||
|
||||
tmp->type = IS_STRING;
|
||||
tmp->value.str.len = length;
|
||||
if (duplicate) {
|
||||
tmp->value.str.val = estrndup(str,tmp->value.str.len);
|
||||
} else {
|
||||
tmp->value.str.val = str;
|
||||
}
|
||||
INIT_PZVAL(tmp);
|
||||
return zend_hash_update(arg->value.obj.properties, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
int zend_startup_module(zend_module_entry *module)
|
||||
{
|
||||
if (module) {
|
||||
module->module_number = zend_next_free_module();
|
||||
if (module->module_startup_func) {
|
||||
if (module->module_startup_func(MODULE_PERSISTENT, module->module_number)==FAILURE) {
|
||||
zend_error(E_CORE_ERROR,"Unable to start %s module",module->name);
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
module->type = MODULE_PERSISTENT;
|
||||
zend_register_module(module);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int _register_list_destructors(void (*list_destructor)(void *), void (*plist_destructor)(void *), int module_number)
|
||||
{
|
||||
list_destructors_entry ld;
|
||||
|
||||
#if 0
|
||||
printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number);
|
||||
#endif
|
||||
|
||||
ld.list_destructor=(void (*)(void *)) list_destructor;
|
||||
ld.plist_destructor=(void (*)(void *)) plist_destructor;
|
||||
ld.module_number = module_number;
|
||||
ld.resource_id = list_destructors.nNextFreeElement;
|
||||
|
||||
if (zend_hash_next_index_insert(&list_destructors,(void *) &ld,sizeof(list_destructors_entry),NULL)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
return list_destructors.nNextFreeElement-1;
|
||||
}
|
||||
|
||||
|
||||
/* registers all functions in *library_functions in the function hash */
|
||||
int zend_register_functions(zend_function_entry *functions, HashTable *function_table)
|
||||
{
|
||||
zend_function_entry *ptr = functions;
|
||||
zend_internal_function internal_function;
|
||||
int count=0,unload=0;
|
||||
HashTable *target_function_table = function_table;
|
||||
CLS_FETCH();
|
||||
|
||||
if (!target_function_table) {
|
||||
target_function_table = CG(function_table);
|
||||
}
|
||||
internal_function.type = ZEND_INTERNAL_FUNCTION;
|
||||
|
||||
while (ptr->fname) {
|
||||
internal_function.handler = ptr->handler;
|
||||
internal_function.arg_types = ptr->func_arg_types;
|
||||
internal_function.function_name = ptr->fname;
|
||||
if (!internal_function.handler) {
|
||||
zend_error(E_CORE_WARNING,"Null function defined as active function");
|
||||
zend_unregister_functions(functions, count, target_function_table);
|
||||
return FAILURE;
|
||||
}
|
||||
if (zend_hash_add(target_function_table, ptr->fname, strlen(ptr->fname)+1, &internal_function, sizeof(zend_internal_function), NULL) == FAILURE) {
|
||||
unload=1;
|
||||
break;
|
||||
}
|
||||
ptr++;
|
||||
count++;
|
||||
}
|
||||
if (unload) { /* before unloading, display all remaining bad function in the module */
|
||||
while (ptr->fname) {
|
||||
if (zend_hash_exists(target_function_table, ptr->fname, strlen(ptr->fname)+1)) {
|
||||
zend_error(E_CORE_WARNING, "Function registration failed - duplicate name - %s",ptr->fname);
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
zend_unregister_functions(functions, count, target_function_table);
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* count=-1 means erase all functions, otherwise,
|
||||
* erase the first count functions
|
||||
*/
|
||||
void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table)
|
||||
{
|
||||
zend_function_entry *ptr = functions;
|
||||
int i=0;
|
||||
HashTable *target_function_table = function_table;
|
||||
CLS_FETCH();
|
||||
|
||||
if (!target_function_table) {
|
||||
target_function_table = CG(function_table);
|
||||
}
|
||||
while (ptr->fname) {
|
||||
if (count!=-1 && i>=count) {
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
zend_printf("Unregistering %s()\n", ptr->fname);
|
||||
#endif
|
||||
zend_hash_del(target_function_table, ptr->fname, strlen(ptr->fname)+1);
|
||||
ptr++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_register_module(zend_module_entry *module)
|
||||
{
|
||||
#if 0
|
||||
zend_printf("%s: Registering module %d\n",module->name, module->module_number);
|
||||
#endif
|
||||
if (module->functions && zend_register_functions(module->functions, NULL)==FAILURE) {
|
||||
zend_error(E_CORE_WARNING,"%s: Unable to register functions, unable to load",module->name);
|
||||
return FAILURE;
|
||||
}
|
||||
module->module_started=1;
|
||||
return zend_hash_add(&module_registry, module->name,strlen(module->name)+1,(void *)module,sizeof(zend_module_entry),NULL);
|
||||
}
|
||||
|
||||
|
||||
void module_destructor(zend_module_entry *module)
|
||||
{
|
||||
if (module->type == MODULE_TEMPORARY) {
|
||||
zend_hash_apply_with_argument(&list_destructors, (int (*)(void *,void *)) clean_module_resource_destructors, (void *) &(module->module_number));
|
||||
clean_module_constants(module->module_number);
|
||||
}
|
||||
|
||||
if (module->request_started && module->request_shutdown_func) {
|
||||
#if 0
|
||||
zend_printf("%s: Request shutdown\n",module->name);
|
||||
#endif
|
||||
module->request_shutdown_func(module->type, module->module_number);
|
||||
}
|
||||
module->request_started=0;
|
||||
if (module->module_started && module->module_shutdown_func) {
|
||||
#if 0
|
||||
zend_printf("%s: Module shutdown\n",module->name);
|
||||
#endif
|
||||
module->module_shutdown_func(module->type, module->module_number);
|
||||
}
|
||||
module->module_started=0;
|
||||
if (module->functions) {
|
||||
zend_unregister_functions(module->functions, -1, NULL);
|
||||
}
|
||||
|
||||
#if HAVE_LIBDL
|
||||
if (module->handle) {
|
||||
dlclose(module->handle);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* call request startup for all modules */
|
||||
int module_registry_request_startup(zend_module_entry *module)
|
||||
{
|
||||
if (!module->request_started && module->request_startup_func) {
|
||||
#if 0
|
||||
zend_printf("%s: Request startup\n",module->name);
|
||||
#endif
|
||||
module->request_startup_func(module->type, module->module_number);
|
||||
}
|
||||
module->request_started=1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* for persistent modules - call request shutdown and flag NOT to erase
|
||||
* for temporary modules - do nothing, and flag to erase
|
||||
*/
|
||||
int module_registry_cleanup(zend_module_entry *module)
|
||||
{
|
||||
switch(module->type) {
|
||||
case MODULE_PERSISTENT:
|
||||
if (module->request_started && module->request_shutdown_func) {
|
||||
#if 0
|
||||
zend_printf("%s: Request shutdown\n",module->name);
|
||||
#endif
|
||||
module->request_shutdown_func(module->type, module->module_number);
|
||||
}
|
||||
module->request_started=0;
|
||||
return 0;
|
||||
break;
|
||||
case MODULE_TEMPORARY:
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* return the next free module number */
|
||||
int zend_next_free_module(void)
|
||||
{
|
||||
return ++module_count;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API zend_class_entry *register_internal_class(zend_class_entry *class_entry)
|
||||
{
|
||||
zend_class_entry *register_class;
|
||||
char *lowercase_name = zend_strndup(class_entry->name, class_entry->name_length);
|
||||
CLS_FETCH();
|
||||
|
||||
zend_str_tolower(lowercase_name, class_entry->name_length);
|
||||
|
||||
class_entry->type = ZEND_INTERNAL_CLASS;
|
||||
class_entry->parent = NULL;
|
||||
class_entry->refcount = (int *) malloc(sizeof(int));
|
||||
*class_entry->refcount = 1;
|
||||
zend_hash_init(&class_entry->default_properties, 0, NULL, PVAL_PTR_DTOR, 1);
|
||||
zend_hash_init(&class_entry->function_table, 0, NULL, ZEND_FUNCTION_DTOR, 1);
|
||||
|
||||
zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, class_entry, sizeof(zend_class_entry), (void **) ®ister_class);
|
||||
free(lowercase_name);
|
||||
|
||||
if (class_entry->builtin_functions) {
|
||||
zend_register_functions(class_entry->builtin_functions, &class_entry->function_table);
|
||||
}
|
||||
return register_class;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API zend_module_entry *zend_get_module(int module_number)
|
||||
{
|
||||
zend_module_entry *module;
|
||||
|
||||
if (zend_hash_index_find(&module_registry, module_number, (void **) &module)==SUCCESS) {
|
||||
return module;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
+271
@@ -0,0 +1,271 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ZEND_API_H
|
||||
#define _ZEND_API_H
|
||||
|
||||
#include "modules.h"
|
||||
#include "zend_list.h"
|
||||
|
||||
|
||||
#define ZEND_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
|
||||
#define ZEND_FUNCTION(name) ZEND_NAMED_FUNCTION(zend_if_##name)
|
||||
|
||||
#define ZEND_NAMED_FE(runtime_name, name, arg_types) { #runtime_name, name, arg_types },
|
||||
#define ZEND_FE(name, arg_types) ZEND_NAMED_FE(name, zend_if_##name, arg_types)
|
||||
|
||||
|
||||
#define INIT_CLASS_ENTRY(class_container, class_name, functions) \
|
||||
{ \
|
||||
class_container.name = strdup(class_name); \
|
||||
class_container.name_length = sizeof(class_name)-1; \
|
||||
class_container.builtin_functions = functions; \
|
||||
class_container.handle_function_call = NULL; \
|
||||
class_container.handle_property_get = NULL; \
|
||||
class_container.handle_property_set = NULL; \
|
||||
}
|
||||
|
||||
#define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset) \
|
||||
{ \
|
||||
class_container.name = strdup(class_name); \
|
||||
class_container.name_length = sizeof(class_name)-1; \
|
||||
class_container.builtin_functions = functions; \
|
||||
class_container.handle_function_call = handle_fcall; \
|
||||
class_container.handle_property_get = handle_propget; \
|
||||
class_container.handle_property_set = handle_propset; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
int zend_next_free_module(void);
|
||||
|
||||
ZEND_API int getParameters(int ht, int param_count,...);
|
||||
ZEND_API int getParametersArray(int ht, int param_count, zval **argument_array);
|
||||
ZEND_API int getParametersEx(int param_count,...);
|
||||
ZEND_API int getParametersArrayEx(int param_count, zval ***argument_array);
|
||||
|
||||
ZEND_API int ParameterPassedByReference(int ht, uint n);
|
||||
|
||||
int zend_register_functions(zend_function_entry *functions, HashTable *function_table);
|
||||
void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table);
|
||||
ZEND_API int zend_register_module(zend_module_entry *module_entry);
|
||||
ZEND_API zend_class_entry *register_internal_class(zend_class_entry *class_entry);
|
||||
ZEND_API zend_module_entry *zend_get_module(int module_number);
|
||||
|
||||
ZEND_API void wrong_param_count(void);
|
||||
|
||||
#define getThis() (this_ptr)
|
||||
|
||||
#define WRONG_PARAM_COUNT { wrong_param_count(); return; }
|
||||
#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) { wrong_param_count(); return ret; }
|
||||
#define ARG_COUNT(ht) (ht)
|
||||
|
||||
#define BYREF_NONE 0
|
||||
#define BYREF_FORCE 1
|
||||
#define BYREF_ALLOW 2
|
||||
|
||||
#if !(WIN32||WINNT)
|
||||
#define DLEXPORT
|
||||
#endif
|
||||
|
||||
int zend_startup_module(zend_module_entry *module);
|
||||
|
||||
ZEND_API int array_init(zval *arg);
|
||||
ZEND_API int object_init(zval *arg);
|
||||
ZEND_API int object_init_ex(zval *arg, zend_class_entry *ce);
|
||||
ZEND_API int add_assoc_long(zval *arg, char *key, long n);
|
||||
ZEND_API int add_assoc_double(zval *arg, char *key, double d);
|
||||
ZEND_API int add_assoc_string(zval *arg, char *key, char *str, int duplicate);
|
||||
ZEND_API int add_assoc_stringl(zval *arg, char *key, char *str, uint length, int duplicate);
|
||||
ZEND_API int add_assoc_function(zval *arg, char *key,void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS));
|
||||
ZEND_API int add_index_long(zval *arg, uint idx, long n);
|
||||
ZEND_API int add_index_double(zval *arg, uint idx, double d);
|
||||
ZEND_API int add_index_string(zval *arg, uint idx, char *str, int duplicate);
|
||||
ZEND_API int add_index_stringl(zval *arg, uint idx, char *str, uint length, int duplicate);
|
||||
ZEND_API int add_next_index_long(zval *arg, long n);
|
||||
ZEND_API int add_next_index_double(zval *arg, double d);
|
||||
ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate);
|
||||
ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate);
|
||||
|
||||
ZEND_API int add_get_assoc_string(zval *arg, char *key, char *str, void **dest, int duplicate);
|
||||
ZEND_API int add_get_assoc_stringl(zval *arg, char *key, char *str, uint length, void **dest, int duplicate);
|
||||
ZEND_API int add_get_index_long(zval *arg, uint idx, long l, void **dest);
|
||||
ZEND_API int add_get_index_double(zval *arg, uint idx, double d, void **dest);
|
||||
ZEND_API int add_get_index_string(zval *arg, uint idx, char *str, void **dest, int duplicate);
|
||||
ZEND_API int add_get_index_stringl(zval *arg, uint idx, char *str, uint length, void **dest, int duplicate);
|
||||
|
||||
ZEND_API int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval, int param_count, zval *params[]);
|
||||
ZEND_API int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval, int param_count, zval **params[], int no_separation);
|
||||
|
||||
|
||||
ZEND_API int add_property_long(zval *arg, char *key, long l);
|
||||
ZEND_API int add_property_double(zval *arg, char *key, double d);
|
||||
ZEND_API int add_property_string(zval *arg, char *key, char *str, int duplicate);
|
||||
ZEND_API int add_property_stringl(zval *arg, char *key, char *str, uint length, int duplicate);
|
||||
|
||||
#define add_method(arg,key,method) add_assoc_function((arg),(key),(method))
|
||||
|
||||
#define RETVAL_RESOURCE(l) { \
|
||||
return_value->type = IS_RESOURCE;\
|
||||
return_value->value.lval = l; \
|
||||
}
|
||||
#define RETVAL_LONG(l) { \
|
||||
return_value->type = IS_LONG; \
|
||||
return_value->value.lval = l; \
|
||||
}
|
||||
#define RETVAL_DOUBLE(d) { \
|
||||
return_value->type = IS_DOUBLE; \
|
||||
return_value->value.dval = d; \
|
||||
}
|
||||
#define RETVAL_STRING(s,duplicate) { \
|
||||
char *__s=(s); \
|
||||
return_value->value.str.len = strlen(__s); \
|
||||
return_value->value.str.val = (duplicate?estrndup(__s,return_value->value.str.len):__s); \
|
||||
return_value->type = IS_STRING; \
|
||||
}
|
||||
#define RETVAL_STRINGL(s,l,duplicate) { \
|
||||
char *__s=(s); int __l=l; \
|
||||
return_value->value.str.len = __l; \
|
||||
return_value->value.str.val = (duplicate?estrndup(__s,__l):__s); \
|
||||
return_value->type = IS_STRING; \
|
||||
}
|
||||
|
||||
#define RETVAL_FALSE { return_value->value.lval = 0; return_value->type = IS_BOOL; }
|
||||
#define RETVAL_TRUE { return_value->value.lval = 1; return_value->type = IS_BOOL; }
|
||||
|
||||
#define RETURN_RESOURCE(l) { \
|
||||
return_value->type = IS_RESOURCE;\
|
||||
return_value->value.lval = l; \
|
||||
return; \
|
||||
}
|
||||
#define RETURN_LONG(l) { \
|
||||
return_value->type = IS_LONG; \
|
||||
return_value->value.lval = l; \
|
||||
return; \
|
||||
}
|
||||
#define RETURN_DOUBLE(d) { \
|
||||
return_value->type = IS_DOUBLE; \
|
||||
return_value->value.dval = d; \
|
||||
return; \
|
||||
}
|
||||
#define RETURN_STRING(s,duplicate) { \
|
||||
char *__s=(s); \
|
||||
return_value->value.str.len = strlen(__s); \
|
||||
return_value->value.str.val = (duplicate?estrndup(__s,return_value->value.str.len):__s); \
|
||||
return_value->type = IS_STRING; \
|
||||
return; \
|
||||
}
|
||||
#define RETURN_STRINGL(s,l,duplicate) { \
|
||||
char *__s=(s); int __l=l; \
|
||||
return_value->value.str.len = __l; \
|
||||
return_value->value.str.val = (duplicate?estrndup(__s,__l):__s); \
|
||||
return_value->type = IS_STRING; \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define RETURN_FALSE { RETVAL_FALSE; return; }
|
||||
#define RETURN_TRUE { RETVAL_TRUE; return; }
|
||||
|
||||
#define SET_VAR_STRING(n,v) { \
|
||||
{ \
|
||||
zval *var = (zval *) emalloc(sizeof(zval)); \
|
||||
char *str=(v); /* prevent 'v' from being evaluated more than once */ \
|
||||
\
|
||||
var->value.str.val = (str); \
|
||||
var->value.str.len = strlen((str)); \
|
||||
var->type = IS_STRING; \
|
||||
ZEND_SET_GLOBAL_VAR(n, var); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define SET_VAR_STRINGL(n,v,l) { \
|
||||
{ \
|
||||
zval *var = (zval *) emalloc(sizeof(zval)); \
|
||||
\
|
||||
var->value.str.val = (v); \
|
||||
var->value.str.len = (l); \
|
||||
var->type = IS_STRING; \
|
||||
ZEND_SET_GLOBAL_VAR(n, var); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define SET_VAR_LONG(n,v) { \
|
||||
{ \
|
||||
zval *var = (zval *) emalloc(sizeof(zval)); \
|
||||
\
|
||||
var->value.lval = (v); \
|
||||
var->type = IS_LONG; \
|
||||
ZEND_SET_GLOBAL_VAR(n, var); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define SET_VAR_DOUBLE(n,v) { \
|
||||
{ \
|
||||
zval *var = (zval *) emalloc(sizeof(zval)); \
|
||||
\
|
||||
var->value.dval = (v); \
|
||||
var->type = IS_DOUBLE; \
|
||||
ZEND_SET_GLOBAL_VAR(n, var); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define ZEND_SET_SYMBOL(symtable, name, var) \
|
||||
{ \
|
||||
char *_name = (name); \
|
||||
\
|
||||
ZEND_SET_SYMBOL_WITH_LENGTH(symtable, _name, strlen(_name)+1, var); \
|
||||
}
|
||||
|
||||
|
||||
#define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var) \
|
||||
{ \
|
||||
zval **orig_var; \
|
||||
\
|
||||
if (zend_hash_find(symtable, (name), (name_length), (void **) &orig_var)==SUCCESS \
|
||||
&& PZVAL_IS_REF(*orig_var)) { \
|
||||
var->refcount = (*orig_var)->refcount; \
|
||||
var->EA.locks = (*orig_var)->EA.locks; \
|
||||
var->EA.is_ref = 1; \
|
||||
\
|
||||
zval_dtor(*orig_var); \
|
||||
**orig_var = *var; \
|
||||
efree(var); \
|
||||
} else { \
|
||||
INIT_PZVAL(var); \
|
||||
zend_hash_update(symtable, (name), (name_length), &var, sizeof(zval *), NULL); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define ZEND_SET_GLOBAL_VAR(name, var) \
|
||||
ZEND_SET_SYMBOL(&EG(symbol_table), name, var)
|
||||
|
||||
#define ZEND_SET_GLOBAL_VAR_WITH_LENGTH(name, name_length, var) \
|
||||
ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table), name, name_length, var)
|
||||
|
||||
#endif /* _ZEND_API_H */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -0,0 +1,592 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_alloc.h"
|
||||
#include "zend_globals.h"
|
||||
#if HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef ZTS
|
||||
static zend_alloc_globals alloc_globals;
|
||||
#endif
|
||||
|
||||
|
||||
#if ZEND_DEBUG
|
||||
# define END_MAGIC_SIZE sizeof(long)
|
||||
# define END_ALIGNMENT(size) (((size)%PLATFORM_ALIGNMENT)?(PLATFORM_ALIGNMENT-((size)%PLATFORM_ALIGNMENT)):0)
|
||||
#else
|
||||
# define END_MAGIC_SIZE 0
|
||||
# define END_ALIGNMENT(size) 0
|
||||
#endif
|
||||
|
||||
|
||||
# if MEMORY_LIMIT
|
||||
# if ZEND_DEBUG
|
||||
#define CHECK_MEMORY_LIMIT(s) _CHECK_MEMORY_LIMIT(s,filename,lineno)
|
||||
# else
|
||||
#define CHECK_MEMORY_LIMIT(s) _CHECK_MEMORY_LIMIT(s,NULL,0)
|
||||
# endif
|
||||
|
||||
#define _CHECK_MEMORY_LIMIT(s,file,lineno) { AG(allocated_memory) += (s);\
|
||||
if (AG(memory_limit)<AG(allocated_memory)) {\
|
||||
if (!file) { \
|
||||
zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted (tried to allocate %d bytes)", AG(memory_limit),s); \
|
||||
} else { \
|
||||
zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)", AG(memory_limit), file, lineno, s); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
# endif
|
||||
|
||||
#ifndef CHECK_MEMORY_LIMIT
|
||||
#define CHECK_MEMORY_LIMIT(s)
|
||||
#endif
|
||||
|
||||
|
||||
#define REMOVE_POINTER_FROM_LIST(p) \
|
||||
if (!p->persistent && p==AG(head)) { \
|
||||
AG(head) = p->pNext; \
|
||||
} else if (p->persistent && p==AG(phead)) { \
|
||||
AG(phead) = p->pNext; \
|
||||
} else { \
|
||||
p->pLast->pNext = p->pNext; \
|
||||
} \
|
||||
if (p->pNext) { \
|
||||
p->pNext->pLast = p->pLast; \
|
||||
}
|
||||
|
||||
#define ADD_POINTER_TO_LIST(p) \
|
||||
if (p->persistent) { \
|
||||
p->pNext = AG(phead); \
|
||||
if (AG(phead)) { \
|
||||
AG(phead)->pLast = p; \
|
||||
} \
|
||||
AG(phead) = p; \
|
||||
} else { \
|
||||
p->pNext = AG(head); \
|
||||
if (AG(head)) { \
|
||||
AG(head)->pLast = p; \
|
||||
} \
|
||||
AG(head) = p; \
|
||||
} \
|
||||
p->pLast = (mem_header *) NULL;
|
||||
|
||||
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_API void *_emalloc(size_t size, char *filename, uint lineno)
|
||||
#else
|
||||
ZEND_API void *_emalloc(size_t size)
|
||||
#endif
|
||||
{
|
||||
mem_header *p;
|
||||
ALS_FETCH();
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
if ((size < MAX_CACHED_MEMORY) && (AG(cache_count)[size] > 0)) {
|
||||
p = AG(cache)[size][--AG(cache_count)[size]];
|
||||
#if ZEND_DEBUG
|
||||
p->filename = filename;
|
||||
p->lineno = lineno;
|
||||
p->magic = MEM_BLOCK_START_MAGIC;
|
||||
p->reported = 0;
|
||||
#endif
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
p->persistent = 0;
|
||||
p->cached = 0;
|
||||
return (void *)((char *)p + sizeof(mem_header) + PLATFORM_PADDING);
|
||||
} else {
|
||||
p = (mem_header *) malloc(sizeof(mem_header) + size + PLATFORM_PADDING + END_ALIGNMENT(size) + END_MAGIC_SIZE);
|
||||
}
|
||||
|
||||
if (!p) {
|
||||
fprintf(stderr,"FATAL: emalloc(): Unable to allocate %ld bytes\n", (long) size);
|
||||
#if ZEND_DEBUG && HAVE_KILL && HAVE_GETPID
|
||||
kill(getpid(), SIGSEGV);
|
||||
#else
|
||||
exit(1);
|
||||
#endif
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (void *)p;
|
||||
}
|
||||
p->persistent = p->cached = 0;
|
||||
ADD_POINTER_TO_LIST(p);
|
||||
p->size = size;
|
||||
#if ZEND_DEBUG
|
||||
p->filename = filename;
|
||||
p->lineno = lineno;
|
||||
p->magic = MEM_BLOCK_START_MAGIC;
|
||||
p->reported = 0;
|
||||
*((long *)(((char *) p) + sizeof(mem_header)+size+PLATFORM_PADDING+END_ALIGNMENT(size))) = MEM_BLOCK_END_MAGIC;
|
||||
#endif
|
||||
#if MEMORY_LIMIT
|
||||
CHECK_MEMORY_LIMIT(size);
|
||||
#endif
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (void *)((char *)p + sizeof(mem_header) + PLATFORM_PADDING);
|
||||
}
|
||||
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_API void _efree(void *ptr, char *filename, uint lineno)
|
||||
#else
|
||||
ZEND_API void _efree(void *ptr)
|
||||
#endif
|
||||
{
|
||||
mem_header *p = (mem_header *) ((char *)ptr - sizeof(mem_header) - PLATFORM_PADDING);
|
||||
ALS_FETCH();
|
||||
|
||||
#if ZEND_DEBUG
|
||||
if (!_mem_block_check(ptr, 1, filename, lineno)) {
|
||||
return;
|
||||
}
|
||||
memset(ptr, 0x5a, p->size);
|
||||
#endif
|
||||
|
||||
if (!p->persistent && (p->size < MAX_CACHED_MEMORY) && (AG(cache_count)[p->size] < MAX_CACHED_ENTRIES)) {
|
||||
AG(cache)[p->size][AG(cache_count)[p->size]++] = p;
|
||||
p->cached = 1;
|
||||
#if ZEND_DEBUG
|
||||
p->magic = MEM_BLOCK_CACHED_MAGIC;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
REMOVE_POINTER_FROM_LIST(p);
|
||||
|
||||
#if MEMORY_LIMIT
|
||||
AG(allocated_memory) -= p->size;
|
||||
#endif
|
||||
|
||||
free(p);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
}
|
||||
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_API void *_ecalloc(size_t nmemb, size_t size, char *filename, uint lineno)
|
||||
#else
|
||||
ZEND_API void *_ecalloc(size_t nmemb, size_t size)
|
||||
#endif
|
||||
{
|
||||
void *p;
|
||||
int final_size=size*nmemb;
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
#if ZEND_DEBUG
|
||||
p = _emalloc(final_size,filename,lineno);
|
||||
#else
|
||||
p = emalloc(final_size);
|
||||
#endif
|
||||
if (!p) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (void *) p;
|
||||
}
|
||||
memset(p,(int)NULL,final_size);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure, char *filename, uint lineno)
|
||||
#else
|
||||
ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure)
|
||||
#endif
|
||||
{
|
||||
mem_header *p = (mem_header *) ((char *)ptr-sizeof(mem_header)-PLATFORM_PADDING);
|
||||
mem_header *orig = p;
|
||||
ALS_FETCH();
|
||||
|
||||
if (!ptr) {
|
||||
#if ZEND_DEBUG
|
||||
return _emalloc(size, filename, lineno);
|
||||
#else
|
||||
return emalloc(size);
|
||||
#endif
|
||||
}
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
REMOVE_POINTER_FROM_LIST(p);
|
||||
p = (mem_header *) realloc(p,sizeof(mem_header)+size+PLATFORM_PADDING+END_ALIGNMENT(size)+END_MAGIC_SIZE);
|
||||
if (!p) {
|
||||
if (!allow_failure) {
|
||||
fprintf(stderr,"FATAL: erealloc(): Unable to allocate %ld bytes\n", (long) size);
|
||||
#if ZEND_DEBUG && HAVE_KILL && HAVE_GETPID
|
||||
kill(getpid(), SIGSEGV);
|
||||
#else
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
ADD_POINTER_TO_LIST(orig);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (void *)NULL;
|
||||
}
|
||||
ADD_POINTER_TO_LIST(p);
|
||||
#if ZEND_DEBUG
|
||||
p->filename = filename;
|
||||
p->lineno = lineno;
|
||||
p->magic = MEM_BLOCK_START_MAGIC;
|
||||
*((long *)(((char *) p) + sizeof(mem_header)+size+PLATFORM_PADDING+END_ALIGNMENT(size))) = MEM_BLOCK_END_MAGIC;
|
||||
#endif
|
||||
#if MEMORY_LIMIT
|
||||
CHECK_MEMORY_LIMIT(size - p->size);
|
||||
#endif
|
||||
p->size = size;
|
||||
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (void *)((char *)p+sizeof(mem_header)+PLATFORM_PADDING);
|
||||
}
|
||||
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_API char *_estrdup(const char *s, char *filename, uint lineno)
|
||||
#else
|
||||
ZEND_API char *_estrdup(const char *s)
|
||||
#endif
|
||||
{
|
||||
int length;
|
||||
char *p;
|
||||
|
||||
length = strlen(s)+1;
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
#if ZEND_DEBUG
|
||||
p = (char *) _emalloc(length,filename,lineno);
|
||||
#else
|
||||
p = (char *) emalloc(length);
|
||||
#endif
|
||||
if (!p) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (char *)NULL;
|
||||
}
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
memcpy(p,s,length);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_API char *_estrndup(const char *s, uint length, char *filename, uint lineno)
|
||||
#else
|
||||
ZEND_API char *_estrndup(const char *s, uint length)
|
||||
#endif
|
||||
{
|
||||
char *p;
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
#if ZEND_DEBUG
|
||||
p = (char *) _emalloc(length+1,filename,lineno);
|
||||
#else
|
||||
p = (char *) emalloc(length+1);
|
||||
#endif
|
||||
if (!p) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (char *)NULL;
|
||||
}
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
memcpy(p,s,length);
|
||||
p[length]=0;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *zend_strndup(const char *s, uint length)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = (char *) malloc(length+1);
|
||||
if (!p) {
|
||||
return (char *)NULL;
|
||||
}
|
||||
if (length) {
|
||||
memcpy(p,s,length);
|
||||
}
|
||||
p[length]=0;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_set_memory_limit(unsigned int memory_limit)
|
||||
{
|
||||
#if MEMORY_LIMIT
|
||||
ALS_FETCH();
|
||||
|
||||
AG(memory_limit) = memory_limit;
|
||||
return SUCCESS;
|
||||
#else
|
||||
return FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void start_memory_manager(void)
|
||||
{
|
||||
ALS_FETCH();
|
||||
|
||||
AG(phead) = AG(head) = NULL;
|
||||
|
||||
#if MEMORY_LIMIT
|
||||
AG(memory_limit)=1<<30; /* rediculous limit, effectively no limit */
|
||||
AG(allocated_memory)=0;
|
||||
AG(memory_exhausted)=0;
|
||||
#endif
|
||||
|
||||
memset(AG(cache_count),0,MAX_CACHED_MEMORY*sizeof(unsigned char));
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void shutdown_memory_manager(int silent, int clean_cache)
|
||||
{
|
||||
mem_header *p, *t;
|
||||
#ifdef ZEND_DEBUG
|
||||
int had_leaks=0;
|
||||
#endif
|
||||
ALS_FETCH();
|
||||
|
||||
p=AG(head);
|
||||
t=AG(head);
|
||||
while (t) {
|
||||
if (!t->cached || clean_cache) {
|
||||
#if ZEND_DEBUG
|
||||
if (!t->cached && !t->reported) {
|
||||
mem_header *iterator;
|
||||
int total_leak=0, total_leak_count=0;
|
||||
|
||||
had_leaks=1;
|
||||
if (!silent) {
|
||||
zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, t);
|
||||
}
|
||||
t->reported = 1;
|
||||
for (iterator=t->pNext; iterator; iterator=iterator->pNext) {
|
||||
if (!iterator->cached
|
||||
&& iterator->filename==t->filename
|
||||
&& iterator->lineno==t->lineno) {
|
||||
total_leak += iterator->size;
|
||||
total_leak_count++;
|
||||
iterator->reported = 1;
|
||||
}
|
||||
}
|
||||
if (!silent && total_leak_count>0) {
|
||||
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) (long) (total_leak_count));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
p = t->pNext;
|
||||
REMOVE_POINTER_FROM_LIST(t);
|
||||
free(t);
|
||||
t = p;
|
||||
} else {
|
||||
t = t->pNext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if ZEND_DEBUG
|
||||
void zend_debug_alloc_output(char *format, ...)
|
||||
{
|
||||
char output_buf[256];
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(output_buf, format, args);
|
||||
va_end(args);
|
||||
|
||||
#if WIN32||WINNT
|
||||
OutputDebugString(output_buf);
|
||||
#else
|
||||
fprintf(stderr, output_buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int _mem_block_check(void *ptr, int silent, char *filename, int lineno)
|
||||
{
|
||||
mem_header *p = (mem_header *) ((char *)ptr - sizeof(mem_header) - PLATFORM_PADDING);
|
||||
int no_cache_notice=0;
|
||||
int valid_beginning=1;
|
||||
int had_problems=0;
|
||||
|
||||
if (silent==2) {
|
||||
silent=1;
|
||||
no_cache_notice=1;
|
||||
}
|
||||
if (silent==3) {
|
||||
silent=0;
|
||||
no_cache_notice=1;
|
||||
}
|
||||
if (!silent) {
|
||||
zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL);
|
||||
zend_debug_alloc_output("---------------------------------------\n");
|
||||
zend_debug_alloc_output("%s(%d) : Block 0x%0.8lX status:\n", filename, lineno, (long) p);
|
||||
zend_debug_alloc_output("%10s\t","Beginning: ");
|
||||
}
|
||||
|
||||
switch (p->magic) {
|
||||
case MEM_BLOCK_START_MAGIC:
|
||||
if (!silent) {
|
||||
zend_debug_alloc_output("OK (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size);
|
||||
}
|
||||
break; /* ok */
|
||||
case MEM_BLOCK_FREED_MAGIC:
|
||||
if (!silent) {
|
||||
zend_debug_alloc_output("Freed\n");
|
||||
had_problems=1;
|
||||
} else {
|
||||
return _mem_block_check(ptr, 0, filename, lineno);
|
||||
}
|
||||
break;
|
||||
case MEM_BLOCK_CACHED_MAGIC:
|
||||
if (!silent) {
|
||||
if (!no_cache_notice) {
|
||||
zend_debug_alloc_output("Cached (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size);
|
||||
had_problems=1;
|
||||
}
|
||||
} else {
|
||||
if (!no_cache_notice) {
|
||||
return _mem_block_check(ptr, 0, filename, lineno);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (!silent) {
|
||||
zend_debug_alloc_output("Overrun (magic=0x%0.8lX, expected=0x%0.8lX)\n", p->magic, MEM_BLOCK_START_MAGIC);
|
||||
} else {
|
||||
return _mem_block_check(ptr, 0, filename, lineno);
|
||||
}
|
||||
had_problems=1;
|
||||
valid_beginning=0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (valid_beginning
|
||||
&& *((long *)(((char *) p)+sizeof(mem_header)+p->size+PLATFORM_PADDING+END_ALIGNMENT(p->size))) != MEM_BLOCK_END_MAGIC) {
|
||||
long magic_num = MEM_BLOCK_END_MAGIC;
|
||||
char *overflow_ptr, *magic_ptr=(char *) &magic_num;
|
||||
int overflows=0;
|
||||
int i;
|
||||
|
||||
if (silent) {
|
||||
return _mem_block_check(ptr, 0, filename, lineno);
|
||||
}
|
||||
had_problems=1;
|
||||
overflow_ptr = ((char *) p)+sizeof(mem_header)+p->size+PLATFORM_PADDING;
|
||||
|
||||
for (i=0; i<sizeof(long); i++) {
|
||||
if (overflow_ptr[i]!=magic_ptr[i]) {
|
||||
overflows++;
|
||||
}
|
||||
}
|
||||
|
||||
zend_debug_alloc_output("%10s\t", "End:");
|
||||
zend_debug_alloc_output("Overflown (magic=0x%0.8lX instead of 0x%0.8lX)\n",
|
||||
*((long *)(((char *) p) + sizeof(mem_header)+p->size+PLATFORM_PADDING+END_ALIGNMENT(p->size))), MEM_BLOCK_END_MAGIC);
|
||||
zend_debug_alloc_output("%10s\t","");
|
||||
if (overflows>=sizeof(long)) {
|
||||
zend_debug_alloc_output("At least %d bytes overflown\n", sizeof(long));
|
||||
} else {
|
||||
zend_debug_alloc_output("%d byte(s) overflown\n", overflows);
|
||||
}
|
||||
} else if (!silent) {
|
||||
zend_debug_alloc_output("%10s\t", "End:");
|
||||
if (valid_beginning) {
|
||||
zend_debug_alloc_output("OK\n");
|
||||
} else {
|
||||
zend_debug_alloc_output("Unknown\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (had_problems) {
|
||||
int foo = 5;
|
||||
|
||||
foo+=1;
|
||||
}
|
||||
|
||||
if (!silent) {
|
||||
zend_debug_alloc_output("---------------------------------------\n");
|
||||
}
|
||||
return ((!had_problems) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void _full_mem_check(int silent, char *filename, uint lineno)
|
||||
{
|
||||
mem_header *p;
|
||||
int errors=0;
|
||||
ALS_FETCH();
|
||||
|
||||
p = AG(head);
|
||||
|
||||
|
||||
zend_debug_alloc_output("------------------------------------------------\n");
|
||||
zend_debug_alloc_output("Full Memory Check at %s:%d\n", filename, lineno);
|
||||
|
||||
while (p) {
|
||||
if (!_mem_block_check((void *)((char *)p + sizeof(mem_header) + PLATFORM_PADDING), (silent?2:3), filename, lineno)) {
|
||||
errors++;
|
||||
}
|
||||
p = p->pNext;
|
||||
}
|
||||
zend_debug_alloc_output("End of full memory check %s:%d (%d errors)\n", filename, lineno, errors);
|
||||
zend_debug_alloc_output("------------------------------------------------\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_API void _persist_alloc(void *ptr, char *filename, uint lineno)
|
||||
#else
|
||||
ZEND_API void _persist_alloc(void *ptr)
|
||||
#endif
|
||||
{
|
||||
mem_header *p = (mem_header *) ((char *)ptr-sizeof(mem_header)-PLATFORM_PADDING);
|
||||
ALS_FETCH();
|
||||
|
||||
#if ZEND_DEBUG
|
||||
_mem_block_check(ptr, 1, filename, lineno);
|
||||
#endif
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
/* remove the block from the non persistent list */
|
||||
REMOVE_POINTER_FROM_LIST(p);
|
||||
|
||||
p->persistent = 1;
|
||||
|
||||
/* add the block to the persistent list */
|
||||
ADD_POINTER_TO_LIST(p);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ALLOC_H
|
||||
#define _ALLOC_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define MEM_BLOCK_START_MAGIC 0x7312F8DCL
|
||||
#define MEM_BLOCK_END_MAGIC 0x2A8FCC84L
|
||||
#define MEM_BLOCK_FREED_MAGIC 0x99954317L
|
||||
#define MEM_BLOCK_CACHED_MAGIC 0xFB8277DCL
|
||||
|
||||
typedef struct _mem_header {
|
||||
#if ZEND_DEBUG
|
||||
long magic;
|
||||
char *filename;
|
||||
uint lineno;
|
||||
int reported;
|
||||
#endif
|
||||
struct _mem_header *pNext;
|
||||
struct _mem_header *pLast;
|
||||
unsigned int size:30;
|
||||
unsigned int persistent:1;
|
||||
unsigned int cached:1;
|
||||
} mem_header;
|
||||
|
||||
typedef union _align_test {
|
||||
void *ptr;
|
||||
double dbl;
|
||||
long lng;
|
||||
} align_test;
|
||||
|
||||
#define MAX_CACHED_MEMORY 64
|
||||
#define MAX_CACHED_ENTRIES 16
|
||||
|
||||
#define PLATFORM_ALIGNMENT (sizeof(align_test))
|
||||
#define PLATFORM_PADDING (((PLATFORM_ALIGNMENT-sizeof(mem_header))%PLATFORM_ALIGNMENT+PLATFORM_ALIGNMENT)%PLATFORM_ALIGNMENT)
|
||||
|
||||
ZEND_API char *zend_strndup(const char *s, unsigned int length);
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_API void *_emalloc(size_t size, char *filename, uint lineno);
|
||||
ZEND_API void _efree(void *ptr, char *filename, uint lineno);
|
||||
ZEND_API void *_ecalloc(size_t nmemb, size_t size, char *filename, uint lineno);
|
||||
ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure, char *filename, uint lineno);
|
||||
ZEND_API char *_estrdup(const char *s, char *filename, uint lineno);
|
||||
ZEND_API char *_estrndup(const char *s, unsigned int length, char *filename, uint lineno);
|
||||
ZEND_API void _persist_alloc(void *ptr, char *filename, uint lineno);
|
||||
#define emalloc(size) _emalloc((size),__FILE__,__LINE__)
|
||||
#define efree(ptr) _efree((ptr),__FILE__,__LINE__)
|
||||
#define ecalloc(nmemb,size) _ecalloc((nmemb),(size),__FILE__,__LINE__)
|
||||
#define erealloc(ptr,size) _erealloc((ptr),(size),0,__FILE__,__LINE__)
|
||||
#define erealloc_recoverable(ptr,size) _erealloc((ptr),(size),1,__FILE__,__LINE__)
|
||||
#define estrdup(s) _estrdup((s),__FILE__,__LINE__)
|
||||
#define estrndup(s,length) _estrndup((s),(length),__FILE__,__LINE__)
|
||||
#define persist_alloc(p) _persist_alloc((p),__FILE__,__LINE__)
|
||||
#else
|
||||
ZEND_API void *_emalloc(size_t size);
|
||||
ZEND_API void _efree(void *ptr);
|
||||
ZEND_API void *_ecalloc(size_t nmemb, size_t size);
|
||||
ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure);
|
||||
ZEND_API char *_estrdup(const char *s);
|
||||
ZEND_API char *_estrndup(const char *s, unsigned int length);
|
||||
ZEND_API void _persist_alloc(void *ptr);
|
||||
#define emalloc(size) _emalloc((size))
|
||||
#define efree(ptr) _efree((ptr))
|
||||
#define ecalloc(nmemb,size) _ecalloc((nmemb),(size))
|
||||
#define erealloc(ptr,size) _erealloc((ptr),(size),0)
|
||||
#define erealloc_recoverable(ptr,size) _erealloc((ptr),(size),1)
|
||||
#define estrdup(s) _estrdup((s))
|
||||
#define estrndup(s,length) _estrndup((s),(length))
|
||||
#define persist_alloc(p) _persist_alloc((p))
|
||||
#endif
|
||||
|
||||
#define pemalloc(size,persistent) ((persistent)?malloc(size):emalloc(size))
|
||||
#define pefree(ptr,persistent) ((persistent)?free(ptr):efree(ptr))
|
||||
#define pecalloc(nmemb,size,persistent) ((persistent)?calloc((nmemb),(size)):ecalloc((nmemb),(size)))
|
||||
#define perealloc(ptr,size,persistent) ((persistent)?realloc((ptr),(size)):erealloc((ptr),(size)))
|
||||
#define perealloc_recoverable(ptr,size,persistent) ((persistent)?realloc((ptr),(size)):erealloc_recoverable((ptr),(size)))
|
||||
#define pestrdup(s,persistent) ((persistent)?strdup(s):estrdup(s))
|
||||
|
||||
#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):(empty_string))
|
||||
#define safe_estrndup(ptr,len) ((ptr)?(estrndup((ptr),(len))):(empty_string))
|
||||
|
||||
ZEND_API int zend_set_memory_limit(unsigned int memory_limit);
|
||||
|
||||
ZEND_API void start_memory_manager(void);
|
||||
ZEND_API void shutdown_memory_manager(int silent, int clean_cache);
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_API int _mem_block_check(void *ptr, int silent, char *filename, int lineno);
|
||||
ZEND_API void _full_mem_check(int silent, char *filename, uint lineno);
|
||||
#define mem_block_check(ptr, silent) _mem_block_check(ptr, silent, __FILE__, __LINE__)
|
||||
#define mem_block_check(ptr, silent) _mem_block_check(ptr, silent, __FILE__, __LINE__)
|
||||
#define full_mem_check(silent) _full_mem_check(silent, __FILE__, __LINE__)
|
||||
#else
|
||||
#define mem_block_check(type, ptr, silent)
|
||||
#define full_mem_check(silent)
|
||||
#endif
|
||||
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
+2048
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,562 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _COMPILE_H
|
||||
#define _COMPILE_H
|
||||
|
||||
#include "zend.h"
|
||||
|
||||
#if HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#include "zend_llist.h"
|
||||
#define YYSTYPE znode
|
||||
#include "zend-parser.h"
|
||||
|
||||
#define DEBUG_ZEND 0
|
||||
|
||||
#ifndef ZTS
|
||||
#define SUPPORT_INTERACTIVE 1
|
||||
#else
|
||||
#define SUPPORT_INTERACTIVE 0
|
||||
#endif
|
||||
|
||||
#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);
|
||||
|
||||
|
||||
#if SUPPORT_INTERACTIVE
|
||||
#define INC_BPC(op_array) ((op_array)->backpatch_count++)
|
||||
#define DEC_BPC(op_array) ((op_array)->backpatch_count--)
|
||||
#define HANDLE_INTERACTIVE() if (EG(interactive)) { execute_new_code(CLS_C); }
|
||||
#else
|
||||
#define INC_BPC(op_array)
|
||||
#define DEC_BPC(op_array)
|
||||
#define HANDLE_INTERACTIVE()
|
||||
#endif
|
||||
|
||||
typedef struct _zend_op_array zend_op_array;
|
||||
|
||||
typedef struct _znode {
|
||||
int op_type;
|
||||
union {
|
||||
zval constant;
|
||||
|
||||
int var;
|
||||
int opline_num;
|
||||
int fetch_type;
|
||||
zend_op_array *op_array;
|
||||
struct {
|
||||
int var; /* dummy */
|
||||
int type;
|
||||
} EA;
|
||||
} u;
|
||||
} znode;
|
||||
|
||||
|
||||
typedef struct _zend_op {
|
||||
int opcode;
|
||||
znode result;
|
||||
znode op1;
|
||||
znode op2;
|
||||
ulong extended_value;
|
||||
char *filename;
|
||||
uint lineno;
|
||||
} zend_op;
|
||||
|
||||
|
||||
typedef struct _zend_brk_cont_element {
|
||||
int cont;
|
||||
int brk;
|
||||
int parent;
|
||||
} zend_brk_cont_element;
|
||||
|
||||
|
||||
struct _zend_op_array {
|
||||
int type; /* MUST be the first element of this struct! */
|
||||
|
||||
unsigned char *arg_types; /* MUST be the second element of this struct! */
|
||||
|
||||
int *refcount;
|
||||
|
||||
zend_op *opcodes;
|
||||
int last, size;
|
||||
|
||||
int T;
|
||||
|
||||
char *function_name;
|
||||
|
||||
zend_brk_cont_element *brk_cont_array;
|
||||
int last_brk_cont;
|
||||
int current_brk_cont;
|
||||
unsigned char uses_globals;
|
||||
|
||||
/* static variables support */
|
||||
HashTable *static_variables;
|
||||
|
||||
#if SUPPORT_INTERACTIVE
|
||||
int start_op_number, end_op_number;
|
||||
int last_executed_op_number;
|
||||
int backpatch_count;
|
||||
#endif
|
||||
|
||||
void *reserved[4];
|
||||
};
|
||||
|
||||
|
||||
typedef struct _zend_internal_function {
|
||||
int type; /* MUST be the first element of this struct! */
|
||||
|
||||
unsigned char *arg_types; /* MUST be the second element of this struct */
|
||||
|
||||
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
|
||||
char *function_name;
|
||||
} zend_internal_function;
|
||||
|
||||
|
||||
typedef union _zend_function {
|
||||
int type; /* MUST be the first element of this struct! */
|
||||
struct {
|
||||
int type; /* never used */
|
||||
unsigned char *arg_types;
|
||||
} common;
|
||||
|
||||
zend_op_array op_array;
|
||||
zend_internal_function internal_function;
|
||||
} zend_function;
|
||||
|
||||
|
||||
typedef struct _zend_function_state {
|
||||
HashTable *function_symbol_table;
|
||||
zend_function *function;
|
||||
void *reserved[4];
|
||||
} zend_function_state;
|
||||
|
||||
|
||||
typedef struct _zend_switch_entry {
|
||||
znode cond;
|
||||
int default_case;
|
||||
int control_var;
|
||||
} zend_switch_entry;
|
||||
|
||||
|
||||
typedef struct _list_llist_element {
|
||||
znode var;
|
||||
zend_llist dimensions;
|
||||
znode value;
|
||||
} list_llist_element;
|
||||
|
||||
|
||||
typedef struct _zend_file_handle {
|
||||
int type;
|
||||
char *filename;
|
||||
union {
|
||||
int fd;
|
||||
FILE *fp;
|
||||
#ifdef __cplusplus
|
||||
istream *is;
|
||||
#endif
|
||||
} handle;
|
||||
} zend_file_handle;
|
||||
|
||||
|
||||
#include "zend_globals.h"
|
||||
|
||||
#define IS_CONST (1<<0)
|
||||
#define IS_TMP_VAR (1<<1)
|
||||
#define IS_VAR (1<<2)
|
||||
#define IS_UNUSED (1<<3) /* Unused variable */
|
||||
|
||||
|
||||
#define EXT_TYPE_UNUSED (1<<0)
|
||||
|
||||
void init_compiler(CLS_D ELS_DC);
|
||||
void shutdown_compiler(CLS_D);
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
extern ZEND_API zend_op_array *(*zend_compile_files)(int mark_as_ref CLS_DC, int file_count, ...);
|
||||
|
||||
void zend_activate(CLS_D ELS_DC);
|
||||
void zend_deactivate(CLS_D ELS_DC);
|
||||
|
||||
int lex_scan(zval *zendlval CLS_DC);
|
||||
void startup_scanner(CLS_D);
|
||||
void shutdown_scanner(CLS_D);
|
||||
|
||||
ZEND_API char *zend_set_compiled_filename(char *new_compiled_filename);
|
||||
ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename);
|
||||
ZEND_API char *zend_get_compiled_filename();
|
||||
|
||||
#ifdef ZTS
|
||||
const char *zend_get_zendtext(CLS_D);
|
||||
int zend_get_zendleng(CLS_D);
|
||||
#endif
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
/* parser-driven code generators */
|
||||
void do_binary_op(int op, znode *result, znode *op1, znode *op2 CLS_DC);
|
||||
void do_unary_op(int op, znode *result, znode *op1 CLS_DC);
|
||||
void do_binary_assign_op(int op, znode *result, znode *op1, znode *op2 CLS_DC);
|
||||
void do_assign(znode *result, znode *variable, znode *value CLS_DC);
|
||||
void do_assign_ref(znode *result, znode *lvar, znode *rvar CLS_DC);
|
||||
void fetch_simple_variable(znode *result, znode *varname, int bp CLS_DC);
|
||||
void do_indirect_references(znode *result, znode *num_references, znode *variable CLS_DC);
|
||||
void do_fetch_global_or_static_variable(znode *varname, znode *static_assignment, int fetch_type CLS_DC);
|
||||
void do_fetch_globals(znode *varname CLS_DC);
|
||||
|
||||
void fetch_array_begin(znode *result, znode *varname, znode *first_dim CLS_DC);
|
||||
void fetch_array_dim(znode *result, znode *parent, znode *dim CLS_DC);
|
||||
void do_print(znode *result, znode *arg CLS_DC);
|
||||
void do_echo(znode *arg CLS_DC);
|
||||
typedef int (*unary_op_type)(zval *, zval *);
|
||||
ZEND_API unary_op_type get_unary_op(int opcode);
|
||||
ZEND_API void *get_binary_op(int opcode);
|
||||
|
||||
void do_while_cond(znode *expr, znode *close_bracket_token CLS_DC);
|
||||
void do_while_end(znode *while_token, znode *close_bracket_token CLS_DC);
|
||||
void do_do_while_begin(CLS_D);
|
||||
void do_do_while_end(znode *do_token, znode *expr CLS_DC);
|
||||
|
||||
|
||||
void do_if_cond(znode *cond, znode *closing_bracket_token CLS_DC);
|
||||
void do_if_after_statement(znode *closing_bracket_token, unsigned char initialize CLS_DC);
|
||||
void do_if_end(CLS_D);
|
||||
|
||||
void do_for_cond(znode *expr, znode *second_semicolon_token CLS_DC);
|
||||
void do_for_before_statement(znode *cond_start, znode *second_semicolon_token CLS_DC);
|
||||
void do_for_end(znode *second_semicolon_token CLS_DC);
|
||||
|
||||
void do_pre_incdec(znode *result, znode *op1, int op CLS_DC);
|
||||
void do_post_incdec(znode *result, znode *op1, int op CLS_DC);
|
||||
|
||||
void do_begin_variable_parse(CLS_D);
|
||||
void do_end_variable_parse(int type CLS_DC);
|
||||
|
||||
void do_free(znode *op1 CLS_DC);
|
||||
|
||||
void do_init_string(znode *result CLS_DC);
|
||||
void do_add_char(znode *result, znode *op1, znode *op2 CLS_DC);
|
||||
void do_add_string(znode *result, znode *op1, znode *op2 CLS_DC);
|
||||
void do_add_variable(znode *result, znode *op1, znode *op2 CLS_DC);
|
||||
|
||||
void do_begin_function_declaration(znode *function_token, znode *function_name, int is_method CLS_DC);
|
||||
void do_end_function_declaration(znode *function_token CLS_DC);
|
||||
void do_receive_arg(int op, znode *var, znode *offset, znode *initialization, unsigned char pass_type CLS_DC);
|
||||
int do_begin_function_call(znode *function_name CLS_DC);
|
||||
void do_begin_dynamic_function_call(znode *function_name CLS_DC);
|
||||
void do_begin_class_member_function_call(znode *class_name, znode *function_name CLS_DC);
|
||||
void do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall CLS_DC);
|
||||
void do_return(znode *expr CLS_DC);
|
||||
ZEND_API int do_bind_function_or_class(zend_op *opline, HashTable *function_table, HashTable *class_table, int allow_failure);
|
||||
void do_early_binding(CLS_D);
|
||||
|
||||
void do_pass_param(znode *param, int op, int offset CLS_DC);
|
||||
|
||||
|
||||
void do_boolean_or_begin(znode *expr1, znode *op_token CLS_DC);
|
||||
void do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token CLS_DC);
|
||||
void do_boolean_and_begin(znode *expr1, znode *op_token CLS_DC);
|
||||
void do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token CLS_DC);
|
||||
|
||||
void do_brk_cont(int op, znode *expr CLS_DC);
|
||||
|
||||
void do_switch_cond(znode *cond CLS_DC);
|
||||
void do_switch_end(znode *case_list CLS_DC);
|
||||
void do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr CLS_DC);
|
||||
void do_case_after_statement(znode *result, znode *case_token CLS_DC);
|
||||
void do_default_before_statement(znode *case_list, znode *default_token CLS_DC);
|
||||
|
||||
void do_begin_class_declaration(znode *class_name, znode *parent_class_name CLS_DC);
|
||||
void do_end_class_declaration(CLS_D);
|
||||
void do_declare_property(znode *var_name, znode *value CLS_DC);
|
||||
|
||||
void do_fetch_property(znode *result, znode *object, znode *property CLS_DC);
|
||||
|
||||
|
||||
void do_push_object(znode *object CLS_DC);
|
||||
void do_pop_object(znode *object CLS_DC);
|
||||
|
||||
|
||||
void do_begin_new_object(znode *new_token, znode *class_name CLS_DC);
|
||||
void do_end_new_object(znode *result, znode *class_name, znode *new_token, znode *argument_list CLS_DC);
|
||||
|
||||
void do_fetch_constant(znode *result, znode *constant_name, int mode CLS_DC);
|
||||
|
||||
void do_shell_exec(znode *result, znode *cmd CLS_DC);
|
||||
|
||||
void do_init_array(znode *result, znode *expr, znode *offset CLS_DC);
|
||||
void do_add_array_element(znode *result, znode *expr, znode *offset CLS_DC);
|
||||
void do_add_static_array_element(znode *result, znode *offset, znode *expr);
|
||||
void do_list_init();
|
||||
void do_list_end(znode *result, znode *expr CLS_DC);
|
||||
void do_add_list_element(znode *element CLS_DC);
|
||||
void do_new_list_begin(CLS_D);
|
||||
void do_new_list_end(CLS_D);
|
||||
|
||||
void do_cast(znode *result, znode *expr, int type CLS_DC);
|
||||
void do_include_or_eval(int type, znode *result, znode *op1 CLS_DC);
|
||||
|
||||
void do_unset(znode *variable CLS_DC);
|
||||
void do_isset_or_isempty(int type, znode *result, znode *variable CLS_DC);
|
||||
|
||||
void do_foreach_begin(znode *foreach_token, znode *array, znode *open_brackets_token, znode *as_token CLS_DC);
|
||||
void do_foreach_cont(znode *value, znode *key, znode *as_token CLS_DC);
|
||||
void do_foreach_end(znode *foreach_token, znode *open_brackets_token CLS_DC);
|
||||
|
||||
void do_end_heredoc(CLS_D);
|
||||
|
||||
void do_exit(znode *result, znode *message CLS_DC);
|
||||
|
||||
void do_begin_silence(znode *strudel_token CLS_DC);
|
||||
void do_end_silence(znode *strudel_token CLS_DC);
|
||||
|
||||
void do_begin_qm_op(znode *cond, znode *qm_token CLS_DC);
|
||||
void do_qm_true(znode *true_value, znode *qm_token, znode *colon_token CLS_DC);
|
||||
void do_qm_false(znode *result, znode *false_value, znode *qm_token, znode *colon_token CLS_DC);
|
||||
|
||||
void do_extended_info(CLS_D);
|
||||
void do_extended_fcall_begin(CLS_D);
|
||||
void do_extended_fcall_end(CLS_D);
|
||||
|
||||
#define INITIAL_OP_ARRAY_SIZE 64
|
||||
|
||||
|
||||
/* helper functions in zend-scanner.l */
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API int require_file(zend_file_handle *file_handle CLS_DC);
|
||||
ZEND_API int require_filename(char *filename CLS_DC);
|
||||
ZEND_API zend_op_array *compile_files(int mark_as_ref CLS_DC, int file_count, ...);
|
||||
ZEND_API zend_op_array *v_compile_files(int mark_as_ref CLS_DC, int file_count, va_list files);
|
||||
ZEND_API zend_op_array *compile_string(zval *source_string CLS_DC);
|
||||
ZEND_API zend_op_array *compile_filename(zval *filename CLS_DC);
|
||||
ZEND_API inline int open_file_for_scanning(zend_file_handle *file_handle CLS_DC);
|
||||
ZEND_API void init_op_array(zend_op_array *op_array, int initial_ops_size);
|
||||
ZEND_API void destroy_op_array(zend_op_array *op_array);
|
||||
ZEND_API void zend_close_file_handle(zend_file_handle *file_handle CLS_DC);
|
||||
ZEND_API void zend_open_file_dtor(void *f);
|
||||
END_EXTERN_C()
|
||||
|
||||
ZEND_API int destroy_zend_function(zend_function *function);
|
||||
ZEND_API int destroy_zend_class(zend_class_entry *ce);
|
||||
void zend_class_add_ref(zend_class_entry *ce);
|
||||
|
||||
#define ZEND_FUNCTION_DTOR (int (*)(void *)) destroy_zend_function
|
||||
#define ZEND_CLASS_DTOR (int (*)(void *)) destroy_zend_class
|
||||
|
||||
zend_op *get_next_op(zend_op_array *op_array CLS_DC);
|
||||
int get_next_op_number(zend_op_array *op_array);
|
||||
int print_class(zend_class_entry *class_entry);
|
||||
void print_op_array(zend_op_array *op_array, int optimizations);
|
||||
BEGIN_EXTERN_C()
|
||||
int pass_two(zend_op_array *op_array);
|
||||
void pass_include_eval(zend_op_array *op_array);
|
||||
END_EXTERN_C()
|
||||
zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
|
||||
|
||||
|
||||
int zendlex(znode *zendlval CLS_DC);
|
||||
|
||||
|
||||
#define ZEND_NOP 0
|
||||
|
||||
#define ZEND_ADD 1
|
||||
#define ZEND_SUB 2
|
||||
#define ZEND_MUL 3
|
||||
#define ZEND_DIV 4
|
||||
#define ZEND_MOD 5
|
||||
#define ZEND_SL 6
|
||||
#define ZEND_SR 7
|
||||
#define ZEND_CONCAT 8
|
||||
#define ZEND_BW_OR 9
|
||||
#define ZEND_BW_AND 10
|
||||
#define ZEND_BW_XOR 11
|
||||
#define ZEND_BW_NOT 12
|
||||
#define ZEND_BOOL_NOT 13
|
||||
#define ZEND_BOOL_XOR 14
|
||||
#define ZEND_IS_EQUAL 15
|
||||
#define ZEND_IS_NOT_EQUAL 16
|
||||
#define ZEND_IS_SMALLER 17
|
||||
#define ZEND_IS_SMALLER_OR_EQUAL 18
|
||||
#define ZEND_CAST 19
|
||||
#define ZEND_QM_ASSIGN 20
|
||||
|
||||
#define ZEND_ASSIGN_ADD 21
|
||||
#define ZEND_ASSIGN_SUB 22
|
||||
#define ZEND_ASSIGN_MUL 23
|
||||
#define ZEND_ASSIGN_DIV 24
|
||||
#define ZEND_ASSIGN_MOD 25
|
||||
#define ZEND_ASSIGN_SL 26
|
||||
#define ZEND_ASSIGN_SR 27
|
||||
#define ZEND_ASSIGN_CONCAT 28
|
||||
#define ZEND_ASSIGN_BW_OR 29
|
||||
#define ZEND_ASSIGN_BW_AND 30
|
||||
#define ZEND_ASSIGN_BW_XOR 31
|
||||
|
||||
#define ZEND_PRE_INC 32
|
||||
#define ZEND_PRE_DEC 33
|
||||
#define ZEND_POST_INC 34
|
||||
#define ZEND_POST_DEC 35
|
||||
|
||||
#define ZEND_ASSIGN 36
|
||||
#define ZEND_ASSIGN_REF 37
|
||||
|
||||
#define ZEND_ECHO 38
|
||||
#define ZEND_PRINT 39
|
||||
|
||||
#define ZEND_JMP 40
|
||||
#define ZEND_JMPZ 41
|
||||
#define ZEND_JMPNZ 42
|
||||
#define ZEND_JMPZNZ 43
|
||||
#define ZEND_JMPZ_EX 44
|
||||
#define ZEND_JMPNZ_EX 45
|
||||
#define ZEND_CASE 46
|
||||
#define ZEND_SWITCH_FREE 47
|
||||
#define ZEND_BRK 48
|
||||
#define ZEND_CONT 49
|
||||
#define ZEND_BOOL 50
|
||||
|
||||
#define ZEND_INIT_STRING 51
|
||||
#define ZEND_ADD_CHAR 52
|
||||
#define ZEND_ADD_STRING 53
|
||||
#define ZEND_ADD_VAR 54
|
||||
|
||||
#define ZEND_BEGIN_SILENCE 55
|
||||
#define ZEND_END_SILENCE 56
|
||||
|
||||
#define ZEND_INIT_FCALL_BY_NAME 57
|
||||
#define ZEND_DO_FCALL 58
|
||||
#define ZEND_DO_FCALL_BY_NAME 59
|
||||
#define ZEND_RETURN 60
|
||||
|
||||
#define ZEND_RECV 61
|
||||
#define ZEND_RECV_INIT 62
|
||||
|
||||
#define ZEND_SEND_VAL 63
|
||||
#define ZEND_SEND_VAR 64
|
||||
#define ZEND_SEND_REF 65
|
||||
|
||||
#define ZEND_NEW 66
|
||||
#define ZEND_JMP_NO_CTOR 67
|
||||
#define ZEND_FREE 68
|
||||
|
||||
#define ZEND_INIT_ARRAY 69
|
||||
#define ZEND_ADD_ARRAY_ELEMENT 70
|
||||
|
||||
#define ZEND_INCLUDE_OR_EVAL 71
|
||||
|
||||
#define ZEND_UNSET_VAR 72
|
||||
#define ZEND_UNSET_DIM_OBJ 73
|
||||
#define ZEND_ISSET_ISEMPTY 74
|
||||
|
||||
#define ZEND_FE_RESET 75
|
||||
#define ZEND_FE_FETCH 76
|
||||
|
||||
#define ZEND_EXIT 77
|
||||
|
||||
|
||||
/* the following 12 opcodes are 4 groups of 3 opcodes each, and must
|
||||
* remain in that order!
|
||||
*/
|
||||
#define ZEND_FETCH_R 78
|
||||
#define ZEND_FETCH_DIM_R 79
|
||||
#define ZEND_FETCH_OBJ_R 80
|
||||
#define ZEND_FETCH_W 81
|
||||
#define ZEND_FETCH_DIM_W 82
|
||||
#define ZEND_FETCH_OBJ_W 83
|
||||
#define ZEND_FETCH_RW 84
|
||||
#define ZEND_FETCH_DIM_RW 85
|
||||
#define ZEND_FETCH_OBJ_RW 86
|
||||
#define ZEND_FETCH_IS 87
|
||||
#define ZEND_FETCH_DIM_IS 88
|
||||
#define ZEND_FETCH_OBJ_IS 89
|
||||
|
||||
#define ZEND_FETCH_DIM_TMP_VAR 90
|
||||
#define ZEND_FETCH_CONSTANT 91
|
||||
|
||||
#define ZEND_DECLARE_FUNCTION_OR_CLASS 92
|
||||
|
||||
#define ZEND_EXT_STMT 93
|
||||
#define ZEND_EXT_FCALL_BEGIN 94
|
||||
#define ZEND_EXT_FCALL_END 95
|
||||
#define ZEND_EXT_NOP 96
|
||||
|
||||
/* end of block */
|
||||
|
||||
|
||||
|
||||
|
||||
/* global/local fetches */
|
||||
#define ZEND_FETCH_GLOBAL 0
|
||||
#define ZEND_FETCH_LOCAL 1
|
||||
#define ZEND_FETCH_STATIC 2
|
||||
|
||||
/* var status for backpatching */
|
||||
#define BP_VAR_R 0
|
||||
#define BP_VAR_W 1
|
||||
#define BP_VAR_RW 2
|
||||
#define BP_VAR_IS 3
|
||||
#define BP_VAR_NA 4 /* if not applicable */
|
||||
|
||||
|
||||
#define ZEND_INTERNAL_FUNCTION 1
|
||||
#define ZEND_USER_FUNCTION 2
|
||||
#define ZEND_OVERLOADED_FUNCTION 3
|
||||
#define ZEND_EVAL_CODE 4
|
||||
|
||||
#define ZEND_INTERNAL_CLASS 1
|
||||
#define ZEND_USER_CLASS 2
|
||||
|
||||
#define ZEND_EVAL (1<<0)
|
||||
#define ZEND_INCLUDE (1<<1)
|
||||
|
||||
#define ZEND_ISSET (1<<0)
|
||||
#define ZEND_ISEMPTY (1<<1)
|
||||
|
||||
#define ZEND_CT (1<<0)
|
||||
#define ZEND_RT (1<<1)
|
||||
|
||||
|
||||
#define ZEND_HANDLE_FILENAME 0
|
||||
#define ZEND_HANDLE_FD 1
|
||||
#define ZEND_HANDLE_FP 2
|
||||
#define ZEND_HANDLE_ISTREAM 3
|
||||
|
||||
#define ZEND_DECLARE_CLASS 1
|
||||
#define ZEND_DECLARE_FUNCTION 2
|
||||
#define ZEND_DECLARE_INHERITED_CLASS 3
|
||||
|
||||
#define ZEND_FETCH_STANDARD 0
|
||||
#define ZEND_FETCH_ADD_LOCK 1
|
||||
|
||||
#define ZEND_MEMBER_FUNC_CALL 1<<0
|
||||
#define ZEND_CTOR_CALL 1<<1
|
||||
|
||||
|
||||
#define PZVAL_IS_REF(z) ((z)->EA.is_ref)
|
||||
#define PZVAL_IS_LOCKED(z) ((z)->EA.locks>0)
|
||||
|
||||
#define PZVAL_LOCK(z) (z)->EA.locks++
|
||||
#define PZVAL_UNLOCK(z) (z)->EA.locks--
|
||||
#define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
|
||||
|
||||
|
||||
#endif /* _COMPILE_H */
|
||||
@@ -0,0 +1,268 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_constants.h"
|
||||
#include "zend_variables.h"
|
||||
#include "zend_operators.h"
|
||||
#include "zend_globals.h"
|
||||
|
||||
|
||||
int free_zend_constant(zend_constant *c)
|
||||
{
|
||||
if (!(c->flags & CONST_PERSISTENT)) {
|
||||
zval_dtor(&c->value);
|
||||
}
|
||||
free(c->name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void copy_zend_constant(zend_constant *c)
|
||||
{
|
||||
c->name = zend_strndup(c->name, c->name_len);
|
||||
zval_copy_ctor(&c->value);
|
||||
}
|
||||
|
||||
|
||||
void zend_copy_constants(HashTable *target, HashTable *source)
|
||||
{
|
||||
zend_constant tmp_constant;
|
||||
|
||||
zend_hash_copy(target, source, (void (*)(void *)) copy_zend_constant, &tmp_constant, sizeof(zend_constant));
|
||||
}
|
||||
|
||||
|
||||
static int clean_non_persistent_constant(zend_constant *c)
|
||||
{
|
||||
if (c->flags & CONST_PERSISTENT) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int clean_module_constant(zend_constant *c, int *module_number)
|
||||
{
|
||||
if (c->module_number == *module_number) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void clean_module_constants(int module_number)
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
zend_hash_apply_with_argument(EG(zend_constants), (int (*)(void *,void *)) clean_module_constant, (void *) &module_number);
|
||||
}
|
||||
|
||||
|
||||
int zend_startup_constants(HashTable *constants ELS_DC)
|
||||
{
|
||||
#if WIN32|WINNT
|
||||
DWORD dwBuild=0;
|
||||
DWORD dwVersion = GetVersion();
|
||||
DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
||||
DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
|
||||
#endif
|
||||
|
||||
EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable));
|
||||
|
||||
if (zend_hash_init(EG(zend_constants), 20, NULL, ZEND_CONSTANT_DTOR, 1)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void zend_register_standard_constants(ELS_D)
|
||||
{
|
||||
/* ZEND_FIX: Move to PHP */
|
||||
#if 0
|
||||
#if WIN32|WINNT
|
||||
// Get build numbers for Windows NT or Win95
|
||||
if (dwVersion < 0x80000000){
|
||||
php3_os="WINNT";
|
||||
} else {
|
||||
php3_os="WIN32";
|
||||
}
|
||||
#else
|
||||
php3_os=PHP_OS;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
/* This should go back to PHP */
|
||||
REGISTER_MAIN_STRINGL_CONSTANT("PHP_VERSION", PHP_VERSION, sizeof(PHP_VERSION)-1, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS", php3_os, strlen(php3_os), CONST_PERSISTENT | CONST_CS);
|
||||
#endif
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS);
|
||||
|
||||
/* true/false constants */
|
||||
{
|
||||
zend_constant c;
|
||||
|
||||
c.value.type = IS_BOOL;
|
||||
c.flags = CONST_PERSISTENT;
|
||||
c.module_number = 0;
|
||||
|
||||
c.name = zend_strndup("TRUE",4);
|
||||
c.name_len = 5;
|
||||
c.value.value.lval = 1;
|
||||
c.value.type = IS_BOOL;
|
||||
zend_register_constant(&c ELS_CC);
|
||||
|
||||
c.name = zend_strndup("FALSE",5);
|
||||
c.name_len = 6;
|
||||
c.value.value.lval = 0;
|
||||
c.value.type = IS_BOOL;
|
||||
zend_register_constant(&c ELS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int zend_shutdown_constants(ELS_D)
|
||||
{
|
||||
zend_hash_destroy(EG(zend_constants));
|
||||
free(EG(zend_constants));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void clean_non_persistent_constants(void)
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
zend_hash_apply(EG(zend_constants), (int (*)(void *)) clean_non_persistent_constant);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number ELS_DC)
|
||||
{
|
||||
zend_constant c;
|
||||
|
||||
c.value.type = IS_LONG;
|
||||
c.value.value.lval = lval;
|
||||
c.flags = flags;
|
||||
c.name = zend_strndup(name,name_len);
|
||||
c.name_len = name_len;
|
||||
c.module_number = module_number;
|
||||
zend_register_constant(&c ELS_CC);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number ELS_DC)
|
||||
{
|
||||
zend_constant c;
|
||||
|
||||
c.value.type = IS_DOUBLE;
|
||||
c.value.value.dval = dval;
|
||||
c.flags = flags;
|
||||
c.name = zend_strndup(name,name_len);
|
||||
c.name_len = name_len;
|
||||
c.module_number = module_number;
|
||||
zend_register_constant(&c ELS_CC);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number ELS_DC)
|
||||
{
|
||||
zend_constant c;
|
||||
|
||||
c.value.type = IS_STRING;
|
||||
c.value.value.str.val = strval;
|
||||
c.value.value.str.len = strlen;
|
||||
c.flags = flags;
|
||||
c.name = zend_strndup(name,name_len);
|
||||
c.name_len = name_len;
|
||||
c.module_number = module_number;
|
||||
zend_register_constant(&c ELS_CC);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number ELS_DC)
|
||||
{
|
||||
zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number ELS_CC);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_get_constant(char *name, uint name_len, zval *result)
|
||||
{
|
||||
zend_constant *c;
|
||||
char *lookup_name = estrndup(name,name_len);
|
||||
int retval;
|
||||
ELS_FETCH();
|
||||
|
||||
zend_str_tolower(lookup_name, name_len);
|
||||
|
||||
if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) {
|
||||
if ((c->flags & CONST_CS) && memcmp(c->name, name, name_len)!=0) {
|
||||
retval=0;
|
||||
} else {
|
||||
retval=1;
|
||||
*result = c->value;
|
||||
zval_copy_ctor(result);
|
||||
}
|
||||
} else {
|
||||
retval=0;
|
||||
}
|
||||
|
||||
efree(lookup_name);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_register_constant(zend_constant *c ELS_DC)
|
||||
{
|
||||
char *lowercase_name = zend_strndup(c->name, c->name_len);
|
||||
|
||||
#if 0
|
||||
printf("Registering constant for module %d\n",c->module_number);
|
||||
#endif
|
||||
|
||||
zend_str_tolower(lowercase_name, c->name_len);
|
||||
if (zend_hash_add(EG(zend_constants), lowercase_name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {
|
||||
zval_dtor(&c->value);
|
||||
}
|
||||
free(lowercase_name);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CONSTANTS_H
|
||||
#define _CONSTANTS_H
|
||||
|
||||
#include "zend_globals.h"
|
||||
|
||||
#define CONST_CS 0x1 /* Case Sensitive */
|
||||
#define CONST_PERSISTENT 0x2
|
||||
|
||||
typedef struct _zend_constant {
|
||||
zval value;
|
||||
int flags;
|
||||
char *name;
|
||||
uint name_len;
|
||||
int module_number;
|
||||
} zend_constant;
|
||||
|
||||
#define REGISTER_LONG_CONSTANT(name,lval,flags) zend_register_long_constant((name),sizeof(name),(lval),(flags),module_number ELS_CC)
|
||||
#define REGISTER_DOUBLE_CONSTANT(name,dval,flags) zend_register_double_constant((name),sizeof(name),(dval),(flags),module_number ELS_CC)
|
||||
#define REGISTER_STRING_CONSTANT(name,str,flags) zend_register_string_constant((name),sizeof(name),(str),(flags),module_number ELS_CC)
|
||||
#define REGISTER_STRINGL_CONSTANT(name,str,len,flags) zend_register_stringl_constant((name),sizeof(name),(str),(len),(flags),module_number ELS_CC)
|
||||
|
||||
#define REGISTER_MAIN_LONG_CONSTANT(name,lval,flags) zend_register_long_constant((name),sizeof(name),(lval),(flags),0 ELS_CC)
|
||||
#define REGISTER_MAIN_DOUBLE_CONSTANT(name,dval,flags) zend_register_double_constant((name),sizeof(name),(dval),(flags),0 ELS_CC)
|
||||
#define REGISTER_MAIN_STRING_CONSTANT(name,str,flags) zend_register_string_constant((name),sizeof(name),(str),(flags),0 ELS_CC)
|
||||
#define REGISTER_MAIN_STRINGL_CONSTANT(name,str,len,flags) zend_register_stringl_constant((name),sizeof(name),(str),(len),(flags),0 ELS_CC)
|
||||
|
||||
void clean_module_constants(int module_number);
|
||||
int free_zend_constant(zend_constant *c);
|
||||
int zend_startup_constants(HashTable *constants ELS_DC);
|
||||
int zend_shutdown_constants(ELS_D);
|
||||
void zend_register_standard_constants(ELS_D);
|
||||
void clean_non_persistent_constants(void);
|
||||
ZEND_API int zend_get_constant(char *name, uint name_len, zval *result);
|
||||
ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number ELS_DC);
|
||||
ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number ELS_DC);
|
||||
ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number ELS_DC);
|
||||
ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number ELS_DC);
|
||||
ZEND_API void zend_register_constant(zend_constant *c ELS_DC);
|
||||
void zend_copy_constants(HashTable *target, HashTable *sourc);
|
||||
|
||||
#define ZEND_CONSTANT_DTOR (int (*)(void *)) free_zend_constant
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ZEND_ERRORS_H
|
||||
#define _ZEND_ERRORS_H
|
||||
|
||||
#define E_ERROR (1<<0L)
|
||||
#define E_WARNING (1<<1L)
|
||||
#define E_PARSE (1<<2L)
|
||||
#define E_NOTICE (1<<3L)
|
||||
#define E_CORE_ERROR (1<<4L)
|
||||
#define E_CORE_WARNING (1<<5L)
|
||||
#define E_COMPILE_ERROR (1<<6L)
|
||||
#define E_COMPILE_WARNING (1<<7L)
|
||||
|
||||
#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING)
|
||||
#define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
|
||||
|
||||
#endif /* _ZEND_ERRORS_H */
|
||||
|
||||
+2065
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _EXECUTE_H
|
||||
#define _EXECUTE_H
|
||||
|
||||
#include "zend_compile.h"
|
||||
#include "zend_hash.h"
|
||||
|
||||
typedef union _temp_variable {
|
||||
zval tmp_var;
|
||||
zval **var;
|
||||
struct {
|
||||
zval tmp_var; /* a dummy */
|
||||
|
||||
zval *str;
|
||||
int offset;
|
||||
unsigned char type;
|
||||
} EA;
|
||||
} temp_variable;
|
||||
|
||||
|
||||
ZEND_API extern void (*zend_execute)(zend_op_array *op_array ELS_DC);
|
||||
|
||||
void init_executor(CLS_D ELS_DC);
|
||||
void shutdown_executor(ELS_D);
|
||||
void execute(zend_op_array *op_array ELS_DC);
|
||||
ZEND_API int zend_is_true(zval *op);
|
||||
ZEND_API inline void safe_free_zval_ptr(zval *p);
|
||||
ZEND_API void zend_eval_string(char *str, zval *retval CLS_DC ELS_DC);
|
||||
ZEND_API inline int i_zend_is_true(zval *op);
|
||||
ZEND_API void zval_update_constant(zval *p);
|
||||
ZEND_API inline void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts ELS_DC);
|
||||
|
||||
/* dedicated Zend executor functions - do not use! */
|
||||
ZEND_API inline void zend_ptr_stack_clear_multiple(ELS_D);
|
||||
ZEND_API inline int zend_ptr_stack_get_arg(int requested_arg, void **data ELS_DC);
|
||||
|
||||
#if SUPPORT_INTERACTIVE
|
||||
void execute_new_code(CLS_D);
|
||||
#endif
|
||||
|
||||
|
||||
/* services */
|
||||
ZEND_API char *get_active_function_name();
|
||||
ZEND_API char *zend_get_executed_filename(ELS_D);
|
||||
ZEND_API uint zend_get_executed_lineno(ELS_D);
|
||||
|
||||
#define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p))
|
||||
#define zendi_zval_dtor(p) zval_dtor(&(p))
|
||||
|
||||
#define active_opline (*EG(opline_ptr))
|
||||
|
||||
|
||||
#define IS_OVERLOADED_OBJECT 1
|
||||
#define IS_STRING_OFFSET 2
|
||||
|
||||
#endif /* _EXECUTE_H */
|
||||
@@ -0,0 +1,553 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_compile.h"
|
||||
#include "zend_execute.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_ptr_stack.h"
|
||||
#include "zend_variables.h"
|
||||
#include "zend_operators.h"
|
||||
#include "zend_constants.h"
|
||||
#include "zend_extensions.h"
|
||||
|
||||
|
||||
ZEND_API void (*zend_execute)(zend_op_array *op_array ELS_DC);
|
||||
|
||||
|
||||
#if ZEND_DEBUG
|
||||
static void (*original_sigsegv_handler)(int);
|
||||
static void zend_handle_sigsegv(int dummy)
|
||||
{
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
if (original_sigsegv_handler==zend_handle_sigsegv) {
|
||||
signal(SIGSEGV, original_sigsegv_handler);
|
||||
} else {
|
||||
signal(SIGSEGV, SIG_DFL);
|
||||
}
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %s() at %s:%d\n\n",
|
||||
active_opline->opcode,
|
||||
active_opline-EG(active_op_array)->opcodes,
|
||||
get_active_function_name(),
|
||||
zend_get_executed_filename(ELS_C),
|
||||
zend_get_executed_lineno(ELS_C));
|
||||
}
|
||||
if (original_sigsegv_handler!=zend_handle_sigsegv) {
|
||||
original_sigsegv_handler(dummy);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void zend_extension_activator(zend_extension *extension)
|
||||
{
|
||||
if (extension->activate) {
|
||||
extension->activate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void zend_extension_deactivator(zend_extension *extension)
|
||||
{
|
||||
if (extension->deactivate) {
|
||||
extension->deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_executor(CLS_D ELS_DC)
|
||||
{
|
||||
var_uninit(&EG(uninitialized_zval));
|
||||
var_uninit(&EG(error_zval));
|
||||
EG(uninitialized_zval).refcount = 1;
|
||||
EG(uninitialized_zval).EA.is_ref=0;
|
||||
EG(uninitialized_zval).EA.locks = 0;
|
||||
EG(uninitialized_zval_ptr)=&EG(uninitialized_zval);
|
||||
EG(error_zval).refcount = 1;
|
||||
EG(error_zval).EA.is_ref=0;
|
||||
EG(error_zval).EA.locks = 0;
|
||||
EG(error_zval_ptr)=&EG(error_zval);
|
||||
EG(destroying_function_symbol_table) = 0;
|
||||
zend_ptr_stack_init(&EG(arg_types_stack));
|
||||
zend_stack_init(&EG(overloaded_objects_stack));
|
||||
/* destroys stack frame, therefore makes core dumps worthless */
|
||||
#if 0
|
||||
#if ZEND_DEBUG
|
||||
original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv);
|
||||
#endif
|
||||
#endif
|
||||
EG(return_value) = &EG(global_return_value);
|
||||
var_reset(EG(return_value));
|
||||
EG(symtable_cache_ptr) = EG(symtable_cache)-1;
|
||||
EG(symtable_cache_limit)=EG(symtable_cache)+SYMTABLE_CACHE_SIZE-1;
|
||||
EG(no_extensions)=0;
|
||||
|
||||
EG(function_table) = CG(function_table);
|
||||
EG(class_table) = CG(class_table);
|
||||
|
||||
zend_ptr_stack_init(&EG(argument_stack));
|
||||
|
||||
EG(main_op_array) = NULL;
|
||||
zend_hash_init(&EG(symbol_table), 50, NULL, PVAL_PTR_DTOR, 0);
|
||||
EG(active_symbol_table) = &EG(symbol_table);
|
||||
|
||||
zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_activator);
|
||||
EG(opline_ptr) = NULL;
|
||||
}
|
||||
|
||||
|
||||
void shutdown_executor(ELS_D)
|
||||
{
|
||||
zval_dtor(EG(return_value));
|
||||
zend_ptr_stack_destroy(&EG(arg_types_stack));
|
||||
zend_stack_destroy(&EG(overloaded_objects_stack));
|
||||
|
||||
while (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
|
||||
zend_hash_destroy(*EG(symtable_cache_ptr));
|
||||
efree(*EG(symtable_cache_ptr));
|
||||
EG(symtable_cache_ptr)--;
|
||||
}
|
||||
zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_deactivator);
|
||||
|
||||
zend_hash_destroy(&EG(symbol_table));
|
||||
|
||||
destroy_resource_list(); /* must be destroyed after the main symbol table is destroyed */
|
||||
|
||||
zend_ptr_stack_destroy(&EG(argument_stack));
|
||||
if (EG(main_op_array)) {
|
||||
destroy_op_array(EG(main_op_array));
|
||||
efree(EG(main_op_array));
|
||||
}
|
||||
clean_non_persistent_constants();
|
||||
#if ZEND_DEBUG
|
||||
signal(SIGSEGV, original_sigsegv_handler);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *get_active_function_name()
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
switch(EG(function_state_ptr)->function->type) {
|
||||
case ZEND_USER_FUNCTION: {
|
||||
char *function_name = ((zend_op_array *) EG(function_state_ptr)->function)->function_name;
|
||||
|
||||
if (function_name) {
|
||||
return function_name;
|
||||
} else {
|
||||
return "main";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ZEND_INTERNAL_FUNCTION:
|
||||
return ((zend_internal_function *) EG(function_state_ptr)->function)->function_name;
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *zend_get_executed_filename(ELS_D)
|
||||
{
|
||||
if (EG(opline_ptr)) {
|
||||
return active_opline->filename;
|
||||
} else {
|
||||
return "[no active file]";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API uint zend_get_executed_lineno(ELS_D)
|
||||
{
|
||||
if (EG(opline_ptr)) {
|
||||
return active_opline->lineno;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline void safe_free_zval_ptr(zval *p)
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
if (p!=EG(uninitialized_zval_ptr)) {
|
||||
efree(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zval_ptr_dtor(zval **zval_ptr)
|
||||
{
|
||||
int locked = (*zval_ptr)->EA.locks;
|
||||
|
||||
#if DEBUG_ZEND>=2
|
||||
printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, (*zval_ptr)->refcount, (*zval_ptr)->refcount-1);
|
||||
#endif
|
||||
(*zval_ptr)->refcount--;
|
||||
if ((*zval_ptr)->refcount==0) {
|
||||
zval_dtor(*zval_ptr);
|
||||
safe_free_zval_ptr(*zval_ptr);
|
||||
}
|
||||
if (locked) {
|
||||
ELS_FETCH();
|
||||
|
||||
if (EG(destroying_function_symbol_table)) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0; /* don't kill the container bucket */
|
||||
}
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline int i_zend_is_true(zval *op)
|
||||
{
|
||||
int result;
|
||||
|
||||
switch (op->type) {
|
||||
case IS_LONG:
|
||||
case IS_BOOL:
|
||||
case IS_RESOURCE:
|
||||
result = (op->value.lval?1:0);
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
result = (op->value.dval ? 1 : 0);
|
||||
break;
|
||||
case IS_STRING:
|
||||
if (op->value.str.len == 0
|
||||
|| (op->value.str.len==1 && op->value.str.val[0]=='0')) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = 1;
|
||||
}
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
result = (zend_hash_num_elements(op->value.ht)?1:0);
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
result = (zend_hash_num_elements(op->value.obj.properties)?1:0);
|
||||
break;
|
||||
default:
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_is_true(zval *op)
|
||||
{
|
||||
return i_zend_is_true(op);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zval_update_constant(zval *p)
|
||||
{
|
||||
if (p->type == IS_CONSTANT) {
|
||||
zval c;
|
||||
|
||||
if (!zend_get_constant(p->value.str.val, p->value.str.len, &c)) {
|
||||
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
|
||||
p->value.str.val,
|
||||
p->value.str.val);
|
||||
p->type = IS_STRING;
|
||||
} else {
|
||||
STR_FREE(p->value.str.val);
|
||||
*p = c;
|
||||
}
|
||||
INIT_PZVAL(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval, int param_count, zval *params[])
|
||||
{
|
||||
zval ***params_array = (zval ***) emalloc(sizeof(zval **)*param_count);
|
||||
int i;
|
||||
int ex_retval;
|
||||
|
||||
for (i=0; i<param_count; i++) {
|
||||
params_array[i] = ¶ms[i];
|
||||
}
|
||||
ex_retval = call_user_function_ex(function_table, object, function_name, retval, param_count, params_array, 1);
|
||||
efree(params_array);
|
||||
return ex_retval;
|
||||
}
|
||||
|
||||
|
||||
int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval, int param_count, zval **params[], int no_separation)
|
||||
{
|
||||
int i;
|
||||
zval *original_return_value;
|
||||
HashTable *calling_symbol_table;
|
||||
zend_function_state function_state;
|
||||
zend_function_state *original_function_state_ptr;
|
||||
zend_op_array *original_op_array;
|
||||
zend_op **original_opline_ptr;
|
||||
CLS_FETCH();
|
||||
ELS_FETCH();
|
||||
|
||||
if (object) {
|
||||
if (object->type != IS_OBJECT) {
|
||||
return FAILURE;
|
||||
}
|
||||
function_table = &object->value.obj.ce->function_table;
|
||||
}
|
||||
original_function_state_ptr = EG(function_state_ptr);
|
||||
zend_str_tolower(function_name->value.str.val, function_name->value.str.len);
|
||||
if (zend_hash_find(function_table, function_name->value.str.val, function_name->value.str.len+1, (void **) &function_state.function)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
for (i=0; i<param_count; i++) {
|
||||
zval *param;
|
||||
|
||||
if (function_state.function->common.arg_types
|
||||
&& i<function_state.function->common.arg_types[0]
|
||||
&& function_state.function->common.arg_types[i+1]==BYREF_FORCE
|
||||
&& !PZVAL_IS_REF(*params[i])) {
|
||||
if ((*params[i])->refcount>1) {
|
||||
zval *new_zval;
|
||||
|
||||
if (no_separation) {
|
||||
return FAILURE;
|
||||
}
|
||||
new_zval = (zval *) emalloc(sizeof(zval));
|
||||
*new_zval = **params[i];
|
||||
zval_copy_ctor(new_zval);
|
||||
new_zval->refcount = 1;
|
||||
new_zval->EA.locks = 0;
|
||||
(*params[i])->refcount--;
|
||||
*params[i] = new_zval;
|
||||
}
|
||||
(*params[i])->refcount++;
|
||||
(*params[i])->EA.is_ref = 1;
|
||||
param = *params[i];
|
||||
} else if (*params[i] != &EG(uninitialized_zval)) {
|
||||
(*params[i])->refcount++;
|
||||
param = *params[i];
|
||||
} else {
|
||||
param = (zval *) emalloc(sizeof(zval));
|
||||
*param = **(params[i]);
|
||||
INIT_PZVAL(param);
|
||||
}
|
||||
zend_ptr_stack_push(&EG(argument_stack), param);
|
||||
}
|
||||
|
||||
zend_ptr_stack_push(&EG(argument_stack), (void *) (long) param_count);
|
||||
|
||||
var_uninit(retval);
|
||||
if (function_state.function->type == ZEND_USER_FUNCTION) {
|
||||
calling_symbol_table = EG(active_symbol_table);
|
||||
EG(active_symbol_table) = (HashTable *) emalloc(sizeof(HashTable));
|
||||
zend_hash_init(EG(active_symbol_table), 0, NULL, PVAL_PTR_DTOR, 0);
|
||||
if (object) {
|
||||
zval *dummy = (zval *) emalloc(sizeof(zval)), **this_ptr;
|
||||
|
||||
var_uninit(dummy);
|
||||
INIT_PZVAL(dummy);
|
||||
zend_hash_update_ptr(EG(active_symbol_table), "this", sizeof("this"), dummy, sizeof(zval *), (void **) &this_ptr);
|
||||
zend_assign_to_variable_reference(NULL, this_ptr, &object, NULL ELS_CC);
|
||||
}
|
||||
original_return_value = EG(return_value);
|
||||
original_op_array = EG(active_op_array);
|
||||
EG(return_value) = retval;
|
||||
EG(active_op_array) = (zend_op_array *) function_state.function;
|
||||
original_opline_ptr = EG(opline_ptr);
|
||||
zend_execute(EG(active_op_array) ELS_CC);
|
||||
zend_hash_destroy(EG(active_symbol_table));
|
||||
efree(EG(active_symbol_table));
|
||||
EG(active_symbol_table) = calling_symbol_table;
|
||||
EG(active_op_array) = original_op_array;
|
||||
EG(return_value)=original_return_value;
|
||||
EG(opline_ptr) = original_opline_ptr;
|
||||
} else {
|
||||
((zend_internal_function *) function_state.function)->handler(param_count, retval, &EG(regular_list), &EG(persistent_list), object);
|
||||
}
|
||||
zend_ptr_stack_clear_multiple(ELS_C);
|
||||
EG(function_state_ptr) = original_function_state_ptr;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_eval_string(char *str, zval *retval CLS_DC ELS_DC)
|
||||
{
|
||||
zval pv;
|
||||
zend_op_array *new_op_array;
|
||||
zend_op_array *original_active_op_array = EG(active_op_array);
|
||||
zend_function_state *original_function_state_ptr = EG(function_state_ptr);
|
||||
int original_handle_op_arrays;
|
||||
|
||||
if (retval) {
|
||||
pv.value.str.len = strlen(str)+sizeof("return ;")-1;
|
||||
pv.value.str.val = emalloc(pv.value.str.len+1);
|
||||
strcpy(pv.value.str.val, "return ");
|
||||
strcat(pv.value.str.val, str);
|
||||
strcat(pv.value.str.val, " ;");
|
||||
} else {
|
||||
pv.value.str.len = strlen(str);
|
||||
pv.value.str.val = estrndup(str, pv.value.str.len);
|
||||
}
|
||||
pv.type = IS_STRING;
|
||||
|
||||
/*printf("Evaluating '%s'\n", pv.value.str.val);*/
|
||||
|
||||
original_handle_op_arrays = CG(handle_op_arrays);
|
||||
CG(handle_op_arrays) = 0;
|
||||
new_op_array = compile_string(&pv CLS_CC);
|
||||
CG(handle_op_arrays) = original_handle_op_arrays;
|
||||
|
||||
if (new_op_array) {
|
||||
zval dummy_retval;
|
||||
zval *original_return_value = EG(return_value);
|
||||
zend_op **original_opline_ptr = EG(opline_ptr);
|
||||
|
||||
EG(return_value) = (retval?retval:&dummy_retval);
|
||||
var_reset(EG(return_value));
|
||||
EG(active_op_array) = new_op_array;
|
||||
EG(no_extensions)=1;
|
||||
zend_execute(new_op_array ELS_CC);
|
||||
EG(no_extensions)=0;
|
||||
EG(opline_ptr) = original_opline_ptr;
|
||||
EG(active_op_array) = original_active_op_array;
|
||||
EG(function_state_ptr) = original_function_state_ptr;
|
||||
destroy_op_array(new_op_array);
|
||||
efree(new_op_array);
|
||||
EG(return_value) = original_return_value;
|
||||
if (!retval) {
|
||||
zval_dtor(&dummy_retval);
|
||||
}
|
||||
} else {
|
||||
printf("Failed executing:\n%s\n", str);
|
||||
}
|
||||
zval_dtor(&pv);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts ELS_DC)
|
||||
{
|
||||
zval *variable_ptr = *variable_ptr_ptr;
|
||||
zval *value_ptr;
|
||||
|
||||
|
||||
if (!value_ptr_ptr) {
|
||||
zend_error(E_ERROR, "Cannot create references to string offsets nor overloaded objects");
|
||||
return;
|
||||
}
|
||||
|
||||
value_ptr = *value_ptr_ptr;
|
||||
if (variable_ptr == EG(error_zval_ptr) || value_ptr==EG(error_zval_ptr)) {
|
||||
variable_ptr_ptr = &EG(uninitialized_zval_ptr);
|
||||
} else if (variable_ptr==&EG(uninitialized_zval) || variable_ptr!=value_ptr) {
|
||||
variable_ptr->refcount--;
|
||||
if (variable_ptr->refcount==0) {
|
||||
zendi_zval_dtor(*variable_ptr);
|
||||
efree(variable_ptr);
|
||||
}
|
||||
|
||||
if (!PZVAL_IS_REF(value_ptr)) {
|
||||
/* break it away */
|
||||
value_ptr->refcount--;
|
||||
if (value_ptr->refcount>0) {
|
||||
*value_ptr_ptr = (zval *) emalloc(sizeof(zval));
|
||||
**value_ptr_ptr = *value_ptr;
|
||||
value_ptr = *value_ptr_ptr;
|
||||
zendi_zval_copy_ctor(*value_ptr);
|
||||
}
|
||||
value_ptr->refcount = 1;
|
||||
value_ptr->EA.is_ref = 1;
|
||||
value_ptr->EA.locks = 0;
|
||||
}
|
||||
|
||||
*variable_ptr_ptr = value_ptr;
|
||||
value_ptr->refcount++;
|
||||
} else {
|
||||
/* nothing to do */
|
||||
}
|
||||
|
||||
if (result && (result->op_type != IS_UNUSED)) {
|
||||
Ts[result->u.var].var = variable_ptr_ptr;
|
||||
SELECTIVE_PZVAL_LOCK(*variable_ptr_ptr, result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if SUPPORT_INTERACTIVE
|
||||
void execute_new_code(CLS_D)
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
if (!EG(interactive)
|
||||
|| CG(active_op_array)->backpatch_count>0
|
||||
|| CG(active_op_array)->function_name
|
||||
|| CG(active_op_array)->type!=ZEND_USER_FUNCTION) {
|
||||
return;
|
||||
}
|
||||
CG(active_op_array)->start_op_number = CG(active_op_array)->last_executed_op_number;
|
||||
CG(active_op_array)->end_op_number = CG(active_op_array)->last;
|
||||
EG(active_op_array) = CG(active_op_array);
|
||||
zend_execute(CG(active_op_array) ELS_CC);
|
||||
CG(active_op_array)->start_op_number = CG(active_op_array)->last_executed_op_number;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* these are a dedicated, optimized, function, and shouldn't be used for any purpose
|
||||
* other than by Zend's executor
|
||||
*/
|
||||
ZEND_API inline void zend_ptr_stack_clear_multiple(ELS_D)
|
||||
{
|
||||
void **p = EG(argument_stack).top_element-1;
|
||||
int delete_count = (ulong) *p;
|
||||
|
||||
EG(argument_stack).top -= (delete_count+1);
|
||||
while (--delete_count>=0) {
|
||||
zval_ptr_dtor((zval **) --p);
|
||||
}
|
||||
EG(argument_stack).top_element = p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ZEND_API int zend_ptr_stack_get_arg(int requested_arg, void **data ELS_DC)
|
||||
{
|
||||
void **p = EG(argument_stack).top_element-1;
|
||||
int arg_count = (ulong) *p;
|
||||
|
||||
if (requested_arg>arg_count) {
|
||||
return FAILURE;
|
||||
}
|
||||
*data = (p-arg_count+requested_arg-1);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "zend_extensions.h"
|
||||
|
||||
ZEND_API zend_llist zend_extensions;
|
||||
static int last_resource_number;
|
||||
|
||||
int zend_load_extensions(char **extension_paths)
|
||||
{
|
||||
char **p = extension_paths;
|
||||
|
||||
if (!p) {
|
||||
return SUCCESS;
|
||||
}
|
||||
while (*p) {
|
||||
if (zend_load_extension(*p)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int zend_load_extension(char *path)
|
||||
{
|
||||
#if ZEND_EXTENSIONS_SUPPORT
|
||||
DL_HANDLE handle;
|
||||
zend_extension extension, *new_extension;
|
||||
zend_extension_version_info *extension_version_info;
|
||||
|
||||
handle = DL_LOAD(path);
|
||||
if (!handle) {
|
||||
#if !(WIN32||WINNT)
|
||||
fprintf(stderr, "Failed loading %s: %s\n", path, dlerror());
|
||||
#else
|
||||
fprintf(stderr, "Failed loading %s\n", path);
|
||||
#endif
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "extension_version_info");
|
||||
new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, "zend_extension_entry");
|
||||
if (!extension_version_info || !new_extension) {
|
||||
fprintf(stderr, "%s doesn't appear to be a valid Zend extension\n", path);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (extension_version_info->zend_extension_api_no > ZEND_EXTENSION_API_NO) {
|
||||
fprintf(stderr, "%s requires Zend version %s or later\n"
|
||||
"Current version %s, API version %d\n",
|
||||
new_extension->name,
|
||||
extension_version_info->required_zend_version,
|
||||
ZEND_VERSION,
|
||||
ZEND_EXTENSION_API_NO);
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
} else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) {
|
||||
/* we may be able to allow for downwards compatability in some harmless cases. */
|
||||
fprintf(stderr, "%s is outdated (API version %d, current version %d)\n"
|
||||
"Contact %s at %s for a later version of this module.\n",
|
||||
new_extension->name,
|
||||
extension_version_info->zend_extension_api_no,
|
||||
ZEND_EXTENSION_API_NO,
|
||||
new_extension->author,
|
||||
new_extension->URL);
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
} else if (ZTS_V!=extension_version_info->thread_safe) {
|
||||
fprintf(stderr, "Cannot load %s - it %s thread safe, whereas Zend %s\n",
|
||||
new_extension->name,
|
||||
(extension_version_info->thread_safe?"is":"isn't"),
|
||||
(ZTS_V?"is":"isn't"));
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
} else if (ZEND_DEBUG_V!=extension_version_info->debug) {
|
||||
fprintf(stderr, "Cannot load %s - it %s debug information, whereas Zend %s\n",
|
||||
new_extension->name,
|
||||
(extension_version_info->debug?"contains":"does not contain"),
|
||||
(ZEND_DEBUG_V?"does":"does not"));
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (new_extension->startup) {
|
||||
if (new_extension->startup(new_extension)!=SUCCESS) {
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
extension = *new_extension;
|
||||
extension.handle = handle;
|
||||
|
||||
zend_llist_add_element(&zend_extensions, &extension);
|
||||
|
||||
/*fprintf(stderr, "Loaded %s, version %s\n", extension.name, extension.version);*/
|
||||
|
||||
zend_append_version_info(&extension);
|
||||
return SUCCESS;
|
||||
#else
|
||||
fprintf(stderr, "Extensions are not supported on this platform.\n");
|
||||
return FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void zend_extension_shutdown(zend_extension *extension)
|
||||
{
|
||||
#if ZEND_EXTENSIONS_SUPPORT
|
||||
if (extension->shutdown) {
|
||||
extension->shutdown(extension);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void zend_shutdown_extensions()
|
||||
{
|
||||
zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_shutdown);
|
||||
zend_llist_destroy(&zend_extensions);
|
||||
}
|
||||
|
||||
|
||||
void zend_extension_dtor(zend_extension *extension)
|
||||
{
|
||||
#if ZEND_EXTENSIONS_SUPPORT
|
||||
DL_UNLOAD(extension->handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_get_resource_handle(zend_extension *extension)
|
||||
{
|
||||
if (last_resource_number<4) {
|
||||
extension->resource_number = last_resource_number;
|
||||
return last_resource_number;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ZEND_EXTENSIONS_H
|
||||
#define _ZEND_EXTENSIONS_H
|
||||
|
||||
#include "zend_compile.h"
|
||||
|
||||
#define ZEND_EXTENSION_API_NO 19990619
|
||||
|
||||
typedef struct _zend_extension_version_info {
|
||||
int zend_extension_api_no;
|
||||
char *required_zend_version;
|
||||
unsigned char thread_safe;
|
||||
unsigned char debug;
|
||||
} zend_extension_version_info;
|
||||
|
||||
|
||||
typedef struct _zend_extension zend_extension;
|
||||
|
||||
struct _zend_extension {
|
||||
char *name;
|
||||
char *version;
|
||||
char *author;
|
||||
char *URL;
|
||||
char *copyright;
|
||||
|
||||
int (*startup)(zend_extension *extension);
|
||||
void (*shutdown)(zend_extension *extension);
|
||||
void (*activate)();
|
||||
void (*deactivate)();
|
||||
|
||||
void (*op_array_handler)(zend_op_array *op_array);
|
||||
|
||||
void (*statement_handler)(zend_op_array *op_array);
|
||||
void (*fcall_begin_handler)(zend_op_array *op_array);
|
||||
void (*fcall_end_handler)(zend_op_array *op_array);
|
||||
|
||||
void (*op_array_ctor)(void **resource);
|
||||
void (*op_array_dtor)(void **resource);
|
||||
|
||||
void *reserved1;
|
||||
void *reserved2;
|
||||
void *reserved3;
|
||||
void *reserved4;
|
||||
void *reserved5;
|
||||
void *reserved6;
|
||||
void *reserved7;
|
||||
void *reserved8;
|
||||
|
||||
DL_HANDLE handle;
|
||||
int resource_number;
|
||||
};
|
||||
|
||||
|
||||
ZEND_API int zend_get_resource_handle();
|
||||
|
||||
#ifdef ZTS
|
||||
#define ZTS_V 1
|
||||
#else
|
||||
#define ZTS_V 0
|
||||
#endif
|
||||
|
||||
#ifdef ZEND_DEBUG
|
||||
#define ZEND_DEBUG_V 1
|
||||
#else
|
||||
#define ZEND_DEBUG_V 0
|
||||
#endif
|
||||
|
||||
|
||||
#define ZEND_EXTENSION() \
|
||||
ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, "0.90", ZTS_V, ZEND_DEBUG_V }
|
||||
|
||||
#define STANDARD_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
|
||||
|
||||
|
||||
ZEND_API extern zend_llist zend_extensions;
|
||||
|
||||
void zend_extension_dtor(zend_extension *extension);
|
||||
int zend_load_extension(char *path);
|
||||
int zend_load_extensions(char **extension_paths);
|
||||
void zend_append_version_info(zend_extension *extension);
|
||||
void zend_shutdown_extensions();
|
||||
|
||||
#endif /* _ZEND_EXTENSIONS_H */
|
||||
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _T_GLOBALS_H
|
||||
#define _T_GLOBALS_H
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#include "zend_stack.h"
|
||||
#include "zend_ptr_stack.h"
|
||||
#include "zend_hash.h"
|
||||
#include "zend_llist.h"
|
||||
|
||||
/* Define ZTS if you want a thread-safe Zend */
|
||||
/*#undef ZTS*/
|
||||
|
||||
#ifdef ZTS
|
||||
#include "../TSRM/TSRM.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class ZendFlexLexer;
|
||||
#endif
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API extern int compiler_globals_id;
|
||||
ZEND_API extern int executor_globals_id;
|
||||
extern int alloc_globals_id;
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct _zend_compiler_globals zend_compiler_globals;
|
||||
typedef struct _zend_executor_globals zend_executor_globals;
|
||||
typedef struct _zend_alloc_globals zend_alloc_globals;
|
||||
|
||||
#define SYMTABLE_CACHE_SIZE 32
|
||||
|
||||
|
||||
/* Compiler */
|
||||
#ifdef ZTS
|
||||
# define CLS_D zend_compiler_globals *compiler_globals
|
||||
# define CLS_DC , CLS_D
|
||||
# define CLS_C compiler_globals
|
||||
# define CLS_CC , CLS_C
|
||||
# define CG(v) (((zend_compiler_globals *) compiler_globals)->v)
|
||||
# define CLS_FETCH() zend_compiler_globals *compiler_globals = (zend_compiler_globals *) ts_resource(compiler_globals_id)
|
||||
# define YYPARSE_PARAM compiler_globals
|
||||
# define YYLEX_PARAM compiler_globals
|
||||
BEGIN_EXTERN_C()
|
||||
int zendparse(void *compiler_globals);
|
||||
END_EXTERN_C()
|
||||
#else
|
||||
# define CLS_D
|
||||
# define CLS_DC
|
||||
# define CLS_C
|
||||
# define CLS_CC
|
||||
# define CG(v) (compiler_globals.v)
|
||||
# define CLS_FETCH()
|
||||
extern ZEND_API zend_compiler_globals compiler_globals;
|
||||
int zendparse();
|
||||
#endif
|
||||
|
||||
|
||||
/* Executor */
|
||||
#ifdef ZTS
|
||||
# define ELS_D zend_executor_globals *executor_globals
|
||||
# define ELS_DC , ELS_D
|
||||
# define ELS_C executor_globals
|
||||
# define ELS_CC , ELS_C
|
||||
# define EG(v) (executor_globals->v)
|
||||
# define ELS_FETCH() zend_executor_globals *executor_globals = (zend_executor_globals *) ts_resource(executor_globals_id)
|
||||
#else
|
||||
# define ELS_D
|
||||
# define ELS_DC
|
||||
# define ELS_C
|
||||
# define ELS_CC
|
||||
# define EG(v) (executor_globals.v)
|
||||
# define ELS_FETCH()
|
||||
extern ZEND_API zend_executor_globals executor_globals;
|
||||
#endif
|
||||
|
||||
|
||||
/* Memory Manager */
|
||||
#ifdef ZTS
|
||||
# define ALS_D zend_alloc_globals *alloc_globals
|
||||
# define ALS_DC , ALS_D
|
||||
# define ALS_C alloc_globals
|
||||
# define ALS_CC , ALS_C
|
||||
# define AG(v) (((zend_alloc_globals *) alloc_globals)->v)
|
||||
# define ALS_FETCH() zend_alloc_globals *alloc_globals = (zend_alloc_globals *) ts_resource(alloc_globals_id)
|
||||
#else
|
||||
# define ALS_D
|
||||
# define ALS_DC
|
||||
# define ALS_C
|
||||
# define ALS_CC
|
||||
# define AG(v) (alloc_globals.v)
|
||||
# define ALS_FETCH()
|
||||
#endif
|
||||
|
||||
#include "zend_compile.h"
|
||||
#include "zend_execute.h"
|
||||
|
||||
struct _zend_compiler_globals {
|
||||
zend_stack bp_stack;
|
||||
zend_stack switch_cond_stack;
|
||||
zend_stack object_stack;
|
||||
|
||||
zend_class_entry class_entry, *active_class_entry;
|
||||
|
||||
/* variables for list() compilation */
|
||||
zend_llist list_llist;
|
||||
zend_llist dimension_llist;
|
||||
|
||||
zend_stack function_call_stack;
|
||||
|
||||
char *compiled_filename;
|
||||
|
||||
int zend_lineno;
|
||||
char *heredoc;
|
||||
int heredoc_len;
|
||||
|
||||
zend_op_array *active_op_array;
|
||||
|
||||
HashTable *function_table; /* function symbol table */
|
||||
HashTable *class_table; /* class table */
|
||||
|
||||
zend_llist filenames_list;
|
||||
|
||||
zend_bool short_tags;
|
||||
zend_bool asp_tags;
|
||||
|
||||
/* For extensions support */
|
||||
zend_bool extended_info; /* generate extension information for debugger/profiler */
|
||||
zend_bool handle_op_arrays; /* run op_arrays through op_array handlers */
|
||||
|
||||
zend_bool unclean_shutdown;
|
||||
|
||||
zend_llist open_files;
|
||||
#ifdef ZTS
|
||||
#ifdef __cplusplus
|
||||
ZendFlexLexer *ZFL;
|
||||
#else
|
||||
void *ZFL;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
struct _zend_executor_globals {
|
||||
zval *return_value;
|
||||
|
||||
zval uninitialized_zval;
|
||||
zval *uninitialized_zval_ptr;
|
||||
|
||||
zval error_zval;
|
||||
zval *error_zval_ptr;
|
||||
|
||||
zend_function_state *function_state_ptr;
|
||||
zend_ptr_stack arg_types_stack;
|
||||
zend_stack overloaded_objects_stack;
|
||||
zval global_return_value;
|
||||
|
||||
/* symbol table cache */
|
||||
HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
|
||||
HashTable **symtable_cache_limit;
|
||||
HashTable **symtable_cache_ptr;
|
||||
|
||||
zend_op **opline_ptr;
|
||||
|
||||
HashTable *active_symbol_table;
|
||||
HashTable symbol_table; /* main symbol table */
|
||||
|
||||
jmp_buf bailout;
|
||||
|
||||
int error_reporting;
|
||||
|
||||
zend_op_array *active_op_array;
|
||||
zend_op_array *main_op_array;
|
||||
|
||||
HashTable *function_table; /* function symbol table */
|
||||
HashTable *class_table; /* class table */
|
||||
HashTable *zend_constants; /* constants table */
|
||||
|
||||
long precision;
|
||||
zend_bool destroying_function_symbol_table;
|
||||
|
||||
/* for extended information support */
|
||||
zend_bool no_extensions;
|
||||
|
||||
HashTable regular_list;
|
||||
HashTable persistent_list;
|
||||
|
||||
zend_ptr_stack argument_stack;
|
||||
|
||||
void *reserved[4];
|
||||
#if SUPPORT_INTERACTIVE
|
||||
int interactive;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct _zend_alloc_globals {
|
||||
mem_header *head; /* standard list */
|
||||
mem_header *phead; /* persistent list */
|
||||
void *cache[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES];
|
||||
unsigned char cache_count[MAX_CACHED_MEMORY];
|
||||
|
||||
#if MEMORY_LIMIT
|
||||
unsigned int memory_limit;
|
||||
unsigned int allocated_memory;
|
||||
unsigned char memory_exhausted;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#endif /* _T_GLOBALS_H */
|
||||
+1190
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef _HASH_
|
||||
#define _HASH_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define HASH_KEY_IS_STRING 1
|
||||
#define HASH_KEY_IS_LONG 2
|
||||
#define HASH_KEY_NON_EXISTANT 3
|
||||
|
||||
#define HASH_UPDATE (1<<0)
|
||||
#define HASH_ADD (1<<1)
|
||||
#define HASH_NEXT_INSERT (1<<2)
|
||||
#define HASH_ADD_PTR (1<<3)
|
||||
|
||||
#define HASH_DEL_KEY 0
|
||||
#define HASH_DEL_INDEX 1
|
||||
|
||||
struct hashtable;
|
||||
|
||||
typedef struct bucket {
|
||||
ulong h; /* Used for numeric indexing */
|
||||
uint nKeyLength;
|
||||
void *pData;
|
||||
void *pDataPtr;
|
||||
char bIsPointer;
|
||||
struct bucket *pListNext;
|
||||
struct bucket *pListLast;
|
||||
struct bucket *pNext;
|
||||
char arKey[1]; /* Must be last element */
|
||||
} Bucket;
|
||||
|
||||
typedef struct hashtable {
|
||||
uint nTableSize;
|
||||
uint nHashSizeIndex;
|
||||
uint nNumOfElements;
|
||||
ulong nNextFreeElement;
|
||||
ulong(*pHashFunction) (char *arKey, uint nKeyLength);
|
||||
Bucket *pInternalPointer; /* Used for element traversal */
|
||||
Bucket *pListHead;
|
||||
Bucket *pListTail;
|
||||
Bucket **arBuckets;
|
||||
int (*pDestructor) (void *pData);
|
||||
unsigned char persistent;
|
||||
} HashTable;
|
||||
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
/* startup/shutdown */
|
||||
ZEND_API int zend_hash_init(HashTable *ht, uint nSize, ulong(*pHashFunction) (char *arKey, uint nKeyLength), int (*pDestructor) (void *pData), int persistent);
|
||||
ZEND_API void zend_hash_destroy(HashTable *ht);
|
||||
|
||||
ZEND_API void zend_hash_clean(HashTable *ht);
|
||||
|
||||
/* additions/updates/changes */
|
||||
ZEND_API int zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest,int flag);
|
||||
#define zend_hash_update(ht,arKey,nKeyLength,pData,nDataSize,pDest) \
|
||||
zend_hash_add_or_update(ht,arKey,nKeyLength,pData,nDataSize,pDest,HASH_UPDATE)
|
||||
#define zend_hash_add(ht,arKey,nKeyLength,pData,nDataSize,pDest) \
|
||||
zend_hash_add_or_update(ht,arKey,nKeyLength,pData,nDataSize,pDest,HASH_ADD)
|
||||
#define zend_hash_update_ptr(ht,arKey,nKeyLength,pData,nDataSize,pDest) \
|
||||
zend_hash_add_or_update(ht,arKey,nKeyLength,pData,0,pDest,(HASH_UPDATE|HASH_ADD_PTR))
|
||||
|
||||
ZEND_API int zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest,int flag);
|
||||
#define zend_hash_quick_update(ht,arKey,nKeyLength,h,pData,nDataSize,pDest) \
|
||||
zend_hash_quick_add_or_update(ht,arKey,nKeyLength,h,pData,nDataSize,pDest,HASH_UPDATE)
|
||||
#define zend_hash_quick_add(ht,arKey,nKeyLength,h,pData,nDataSize,pDest) \
|
||||
zend_hash_quick_add_or_update(ht,arKey,nKeyLength,h,pData,nDataSize,pDest,HASH_ADD)
|
||||
#define zend_hash_quick_update_ptr(ht,arKey,nKeyLength,h,pData,nDataSize,pDest) \
|
||||
zend_hash_quick_add_or_update(ht,arKey,nKeyLength,h,pData,0,pDest,HASH_UPDATE|HASH_ADD_PTR)
|
||||
|
||||
ZEND_API int zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag);
|
||||
#define zend_hash_index_update(ht,h,pData,nDataSize,pDest) \
|
||||
zend_hash_index_update_or_next_insert(ht,h,pData,nDataSize,pDest,HASH_UPDATE)
|
||||
#define zend_hash_next_index_insert(ht,pData,nDataSize,pDest) \
|
||||
zend_hash_index_update_or_next_insert(ht,0,pData,nDataSize,pDest,HASH_NEXT_INSERT)
|
||||
#define zend_hash_next_index_insert_ptr(ht,pData,nDataSize,pDest) \
|
||||
zend_hash_index_update_or_next_insert(ht,0,pData,nDataSize,pDest,HASH_NEXT_INSERT|HASH_ADD_PTR)
|
||||
|
||||
ZEND_API int zend_hash_pointer_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData);
|
||||
|
||||
ZEND_API int zend_hash_pointer_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, int flag);
|
||||
#define zend_hash_pointer_index_update(ht,h,pData) \
|
||||
zend_hash_pointer_index_update_or_next_insert(ht,h,pData,HASH_UPDATE)
|
||||
#define zend_hash_next_index_pointer_insert(ht,pData) \
|
||||
zend_hash_pointer_index_update_or_next_insert(ht,0,pData,HASH_NEXT_INSERT)
|
||||
ZEND_API void zend_hash_apply(HashTable *ht,int (*destruct) (void *));
|
||||
ZEND_API void zend_hash_apply_with_argument(HashTable *ht,int (*destruct) (void *, void *), void *);
|
||||
|
||||
|
||||
|
||||
/* Deletes */
|
||||
ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag);
|
||||
#define zend_hash_del(ht,arKey,nKeyLength) \
|
||||
zend_hash_del_key_or_index(ht,arKey,nKeyLength,0,HASH_DEL_KEY)
|
||||
#define zend_hash_index_del(ht,h) \
|
||||
zend_hash_del_key_or_index(ht,NULL,0,h,HASH_DEL_INDEX)
|
||||
|
||||
ZEND_API ulong zend_get_hash_value(HashTable *ht, char *arKey, uint nKeyLength);
|
||||
|
||||
/* Data retreival */
|
||||
ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData);
|
||||
ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData);
|
||||
ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData);
|
||||
|
||||
/* Misc */
|
||||
ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength);
|
||||
ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h);
|
||||
ZEND_API int zend_hash_is_pointer(HashTable *ht, char *arKey, uint nKeyLength);
|
||||
ZEND_API int zend_hash_index_is_pointer(HashTable *ht, ulong h);
|
||||
ZEND_API ulong zend_hash_next_free_element(HashTable *ht);
|
||||
|
||||
/* traversing */
|
||||
ZEND_API void zend_hash_move_forward(HashTable *ht);
|
||||
ZEND_API void zend_hash_move_backwards(HashTable *ht);
|
||||
ZEND_API int zend_hash_get_current_key(HashTable *ht, char **str_index, ulong *num_index);
|
||||
ZEND_API int zend_hash_get_current_key_type(HashTable *ht);
|
||||
ZEND_API int zend_hash_get_current_data(HashTable *ht, void **pData);
|
||||
ZEND_API void zend_hash_internal_pointer_reset(HashTable *ht);
|
||||
ZEND_API void zend_hash_internal_pointer_end(HashTable *ht);
|
||||
|
||||
/* Copying, merging and sorting */
|
||||
ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, void (*pCopyConstructor) (void *pData), void *tmp, uint size);
|
||||
ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, void (*pCopyConstructor) (void *pData), void *tmp, uint size, int overwrite);
|
||||
ZEND_API int zend_hash_sort(HashTable *ht, int (*compar) (const void *, const void *), int renumber);
|
||||
ZEND_API int zend_hash_minmax(HashTable *ht, int (*compar) (const void *, const void *), int flag, void **pData);
|
||||
|
||||
ZEND_API int zend_hash_num_elements(HashTable *ht);
|
||||
|
||||
|
||||
ZEND_API ulong hashpjw(char *arKey, uint nKeyLength);
|
||||
|
||||
#if DEBUG
|
||||
/* debug */
|
||||
void zend_hash_display_pListTail(HashTable *ht);
|
||||
void zend_hash_display(HashTable *ht);
|
||||
#endif
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif /* _HASH_ */
|
||||
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_compile.h"
|
||||
#include "zend_highlight.h"
|
||||
#include "zend_ptr_stack.h"
|
||||
#include "zend_globals.h"
|
||||
|
||||
#ifndef ZTS
|
||||
extern char *zendtext;
|
||||
extern int zendleng;
|
||||
#else
|
||||
#define zendtext ((char *) zend_get_zendtext(CLS_C))
|
||||
#define zendleng zend_get_zendleng(CLS_C)
|
||||
#endif
|
||||
|
||||
static void html_putc(char c)
|
||||
{
|
||||
switch (c) {
|
||||
case '\n':
|
||||
ZEND_PUTS("<br>");
|
||||
break;
|
||||
case '<':
|
||||
ZEND_PUTS("<");
|
||||
break;
|
||||
case '>':
|
||||
ZEND_PUTS(">");
|
||||
break;
|
||||
case '&':
|
||||
ZEND_PUTS("&");
|
||||
break;
|
||||
case ' ':
|
||||
ZEND_PUTS(" ");
|
||||
break;
|
||||
case '\t':
|
||||
ZEND_PUTS(" ");
|
||||
break;
|
||||
default:
|
||||
ZEND_PUTC(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void html_puts(char *s, uint len)
|
||||
{
|
||||
register char *ptr=s, *end=s+len;
|
||||
|
||||
while (ptr<end) {
|
||||
html_putc(*ptr++);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini)
|
||||
{
|
||||
zval token;
|
||||
int token_type;
|
||||
char *last_color = syntax_highlighter_ini->highlight_html;
|
||||
char *next_color;
|
||||
int in_string=0;
|
||||
CLS_FETCH();
|
||||
|
||||
zend_printf("<font color=\"%s\">\n", last_color);
|
||||
/* highlight stuff coming back from zendlex() */
|
||||
token.type = 0;
|
||||
while ((token_type=lex_scan(&token CLS_CC))) {
|
||||
switch (token_type) {
|
||||
case T_INLINE_HTML:
|
||||
next_color = syntax_highlighter_ini->highlight_html;
|
||||
break;
|
||||
case T_COMMENT:
|
||||
next_color = syntax_highlighter_ini->highlight_comment;
|
||||
break;
|
||||
case T_OPEN_TAG:
|
||||
next_color = syntax_highlighter_ini->highlight_default;
|
||||
break;
|
||||
case T_CLOSE_TAG:
|
||||
next_color = syntax_highlighter_ini->highlight_default;
|
||||
break;
|
||||
case T_CONSTANT_ENCAPSED_STRING:
|
||||
next_color = syntax_highlighter_ini->highlight_string;
|
||||
break;
|
||||
case '"':
|
||||
next_color = syntax_highlighter_ini->highlight_string;
|
||||
in_string = !in_string;
|
||||
break;
|
||||
case T_WHITESPACE:
|
||||
html_puts(zendtext, zendleng); /* no color needed */
|
||||
token.type = 0;
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
if (token.type==0) {
|
||||
next_color = syntax_highlighter_ini->highlight_keyword;
|
||||
} else {
|
||||
if (in_string) {
|
||||
next_color = syntax_highlighter_ini->highlight_string;
|
||||
} else {
|
||||
next_color = syntax_highlighter_ini->highlight_default;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (last_color != next_color) {
|
||||
if (last_color != syntax_highlighter_ini->highlight_html) {
|
||||
zend_printf("</font>");
|
||||
}
|
||||
last_color = next_color;
|
||||
if (last_color != syntax_highlighter_ini->highlight_html) {
|
||||
zend_printf("<font color=\"%s\">", last_color);
|
||||
}
|
||||
}
|
||||
switch (token_type) {
|
||||
case T_DOLLAR_OPEN_CURLY_BRACES:
|
||||
html_puts("{", 1);
|
||||
break;
|
||||
default:
|
||||
html_puts(zendtext, zendleng);
|
||||
break;
|
||||
}
|
||||
|
||||
if (token.type == IS_STRING) {
|
||||
switch (token_type) {
|
||||
case T_OPEN_TAG:
|
||||
case T_CLOSE_TAG:
|
||||
case T_WHITESPACE:
|
||||
break;
|
||||
default:
|
||||
efree(token.value.str.val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
token.type = 0;
|
||||
}
|
||||
if (last_color != syntax_highlighter_ini->highlight_html) {
|
||||
zend_printf("</font>\n");
|
||||
}
|
||||
zend_printf("</font>\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _HIGHLIGHT_H
|
||||
#define _HIGHLIGHT_H
|
||||
|
||||
#define HL_COMMENT_COLOR "#FF8000" /* orange */
|
||||
#define HL_DEFAULT_COLOR "#0000BB" /* blue */
|
||||
#define HL_HTML_COLOR "#000000" /* black */
|
||||
#define HL_STRING_COLOR "#DD0000" /* red */
|
||||
#define HL_BG_COLOR "#FFFFFF" /* white */
|
||||
#define HL_KEYWORD_COLOR "#007700" /* green */
|
||||
|
||||
|
||||
typedef struct _zend_syntax_highlighter_ini {
|
||||
char *highlight_html;
|
||||
char *highlight_comment;
|
||||
char *highlight_default;
|
||||
char *highlight_string;
|
||||
char *highlight_keyword;
|
||||
} zend_syntax_highlighter_ini;
|
||||
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini);
|
||||
int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini);
|
||||
int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini);
|
||||
END_EXTERN_C()
|
||||
|
||||
extern zend_syntax_highlighter_ini syntax_highlighter_ini;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
/* This indenter doesn't really work, it's here for no particular reason. */
|
||||
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_compile.h"
|
||||
#include "zend_indent.h"
|
||||
|
||||
#ifndef ZTS
|
||||
extern char *zendtext;
|
||||
extern int zendleng;
|
||||
#else
|
||||
#define zendtext ((char *) zend_get_zendtext(CLS_C))
|
||||
#define zendleng zend_get_zendleng(CLS_C)
|
||||
#endif
|
||||
|
||||
|
||||
static void handle_whitespace(int *emit_whitespace)
|
||||
{
|
||||
unsigned char c;
|
||||
int i;
|
||||
|
||||
for (c=0; c<128; c++) {
|
||||
if (emit_whitespace[c]>0) {
|
||||
for (i=0; i<emit_whitespace[c]; i++) {
|
||||
zend_write((char *) &c, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
memset(emit_whitespace, 0, sizeof(int)*256);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_indent()
|
||||
{
|
||||
zval token;
|
||||
int token_type;
|
||||
int in_string=0;
|
||||
int nest_level=0;
|
||||
int emit_whitespace[256];
|
||||
int i;
|
||||
CLS_FETCH();
|
||||
|
||||
memset(emit_whitespace, 0, sizeof(int)*256);
|
||||
|
||||
/* highlight stuff coming back from zendlex() */
|
||||
token.type = 0;
|
||||
while ((token_type=lex_scan(&token CLS_CC))) {
|
||||
switch (token_type) {
|
||||
case T_INLINE_HTML:
|
||||
zend_write(zendtext, zendleng);
|
||||
break;
|
||||
case T_WHITESPACE: {
|
||||
token.type = 0;
|
||||
/* eat whitespace, emit newlines */
|
||||
for (i=0; i<zendleng; i++) {
|
||||
emit_whitespace[(unsigned char) zendtext[i]]++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '"':
|
||||
in_string = !in_string;
|
||||
/* break missing intentionally */
|
||||
default:
|
||||
if (token.type==0) {
|
||||
/* keyword */
|
||||
switch(token_type) {
|
||||
case ',':
|
||||
ZEND_PUTS(", ");
|
||||
goto dflt_printout;
|
||||
break;
|
||||
case '{':
|
||||
nest_level++;
|
||||
if (emit_whitespace['\n']>0) {
|
||||
ZEND_PUTS(" {\n");
|
||||
memset(emit_whitespace, 0, sizeof(int)*256);
|
||||
} else {
|
||||
ZEND_PUTS("{");
|
||||
}
|
||||
break;
|
||||
case '}':
|
||||
nest_level--;
|
||||
if (emit_whitespace['\n']==0) {
|
||||
ZEND_PUTS("\n");
|
||||
}
|
||||
for (i=0; i<nest_level; i++) {
|
||||
ZEND_PUTS(" ");
|
||||
}
|
||||
goto dflt_printout;
|
||||
break;
|
||||
dflt_printout:
|
||||
default:
|
||||
if (emit_whitespace['\n']>0) {
|
||||
for (i=0; i<emit_whitespace['\n']; i++) {
|
||||
ZEND_PUTS("\n");
|
||||
}
|
||||
memset(emit_whitespace, 0, sizeof(int)*256);
|
||||
for (i=0; i<nest_level; i++) {
|
||||
ZEND_PUTS(" ");
|
||||
}
|
||||
} else {
|
||||
handle_whitespace(emit_whitespace);
|
||||
}
|
||||
zend_write(zendtext, zendleng);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
handle_whitespace(emit_whitespace);
|
||||
if (in_string) {
|
||||
zend_write(zendtext, zendleng);
|
||||
/* a part of a string */
|
||||
} else {
|
||||
zend_write(zendtext, zendleng);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (token.type == IS_STRING) {
|
||||
switch (token_type) {
|
||||
case T_OPEN_TAG:
|
||||
case T_CLOSE_TAG:
|
||||
case T_WHITESPACE:
|
||||
break;
|
||||
default:
|
||||
efree(token.value.str.val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
token.type = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ZEND_INDENT_H
|
||||
#define _ZEND_INDENT_H
|
||||
|
||||
ZEND_API void zend_indent();
|
||||
|
||||
#endif /* _ZEND_INDENT_H */
|
||||
@@ -0,0 +1,228 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_list.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_globals.h"
|
||||
|
||||
|
||||
ZEND_API int le_index_ptr;
|
||||
|
||||
static inline int zend_list_do_insert(HashTable *list,void *ptr, int type)
|
||||
{
|
||||
int index;
|
||||
list_entry le;
|
||||
|
||||
index = zend_hash_next_free_element(list);
|
||||
|
||||
if (index==0) index++;
|
||||
|
||||
le.ptr=ptr;
|
||||
le.type=type;
|
||||
le.refcount=1;
|
||||
zend_hash_index_update(list, index, (void *) &le, sizeof(list_entry), NULL);
|
||||
return index;
|
||||
}
|
||||
|
||||
static inline int zend_list_do_delete(HashTable *list,int id)
|
||||
{
|
||||
list_entry *le;
|
||||
ELS_FETCH();
|
||||
|
||||
if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
|
||||
/* printf("del(%d): %d->%d\n", id, le->refcount, le->refcount-1); */
|
||||
if (--le->refcount<=0) {
|
||||
return zend_hash_index_del(&EG(regular_list), id);
|
||||
} else {
|
||||
return SUCCESS;
|
||||
}
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static inline void *zend_list_do_find(HashTable *list,int id, int *type)
|
||||
{
|
||||
list_entry *le;
|
||||
|
||||
if (zend_hash_index_find(list, id, (void **) &le)==SUCCESS) {
|
||||
*type = le->type;
|
||||
return le->ptr;
|
||||
} else {
|
||||
*type = -1;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_list_insert(void *ptr, int type)
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
return zend_list_do_insert(&EG(regular_list), ptr, type);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_plist_insert(void *ptr, int type)
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
return zend_list_do_insert(&EG(persistent_list), ptr, type);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_list_addref(int id)
|
||||
{
|
||||
list_entry *le;
|
||||
ELS_FETCH();
|
||||
|
||||
if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
|
||||
/* printf("add(%d): %d->%d\n", id, le->refcount, le->refcount+1); */
|
||||
le->refcount++;
|
||||
return SUCCESS;
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_list_delete(int id)
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
return zend_list_do_delete(&EG(regular_list), id);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_plist_delete(int id)
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
return zend_list_do_delete(&EG(persistent_list), id);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void *zend_list_find(int id, int *type)
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
return zend_list_do_find(&EG(regular_list), id, type);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void *zend_plist_find(int id, int *type)
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
return zend_list_do_find(&EG(persistent_list), id, type);
|
||||
}
|
||||
|
||||
|
||||
int list_entry_destructor(void *ptr)
|
||||
{
|
||||
list_entry *le = (list_entry *) ptr;
|
||||
list_destructors_entry *ld;
|
||||
|
||||
if (zend_hash_index_find(&list_destructors,le->type,(void **) &ld)==SUCCESS) {
|
||||
if (ld->list_destructor) {
|
||||
(ld->list_destructor)(le->ptr);
|
||||
}
|
||||
} else {
|
||||
zend_error(E_WARNING,"Unknown list entry type in request shutdown (%d)",le->type);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int plist_entry_destructor(void *ptr)
|
||||
{
|
||||
list_entry *le = (list_entry *) ptr;
|
||||
list_destructors_entry *ld;
|
||||
|
||||
if (zend_hash_index_find(&list_destructors,le->type,(void **) &ld)==SUCCESS) {
|
||||
if (ld->plist_destructor) {
|
||||
(ld->plist_destructor)(le->ptr);
|
||||
}
|
||||
} else {
|
||||
zend_error(E_WARNING,"Unknown persistent list entry type in module shutdown (%d)",le->type);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int init_resource_list(ELS_D)
|
||||
{
|
||||
return zend_hash_init(&EG(regular_list), 0, NULL, list_entry_destructor, 0);
|
||||
}
|
||||
|
||||
|
||||
int init_resource_plist(ELS_D)
|
||||
{
|
||||
return zend_hash_init(&EG(persistent_list), 0, NULL, plist_entry_destructor, 1);
|
||||
}
|
||||
|
||||
|
||||
void destroy_resource_list(void)
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
zend_hash_destroy(&EG(regular_list));
|
||||
}
|
||||
|
||||
|
||||
void destroy_resource_plist(void)
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
zend_hash_destroy(&EG(persistent_list));
|
||||
}
|
||||
|
||||
|
||||
static int clean_module_resource(list_entry *le, int *resource_id)
|
||||
{
|
||||
if (le->type == *resource_id) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int clean_module_resource_destructors(list_destructors_entry *ld, int *module_number)
|
||||
{
|
||||
if (ld->module_number == *module_number) {
|
||||
ELS_FETCH();
|
||||
|
||||
zend_hash_apply_with_argument(&EG(persistent_list), (int (*)(void *,void *)) clean_module_resource, (void *) &(ld->resource_id));
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _LIST_H
|
||||
#define _LIST_H
|
||||
|
||||
#include "zend_hash.h"
|
||||
#include "zend_globals.h"
|
||||
|
||||
extern HashTable list_destructors;
|
||||
|
||||
typedef struct _list_entry {
|
||||
void *ptr;
|
||||
int type;
|
||||
int refcount;
|
||||
} list_entry;
|
||||
|
||||
typedef struct _list_destructors_entry {
|
||||
void (*list_destructor)(void *);
|
||||
void (*plist_destructor)(void *);
|
||||
int module_number;
|
||||
int resource_id;
|
||||
} list_destructors_entry;
|
||||
|
||||
#define register_list_destructors(ld,pld) _register_list_destructors((void (*)(void *))ld, (void (*)(void *))pld, module_number);
|
||||
ZEND_API int _register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number);
|
||||
|
||||
enum list_entry_type {
|
||||
LE_DB=1000
|
||||
};
|
||||
|
||||
int list_entry_destructor(void *ptr);
|
||||
int plist_entry_destructor(void *ptr);
|
||||
|
||||
int clean_module_resource_destructors(list_destructors_entry *ld, int *module_number);
|
||||
int init_resource_list(ELS_D);
|
||||
int init_resource_plist(ELS_D);
|
||||
void destroy_resource_list(void);
|
||||
void destroy_resource_plist(void);
|
||||
|
||||
ZEND_API int zend_list_insert(void *ptr, int type);
|
||||
ZEND_API int zend_plist_insert(void *ptr, int type);
|
||||
ZEND_API int zend_list_addref(int id);
|
||||
ZEND_API int zend_list_delete(int id);
|
||||
ZEND_API int zend_plist_delete(int id);
|
||||
ZEND_API void *zend_list_find(int id, int *type);
|
||||
ZEND_API void *zend_plist_find(int id, int *type);
|
||||
|
||||
extern ZEND_API int le_index_ptr; /* list entry type for index pointers */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_llist.h"
|
||||
|
||||
ZEND_API void zend_llist_init(zend_llist *l, size_t size, void (*dtor)(void *data), unsigned char persistent)
|
||||
{
|
||||
l->head = NULL;
|
||||
l->tail = NULL;
|
||||
l->size = size;
|
||||
l->dtor = dtor;
|
||||
l->persistent = persistent;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_llist_add_element(zend_llist *l, void *element)
|
||||
{
|
||||
zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent);
|
||||
|
||||
tmp->prev = l->tail;
|
||||
tmp->next = NULL;
|
||||
if (l->tail) {
|
||||
l->tail->next = tmp;
|
||||
} else {
|
||||
l->head = tmp;
|
||||
}
|
||||
l->tail = tmp;
|
||||
memcpy(tmp->data, element, l->size);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element)
|
||||
{
|
||||
zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent);
|
||||
|
||||
tmp->next = l->head;
|
||||
tmp->prev = NULL;
|
||||
if (l->head) {
|
||||
l->head->prev = tmp;
|
||||
} else {
|
||||
l->tail = tmp;
|
||||
}
|
||||
l->head = tmp;
|
||||
memcpy(tmp->data, element, l->size);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_llist_del_element(zend_llist *l, void *element)
|
||||
{
|
||||
zend_llist_element *current=l->head;
|
||||
|
||||
while (current) {
|
||||
if (!memcmp(current->data, element, l->size)) {
|
||||
if (current->prev) {
|
||||
current->prev->next = current->next;
|
||||
} else {
|
||||
l->head = current->next;
|
||||
}
|
||||
if (current->next) {
|
||||
current->next->prev = current->prev;
|
||||
} else {
|
||||
l->tail = current->prev;
|
||||
}
|
||||
if (l->dtor) {
|
||||
l->dtor(current->data);
|
||||
efree(current);
|
||||
}
|
||||
break;
|
||||
}
|
||||
current = current->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_llist_destroy(zend_llist *l)
|
||||
{
|
||||
zend_llist_element *current=l->head, *next;
|
||||
|
||||
while (current) {
|
||||
next = current->next;
|
||||
if (l->dtor) {
|
||||
l->dtor(current->data);
|
||||
}
|
||||
pefree(current, l->persistent);
|
||||
current = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_llist_clean(zend_llist *l)
|
||||
{
|
||||
zend_llist_destroy(l);
|
||||
l->head = l->tail = NULL;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_llist_remove_tail(zend_llist *l)
|
||||
{
|
||||
zend_llist_element *old_tail;
|
||||
|
||||
if ((old_tail = l->tail)) {
|
||||
if (l->tail->prev) {
|
||||
l->tail->prev->next = NULL;
|
||||
}
|
||||
l->tail = l->tail->prev;
|
||||
efree(old_tail);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src)
|
||||
{
|
||||
zend_llist_element *ptr;
|
||||
|
||||
zend_llist_init(dst, src->size, src->dtor, src->persistent);
|
||||
ptr = src->head;
|
||||
while (ptr) {
|
||||
zend_llist_add_element(dst, ptr->data);
|
||||
ptr = ptr->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_llist_apply(zend_llist *l, void (*func)(void *data))
|
||||
{
|
||||
zend_llist_element *element;
|
||||
|
||||
for (element=l->head; element; element=element->next) {
|
||||
func(element->data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_llist_apply_with_argument(zend_llist *l, void (*func)(void *data, void *arg), void *arg)
|
||||
{
|
||||
zend_llist_element *element;
|
||||
|
||||
for (element=l->head; element; element=element->next) {
|
||||
func(element->data, arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void *zend_llist_get_first(zend_llist *l)
|
||||
{
|
||||
l->traverse_ptr = l->head;
|
||||
if (l->traverse_ptr) {
|
||||
return l->traverse_ptr->data;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void *zend_llist_get_last(zend_llist *l)
|
||||
{
|
||||
l->traverse_ptr = l->tail;
|
||||
if (l->traverse_ptr) {
|
||||
return l->traverse_ptr->data;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void *zend_llist_get_next(zend_llist *l)
|
||||
{
|
||||
if (l->traverse_ptr) {
|
||||
l->traverse_ptr = l->traverse_ptr->next;
|
||||
if (l->traverse_ptr) {
|
||||
return l->traverse_ptr->data;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void *zend_llist_get_prev(zend_llist *l)
|
||||
{
|
||||
if (l->traverse_ptr) {
|
||||
l->traverse_ptr = l->traverse_ptr->prev;
|
||||
if (l->traverse_ptr) {
|
||||
return l->traverse_ptr->data;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ZEND_LLIST_H
|
||||
#define _ZEND_LLIST_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct _zend_llist_element {
|
||||
struct _zend_llist_element *next;
|
||||
struct _zend_llist_element *prev;
|
||||
char data[1]; /* Needs to always be last in the struct */
|
||||
} zend_llist_element;
|
||||
|
||||
typedef struct _zend_llist {
|
||||
zend_llist_element *head;
|
||||
zend_llist_element *tail;
|
||||
size_t size;
|
||||
void (*dtor)(void *data);
|
||||
unsigned char persistent;
|
||||
zend_llist_element *traverse_ptr;
|
||||
} zend_llist;
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_llist_init(zend_llist *l, size_t size, void (*dtor)(void *data), unsigned char persistent);
|
||||
ZEND_API void zend_llist_add_element(zend_llist *l, void *element);
|
||||
ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element);
|
||||
ZEND_API void zend_llist_del_element(zend_llist *l, void *element);
|
||||
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_copy(zend_llist *dst, zend_llist *src);
|
||||
ZEND_API void zend_llist_apply(zend_llist *l, void (*func)(void *data));
|
||||
ZEND_API void zend_llist_apply_with_argument(zend_llist *l, void (*func)(void *data, void *arg), void *arg);
|
||||
ZEND_API int zend_llist_count(zend_llist *l);
|
||||
|
||||
/* traversal */
|
||||
ZEND_API void *zend_llist_get_first(zend_llist *l);
|
||||
ZEND_API void *zend_llist_get_last(zend_llist *l);
|
||||
ZEND_API void *zend_llist_get_next(zend_llist *l);
|
||||
ZEND_API void *zend_llist_get_prev(zend_llist *l);
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif /* _ZEND_LLIST_H */
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _MODULES_H
|
||||
#define _MODULES_H
|
||||
|
||||
#define INIT_FUNC_ARGS int type, int module_number
|
||||
#define INIT_FUNC_ARGS_PASSTHRU type, module_number
|
||||
#define SHUTDOWN_FUNC_ARGS int type, int module_number
|
||||
#define SHUTDOWN_FUNC_ARGS_PASSTHRU type, module_number
|
||||
#define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module
|
||||
|
||||
#define STANDARD_MODULE_PROPERTIES 0, 0, 0, NULL, 0
|
||||
|
||||
|
||||
#define MODULE_PERSISTENT 1
|
||||
#define MODULE_TEMPORARY 2
|
||||
|
||||
typedef struct _zend_module_entry zend_module_entry;
|
||||
|
||||
struct _zend_module_entry {
|
||||
char *name;
|
||||
zend_function_entry *functions;
|
||||
int (*module_startup_func)(INIT_FUNC_ARGS);
|
||||
int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS);
|
||||
int (*request_startup_func)(INIT_FUNC_ARGS);
|
||||
int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS);
|
||||
void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS);
|
||||
int request_started, module_started;
|
||||
unsigned char type;
|
||||
void *handle;
|
||||
int module_number;
|
||||
};
|
||||
|
||||
|
||||
extern HashTable module_registry;
|
||||
|
||||
extern void module_destructor(zend_module_entry *module);
|
||||
extern int module_registry_cleanup(zend_module_entry *module);
|
||||
extern int module_registry_request_startup(zend_module_entry *module);
|
||||
|
||||
#define ZEND_MODULE_DTOR (int (*)(void *)) module_destructor
|
||||
#endif
|
||||
@@ -0,0 +1,399 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_alloc.h"
|
||||
#include "zend_compile.h"
|
||||
#include "zend_variables.h"
|
||||
#include "zend_operators.h"
|
||||
#include "zend_extensions.h"
|
||||
#include "zend_API.h"
|
||||
|
||||
|
||||
static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array)
|
||||
{
|
||||
if (extension->op_array_ctor) {
|
||||
if (extension->resource_number>=0) {
|
||||
extension->op_array_ctor(&op_array->reserved[extension->resource_number]);
|
||||
} else {
|
||||
extension->op_array_ctor(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array)
|
||||
{
|
||||
if (extension->op_array_dtor) {
|
||||
if (extension->resource_number>=0) {
|
||||
extension->op_array_dtor(&op_array->reserved[extension->resource_number]);
|
||||
} else {
|
||||
extension->op_array_dtor(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void op_array_alloc_ops(zend_op_array *op_array)
|
||||
{
|
||||
op_array->opcodes = erealloc(op_array->opcodes, (op_array->size)*sizeof(zend_op));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void init_op_array(zend_op_array *op_array, int initial_ops_size)
|
||||
{
|
||||
op_array->type = ZEND_USER_FUNCTION;
|
||||
#if SUPPORT_INTERACTIVE
|
||||
{
|
||||
ELS_FETCH();
|
||||
|
||||
op_array->start_op_number = op_array->end_op_number = op_array->last_executed_op_number = 0;
|
||||
op_array->backpatch_count = 0;
|
||||
if (EG(interactive)) {
|
||||
/* We must avoid a realloc() on the op_array in interactive mode, since pointers to constants
|
||||
* will become invalid
|
||||
*/
|
||||
initial_ops_size = 8192;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
op_array->refcount = (int *) emalloc(sizeof(int));
|
||||
*op_array->refcount = 1;
|
||||
op_array->size = initial_ops_size;
|
||||
op_array->last = 0;
|
||||
op_array->opcodes = NULL;
|
||||
op_array_alloc_ops(op_array);
|
||||
|
||||
op_array->T = 0;
|
||||
|
||||
op_array->function_name = NULL;
|
||||
|
||||
op_array->arg_types = NULL;
|
||||
|
||||
op_array->brk_cont_array = NULL;
|
||||
op_array->last_brk_cont = 0;
|
||||
op_array->current_brk_cont = -1;
|
||||
|
||||
op_array->static_variables = NULL;
|
||||
|
||||
op_array->uses_globals = 0;
|
||||
|
||||
zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_op_array_ctor_handler, op_array);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int destroy_zend_function(zend_function *function)
|
||||
{
|
||||
switch (function->type) {
|
||||
case ZEND_USER_FUNCTION:
|
||||
destroy_op_array((zend_op_array *) function);
|
||||
break;
|
||||
case ZEND_INTERNAL_FUNCTION:
|
||||
/* do nothing */
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int destroy_zend_class(zend_class_entry *ce)
|
||||
{
|
||||
if (--(*ce->refcount)>0) {
|
||||
return 1;
|
||||
}
|
||||
switch (ce->type) {
|
||||
case ZEND_USER_CLASS:
|
||||
efree(ce->name);
|
||||
efree(ce->refcount);
|
||||
zend_hash_destroy(&ce->function_table);
|
||||
zend_hash_destroy(&ce->default_properties);
|
||||
break;
|
||||
case ZEND_INTERNAL_CLASS:
|
||||
free(ce->name);
|
||||
free(ce->refcount);
|
||||
zend_hash_destroy(&ce->function_table);
|
||||
zend_hash_destroy(&ce->default_properties);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void zend_class_add_ref(zend_class_entry *ce)
|
||||
{
|
||||
(*ce->refcount)++;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void destroy_op_array(zend_op_array *op_array)
|
||||
{
|
||||
zend_op *opline = op_array->opcodes;
|
||||
zend_op *end = op_array->opcodes+op_array->last;
|
||||
|
||||
if (--(*op_array->refcount)>0) {
|
||||
return;
|
||||
}
|
||||
|
||||
efree(op_array->refcount);
|
||||
|
||||
while (opline<end) {
|
||||
if (opline->op1.op_type==IS_CONST) {
|
||||
#if DEBUG_ZEND>2
|
||||
printf("Reducing refcount for %x 1=>0 (destroying)\n", &opline->op1.u.constant);
|
||||
#endif
|
||||
zval_dtor(&opline->op1.u.constant);
|
||||
}
|
||||
if (opline->op2.op_type==IS_CONST) {
|
||||
#if DEBUG_ZEND>2
|
||||
printf("Reducing refcount for %x 1=>0 (destroying)\n", &opline->op2.u.constant);
|
||||
#endif
|
||||
zval_dtor(&opline->op2.u.constant);
|
||||
}
|
||||
opline++;
|
||||
}
|
||||
efree(op_array->opcodes);
|
||||
if (op_array->function_name) {
|
||||
efree(op_array->function_name);
|
||||
}
|
||||
if (op_array->arg_types) {
|
||||
efree(op_array->arg_types);
|
||||
}
|
||||
if (op_array->brk_cont_array) {
|
||||
efree(op_array->brk_cont_array);
|
||||
}
|
||||
if (op_array->static_variables) {
|
||||
zend_hash_destroy(op_array->static_variables);
|
||||
efree(op_array->static_variables);
|
||||
}
|
||||
zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_op_array_dtor_handler, op_array);
|
||||
}
|
||||
|
||||
|
||||
zend_op *get_next_op(zend_op_array *op_array CLS_DC)
|
||||
{
|
||||
int next_op_num = op_array->last++;
|
||||
zend_op *next_op;
|
||||
|
||||
if (next_op_num >= op_array->size) {
|
||||
#if SUPPORT_INTERACTIVE
|
||||
ELS_FETCH();
|
||||
|
||||
if (EG(interactive)) {
|
||||
/* we messed up */
|
||||
zend_printf("Ran out of opcode space!\n"
|
||||
"You should probably consider writing this huge script into a file!\n");
|
||||
zend_bailout();
|
||||
}
|
||||
#endif
|
||||
op_array->size *= 2;
|
||||
op_array_alloc_ops(op_array);
|
||||
}
|
||||
|
||||
next_op = &(op_array->opcodes[next_op_num]);
|
||||
next_op->lineno = CG(zend_lineno);
|
||||
next_op->filename = zend_get_compiled_filename();
|
||||
next_op->result.op_type = IS_UNUSED;
|
||||
next_op->extended_value = 0;
|
||||
|
||||
return next_op;
|
||||
}
|
||||
|
||||
|
||||
int get_next_op_number(zend_op_array *op_array)
|
||||
{
|
||||
return op_array->last;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array)
|
||||
{
|
||||
op_array->last_brk_cont++;
|
||||
op_array->brk_cont_array = erealloc(op_array->brk_cont_array, sizeof(zend_brk_cont_element)*op_array->last_brk_cont);
|
||||
return &op_array->brk_cont_array[op_array->last_brk_cont-1];
|
||||
}
|
||||
|
||||
|
||||
static void zend_update_extended_info(zend_op_array *op_array CLS_DC)
|
||||
{
|
||||
zend_op *opline = op_array->opcodes, *end=opline+op_array->last;
|
||||
|
||||
while (opline<end) {
|
||||
if (opline->opcode == ZEND_EXT_STMT) {
|
||||
if (opline+1<end) {
|
||||
if ((opline+1)->opcode == ZEND_EXT_STMT) {
|
||||
opline->opcode = ZEND_NOP;
|
||||
opline++;
|
||||
continue;
|
||||
}
|
||||
opline->lineno = (opline+1)->lineno;
|
||||
opline->filename = (opline+1)->filename;
|
||||
} else {
|
||||
opline->opcode = ZEND_NOP;
|
||||
}
|
||||
}
|
||||
opline++;
|
||||
}
|
||||
opline = get_next_op(op_array CLS_CC);
|
||||
opline->opcode = ZEND_EXT_STMT;
|
||||
opline->op1.op_type = IS_UNUSED;
|
||||
opline->op2.op_type = IS_UNUSED;
|
||||
if (op_array->last>0) {
|
||||
opline->filename = op_array->opcodes[op_array->last-2].filename;
|
||||
opline->lineno= op_array->opcodes[op_array->last-2].lineno;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array)
|
||||
{
|
||||
if (extension->op_array_handler) {
|
||||
extension->op_array_handler(op_array);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int pass_two(zend_op_array *op_array)
|
||||
{
|
||||
CLS_FETCH();
|
||||
|
||||
if (op_array->type!=ZEND_USER_FUNCTION && op_array->type!=ZEND_EVAL_CODE) {
|
||||
return 0;
|
||||
}
|
||||
if (CG(extended_info)) {
|
||||
zend_update_extended_info(op_array CLS_CC);
|
||||
}
|
||||
if (CG(handle_op_arrays)) {
|
||||
zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_op_array_handler, op_array);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void pass_include_eval(zend_op_array *op_array)
|
||||
{
|
||||
zend_op *opline=op_array->opcodes, *end=opline+op_array->last;
|
||||
|
||||
while (opline<end) {
|
||||
if (opline->op1.op_type==IS_CONST) {
|
||||
opline->op1.u.constant.EA.is_ref = 1;
|
||||
}
|
||||
if (opline->op2.op_type==IS_CONST) {
|
||||
opline->op2.u.constant.EA.is_ref = 1;
|
||||
}
|
||||
opline++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int print_class(zend_class_entry *class_entry)
|
||||
{
|
||||
printf("Class %s:\n", class_entry->name);
|
||||
zend_hash_apply(&class_entry->function_table, (int (*)(void *)) pass_two);
|
||||
printf("End of class %s.\n\n", class_entry->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ZEND_API unary_op_type get_unary_op(int opcode)
|
||||
{
|
||||
switch(opcode) {
|
||||
case ZEND_BW_NOT:
|
||||
return (unary_op_type) bitwise_not_function;
|
||||
break;
|
||||
case ZEND_BOOL_NOT:
|
||||
return (unary_op_type) boolean_not_function;
|
||||
break;
|
||||
default:
|
||||
return (unary_op_type) NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void *get_binary_op(int opcode)
|
||||
{
|
||||
switch (opcode) {
|
||||
case ZEND_ADD:
|
||||
case ZEND_ASSIGN_ADD:
|
||||
return (void *) add_function;
|
||||
break;
|
||||
case ZEND_SUB:
|
||||
case ZEND_ASSIGN_SUB:
|
||||
return (void *) sub_function;
|
||||
break;
|
||||
case ZEND_MUL:
|
||||
case ZEND_ASSIGN_MUL:
|
||||
return (void *) mul_function;
|
||||
break;
|
||||
case ZEND_DIV:
|
||||
case ZEND_ASSIGN_DIV:
|
||||
return (void *) div_function;
|
||||
break;
|
||||
case ZEND_MOD:
|
||||
case ZEND_ASSIGN_MOD:
|
||||
return (void *) mod_function;
|
||||
break;
|
||||
case ZEND_SL:
|
||||
case ZEND_ASSIGN_SL:
|
||||
return (void *) shift_left_function;
|
||||
break;
|
||||
case ZEND_SR:
|
||||
case ZEND_ASSIGN_SR:
|
||||
return (void *) shift_right_function;
|
||||
break;
|
||||
case ZEND_CONCAT:
|
||||
case ZEND_ASSIGN_CONCAT:
|
||||
return (void *) concat_function;
|
||||
break;
|
||||
case ZEND_IS_EQUAL:
|
||||
return (void *) is_equal_function;
|
||||
break;
|
||||
case ZEND_IS_NOT_EQUAL:
|
||||
return (void *) is_not_equal_function;
|
||||
break;
|
||||
case ZEND_IS_SMALLER:
|
||||
return (void *) is_smaller_function;
|
||||
break;
|
||||
case ZEND_IS_SMALLER_OR_EQUAL:
|
||||
return (void *) is_smaller_or_equal_function;
|
||||
break;
|
||||
case ZEND_BW_OR:
|
||||
case ZEND_ASSIGN_BW_OR:
|
||||
return (void *) bitwise_or_function;
|
||||
break;
|
||||
case ZEND_BW_AND:
|
||||
case ZEND_ASSIGN_BW_AND:
|
||||
return (void *) bitwise_and_function;
|
||||
break;
|
||||
case ZEND_BW_XOR:
|
||||
case ZEND_ASSIGN_BW_XOR:
|
||||
return (void *) bitwise_xor_function;
|
||||
break;
|
||||
default:
|
||||
return (void *) NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _OPERATORS_H
|
||||
#define _OPERATORS_H
|
||||
|
||||
#define MAX_LENGTH_OF_LONG 18
|
||||
#define MAX_LENGTH_OF_DOUBLE 32
|
||||
|
||||
ZEND_API int add_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int sub_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int mul_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int div_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int mod_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int boolean_or_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int boolean_and_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int boolean_not_function(zval *result, zval *op1);
|
||||
ZEND_API int bitwise_not_function(zval *result, zval *op1);
|
||||
ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int concat_function(zval *result, zval *op1, zval *op2);
|
||||
|
||||
ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2);
|
||||
|
||||
ZEND_API int increment_function(zval *op1);
|
||||
ZEND_API int decrement_function(zval *op2);
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void convert_scalar_to_number(zval *op);
|
||||
ZEND_API void convert_to_string(zval *op);
|
||||
ZEND_API void convert_to_long(zval *op);
|
||||
ZEND_API void convert_to_long_base(zval *op, int base);
|
||||
ZEND_API void convert_to_boolean(zval *op);
|
||||
ZEND_API void convert_to_array(zval *op);
|
||||
ZEND_API void convert_to_object(zval *op);
|
||||
ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2);
|
||||
ZEND_API void convert_to_double(zval *op);
|
||||
END_EXTERN_C()
|
||||
|
||||
ZEND_API int zval_is_true(zval *op);
|
||||
ZEND_API int compare_function(zval *result, zval *op1, zval *op2);
|
||||
|
||||
ZEND_API void zend_str_tolower(char *str, unsigned int length);
|
||||
ZEND_API int zend_binary_strcmp(zval *s1, zval *s2);
|
||||
ZEND_API int zend_binary_strcasecmp(zval *s1, zval *s2);
|
||||
ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_ptr_stack.h"
|
||||
#if HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
|
||||
ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack)
|
||||
{
|
||||
stack->top_element = stack->elements = (void **) emalloc(sizeof(void *)*PTR_STACK_BLOCK_SIZE);
|
||||
stack->max = PTR_STACK_BLOCK_SIZE;
|
||||
stack->top = 0;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline void zend_ptr_stack_push(zend_ptr_stack *stack, void *ptr)
|
||||
{
|
||||
if (stack->top >= stack->max) { /* we need to allocate more memory */
|
||||
stack->elements = (void **) erealloc(stack->elements, (sizeof(void *) * (stack->max *= 2 )));
|
||||
stack->top_element = stack->elements+stack->top;
|
||||
}
|
||||
stack->top++;
|
||||
*(stack->top_element++) = ptr;
|
||||
}
|
||||
|
||||
ZEND_API inline void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count,...)
|
||||
{
|
||||
va_list ptr;
|
||||
void *elem;
|
||||
|
||||
if (stack->top+count > stack->max) { /* we need to allocate more memory */
|
||||
stack->max *= 2;
|
||||
stack->max += count;
|
||||
stack->elements = (void **) erealloc(stack->elements, (sizeof(void *) * (stack->max)));
|
||||
stack->top_element = stack->elements+stack->top;
|
||||
}
|
||||
va_start(ptr, count);
|
||||
while (count>0) {
|
||||
elem = va_arg(ptr, void *);
|
||||
stack->top++;
|
||||
*(stack->top_element++) = elem;
|
||||
count--;
|
||||
}
|
||||
va_end(ptr);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API inline void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count,...)
|
||||
{
|
||||
va_list ptr;
|
||||
void **elem;
|
||||
|
||||
va_start(ptr, count);
|
||||
while (count>0) {
|
||||
elem = va_arg(ptr, void **);
|
||||
*elem = *(--stack->top_element);
|
||||
stack->top--;
|
||||
count--;
|
||||
}
|
||||
va_end(ptr);
|
||||
}
|
||||
|
||||
ZEND_API inline void *zend_ptr_stack_pop(zend_ptr_stack *stack)
|
||||
{
|
||||
stack->top--;
|
||||
return *(--stack->top_element);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack)
|
||||
{
|
||||
if (stack->elements) {
|
||||
efree(stack->elements);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_ptr_stack_apply(zend_ptr_stack *stack, void (*func)(void *))
|
||||
{
|
||||
int i = stack->top;
|
||||
|
||||
while (--i >= 0) {
|
||||
func(stack->elements[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *))
|
||||
{
|
||||
zend_ptr_stack_apply(stack, func);
|
||||
stack->top = 0;
|
||||
stack->top_element = stack->elements;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ZEND_PTR_STACK_H
|
||||
#define _ZEND_PTR_STACK_H
|
||||
|
||||
typedef struct _zend_ptr_stack {
|
||||
short top, max;
|
||||
void **elements;
|
||||
void **top_element;
|
||||
} zend_ptr_stack;
|
||||
|
||||
|
||||
#define PTR_STACK_BLOCK_SIZE 64
|
||||
|
||||
ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack);
|
||||
ZEND_API void zend_ptr_stack_push(zend_ptr_stack *stack, void *ptr);
|
||||
ZEND_API void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count,...);
|
||||
ZEND_API void *zend_ptr_stack_pop(zend_ptr_stack *stack);
|
||||
ZEND_API void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count,...);
|
||||
ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack);
|
||||
ZEND_API void zend_ptr_stack_apply(zend_ptr_stack *stack, void (*func)(void *));
|
||||
ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *));
|
||||
|
||||
#endif /* _ZEND_PTR_STACK_H */
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "zend.h"
|
||||
|
||||
#if HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#if BROKEN_SPRINTF
|
||||
int zend_sprintf(char *buffer, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(buffer, format, args);
|
||||
va_end(args);
|
||||
|
||||
return strlen(buffer);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_stack.h"
|
||||
|
||||
ZEND_API int zend_stack_init(zend_stack *stack)
|
||||
{
|
||||
stack->top = 0;
|
||||
stack->elements = (void **) emalloc(sizeof(void **) * STACK_BLOCK_SIZE);
|
||||
if (!stack->elements) {
|
||||
return FAILURE;
|
||||
} else {
|
||||
stack->max = STACK_BLOCK_SIZE;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size)
|
||||
{
|
||||
if (stack->top >= stack->max) { /* we need to allocate more memory */
|
||||
stack->elements = (void **) erealloc(stack->elements,
|
||||
(sizeof(void **) * (stack->max += STACK_BLOCK_SIZE)));
|
||||
if (!stack->elements) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
stack->elements[stack->top] = (void *) emalloc(size);
|
||||
memcpy(stack->elements[stack->top], element, size);
|
||||
return stack->top++;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_stack_top(zend_stack *stack, void **element)
|
||||
{
|
||||
if (stack->top > 0) {
|
||||
*element = stack->elements[stack->top - 1];
|
||||
return SUCCESS;
|
||||
} else {
|
||||
*element = NULL;
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_stack_del_top(zend_stack *stack)
|
||||
{
|
||||
if (stack->top > 0) {
|
||||
efree(stack->elements[--stack->top]);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_stack_int_top(zend_stack *stack)
|
||||
{
|
||||
int *e;
|
||||
|
||||
if (zend_stack_top(stack, (void **) &e) == FAILURE) {
|
||||
return FAILURE; /* this must be a negative number, since negative numbers can't be address numbers */
|
||||
} else {
|
||||
return *e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_stack_is_empty(zend_stack *stack)
|
||||
{
|
||||
if (stack->top == 0) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_stack_destroy(zend_stack *stack)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; i < stack->top; i++) {
|
||||
efree(stack->elements[i]);
|
||||
}
|
||||
|
||||
if (stack->elements) {
|
||||
efree(stack->elements);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void **zend_stack_base(zend_stack *stack)
|
||||
{
|
||||
return stack->elements;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_stack_count(zend_stack *stack)
|
||||
{
|
||||
return stack->top;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_stack_apply(zend_stack *stack, void (*apply_function)(void *element), int type)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch (type) {
|
||||
case ZEND_STACK_APPLY_TOPDOWN:
|
||||
for (i=stack->top-1; i>=0; i--) {
|
||||
apply_function(stack->elements[i]);
|
||||
}
|
||||
break;
|
||||
case ZEND_STACK_APPLY_BOTTOMUP:
|
||||
for (i=0; i<stack->top; i++) {
|
||||
apply_function(stack->elements[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, void (*apply_function)(void *element, void *arg), int type, void *arg)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch (type) {
|
||||
case ZEND_STACK_APPLY_TOPDOWN:
|
||||
for (i=stack->top-1; i>=0; i--) {
|
||||
apply_function(stack->elements[i], arg);
|
||||
}
|
||||
break;
|
||||
case ZEND_STACK_APPLY_BOTTOMUP:
|
||||
for (i=0; i<stack->top; i++) {
|
||||
apply_function(stack->elements[i], arg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ZEND_STACK_H
|
||||
#define _ZEND_STACK_H
|
||||
|
||||
typedef struct _zend_stack {
|
||||
int top, max;
|
||||
void **elements;
|
||||
} zend_stack;
|
||||
|
||||
|
||||
#define STACK_BLOCK_SIZE 64
|
||||
|
||||
ZEND_API int zend_stack_init(zend_stack *stack);
|
||||
ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size);
|
||||
ZEND_API int zend_stack_top(zend_stack *stack, void **element);
|
||||
ZEND_API int zend_stack_del_top(zend_stack *stack);
|
||||
ZEND_API int zend_stack_int_top(zend_stack *stack);
|
||||
ZEND_API int zend_stack_is_empty(zend_stack *stack);
|
||||
ZEND_API int zend_stack_destroy(zend_stack *stack);
|
||||
ZEND_API void **zend_stack_base(zend_stack *stack);
|
||||
ZEND_API int zend_stack_count(zend_stack *stack);
|
||||
ZEND_API void zend_stack_apply(zend_stack *stack, void (*apply_function)(void *element), int type);
|
||||
ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, void (*apply_function)(void *element, void *arg), int type, void *arg);
|
||||
|
||||
#define ZEND_STACK_APPLY_TOPDOWN 1
|
||||
#define ZEND_STACK_APPLY_BOTTOMUP 2
|
||||
|
||||
#endif /* _ZEND_STACK_H */
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "zend.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_globals.h"
|
||||
#include "zend_constants.h"
|
||||
#include "zend_variables.h"
|
||||
#include "zend_list.h"
|
||||
|
||||
ZEND_API char *empty_string = ""; /* in order to save emalloc() and efree() time for
|
||||
* empty strings (usually used to denote empty
|
||||
* return values in failed functions).
|
||||
* The macro STR_FREE() will not efree() it.
|
||||
*/
|
||||
|
||||
ZEND_API char *undefined_variable_string = "\0";
|
||||
|
||||
/* this function MUST set the value for the variable to an empty string */
|
||||
/* and empty strings must be evaluated as FALSE */
|
||||
ZEND_API inline void var_reset(zval *var)
|
||||
{
|
||||
var->type = IS_STRING;
|
||||
var->value.str.val = empty_string;
|
||||
var->value.str.len = 0;
|
||||
}
|
||||
|
||||
ZEND_API inline void var_uninit(zval *var)
|
||||
{
|
||||
var->type = IS_STRING;
|
||||
var->value.str.val = undefined_variable_string;
|
||||
var->value.str.len = 0;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zval_dtor(zval *zvalue)
|
||||
{
|
||||
if (zvalue->type==IS_LONG) {
|
||||
return 1;
|
||||
}
|
||||
switch(zvalue->type) {
|
||||
case IS_STRING:
|
||||
case IS_CONSTANT:
|
||||
STR_FREE(zvalue->value.str.val);
|
||||
break;
|
||||
case IS_ARRAY: {
|
||||
ELS_FETCH();
|
||||
|
||||
if (zvalue->value.ht && (zvalue->value.ht != &EG(symbol_table))) {
|
||||
zend_hash_destroy(zvalue->value.ht);
|
||||
efree(zvalue->value.ht);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
zend_hash_destroy(zvalue->value.obj.properties);
|
||||
efree(zvalue->value.obj.properties);
|
||||
break;
|
||||
case IS_RESOURCE:
|
||||
/* destroy resource */
|
||||
zend_list_delete(zvalue->value.lval);
|
||||
break;
|
||||
case IS_LONG:
|
||||
case IS_DOUBLE:
|
||||
case IS_BOOL:
|
||||
default:
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void zval_add_ref(zval **p)
|
||||
{
|
||||
(*p)->refcount++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ZEND_API int zval_copy_ctor(zval *zvalue)
|
||||
{
|
||||
switch (zvalue->type) {
|
||||
case IS_RESOURCE:
|
||||
zend_list_addref(zvalue->value.lval);
|
||||
break;
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
break;
|
||||
case IS_STRING:
|
||||
if (zvalue->value.str.val) {
|
||||
if (zvalue->value.str.len==0) {
|
||||
if (zvalue->value.str.val==undefined_variable_string) {
|
||||
zvalue->value.str.val = undefined_variable_string;
|
||||
} else {
|
||||
zvalue->value.str.val = empty_string;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
zvalue->value.str.val = (char *) estrndup(zvalue->value.str.val, zvalue->value.str.len);
|
||||
break;
|
||||
case IS_ARRAY: {
|
||||
zval *tmp;
|
||||
HashTable *original_ht = zvalue->value.ht;
|
||||
ELS_FETCH();
|
||||
|
||||
if (!zvalue->value.ht || zvalue->value.ht==&EG(symbol_table)) {
|
||||
var_reset(zvalue);
|
||||
return FAILURE;
|
||||
}
|
||||
zvalue->value.ht = (HashTable *) emalloc(sizeof(HashTable));
|
||||
zend_hash_init(zvalue->value.ht, 0, NULL, PVAL_PTR_DTOR, 0);
|
||||
zend_hash_copy(zvalue->value.ht, original_ht, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
}
|
||||
break;
|
||||
case IS_OBJECT: {
|
||||
zval *tmp;
|
||||
HashTable *original_ht = zvalue->value.obj.properties;
|
||||
|
||||
zvalue->value.obj.properties = (HashTable *) emalloc(sizeof(HashTable));
|
||||
zend_hash_init(zvalue->value.obj.properties, 0, NULL, PVAL_PTR_DTOR, 0);
|
||||
zend_hash_copy(zvalue->value.obj.properties, original_ht, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
}
|
||||
break;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_print_variable(zval *var)
|
||||
{
|
||||
return zend_print_zval(var, 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 0.91 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_91.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _VARIABLES_H
|
||||
#define _VARIABLES_H
|
||||
|
||||
|
||||
ZEND_API int zend_print_variable(zval *var);
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API int zval_copy_ctor(zval *zvalue);
|
||||
ZEND_API int zval_dtor(zval *zvalue);
|
||||
END_EXTERN_C()
|
||||
|
||||
ZEND_API int zval_ptr_dtor(zval **zval_ptr);
|
||||
void zval_add_ref(zval **p);
|
||||
|
||||
#define PVAL_DESTRUCTOR (int (*)(void *)) zval_dtor
|
||||
#define PVAL_PTR_DTOR (int (*)(void *)) zval_ptr_dtor
|
||||
#define PVAL_COPY_CTOR (void (*)(void *)) zval_copy_ctor
|
||||
|
||||
ZEND_API void var_reset(zval *var);
|
||||
ZEND_API void var_uninit(zval *var);
|
||||
|
||||
#endif
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
/* This is the default configuration file to read -*- C -*- */
|
||||
|
||||
/* these are defined by automake */
|
||||
#undef PACKAGE
|
||||
#undef VERSION
|
||||
|
||||
#undef HAVE_STRUCT_FLOCK
|
||||
#undef HAVE_TM_GMTOFF
|
||||
|
||||
#define CONFIGURATION_FILE_PATH "php.ini"
|
||||
#define USE_CONFIG_FILE 1
|
||||
|
||||
#undef HAVE_DMALLOC
|
||||
|
||||
/* Some global constants defined by conigure */
|
||||
#undef PHP_BUILD_DATE
|
||||
#undef PHP_OS
|
||||
#undef PHP_UNAME
|
||||
|
||||
/* define uint by configure if it is missed (QNX and BSD derived) */
|
||||
#undef uint
|
||||
|
||||
/* define ulong by configure if it is missed (most probably is) */
|
||||
#undef ulong
|
||||
|
||||
/* type check for in_addr_t */
|
||||
#undef in_addr_t
|
||||
|
||||
/* Define if you have dirent.h but opendir() resides in libc rather than in libdir */
|
||||
/* This will cause HAVE_DIRENT_H defined twice sometimes, but it should be problem */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define if you have the resolv library (-lresolv). */
|
||||
#undef HAVE_LIBRESOLV
|
||||
|
||||
/* Define if you have the pam library (-lpam). */
|
||||
#define HAVE_LIBPAM 0
|
||||
|
||||
/* Define if you have the bind library (-lbind). */
|
||||
#define HAVE_LIBBIND 0
|
||||
|
||||
/* Define if you have Netscape LDAP instead of umich ldap or openldap*/
|
||||
#define HAVE_NSLDAP 0
|
||||
|
||||
/* Define if you want safe mode enabled by default. */
|
||||
#define PHP_SAFE_MODE 0
|
||||
|
||||
/* Set to the path to the dir containing safe mode executables */
|
||||
#define PHP_SAFE_MODE_EXEC_DIR /usr/local/php/bin
|
||||
|
||||
/* Define if you want POST/GET/Cookie track variables by default */
|
||||
#define PHP_TRACK_VARS 0
|
||||
|
||||
/* Undefine if you want stricter XML/SGML compliance by default */
|
||||
/* (this disables "<?expression?>" by default) */
|
||||
#define DEFAULT_SHORT_OPEN_TAG 1
|
||||
|
||||
/* Undefine if you do not want PHP by default to escape "'" */
|
||||
/* in GET/POST/Cookie data */
|
||||
#define MAGIC_QUOTES 1
|
||||
|
||||
/* Define both of these if you want the bundled REGEX library */
|
||||
#define REGEX 0
|
||||
#define HSREGEX 0
|
||||
|
||||
/* Define if you have and want to use libnsl */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
/* Define if you have and want to use libsocket */
|
||||
#undef HAVE_LIBSOCKET
|
||||
|
||||
/* Define if you have the sendmail program available */
|
||||
#define HAVE_SENDMAIL 0
|
||||
|
||||
/* Define if you are compiling PHP as an Apache module */
|
||||
#define APACHE 0
|
||||
|
||||
/* Define if you are compiling PHP as an Apache module with mod_charset patch applied (aka Russian Apache)*/
|
||||
#define USE_TRANSFER_TABLES 0
|
||||
|
||||
/* Define if you are compiling PHP as an fhttpd module */
|
||||
#define FHTTPD 0
|
||||
|
||||
/* Define if your Apache creates an ap_config.h header file (only 1.3b6 and later) */
|
||||
#define HAVE_AP_CONFIG_H 0
|
||||
|
||||
/* Define if your Apache has src/include/compat.h */
|
||||
#define HAVE_OLD_COMPAT_H 0
|
||||
|
||||
/* Define if your Apache has src/include/ap_compat.h */
|
||||
#define HAVE_AP_COMPAT_H 0
|
||||
|
||||
#ifndef DEBUG /* should be set to ZEND_DEBUG */
|
||||
#define DEBUG 0
|
||||
#endif
|
||||
|
||||
/* Define if you want to enable PHP RPC (experimental) */
|
||||
#define PHP_RPC 0
|
||||
|
||||
/* Define if you want to prevent the CGI from working unless REDIRECT_STATUS is defined in the environment */
|
||||
#define FORCE_CGI_REDIRECT 0
|
||||
|
||||
/* Define if you want to prevent the CGI from using path_info and path_translated */
|
||||
#define DISCARD_PATH 0
|
||||
|
||||
/* Define if you want include() and other functions to be able to open
|
||||
* http and ftp URLs as files.
|
||||
*/
|
||||
#define PHP3_URL_FOPEN 0
|
||||
|
||||
/* Define if you have broken header files like SunOS 4 */
|
||||
#define MISSING_FCLOSE_DECL 0
|
||||
|
||||
/* Define if you have broken sprintf function like SunOS 4 */
|
||||
#define BROKEN_SPRINTF 0
|
||||
|
||||
/* Define to compile PHP/Zend thread safe */
|
||||
#undef ZTS
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl This file contains local autoconf functions.
|
||||
|
||||
dnl
|
||||
dnl AC_PHP_ONCE(namespace, variable, code)
|
||||
dnl
|
||||
dnl execute code, if variable is not set in namespace
|
||||
dnl
|
||||
AC_DEFUN(AC_PHP_ONCE,[
|
||||
unique=`echo $ac_n "$2$ac_c" | tr -c -d a-zA-Z0-9`
|
||||
cmd="echo $ac_n \"\$$1$unique$ac_c\""
|
||||
if test -n "$unique" && test "`eval $cmd`" = "" ; then
|
||||
eval "$1$unique=set"
|
||||
$3
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl AC_EXPAND_PATH(path, variable)
|
||||
dnl
|
||||
dnl expands path to an absolute path and assigns it to variable
|
||||
dnl
|
||||
AC_DEFUN(AC_EXPAND_PATH,[
|
||||
if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then
|
||||
$2="$1"
|
||||
else
|
||||
$2="`pwd`/$1"
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl AC_ADD_LIBPATH(path)
|
||||
dnl
|
||||
dnl add a library to linkpath/runpath
|
||||
dnl
|
||||
AC_DEFUN(AC_ADD_LIBPATH,[
|
||||
AC_EXPAND_PATH($1, ai_p)
|
||||
AC_PHP_ONCE(LIBPATH, $ai_p, [
|
||||
EXTRA_LIBS="$EXTRA_LIBS -L$ai_p"
|
||||
RAW_RPATHS="$RAW_RPATHS ${raw_runpath_switch}$ai_p"
|
||||
if test -n "$APXS" ; then
|
||||
RPATHS="$RPATHS ${apxs_runpath_switch}$ai_p'"
|
||||
else
|
||||
RPATHS="$RPATHS ${ld_runpath_switch}$ai_p"
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl AC_ADD_INCLUDE(path)
|
||||
dnl
|
||||
dnl add a include path
|
||||
dnl
|
||||
AC_DEFUN(AC_ADD_INCLUDE,[
|
||||
AC_EXPAND_PATH($1, ai_p)
|
||||
AC_PHP_ONCE(INCLUDEPATH, $ai_p, [
|
||||
INCLUDES="$INCLUDES -I$ai_p"
|
||||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl AC_ADD_LIBRARY(library)
|
||||
dnl
|
||||
dnl add a library to the link line
|
||||
dnl
|
||||
AC_DEFUN(AC_ADD_LIBRARY,[
|
||||
AC_PHP_ONCE(LIBRARY, $1, [
|
||||
EXTRA_LIBS="$EXTRA_LIBS -l$1"
|
||||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl AC_ADD_LIBRARY_WITH_PATH(library, path)
|
||||
dnl
|
||||
dnl add a library to the link line and path to linkpath/runpath
|
||||
dnl
|
||||
AC_DEFUN(AC_ADD_LIBRARY_WITH_PATH,[
|
||||
AC_ADD_LIBPATH($2)
|
||||
AC_ADD_LIBRARY($1)
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl Check for cc option
|
||||
dnl
|
||||
AC_DEFUN(AC_CHECK_CC_OPTION,[
|
||||
echo "main(){return 0;}" > conftest.$ac_ext
|
||||
opt="$1"
|
||||
var=`echo $ac_n "$opt$ac_c"|tr -c a-zA-Z0-9 _`
|
||||
AC_MSG_CHECKING([if compiler supports -$1 really])
|
||||
ac_php_compile="${CC-cc} -$opt -o conftest $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1"
|
||||
if eval $ac_php_compile 2>&1 | egrep "$opt" > /dev/null 2>&1 ; then
|
||||
eval php_cc_$var=no
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
if eval ./conftest 2>/dev/null ; then
|
||||
eval php_cc_$var=yes
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
eval php_cc_$var=no
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl See if we have broken header files like SunOS has.
|
||||
dnl
|
||||
AC_DEFUN(AC_MISSING_FCLOSE_DECL,[
|
||||
AC_MSG_CHECKING([for fclose declaration])
|
||||
AC_TRY_COMPILE([#include <stdio.h>],[int (*func)() = fclose],[
|
||||
AC_DEFINE(MISSING_FCLOSE_DECL,0)
|
||||
AC_MSG_RESULT(ok)
|
||||
],[
|
||||
AC_DEFINE(MISSING_FCLOSE_DECL,1)
|
||||
AC_MSG_RESULT(missing)
|
||||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Check for broken sprintf()
|
||||
dnl
|
||||
AC_DEFUN(AC_BROKEN_SPRINTF,[
|
||||
AC_MSG_CHECKING([for broken sprintf])
|
||||
AC_TRY_RUN([main() { char buf[20]; exit (sprintf(buf,"testing 123")!=11); }],[
|
||||
AC_DEFINE(BROKEN_SPRINTF,0)
|
||||
AC_MSG_RESULT(ok)
|
||||
],[
|
||||
AC_DEFINE(BROKEN_SPRINTF,1)
|
||||
AC_MSG_RESULT(broken)
|
||||
],[
|
||||
AC_DEFINE(BROKEN_SPRINTF,0)
|
||||
AC_MSG_RESULT(cannot check, guessing ok)
|
||||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Stuff to do when setting up a new extension.
|
||||
dnl XXX have to change the hardcoding of ".a" when we want to be able
|
||||
dnl to make dynamic libraries as well.
|
||||
dnl
|
||||
AC_DEFUN(PHP_EXTENSION,[
|
||||
EXT_SUBDIRS="$EXT_SUBDIRS $1"
|
||||
if test "$2" != "shared" -a "$2" != "yes"; then
|
||||
_extlib="libphpext_$1.a"
|
||||
EXT_LIBS="$EXT_LIBS $1/$_extlib"
|
||||
EXTINFO_DEPS="$EXTINFO_DEPS ../ext/$1/extinfo.c.stub"
|
||||
EXT_STATIC="$EXT_STATIC $1"
|
||||
else
|
||||
EXT_SHARED="$EXT_SHARED $1"
|
||||
fi
|
||||
dnl EXT_INCLUDE_CODE="\#include \"ext/$1/php3_$1.h\"\\n$EXT_INCLUDE_CODE"
|
||||
dnl EXT_MODULE_PTRS="phpext_$1_ptr, $EXT_MODULE_PTRS"
|
||||
dnl "
|
||||
])
|
||||
|
||||
AC_SUBST(EXT_SUBDIRS)
|
||||
AC_SUBST(EXT_STATIC)
|
||||
AC_SUBST(EXT_SHARED)
|
||||
AC_SUBST(EXT_LIBS)
|
||||
AC_SUBST(EXTINFO_DEPS)
|
||||
dnl AC_SUBST(EXT_INCLUDE_CODE)
|
||||
dnl AC_SUBST(EXT_MODULES_PTRS)
|
||||
|
||||
dnl
|
||||
dnl Solaris requires main code to be position independent in order
|
||||
dnl to let shared objects find symbols. Weird. Ugly.
|
||||
dnl
|
||||
dnl Must be run after all --with-NN options that let the user
|
||||
dnl choose dynamic extensions, and after the gcc test.
|
||||
dnl
|
||||
AC_DEFUN(PHP_SOLARIS_PIC_WEIRDNESS,[
|
||||
AC_MSG_CHECKING(whether -fPIC is required)
|
||||
if test "$EXT_SHARED" != ""; then
|
||||
os=`uname -sr 2>/dev/null`
|
||||
case "$os" in
|
||||
"SunOS 5.6"|"SunOS 5.7")
|
||||
case "$CC" in
|
||||
gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";;
|
||||
*) CFLAGS="$CFLAGS -fpic";;
|
||||
esac
|
||||
AC_MSG_RESULT(yes);;
|
||||
*)
|
||||
AC_MSG_RESULT(no);;
|
||||
esac
|
||||
fi
|
||||
])
|
||||
@@ -0,0 +1,4 @@
|
||||
This is a place-holder which indicates to Configure that it shouldn't
|
||||
provide the default targets when building the Makefile in this directory.
|
||||
Instead it'll just prepend all the important variable definitions, and
|
||||
copy the Makefile.tmpl onto the end.
|
||||
@@ -0,0 +1,77 @@
|
||||
##
|
||||
## Apache 1.3 Makefile template for PHP3 Module
|
||||
## [src/modules/php4/Makefile.tmpl]
|
||||
##
|
||||
|
||||
# the parametrized target
|
||||
LIB=libphp4.$(LIBEXT)
|
||||
|
||||
# objects for building the static library
|
||||
OBJS=mod_php4.o
|
||||
OBJS_LIB=libmodphp4.a
|
||||
|
||||
# objects for building the shared object library
|
||||
SHLIB_OBJS=mod_php4.so-o
|
||||
SHLIB_OBJS_LIB=libmodphp4-so.a
|
||||
|
||||
# the general targets
|
||||
all: lib
|
||||
lib: $(LIB)
|
||||
|
||||
# build the static library by merging the object files
|
||||
libphp4.a: $(OBJS) $(OBJS_LIB)
|
||||
cp $(OBJS_LIB) $@
|
||||
ar r $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
# ugly hack to support older Apache-1.3 betas that don't set $LIBEXT
|
||||
libphp4.: $(OBJS) $(OBJS_LIB)
|
||||
cp $(OBJS_LIB) $@
|
||||
ar r $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
cp libphp4. libphp4.a
|
||||
|
||||
# build the shared object library by linking the object files
|
||||
libphp4.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
|
||||
rm -f $@
|
||||
$(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS)
|
||||
|
||||
# 1. extension .o for shared objects cannot be used here because
|
||||
# first these files aren't still shared objects and second we
|
||||
# have to use a different name to trigger the different
|
||||
# implicit Make rule
|
||||
# 2. extension -so.o (as used elsewhere) cannot be used because
|
||||
# the suffix feature of Make really wants just .x, so we use
|
||||
# extension .so-o
|
||||
.SUFFIXES: .o .so-o
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
|
||||
.c.so-o:
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $(SPACER) $< && mv $*.o $*.so-o
|
||||
|
||||
# cleanup
|
||||
clean:
|
||||
-rm -f $(OBJS) $(SHLIB_OBJS) $(LIB)
|
||||
|
||||
# We really don't expect end users to use this rule. It works only with
|
||||
# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
|
||||
# using it.
|
||||
depend:
|
||||
cp Makefile.tmpl Makefile.tmpl.bak \
|
||||
&& sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
|
||||
&& gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
|
||||
&& sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' Makefile.new \
|
||||
> Makefile.tmpl \
|
||||
&& rm Makefile.new
|
||||
|
||||
#Dependencies
|
||||
|
||||
$(OBJS): Makefile
|
||||
|
||||
# DO NOT REMOVE
|
||||
mod_php4.o: mod_php4.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
|
||||
$(INCDIR)/alloc.h $(INCDIR)/buff.h \
|
||||
$(INCDIR)/http_config.h \
|
||||
$(INCDIR)/http_core.h $(INCDIR)/http_main.h \
|
||||
$(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
|
||||
$(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php4.h
|
||||
+276
@@ -0,0 +1,276 @@
|
||||
Following is a merge of two letters I sent to php4beta@lists.php.net,
|
||||
describing the changes in API between PHP 3.0 and PHP 4.0 (Zend).
|
||||
This file is by no means thorough documentation of the PHP API,
|
||||
and is intended for developers who are familiar with the PHP 3.0 API,
|
||||
and want to port their code to PHP 4.0, or take advantage of its new
|
||||
features. For highlights about the PHP 3.0 API, consult apidoc.txt.
|
||||
|
||||
Zeev
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
I'm going to try to list the important changes in API and programming
|
||||
techniques that are involved in developing modules for PHP4/Zend, as
|
||||
opposed to PHP3. Listing the whole PHP4 API is way beyond my scope here,
|
||||
it's mostly a 'diff' from the apidoc.txt, which you're all pretty familiar
|
||||
with.
|
||||
An important note that I neglected to mention yesterday - the php4 tree is
|
||||
based on the php 3.0.5 tree, plus all 3.0.6 patches hand-patched into it.
|
||||
Notably, it does NOT include any 3.0.7 patches. All of those have to be
|
||||
reapplied, with extreme care - modules should be safe to patch (mostly),
|
||||
but anything that touches the core or main.c will almost definitely require
|
||||
changes in order to work properly.
|
||||
|
||||
[1] Symbol Tables
|
||||
|
||||
One of the major changes in Zend involves changing the way symbols tables
|
||||
work. Zend enforces reference counting on all values and resources. This
|
||||
required changes in the semantics of the hash tables that implement symbol
|
||||
tables. Instead of storing pval in the hashes, we now store pval *. All
|
||||
of the API functions in Zend were changed in a way that this change is
|
||||
completely transparent. However, if you've used 'low level' hash functions
|
||||
to access or update elements in symbol tables, your code will require
|
||||
changes. Following are two simple examples, one demonstrates the
|
||||
difference between PHP3 and Zend when reading a symbol's value, and the
|
||||
other demonstrates the difference when writing a value.
|
||||
|
||||
php3_read()
|
||||
{
|
||||
pval *foo;
|
||||
|
||||
_php3_hash_find(ht, "foo", sizeof("foo"), &foo);
|
||||
/* foo->type is the type and foo->value is the value */
|
||||
}
|
||||
|
||||
|
||||
php4_read()
|
||||
{
|
||||
pval **foo;
|
||||
|
||||
_php3_hash_find(ht, "foo", sizeof("foo"), &foo);
|
||||
/* (*foo)->type is the type and (*foo)->value is the value */
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
php3_write()
|
||||
{
|
||||
pval newval;
|
||||
|
||||
newval.type = ...;
|
||||
newval.value = ...;
|
||||
_php3_hash_update(ht, "bar", sizeof("bar"), &newval, sizeof(pval), NULL);
|
||||
}
|
||||
|
||||
php4_write()
|
||||
{
|
||||
pval *newval = (pval *) emalloc(sizeof(pval));
|
||||
|
||||
newval->refcount=1;
|
||||
newval->is_ref=0;
|
||||
newval->type = ...;
|
||||
newval->value = ...;
|
||||
_php3_hash_update(ht, "bar", sizeof("bar"), &newval, sizeof(pval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
[2] Resources
|
||||
|
||||
One of the 'cute' things about the reference counting support is that it
|
||||
completely eliminates the problem of resource leaking. A simple loop that
|
||||
included '$result = mysql_query(...)' in PHP leaked unless the user
|
||||
remembered to run mysql_free($result) at the end of the loop body, and
|
||||
nobody really did. In order to take advantage of the automatic resource
|
||||
deallocation upon destruction, there's virtually one small change you need
|
||||
to conduct. Change the result type of a resource that you want to destroy
|
||||
itself as soon as its no longer referenced (just about any resource I can
|
||||
think of) as IS_RESOURCE, instead of as IS_LONG. The rest is magic.
|
||||
|
||||
A special treatment is required for SQL modules that follow MySQL's
|
||||
approach for having the link handle as an optional argument. Modules that
|
||||
follow the MySQL module model, store the last opened link in a global
|
||||
variable, that they use in case the user neglects to explicitly specify a
|
||||
link handle. Due to the way referenec counting works, this global
|
||||
reference is just like any other reference, and must increase that SQL link
|
||||
resource's reference count (otherwise, it will be closed prematurely).
|
||||
Simply, when you set the default link to a certain link, increase that
|
||||
link's reference count by calling zend_list_addref().
|
||||
As always, the MySQL module is the one used to demonstrate 'new
|
||||
technology'. You can look around it and look for IS_RESOURCE, as well as
|
||||
zend_list_addref(), to see a clear example of how the new API should be used.
|
||||
|
||||
|
||||
[3] Thread safety issues
|
||||
|
||||
I'm not going to say that Zend was designed with thread safety in mind, but
|
||||
from some point, we've decided upon several guidelines that would make the
|
||||
move to thread safety much, much easier. Generally, we've followed the PHP
|
||||
3.1 approach of moving global variables to a structure, and encapsulating
|
||||
all global variable references within macros. There are three main
|
||||
differences:
|
||||
1. We grouped related globals in a single structure, instead of grouping
|
||||
all globals in one structure.
|
||||
2. We've used much, much shorter macro names to increase the readability
|
||||
of the source code.
|
||||
3. Regardless of whether we're compiling in thread safe mode or not, all
|
||||
global variables are *always* stored in a structure. For example, you
|
||||
would never have a global variable 'foo', instead, it'll be a property of a
|
||||
global structure, for example, compiler_globals.foo. That makes
|
||||
development much, much easier, since your code will simply not compile
|
||||
unless you remember to put the necessary macro around foo.
|
||||
|
||||
To write code that'll be thread safe in the future (when we release our
|
||||
thread safe memory manager and work on integrating it), you can take a look
|
||||
at zend_globals.h. Essentially, two sets of macros are defined, one for
|
||||
thread safe mode, and one for thread unsafe mode. All global references
|
||||
are encapsulated within ???G(varname), where ??? is the appropriate prefix
|
||||
for your structure (for example, so far we have CG(), EG() and AG(), which
|
||||
stand for the compiler, executor and memory allocator, respectively).
|
||||
When compiling with thread safety enabled, each function that makes use of
|
||||
a ???G() macro, must obtain the pointer to its copy of the structure. It
|
||||
can do so in one of two forms:
|
||||
1. It can receive it as an argument.
|
||||
2. It can fetch it.
|
||||
|
||||
Obviously, the first method is preferable since it's much quicker.
|
||||
However, it's not always possible to send the structure all the way to a
|
||||
particular function, or it may simply bloat the code too much in some
|
||||
cases. Functions that receive the globals as an argument, should look like
|
||||
this:
|
||||
|
||||
rettype functioname(???LS_D) <-- a function with no arguments
|
||||
rettype functioname(type arg1, ..., type argn ???LS_DC) <-- a funciton with
|
||||
arguments
|
||||
|
||||
Calls to such functions should look like this:
|
||||
functionname(???LS_C) <-- a function with no arguments
|
||||
functionname(arg1, ..., argn ???LS_CC) <-- a function with arguments
|
||||
|
||||
LS stands for 'Local Storage', _C stands for Call and _CC stands for Call
|
||||
Comma, _D stands for Declaration and _DC stands for Declaration Comma.
|
||||
Note that there's NO comma between the last argument and ???LS_DC or ???LS_CC.
|
||||
|
||||
In general, every module that makes use of globals should use this approach
|
||||
if it plans to be thread safe.
|
||||
|
||||
|
||||
[4] Generalized INI support
|
||||
|
||||
The code comes to solve several issues:
|
||||
|
||||
a. The ugly long block of code in main.c that reads values from the
|
||||
cfg_hash into php3_ini.
|
||||
b. Get rid of php3_ini. The performance penalty of copying it around all
|
||||
the time in the Apache module probably wasn't too high, but
|
||||
psychologically, it annoyed me :)
|
||||
c. Get rid of the ugly code in mod_php4.c, that also reads values from
|
||||
Apache directives and puts them into the php3_ini structure.
|
||||
d. Generalize all the code so that you only have to add an entry in one
|
||||
single place and get it automatically supported in php3.ini, Apache, Win32
|
||||
registry, runtime function ini_get() and ini_alter() and any future method
|
||||
we might have.
|
||||
e. Allow users to easily override *ANY* php3.ini value, except for ones
|
||||
they're not supposed to, of course.
|
||||
|
||||
I'm happy to say that I think I pretty much reached all goals. php_ini.c
|
||||
implements a mechanism that lets you add your INI entry in a single place,
|
||||
with a default value in case there's no php3.ini value. What you get by
|
||||
using this mechanism:
|
||||
|
||||
1. Automatic initialization from php3.ini if available, or from the
|
||||
default value if not.
|
||||
2. Automatic support in ini_alter(). That means a user can change the
|
||||
value for this INI entry at runtime, without you having to add in a single
|
||||
line of code, and definitely no additional function (for example, in PHP3,
|
||||
we had to add in special dedicated functions, like
|
||||
set_magic_quotes_runtime() or the likes - no need for that anymore).
|
||||
3. Automatic support in Apache .conf files.
|
||||
4. No need for a global php3_ini-like variable that'll store all that
|
||||
info. You can directly access each INI entry by name, in runtime. 'Sure,
|
||||
that's not revolutionary, it's just slow' is probably what some of you
|
||||
think - which is true, but, you can also register a callback function that
|
||||
is called each time your INI entry is changed, if you wish to store it in a
|
||||
cached location for intensive use.
|
||||
5. Ability to access the current active value for a given INI entry, and
|
||||
the 'master' value.
|
||||
|
||||
Of course, (2) and (3) are only applicable in some cases. Some entries
|
||||
shouldn't be overriden by users in runtime or through Apache .conf files -
|
||||
you can, of course, mark them as such.
|
||||
|
||||
|
||||
So, enough hype, how does it work.
|
||||
|
||||
Essentially:
|
||||
|
||||
static PHP_INI_MH(OnChangeBar); /* declare a message handler for a change
|
||||
in "bar" */
|
||||
|
||||
PHP_INI_BEGIN()
|
||||
PHP_INI_ENTRY("foo", "1", PHP_INI_ALL, NULL, NULL)
|
||||
PHP_INI_ENTRY("bar", "bah", PHP_INI_SYSTEM, OnChangeBar, NULL)
|
||||
PHP_INI_END()
|
||||
|
||||
static PHP_INI_MH(OnChangeBar)
|
||||
{
|
||||
a_global_var_for_bar = new_value;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
int whatever_minit(INIT_FUNC_ARGS)
|
||||
{
|
||||
...
|
||||
REGISTER_INI_ENTRIES();
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
int whatever_mshutdown(SHUTDOWN_FUNC_ARGS)
|
||||
{
|
||||
...
|
||||
UNREGISTER_INI_ENTRIES();
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
and that's it. Here's what it does. As you can probably guess, this code
|
||||
registers two INI entries - "foo" and "bar". They're given defaults "1"
|
||||
and "bah" respectively - note that all defaults are always given as
|
||||
strings. That doesn't reduce your ability to use integer values, simply
|
||||
specify them as strings. "foo" is marked so that it can be changed by
|
||||
anyone at any time (PHP_INI_ALL), whereas "foo" is marked so it can be
|
||||
changed only at startup in the php3.ini only, presumably, by the system
|
||||
administrator (PHP_INI_SYSTEM).
|
||||
When "foo" changes, no function is called. Access to it is done using the
|
||||
macros INI_INT("foo"), INI_FLT("foo") or INI_STR("foo"), which return a
|
||||
long, double or char * respectively (strings that are returned aren't
|
||||
duplicated - if they're manipulated, you must duplicate them first). You
|
||||
can also access the original value (the 'master' value, in case one of them
|
||||
was overriden by a user) using another pair of macros:
|
||||
INI_ORIG_INT("foo"), INI_ORIG_FLT("foo") and INI_ORIG_STR("foo").
|
||||
|
||||
When "bar" changes, a special message handler is called, OnBarChange().
|
||||
Always declare those message handlers using PHP_INI_MH(), as they might
|
||||
change in the future. Message handlers are called as soon as an ini entry
|
||||
initializes or changes, and allow you to cache a certain INI value in a
|
||||
quick C structure. In this example, whenever "bar" changes, the new value
|
||||
is stored in a_global_var_for_bar, which is a global char * pointer,
|
||||
quickly accessible from other functions. Things get a bit more complicated
|
||||
when you want to implement a thread-safe module, but it's doable as well.
|
||||
Message handlers may return SUCCESS to acknowledge the new value, or
|
||||
FAILURE to reject it. That enables you to reject invalid values for some
|
||||
INI entries if you want. Finally, you can have a pointer passed to your
|
||||
message handler - that's the fifth argument to PHP_INI_ENTRY(). It is
|
||||
passed as mh_arg to the message handler.
|
||||
|
||||
Remember that for certain values, there's really no reason to mess with a
|
||||
callback function. A perfect example for this are the syntax highlight
|
||||
colors, which no longer have a dedicated global C slot that stores them,
|
||||
but instead, are fetched from the php_ini hash on demand.
|
||||
|
||||
"As always", for a perfect working example of this mechanism, consult
|
||||
functions/mysql.c. This module uses the new INI entry mechanism, and was
|
||||
also converted to be thread safe in general, and in its php_ini support in
|
||||
particular. Converting your modules to look like this for thread safety
|
||||
isn't a bad idea (not necessarily now, but in the long run).
|
||||
|
||||
+492
@@ -0,0 +1,492 @@
|
||||
PHP Version 3.0 API Documentation
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
1. Function Prototype
|
||||
2. Function Arguments
|
||||
3. Variable number of function arguments
|
||||
4. Using the function arguments
|
||||
5. Memory management in functions
|
||||
6. Setting variables in the symbol table
|
||||
7. Returning values from functions
|
||||
8. Returning 'complex' values from functions (arrays or objects)
|
||||
9. Using the resource list
|
||||
10. Using the persistent resource table
|
||||
11. Adding runtime configuration directives
|
||||
-----------------
|
||||
|
||||
1. Function Prototype
|
||||
|
||||
All functions look like this:
|
||||
|
||||
PHP_FUNCTION(foo) {
|
||||
|
||||
}
|
||||
|
||||
Even if your function doesn't take any arguments, this is how it is
|
||||
called.
|
||||
|
||||
-----------------
|
||||
|
||||
2. Function Arguments
|
||||
|
||||
Arguments are always of type pval. This type contains a union which
|
||||
has the actual type of the argument. So, if your function takes two
|
||||
arguments, you would do something like the following at the top of your
|
||||
function:
|
||||
|
||||
pval *arg1, *arg2;
|
||||
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&arg1,&arg2)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
NOTE: Arguments can be passed either by value or by reference. In both
|
||||
cases you will need to pass &(pval *) to getParameters. If you want to
|
||||
check if the n'th parameter was sent to you by reference or not, you can
|
||||
use the function, ParameterPassedByReference(ht,n). It will return either
|
||||
1 or 0.
|
||||
|
||||
When you change any of the passed parameters, whether they are sent by
|
||||
reference or by value, you can either start over with the parameter by
|
||||
calling pval_destructor on it, or if it's an ARRAY you want to add to,
|
||||
you can use functions similar to the ones in internal_functions.h which
|
||||
manipulate return_value as an ARRAY.
|
||||
|
||||
Also if you change a parameter to IS_STRING make sure you first assign
|
||||
the new estrdup'ed string and the string length, and only later change the
|
||||
type to IS_STRING. If you change the string of a parameter which already
|
||||
IS_STRING or IS_ARRAY you should run pval_destructor on it first.
|
||||
|
||||
-----------------
|
||||
|
||||
3. Variable number of function arguments
|
||||
|
||||
A function can take a variable number of arguments. If your function can
|
||||
take either 2 or 3 arguments, use the following:
|
||||
|
||||
pval *arg1, *arg2, *arg3;
|
||||
int arg_count = ARG_COUNT(ht);
|
||||
|
||||
if (arg_count<2 || arg_count>3 ||
|
||||
getParameters(ht,arg_count,&arg1,&arg2,&arg3)==FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
------------------
|
||||
|
||||
4. Using the function arguments
|
||||
|
||||
The type of each argument is stored in the pval type field:
|
||||
|
||||
|
||||
This type can be any of the following:
|
||||
|
||||
IS_STRING String
|
||||
IS_DOUBLE Double-precision floating point
|
||||
IS_LONG Long
|
||||
IS_ARRAY Array
|
||||
|
||||
IS_EMPTY ??
|
||||
IS_USER_FUNCTION ??
|
||||
IS_INTERNAL_FUNCTION ?? (if some of these cannot be passed to a
|
||||
function - delete)
|
||||
IS_CLASS ??
|
||||
IS_OBJECT ??
|
||||
|
||||
If you get an argument of one type and would like to use it as another,
|
||||
or if you just want to force the argument to be of a certain type, you
|
||||
can use one of the following conversion functions:
|
||||
|
||||
convert_to_long(arg1);
|
||||
convert_to_double(arg1);
|
||||
convert_to_string(arg1);
|
||||
convert_to_boolean_long(arg1); If the string is "" or "0" it
|
||||
becomes 0, 1 otherwise
|
||||
convert_string_to_number(arg1); Converts string to either LONG or
|
||||
DOUBLE depending on string
|
||||
|
||||
These function all do in-place conversion. They do not return anything.
|
||||
|
||||
The actual argument is stored in a union.
|
||||
|
||||
For type IS_STRING, use arg1->value.str.val
|
||||
IS_LONG arg1->value.lval
|
||||
IS_DOUBLE arg1->value.dval
|
||||
|
||||
-------------------
|
||||
|
||||
5. Memory management in functions
|
||||
|
||||
Any memory needed by a function should be allocated with either emalloc()
|
||||
or estrdup(). These are memory handling abstraction functions that look
|
||||
and smell like the normal malloc() and strdup() functions. Memory should
|
||||
be freed with efree().
|
||||
|
||||
There are two kinds of memory in this program. Memory which is returned
|
||||
to the parser in a variable and memory which you need for temporary
|
||||
storage in your internal function. When you assign a string to a
|
||||
variable which is returned to the parser you need to make sure you first
|
||||
allocate the memory with either emalloc or estrdup. This memory
|
||||
should NEVER be freed by you, unless you later, in the same function
|
||||
overwrite your original assignment (this kind of programming practice is
|
||||
not good though).
|
||||
|
||||
For any temporary/permanent memory you need in your functions/library you
|
||||
should use the three emalloc(), estrdup(), and efree() functions. They
|
||||
behave EXACTLY like their counterpart functions. Anything you emalloc()
|
||||
or estrdup() you have to efree() at some point or another, unless it's
|
||||
supposed to stick around until the end of the program, otherwise there
|
||||
will be a memory leak. The meaning of "the functions behave exactly like
|
||||
their counterparts" is if you efree() something which was not
|
||||
emalloc()'ed nor estrdup()'ed you might get a segmentation fault. So
|
||||
please take care and free all of your wasted memory. One of the biggest
|
||||
improvements in PHP 3.0 will hopefully be the memory management.
|
||||
|
||||
If you compile with "-DDEBUG", PHP3 will print out a list of all
|
||||
memory that was allocated using emalloc() and estrdup() but never
|
||||
freed with efree() when it is done running the specified script.
|
||||
|
||||
-------------------
|
||||
|
||||
6. Setting variables in the symbol table
|
||||
|
||||
A number of macros are available which make it easier to set a variable
|
||||
in the symbol table:
|
||||
|
||||
SET_VAR_STRING(name,value) **
|
||||
SET_VAR_DOUBLE(name,value)
|
||||
SET_VAR_LONG(name,value)
|
||||
|
||||
** Be careful here. The value part must be malloc'ed manually because
|
||||
the memory management code will try to free this pointer later. Do
|
||||
not pass statically allocated memory into a SET_VAR_STRING
|
||||
|
||||
Symbol tables in PHP 3.0 are implemented as hash tables. At any given time,
|
||||
&symbol_table is a pointer to the 'main' symbol table, and active_symbol_table
|
||||
points to the currently active symbol table (these may be identical like in
|
||||
startup, or different, if you're inside a function).
|
||||
|
||||
The following examples use 'active_symbol_table'. You should replace it with
|
||||
&symbol_table if you specifically want to work with the 'main' symbol table.
|
||||
Also, the same funcions may be applied to arrays, as explained below.
|
||||
|
||||
* To check whether a variable named $foo already exists in a symbol table:
|
||||
if (hash_exists(active_symbol_table,"foo",sizeof("foo"))) { exists... }
|
||||
else { doesn't exist }
|
||||
|
||||
* If you also need to get the type of the variable, you can use:
|
||||
hash_find(active_symbol_table,"foo",sizeof("foo"),&pvalue);
|
||||
check(pvalue.type);
|
||||
|
||||
Arrays in PHP 3.0 are implemented using the same hashtables as symbol tables.
|
||||
This means the two above functions can also be used to check variables
|
||||
inside arrays.
|
||||
|
||||
If you want to define a new array in a symbol table, you should do this:
|
||||
|
||||
1. Possibly check it exists and abort, using hash_exists()
|
||||
or hash_find().
|
||||
2. Code:
|
||||
|
||||
pval arr;
|
||||
|
||||
if (array_init(&arr) == FAILURE) { failed... };
|
||||
hash_update(active_symbol_table,"foo",sizeof("foo"),&arr,sizeof(pval),NULL);
|
||||
|
||||
This code declares a new array, named $foo, in the active symbol table.
|
||||
This array is empty.
|
||||
|
||||
Here's how to add new entries to it:
|
||||
|
||||
pval entry;
|
||||
|
||||
entry.type = IS_LONG;
|
||||
entry.value.lval = 5;
|
||||
|
||||
hash_update(arr.value.ht,"bar",sizeof("bar"),&entry,sizeof(pval),NULL); /* defines $foo["bar"] = 5 */
|
||||
hash_index_update(arr.value.ht,7,&entry,sizeof(pval),NULL); /* defines $foo[7] = 5 */
|
||||
hash_next_index_insert(arr.value.ht,&entry,sizeof(pval),NULL); /* defines the next free place in $foo[],
|
||||
* $foo[8], to be 5 (works like php2)
|
||||
*/
|
||||
|
||||
If you'd like to modify a value that you inserted to a hash, you must first retreive it from the hash. To
|
||||
prevent that overhead, you can supply a pval ** to the hash add function, and it'll be updated with the
|
||||
pval * address of the inserted element inside the hash. If that value is NULL (like in all of the
|
||||
above examples) - that parameter is ignored.
|
||||
|
||||
hash_next_index_insert() works more or less using the same logic
|
||||
"$foo[] = bar;" works in PHP 2.0.
|
||||
|
||||
If you are building an array to return from a function, you can initialize
|
||||
the array just like above by doing:
|
||||
|
||||
if (array_init(return_value) == FAILURE) { failed...; }
|
||||
|
||||
and then adding values with the helper functions:
|
||||
|
||||
add_next_index_long(return_value,long_value);
|
||||
add_next_index_double(return_value,double_value);
|
||||
add_next_index_string(return_value,estrdup(string_value));
|
||||
|
||||
Of course, if the adding isn't done right after the array
|
||||
initialization, you'd probably have to look for the array first:
|
||||
|
||||
pval *arr;
|
||||
|
||||
if (hash_find(active_symbol_table,"foo",sizeof("foo"),(void **)&arr)==FAILURE) { can't find... }
|
||||
else { use arr->value.ht... }
|
||||
|
||||
Note that hash_find receives a pointer to a pval pointer, and
|
||||
not a pval pointer.
|
||||
|
||||
Just about any hash function returns SUCCESS or FAILURE (except for
|
||||
hash_exists() that returns a boolean truth value).
|
||||
|
||||
-------------------
|
||||
|
||||
7. Returning 'simple' values from functions (integers, floats or strings)
|
||||
|
||||
A number of macros are available to make it easier to return things from
|
||||
functions:
|
||||
|
||||
These set the return value and return from the function:
|
||||
|
||||
RETURN_FALSE
|
||||
RETURN_TRUE
|
||||
RETURN_LONG(l)
|
||||
RETURN_STRING(s,dup) If dup is true, duplicates the string
|
||||
RETURN_STRINGL(s,l,dup) Return string (s) specifying length (l).
|
||||
RETURN_DOUBLE(d)
|
||||
|
||||
These only set the return value:
|
||||
|
||||
RETVAL_FALSE
|
||||
RETVAL_TRUE
|
||||
RETVAL_LONG(l)
|
||||
RETVAL_STRING(s,dup) If dup is true, duplicates the string
|
||||
RETVAL_STRINGL(s,l,dup) Return string (s) specifying length (l).
|
||||
RETVAL_DOUBLE(d)
|
||||
|
||||
The string macros above will all estrdup() the passed 's' argument,
|
||||
so you can safely free the argument after calling the macro, or
|
||||
alternatively use statically allocated memory.
|
||||
|
||||
If your function returns boolean success/error responses, always use
|
||||
RETURN_TRUE and RETURN_FALSE respectively.
|
||||
|
||||
-------------------
|
||||
|
||||
8. Returning 'complex' values from functions (arrays or objects)
|
||||
|
||||
Your function can also return a complex data type such as an object
|
||||
or an array.
|
||||
|
||||
Returning an object:
|
||||
|
||||
1. Call object_init(return_value).
|
||||
2. Fill it up with values:
|
||||
|
||||
add_property_long(return_value,property_name,l) Add a property named 'property_name', of type long, equals to 'l'
|
||||
add_property_double(return_value,property_name,d) Same, only a double
|
||||
add_property_string(return_value,property_name,str) Same, only a string
|
||||
add_property_stringl(return_value,property_name,str,l) Add a property named 'property_name', of type string, string is 'str' with length 'l'
|
||||
|
||||
3. Possibly, register functions for this object. In order to
|
||||
obtain values from the object, the function would have to fetch
|
||||
"this" from the active_symbol_table. Its type should be IS_OBJECT,
|
||||
and it's basically a regular hash table (i.e., you can use regular
|
||||
hash functions on .value.ht). The actual registration of the
|
||||
function can be done using:
|
||||
|
||||
add_method(return_value,function_name,function_ptr)
|
||||
|
||||
|
||||
Returning an array:
|
||||
|
||||
1. Call array_init(return_value).
|
||||
2. Fill it up with values:
|
||||
|
||||
add_assoc_long(return_value,key,l) add associative entry with key 'key' and long value 'l'
|
||||
add_assoc_double(return_value,key,d)
|
||||
add_assoc_string(return_value,key,str)
|
||||
add_assoc_stringl(return_value,key,str,length) specify the string length
|
||||
|
||||
add_index_long(return_value,index,l) add entry in index 'index' with long value 'l'
|
||||
add_index_double(return_value,index,d)
|
||||
add_index_string(return_value,index,str)
|
||||
add_index_stringl(return_value,index,str,length) specify the string length
|
||||
|
||||
add_next_index_long(return_value,l) add an array entry in the next free offset with long value 'l'
|
||||
add_next_index_double(return_value,d)
|
||||
add_next_index_string(return_value,str)
|
||||
add_next_index_stringl(return_value,str,length) specify the string length
|
||||
|
||||
-------------------
|
||||
|
||||
9. Using the resource list
|
||||
|
||||
PHP 3.0 has a standard way of dealing with various types of resources,
|
||||
that replaces all of the local linked lists in PHP 2.0.
|
||||
|
||||
Available functions:
|
||||
|
||||
php3_list_insert(ptr, type) returns the 'id' of the newly inserted resource
|
||||
php3_list_delete(id) delete the resource with the specified id
|
||||
php3_list_find(id,*type) returns the pointer of the resource with the specified id, updates 'type' to the resource's type
|
||||
|
||||
Typically, these functions are used for SQL drivers but they can be
|
||||
used for anything else, and are used, for instance, for maintaining
|
||||
file descriptors.
|
||||
|
||||
Typical list code would look like this:
|
||||
|
||||
Adding a new resource:
|
||||
|
||||
RESOURCE *resource;
|
||||
|
||||
...allocate memory for resource and acquire resource...
|
||||
/* add a new resource to the list */
|
||||
return_value->value.lval = php3_list_insert((void *) resource, LE_RESOURCE_TYPE);
|
||||
return_value->type = IS_LONG;
|
||||
|
||||
Using an existing resource:
|
||||
|
||||
pval *resource_id;
|
||||
RESOURCE *resource;
|
||||
int type;
|
||||
|
||||
convert_to_long(resource_id);
|
||||
resource = php3_list_find(resource_id->value.lval, &type);
|
||||
if (type != LE_RESOURCE_TYPE) {
|
||||
php3_error(E_WARNING,"resource index %d has the wrong type",resource_id->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
...use resource...
|
||||
|
||||
Deleting an existing resource:
|
||||
|
||||
pval *resource_id;
|
||||
RESOURCE *resource;
|
||||
int type;
|
||||
|
||||
convert_to_long(resource_id);
|
||||
php3_list_delete(resource_id->value.lval);
|
||||
|
||||
|
||||
The resource types should be registered in php3_list.h, in enum
|
||||
list_entry_type. In addition, one should add shutdown code for any
|
||||
new resource type defined, in list.c's list_entry_destructor() (even if
|
||||
you don't have anything to do on shutdown, you must add an empty case).
|
||||
|
||||
-------------------
|
||||
|
||||
10. Using the persistent resource table
|
||||
|
||||
PHP 3.0 has a standard way of storing persistent resources (i.e.,
|
||||
resources that are kept in between hits). The first module to use
|
||||
this feature was the MySQL module, and mSQL followed it, so one can
|
||||
get the general impression of how a persistent resource should be
|
||||
used by reading mysql.c. The functions you should look at are:
|
||||
php3_mysql_do_connect()
|
||||
php3_mysql_connect()
|
||||
php3_mysql_pconnect()
|
||||
|
||||
The general idea of persistence modules is this:
|
||||
1. Code all of your module to work with the regular resource list
|
||||
mentioned in section (9).
|
||||
2. Code extra connect functions that check if the resource already
|
||||
exists in the persistent resource list. If it does, register it
|
||||
as in the regular resource list as a pointer to the persistent
|
||||
resource list (because of 1., the rest of the code
|
||||
should work immediately). If it doesn't, then create it, add it
|
||||
to the persistent resource list AND add a pointer to it from the
|
||||
regular resource list, so all of the code would work since it's
|
||||
in the regular resource list, but on the next connect, the
|
||||
resource would be found in the persistent resource list and be
|
||||
used without having to recreate it.
|
||||
You should register these resources with a different type (e.g.
|
||||
LE_MYSQL_LINK for non-persistent link and LE_MYSQL_PLINK for
|
||||
a persistent link).
|
||||
|
||||
If you read mysql.c, you'll notice that except for the more complex
|
||||
connect function, nothing in the rest of the module has to be changed.
|
||||
|
||||
The very same interface exists for the regular resource list and the
|
||||
persistent resource list, only 'list' is replaced with 'plist':
|
||||
|
||||
php3_plist_insert(ptr, type) returns the 'id' of the newly inserted resource
|
||||
php3_plist_delete(id) delete the resource with the specified id
|
||||
php3_plist_find(id,*type) returns the pointer of the resource with the specified id, updates 'type' to the resource's type
|
||||
|
||||
However, it's more than likely that these functions would prove
|
||||
to be useless for you when trying to implement a persistent module.
|
||||
Typically, one would want to use the fact that the persistent resource
|
||||
list is really a hash table. For instance, in the MySQL/mSQL modules,
|
||||
when there's a pconnect() call (persistent connect), the function
|
||||
builds a string out of the host/user/passwd that were passed to the
|
||||
function, and hashes the SQL link with this string as a key. The next
|
||||
time someone calls a pconnect() with the same host/user/passwd, the
|
||||
same key would be generated, and the function would find the SQL link
|
||||
in the persistent list.
|
||||
|
||||
Until further documented, you should look at mysql.c or msql.c to
|
||||
see how one should use the plist's hash table abilities.
|
||||
|
||||
One important thing to note: resources going into the persistent
|
||||
resource list must *NOT* be allocated with PHP's memory manager, i.e.,
|
||||
they should NOT be created with emalloc(), estrdup(), etc. Rather,
|
||||
one should use the regular malloc(), strdup(), etc. The reason for
|
||||
this is simple - at the end of the request (end of the hit), every
|
||||
memory chunk that was allocated using PHP's memory manager is deleted.
|
||||
Since the persistent list isn't supposed to be erased at the end
|
||||
of a request, one mustn't use PHP's memory manager for allocating
|
||||
resources that go to it.
|
||||
|
||||
Shutting down persistent resources:
|
||||
|
||||
When you register resource that's going to be in the persistent list,
|
||||
you should add destructors to it both in the non-persistent list
|
||||
and in the persistent list.
|
||||
The destructor in the non-persistent list destructor shouldn't do anything.
|
||||
The one in the persistent list destructor should properly free any
|
||||
resources obtained by that type (e.g. memory, SQL links, etc). Just like
|
||||
with the non-persistent resources, you *MUST* add destructors for every
|
||||
resource, even it requires no destructotion and the destructor would
|
||||
be empty.
|
||||
Remember, since emalloc() and friends aren't to be used in conjunction
|
||||
with the persistent list, you mustn't use efree() here either.
|
||||
|
||||
-------------------
|
||||
|
||||
11. Adding runtime configuration directives
|
||||
|
||||
Many of the features of PHP3 can be configured at runtime. These
|
||||
configuration directives can appear in either the designated php3.ini
|
||||
file, or in the case of the Apache module version in the Apache .conf
|
||||
files. The advantage of having them in the Apache .conf files is that
|
||||
they can be configured on a per-directory basis. This means that one
|
||||
directory may have a certain safemodeexecdir for example, while another
|
||||
directory may have another. This configuration granularity is especially
|
||||
handy when a server supports multiple virtual hosts.
|
||||
|
||||
The steps required to add a new directive:
|
||||
|
||||
1. Add directive to php3_ini_structure struct in mod_php4.h.
|
||||
|
||||
2. In main.c, edit the php3_module_startup function and add the
|
||||
appropriate cfg_get_string() or cfg_get_long() call.
|
||||
|
||||
3. Add the directive, restrictions and a comment to the php3_commands
|
||||
structure in mod_php4.c. Note the restrictions part. RSRC_CONF are
|
||||
directives that can only be present in the actual Apache .conf files.
|
||||
Any OR_OPTIONS directives can be present anywhere, include normal
|
||||
.htaccess files.
|
||||
|
||||
4. In either php3take1handler() or php3flaghandler() add the appropriate
|
||||
entry for your directive.
|
||||
|
||||
5. In the configuration section of the _php3_info() function in
|
||||
functions/info.c you need to add your new directive.
|
||||
|
||||
6. And last, you of course have to use your new directive somewhere.
|
||||
It will be addressable as php3_ini.directive
|
||||
@@ -0,0 +1,92 @@
|
||||
/* -*- C -*-
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
| |
|
||||
| You should have received a copy of both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Stig Sæther Bakken <ssb@guardian.no> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#define PHP_ADA_INCLUDE ""
|
||||
#define PHP_ADA_LFLAGS ""
|
||||
#define PHP_ADA_LIBS ""
|
||||
#define PHP_APACHE_INCLUDE ""
|
||||
#define PHP_APACHE_TARGET ""
|
||||
#define PHP_FHTTPD_INCLUDE ""
|
||||
#define PHP_FHTTPD_LIB ""
|
||||
#define PHP_FHTTPD_TARGET ""
|
||||
#define PHP_BINNAME "@BINNAME@"
|
||||
#define PHP_CFLAGS "@CFLAGS@"
|
||||
#define PHP_DBASE_LIB ""
|
||||
#define PHP_DEBUG "@DEBUG_CFLAGS@"
|
||||
#define PHP_GDBM_INCLUDE ""
|
||||
#define PHP_HSREGEX ""
|
||||
#define PHP_IBASE_INCLUDE ""
|
||||
#define PHP_IBASE_LFLAGS ""
|
||||
#define PHP_IBASE_LIBS ""
|
||||
#define PHP_IFX_INCLUDE ""
|
||||
#define PHP_IFX_LFLAGS ""
|
||||
#define PHP_IFX_LIBS ""
|
||||
#define PHP_INSTALL_IT "@INSTALL_IT@"
|
||||
#define PHP_IODBC_INCLUDE ""
|
||||
#define PHP_IODBC_LFLAGS ""
|
||||
#define PHP_IODBC_LIBS ""
|
||||
#define PHP_MSQL_INCLUDE ""
|
||||
#define PHP_MSQL_LFLAGS ""
|
||||
#define PHP_MSQL_LIBS ""
|
||||
#define PHP_MYSQL_INCLUDE ""
|
||||
#define PHP_MYSQL_LFLAGS ""
|
||||
#define PHP_MYSQL_LIBS ""
|
||||
#define PHP_ORACLE_HOME ""
|
||||
#define PHP_ORACLE_INCLUDE ""
|
||||
#define PHP_ORACLE_LFLAGS ""
|
||||
#define PHP_ORACLE_LIBS ""
|
||||
#define PHP_ORACLE_SHLIBS ""
|
||||
#define PHP_ORACLE_STLIBS ""
|
||||
#define PHP_ORACLE_VERSION ""
|
||||
#define PHP_PGSQL_INCLUDE ""
|
||||
#define PHP_PGSQL_LFLAGS ""
|
||||
#define PHP_PGSQL_LIBS ""
|
||||
#define PHP_PROG_SENDMAIL "@PROG_SENDMAIL@"
|
||||
#define PHP_REGEX_LIB ""
|
||||
#define PHP_SOLID_INCLUDE ""
|
||||
#define PHP_SOLID_LIBS ""
|
||||
#define PHP_EMPRESS_INCLUDE ""
|
||||
#define PHP_EMPRESS_LIBS ""
|
||||
#define PHP_SYBASE_INCLUDE ""
|
||||
#define PHP_SYBASE_LFLAGS ""
|
||||
#define PHP_SYBASE_LIBS ""
|
||||
#define PHP_DBM_TYPE ""
|
||||
#define PHP_DBM_LIB ""
|
||||
#define PHP_LDAP_LFLAGS ""
|
||||
#define PHP_LDAP_INCLUDE ""
|
||||
#define PHP_LDAP_LIBS ""
|
||||
#define PHP_VELOCIS_INCLUDE ""
|
||||
#define PHP_VELOCIS_LIBS ""
|
||||
|
||||
#define ODBC_TYPE ""
|
||||
#define ODBC_INCDIR ""
|
||||
#define ODBC_INCLUDE ""
|
||||
#define ODBC_LIBDIR ""
|
||||
#define ODBC_LFLAGS ""
|
||||
#define ODBC_LIBS ""
|
||||
@@ -0,0 +1,134 @@
|
||||
#!/bin/sh
|
||||
|
||||
supplied_flag=$1
|
||||
|
||||
# do some version checking for the tools we use
|
||||
if test "$1" = "--force"; then
|
||||
shift
|
||||
elif test -r buildconf.stamp ; then
|
||||
:
|
||||
else
|
||||
echo "buildconf: checking installation..."
|
||||
|
||||
# autoconf 2.13 or newer
|
||||
ac_version=`autoconf --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
|
||||
if test "$ac_version" = ""; then
|
||||
echo "buildconf: autoconf not found."
|
||||
echo " You need autoconf version 2.13 or newer installed"
|
||||
echo " to build PHP from CVS."
|
||||
exit 1
|
||||
fi
|
||||
IFS=.; set $ac_version; IFS=' '
|
||||
if test "$1" = "2" -a "$2" -lt "13" || test "$1" -lt "2"; then
|
||||
echo "buildconf: autoconf version $ac_version found."
|
||||
echo " You need autoconf version 2.13 or newer installed"
|
||||
echo " to build PHP from CVS."
|
||||
exit 1
|
||||
else
|
||||
echo "buildconf: autoconf version $ac_version (ok)"
|
||||
fi
|
||||
|
||||
# automake 1.4 or newer
|
||||
am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
|
||||
if test "$am_version" = ""; then
|
||||
echo "buildconf: automake not found."
|
||||
echo " You need automake version 1.4 or newer installed"
|
||||
echo " to build PHP from CVS."
|
||||
exit 1
|
||||
fi
|
||||
IFS=.; set $am_version; IFS=' '
|
||||
if test "$1" = "1" -a "$2" -lt "4" || test "$1" -lt "1"; then
|
||||
echo "buildconf: automake version $am_version found."
|
||||
echo " You need automake version 1.4 or newer installed"
|
||||
echo " to build PHP from CVS."
|
||||
exit 1
|
||||
else
|
||||
echo "buildconf: automake version $am_version (ok)"
|
||||
fi
|
||||
|
||||
# libtool 1.2f or newer
|
||||
lt_pversion=`libtool --version 2>/dev/null|sed -e 's/^[^0-9]*//' -e 's/ .*//'`
|
||||
if test "$lt_pversion" = ""; then
|
||||
echo "buildconf: libtool not found."
|
||||
echo " You need libtool version 1.3 or newer installed"
|
||||
echo " to build PHP from CVS."
|
||||
exit 1
|
||||
fi
|
||||
lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
|
||||
IFS=.; set $lt_version; IFS=' '
|
||||
if test "$1" -gt "1" || test "$2" -ge "3" || test "$2" = "2" -a "$3" = "f"
|
||||
then
|
||||
echo "buildconf: libtool version $lt_pversion (ok)"
|
||||
else
|
||||
echo "buildconf: libtool version $lt_pversion found."
|
||||
echo " You need libtool version 1.2f or newer installed"
|
||||
echo " to build PHP from CVS."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
touch buildconf.stamp
|
||||
fi
|
||||
|
||||
if test "$supplied_flag" = "--copy"; then
|
||||
automake_flags=--copy
|
||||
fi
|
||||
|
||||
if test ! -d libzend; then
|
||||
if test -d ../libzend; then
|
||||
echo "buildconf: linking ../libzend to ./libzend"
|
||||
ln -s ../libzend .
|
||||
else
|
||||
echo "buildconf: can not find libzend"
|
||||
echo " libzend should be installed in . or .., how to fetch:"
|
||||
echo ""
|
||||
echo " cvs -d :pserver:cvsread@cvs.zend.com:/repository login"
|
||||
echo " (password \"zend\")"
|
||||
echo " cvs -d :pserver:cvsread@cvs.zend.com:/repository co libzend"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if test ! -d TSRM; then
|
||||
if test -d ../TSRM; then
|
||||
echo "buildconf: linking ../TSRM to ./TSRM"
|
||||
ln -s ../TSRM .
|
||||
else
|
||||
echo "buildconf: can not find TSRM"
|
||||
echo " TSRM should be installed in . or .., how to fetch:"
|
||||
echo ""
|
||||
echo " cvs -d :pserver:cvsread@cvs.zend.com:/repository login"
|
||||
echo " (password \"zend\")"
|
||||
echo " cvs -d :pserver:cvsread@cvs.zend.com:/repository co TSRM"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
./scripts/preconfig
|
||||
|
||||
libtoolize --automake $automake_flags --force
|
||||
|
||||
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 aclocal.m4"
|
||||
mv aclocal.m4.old aclocal.m4
|
||||
else
|
||||
echo "buildconf: created or modified 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 configure"
|
||||
mv configure.old configure
|
||||
else
|
||||
echo "buildconf: created or modified configure"
|
||||
fi
|
||||
|
||||
(cd libzend; ./buildconf libzend/)
|
||||
(cd TSRM; ./buildconf TSRM/)
|
||||
+244
@@ -0,0 +1,244 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on calendar.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=calendar - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to calendar - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "calendar - Win32 Release" && "$(CFG)" != "calendar - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!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 "calendar.mak" CFG="calendar - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "calendar - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "calendar - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "calendar - Win32 Release"
|
||||
|
||||
OUTDIR=.\module_release
|
||||
INTDIR=.\module_release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\module_release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\php3_calendar.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\calendar.obj"
|
||||
-@erase "$(INTDIR)\dow.obj"
|
||||
-@erase "$(INTDIR)\french.obj"
|
||||
-@erase "$(INTDIR)\gregor.obj"
|
||||
-@erase "$(INTDIR)\jewish.obj"
|
||||
-@erase "$(INTDIR)\julian.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\php3_calendar.dll"
|
||||
-@erase "$(OUTDIR)\php3_calendar.exp"
|
||||
-@erase "$(OUTDIR)\php3_calendar.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\calendar.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\calendar.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:1 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_calendar.pdb" /machine:I386 /out:"$(OUTDIR)\php3_calendar.dll" /implib:"$(OUTDIR)\php3_calendar.lib" /libpath:"cgi_release"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\calendar.obj" \
|
||||
"$(INTDIR)\dow.obj" \
|
||||
"$(INTDIR)\french.obj" \
|
||||
"$(INTDIR)\gregor.obj" \
|
||||
"$(INTDIR)\jewish.obj" \
|
||||
"$(INTDIR)\julian.obj"
|
||||
|
||||
"$(OUTDIR)\php3_calendar.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "calendar - Win32 Debug"
|
||||
|
||||
OUTDIR=.\module_debug
|
||||
INTDIR=.\module_debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\module_debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\php3_calendar.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\calendar.obj"
|
||||
-@erase "$(INTDIR)\dow.obj"
|
||||
-@erase "$(INTDIR)\french.obj"
|
||||
-@erase "$(INTDIR)\gregor.obj"
|
||||
-@erase "$(INTDIR)\jewish.obj"
|
||||
-@erase "$(INTDIR)\julian.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\php3_calendar.dll"
|
||||
-@erase "$(OUTDIR)\php3_calendar.exp"
|
||||
-@erase "$(OUTDIR)\php3_calendar.ilk"
|
||||
-@erase "$(OUTDIR)\php3_calendar.lib"
|
||||
-@erase "$(OUTDIR)\php3_calendar.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /D "DEBUG" /D "_DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\calendar.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\calendar.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:1 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_calendar.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_calendar.dll" /implib:"$(OUTDIR)\php3_calendar.lib" /pdbtype:sept /libpath:"cgi_debug"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\calendar.obj" \
|
||||
"$(INTDIR)\dow.obj" \
|
||||
"$(INTDIR)\french.obj" \
|
||||
"$(INTDIR)\gregor.obj" \
|
||||
"$(INTDIR)\jewish.obj" \
|
||||
"$(INTDIR)\julian.obj"
|
||||
|
||||
"$(OUTDIR)\php3_calendar.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("calendar.dep")
|
||||
!INCLUDE "calendar.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "calendar.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "calendar - Win32 Release" || "$(CFG)" == "calendar - Win32 Debug"
|
||||
SOURCE=.\dl\calendar\calendar.c
|
||||
|
||||
"$(INTDIR)\calendar.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dl\calendar\dow.c
|
||||
|
||||
"$(INTDIR)\dow.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dl\calendar\french.c
|
||||
|
||||
"$(INTDIR)\french.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dl\calendar\gregor.c
|
||||
|
||||
"$(INTDIR)\gregor.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dl\calendar\jewish.c
|
||||
|
||||
"$(INTDIR)\jewish.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dl\calendar\julian.c
|
||||
|
||||
"$(INTDIR)\julian.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
+479
@@ -0,0 +1,479 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997, 1998, 1999 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
|
||||
| Stig Bakken <ssb@fast.no> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
#include "php.h"
|
||||
#include "php_globals.h"
|
||||
|
||||
#include "SAPI.h"
|
||||
|
||||
#if CGI_BINARY
|
||||
|
||||
#include <stdio.h>
|
||||
#include "php.h"
|
||||
#ifdef MSVC5
|
||||
#include "win32/time.h"
|
||||
#include "win32/signal.h"
|
||||
#include <process.h>
|
||||
#else
|
||||
#include "build-defs.h"
|
||||
#endif
|
||||
#if HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#if HAVE_SETLOCALE
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#include "zend.h"
|
||||
#include "php_ini.h"
|
||||
#include "php_globals.h"
|
||||
#include "main.h"
|
||||
#include "fopen-wrappers.h"
|
||||
#include "ext/standard/php3_standard.h"
|
||||
#include "snprintf.h"
|
||||
#if WIN32|WINNT
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include "win32/syslog.h"
|
||||
#include "win32/php_registry.h"
|
||||
#else
|
||||
#include <syslog.h>
|
||||
#endif
|
||||
|
||||
#include "zend_compile.h"
|
||||
#include "zend_execute.h"
|
||||
#include "zend_highlight.h"
|
||||
#include "zend_indent.h"
|
||||
|
||||
|
||||
#if USE_SAPI
|
||||
#include "serverapi/sapi.h"
|
||||
void *gLock;
|
||||
#ifndef THREAD_SAFE
|
||||
struct sapi_request_info *sapi_rqst;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MSVC5 || !defined(HAVE_GETOPT)
|
||||
#include "php_getopt.h"
|
||||
#endif
|
||||
|
||||
PHPAPI extern char *php3_ini_path;
|
||||
|
||||
#define PHP_MODE_STANDARD 1
|
||||
#define PHP_MODE_HIGHLIGHT 2
|
||||
#define PHP_MODE_INDENT 3
|
||||
|
||||
PHPAPI extern char *optarg;
|
||||
PHPAPI extern int optind;
|
||||
|
||||
|
||||
static int zend_cgibin_ub_write(const char *str, uint str_length)
|
||||
{
|
||||
return fwrite(str, 1, str_length, stdout);
|
||||
}
|
||||
|
||||
|
||||
static void sapi_cgi_send_header(sapi_header_struct *sapi_header, void *server_context)
|
||||
{
|
||||
if (sapi_header) {
|
||||
PHPWRITE_H(sapi_header->header, sapi_header->header_len);
|
||||
}
|
||||
PHPWRITE_H("\r\n", 2);
|
||||
}
|
||||
|
||||
|
||||
static int sapi_cgi_read_post(char *buffer, uint count_bytes SLS_DC)
|
||||
{
|
||||
uint read_bytes=0, tmp_read_bytes;
|
||||
|
||||
count_bytes = MIN(count_bytes, SG(request_info).content_length-SG(read_post_bytes));
|
||||
while (read_bytes < count_bytes) {
|
||||
tmp_read_bytes = read(0, buffer+read_bytes, count_bytes-read_bytes);
|
||||
if (tmp_read_bytes<=0) {
|
||||
break;
|
||||
}
|
||||
read_bytes += tmp_read_bytes;
|
||||
}
|
||||
return read_bytes;
|
||||
}
|
||||
|
||||
|
||||
static char *sapi_cgi_read_cookies(SLS_D)
|
||||
{
|
||||
return getenv("HTTP_COOKIE");
|
||||
}
|
||||
|
||||
|
||||
static sapi_module_struct sapi_module = {
|
||||
"PHP Language", /* name */
|
||||
|
||||
php_module_startup, /* startup */
|
||||
php_module_shutdown_wrapper, /* shutdown */
|
||||
|
||||
zend_cgibin_ub_write, /* unbuffered write */
|
||||
|
||||
php_error, /* error handler */
|
||||
|
||||
NULL, /* header handler */
|
||||
NULL, /* send headers handler */
|
||||
sapi_cgi_send_header, /* send header handler */
|
||||
|
||||
sapi_cgi_read_post, /* read POST data */
|
||||
sapi_cgi_read_cookies /* read Cookies */
|
||||
};
|
||||
|
||||
|
||||
static void php_cgi_usage(char *argv0)
|
||||
{
|
||||
char *prog;
|
||||
|
||||
prog = strrchr(argv0, '/');
|
||||
if (prog) {
|
||||
prog++;
|
||||
} else {
|
||||
prog = "php";
|
||||
}
|
||||
|
||||
php_printf("Usage: %s [-q] [-h]"
|
||||
" [-s]"
|
||||
" [-v] [-i] [-f <file>] | "
|
||||
"{<file> [args...]}\n"
|
||||
" -q Quiet-mode. Suppress HTTP Header output.\n"
|
||||
" -s Display colour syntax highlighted source.\n"
|
||||
" -f<file> Parse <file>. Implies `-q'\n"
|
||||
" -v Version number\n"
|
||||
" -c<path> Look for php.ini file in this directory\n"
|
||||
#if SUPPORT_INTERACTIVE
|
||||
" -a Run interactively\n"
|
||||
#endif
|
||||
" -e Generate extended information for debugger/profiler\n"
|
||||
" -i PHP information\n"
|
||||
" -h This help\n", prog);
|
||||
}
|
||||
|
||||
|
||||
static void init_request_info(SLS_D)
|
||||
{
|
||||
char *content_length = getenv("CONTENT_LENGTH");
|
||||
|
||||
SG(request_info).request_method = getenv("REQUEST_METHOD");
|
||||
SG(request_info).query_string = getenv("QUERY_STRING");
|
||||
SG(request_info).request_uri = getenv("PATH_INFO");
|
||||
SG(request_info).path_translated = NULL; /* we have to update it later, when we have that information */
|
||||
SG(request_info).content_type = getenv("CONTENT_TYPE");
|
||||
SG(request_info).content_length = (content_length?atoi(content_length):0);
|
||||
|
||||
/* CGI does not support HTTP authentication */
|
||||
SG(request_info).auth_user = NULL;
|
||||
SG(request_info).auth_password = NULL;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int cgi = 0, c, i, len;
|
||||
zend_file_handle file_handle;
|
||||
char *s;
|
||||
/* temporary locals */
|
||||
int cgi_started=0;
|
||||
int behavior=PHP_MODE_STANDARD;
|
||||
int no_headers=0;
|
||||
#if SUPPORT_INTERACTIVE
|
||||
int interactive=0;
|
||||
#endif
|
||||
/* end of temporary locals */
|
||||
#ifdef ZTS
|
||||
zend_compiler_globals *compiler_globals;
|
||||
zend_executor_globals *executor_globals;
|
||||
php_core_globals *core_globals;
|
||||
sapi_globals_struct *sapi_globals;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef ZTS
|
||||
if (setjmp(EG(bailout))!=0) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
tsrm_startup(1,1,0);
|
||||
#endif
|
||||
|
||||
sapi_startup(&sapi_module);
|
||||
|
||||
#if WIN32|WINNT
|
||||
_fmode = _O_BINARY; /*sets default for file streams to binary */
|
||||
setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */
|
||||
setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */
|
||||
setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
|
||||
#endif
|
||||
|
||||
|
||||
/* Make sure we detect we are a cgi - a bit redundancy here,
|
||||
but the default case is that we have to check only the first one. */
|
||||
if (getenv("SERVER_SOFTWARE")
|
||||
|| getenv("SERVER_NAME")
|
||||
|| getenv("GATEWAY_INTERFACE")
|
||||
|| getenv("REQUEST_METHOD")) {
|
||||
cgi = 1;
|
||||
if (argc > 1)
|
||||
request_info.php_argv0 = strdup(argv[1]);
|
||||
else request_info.php_argv0 = NULL;
|
||||
#if FORCE_CGI_REDIRECT
|
||||
if (!getenv("REDIRECT_STATUS")) {
|
||||
PUTS("<b>Security Alert!</b> PHP CGI cannot be accessed directly.\n\
|
||||
\n\
|
||||
<P>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\
|
||||
means that a page will only be served up if the REDIRECT_STATUS CGI variable is\n\
|
||||
set. This variable is set, for example, by Apache's Action directive redirect.\n\
|
||||
<P>You may disable this restriction by recompiling the PHP binary with the\n\
|
||||
--disable-force-cgi-redirect switch. If you do this and you have your PHP CGI\n\
|
||||
binary accessible somewhere in your web tree, people will be able to circumvent\n\
|
||||
.htaccess security by loading files through the PHP parser. A good way around\n\
|
||||
this is to define doc_root in your php.ini file to something other than your\n\
|
||||
top-level DOCUMENT_ROOT. This way you can separate the part of your web space\n\n\
|
||||
which uses PHP from the normal part using .htaccess security. If you do not have\n\
|
||||
any .htaccess restrictions anywhere on your site you can leave doc_root undefined.\n\
|
||||
\n");
|
||||
|
||||
/* remove that detailed explanation some time */
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
#endif /* FORCE_CGI_REDIRECT */
|
||||
}
|
||||
|
||||
if (php_module_startup(&sapi_module)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
#ifdef ZTS
|
||||
compiler_globals = ts_resource(compiler_globals_id);
|
||||
executor_globals = ts_resource(executor_globals_id);
|
||||
core_globals = ts_resource(core_globals_id);
|
||||
sapi_globals = ts_resource(sapi_globals_id);
|
||||
if (setjmp(EG(bailout))!=0) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
SG(request_info).path_translated = NULL;
|
||||
init_request_info(SLS_C);
|
||||
SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */
|
||||
CG(extended_info) = 0;
|
||||
|
||||
if (!cgi) { /* never execute the arguments if you are a CGI */
|
||||
request_info.php_argv0 = NULL;
|
||||
while ((c = getopt(argc, argv, "c:qvisnaeh?vf:")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
if (!cgi_started){
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
}
|
||||
cgi_started=1;
|
||||
SG(request_info).path_translated = estrdup(optarg);
|
||||
/* break missing intentionally */
|
||||
case 'q':
|
||||
no_headers = 1;
|
||||
break;
|
||||
case 'v':
|
||||
if (!cgi_started) {
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
}
|
||||
php_printf("%s\n", PHP_VERSION);
|
||||
exit(1);
|
||||
break;
|
||||
case 'i':
|
||||
if (!cgi_started) {
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
}
|
||||
cgi_started=1;
|
||||
php3_TreatHeaders();
|
||||
php_print_info(0xFFFFFFFF);
|
||||
exit(1);
|
||||
break;
|
||||
case 's':
|
||||
behavior=PHP_MODE_HIGHLIGHT;
|
||||
break;
|
||||
case 'n':
|
||||
behavior=PHP_MODE_INDENT;
|
||||
break;
|
||||
case 'c':
|
||||
php3_ini_path = strdup(optarg); /* intentional leak */
|
||||
break;
|
||||
case 'a':
|
||||
#if SUPPORT_INTERACTIVE
|
||||
printf("Interactive mode enabled\n\n");
|
||||
interactive=1;
|
||||
#else
|
||||
printf("Interactive mode not supported!\n\n");
|
||||
#endif
|
||||
break;
|
||||
case 'e':
|
||||
CG(extended_info) = 1;
|
||||
break;
|
||||
case 'h':
|
||||
case '?':
|
||||
zend_output_startup();
|
||||
SG(headers_sent) = 1;
|
||||
php_cgi_usage(argv[0]);
|
||||
exit(1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* not cgi */
|
||||
|
||||
#if SUPPORT_INTERACTIVE
|
||||
EG(interactive) = interactive;
|
||||
#endif
|
||||
|
||||
if (!cgi_started) {
|
||||
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (no_headers) {
|
||||
SG(headers_sent) = 1;
|
||||
}
|
||||
file_handle.filename = "-";
|
||||
file_handle.type = ZEND_HANDLE_FP;
|
||||
file_handle.handle.fp = stdin;
|
||||
|
||||
php3_TreatHeaders();
|
||||
|
||||
|
||||
if (!cgi) {
|
||||
if (!SG(request_info).query_string) {
|
||||
for (i = optind, len = 0; i < argc; i++)
|
||||
len += strlen(argv[i]) + 1;
|
||||
|
||||
s = malloc(len + 1); /* leak - but only for command line version, so ok */
|
||||
*s = '\0'; /* we are pretending it came from the environment */
|
||||
for (i = optind, len = 0; i < argc; i++) {
|
||||
strcat(s, argv[i]);
|
||||
if (i < (argc - 1))
|
||||
strcat(s, "+");
|
||||
}
|
||||
SG(request_info).query_string = s;
|
||||
}
|
||||
if (!SG(request_info).path_translated && argc > optind)
|
||||
SG(request_info).path_translated = argv[optind];
|
||||
}
|
||||
/* If for some reason the CGI interface is not setting the
|
||||
PATH_TRANSLATED correctly, SG(request_info).path_translated is NULL.
|
||||
We still call php3_fopen_for_parser, because if you set doc_root
|
||||
or user_dir configuration directives, PATH_INFO is used to construct
|
||||
the filename as a side effect of php3_fopen_for_parser.
|
||||
*/
|
||||
if (cgi || SG(request_info).path_translated) {
|
||||
file_handle.handle.fp = php3_fopen_for_parser();
|
||||
file_handle.filename = SG(request_info).path_translated;
|
||||
}
|
||||
|
||||
if (cgi && !file_handle.handle.fp) {
|
||||
PUTS("No input file specified.\n");
|
||||
#if 0 /* this is here for debuging under windows */
|
||||
if (argc) {
|
||||
i = 0;
|
||||
php_printf("\nargc %d\n",argc);
|
||||
while (i <= argc) {
|
||||
php_printf("%s\n",argv[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
php_request_shutdown((void *) 0);
|
||||
php_module_shutdown();
|
||||
return FAILURE;
|
||||
} else if (file_handle.handle.fp && file_handle.handle.fp!=stdin) {
|
||||
/* #!php support */
|
||||
c = fgetc(file_handle.handle.fp);
|
||||
if (c == '#') {
|
||||
while (c != 10 && c != 13) {
|
||||
c = fgetc(file_handle.handle.fp); /* skip to end of line */
|
||||
}
|
||||
CG(zend_lineno)++;
|
||||
} else {
|
||||
rewind(file_handle.handle.fp);
|
||||
}
|
||||
}
|
||||
|
||||
switch (behavior) {
|
||||
case PHP_MODE_STANDARD:
|
||||
php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
|
||||
break;
|
||||
case PHP_MODE_HIGHLIGHT: {
|
||||
zend_syntax_highlighter_ini syntax_highlighter_ini;
|
||||
|
||||
if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
|
||||
php_get_highlight_struct(&syntax_highlighter_ini);
|
||||
zend_highlight(&syntax_highlighter_ini);
|
||||
fclose(file_handle.handle.fp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case PHP_MODE_INDENT:
|
||||
open_file_for_scanning(&file_handle CLS_CC);
|
||||
zend_indent();
|
||||
fclose(file_handle.handle.fp);
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
php3_header(); /* Make sure headers have been sent */
|
||||
php_request_shutdown((void *) 0);
|
||||
php_module_shutdown();
|
||||
#ifdef ZTS
|
||||
tsrm_shutdown();
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
+952
@@ -0,0 +1,952 @@
|
||||
dnl $Id$ -*- sh -*-
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
divert(0)
|
||||
AC_INIT(main.c)
|
||||
recurse=yes
|
||||
for arg in $@; do
|
||||
case $arg in
|
||||
## This is to prevent "./config.status --recheck" from
|
||||
## running configure in libzend again.
|
||||
--no-recursion) recurse=no;;
|
||||
--enable-thread-safety) threadsafe=yes;;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test "$with_shared_apache" != "no" && test -n "$with_shared_apache" ; then
|
||||
echo ""
|
||||
echo "ERROR: --with-shared-apache is not supported."
|
||||
echo " Please read INSTALL.DSO for instructions on using APXS."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cwd=`pwd`
|
||||
cachefile=$cwd/config.cache
|
||||
|
||||
if test "$recurse" = "yes"; then
|
||||
(set -x; test -d libzend || mkdir libzend ; cd libzend; $cwd/$srcdir/libzend/configure --cache-file=$cachefile $@)
|
||||
if test "$threadsafe" = "yes"; then
|
||||
(set -x; test -d TSRM || mkdir TSRM; cd TSRM; $cwd/$srcdir/TSRM/configure --cache-file=$cachefile $@)
|
||||
fi
|
||||
(set -x; cd $srcdir; sh ltconfig --disable-static --enable-dlopen --cache-file=$cachefile ltmain.sh)
|
||||
fi
|
||||
|
||||
dnl ## Diversion 1 is the initial checking of OS features, programs,
|
||||
dnl ## libraries and so on.
|
||||
|
||||
dnl ## In diversion 2 we check for compile-time options to the PHP
|
||||
dnl ## core and how to deal with different system dependencies. This
|
||||
dnl ## includes what regex library is used and whether debugging or short
|
||||
dnl ## tags are enabled, and the default behaviour of php.ini options.
|
||||
dnl ## This is also where an SAPI interface is selected (choosing between
|
||||
dnl ## Apache module, CGI etc.)
|
||||
|
||||
dnl ## In diversion 3 we check which extensions should be compiled.
|
||||
dnl ## All of these are normally in the extension directories.
|
||||
|
||||
dnl ## Diversion 4 is the last one. Here we generate files and clean up.
|
||||
|
||||
divert(1)
|
||||
|
||||
dnl ## This is where the version number is changed from now on!
|
||||
AM_INIT_AUTOMAKE(php, 4.0B2)
|
||||
|
||||
PHP_VERSION=$VERSION
|
||||
echo "/* automatically generated by configure */" > php_version.h.new
|
||||
echo "/* edit configure.in.in to change version number */" >> php_version.h.new
|
||||
echo "#define PHP_VERSION \"$PHP_VERSION\"" >> php_version.h.new
|
||||
cmp php_version.h.new php_version.h >/dev/null 2>&1
|
||||
if test $? -ne 0 ; then
|
||||
rm -f php_version.h && mv php_version.h.new php_version.h && \
|
||||
echo 'Updated php_version.h'
|
||||
else
|
||||
rm -f php_version.h.new
|
||||
fi
|
||||
AC_SUBST(PHP_VERSION)
|
||||
|
||||
AM_CONFIG_HEADER(php_config.h)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
dnl We want this one before the checks, so the checks can modify CFLAGS.
|
||||
test -z "$CFLAGS" && auto_cflags=1
|
||||
|
||||
dnl If we're using cc on HP-UX, add the -Ae to CFLAGS
|
||||
if test -n "$auto_cflags" && test "`uname -s 2>/dev/null`" = "HP-UX"; then
|
||||
test -n "$GCC" || CFLAGS="-Ae $CFLAGS -D_HPUX_SOURCE"
|
||||
fi
|
||||
|
||||
dnl Checks for programs.
|
||||
AM_PROG_LIBTOOL
|
||||
AC_PROG_YACC
|
||||
if test "$YACC" != "bison -y"; then
|
||||
AC_MSG_WARN(You will need bison if you want to regenerate the PHP parsers.)
|
||||
else
|
||||
AC_MSG_CHECKING(bison version)
|
||||
oldIFS=$IFS; IFS=.
|
||||
set `bison -V | sed -e 's/^GNU Bison version //'`
|
||||
IFS=$oldIFS
|
||||
if test "$1" = "1" -a "$2" -lt "25"; then
|
||||
AC_MSG_WARN(Bison 1.25 or newer needed to regenerate parsers (found $1.$2).)
|
||||
fi
|
||||
AC_MSG_RESULT($1.$2 (ok))
|
||||
fi
|
||||
|
||||
dnl ## there has to be a better way...
|
||||
dnl## OLDLIBS=$LIBS; LIBS=""
|
||||
AC_PROG_CC
|
||||
dnl## LIBS=$OLDLIBS
|
||||
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_CC_C_O
|
||||
AC_PROG_LN_S
|
||||
AC_PATH_PROG(PERL_PATH, perl)
|
||||
|
||||
|
||||
dnl Make flex scanners use const if they can, even if __STDC__ is not
|
||||
dnl true, for compilers like Sun's that only set __STDC__ true in
|
||||
dnl "limit-to-ANSI-standard" mode, not in "ANSI-compatible" mode
|
||||
AC_C_CONST
|
||||
if test "$ac_cv_c_const" = "yes" ; then
|
||||
LEX_CFLAGS="-DYY_USE_CONST"
|
||||
fi
|
||||
AC_SUBST(LEX_CFLAGS)
|
||||
|
||||
dnl Hack to work around a Mac OS X cpp problem
|
||||
dnl Known versions needing this workaround are 5.3 and 5.4
|
||||
if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then
|
||||
CPPFLAGS="$CPPFLAGS -traditional-cpp"
|
||||
fi
|
||||
|
||||
if test "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then
|
||||
APXS_EXP="-bE:mod_php4.exp"
|
||||
fi
|
||||
AC_SUBST(APXS_EXP)
|
||||
|
||||
dnl Ugly hack to get around a problem with gcc on AIX.
|
||||
if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \
|
||||
"`uname -sv`" = "AIX 4"; then
|
||||
CFLAGS=`echo $CFLAGS | sed -e 's/-g//'`
|
||||
fi
|
||||
|
||||
dnl check for -R, etc. switch
|
||||
AC_MSG_CHECKING(if compiler supports -R)
|
||||
AC_CACHE_VAL(php_cv_cc_dashr,[
|
||||
SAVE_LIBS="${LIBS}"
|
||||
LIBS="-R /usr/lib ${LIBS}"
|
||||
AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
|
||||
LIBS="${SAVE_LIBS}"])
|
||||
AC_MSG_RESULT($php_cv_cc_dashr)
|
||||
if test $php_cv_cc_dashr = "yes"; then
|
||||
ld_runpath_switch="-R"
|
||||
raw_runpath_switch="-R"
|
||||
apxs_runpath_switch="-Wl,-R'"
|
||||
else
|
||||
AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
|
||||
AC_CACHE_VAL(php_cv_cc_rpath,[
|
||||
SAVE_LIBS="${LIBS}"
|
||||
LIBS="-Wl,-rpath,/usr/lib ${LIBS}"
|
||||
AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
|
||||
LIBS="${SAVE_LIBS}"])
|
||||
AC_MSG_RESULT($php_cv_cc_rpath)
|
||||
if test $php_cv_cc_rpath = "yes"; then
|
||||
ld_runpath_switch="-Wl,-rpath,"
|
||||
raw_runpath_switch="-rpath "
|
||||
apxs_runpath_switch="-Wl,'-rpath "
|
||||
else
|
||||
dnl something innocuous
|
||||
ld_runpath_switch="-L"
|
||||
raw_runpath_switch="-L"
|
||||
apxs_runpath_switch="-L'"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
dnl Check compiler support for -rdynamic
|
||||
AC_MSG_CHECKING(if compiler supports -rdynamic)
|
||||
AC_CACHE_VAL(php_cc_rdynamic,[
|
||||
SAVE_LIBS="${LIBS}"
|
||||
LIBS="-rdynamic ${LIBS}"
|
||||
AC_TRY_LINK([], [], php_cc_rdynamic=yes, php_cc_rdynamic=no)
|
||||
LIBS="${SAVE_LIBS}"])
|
||||
AC_MSG_RESULT($php_cc_rdynamic)
|
||||
if test $php_cc_rdynamic = "yes"; then
|
||||
AC_CHECK_CC_OPTION(rdynamic)
|
||||
fi
|
||||
if test $php_cc_rdynamic = "yes"; then
|
||||
LDFLAGS="${LDFLAGS} -rdynamic"
|
||||
RDYNAMIC_LFLAGS="-rdynamic"
|
||||
else
|
||||
RDYNAMIC_LFLAGS=""
|
||||
fi
|
||||
AC_SUBST(RDYNAMIC_LFLAGS)
|
||||
|
||||
dnl AC_PROG_INSTALL
|
||||
AC_PATH_PROG(PROG_SENDMAIL, sendmail, /usr/lib/sendmail, $PATH /usr/bin /usr/sbin /usr/etc /etc /usr/ucblib)
|
||||
if test -n "$PROG_SENDMAIL"; then
|
||||
AC_DEFINE(HAVE_SENDMAIL)
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary
|
||||
dnl and source packages. This should be harmless on other OSs.
|
||||
dnl
|
||||
if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
|
||||
CFLAGS="$CFLAGS -I/usr/pkg/include"
|
||||
LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
|
||||
fi
|
||||
|
||||
INCLUDES="-I\$(top_builddir)/libzend -I\$(top_builddir)/TSRM"
|
||||
AC_SUBST(INCLUDES)
|
||||
|
||||
AC_CHECK_LIB(nsl, gethostname, [
|
||||
LIBS="-lnsl $LIBS"
|
||||
AC_DEFINE(HAVE_LIBNSL) ], [])
|
||||
|
||||
AC_CHECK_LIB(c, socket, [:], [
|
||||
AC_CHECK_LIB(socket, socket, [
|
||||
LIBS="-lsocket $LIBS"
|
||||
AC_DEFINE(HAVE_LIBSOCKET) ], []) ])
|
||||
|
||||
AC_CHECK_LIB(c, gethostbyaddr, [:], [
|
||||
AC_CHECK_LIB(nsl, gethostbyaddr, [
|
||||
LIBS="-lnsl $LIBS"
|
||||
AC_DEFINE(HAVE_LIBNSL) ], []) ])
|
||||
|
||||
AC_CHECK_LIB(c, crypt, [:], [
|
||||
AC_CHECK_LIB(crypt, crypt, [
|
||||
LIBS="-lcrypt $LIBS"
|
||||
AC_DEFINE(HAVE_LIBCRYPT) ], []) ])
|
||||
|
||||
dnl The sin may be in a library which need not be specifed
|
||||
dnl as well as res_search resides in libsocket
|
||||
AC_CHECK_LIB(c, sin, [:], [
|
||||
AC_CHECK_LIB(m, sin) ])
|
||||
|
||||
dnl The res_search may be in libsocket as well, and if it is
|
||||
dnl make sure to check for dn_skipname in libresolv, or if res_search
|
||||
dnl is in neither of these libs, still check for dn_skipname in libresolv
|
||||
AC_CHECK_LIB(socket, res_search, [
|
||||
AC_CHECK_LIB(resolv, dn_skipname)
|
||||
AC_CHECK_LIB(resolv, __dn_skipname)
|
||||
LIBS="$LIBS -lsocket"
|
||||
AC_DEFINE(HAVE_LIBSOCKET) ], [
|
||||
AC_CHECK_LIB(resolv, res_search, [
|
||||
LIBS="$LIBS -lresolv"
|
||||
AC_DEFINE(HAVE_LIBRESOLV)
|
||||
], [
|
||||
AC_CHECK_LIB(resolv, dn_skipname)
|
||||
AC_CHECK_LIB(resolv, __dn_skipname)
|
||||
])
|
||||
])
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
dnl In QNX opendir resides in libc but dirent.h is still required
|
||||
if test "`uname -s 2>/dev/null`" != "QNX"; then
|
||||
AC_HEADER_DIRENT
|
||||
else
|
||||
AC_CHECK_HEADERS(dirent.h)
|
||||
fi
|
||||
AC_MISSING_FCLOSE_DECL
|
||||
dnl QNX requires unix.h to allow functions in libunix to work properly
|
||||
AC_CHECK_HEADERS(fcntl.h unistd.h crypt.h sys/file.h memory.h pwd.h grp.h sys/socket.h sys/wait.h syslog.h string.h sys/varargs.h stdarg.h sys/time.h signal.h netinet/in.h dlfcn.h limits.h sys/types.h unix.h arpa/inet.h locale.h sys/select.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_STRUCT_TM
|
||||
AC_STRUCT_TIMEZONE
|
||||
|
||||
AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
|
||||
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;],
|
||||
ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
|
||||
|
||||
if test "$ac_cv_struct_tm_gmtoff" = yes; then
|
||||
AC_DEFINE(HAVE_TM_GMTOFF)
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(for struct flock,php_struct_flock,
|
||||
AC_TRY_COMPILE([
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
],
|
||||
[struct flock x;],
|
||||
[
|
||||
php_struct_flock=yes
|
||||
],[
|
||||
php_struct_flock=no
|
||||
])
|
||||
)
|
||||
if test "$php_struct_flock" = "yes" ; then
|
||||
AC_DEFINE(HAVE_STRUCT_FLOCK, 1)
|
||||
else
|
||||
AC_DEFINE(HAVE_STRUCT_FLOCK, 0)
|
||||
fi
|
||||
|
||||
AC_CHECK_SIZEOF(long, 8)
|
||||
AC_CHECK_SIZEOF(int, 4)
|
||||
|
||||
dnl Check for members of the stat structure
|
||||
AC_STRUCT_ST_BLKSIZE
|
||||
dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists
|
||||
dnl The WARNING_LEVEL required because cc in QNX hates -w option without an argument
|
||||
if test "`uname -s 2>/dev/null`" != "QNX"; then
|
||||
AC_STRUCT_ST_BLOCKS
|
||||
else
|
||||
AC_MSG_WARN(warnings level for cc set to 0)
|
||||
WARNING_LEVEL=0
|
||||
AC_SUBST(WARNING_LEVEL)
|
||||
fi
|
||||
AC_STRUCT_ST_RDEV
|
||||
|
||||
dnl Checks for types
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_UID_T
|
||||
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 )
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS(memcpy memmove strdup strerror strcasecmp strstr flock lockf putenv tempnam usleep setlocale gettimeofday setvbuf srand48 lrand48 srandom random link symlink regcomp getlogin cuserid vsnprintf snprintf gcvt utime crypt rint unsetenv strftime setsockopt tzset shutdown inet_aton)
|
||||
AC_FUNC_UTIME_NULL
|
||||
AC_FUNC_ALLOCA
|
||||
dnl## OLDLIBS=$LIBS; LIBS=""
|
||||
dnl This is also defined/used in libzend. To avoid a redefinition
|
||||
dnl we use that version
|
||||
dnl AC_BROKEN_SPRINTF
|
||||
dnl## LIBS=$OLDLIBS
|
||||
AC_REPLACE_FUNCS(getopt)
|
||||
|
||||
dnl AIX keeps in_addr_t in /usr/include/netinet/in.h
|
||||
dnl AC_MSG_CHECKING(for in_addr_t)
|
||||
AC_CACHE_VAL(ac_cv_type_$1,
|
||||
[AC_EGREP_CPP(dnl
|
||||
changequote(<<,>>)dnl
|
||||
<<in_addr_t[^a-zA-Z_0-9]>>dnl
|
||||
changequote([,]), [#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif], ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)])dnl
|
||||
|
||||
dnl AC_MSG_RESULT($ac_cv_type_in_addr_t)
|
||||
if test $ac_cv_type_in_addr_t = no; then
|
||||
AC_DEFINE(in_addr_t, u_int)
|
||||
fi
|
||||
|
||||
divert(2)
|
||||
|
||||
abs_srcdir=`(cd $srcdir; pwd)`
|
||||
abs_builddir=`pwd`
|
||||
AC_SUBST(abs_srcdir)
|
||||
AC_SUBST(abs_builddir)
|
||||
|
||||
AC_MSG_CHECKING(for Apache module support via DSO through APXS)
|
||||
AC_ARG_WITH(apxs,
|
||||
[ --with-apxs[=FILE] Build shared Apache module. FILE is the optional
|
||||
pathname to the Apache apxs tool; defaults to "apxs".
|
||||
(This option needs Perl installed)],
|
||||
[
|
||||
if test "$withval" = "yes"; then
|
||||
withval=apxs
|
||||
fi
|
||||
AC_EXPAND_PATH($withval, APXS)
|
||||
APXS_LDFLAGS="@SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@"
|
||||
APACHE_INCLUDE="-I`$APXS -q INCLUDEDIR`"
|
||||
BINNAME=libphp4.so
|
||||
INSTALL_IT="\$(APXS) -i -a -n php4 $BINNAME"
|
||||
CFLAGS_SHLIB=`perl -V:cccdlflags | cut -d\' -f2`
|
||||
LDFLAGS_SHLIB=`perl -V:lddlflags | cut -d\' -f2`
|
||||
LDFLAGS_SHLIB_EXPORT=`perl -V:ccdlflags | cut -d\' -f2`
|
||||
PHP_LIBS=
|
||||
STRONGHOLD=
|
||||
INCLUDES="$INCLUDES $APACHE_INCLUDE"
|
||||
AC_DEFINE(APACHE)
|
||||
AC_SUBST(APXS)
|
||||
AC_SUBST(APXS_LDFLAGS)
|
||||
AC_SUBST(BINNAME)
|
||||
AC_SUBST(INSTALL_IT)
|
||||
AC_SUBST(PHP_LIBS)
|
||||
AC_SUBST(APACHE_INCLUDE)
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H)
|
||||
AC_DEFINE(HAVE_AP_COMPAT_H)
|
||||
AC_MSG_RESULT(yes)
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
|
||||
APACHE_INSTALL_FILES="$srcdir/mod_php4.* libphp4.module"
|
||||
|
||||
if test "$BINNAME" != "libmodphp4-so.a"; then
|
||||
if test "$BINNAME" != "libphp4.so"; then
|
||||
AC_MSG_CHECKING(for Apache module support)
|
||||
AC_ARG_WITH(apache,
|
||||
[ --with-apache[=DIR] Build Apache module. DIR is the top-level Apache
|
||||
build directory, defaults to /usr/local/etc/httpd.],
|
||||
[
|
||||
if test "$withval" = "yes"; then
|
||||
# Apache's default directory
|
||||
withval=/usr/local/etc/httpd
|
||||
fi
|
||||
if test "$withval" != "no"; then
|
||||
rpath_raw=yes
|
||||
# For Apache 1.2.x
|
||||
AC_EXPAND_PATH($withval, withval)
|
||||
if test -f $withval/src/httpd.h; then
|
||||
APACHE_INCLUDE=-I$withval/src
|
||||
APACHE_TARGET=$withval/src
|
||||
BINNAME=libphp4.a
|
||||
INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET"
|
||||
PHP_LIBS="-L. -lphp3"
|
||||
AC_DEFINE(APACHE)
|
||||
AC_MSG_RESULT(yes - Apache 1.2.x)
|
||||
STRONGHOLD=
|
||||
if test -f $withval/src/ap_config.h; then
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H)
|
||||
fi
|
||||
# For Apache 1.3.x
|
||||
elif test -f $withval/src/main/httpd.h; then
|
||||
APACHE_INCLUDE="-I$withval/src/main -I$withval/src/os/unix -I$withval/src/ap"
|
||||
APACHE_TARGET=$withval/src/modules/php4
|
||||
if test ! -d $APACHE_TARGET; then
|
||||
mkdir $APACHE_TARGET
|
||||
fi
|
||||
BINNAME=libmodphp4.a
|
||||
INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
|
||||
PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
|
||||
AC_DEFINE(APACHE)
|
||||
AC_MSG_RESULT(yes - Apache 1.3.x)
|
||||
STRONGHOLD=
|
||||
if test -f $withval/src/include/ap_config.h; then
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H)
|
||||
fi
|
||||
if test -f $withval/src/include/ap_compat.h; then
|
||||
AC_DEFINE(HAVE_AP_COMPAT_H)
|
||||
if test ! -f $withval/src/include/ap_config_auto.h; then
|
||||
AC_MSG_ERROR(Please run Apache's configure or src/Configure program once and try again)
|
||||
fi
|
||||
else
|
||||
if test -f $withval/src/include/compat.h; then
|
||||
AC_DEFINE(HAVE_OLD_COMPAT_H)
|
||||
fi
|
||||
fi
|
||||
# Also for Apache 1.3.x
|
||||
elif test -f $withval/src/include/httpd.h; then
|
||||
APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix"
|
||||
APACHE_TARGET=$withval/src/modules/php4
|
||||
if test ! -d $APACHE_TARGET; then
|
||||
mkdir $APACHE_TARGET
|
||||
fi
|
||||
BINNAME=libmodphp4.a
|
||||
PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
|
||||
INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
|
||||
AC_DEFINE(APACHE)
|
||||
AC_MSG_RESULT(yes - Apache 1.3.x)
|
||||
STRONGHOLD=
|
||||
if test -f $withval/src/include/ap_config.h; then
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H)
|
||||
fi
|
||||
if test -f $withval/src/include/ap_compat.h; then
|
||||
AC_DEFINE(HAVE_AP_COMPAT_H)
|
||||
if test ! -f $withval/src/include/ap_config_auto.h; then
|
||||
AC_MSG_ERROR(Please run Apache's configure or src/Configure program once and try again)
|
||||
fi
|
||||
else
|
||||
if test -f $withval/src/include/compat.h; then
|
||||
AC_DEFINE(HAVE_OLD_COMPAT_H)
|
||||
fi
|
||||
fi
|
||||
# For StrongHold 2.2
|
||||
elif test -f $withval/apache/httpd.h; then
|
||||
APACHE_INCLUDE=-"I$withval/apache -I$withval/ssl/include"
|
||||
APACHE_TARGET=$withval/apache
|
||||
BINNAME=libmodphp4.a
|
||||
PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
|
||||
INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET"
|
||||
STRONGHOLD=-DSTRONGHOLD=1
|
||||
AC_DEFINE(APACHE)
|
||||
AC_MSG_RESULT(yes - StrongHold)
|
||||
if test -f $withval/apache/ap_config.h; then
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H)
|
||||
fi
|
||||
if test -f $withval/src/ap_compat.h; then
|
||||
AC_DEFINE(HAVE_AP_COMPAT_H)
|
||||
if test ! -f $withval/src/include/ap_config_auto.h; then
|
||||
AC_MSG_ERROR(Please run Apache's configure or src/Configure program once and try again)
|
||||
fi
|
||||
else
|
||||
if test -f $withval/src/compat.h; then
|
||||
AC_DEFINE(HAVE_OLD_COMPAT_H)
|
||||
fi
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR(Invalid Apache directory - unable to find httpd.h under $withval)
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
BINNAME=php
|
||||
INSTALL_IT="cp $BINNAME \$(bindir)"
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
BINNAME=php
|
||||
INSTALL_IT="cp $BINNAME \$(bindir)"
|
||||
])
|
||||
INCLUDES="$INCLUDES $APACHE_INCLUDE"
|
||||
dnl## AC_SUBST(APACHE_INCLUDE)
|
||||
AC_SUBST(APACHE_TARGET)
|
||||
AC_SUBST(INSTALL_IT)
|
||||
AC_SUBST(BINNAME)
|
||||
AC_SUBST(STRONGHOLD)
|
||||
AC_SUBST(PHP_LIBS)
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(whether to use bundled regex library)
|
||||
AC_ARG_WITH(system-regex,
|
||||
[ --with-system-regex Do not use the bundled regex library],
|
||||
[
|
||||
if test -n "$APXS"; then
|
||||
if test -n "`$APXS -q CFLAGS | grep USE_HSREGEX`"; then
|
||||
HSREGEX=yes
|
||||
else
|
||||
HSREGEX=no
|
||||
fi
|
||||
else
|
||||
if test "$withval" = "no"; then
|
||||
HSREGEX=yes
|
||||
else
|
||||
HSREGEX=no
|
||||
fi
|
||||
fi
|
||||
],[
|
||||
if test -n "$APXS"; then
|
||||
if test -n "`$APXS -q CFLAGS | grep USE_HSREGEX`"; then
|
||||
HSREGEX=yes
|
||||
else
|
||||
HSREGEX=no
|
||||
fi
|
||||
else
|
||||
HSREGEX=yes
|
||||
fi
|
||||
])
|
||||
AC_MSG_RESULT($HSREGEX)
|
||||
|
||||
if test "$HSREGEX" = "yes"; then
|
||||
REGEX_LIB=regex/libregex.a
|
||||
EXTRA_LIBS="-L$abs_builddir/regex -lregex $EXTRA_LIBS"
|
||||
AC_DEFINE(HSREGEX)
|
||||
AC_DEFINE(REGEX,1)
|
||||
else
|
||||
REGEX_LIB=
|
||||
AC_DEFINE(REGEX,0)
|
||||
fi
|
||||
|
||||
AC_SUBST(REGEX_LIB)
|
||||
AC_SUBST(HSREGEX)
|
||||
|
||||
AC_MSG_CHECKING(for mod_charset compatibility option)
|
||||
AC_ARG_WITH(mod_charset,
|
||||
[ --with-mod_charset Enable transfer tables for mod_charset (Rus Apache).],
|
||||
[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_TRANSFER_TABLES)
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(for fhttpd module support)
|
||||
AC_ARG_WITH(fhttpd,
|
||||
[ --with-fhttpd[=DIR] Build fhttpd module. DIR is the fhttpd sources
|
||||
directory, defaults to /usr/local/src/fhttpd.],
|
||||
[
|
||||
if test "$withval" = "yes"; then
|
||||
# fhttpd source directory
|
||||
withval=/usr/local/src/fhttpd
|
||||
fi
|
||||
if test "$withval" != "no"; then
|
||||
# For fhttpd 0.3.x
|
||||
if test -f $withval/servproc.h; then
|
||||
FHTTPD_INCLUDE=-I$withval/
|
||||
FHTTPD_LIB=$withval/servproc.o
|
||||
FHTTPD_TARGET=$withval/
|
||||
BINNAME=php
|
||||
AC_DEFINE(FHTTPD)
|
||||
AC_MSG_RESULT(yes - fhttpd 0.3.x)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR(Invalid fhttpd directory - unable to find servproc.h under $withval)
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
INCLUDES="$INCLUDES $FHTTPD_INCLUDE"
|
||||
dnl## AC_SUBST(FHTTPD_INCLUDE)
|
||||
AC_SUBST(FHTTPD_LIB)
|
||||
AC_SUBST(FHTTPD_TARGET)
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to use a configuration file)
|
||||
AC_ARG_WITH(config-file-path,
|
||||
[ --with-config-file-path=PATH Sets the path in which to look for php.ini
|
||||
defaults to /usr/local/lib],
|
||||
[
|
||||
if test "$withval" = "yes"; then
|
||||
AC_DEFINE_UNQUOTED(CONFIGURATION_FILE_PATH, "/usr/local/lib")
|
||||
AC_DEFINE(USE_CONFIG_FILE, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
if test "$withval" != "no"; then
|
||||
AC_DEFINE_UNQUOTED(CONFIGURATION_FILE_PATH, "$withval")
|
||||
AC_DEFINE(USE_CONFIG_FILE, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_DEFINE(CONFIGURATION_FILE_PATH, 0)
|
||||
AC_DEFINE(USE_CONFIG_FILE, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE_UNQUOTED(CONFIGURATION_FILE_PATH, "/usr/local/lib")
|
||||
AC_DEFINE(USE_CONFIG_FILE, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to include debugging symbols)
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --disable-debug Compile without debugging symbols],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(DEBUG,1)
|
||||
PHP_DEBUG=1
|
||||
DEBUG_CFLAGS="-g"
|
||||
test -n "$GCC" && DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall"
|
||||
test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \
|
||||
DEBUG_CFLAGS="$DEBUG_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(DEBUG,0)
|
||||
PHP_DEBUG=0
|
||||
DEBUG_CFLAGS=""
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(DEBUG,1)
|
||||
PHP_DEBUG=1
|
||||
DEBUG_CFLAGS="-g"
|
||||
])
|
||||
AC_SUBST(DEBUG_CFLAGS)
|
||||
AC_SUBST(PHP_DEBUG)
|
||||
CFLAGS="$CFLAGS $DEBUG_CFLAGS"
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to enable safe mode by default)
|
||||
AC_ARG_ENABLE(safe-mode,
|
||||
[ --enable-safe-mode Enable safe mode by default.],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(PHP_SAFE_MODE, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_DEFINE(PHP_SAFE_MODE, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(PHP_SAFE_MODE, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(for safe mode exec dir)
|
||||
AC_ARG_WITH(exec-dir,
|
||||
[ --with-exec-dir[=DIR] Only allow executables in DIR when in safe mode
|
||||
defaults to /usr/local/php/bin],
|
||||
[
|
||||
if test "$withval" != "no"; then
|
||||
if test "$withval" = "yes"; then
|
||||
AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin")
|
||||
AC_MSG_RESULT(/usr/local/php/bin)
|
||||
else
|
||||
AC_DEFINE_UNQUOTED(PHP_SAFE_MODE_EXEC_DIR,"$withval")
|
||||
AC_MSG_RESULT($withval)
|
||||
fi
|
||||
else
|
||||
AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin")
|
||||
AC_MSG_RESULT(/usr/local/php/bin)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin")
|
||||
AC_MSG_RESULT(/usr/local/php/bin)
|
||||
])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to enable track_vars variables by default)
|
||||
AC_ARG_ENABLE(track-vars,
|
||||
[ --enable-track-vars Enable GET/POST/Cookie track variables by default.],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(PHP_TRACK_VARS, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_DEFINE(PHP_TRACK_VARS, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(PHP_TRACK_VARS, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to enable magic quotes by default)
|
||||
AC_ARG_ENABLE(magic-quotes,
|
||||
[ --enable-magic-quotes Enable magic quotes by default.],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(MAGIC_QUOTES, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_DEFINE(MAGIC_QUOTES, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(MAGIC_QUOTES, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to build PHP thread-safe)
|
||||
AC_ARG_ENABLE(thread-safety,
|
||||
[ --enable-thread-safety Whether to build PHP thread-safe.],[
|
||||
TSRM_LIB='TSRM/libtsrm.a'
|
||||
TSRM_DIR=TSRM
|
||||
AC_DEFINE(ZTS)
|
||||
],[
|
||||
TSRM_DIR=""
|
||||
])
|
||||
AC_SUBST(TSRM_DIR)
|
||||
AC_SUBST(TSRM_LIB)
|
||||
|
||||
dnl AC_MSG_CHECKING(whether to enable PHP RPC support)
|
||||
dnl AC_ARG_ENABLE(php-rpc,
|
||||
dnl [ --enable-php-rpc Compile with PHP RPC support.],
|
||||
dnl [
|
||||
dnl if test "$enableval" = "yes"; then
|
||||
dnl AC_DEFINE(PHP_RPC, 1)
|
||||
dnl AC_MSG_RESULT(yes)
|
||||
dnl else
|
||||
dnl AC_DEFINE(PHP_RPC, 0)
|
||||
dnl AC_MSG_RESULT(no)
|
||||
dnl fi
|
||||
dnl ],[
|
||||
dnl AC_DEFINE(PHP_RPC, 0)
|
||||
dnl AC_MSG_RESULT(no)
|
||||
dnl ])
|
||||
|
||||
if test "$BINNAME" = "php"; then
|
||||
AC_MSG_CHECKING(whether to force Apache CGI redirect)
|
||||
AC_ARG_ENABLE(force-cgi-redirect,
|
||||
[ --enable-force-cgi-redirect Enable the security check for internal server
|
||||
redirects. You should use this if you are
|
||||
running the CGI version with Apache. ],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(FORCE_CGI_REDIRECT, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
REDIRECT=1
|
||||
else
|
||||
AC_DEFINE(FORCE_CGI_REDIRECT, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
REDIRECT=0
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(FORCE_CGI_REDIRECT, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
REDIRECT=0
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(whether to discard path_info + path_translated)
|
||||
AC_ARG_ENABLE(discard_path,
|
||||
[ --enable-discard-path If this is enabled, the PHP CGI binary
|
||||
can safely be placed outside of the
|
||||
web tree and people will not be able
|
||||
to circumvent .htaccess security. ],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(DISCARD_PATH, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
DISCARD_PATH=1
|
||||
else
|
||||
AC_DEFINE(DISCARD_PATH, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
DISCARD_PATH=0
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(DISCARD_PATH, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
DISCARD_PATH=0
|
||||
])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(whether to enable short tags by default)
|
||||
AC_ARG_ENABLE(short-tags,
|
||||
[ --disable-short-tags Disable the short-form <? start tag by default.],
|
||||
[
|
||||
if test "$enableval" = "no"; then
|
||||
AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(whether to enable the URL-aware fopen wrapper)
|
||||
AC_ARG_ENABLE(url-fopen-wrapper,
|
||||
[ --disable-url-fopen-wrapper Disable the URL-aware fopen wrapper that allows
|
||||
accessing files via http or ftp.],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_DEFINE(PHP3_URL_FOPEN, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_DEFINE(PHP3_URL_FOPEN, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_DEFINE(PHP3_URL_FOPEN, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
])
|
||||
|
||||
DMALLOC_RESULT=no
|
||||
AC_MSG_CHECKING(whether to enable dmalloc)
|
||||
AC_ARG_ENABLE(dmalloc,
|
||||
[ --enable-dmalloc Enable dmalloc],
|
||||
[
|
||||
if test "$enableval" = "yes" ; then
|
||||
AC_DEFINE(HAVE_DMALLOC, 1)
|
||||
AC_ADD_LIBRARY(dmalloc)
|
||||
CFLAGS="$CFLAGS -DDMALLOC_FUNC_CHECK"
|
||||
DMALLOC_RESULT=yes
|
||||
fi
|
||||
])
|
||||
AC_MSG_RESULT($DMALLOC_RESULT)
|
||||
|
||||
divert(3)
|
||||
|
||||
AC_SUBST(EXTRA_LIBS)
|
||||
|
||||
# reading config stubs
|
||||
esyscmd(./scripts/config-stubs)
|
||||
|
||||
|
||||
divert(4)
|
||||
|
||||
dnl If we're using gcc and the user hasn't specified CFLAGS, add -O2.
|
||||
test -n "$auto_cflags" && test -n "$GCC" && CFLAGS="$CFLAGS -O2"
|
||||
|
||||
dnl If we're using cc on HP-UX, add the -Ae to CFLAGS
|
||||
if test -n "$auto_cflags" && test "`uname -s 2>/dev/null`" = "HP-UX"; then
|
||||
test -n "$GCC" || CFLAGS="-Ae $CFLAGS"
|
||||
fi
|
||||
|
||||
dnl *** Commented out - generates slow code and consumes a lot of
|
||||
dnl *** resources during compilation - we need to figure out how
|
||||
dnl *** to supply it only when absolutely necessary
|
||||
dnl If we are using gcc add -fpic to make dl() work on some platforms
|
||||
dnl test -n "$GCC" && CFLAGS="$CFLAGS -fpic"
|
||||
|
||||
dnl add -fPIC option on Solaris if we are building dynamic extensions
|
||||
PHP_SOLARIS_PIC_WEIRDNESS
|
||||
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(PROG_SENDMAIL)
|
||||
AC_SUBST(CFLAGS_SHLIB)
|
||||
AC_SUBST(LDFLAGS_SHLIB)
|
||||
AC_SUBST(LDFLAGS_SHLIB_EXPORT)
|
||||
AC_SUBST(RPATHS)
|
||||
AC_SUBST(RAW_RPATHS)
|
||||
|
||||
PHP_BUILD_DATE=`date '+%Y-%m-%d'`
|
||||
AC_SUBST(PHP_BUILD_DATE)
|
||||
AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE")
|
||||
PHP_UNAME=`uname -a`
|
||||
AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME")
|
||||
PHP_OS=`uname`
|
||||
AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS")
|
||||
|
||||
AC_OUTPUT(Makefile libphp4.module php4.spec
|
||||
scripts/mkextlib regex/Makefile
|
||||
@@EXT_MAKEFILES@@ build-defs.h, [
|
||||
], [
|
||||
|
||||
if test ! -f $srcdir/ext/bcmath/number.c; then
|
||||
echo "creating number.c"
|
||||
echo "/* Dummy File */" > $srcdir/ext/bcmath/number.c
|
||||
echo "creating number.h"
|
||||
echo "/* Dummy File */" > $srcdir/ext/bcmath/number.h
|
||||
fi
|
||||
|
||||
if test "" = ""; then
|
||||
|
||||
chmod +x scripts/mkextlib
|
||||
# Hacking while airborne considered harmful.
|
||||
#
|
||||
echo "creating internal_functions.c"
|
||||
extensions=\`grep '^s.@EXT_STATIC@' \$0|sed -e 's/^.*@% *//' -e 's/%.*$//'\`
|
||||
mv -f internal_functions.c internal_functions.c.old 2>/dev/null
|
||||
sh $srcdir/genif.sh $srcdir/internal_functions.c.in $srcdir \$extensions > internal_functions.c
|
||||
if cmp internal_functions.c.old internal_functions.c > /dev/null 2>&1; then
|
||||
echo "internal_functions.c is unchanged"
|
||||
mv internal_functions.c.old internal_functions.c
|
||||
else
|
||||
rm -f internal_functions.c.old
|
||||
fi
|
||||
|
||||
# Warn about CGI version with no extra security options.
|
||||
if test "$BINNAME" = "php"; then
|
||||
if test "$REDIRECT" = "0"; then
|
||||
if test "$DISCARD_PATH" = "0"; then
|
||||
echo "+--------------------------------------------------------------------+"
|
||||
echo "| Warning: |"
|
||||
echo "| You will be compiling the CGI version of PHP without any |"
|
||||
echo "| redirection checking. By putting this cgi binary somewhere in |"
|
||||
echo "| your web space, users may be able to circumvent existing .htaccess |"
|
||||
echo "| security by loading files directly through the parser. See |"
|
||||
echo "| http://www.php.net/manual/config-security.php3 for more details. |"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "+--------------------------------------------------------------------+"
|
||||
echo "| License: |"
|
||||
echo "| This software is subject to the PHP License, available in this |"
|
||||
echo "| distribution in the file LICENSE. By continuing this installation |"
|
||||
echo "| process, you are bound by the terms of this license agreement. |"
|
||||
echo "| If you do not agree with the terms of this license, you must abort |"
|
||||
echo "| the installation process at this point. |"
|
||||
echo "+--------------------------------------------------------------------+"
|
||||
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
divert
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 4
|
||||
# End:
|
||||
@@ -0,0 +1,204 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on crypt.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=crypt - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to crypt - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "crypt - Win32 Release" && "$(CFG)" != "crypt - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!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 "crypt.mak" CFG="crypt - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "crypt - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "crypt - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "crypt - Win32 Release"
|
||||
|
||||
OUTDIR=.\module_Release
|
||||
INTDIR=.\module_Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\module_Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\php3_crypt.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\crypt.obj"
|
||||
-@erase "$(INTDIR)\sflcryp.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\php3_crypt.dll"
|
||||
-@erase "$(OUTDIR)\php3_crypt.exp"
|
||||
-@erase "$(OUTDIR)\php3_crypt.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /D HAVE_SFLCRYPT=1 /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\crypt.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\crypt.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_crypt.pdb" /machine:I386 /out:"$(OUTDIR)\php3_crypt.dll" /implib:"$(OUTDIR)\php3_crypt.lib" /libpath:"cgi_release"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\crypt.obj" \
|
||||
"$(INTDIR)\sflcryp.obj"
|
||||
|
||||
"$(OUTDIR)\php3_crypt.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "crypt - Win32 Debug"
|
||||
|
||||
OUTDIR=.\module_debug
|
||||
INTDIR=.\module_debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\module_debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\php3_crypt.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\crypt.obj"
|
||||
-@erase "$(INTDIR)\sflcryp.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\php3_crypt.dll"
|
||||
-@erase "$(OUTDIR)\php3_crypt.exp"
|
||||
-@erase "$(OUTDIR)\php3_crypt.ilk"
|
||||
-@erase "$(OUTDIR)\php3_crypt.lib"
|
||||
-@erase "$(OUTDIR)\php3_crypt.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /I "../../" /D HAVE_SFLCRYPT=1 /D "DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\crypt.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\crypt.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_crypt.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_crypt.dll" /implib:"$(OUTDIR)\php3_crypt.lib" /pdbtype:sept /libpath:"cgi_debug"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\crypt.obj" \
|
||||
"$(INTDIR)\sflcryp.obj"
|
||||
|
||||
"$(OUTDIR)\php3_crypt.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("crypt.dep")
|
||||
!INCLUDE "crypt.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "crypt.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "crypt - Win32 Release" || "$(CFG)" == "crypt - Win32 Debug"
|
||||
SOURCE=.\dl\crypt\crypt.c
|
||||
|
||||
"$(INTDIR)\crypt.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dl\crypt\sflcryp.c
|
||||
|
||||
"$(INTDIR)\sflcryp.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on dbase.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=dbase - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to dbase - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "dbase - Win32 Release" && "$(CFG)" != "dbase - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!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 "dbase.mak" CFG="dbase - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "dbase - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "dbase - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "dbase - Win32 Release"
|
||||
|
||||
OUTDIR=.\module_release
|
||||
INTDIR=.\module_release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\module_release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\php3_dbase.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\dbase.obj"
|
||||
-@erase "$(INTDIR)\dbf_head.obj"
|
||||
-@erase "$(INTDIR)\dbf_misc.obj"
|
||||
-@erase "$(INTDIR)\dbf_ndx.obj"
|
||||
-@erase "$(INTDIR)\dbf_rec.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\php3_dbase.dll"
|
||||
-@erase "$(OUTDIR)\php3_dbase.exp"
|
||||
-@erase "$(OUTDIR)\php3_dbase.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "dbase\\" /I "./" /I "../" /D DBASE=1 /D "NDEBUG" /D "THREAD_SAFE" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbase.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbase.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_dbase.pdb" /machine:I386 /out:"$(OUTDIR)\php3_dbase.dll" /implib:"$(OUTDIR)\php3_dbase.lib" /libpath:"cgi_release"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\dbase.obj" \
|
||||
"$(INTDIR)\dbf_head.obj" \
|
||||
"$(INTDIR)\dbf_misc.obj" \
|
||||
"$(INTDIR)\dbf_ndx.obj" \
|
||||
"$(INTDIR)\dbf_rec.obj"
|
||||
|
||||
"$(OUTDIR)\php3_dbase.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "dbase - Win32 Debug"
|
||||
|
||||
OUTDIR=.\module_debug
|
||||
INTDIR=.\module_debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\module_debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\php3_dbase.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\dbase.obj"
|
||||
-@erase "$(INTDIR)\dbf_head.obj"
|
||||
-@erase "$(INTDIR)\dbf_misc.obj"
|
||||
-@erase "$(INTDIR)\dbf_ndx.obj"
|
||||
-@erase "$(INTDIR)\dbf_rec.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\php3_dbase.dll"
|
||||
-@erase "$(OUTDIR)\php3_dbase.exp"
|
||||
-@erase "$(OUTDIR)\php3_dbase.ilk"
|
||||
-@erase "$(OUTDIR)\php3_dbase.lib"
|
||||
-@erase "$(OUTDIR)\php3_dbase.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "dbase\\" /I "./" /I "../" /D DBASE=1 /D "DEBUG" /D "_DEBUG" /D "THREAD_SAFE" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbase.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbase.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_dbase.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_dbase.dll" /implib:"$(OUTDIR)\php3_dbase.lib" /pdbtype:sept /libpath:"cgi_debug"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\dbase.obj" \
|
||||
"$(INTDIR)\dbf_head.obj" \
|
||||
"$(INTDIR)\dbf_misc.obj" \
|
||||
"$(INTDIR)\dbf_ndx.obj" \
|
||||
"$(INTDIR)\dbf_rec.obj"
|
||||
|
||||
"$(OUTDIR)\php3_dbase.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("dbase.dep")
|
||||
!INCLUDE "dbase.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "dbase.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "dbase - Win32 Release" || "$(CFG)" == "dbase - Win32 Debug"
|
||||
SOURCE=.\functions\dbase.c
|
||||
|
||||
"$(INTDIR)\dbase.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dbase\dbf_head.c
|
||||
|
||||
"$(INTDIR)\dbf_head.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dbase\dbf_misc.c
|
||||
|
||||
"$(INTDIR)\dbf_misc.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dbase\dbf_ndx.c
|
||||
|
||||
"$(INTDIR)\dbf_ndx.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\dbase\dbf_rec.c
|
||||
|
||||
"$(INTDIR)\dbf_rec.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on dbm.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=dbm - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to dbm - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "dbm - Win32 Release" && "$(CFG)" != "dbm - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!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 "dbm.mak" CFG="dbm - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "dbm - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "dbm - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "dbm - Win32 Release"
|
||||
|
||||
OUTDIR=.\module_release
|
||||
INTDIR=.\module_release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\module_release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\php3_dbm.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\db.obj"
|
||||
-@erase "$(INTDIR)\flock.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\php3_dbm.dll"
|
||||
-@erase "$(OUTDIR)\php3_dbm.exp"
|
||||
-@erase "$(OUTDIR)\php3_dbm.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D NDBM=1 /D GDBM=0 /D BSD2=1 /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbm.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbm.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:2 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_dbm.pdb" /machine:I386 /out:"$(OUTDIR)\php3_dbm.dll" /implib:"$(OUTDIR)\php3_dbm.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\db.obj" \
|
||||
"$(INTDIR)\flock.obj"
|
||||
|
||||
"$(OUTDIR)\php3_dbm.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "dbm - Win32 Debug"
|
||||
|
||||
OUTDIR=.\module_debug
|
||||
INTDIR=.\module_debug
|
||||
|
||||
ALL : "c:\php3\php3_dbm.dll"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\db.obj"
|
||||
-@erase "$(INTDIR)\flock.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\php3_dbm.exp"
|
||||
-@erase "$(OUTDIR)\php3_dbm.lib"
|
||||
-@erase "$(OUTDIR)\php3_dbm.pdb"
|
||||
-@erase "c:\php3\php3_dbm.dll"
|
||||
-@erase "c:\php3\php3_dbm.ilk"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /I "../../include" /D NDBM=1 /D GDBM=0 /D BSD2=1 /D "DEBUG" /D "_DEBUG" /D COMPILE_DL=1 /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbm.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbm.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=php.lib libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:2 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_dbm.pdb" /debug /machine:I386 /out:"c:\php3/php3_dbm.dll" /implib:"$(OUTDIR)\php3_dbm.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\db.obj" \
|
||||
"$(INTDIR)\flock.obj"
|
||||
|
||||
"c:\php3\php3_dbm.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("dbm.dep")
|
||||
!INCLUDE "dbm.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "dbm.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "dbm - Win32 Release" || "$(CFG)" == "dbm - Win32 Debug"
|
||||
SOURCE=.\functions\db.c
|
||||
|
||||
"$(INTDIR)\db.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\win32\flock.c
|
||||
|
||||
"$(INTDIR)\flock.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,418 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 1991 Kendall Bennett.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Filename: $RCSfile$
|
||||
* Version: $Revision$
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: any
|
||||
*
|
||||
* Description: Module to implement doubly linked lists. Includes a routine
|
||||
* to peform a mergesort on the doubly linked list.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Revision History:
|
||||
* -----------------
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.2 1999/05/11 00:01:42 zeev
|
||||
* * Get Apache to work. POST doesn't work yet.
|
||||
* * There are now -I directives for the absolute path of php4, php4/libzend and the builddir for
|
||||
* the Apache module, so we can #include any php/Zend header.
|
||||
* * Rename config.h to php_config.h
|
||||
*
|
||||
* Revision 1.1 1999/04/21 23:11:20 ssb
|
||||
* moved apache, com and hyperwave into ext/
|
||||
*
|
||||
* Revision 1.1.1.1 1999/04/07 21:03:31 zeev
|
||||
* PHP 4.0
|
||||
*
|
||||
* Revision 1.1.1.1 1999/03/17 04:29:11 andi
|
||||
* PHP4
|
||||
*
|
||||
* Revision 1.1.1.1 1998/12/21 07:56:22 andi
|
||||
* Trying to start the zend CVS tree
|
||||
*
|
||||
* Revision 1.1 1998/08/12 09:29:16 steinm
|
||||
* First version of Hyperwave module.
|
||||
*
|
||||
* Revision 1.5 91/12/31 19:39:49 kjb
|
||||
* Modified include file directories.
|
||||
*
|
||||
* Revision 1.4 91/10/28 03:16:39 kjb
|
||||
* Ported to the Iris.
|
||||
*
|
||||
* Revision 1.3 91/09/27 03:09:18 kjb
|
||||
* Cosmetic change.
|
||||
*
|
||||
* Revision 1.2 91/09/03 18:27:42 ROOT_DOS
|
||||
* Ported to UNIX.
|
||||
*
|
||||
* Revision 1.1 91/09/01 18:35:23 ROOT_DOS
|
||||
* Initial revision
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef MSVC5
|
||||
#include "php_config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <signal.h>
|
||||
#include "dlist.h"
|
||||
|
||||
#define PUBLIC
|
||||
#define PRIVATE static
|
||||
|
||||
PUBLIC void *dlst_newnode(int size)
|
||||
/****************************************************************************
|
||||
*
|
||||
* Function: dlst_newnode
|
||||
* Parameters: size - Amount of memory to allocate for node
|
||||
* Returns: Pointer to the allocated node's user space.
|
||||
*
|
||||
* Description: Allocates the memory required for a node, adding a small
|
||||
* header at the start of the node. We return a reference to
|
||||
* the user space of the node, as if it had been allocated via
|
||||
* malloc().
|
||||
*
|
||||
****************************************************************************/
|
||||
{
|
||||
PHP_DLST_BUCKET *node;
|
||||
|
||||
if ( !(node = (PHP_DLST_BUCKET*)malloc(size + sizeof(PHP_DLST_BUCKET))) ) {
|
||||
fprintf(stderr,"Not enough memory to allocate list node.\n");
|
||||
/* raise(SIGABRT);*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return PHP_DLST_USERSPACE(node); /* Return pointer to user space */
|
||||
}
|
||||
|
||||
PUBLIC void dlst_freenode(void *node)
|
||||
/****************************************************************************
|
||||
*
|
||||
* Function: dlst_freenode
|
||||
* Parameters: node - Node to free.
|
||||
*
|
||||
* Description: Frees a node previously allocated with lst_newnode().
|
||||
*
|
||||
****************************************************************************/
|
||||
{
|
||||
free(PHP_DLST_HEADER(node));
|
||||
}
|
||||
|
||||
PUBLIC DLIST *dlst_init(void)
|
||||
/****************************************************************************
|
||||
*
|
||||
* Function: dlst_init
|
||||
* Returns: Pointer to a newly created list.
|
||||
*
|
||||
* Description: Initialises a list and returns a pointer to it.
|
||||
*
|
||||
****************************************************************************/
|
||||
{
|
||||
DLIST *l;
|
||||
|
||||
if ((l = (DLIST*)malloc(sizeof(DLIST))) != NULL) {
|
||||
l->count = 0;
|
||||
l->head = &(l->hz[0]);
|
||||
l->z = &(l->hz[1]);
|
||||
l->head->next = l->z->next = l->z;
|
||||
l->z->prev = l->head->prev = l->head;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr,"Insufficient memory to allocate list\n");
|
||||
/*raise(SIGABRT);*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
PUBLIC void dlst_kill(DLIST *l,void (*freeNode)(void *node))
|
||||
/****************************************************************************
|
||||
*
|
||||
* Function: dlst_kill
|
||||
* Parameters: l - List to kill
|
||||
* freeNode - Pointer to user routine to free a node
|
||||
*
|
||||
* Description: Kills the list l, by deleting all of the elements contained
|
||||
* within the list one by one and then deleting the list
|
||||
* itself. Note that we call the user supplied routine
|
||||
* (*freeNode)() to free each list node. This allows the user
|
||||
* program to perform any extra processing needed to kill each
|
||||
* node (if each node contains pointers to other items on the
|
||||
* heap for example). If no extra processing is required, just
|
||||
* pass the address of dlst_freenode(), ie:
|
||||
*
|
||||
* dlst_kill(myList,dlst_freenode);
|
||||
*
|
||||
****************************************************************************/
|
||||
{
|
||||
PHP_DLST_BUCKET *n,*p;
|
||||
|
||||
n = l->head->next;
|
||||
while (n != l->z) { /* Free all nodes in list */
|
||||
p = n;
|
||||
n = n->next;
|
||||
(*freeNode)(PHP_DLST_USERSPACE(p));
|
||||
}
|
||||
free(l); /* Free the list itself */
|
||||
}
|
||||
|
||||
PUBLIC void dlst_insertafter(DLIST *l,void *node,void *after)
|
||||
/****************************************************************************
|
||||
*
|
||||
* Function: lst_insertafter
|
||||
* Parameters: l - List to insert node into
|
||||
* node - Pointer to user space of node to insert
|
||||
* after - Pointer to user space of node to insert node after
|
||||
*
|
||||
* Description: Inserts a new node into the list after the node 'after'. To
|
||||
* insert a new node at the beginning of the list, user the
|
||||
* macro PHP_DLST_HEAD in place of 'after'. ie:
|
||||
*
|
||||
* dlst_insertafter(mylist,node,PHP_DLST_HEAD(mylist));
|
||||
*
|
||||
****************************************************************************/
|
||||
{
|
||||
PHP_DLST_BUCKET *n = PHP_DLST_HEADER(node),*a = PHP_DLST_HEADER(after);
|
||||
|
||||
n->next = a->next;
|
||||
a->next = n;
|
||||
n->prev = a;
|
||||
n->next->prev = n;
|
||||
l->count++;
|
||||
}
|
||||
|
||||
PUBLIC void *dlst_deletenext(DLIST *l,void *node)
|
||||
/****************************************************************************
|
||||
*
|
||||
* Function: lst_deletenext
|
||||
* Parameters: l - List to delete node from.
|
||||
* node - Node to delete the next node from
|
||||
* Returns: Pointer to the deleted node's userspace.
|
||||
*
|
||||
* Description: Removes the node AFTER 'node' from the list l.
|
||||
*
|
||||
****************************************************************************/
|
||||
{
|
||||
PHP_DLST_BUCKET *n = PHP_DLST_HEADER(node);
|
||||
|
||||
node = PHP_DLST_USERSPACE(n->next);
|
||||
n->next->next->prev = n;
|
||||
n->next = n->next->next;
|
||||
l->count--;
|
||||
return node;
|
||||
}
|
||||
|
||||
PUBLIC void *dlst_first(DLIST *l)
|
||||
/****************************************************************************
|
||||
*
|
||||
* Function: dlst_first
|
||||
* Parameters: l - List to obtain first node from
|
||||
* Returns: Pointer to first node in list, NULL if list is empty.
|
||||
*
|
||||
* Description: Returns a pointer to the user space of the first node in
|
||||
* the list. If the list is empty, we return NULL.
|
||||
*
|
||||
****************************************************************************/
|
||||
{
|
||||
PHP_DLST_BUCKET *n;
|
||||
|
||||
n = l->head->next;
|
||||
return (n == l->z ? NULL : PHP_DLST_USERSPACE(n));
|
||||
}
|
||||
|
||||
PUBLIC void *dlst_last(DLIST *l)
|
||||
/****************************************************************************
|
||||
*
|
||||
* Function: dlst_last
|
||||
* Parameters: l - List to obtain last node from
|
||||
* Returns: Pointer to last node in list, NULL if list is empty.
|
||||
*
|
||||
* Description: Returns a pointer to the user space of the last node in
|
||||
* the list. If the list is empty, we return NULL.
|
||||
*
|
||||
****************************************************************************/
|
||||
{
|
||||
PHP_DLST_BUCKET *n;
|
||||
|
||||
n = l->z->prev;
|
||||
return (n == l->head ? NULL : PHP_DLST_USERSPACE(n));
|
||||
}
|
||||
|
||||
PUBLIC void *dlst_next(void *prev)
|
||||
/****************************************************************************
|
||||
*
|
||||
* Function: dlst_next
|
||||
* Parameters: prev - Previous node in list to obtain next node from
|
||||
* Returns: Pointer to the next node in the list, NULL at end of list.
|
||||
*
|
||||
* Description: Returns a pointer to the user space of the next node in the
|
||||
* list given a pointer to the user space of the previous node.
|
||||
* If we have reached the end of the list, we return NULL. The
|
||||
* end of the list is detected when the next pointer of a node
|
||||
* points back to itself, as does the dummy last node's next
|
||||
* pointer. This enables us to detect the end of the list
|
||||
* without needed access to the list data structure itself.
|
||||
*
|
||||
* NOTE: We do no checking to ensure that 'prev' is NOT a
|
||||
* NULL pointer.
|
||||
*
|
||||
****************************************************************************/
|
||||
{
|
||||
PHP_DLST_BUCKET *n = PHP_DLST_HEADER(prev);
|
||||
|
||||
n = n->next;
|
||||
return (n == n->next ? NULL : PHP_DLST_USERSPACE(n));
|
||||
}
|
||||
|
||||
PUBLIC void *dlst_prev(void *next)
|
||||
/****************************************************************************
|
||||
*
|
||||
* Function: dlst_prev
|
||||
* Parameters: next - Next node in list to obtain previous node from
|
||||
* Returns: Pointer to the previous node in the list, NULL at start list.
|
||||
*
|
||||
* Description: Returns a pointer to the user space of the prev node in the
|
||||
* list given a pointer to the user space of the next node.
|
||||
* If we have reached the start of the list, we return NULL. The
|
||||
* start of the list is detected when the prev pointer of a node
|
||||
* points back to itself, as does the dummy head node's prev
|
||||
* pointer. This enables us to detect the start of the list
|
||||
* without needed access to the list data structure itself.
|
||||
*
|
||||
* NOTE: We do no checking to ensure that 'next' is NOT a
|
||||
* NULL pointer.
|
||||
*
|
||||
****************************************************************************/
|
||||
{
|
||||
PHP_DLST_BUCKET *n = PHP_DLST_HEADER(next);
|
||||
|
||||
n = n->prev;
|
||||
return (n == n->prev ? NULL : PHP_DLST_USERSPACE(n));
|
||||
}
|
||||
|
||||
/* Static globals required by merge() */
|
||||
|
||||
static PHP_DLST_BUCKET *z;
|
||||
static int (*cmp)(void*,void*);
|
||||
|
||||
PRIVATE PHP_DLST_BUCKET *merge(PHP_DLST_BUCKET *a,PHP_DLST_BUCKET *b,PHP_DLST_BUCKET **end)
|
||||
/****************************************************************************
|
||||
*
|
||||
* Function: merge
|
||||
* Parameters: a,b - Sublist's to merge
|
||||
* Returns: Pointer to the merged sublists.
|
||||
*
|
||||
* Description: Merges two sorted lists of nodes together into a single
|
||||
* sorted list.
|
||||
*
|
||||
****************************************************************************/
|
||||
{
|
||||
PHP_DLST_BUCKET *c;
|
||||
|
||||
/* Go through the lists, merging them together in sorted order */
|
||||
|
||||
c = z;
|
||||
while (a != z && b != z) {
|
||||
if ((*cmp)(PHP_DLST_USERSPACE(a),PHP_DLST_USERSPACE(b)) <= 0) {
|
||||
c->next = a; c = a; a = a->next;
|
||||
}
|
||||
else {
|
||||
c->next = b; c = b; b = b->next;
|
||||
}
|
||||
};
|
||||
|
||||
/* If one of the lists is not exhausted, then re-attach it to the end
|
||||
* of the newly merged list
|
||||
*/
|
||||
|
||||
if (a != z) c->next = a;
|
||||
if (b != z) c->next = b;
|
||||
|
||||
/* Set *end to point to the end of the newly merged list */
|
||||
|
||||
while (c->next != z) c = c->next;
|
||||
*end = c;
|
||||
|
||||
/* Determine the start of the merged lists, and reset z to point to
|
||||
* itself
|
||||
*/
|
||||
|
||||
c = z->next; z->next = z;
|
||||
return c;
|
||||
}
|
||||
|
||||
PUBLIC void dlst_mergesort(DLIST *l,int (*cmp_func)(void*,void*))
|
||||
/****************************************************************************
|
||||
*
|
||||
* Function: dlst_mergesort
|
||||
* Parameters: l - List to merge sort
|
||||
* cmp_func - Function to compare two user spaces
|
||||
*
|
||||
* Description: Mergesort's all the nodes in the list. 'cmp' must point to
|
||||
* a comparison function that can compare the user spaces of
|
||||
* two different nodes. 'cmp' should work the same as
|
||||
* strcmp(), in terms of the values it returns. Rather than
|
||||
* waste processing time keeping the previous pointers up to
|
||||
* date while performing the mergesort, we simply run through
|
||||
* the list at the end of the sort to fix the previous pointers.
|
||||
*
|
||||
****************************************************************************/
|
||||
{
|
||||
int i,N;
|
||||
PHP_DLST_BUCKET *a,*b; /* Pointers to sublists to merge */
|
||||
PHP_DLST_BUCKET *c; /* Pointer to end of sorted sublists */
|
||||
PHP_DLST_BUCKET *head; /* Pointer to dummy head node for list */
|
||||
PHP_DLST_BUCKET *todo; /* Pointer to sublists yet to be sorted */
|
||||
PHP_DLST_BUCKET *t; /* Temporary */
|
||||
|
||||
/* Set up globals required by merge() and pointer to head */
|
||||
|
||||
z = l->z; cmp = cmp_func; head = l->head;
|
||||
|
||||
for (N = 1,a = z; a != head->next; N = N + N) {
|
||||
todo = head->next; c = head;
|
||||
while (todo != z) {
|
||||
|
||||
/* Build first sublist to be merged, and splice from main list
|
||||
*/
|
||||
|
||||
a = t = todo;
|
||||
for (i = 1; i < N; i++) t = t->next;
|
||||
b = t->next; t->next = z; t = b;
|
||||
|
||||
/* Build second sublist to be merged and splice from main list
|
||||
*/
|
||||
|
||||
for (i = 1; i < N; i++) t = t->next;
|
||||
todo = t->next; t->next = z;
|
||||
|
||||
/* Merge the two sublists created, and set 'c' to point to the
|
||||
* end of the newly merged sublists.
|
||||
*/
|
||||
|
||||
c->next = merge(a,b,&t); c = t;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fix the previous pointers for the list */
|
||||
|
||||
a = b = l->head;
|
||||
b = b->next;
|
||||
while (1) {
|
||||
b->prev = a;
|
||||
if (b == z)
|
||||
break;
|
||||
a = a->next;
|
||||
b = b->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 1991 Kendall Bennett.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Filename: $RCSfile$
|
||||
* Version: $Revision$
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: any
|
||||
*
|
||||
* Description: Header file for doubly linked list routines.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Revision History:
|
||||
* -----------------
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.1 1999/04/21 23:11:20 ssb
|
||||
* moved apache, com and hyperwave into ext/
|
||||
*
|
||||
* Revision 1.1.1.1 1999/04/07 21:03:20 zeev
|
||||
* PHP 4.0
|
||||
*
|
||||
* Revision 1.1.1.1 1999/03/17 04:29:11 andi
|
||||
* PHP4
|
||||
*
|
||||
* Revision 1.1.1.1 1998/12/21 07:56:22 andi
|
||||
* Trying to start the zend CVS tree
|
||||
*
|
||||
* Revision 1.2 1998/08/14 15:51:12 shane
|
||||
* Some work on getting hyperwave to work on windows. hg_comm needs a lot of work.
|
||||
*
|
||||
* Mainly, signals, fnctl, bzero, bcopy, etc are not portable functions. Most of this
|
||||
* will have to be rewriten for windows.
|
||||
*
|
||||
* Revision 1.1 1998/08/12 09:29:16 steinm
|
||||
* First version of Hyperwave module.
|
||||
*
|
||||
* Revision 1.5 91/12/31 19:40:54 kjb
|
||||
*
|
||||
* Modified include files directories.
|
||||
*
|
||||
* Revision 1.4 91/09/27 03:10:41 kjb
|
||||
* Added compatibility with C++.
|
||||
*
|
||||
* Revision 1.3 91/09/26 10:07:16 kjb
|
||||
* Took out extern references
|
||||
*
|
||||
* Revision 1.2 91/09/01 19:37:20 ROOT_DOS
|
||||
* Changed DLST_TAIL macro so that it returns a pointer to the REAL last
|
||||
* node of the list, not the dummy last node (l->z).
|
||||
*
|
||||
* Revision 1.1 91/09/01 18:38:23 ROOT_DOS
|
||||
* Initial revision
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __DLIST_H
|
||||
#define __DLIST_H
|
||||
|
||||
#ifndef __DEBUG_H
|
||||
/*#include "debug.h"*/
|
||||
#endif
|
||||
|
||||
/*---------------------- Macros and type definitions ----------------------*/
|
||||
|
||||
typedef struct PHP_DLST_BUCKET {
|
||||
struct PHP_DLST_BUCKET *next;
|
||||
struct PHP_DLST_BUCKET *prev;
|
||||
} PHP_DLST_BUCKET;
|
||||
|
||||
/* necessary for AIX 4.2.x */
|
||||
|
||||
#ifdef hz
|
||||
#undef hz
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int count; /* Number of elements currently in list */
|
||||
PHP_DLST_BUCKET *head; /* Pointer to head element of list */
|
||||
PHP_DLST_BUCKET *z; /* Pointer to last node of list */
|
||||
PHP_DLST_BUCKET hz[2]; /* Space for head and z nodes */
|
||||
} DLIST;
|
||||
|
||||
/* Return a pointer to the user space given the address of the header of
|
||||
* a node.
|
||||
*/
|
||||
|
||||
#define PHP_DLST_USERSPACE(h) ((void*)((PHP_DLST_BUCKET*)(h) + 1))
|
||||
|
||||
/* Return a pointer to the header of a node, given the address of the
|
||||
* user space.
|
||||
*/
|
||||
|
||||
#define PHP_DLST_HEADER(n) ((PHP_DLST_BUCKET*)(n) - 1)
|
||||
|
||||
/* Return a pointer to the user space of the list's head node. This user
|
||||
* space does not actually exist, but it is useful to be able to address
|
||||
* it to enable insertion at the start of the list.
|
||||
*/
|
||||
|
||||
#define PHP_DLST_HEAD(l) PHP_DLST_USERSPACE((l)->head)
|
||||
|
||||
/* Return a pointer to the user space of the last node in list. */
|
||||
|
||||
#define PHP_DLST_TAIL(l) PHP_DLST_USERSPACE((l)->z->prev)
|
||||
|
||||
/* Determine if a list is empty
|
||||
*/
|
||||
|
||||
#define PHP_DLST_EMPTY(l) ((l)->count == 0)
|
||||
|
||||
/*-------------------------- Function Prototypes --------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void *dlst_newnode(int size);
|
||||
void dlst_freenode(void *node);
|
||||
DLIST *dlst_init(void);
|
||||
void dlst_kill(DLIST *l,void (*freeNode)(void *node));
|
||||
void dlst_insertafter(DLIST *l,void *node,void *after);
|
||||
void *dlst_deletenext(DLIST *l,void *node);
|
||||
void *dlst_first(DLIST *l);
|
||||
void *dlst_last(DLIST *l);
|
||||
void *dlst_next(void *prev);
|
||||
void *dlst_prev(void *next);
|
||||
void dlst_mergesort(DLIST *l,int (*cmp_func)(void*,void*));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SUBDIRS = @EXT_SUBDIRS@
|
||||
EXT_STATIC = @EXT_STATIC@
|
||||
|
||||
noinst_LIBRARIES=libphpext.a
|
||||
|
||||
libphpext.a: @EXT_LIBS@
|
||||
top_srcdir=$(top_srcdir) $(top_builddir)/scripts/mkextlib $@ $(EXT_STATIC)
|
||||
-@test "`uname -s`" = "Rhapsody" && $(RANLIB) $@
|
||||
@@ -0,0 +1,6 @@
|
||||
# $Id$
|
||||
|
||||
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
|
||||
noinst_LIBRARIES=libphpext_apache.a
|
||||
libphpext_apache_a_SOURCES=apache.c
|
||||
|
||||
@@ -0,0 +1,448 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997, 1998, 1999 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
|
||||
| Stig Sæther Bakken <ssb@guardian.no> |
|
||||
| David Sklar <sklar@student.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
#include "php.h"
|
||||
#include "ext/standard/head.h"
|
||||
#include "php_globals.h"
|
||||
#include "php_ini.h"
|
||||
#include "SAPI.h"
|
||||
#include "mod_php4.h"
|
||||
#include "ext/standard/info.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if APACHE
|
||||
#include "http_request.h"
|
||||
#include "build-defs.h"
|
||||
|
||||
#define SECTION(name) PUTS("<hr><h2>" name "</h2>\n")
|
||||
|
||||
extern module *top_module;
|
||||
|
||||
PHP_FUNCTION(virtual);
|
||||
PHP_FUNCTION(getallheaders);
|
||||
PHP_FUNCTION(apachelog);
|
||||
PHP_FUNCTION(apache_note);
|
||||
PHP_FUNCTION(apache_lookup_uri);
|
||||
|
||||
PHP_MINFO_FUNCTION(apache);
|
||||
|
||||
function_entry apache_functions[] = {
|
||||
PHP_FE(virtual, NULL)
|
||||
PHP_FE(getallheaders, NULL)
|
||||
PHP_FE(apache_note, NULL)
|
||||
PHP_FE(apache_lookup_uri, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
static PHP_INI_MH(OnChangeApacheInt)
|
||||
{
|
||||
long *p;
|
||||
char *base = (char *) &php_apache_info;
|
||||
|
||||
p = (long *) (base+(size_t) mh_arg1);
|
||||
|
||||
if (new_value) {
|
||||
*p = atoi(new_value);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static PHP_INI_MH(OnChangeApacheString)
|
||||
{
|
||||
char **p;
|
||||
char *base = (char *) &php_apache_info;
|
||||
|
||||
p = (char **) (base+(size_t) mh_arg1);
|
||||
|
||||
if (new_value) {
|
||||
*p = new_value;
|
||||
return SUCCESS;
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
PHP_INI_BEGIN()
|
||||
PHP_INI_ENTRY1("xbithack", "0", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, xbithack))
|
||||
PHP_INI_ENTRY1("engine", "1", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, engine))
|
||||
PHP_INI_ENTRY1("last_modified", "0", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, last_modified))
|
||||
PHP_INI_ENTRY1("dav_script", NULL, PHP_INI_ALL, OnChangeApacheString, (void *) XtOffsetOf(php_apache_info_struct, dav_script))
|
||||
PHP_INI_END()
|
||||
|
||||
|
||||
static PHP_MINIT_FUNCTION(apache)
|
||||
{
|
||||
REGISTER_INI_ENTRIES();
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static PHP_MSHUTDOWN_FUNCTION(apache)
|
||||
{
|
||||
UNREGISTER_INI_ENTRIES();
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
php3_module_entry apache_module_entry = {
|
||||
"Apache", apache_functions, PHP_MINIT(apache), PHP_MSHUTDOWN(apache), NULL, NULL, PHP_MINFO(apache), STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
/* {{{ proto string apache_note(string note_name [, string note_value])
|
||||
Get and set Apache request notes */
|
||||
PHP_FUNCTION(apache_note)
|
||||
{
|
||||
pval *arg_name,*arg_val;
|
||||
char *note_val;
|
||||
int arg_count = ARG_COUNT(ht);
|
||||
SLS_FETCH();
|
||||
|
||||
if (arg_count<1 || arg_count>2 ||
|
||||
getParameters(ht,arg_count,&arg_name,&arg_val) == FAILURE ) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_string(arg_name);
|
||||
note_val = (char *) table_get(((request_rec *) SG(server_context))->notes,arg_name->value.str.val);
|
||||
|
||||
if (arg_count == 2) {
|
||||
convert_to_string(arg_val);
|
||||
table_set(((request_rec *) SG(server_context))->notes,arg_name->value.str.val,arg_val->value.str.val);
|
||||
}
|
||||
|
||||
if (note_val) {
|
||||
RETURN_STRING(note_val,1);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
PHP_MINFO_FUNCTION(apache)
|
||||
{
|
||||
module *modp = NULL;
|
||||
char output_buf[128];
|
||||
#if !defined(WIN32) && !defined(WINNT)
|
||||
char name[64];
|
||||
char *p;
|
||||
#endif
|
||||
server_rec *serv;
|
||||
extern char server_root[MAX_STRING_LEN];
|
||||
extern uid_t user_id;
|
||||
extern char *user_name;
|
||||
extern gid_t group_id;
|
||||
extern int max_requests_per_child;
|
||||
SLS_FETCH();
|
||||
|
||||
serv = ((request_rec *) SG(server_context))->server;
|
||||
|
||||
PUTS("<table border=5 width=\"600\">\n");
|
||||
php_info_print_table_header(2, "Entry", "Value");
|
||||
#if WIN32|WINNT
|
||||
PUTS("Apache for Windows 95/NT<br>");
|
||||
#else
|
||||
php_info_print_table_row(2, "APACHE_INCLUDE", PHP_APACHE_INCLUDE);
|
||||
php_info_print_table_row(2, "APACHE_TARGET", PHP_APACHE_TARGET);
|
||||
#endif
|
||||
php_info_print_table_row(2, "Apache Version", SERVER_VERSION);
|
||||
#ifdef APACHE_RELEASE
|
||||
sprintf(output_buf, "%d", APACHE_RELEASE);
|
||||
php_info_print_table_row(2, "Apache Release", output_buf);
|
||||
#endif
|
||||
sprintf(output_buf, "%d", MODULE_MAGIC_NUMBER);
|
||||
php_info_print_table_row(2, "Apache API Version", output_buf);
|
||||
sprintf(output_buf, "%s:%u", serv->server_hostname,serv->port);
|
||||
php_info_print_table_row(2, "Hostname/Port", output_buf);
|
||||
#if !defined(WIN32) && !defined(WINNT)
|
||||
sprintf(output_buf, "%s(%d)/%d", user_name,(int)user_id,(int)group_id);
|
||||
php_info_print_table_row(2, "User/Group", output_buf);
|
||||
sprintf(output_buf, "per child: %d<br>keep alive: %s<br>max per connection: %d",max_requests_per_child,serv->keep_alive ? "on":"off", serv->keep_alive_max);
|
||||
php_info_print_table_row(2, "Max Requests", output_buf);
|
||||
#endif
|
||||
sprintf(output_buf, "connection: %d<br>keep-alive: %d",serv->timeout,serv->keep_alive_timeout);
|
||||
php_info_print_table_row(2, "Timeouts", output_buf);
|
||||
#if !defined(WIN32) && !defined(WINNT)
|
||||
php_info_print_table_row(2, "Server Root", server_root);
|
||||
|
||||
|
||||
PUTS("<tr><td valign=\"top\" bgcolor=\"" PHP_ENTRY_NAME_COLOR "\">Loaded modules</td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">");
|
||||
for(modp = top_module; modp; modp = modp->next) {
|
||||
strncpy(name, modp->name, sizeof(name) - 1);
|
||||
if ((p = strrchr(name, '.'))) {
|
||||
*p='\0'; /* Cut off ugly .c extensions on module names */
|
||||
}
|
||||
PUTS(name);
|
||||
if (modp->next) {
|
||||
PUTS(", ");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
PUTS("</td></tr>\n");
|
||||
PUTS("</table>\n");
|
||||
|
||||
|
||||
{
|
||||
register int i;
|
||||
array_header *arr;
|
||||
table_entry *elts;
|
||||
request_rec *r;
|
||||
SLS_FETCH();
|
||||
|
||||
r = ((request_rec *) SG(server_context));
|
||||
arr = table_elts(r->subprocess_env);
|
||||
elts = (table_entry *)arr->elts;
|
||||
|
||||
SECTION("Apache Environment");
|
||||
PUTS("<table border=5 width=\"600\">\n");
|
||||
php_info_print_table_header(2, "Variable", "Value");
|
||||
for (i=0; i < arr->nelts; i++) {
|
||||
php_info_print_table_row(2, elts[i].key, elts[i].val);
|
||||
}
|
||||
PUTS("</table>\n");
|
||||
}
|
||||
|
||||
{
|
||||
array_header *env_arr;
|
||||
table_entry *env;
|
||||
int i;
|
||||
request_rec *r;
|
||||
SLS_FETCH();
|
||||
|
||||
r = ((request_rec *) SG(server_context));
|
||||
SECTION("HTTP Headers Information");
|
||||
PUTS("<table border=5 width=\"600\">\n");
|
||||
PUTS(" <tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Request Headers</th></tr>\n");
|
||||
php_info_print_table_row(2, "HTTP Request", r->the_request);
|
||||
env_arr = table_elts(r->headers_in);
|
||||
env = (table_entry *)env_arr->elts;
|
||||
for (i = 0; i < env_arr->nelts; ++i) {
|
||||
if (env[i].key) {
|
||||
php_info_print_table_row(2, env[i].key, env[i].val);
|
||||
}
|
||||
}
|
||||
PUTS(" <tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Response Headers</th></tr>\n");
|
||||
env_arr = table_elts(r->headers_out);
|
||||
env = (table_entry *)env_arr->elts;
|
||||
for(i = 0; i < env_arr->nelts; ++i) {
|
||||
if (env[i].key) {
|
||||
php_info_print_table_row(2, env[i].key, env[i].val);
|
||||
}
|
||||
}
|
||||
PUTS("</table>\n\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* This function is equivalent to <!--#include virtual...-->
|
||||
* in mod_include. It does an Apache sub-request. It is useful
|
||||
* for including CGI scripts or .shtml files, or anything else
|
||||
* that you'd parse through Apache (for .phtml files, you'd probably
|
||||
* want to use <?Include>. This only works when PHP is compiled
|
||||
* as an Apache module, since it uses the Apache API for doing
|
||||
* sub requests.
|
||||
*/
|
||||
/* {{{ proto int virtual(string filename)
|
||||
Perform an Apache sub-request */
|
||||
PHP_FUNCTION(virtual)
|
||||
{
|
||||
pval *filename;
|
||||
request_rec *rr = NULL;
|
||||
SLS_FETCH();
|
||||
|
||||
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string(filename);
|
||||
|
||||
if (!(rr = sub_req_lookup_uri (filename->value.str.val, ((request_rec *) SG(server_context))))) {
|
||||
php_error(E_WARNING, "Unable to include '%s' - URI lookup failed", filename->value.str.val);
|
||||
if (rr) destroy_sub_req (rr);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (rr->status != 200) {
|
||||
php_error(E_WARNING, "Unable to include '%s' - error finding URI", filename->value.str.val);
|
||||
if (rr) destroy_sub_req (rr);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* Cannot include another PHP file because of global conflicts */
|
||||
if (rr->content_type &&
|
||||
!strcmp(rr->content_type, PHP3_MIME_TYPE)) {
|
||||
php_error(E_WARNING, "Cannot include a PHP file "
|
||||
"(use <code><?include \"%s\"></code> instead)", filename->value.str.val);
|
||||
if (rr) destroy_sub_req (rr);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (run_sub_req(rr)) {
|
||||
php_error(E_WARNING, "Unable to include '%s' - request execution failed", filename->value.str.val);
|
||||
if (rr) destroy_sub_req (rr);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
if (rr) destroy_sub_req (rr);
|
||||
RETURN_TRUE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array getallheaders(void)
|
||||
Fetch all HTTP request headers */
|
||||
PHP_FUNCTION(getallheaders)
|
||||
{
|
||||
array_header *env_arr;
|
||||
table_entry *tenv;
|
||||
int i;
|
||||
SLS_FETCH();
|
||||
|
||||
if (array_init(return_value) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
env_arr = table_elts(((request_rec *) SG(server_context))->headers_in);
|
||||
tenv = (table_entry *)env_arr->elts;
|
||||
for (i = 0; i < env_arr->nelts; ++i) {
|
||||
if (!tenv[i].key ||
|
||||
(PG(safe_mode) &&
|
||||
!strncasecmp(tenv[i].key, "authorization", 13))) {
|
||||
continue;
|
||||
}
|
||||
if (add_assoc_string(return_value, tenv[i].key,(tenv[i].val==NULL) ? "" : tenv[i].val, 1)==FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto class apache_lookup_uri(string URI)
|
||||
Perform a partial request of the given URI to obtain information about it */
|
||||
PHP_FUNCTION(apache_lookup_uri)
|
||||
{
|
||||
pval *filename;
|
||||
request_rec *rr=NULL;
|
||||
SLS_FETCH();
|
||||
|
||||
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string(filename);
|
||||
|
||||
if(!(rr = sub_req_lookup_uri(filename->value.str.val, ((request_rec *) SG(server_context))))) {
|
||||
php_error(E_WARNING, "URI lookup failed", filename->value.str.val);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
object_init(return_value);
|
||||
add_property_long(return_value,"status",rr->status);
|
||||
if (rr->the_request) {
|
||||
add_property_string(return_value,"the_request",rr->the_request,1);
|
||||
}
|
||||
if (rr->status_line) {
|
||||
add_property_string(return_value,"status_line",(char *)rr->status_line,1);
|
||||
}
|
||||
if (rr->method) {
|
||||
add_property_string(return_value,"method",(char *)rr->method,1);
|
||||
}
|
||||
if (rr->content_type) {
|
||||
add_property_string(return_value,"content_type",(char *)rr->content_type,1);
|
||||
}
|
||||
if (rr->handler) {
|
||||
add_property_string(return_value,"handler",(char *)rr->handler,1);
|
||||
}
|
||||
if (rr->uri) {
|
||||
add_property_string(return_value,"uri",rr->uri,1);
|
||||
}
|
||||
if (rr->filename) {
|
||||
add_property_string(return_value,"filename",rr->filename,1);
|
||||
}
|
||||
if (rr->path_info) {
|
||||
add_property_string(return_value,"path_info",rr->path_info,1);
|
||||
}
|
||||
if (rr->args) {
|
||||
add_property_string(return_value,"args",rr->args,1);
|
||||
}
|
||||
if (rr->boundary) {
|
||||
add_property_string(return_value,"boundary",rr->boundary,1);
|
||||
}
|
||||
add_property_long(return_value,"no_cache",rr->no_cache);
|
||||
add_property_long(return_value,"no_local_copy",rr->no_local_copy);
|
||||
add_property_long(return_value,"allowed",rr->allowed);
|
||||
add_property_long(return_value,"sent_bodyct",rr->sent_bodyct);
|
||||
add_property_long(return_value,"bytes_sent",rr->bytes_sent);
|
||||
add_property_long(return_value,"byterange",rr->byterange);
|
||||
add_property_long(return_value,"clength",rr->clength);
|
||||
|
||||
#if MODULE_MAGIC_NUMBER >= 19980324
|
||||
if (rr->unparsed_uri) {
|
||||
add_property_string(return_value,"unparsed_uri",rr->unparsed_uri,1);
|
||||
}
|
||||
if(rr->mtime) {
|
||||
add_property_long(return_value,"mtime",rr->mtime);
|
||||
}
|
||||
#endif
|
||||
if(rr->request_time) {
|
||||
add_property_long(return_value,"request_time",rr->request_time);
|
||||
}
|
||||
|
||||
destroy_sub_req(rr);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if 0
|
||||
This function is most likely a bad idea. Just playing with it for now.
|
||||
|
||||
PHP_FUNCTION(apache_exec_uri)
|
||||
{
|
||||
pval *filename;
|
||||
request_rec *rr=NULL;
|
||||
SLS_FETCH();
|
||||
|
||||
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string(filename);
|
||||
|
||||
if(!(rr = ap_sub_req_lookup_uri(filename->value.str.val, ((request_rec *) SG(server_context))))) {
|
||||
php_error(E_WARNING, "URI lookup failed", filename->value.str.val);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETVAL_LONG(ap_run_sub_req(rr));
|
||||
ap_destroy_sub_req(rr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
@@ -0,0 +1,5 @@
|
||||
dnl $Id$
|
||||
|
||||
if test -n "$APACHE_INCLUDE"; then
|
||||
PHP_EXTENSION(apache)
|
||||
fi
|
||||
@@ -0,0 +1,6 @@
|
||||
# $Id$
|
||||
|
||||
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
|
||||
noinst_LIBRARIES=libphpext_aspell.a
|
||||
libphpext_aspell_a_SOURCES=aspell.c
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997, 1998, 1999 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include "php.h"
|
||||
#if defined(COMPILE_DL)
|
||||
#include "phpdl.h"
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if HAVE_ASPELL
|
||||
|
||||
#include "php3_aspell.h"
|
||||
#if APACHE
|
||||
# ifndef DEBUG
|
||||
# undef palloc
|
||||
# endif
|
||||
#endif
|
||||
#include <aspell-c.h>
|
||||
|
||||
function_entry aspell_functions[] = {
|
||||
PHP_FE(aspell_new, NULL)
|
||||
PHP_FE(aspell_check, NULL)
|
||||
PHP_FE(aspell_check_raw, NULL)
|
||||
PHP_FE(aspell_suggest, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
static int le_aspell;
|
||||
|
||||
php3_module_entry aspell_module_entry = {
|
||||
"Aspell", aspell_functions, PHP_MINIT(aspell), NULL, NULL, NULL, PHP_MINFO(aspell), STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
|
||||
#if COMPILE_DL
|
||||
DLEXPORT php3_module_entry *get_module(void) { return &aspell_module_entry; }
|
||||
#endif
|
||||
|
||||
PHP_MINIT_FUNCTION(aspell)
|
||||
{
|
||||
le_aspell = register_list_destructors(php3_aspell_close,NULL);
|
||||
return SUCCESS;
|
||||
|
||||
}
|
||||
void php3_aspell_close(aspell *sc)
|
||||
{
|
||||
aspell_free(sc);
|
||||
}
|
||||
|
||||
/* {{{ proto int aspell_new(string master[, string personal])
|
||||
Load a dictionary */
|
||||
PHP_FUNCTION(aspell_new)
|
||||
{
|
||||
pval *master, *personal;
|
||||
int argc;
|
||||
aspell *sc;
|
||||
int ind;
|
||||
|
||||
argc = ARG_COUNT(ht);
|
||||
if (argc < 1 || argc > 2 || getParameters(ht, argc, &master,&personal) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_string(master);
|
||||
if(argc==2)
|
||||
{
|
||||
convert_to_string(personal) ;
|
||||
sc=aspell_new(master->value.str.val,personal->value.str.val);
|
||||
}
|
||||
else
|
||||
sc=aspell_new(master->value.str.val,"");
|
||||
|
||||
ind = php3_list_insert(sc, le_aspell);
|
||||
RETURN_LONG(ind);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto array aspell_suggest(aspell int,string word)
|
||||
Return array of Suggestions */
|
||||
PHP_FUNCTION(aspell_suggest)
|
||||
{
|
||||
pval *scin, *word;
|
||||
int argc;
|
||||
aspell *sc;
|
||||
int ind,type;
|
||||
aspellSuggestions *sug;
|
||||
size_t i;
|
||||
|
||||
|
||||
argc = ARG_COUNT(ht);
|
||||
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(scin);
|
||||
convert_to_string(word);
|
||||
sc= (aspell *) php3_list_find(scin->value.lval, &type);
|
||||
if(!sc)
|
||||
{
|
||||
php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (array_init(return_value) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
sug = aspell_suggest(sc, word->value.str.val);
|
||||
for (i = 0; i != sug->size; ++i) {
|
||||
add_next_index_string(return_value,(char *)sug->data[i],1);
|
||||
}
|
||||
aspell_free_suggestions(sug);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int aspell_check(aspell int,string word)
|
||||
Return if word is valid */
|
||||
PHP_FUNCTION(aspell_check)
|
||||
{
|
||||
int type;
|
||||
pval *scin,*word;
|
||||
aspell *sc;
|
||||
|
||||
int argc;
|
||||
argc = ARG_COUNT(ht);
|
||||
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(scin);
|
||||
convert_to_string(word);
|
||||
sc= (aspell *) php3_list_find(scin->value.lval, &type);
|
||||
if(!sc)
|
||||
{
|
||||
php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (aspell_check(sc, word->value.str.val))
|
||||
{
|
||||
RETURN_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int aspell_check_raw(aspell int,string word)
|
||||
Return if word is valid, ignoring case or trying to trim it in any way*/
|
||||
PHP_FUNCTION(aspell_check_raw)
|
||||
{
|
||||
pval *scin,*word;
|
||||
int type;
|
||||
int argc;
|
||||
aspell *sc;
|
||||
|
||||
argc = ARG_COUNT(ht);
|
||||
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long(scin);
|
||||
convert_to_string(word);
|
||||
sc= (aspell *) php3_list_find(scin->value.lval, &type);
|
||||
if(!sc)
|
||||
{
|
||||
php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (aspell_check_raw(sc, word->value.str.val))
|
||||
{
|
||||
RETURN_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
PHP_MINFO_FUNCTION(aspell)
|
||||
{
|
||||
php_printf("ASpell support enabled");
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,4 @@
|
||||
/* Define if you want the ASPELL interface */
|
||||
#ifndef HAVE_ASPELL
|
||||
#define HAVE_ASPELL 0
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
dnl $Id$
|
||||
|
||||
AC_MSG_CHECKING(for ASPELL support)
|
||||
AC_ARG_WITH(aspell,
|
||||
[ --with-aspell[=DIR] Include ASPELL support.],
|
||||
[
|
||||
if test "$withval" != "no"; then
|
||||
if test "$withval" = "yes"; then
|
||||
ASPELL_DIR=/usr/local
|
||||
else
|
||||
ASPELL_DIR=$withval
|
||||
fi
|
||||
|
||||
AC_ADD_INCLUDE($ASPELL_DIR/include)
|
||||
AC_ADD_LIBRARY_WITH_PATH(aspell, $ASPELL_DIR/lib)
|
||||
|
||||
if test ! -f "$ASPELL_DIR/include/aspell-c.h"; then
|
||||
AC_MSG_ERROR(Could not find aspell-c.h in $ASPELL_DIR/include - please copy it manually from the aspell sources to $ASPELL_DIR/include)
|
||||
fi
|
||||
AC_DEFINE(HAVE_ASPELL)
|
||||
AC_MSG_RESULT(yes)
|
||||
PHP_EXTENSION(aspell)
|
||||
else
|
||||
AC_MSG_ERROR(no)
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP HTML Embedded Scripting Language Version 3.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-1999 PHP Development Team (See Credits file) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This program is free software; you can redistribute it and/or modify |
|
||||
| it under the terms of one of the following licenses: |
|
||||
| |
|
||||
| A) 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. |
|
||||
| |
|
||||
| B) the PHP License as published by the PHP Development Team and |
|
||||
| included in the distribution in the file: LICENSE |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
| |
|
||||
| You should have received a copy of both licenses referred to here. |
|
||||
| If you did not, or have any questions about PHP licensing, please |
|
||||
| contact core@php.net. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _ASPELL_H
|
||||
#define _ASPELL_H
|
||||
#if HAVE_ASPELL
|
||||
extern php3_module_entry aspell_module_entry;
|
||||
#define aspell_module_ptr &aspell_module_entry
|
||||
|
||||
extern PHP_MINIT_FUNCTION(aspell);
|
||||
extern PHP_MINFO_FUNCTION(aspell);
|
||||
extern void php3_aspell_close();
|
||||
|
||||
PHP_FUNCTION(aspell_new);
|
||||
PHP_FUNCTION(aspell_check);
|
||||
PHP_FUNCTION(aspell_check_raw);
|
||||
PHP_FUNCTION(aspell_suggest);
|
||||
|
||||
#else
|
||||
#define aspell_module_ptr NULL
|
||||
#endif
|
||||
|
||||
#define phpext_aspell_ptr aspell_module_ptr
|
||||
|
||||
#endif /* _ASPELL_H */
|
||||
Loaded 100 of 642 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user