mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-12 03:30:50 +00:00
Compare commits
511
Commits
php-4.3.5
...
php-4.3.10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79e7914724 | ||
|
|
84a696da20 | ||
|
|
19d0000632 | ||
|
|
5a4b7f9c30 | ||
|
|
bb2e9ef00c | ||
|
|
6cd0a77372 | ||
|
|
f137de1506 | ||
|
|
aea9676eb0 | ||
|
|
67524ef7c9 | ||
|
|
a5d9c87d49 | ||
|
|
87cae0e01b | ||
|
|
b4b338a8d1 | ||
|
|
fe29c8def5 | ||
|
|
251851dbb3 | ||
|
|
6416003e95 | ||
|
|
db633a0760 | ||
|
|
aff3259a25 | ||
|
|
9b72bcfd99 | ||
|
|
d2bf5faa4f | ||
|
|
eea7fbdd4f | ||
|
|
dcfe66f9d7 | ||
|
|
61442c339f | ||
|
|
3d2bc043a7 | ||
|
|
2381aecca9 | ||
|
|
14c6cd1788 | ||
|
|
d059006b67 | ||
|
|
95d9d7069a | ||
|
|
aea33db8bb | ||
|
|
9ab7598560 | ||
|
|
a21c4e544f | ||
|
|
ccbb17575a | ||
|
|
0cd60dedad | ||
|
|
1686229772 | ||
|
|
0520c88818 | ||
|
|
bc0b61d250 | ||
|
|
fa3568d490 | ||
|
|
84b568c4be | ||
|
|
ef56c2d1ee | ||
|
|
aa65def360 | ||
|
|
26b45cf15f | ||
|
|
8aa0e89801 | ||
|
|
0c23ef8d85 | ||
|
|
aa3971b119 | ||
|
|
5cc3311229 | ||
|
|
78388bd7c5 | ||
|
|
5742bd2c52 | ||
|
|
169205c41a | ||
|
|
7335ef4d30 | ||
|
|
fb8f2ff8e4 | ||
|
|
918be06876 | ||
|
|
909ad657e1 | ||
|
|
2abee83ee1 | ||
|
|
a09961a655 | ||
|
|
07392ae5f1 | ||
|
|
6fcaae369a | ||
|
|
c30a032552 | ||
|
|
a3ee846047 | ||
|
|
6b59cbbdd7 | ||
|
|
2cf6532d17 | ||
|
|
fc627a4fa1 | ||
|
|
0a2b8eb991 | ||
|
|
ec7db7ced2 | ||
|
|
41dca25055 | ||
|
|
57c2b685d7 | ||
|
|
4eb5de66a4 | ||
|
|
0823cf28da | ||
|
|
3775b78197 | ||
|
|
be6160f0f9 | ||
|
|
6db1b839c8 | ||
|
|
581e6a7ea8 | ||
|
|
4bd84a5e69 | ||
|
|
b5d739b88b | ||
|
|
ef30fa2ee0 | ||
|
|
0e33da898f | ||
|
|
e018da1aa3 | ||
|
|
963d068fd5 | ||
|
|
189654d882 | ||
|
|
4ac1241426 | ||
|
|
edd4e6525a | ||
|
|
2c14b8fd21 | ||
|
|
4c04d243da | ||
|
|
9f38730cf9 | ||
|
|
b9a5843251 | ||
|
|
ac0a29b046 | ||
|
|
92c8f6ce9b | ||
|
|
cdac193f9f | ||
|
|
81c614a1ef | ||
|
|
21c8eb93ba | ||
|
|
e0fc58c29f | ||
|
|
a451f1c9e4 | ||
|
|
26ed6ea8b2 | ||
|
|
a4e90790c4 | ||
|
|
2b2129c057 | ||
|
|
e4fadfcd89 | ||
|
|
02b50acd93 | ||
|
|
4ab0cd7dcb | ||
|
|
8cb520a855 | ||
|
|
06a0021a55 | ||
|
|
63b0419766 | ||
|
|
1701079235 | ||
|
|
9a27a01007 | ||
|
|
045499b31f | ||
|
|
bcb3eb98a8 | ||
|
|
3b3ef4c5ee | ||
|
|
62e23967ee | ||
|
|
5b683f14f5 | ||
|
|
75ae21df6d | ||
|
|
f890a666a8 | ||
|
|
db953cd7ff | ||
|
|
bf3ad32af1 | ||
|
|
018f7b5094 | ||
|
|
2a4fc5e0ee | ||
|
|
388504729f | ||
|
|
a360086291 | ||
|
|
6abde062a9 | ||
|
|
972ec73cb1 | ||
|
|
637a9710a1 | ||
|
|
d564087e47 | ||
|
|
9e8ce192df | ||
|
|
48a22e8997 | ||
|
|
f3313b21b6 | ||
|
|
8f5de28871 | ||
|
|
c6a4f91836 | ||
|
|
e2cea361db | ||
|
|
545e42675d | ||
|
|
70e1858a92 | ||
|
|
5a91c43301 | ||
|
|
98b81c2a4e | ||
|
|
c3f72d45ec | ||
|
|
7952ed122a | ||
|
|
6efc4c4940 | ||
|
|
31f503c1aa | ||
|
|
70b35bb580 | ||
|
|
13effac5aa | ||
|
|
97dbc366c7 | ||
|
|
21d9578e52 | ||
|
|
ca25d91f13 | ||
|
|
b663137e04 | ||
|
|
6175cec8a7 | ||
|
|
2b5c855143 | ||
|
|
4fdd5249fb | ||
|
|
35b1b345c4 | ||
|
|
15b4d3dc78 | ||
|
|
ef6d751b04 | ||
|
|
0938da3685 | ||
|
|
b30885d8a3 | ||
|
|
4a202474ef | ||
|
|
a975e43310 | ||
|
|
0abfed95e3 | ||
|
|
3e7f149be6 | ||
|
|
18fdb3b33e | ||
|
|
5949c3968e | ||
|
|
ab4433e348 | ||
|
|
d84d278900 | ||
|
|
8a17d68216 | ||
|
|
8c9126e101 | ||
|
|
3a27e5a0c1 | ||
|
|
8a12f7d72d | ||
|
|
54ec8a53d3 | ||
|
|
4265c3d6f4 | ||
|
|
51452106e7 | ||
|
|
4ed862d6fb | ||
|
|
62a06abf37 | ||
|
|
66b8788497 | ||
|
|
bc7fd9511f | ||
|
|
77b928515a | ||
|
|
4cebdf96d6 | ||
|
|
92b51bfe9d | ||
|
|
5fd50121a2 | ||
|
|
ef38483ca3 | ||
|
|
1efef3488f | ||
|
|
0d73873aad | ||
|
|
6c42291ed6 | ||
|
|
70e839b911 | ||
|
|
3bdf8fda7f | ||
|
|
53b3b33aae | ||
|
|
a05ffc841e | ||
|
|
1b480cd24b | ||
|
|
88e1d65564 | ||
|
|
64245f3654 | ||
|
|
74bbb513a2 | ||
|
|
35bf13d97f | ||
|
|
4d03a6980d | ||
|
|
a0902bfa37 | ||
|
|
2086644e2b | ||
|
|
7be45c1573 | ||
|
|
e749e406d8 | ||
|
|
a7a797726e | ||
|
|
541f96e1b6 | ||
|
|
11d323faae | ||
|
|
61ff34a945 | ||
|
|
c6debc5600 | ||
|
|
d6316ebef3 | ||
|
|
0e39d9932a | ||
|
|
4577ef345d | ||
|
|
c38946f838 | ||
|
|
9409252d3f | ||
|
|
2e63531d77 | ||
|
|
54b5111a98 | ||
|
|
bc8dccc7e2 | ||
|
|
8592a15028 | ||
|
|
de231c928c | ||
|
|
ca19c39b62 | ||
|
|
3dd7a7f8b4 | ||
|
|
35a2f5306d | ||
|
|
c008ca83c4 | ||
|
|
d0bfbece1a | ||
|
|
1f13e32204 | ||
|
|
bcac9d3773 | ||
|
|
041b586c59 | ||
|
|
77d6edf304 | ||
|
|
bb1624acd9 | ||
|
|
e212b6c56c | ||
|
|
043fdb5fb1 | ||
|
|
429a6bc483 | ||
|
|
ef6cfdbec3 | ||
|
|
00f869c0a7 | ||
|
|
7869874e5a | ||
|
|
7456da1533 | ||
|
|
9cb224eafe | ||
|
|
cd774e73fb | ||
|
|
0d1c4f234b | ||
|
|
2b73a58a4c | ||
|
|
f647379a3d | ||
|
|
098de0df5d | ||
|
|
510a2806b3 | ||
|
|
cc47667fb0 | ||
|
|
42a50158bc | ||
|
|
6957c8ab5a | ||
|
|
1802b2c9dd | ||
|
|
e3a480faf8 | ||
|
|
53cc10e1c2 | ||
|
|
619f6faa20 | ||
|
|
184917eb1f | ||
|
|
4bed8c9537 | ||
|
|
235ef76a89 | ||
|
|
9638f4c8ff | ||
|
|
d61681ffe8 | ||
|
|
bfe60f6a55 | ||
|
|
53f837720f | ||
|
|
5a3f8c4864 | ||
|
|
ca71f35892 | ||
|
|
14e3bbd0ca | ||
|
|
2419d2e170 | ||
|
|
c94734d283 | ||
|
|
a47aa0e936 | ||
|
|
87631a8713 | ||
|
|
6b2dc66a5b | ||
|
|
9947c89d6e | ||
|
|
0fb6cde415 | ||
|
|
9fb029f257 | ||
|
|
aaaa6ce403 | ||
|
|
3e7cb1286f | ||
|
|
ff9097524c | ||
|
|
d8e1afab0b | ||
|
|
fea008a67f | ||
|
|
1857c0d17f | ||
|
|
a7067ff166 | ||
|
|
8b504aad98 | ||
|
|
8dfbcec9a6 | ||
|
|
4b40bdbc00 | ||
|
|
f4c286ce51 | ||
|
|
549b2ae9fe | ||
|
|
d5edc8497b | ||
|
|
8cafde7940 | ||
|
|
f864a93b00 | ||
|
|
1556fa2665 | ||
|
|
fe68f62429 | ||
|
|
1d14c2f46f | ||
|
|
a4b9d8117f | ||
|
|
e7252868ce | ||
|
|
435da1b34e | ||
|
|
0a968e6e62 | ||
|
|
78e6f958af | ||
|
|
384900bd89 | ||
|
|
a3a9ff1309 | ||
|
|
0cc1014ebf | ||
|
|
aed8e18415 | ||
|
|
669897add1 | ||
|
|
5584e5ef18 | ||
|
|
a84df36b1e | ||
|
|
de54f321b3 | ||
|
|
cba1c57ac6 | ||
|
|
4240a5d3cf | ||
|
|
10a0500ad9 | ||
|
|
7e965d8661 | ||
|
|
2d18951de4 | ||
|
|
d2be511ea2 | ||
|
|
b67e80ea4f | ||
|
|
3b9b9a4bbd | ||
|
|
0a766591b8 | ||
|
|
63dc7bd0ce | ||
|
|
d564f6dda8 | ||
|
|
0314e61193 | ||
|
|
67d56970b9 | ||
|
|
115ba4988e | ||
|
|
06c716589e | ||
|
|
45b4b82fe4 | ||
|
|
323a19116c | ||
|
|
1b88577508 | ||
|
|
a7aa47c46d | ||
|
|
eef33e863b | ||
|
|
0f78991ac6 | ||
|
|
d6d59e9609 | ||
|
|
0fba197478 | ||
|
|
eae73713eb | ||
|
|
f6c1bcfb4d | ||
|
|
d8afde1799 | ||
|
|
70ad496213 | ||
|
|
4d861228c3 | ||
|
|
a21f7c4998 | ||
|
|
2080e2fb4a | ||
|
|
80616e818e | ||
|
|
0b69477a1d | ||
|
|
08887c2067 | ||
|
|
254451337c | ||
|
|
c5eb0540e0 | ||
|
|
2053bc60d2 | ||
|
|
25f5ea0398 | ||
|
|
1618452e53 | ||
|
|
307eedeffe | ||
|
|
aad180c93f | ||
|
|
b38423c7f6 | ||
|
|
f62069244a | ||
|
|
6aecc4c6d6 | ||
|
|
a8d2d22d9b | ||
|
|
8f5c250266 | ||
|
|
8ee3553aa4 | ||
|
|
12e1c89041 | ||
|
|
40329bff38 | ||
|
|
b9d3aafe55 | ||
|
|
7966bb1186 | ||
|
|
5e2f6ea744 | ||
|
|
354eff7e1e | ||
|
|
9a5f0ef61a | ||
|
|
df0d52bd78 | ||
|
|
baed8167d6 | ||
|
|
47b6b1e28a | ||
|
|
a063cc2956 | ||
|
|
5e5de1960f | ||
|
|
893aee30e8 | ||
|
|
30b2af9511 | ||
|
|
03edfa1677 | ||
|
|
1a9d759fc4 | ||
|
|
b8a8640846 | ||
|
|
e384ab1666 | ||
|
|
c50ef2e715 | ||
|
|
f17eff3a6c | ||
|
|
e7e54fccac | ||
|
|
9c488ef4f2 | ||
|
|
5a3baf610b | ||
|
|
9dd0472573 | ||
|
|
900eaa32f3 | ||
|
|
8635889231 | ||
|
|
c0cea96139 | ||
|
|
45fa60d315 | ||
|
|
b7479f6c29 | ||
|
|
27c3401da5 | ||
|
|
8761f766d4 | ||
|
|
22214bc11e | ||
|
|
5eaf82b6eb | ||
|
|
f93672da8e | ||
|
|
7be44d2b6d | ||
|
|
e864dc5b13 | ||
|
|
41da69f20f | ||
|
|
879cbe7961 | ||
|
|
739846a6a8 | ||
|
|
e5d7aef143 | ||
|
|
47692de95f | ||
|
|
6be3e2d751 | ||
|
|
e69edbeac2 | ||
|
|
86b31b56de | ||
|
|
efb6da662d | ||
|
|
7f8bbde609 | ||
|
|
338de41cf9 | ||
|
|
139deb5ddb | ||
|
|
6d859da0da | ||
|
|
8f242bb48b | ||
|
|
7afbc02392 | ||
|
|
e3aa91d3f3 | ||
|
|
8838b0f114 | ||
|
|
349514ed2d | ||
|
|
d676db7541 | ||
|
|
b7c800e6fb | ||
|
|
ba9faa42a0 | ||
|
|
164703f306 | ||
|
|
a9d700c5c7 | ||
|
|
a750e94013 | ||
|
|
bbf5e08fa3 | ||
|
|
1be1a0b472 | ||
|
|
072961be7b | ||
|
|
9f7829fb47 | ||
|
|
80dfa0ba37 | ||
|
|
d1be87446b | ||
|
|
4c9527044b | ||
|
|
7de0f803d1 | ||
|
|
208a735a85 | ||
|
|
58466f957f | ||
|
|
06fd453fb9 | ||
|
|
2d9549455d | ||
|
|
7aa63c6209 | ||
|
|
bc594f1506 | ||
|
|
b5d2a4aa12 | ||
|
|
a20b67c30f | ||
|
|
1aad1b4291 | ||
|
|
6fc504ce16 | ||
|
|
b24de2d58a | ||
|
|
4c5521ad81 | ||
|
|
808dee23d7 | ||
|
|
4c722bee9c | ||
|
|
19db79ff1d | ||
|
|
e3727d1061 | ||
|
|
43d81b700a | ||
|
|
a6ea6cc87c | ||
|
|
9f6f2471f0 | ||
|
|
90adf3ec54 | ||
|
|
de83567151 | ||
|
|
c6af3e463a | ||
|
|
09d9532952 | ||
|
|
4e9e5c1913 | ||
|
|
9a9864a0e9 | ||
|
|
065d0986aa | ||
|
|
8a088529c9 | ||
|
|
908f37b08b | ||
|
|
ea2fa14acb | ||
|
|
ebf7a4f847 | ||
|
|
46d273a2b9 | ||
|
|
4293672558 | ||
|
|
f5865d02d0 | ||
|
|
cf3d459815 | ||
|
|
fcfe6ff818 | ||
|
|
88b30630b2 | ||
|
|
9d4bd52adf | ||
|
|
bf45f6d5ba | ||
|
|
76c42836b2 | ||
|
|
fd4dea3500 | ||
|
|
c1134d6bb9 | ||
|
|
9166d10260 | ||
|
|
fa843198d4 | ||
|
|
e5a94e640e | ||
|
|
3a95b4b173 | ||
|
|
8a6f9ab5c0 | ||
|
|
9a87c59f72 | ||
|
|
831caad432 | ||
|
|
0ef09b9609 | ||
|
|
df1e5064e7 | ||
|
|
ad63c6c086 | ||
|
|
8d802f10f0 | ||
|
|
6c192034a2 | ||
|
|
3bab4824f0 | ||
|
|
951f80976b | ||
|
|
0e00c049c7 | ||
|
|
e85ca0efce | ||
|
|
56c1fec8d8 | ||
|
|
4b1deca2e1 | ||
|
|
c40ac6b268 | ||
|
|
8e07a4fd52 | ||
|
|
5336ad6dbd | ||
|
|
e1fa70df9a | ||
|
|
85923625fe | ||
|
|
de9e6e1f1b | ||
|
|
b145f87d40 | ||
|
|
f579d02059 | ||
|
|
2058fec25b | ||
|
|
6c63a9e153 | ||
|
|
4de55b50dc | ||
|
|
bbdbfa8563 | ||
|
|
cc5e0df571 | ||
|
|
d528916296 | ||
|
|
0cd7e11430 | ||
|
|
772523e4a8 | ||
|
|
5f1a942add | ||
|
|
ddbc35b39c | ||
|
|
ea3c36078c | ||
|
|
24e9c2b3ff | ||
|
|
6241abce94 | ||
|
|
53b5689016 | ||
|
|
7eed89deb7 | ||
|
|
06f91140fe | ||
|
|
0825bb2386 | ||
|
|
64fe4952b6 | ||
|
|
96b2eaca0d | ||
|
|
ffe1113b3d | ||
|
|
db9a8f2f5e | ||
|
|
6efb1b369c | ||
|
|
538a818db0 | ||
|
|
9934670186 | ||
|
|
89206cfca4 | ||
|
|
cb8e1f16ee | ||
|
|
1af4d7724f | ||
|
|
7e941eefe8 | ||
|
|
885e837b2a | ||
|
|
6a3fc10b05 | ||
|
|
e96b4d55bd | ||
|
|
5188dd875f | ||
|
|
6f431d5d6d | ||
|
|
4e78551db1 | ||
|
|
9de151b2ce | ||
|
|
91786ab7a5 | ||
|
|
0bf404dbeb | ||
|
|
e566c744d1 | ||
|
|
a96a6a2b7f | ||
|
|
f51237d726 | ||
|
|
b1061c7443 | ||
|
|
5d3a542a08 | ||
|
|
20c0fb5e9c | ||
|
|
e89ac09125 | ||
|
|
94728f7301 | ||
|
|
e65f145d46 | ||
|
|
2986565c79 | ||
|
|
e2088baab4 |
No files matched your search
+1
-1
@@ -262,7 +262,7 @@ STATUS: Unknown
|
||||
EXTENSION: domxml
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dotnet
|
||||
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
|
||||
|
||||
@@ -1,11 +1,245 @@
|
||||
PHP 4 NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? Mar 2004, Version 4.3.5
|
||||
15 Dec 2004, Version 4.3.10
|
||||
- Added the %F modifier to *printf to render a non-locale-aware representation
|
||||
of a float with the . as decimal separator. (Derick)
|
||||
- Fixed a bug in addslashes() handling of the '\0' character. (Ilia)
|
||||
- Backported Marcus' foreach() speedup patch from PHP 5.x. (Derick)
|
||||
- Fixed potential problems with unserializing invalid serialize data. (Marcus)
|
||||
- Fixed bug #31034 (Problem with non-existing iconv header file). (Derick)
|
||||
- Fixed bug #31024 (Crash in fgetcsv() with negative length). (Ilia)
|
||||
- Fixed bug #31019 (Logic error mssql library checking). (Frank)
|
||||
- Fixed bug #30995 (snmp extension does not build with net-snmp 5.2). (Ilia)
|
||||
- Fixed bug #30990 (allow popen() on *NIX to accept 'b' flag). (Ilia)
|
||||
- Fixed bug #30826 (Certain reference relations cannot be unserialized
|
||||
properly). (Ilia)
|
||||
- Fixed bug #30750 (Meaningful error message when upload directory is not
|
||||
accessible). (Ilia)
|
||||
- Fixed bug #30739 (imagefill does not set back alphablending mode). (Pierre)
|
||||
- Fixed bug #30672 (Problem handling exif data in jpeg images at unusual
|
||||
places). (Marcus)
|
||||
- Fixed bug #30658 (Ensure that temporary files created by GD are removed).
|
||||
(Ilia)
|
||||
- Fixed bug #30654 (oci8 persistent connection is deleted from hash
|
||||
if there was exclusive connection with the same credentials). (Tony)
|
||||
- Fixed bug #30613 (Prevent infinite recursion in url redirection). (Ilia)
|
||||
- Fixed bug #30587 (array_multisort doesn't separate zvals before
|
||||
changing them). (Tony)
|
||||
- Fixed bug #30475 (curl_getinfo() may crash in some situations). (Ilia)
|
||||
- Fixed bug #30442 (segfault when parsing ?getvariable[][ ). (Tony)
|
||||
- Fixed bug #30388 (rename across filesystems loses ownership and
|
||||
permission info). (Tony)
|
||||
- Fixed bug #30282 (segfault when using unknown/unsupported
|
||||
session.save_handler and/or session.serialize_handler). (Tony)
|
||||
- Fixed bug #30281 (Prevent non-wbmp images from being detected as such).
|
||||
(Ilia)
|
||||
- Fixed bug #30276 (Possible crash in ctype_digit on large numbers). (Ilia)
|
||||
- Fixed bug #30229 (imagerectangle and imagefilledrectangle do work well
|
||||
with alpha channel, corners are drawn twice). (Pierre)
|
||||
- Fixed bug #30224 (Sybase date strings are sometimes not null terminated).
|
||||
(Ilia)
|
||||
- Fixed bug #30133 (get_current_user() crashes on Windows). (Edin)
|
||||
- Fixed bug #30057 (did not detect IPV6 on FreeBSD 4.1). (Wez)
|
||||
- Fixed bug #30027 (Possible crash inside ftp_get()).
|
||||
(cfield at affinitysolutions dot com)
|
||||
- Fixed bug #29805 (HTTP Authentication Issues). (Uwe Schindler)
|
||||
- Fixed bug #29418 (double free when openssl_csr_new fails).
|
||||
(Kamesh Jayachandran).
|
||||
- Fixed bug #28598 (Lost support for MS Symbol fonts). (Pierre)
|
||||
- Fixed bug #28325 (Circular references not properly serialized). (Moriyoshi)
|
||||
- Fixed bug #28228 (NULL decimal separator is not being handled correctly).
|
||||
(Ilia)
|
||||
- Fixed bug #27469 (serialize() objects of incomplete class). (Dmitry)
|
||||
|
||||
22 Sep 2004, Version 4.3.9
|
||||
- GPC input processing fixes (Stefano Di Paola, Rasmus, Stefan)
|
||||
- Implemented periodic PCRE compiled regexp cache cleanup, to avoid memory
|
||||
exhaustion. (Andrei)
|
||||
- Fixed bug with raw_post_data not getting set (Brian)
|
||||
- Fixed a file-descriptor leak with phpinfo() and other 'special' URLs (Zeev)
|
||||
- Rewritten UNIX and Windows install help files. (Documentation Team)
|
||||
- Updated PCRE to provide better error handling in certain cases. (Andrei)
|
||||
- NSAPI: added "bucket" parameter to list of non-php.ini-keys of php4_execute
|
||||
for doing performance stats without warnings in server-log. (Uwe Schindler)
|
||||
- Fixed leap year checking with idate(). (Christian Schneider, Derick)
|
||||
- Fixed strip_tags() to correctly handle '\0' characters. (Stefan)
|
||||
- Fixed funny forking effect in FastCGI when PHP_FCGI_CHILDREN was not set.
|
||||
- Fixed bug #30050 (Possible crash inside php_shutdown_config()).
|
||||
(Ilia, nw at softwarekombinat dot de)
|
||||
- Fixed bug #29954 (array_reduce segfaults when initial value is array). (Tony)
|
||||
- Fixed bug #29882 (isset crashes on arrays). (Marcus)
|
||||
- Fixed bug #29753 (mcal_fetch_event() allows 2nd argument to be optional).
|
||||
(Ilia, Vrana)
|
||||
- Fixed bug #29727 (Added missing CURL authentication directives). (Ilia)
|
||||
- Fixed bug #29719 (fgetcsv() has problem parsing strings ending with escaped
|
||||
enclosures). (Ilia)
|
||||
- Fixed bug #29607 (highlighting code with HEREDOC produces invalid output).
|
||||
(Ilia)
|
||||
- Fixed bug #29599 (domxml_error segfaults another apache module). (Rob)
|
||||
- Fixed bug #29594 (Use PHP's own tmpfile() implementation). (Ilia)
|
||||
- Fixed bug #29581 (Typo inside php.ini comments for mysql.trace_mode). (Ilia)
|
||||
- Fixed bug #29493 (extract(array, EXTR_REFS) misbehaves with elements referred
|
||||
twice or more times). (Moriyoshi)
|
||||
- Fixed bug #29443 (Sanity check for wbmp detection). (Ilia)
|
||||
- Fixed bug #29369 (Uploaded files with ' or " in their names get their names
|
||||
truncated at those characters). (Ilia)
|
||||
- Fixed bug #29349 (imagecreatefromstring() crashes with external GD library).
|
||||
(Ilia, adconrad at debian dot org)
|
||||
- Fixed bug #29333 (output_buffering+trans_sess_id can corrupt output). (Ilia)
|
||||
- Fixed bug #29226 (ctype_* functions missing validation of numeric string
|
||||
representations). (Ilia)
|
||||
- Fixed bug #29209 (imap_fetchbody() doesn't check message index).
|
||||
(Ilia, Tony)
|
||||
- Fixed bug #29116 (Zend constant warning uses memory after free).
|
||||
(Marcus, jdolecek at NetBSD dot org)
|
||||
- Fixed bug #29114 (Potential double free in php_stat). (Sara)
|
||||
- Fixed bug #29075 (strnatcmp() incorrectly handles whitespace).
|
||||
(Curt, Ilia)
|
||||
- Fixed bug #29049 (array sorting via user function/method does not
|
||||
validate it). (Ilia)
|
||||
- Fixed bug #29038 (extract() with EXTR_PREFIX_SAME prefixes empty strings).
|
||||
(Andrey)
|
||||
- Fixed bug #29034 (wordwrap() returns a boolean when passed empty string).
|
||||
(Ilia)
|
||||
- Fixed bug #28974 (overflow in array_slice(), array_splice(), substr,
|
||||
substr_replace(), strspn(), strcspn()). (Andrey)
|
||||
- Fixed bug #28897 (ibase: -1 returned as -0.000 for 64-bit scaled int). (Ard)
|
||||
- Fixed bug #28879 (Implicit/Explicit array creation inconsistency when using
|
||||
Resources, Arrays, or Objects as indices). (Sara)
|
||||
- Fixed bug #28878 (Setting of inikey's in obj.conf fails). (Uwe Schindler)
|
||||
- Fixed bug #28868 (Internal wrapper registry not thread safe). (Sara)
|
||||
- Fixed bug #28818 (Apache 2 sapis do not export st_dev).
|
||||
(xuefer at 21cn dot com, Ilia).
|
||||
- Fixed bug #28800 (strings beginning with "inf" improperly converted). (Ilia)
|
||||
- Fixed bug #28723 (Fixed mbstring config.m4 to work on OSes where test
|
||||
command does not support -e parameter). (Ilia)
|
||||
- Fixed bug #28692 (\0 in Authenticate header passed via safe_mode). (Ilia)
|
||||
- Fixed bug #28670 (WWW-Authentication header mangling with PCRE in safe_mode
|
||||
adds extra spaces). (Ilia)
|
||||
- Fixed bug #28668 (glob() does not work with relative paths on Windows). (Ilia)
|
||||
- Fixed bug #28649 (Proper glob() return value on Linux when there are no
|
||||
matches). (Ilia)
|
||||
- Fixed bug #28633 (sprintf incorrectly adding padding to floats). (Ilia)
|
||||
- Fixed bug #28627 (When multiple MySQL links are used default link is leaked).
|
||||
(gavin at ipalsoftware dot com, Ilia)
|
||||
- Fixed bug #28525 (gmp_powm() does not work with hexadecimal string modulo
|
||||
represented as a string). (pickett at sumu dot org, Ilia)
|
||||
- Fixed bug #28512 (Allocate enough space to store MSSQL data). (Frank)
|
||||
- Fixed bug #28466 (mbstring_convert_variables() array separation problem).
|
||||
(Moriyoshi)
|
||||
- Fixed bug #28175 (Allow bundled GD to compile against freetype 2.1.2).
|
||||
(Elf, Ilia)
|
||||
|
||||
14 Jul 2004, Version 4.3.8
|
||||
- Fixed strip_tags() to correctly handle '\0' characters. (Stefan)
|
||||
- Fixed memory_limit during request startup. (Stefan)
|
||||
- Replace alloca() with emalloc() for better stack protection. (Ilia)
|
||||
- Added missing safe_mode checks inside ftok and itpc. (Ilia)
|
||||
- Fixed bug #28963 (Missing space for \0 in address allocation in IMAP). (Ilia)
|
||||
- Fixed bug #28632 (Prevent open_basedir bypass via MySQL's LOAD DATA LOCAL).
|
||||
(Ilia)
|
||||
|
||||
03 Jun 2004, Version 4.3.7
|
||||
- Upgraded bundled GD library to 2.0.23. (Ilia)
|
||||
- Changed user error handler mechanism to relay to built-in error handler if it
|
||||
returns false. (Andrei)
|
||||
- Fixed command line escaping routines for win32. (Ilia)
|
||||
- Fixed problems with *printf() functions and '%f' formatting. (Marcus)
|
||||
- Fixed possible crash inside pg_copy_(to|from) function if delimiter is more
|
||||
then 1 character long. (Ilia)
|
||||
- Fixed crash inside cpdf_place_inline_image() when working with truecolor
|
||||
images. (Ilia)
|
||||
- Fixed handling of return values from storred procedures in mssql_execute()
|
||||
with multiple result sets returned. (Frank)
|
||||
- Fixed logic bug in session_register() which allowed registering _SESSION
|
||||
and/or HTTP_SESSION_VARS. (Sara)
|
||||
- Fixed bug #28597 (xmlrpc_encode_request() incorrectly encodes chars in
|
||||
200-210 range). (fernando dot nemec at folha dot com dot br, Ilia)
|
||||
- Fixed bug #28569 (informix connection id is not thread safe).
|
||||
(novicky at aarongroup dot cz, Ard)
|
||||
- Fixed bug #28564 (Problem building informix as a shared extension).
|
||||
(roques at mti dot ag, Ilia)
|
||||
- Fixed bug #28508 (Do not make hypot() available if not supported by libc).
|
||||
(Ilia)
|
||||
- Fixed bug #28506 (Allow negative start angle in imagearc and imagefilledarc.
|
||||
(Pierre)
|
||||
- Fixed bug #28456 (Problem with enclosed / in uploaded files). (Antony)
|
||||
- Fixed bug #28386 (wordwrap() wraps lines 1 character too soon). (Ilia)
|
||||
- Fixed bug #28374 (Possible unterminated loop inside
|
||||
_php_pgsql_trim_message()). (Ilia)
|
||||
- Fixed bug #28355 (glob() does not return error on Linux when it does not
|
||||
have permission to open the directory). (Ilia)
|
||||
- Fixed bug #28289 (incorrect resolving of relative paths by glob() in
|
||||
windows). (Ilia)
|
||||
- Fixed bug #28229 (run-tests tripped up by spaces in names). (Marcus)
|
||||
- Fixed bug #28228 (number_format() does not allow empty decimal separator).
|
||||
(Ilia)
|
||||
- Fixed bug #28196 (missing error constants in cURL extension). (Ilia)
|
||||
- Fixed bug #28187 (parse_url() not handling embedded IPv6 in URLs). (Sara)
|
||||
- Fixed bug #28175 (build problem for people using FreeType 2.1.0-2.1.2).
|
||||
(Ilia)
|
||||
- Fixed bug #28147 (Crash with drawing anti-aliased lines). (Derick)
|
||||
- Fixed bug #28122 (dba_open db3: Permission denied). (Marcus)
|
||||
- Fixed bug #28112 (sqlite_query() crashing apache on malformed query). (Ilia,
|
||||
Marcus)
|
||||
- Fixed bug #28055 (timeout duration too long in feof()/pfsockopen() liveness
|
||||
checks). (Wez)
|
||||
- Fixed bug #28087 (Do not force mysql.trace_mode to 0 on every request).
|
||||
(Ilia)
|
||||
- Fixed bug #28042 (greek letters in html to entitity mapping not correct).
|
||||
(Derick)
|
||||
- Fixed bug #28007 (compile mssql extension with old versions of FreeTDS
|
||||
fails). (Frank)
|
||||
- Fixed bug #27995 (imagefilltoborder() stops the fill process prematurely).
|
||||
(Ilia)
|
||||
- Fixed bug #27810 (don't use php's pemalloc in ext/pcre). (Joe Orton)
|
||||
- Fixed bug #23220 (SSL: fatal protocol error when talking to IIS). (Wez)
|
||||
|
||||
15 Apr 2004, Version 4.3.6
|
||||
- Updated bundled PDFLib library to version 5.0.3p1 in Windows distribution.
|
||||
(Edin)
|
||||
- Fixed a crash in multi-threaded environments when a thread is shutdown by
|
||||
the web server. (Stas)
|
||||
- Fixed a bug that prevented building of the GD extension against external GD
|
||||
lib 1.X. (Ilia, Edin, Nick Talbott).
|
||||
- Synchronized bundled GD library with GD 2.0.22. (Ilia)
|
||||
- Fixed bug #27963 (Session lifetime setting may leak between requests). (Ilia)
|
||||
- Fixed bug #27849 (configure craps out on trivial syntax error). (Derick)
|
||||
- Fixed bug #27822 (is_resource() returns TRUE for closed resources). (Derick)
|
||||
- Fixed bug #27819 (problems returning reference to a reference parameter).
|
||||
(Ilia)
|
||||
- Fixed bug #27809 (ftp_systype returns null on some ftp servers). (Ilia)
|
||||
- Fixed bug #27802 (default number of children to 8 when PHP_FCGI_CHILDREN is
|
||||
not defined). (Ilia)
|
||||
- Fixed bug #27780 (strtotime(+1 xxx) returns a wrong date/time). (Derick)
|
||||
- Fixed bug #27769 (domxml_xmltree crashes). (Rob)
|
||||
- Fixed bug #27764 (Get return value from a stored procedure not returning any
|
||||
result sets). (Frank)
|
||||
- Fixed bug #27762 (SCO Openserver doesn't have S_ISSOCK). (Wez)
|
||||
- Fixed bug #27743 (Make sure Money types are converted and returned
|
||||
correctly). (Frank)
|
||||
- Fixed bug #27732 (Fixed compilation bug inside php_sab_info.h). (Ilia)
|
||||
- Fixed bug #27731 (error_reporting() inside @ block fails to set
|
||||
error_reporting level). (Ilia)
|
||||
- Fixed bug #27719 (mktime issues on and around DST changeover). (Rasmus)
|
||||
- Fixed bug #27717 (Test Failures when compiled on 64-bit mode). (Ard, Derick)
|
||||
- Fixed bug #27687 (Bug Adding Default Charset to 'text/*' Content-Type
|
||||
Header). (Marcus)
|
||||
- Fixed bug #27663 (compile failure with cURL 7.11.1). (Ilia)
|
||||
- Fixed bug #27646 (Cannot serialize/unserialize non-finite numeric values).
|
||||
(Marcus)
|
||||
- Fixed bug #26757 (session.save_path default is bogus for win32). (Wez)
|
||||
- Fixed bug #26589 (Crash inside mssql extension when selecting many columns
|
||||
of type money). (Frank)
|
||||
- Fixed bug #25547 (error_handler and array index with function call).
|
||||
(cschneid at cschneid dot com)
|
||||
|
||||
26 Mar 2004, Version 4.3.5
|
||||
- Fixed possible crash using an invalid color index with a palette image in
|
||||
imagecolortransparent (Pierre)
|
||||
imagecolortransparent. (Pierre)
|
||||
- Fixed php-cgi to not ignore command-line switches when run in a web context.
|
||||
This fixes our test cases allowing INI with GET sections to work (Rasmus)
|
||||
- Fixed getopt() so it works without $_SERVER (Rasmus, bfrance)
|
||||
This fixes our test cases allowing INI with GET sections to work. (Rasmus)
|
||||
- Fixed getopt() so it works without $_SERVER. (Rasmus, bfrance)
|
||||
- Fixed crash in php_ini_scanned_files() when no additional INI files were
|
||||
actually parsed. (Jon)
|
||||
- Fixed possible crashes inside socket extension, due to missing check inside
|
||||
@@ -19,7 +253,7 @@ PHP 4 NEWS
|
||||
. Added "sybct.packet_size" php.ini option.
|
||||
. Changed "sybct.login_timeout" php.ini option changeable at runtime.
|
||||
. Fixed memory leak in sybase_set_message_handler().
|
||||
- Synchronized bundled GD library with GD 2.0.17
|
||||
- Synchronized bundled GD library with GD 2.0.17. (Ilia)
|
||||
- Upgraded PCRE library to version 4.5. (Andrei)
|
||||
- Updated bundled PostgreSQL library to version 7.4 in Windows distribution.
|
||||
(Edin)
|
||||
|
||||
+10
-18
@@ -37,8 +37,11 @@ The next few rules are more of a technical nature.
|
||||
messages every day. Woe be to those who attempt to mess with it.
|
||||
|
||||
2. All news updates intended for public viewing, such as new features,
|
||||
bug fixes, improvements, etc., should go into the NEWS file. Also see
|
||||
the note below about automatically updating NEWS in your commit message.
|
||||
bug fixes, improvements, etc., should go into the NEWS file.
|
||||
|
||||
NB! Lines, starting with @ will go automagically into NEWS file, but
|
||||
this is NOT recommended, though. Please, add news entries directly to
|
||||
NEWS file and don't forget to keep them adjusted and sorted.
|
||||
|
||||
3. Do not commit multiple file and dump all messages in one commit. If you
|
||||
modified several unrelated files, commit each group separately and
|
||||
@@ -59,14 +62,10 @@ The next few rules are more of a technical nature.
|
||||
The format of the commit messages is pretty simple.
|
||||
|
||||
If a line begins with #, it is taken to be a comment and will not appear
|
||||
in the ChangeLog. If the line begins with @, it will be redirected to the
|
||||
NEWS file. Everything else goes into the ChangeLog.
|
||||
in the ChangeLog. Everything else goes into the ChangeLog.
|
||||
|
||||
It is important to note that if your comment or news logline spans multiple
|
||||
lines, you have to put # or @ at the beginning of _every_ such line. Every
|
||||
entry in NEWS has to have a name after it, so if you did it with someone's
|
||||
help, put both your names there. Your name WILL NOT be automatically put
|
||||
at the end of the NEWS entry - so, please provide it yourself.
|
||||
lines, you have to put # at the beginning of _every_ such line.
|
||||
|
||||
Example. Say you modified two files, datetime.c and string.c. In datetime.c
|
||||
you added a new format option for date() function, and in string.c you fixed
|
||||
@@ -78,17 +77,12 @@ For datetime.c:
|
||||
|
||||
(PHP date) Added new 'K' format modifier for printing out number of
|
||||
days until New Year's Eve.
|
||||
@- Added new 'K' format modifier that will output the number of days
|
||||
@ until New Year's Eve. (Bob)
|
||||
|
||||
For string.c:
|
||||
(php_trim) Fixed a memory leak resulting from improper use of zval_dtor().
|
||||
# Man, that thing was leaking all over the place!
|
||||
@- Fixed memory leak in trim(). (Bob)
|
||||
|
||||
The lines above marked with @ will go into NEWS file automagically, and the
|
||||
# lines will be omitted from the ChangeLog. Alternatively, you might want
|
||||
to modify NEWS file directly and not use the @ lines.
|
||||
The # lines will be omitted from the ChangeLog automagically.
|
||||
|
||||
If you fix some bugs, you should note the bug ID numbers in your
|
||||
commit message. Bug ID should be prefixed by "#" for easier access to
|
||||
@@ -97,12 +91,10 @@ bug report when developers are browsing CVS via. LXR or Bonsai.
|
||||
Example:
|
||||
|
||||
Fixed pgsql notice handler double free crash bug. Bug #14016
|
||||
@ Fixed pgsql notice handler double free crash bug. Bug #14016
|
||||
|
||||
If you don't see your messages in ChangeLog and NEWS right away, don't worry!
|
||||
If you don't see your messages in ChangeLog right away, don't worry!
|
||||
These files are updated once a day, so your stuff will not show up until
|
||||
somewhat later. Don't go adding stuff to NEWS by hand if you already put @
|
||||
lines in the commit message.
|
||||
somewhat later.
|
||||
|
||||
You can use LXR (http://lxr.php.net/) and Bonsai (http://bonsai.php.net/)
|
||||
to look at PHP CVS repository in various ways.
|
||||
|
||||
@@ -158,9 +158,15 @@ TSRM_API void tsrm_shutdown(void)
|
||||
|
||||
next_p = p->next;
|
||||
for (j=0; j<p->count; j++) {
|
||||
/* Disabled - calling dtors in tsrm_shutdown makes
|
||||
modules registering TSRM ids to crash, if they have
|
||||
dtors, since the module is unloaded before tsrm_shutdown
|
||||
is called. Can be re-enabled after tsrm_free_id is
|
||||
implemented.
|
||||
if (resource_types_table && resource_types_table[j].dtor) {
|
||||
resource_types_table[j].dtor(p->storage[j], &p->storage);
|
||||
}
|
||||
*/
|
||||
free(p->storage[j]);
|
||||
}
|
||||
free(p->storage);
|
||||
|
||||
+51
-10
@@ -301,15 +301,22 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
|
||||
if (path_length == 0)
|
||||
return (0);
|
||||
if (path_length >= MAXPATHLEN)
|
||||
return (1);
|
||||
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
/* cwd_length can be 0 when getcwd() fails.
|
||||
* This can happen under solaris when a dir does not have read permissions
|
||||
* but *does* have execute permissions */
|
||||
if (IS_ABSOLUTE_PATH(path, path_length) || (state->cwd_length < 1)) {
|
||||
if (use_realpath && realpath(path, resolved_path)) {
|
||||
path = resolved_path;
|
||||
path_length = strlen(path);
|
||||
if (use_realpath) {
|
||||
if (realpath(path, resolved_path)) {
|
||||
path = resolved_path;
|
||||
path_length = strlen(path);
|
||||
} else {
|
||||
/* disable for now
|
||||
return 1; */
|
||||
}
|
||||
}
|
||||
} else { /* Concat current directory with relative path and then run realpath() on it */
|
||||
char *tmp;
|
||||
@@ -325,9 +332,19 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
memcpy(ptr, path, path_length);
|
||||
ptr += path_length;
|
||||
*ptr = '\0';
|
||||
if (use_realpath && realpath(tmp, resolved_path)) {
|
||||
path = resolved_path;
|
||||
path_length = strlen(path);
|
||||
if (strlen(tmp) >= MAXPATHLEN) {
|
||||
free(tmp);
|
||||
return 1;
|
||||
}
|
||||
if (use_realpath) {
|
||||
if (realpath(tmp, resolved_path)) {
|
||||
path = resolved_path;
|
||||
path_length = strlen(path);
|
||||
} else {
|
||||
/* disable for now
|
||||
free(tmp);
|
||||
return 1; */
|
||||
}
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
@@ -818,13 +835,24 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
|
||||
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
|
||||
{
|
||||
int command_length;
|
||||
int dir_length, extra = 0;
|
||||
char *command_line;
|
||||
char *ptr;
|
||||
char *ptr, *dir;
|
||||
FILE *retval;
|
||||
|
||||
command_length = strlen(command);
|
||||
|
||||
ptr = command_line = (char *) malloc(command_length + sizeof("cd ; ") + CWDG(cwd).cwd_length+1);
|
||||
dir_length = CWDG(cwd).cwd_length;
|
||||
dir = CWDG(cwd).cwd;
|
||||
while (dir_length > 0) {
|
||||
if (*dir == '\'') extra+=3;
|
||||
dir++;
|
||||
dir_length--;
|
||||
}
|
||||
dir_length = CWDG(cwd).cwd_length;
|
||||
dir = CWDG(cwd).cwd;
|
||||
|
||||
ptr = command_line = (char *) malloc(command_length + sizeof("cd '' ; ") + dir_length +1+1);
|
||||
if (!command_line) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -834,8 +862,21 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
|
||||
if (CWDG(cwd).cwd_length == 0) {
|
||||
*ptr++ = DEFAULT_SLASH;
|
||||
} else {
|
||||
memcpy(ptr, CWDG(cwd).cwd, CWDG(cwd).cwd_length);
|
||||
ptr += CWDG(cwd).cwd_length;
|
||||
*ptr++ = '\'';
|
||||
while (dir_length > 0) {
|
||||
switch (*dir) {
|
||||
case '\'':
|
||||
*ptr++ = '\'';
|
||||
*ptr++ = '\\';
|
||||
*ptr++ = '\'';
|
||||
/* fall-through */
|
||||
default:
|
||||
*ptr++ = *dir;
|
||||
}
|
||||
dir++;
|
||||
dir_length--;
|
||||
}
|
||||
*ptr++ = '\'';
|
||||
}
|
||||
|
||||
*ptr++ = ' ';
|
||||
|
||||
+19
-7
@@ -1,4 +1,4 @@
|
||||
dnl $Id$
|
||||
dnl $Id$ -*- autoconf -*-
|
||||
dnl
|
||||
dnl This file contains local autoconf functions.
|
||||
|
||||
@@ -20,12 +20,12 @@ AC_DEFUN(PHP_PROG_RE2C,[
|
||||
AC_CHECK_PROG(RE2C, re2c, re2c, [exit 0;])
|
||||
])
|
||||
|
||||
dnl PHP_DEFINE(WHAT[, value])
|
||||
dnl PHP_DEFINE(WHAT[, value[, directory]])
|
||||
dnl
|
||||
dnl Creates builddir/include/what.h and in there #define WHAT value
|
||||
dnl
|
||||
AC_DEFUN([PHP_DEFINE],[
|
||||
[echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > include/php_]translit($1,A-Z,a-z)[.h]
|
||||
[echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > ]ifelse([$3],,[include],[$3])[/php_]translit($1,A-Z,a-z)[.h]
|
||||
])
|
||||
|
||||
dnl PHP_INIT_BUILD_SYSTEM
|
||||
@@ -1699,16 +1699,28 @@ AC_DEFUN([PHP_SETUP_ICONV], [
|
||||
found_iconv=no
|
||||
unset ICONV_DIR
|
||||
|
||||
# Create the directories for a VPATH build:
|
||||
test -d ext || mkdir ext
|
||||
test -d ext/iconv || mkdir ext/iconv
|
||||
|
||||
echo > ext/iconv/php_have_bsd_iconv.h
|
||||
echo > ext/iconv/php_have_glibc_iconv.h
|
||||
echo > ext/iconv/php_have_libiconv.h
|
||||
echo > ext/iconv/php_have_iconv.h
|
||||
echo > ext/iconv/php_php_iconv_impl.h
|
||||
echo > ext/iconv/php_php_iconv_h_path.h
|
||||
echo > ext/iconv/php_iconv_supports_errno.h
|
||||
|
||||
dnl
|
||||
dnl Check libc first if no path is provided in --with-iconv
|
||||
dnl
|
||||
if test "$PHP_ICONV" = "yes"; then
|
||||
AC_CHECK_FUNC(iconv, [
|
||||
PHP_DEFINE(HAVE_ICONV)
|
||||
PHP_DEFINE(HAVE_ICONV,1,[ext/iconv])
|
||||
found_iconv=yes
|
||||
],[
|
||||
AC_CHECK_FUNC(libiconv,[
|
||||
PHP_DEFINE(HAVE_LIBICONV)
|
||||
PHP_DEFINE(HAVE_LIBICONV,1,[ext/iconv])
|
||||
found_iconv=yes
|
||||
])
|
||||
])
|
||||
@@ -1741,11 +1753,11 @@ AC_DEFUN([PHP_SETUP_ICONV], [
|
||||
then
|
||||
PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [
|
||||
found_iconv=yes
|
||||
PHP_DEFINE(HAVE_LIBICONV)
|
||||
PHP_DEFINE(HAVE_LIBICONV,1,[ext/iconv])
|
||||
], [
|
||||
PHP_CHECK_LIBRARY($iconv_lib_name, iconv, [
|
||||
found_iconv=yes
|
||||
PHP_DEFINE(HAVE_ICONV)
|
||||
PHP_DEFINE(HAVE_ICONV,1,[ext/iconv])
|
||||
], [], [
|
||||
-L$ICONV_DIR/lib
|
||||
])
|
||||
|
||||
+16
-12
@@ -40,7 +40,7 @@ AC_CONFIG_HEADER(main/php_config.h)
|
||||
|
||||
MAJOR_VERSION=4
|
||||
MINOR_VERSION=3
|
||||
RELEASE_VERSION=5
|
||||
RELEASE_VERSION=10
|
||||
EXTRA_VERSION=""
|
||||
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
|
||||
|
||||
@@ -351,6 +351,7 @@ stdlib.h \
|
||||
string.h \
|
||||
syslog.h \
|
||||
sysexits.h \
|
||||
sys/bitypes.h \
|
||||
sys/file.h \
|
||||
sys/mman.h \
|
||||
sys/mount.h \
|
||||
@@ -528,17 +529,20 @@ AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
|
||||
AC_TRY_RUN([
|
||||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef AF_INET
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
int main(void) {
|
||||
struct addrinfo *ai, *pai, hints;
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
|
||||
if (getaddrinfo("127.0.0.1", NULL, &hints, &ai) < 0) {
|
||||
if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ai == NULL) {
|
||||
if (ai == 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -567,8 +571,8 @@ fi
|
||||
AC_REPLACE_FUNCS(strlcat strlcpy getopt)
|
||||
AC_FUNC_UTIME_NULL
|
||||
AC_FUNC_ALLOCA
|
||||
PHP_AC_BROKEN_SPRINTF
|
||||
PHP_AC_BROKEN_SNPRINTF
|
||||
dnl PHP_AC_BROKEN_SPRINTF
|
||||
dnl PHP_AC_BROKEN_SNPRINTF
|
||||
PHP_DECLARED_TIMEZONE
|
||||
PHP_TIME_R_TYPE
|
||||
PHP_READDIR_R_TYPE
|
||||
@@ -857,15 +861,15 @@ if test "$PHP_PEAR" != "no"; then
|
||||
dnl
|
||||
if test "$PHP_SAPI_CLI" = "no"; then
|
||||
pear_error_msg="$pear_error_msg
|
||||
PEAR requires CLI to be enabled. Add --enable-cli to the configure line."
|
||||
PEAR requires CLI to be enabled. Add --enable-cli to the configure line. (or --disable-pear)"
|
||||
fi
|
||||
if test "$PHP_PCRE_REGEX" = "no"; then
|
||||
pear_error_msg="$pear_error_msg
|
||||
PEAR requires PCRE to be enabled. Add --with-pcre-regex to the configure line."
|
||||
PEAR requires PCRE to be enabled. Add --with-pcre-regex to the configure line. (or --disable-pear)"
|
||||
fi
|
||||
if test "$PHP_XML" = "no"; then
|
||||
pear_error_msg="$pear_error_msg
|
||||
PEAR requires XML to be enabled. Add --enable-xml to the configure line."
|
||||
PEAR requires XML to be enabled. Add --enable-xml to the configure line. (or --disable-pear)"
|
||||
fi
|
||||
|
||||
dnl
|
||||
@@ -873,7 +877,7 @@ dnl ext/xmlrpc is not really there yet to be a requirement..
|
||||
dnl
|
||||
dnl if test "$PHP_XMLRPC" = "no"; then
|
||||
dnl pear_error_msg="$pear_error_msg
|
||||
dnl PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line."
|
||||
dnl PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line. (or --disable-pear)"
|
||||
dnl fi
|
||||
dnl
|
||||
|
||||
@@ -916,7 +920,7 @@ fi
|
||||
|
||||
if test "$abs_srcdir" != "$abs_builddir"; then
|
||||
INCLUDES="$INCLUDES -I\$(top_srcdir)/main -I\$(top_srcdir)/Zend"
|
||||
INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM"
|
||||
INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM -I\$(top_builddir)/"
|
||||
fi
|
||||
|
||||
ZEND_EXTRA_LIBS="$LIBS"
|
||||
@@ -1210,7 +1214,7 @@ PHP_ADD_SOURCES(Zend, \
|
||||
zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
|
||||
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
|
||||
zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
|
||||
zend_ini.c zend_qsort.c zend_multibyte.c)
|
||||
zend_ini.c zend_qsort.c zend_multibyte.c zend_strtod.c)
|
||||
|
||||
if test -r "$abs_srcdir/Zend/zend_objects.c"; then
|
||||
PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c zend_mm.c)
|
||||
@@ -1407,7 +1411,7 @@ cat <<X
|
||||
| If your application relies on register_globals being ON, you |
|
||||
| should explicitly set it to on in your php.ini file. |
|
||||
| Note that you are strongly encouraged to read |
|
||||
| http://www.php.net/manual/en/security.registerglobals.php |
|
||||
| http://www.php.net/manual/en/security.globals.php |
|
||||
| about the implications of having register_globals set to on, and |
|
||||
| avoid using it if possible. |
|
||||
+--------------------------------------------------------------------+
|
||||
|
||||
@@ -92,6 +92,7 @@ bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale TSR
|
||||
bc_free_num (&power);
|
||||
bc_free_num (&exponent);
|
||||
bc_free_num (result);
|
||||
bc_free_num (&parity);
|
||||
*result = temp;
|
||||
return 0; /* Everything is OK. */
|
||||
}
|
||||
+1
-1
@@ -185,7 +185,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
|
||||
|
||||
if (bz_file == NULL) {
|
||||
/* that didn't work, so try and get something from the network/wrapper */
|
||||
stream = php_stream_open_wrapper(path, mode, options, opened_path);
|
||||
stream = php_stream_open_wrapper(path, mode, options | STREAM_WILL_CAST, opened_path);
|
||||
|
||||
if (stream) {
|
||||
int fd;
|
||||
|
||||
+2
-2
@@ -1849,7 +1849,7 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer
|
||||
|
||||
obj = obj_prop;
|
||||
php_COM_set(obj, &V_DISPATCH(var_result), TRUE TSRMLS_CC);
|
||||
VariantInit(var_result); // to protect C_DISPATCH(obj) from being freed when var_result is destructed
|
||||
VariantInit(var_result); /* to protect C_DISPATCH(obj) from being freed when var_result is destructed */
|
||||
} else {
|
||||
php_variant_to_pval(var_result, &retval, codepage TSRMLS_CC);
|
||||
|
||||
@@ -1934,7 +1934,7 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_refere
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
VariantInit(var_result); // to protect C_DISPATCH(obj) from being freed when var_result is destructed
|
||||
VariantInit(var_result); /* to protect C_DISPATCH(obj) from being freed when var_result is destructed */
|
||||
zval_dtor(&overloaded_property->element);
|
||||
}
|
||||
FREE_VARIANT(var_result);
|
||||
|
||||
+1
-1
@@ -181,7 +181,7 @@ static pval php_VARIANT_get_property_handler(zend_property_reference *property_r
|
||||
|
||||
case OE_IS_OBJECT:
|
||||
if (!strcmp(Z_STRVAL(overloaded_property->element), "value")) {
|
||||
// var_arg can't be an idispatch, so we don't care for the implicit AddRef() call here
|
||||
/* var_arg can't be an idispatch, so we don't care for the implicit AddRef() call here */
|
||||
php_variant_to_pval(var_arg, &result, codepage TSRMLS_CC);
|
||||
} else if (!strcmp(Z_STRVAL(overloaded_property->element), "type")) {
|
||||
ZVAL_LONG(&result, V_VT(var_arg))
|
||||
|
||||
@@ -119,7 +119,7 @@ PHPAPI void php_pval_to_variant_ex2(pval *pval_arg, VARIANT *var_arg, VARTYPE ty
|
||||
var_arg = V_VARIANTREF(var_arg); /* put the array in that VARIANT */
|
||||
}
|
||||
if (!type) {
|
||||
// if no type is given we take the variant type
|
||||
/* if no type is given we take the variant type */
|
||||
type = VT_VARIANT;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -280,7 +280,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex(
|
||||
ZVAL_NULL(zarg);
|
||||
}
|
||||
} else {
|
||||
// arg can't be an idispatch, so we don't care for the implicit AddRef() call here
|
||||
/* arg can't be an idispatch, so we don't care for the implicit AddRef() call here */
|
||||
if (FAILURE == php_variant_to_pval(arg, zarg, codepage TSRMLS_CC)) {
|
||||
trace("failed to convert arg %d to zval\n", i);
|
||||
ZVAL_NULL(zarg);
|
||||
|
||||
+23
-7
@@ -1563,7 +1563,9 @@ PHP_FUNCTION(cpdf_setdash)
|
||||
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (!pdf->currentMemStream) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
snprintf(buffer, BUFFERLEN, "[%d %d] 0", (int) Z_LVAL_P(arg2), (int) Z_LVAL_P(arg3));
|
||||
cpdf_setdash(pdf, buffer);
|
||||
|
||||
@@ -2522,16 +2524,30 @@ PHP_FUNCTION(cpdf_place_inline_image)
|
||||
}
|
||||
|
||||
count = 3 * im->sx * im->sy;
|
||||
if(NULL == (buffer = (unsigned char *) emalloc(count)))
|
||||
RETURN_FALSE;
|
||||
buffer = (unsigned char *) safe_emalloc(3 * im->sx, im->sy, 0);
|
||||
|
||||
ptr = buffer;
|
||||
for(i=0; i<im->sy; i++) {
|
||||
for(j=0; j<im->sx; j++) {
|
||||
color = im->pixels[i][j];
|
||||
*ptr++ = im->red[color];
|
||||
*ptr++ = im->green[color];
|
||||
*ptr++ = im->blue[color];
|
||||
#if HAVE_LIBGD20
|
||||
if(gdImageTrueColor(im)) {
|
||||
if (im->tpixels && gdImageBoundsSafe(im, j, i)) {
|
||||
color = gdImageTrueColorPixel(im, j, i);
|
||||
*ptr++ = (color >> 16) & 0xFF;
|
||||
*ptr++ = (color >> 8) & 0xFF;
|
||||
*ptr++ = color & 0xFF;
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
if (im->pixels && gdImageBoundsSafe(im, j, i)) {
|
||||
color = im->pixels[i][j];
|
||||
*ptr++ = im->red[color];
|
||||
*ptr++ = im->green[color];
|
||||
*ptr++ = im->blue[color];
|
||||
}
|
||||
#if HAVE_LIBGD20
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -97,7 +97,13 @@ PHP_MINFO_FUNCTION(ctype)
|
||||
return; \
|
||||
switch (Z_TYPE_P(c)) { \
|
||||
case IS_LONG: \
|
||||
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
|
||||
if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \
|
||||
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
|
||||
} else if (Z_LVAL_P(c) >= -128 && Z_LVAL_P(c) < 0) { \
|
||||
RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \
|
||||
} \
|
||||
SEPARATE_ZVAL(&c); \
|
||||
convert_to_string(c); \
|
||||
case IS_STRING: \
|
||||
{ \
|
||||
char *p; \
|
||||
|
||||
+91
-12
@@ -22,6 +22,10 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
|
||||
#if HAVE_CURL
|
||||
@@ -30,13 +34,17 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#include <winsock.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <curl/easy.h>
|
||||
|
||||
/* As of curl 7.11.1 this is no longer defined inside curl.h */
|
||||
#ifndef HttpPost
|
||||
#define HttpPost curl_httppost
|
||||
#endif
|
||||
|
||||
#define SMART_STR_PREALLOC 4096
|
||||
|
||||
#include "ext/standard/php_smart_str.h"
|
||||
@@ -133,7 +141,9 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FOLLOWLOCATION);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FTPASCII);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PUT);
|
||||
#if CURLOPT_MUTE != 0
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_MUTE);
|
||||
#endif
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_USERPWD);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXYUSERPWD);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_RANGE);
|
||||
@@ -191,10 +201,28 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SSLENGINE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SSLENGINE_DEFAULT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_CRLF);
|
||||
REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFMODSINCE);
|
||||
REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFUNMODSINCE);
|
||||
REGISTER_CURL_CONSTANT(CURL_TIMECOND_LASTMOD);
|
||||
#if LIBCURL_VERSION_NUM >= 0x070a00
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_ENCODING);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM > 0x070a05 /* CURLOPT_HTTPAUTH is available since curl 7.10.6 */
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_HTTPAUTH);
|
||||
/* http authentication options */
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_BASIC);
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_DIGEST);
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_GSSNEGOTIATE);
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_NTLM);
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_ANY);
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_ANYSAFE);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM > 0x070a06 /* CURLOPT_PROXYAUTH is available since curl 7.10.7 */
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXYAUTH);
|
||||
#endif
|
||||
|
||||
/* Constants effecting the way CURLOPT_CLOSEPOLICY works */
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_TRAFFIC);
|
||||
@@ -277,6 +305,35 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLE_TELNET_OPTION_SYNTAX);
|
||||
REGISTER_CURL_CONSTANT(CURLE_OBSOLETE);
|
||||
REGISTER_CURL_CONSTANT(CURLE_SSL_PEER_CERTIFICATE);
|
||||
REGISTER_CURL_CONSTANT(CURLE_GOT_NOTHING);
|
||||
REGISTER_CURL_CONSTANT(CURLE_SSL_ENGINE_NOTFOUND);
|
||||
REGISTER_CURL_CONSTANT(CURLE_SSL_ENGINE_SETFAILED);
|
||||
REGISTER_CURL_CONSTANT(CURLE_SEND_ERROR);
|
||||
REGISTER_CURL_CONSTANT(CURLE_RECV_ERROR);
|
||||
#ifdef CURLE_SHARE_IN_USE
|
||||
REGISTER_CURL_CONSTANT(CURLE_SHARE_IN_USE);
|
||||
#endif
|
||||
#ifdef CURLE_SSL_CERTPROBLEM
|
||||
REGISTER_CURL_CONSTANT(CURLE_SSL_CERTPROBLEM);
|
||||
#endif
|
||||
#ifdef CURLE_SSL_CIPHER
|
||||
REGISTER_CURL_CONSTANT(CURLE_SSL_CIPHER);
|
||||
#endif
|
||||
#ifdef CURLE_SSL_CACERT
|
||||
REGISTER_CURL_CONSTANT(CURLE_SSL_CACERT);
|
||||
#endif
|
||||
#ifdef CURLE_BAD_CONTENT_ENCODING
|
||||
REGISTER_CURL_CONSTANT(CURLE_BAD_CONTENT_ENCODING);
|
||||
#endif
|
||||
#ifdef CURLE_LDAP_INVALID_URL
|
||||
REGISTER_CURL_CONSTANT(CURLE_LDAP_INVALID_URL);
|
||||
#endif
|
||||
#ifdef CURLE_FILESIZE_EXCEEDED
|
||||
REGISTER_CURL_CONSTANT(CURLE_FILESIZE_EXCEEDED);
|
||||
#endif
|
||||
#ifdef CURLE_FTP_SSL_FAILED
|
||||
REGISTER_CURL_CONSTANT(CURLE_FTP_SSL_FAILED);
|
||||
#endif
|
||||
|
||||
REGISTER_CURL_CONSTANT(CURL_NETRC_OPTIONAL);
|
||||
REGISTER_CURL_CONSTANT(CURL_NETRC_IGNORED);
|
||||
@@ -506,6 +563,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if CURLOPT_PASSWDFUNCTION != 0
|
||||
/* {{{ curl_passwd
|
||||
*/
|
||||
static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
|
||||
@@ -552,6 +610,7 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
/* {{{ curl_free_string
|
||||
*/
|
||||
@@ -649,6 +708,7 @@ PHP_FUNCTION(curl_init)
|
||||
curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20); /* prevent infinite redirects */
|
||||
|
||||
if (argc > 0) {
|
||||
char *urlcopy;
|
||||
@@ -697,7 +757,9 @@ PHP_FUNCTION(curl_setopt)
|
||||
case CURLOPT_NETRC:
|
||||
case CURLOPT_FOLLOWLOCATION:
|
||||
case CURLOPT_PUT:
|
||||
case CURLOPT_MUTE:
|
||||
#if CURLOPT_MUTE != 0
|
||||
case CURLOPT_MUTE:
|
||||
#endif
|
||||
case CURLOPT_TIMEOUT:
|
||||
case CURLOPT_FTP_USE_EPSV:
|
||||
case CURLOPT_LOW_SPEED_LIMIT:
|
||||
@@ -721,6 +783,12 @@ PHP_FUNCTION(curl_setopt)
|
||||
case CURLOPT_HTTPGET:
|
||||
case CURLOPT_HTTP_VERSION:
|
||||
case CURLOPT_CRLF:
|
||||
#if LIBCURL_VERSION_NUM > 0x070a05 /* CURLOPT_HTTPAUTH is available since curl 7.10.6 */
|
||||
case CURLOPT_HTTPAUTH:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM > 0x070a06 /* CURLOPT_PROXYAUTH is available since curl 7.10.7 */
|
||||
case CURLOPT_PROXYAUTH:
|
||||
#endif
|
||||
convert_to_long_ex(zvalue);
|
||||
error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
|
||||
break;
|
||||
@@ -842,6 +910,7 @@ PHP_FUNCTION(curl_setopt)
|
||||
ch->handlers->write_header->func = *zvalue;
|
||||
ch->handlers->write_header->method = PHP_CURL_USER;
|
||||
break;
|
||||
#if CURLOPT_PASSWDFUNCTION != 0
|
||||
case CURLOPT_PASSWDFUNCTION:
|
||||
if (ch->handlers->passwd) {
|
||||
zval_ptr_dtor(&ch->handlers->passwd);
|
||||
@@ -851,6 +920,7 @@ PHP_FUNCTION(curl_setopt)
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDFUNCTION, curl_passwd);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDDATA, (void *) ch);
|
||||
break;
|
||||
#endif
|
||||
case CURLOPT_POSTFIELDS:
|
||||
if (Z_TYPE_PP(zvalue) == IS_ARRAY || Z_TYPE_PP(zvalue) == IS_OBJECT) {
|
||||
zval **current;
|
||||
@@ -893,7 +963,7 @@ PHP_FUNCTION(curl_setopt)
|
||||
error = curl_formadd(&first, &last,
|
||||
CURLFORM_COPYNAME, string_key,
|
||||
CURLFORM_NAMELENGTH, string_key_len - 1,
|
||||
(ZVAL_REFCOUNT(*zvalue) > 1 ? CURLFORM_PTRCONTENTS : CURLFORM_COPYCONTENTS), postval,
|
||||
CURLFORM_COPYCONTENTS, postval,
|
||||
CURLFORM_CONTENTSLENGTH, Z_STRLEN_PP(current),
|
||||
CURLFORM_END);
|
||||
}
|
||||
@@ -1138,10 +1208,13 @@ PHP_FUNCTION(curl_getinfo)
|
||||
switch (option) {
|
||||
case CURLINFO_EFFECTIVE_URL:
|
||||
case CURLINFO_CONTENT_TYPE: {
|
||||
char *s_code;
|
||||
char *s_code = NULL;
|
||||
|
||||
curl_easy_getinfo(ch->cp, option, &s_code);
|
||||
RETURN_STRING(s_code, 1);
|
||||
if (curl_easy_getinfo(ch->cp, option, &s_code) == CURLE_OK && s_code) {
|
||||
RETURN_STRING(s_code, 1);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1151,10 +1224,13 @@ PHP_FUNCTION(curl_getinfo)
|
||||
case CURLINFO_FILETIME:
|
||||
case CURLINFO_SSL_VERIFYRESULT:
|
||||
case CURLINFO_REDIRECT_COUNT: {
|
||||
long code;
|
||||
long code = 0;
|
||||
|
||||
curl_easy_getinfo(ch->cp, option, &code);
|
||||
RETURN_LONG(code);
|
||||
if (curl_easy_getinfo(ch->cp, option, &code) == CURLE_OK) {
|
||||
RETURN_LONG(code);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1170,10 +1246,13 @@ PHP_FUNCTION(curl_getinfo)
|
||||
case CURLINFO_CONTENT_LENGTH_UPLOAD:
|
||||
case CURLINFO_STARTTRANSFER_TIME:
|
||||
case CURLINFO_REDIRECT_TIME: {
|
||||
double code;
|
||||
double code = 0.0;
|
||||
|
||||
curl_easy_getinfo(ch->cp, option, &code);
|
||||
RETURN_DOUBLE(code);
|
||||
if (curl_easy_getinfo(ch->cp, option, &code) == CURLE_OK) {
|
||||
RETURN_DOUBLE(code);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ PHPAPI php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *fil
|
||||
curl_easy_setopt(curlstream->curl, CURLOPT_PROGRESSDATA, stream);
|
||||
curl_easy_setopt(curlstream->curl, CURLOPT_NOPROGRESS, 0);
|
||||
|
||||
curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, "PHP/" PHP_VERSION);
|
||||
curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, FG(user_agent) ? FG(user_agent) : "PHP/" PHP_VERSION);
|
||||
|
||||
/* TODO: read cookies and options from context */
|
||||
|
||||
|
||||
+6
-3
@@ -11,8 +11,11 @@ AC_DEFUN(PHP_DBA_STD_BEGIN,[
|
||||
AC_DEFUN(PHP_TEMP_LDFLAGS,[
|
||||
old_LDFLAGS=$LDFLAGS
|
||||
LDFLAGS="$1 $LDFLAGS"
|
||||
$2
|
||||
old_LIBS=$LIBS
|
||||
LIBS="$2 $LIBS"
|
||||
$3
|
||||
LDFLAGS=$old_LDFLAGS
|
||||
LIBS=$old_LIBS
|
||||
])
|
||||
|
||||
dnl Assign INCLUDE/LFLAGS from PREFIX
|
||||
@@ -134,7 +137,7 @@ dnl parameters(version, library list, function)
|
||||
AC_DEFUN(PHP_DBA_DB_CHECK,[
|
||||
for LIB in $2; do
|
||||
if test -f $THIS_PREFIX/lib/lib$LIB.a -o -f $THIS_PREFIX/lib/lib$LIB.$SHLIB_SUFFIX_NAME; then
|
||||
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib -l$LIB,[
|
||||
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib, -l$LIB,[
|
||||
AC_TRY_LINK([
|
||||
#include "$THIS_INCLUDE"
|
||||
],[
|
||||
@@ -171,7 +174,7 @@ AC_DEFUN(PHP_DBA_DB_CHECK,[
|
||||
])
|
||||
fi
|
||||
if test "$ext_shared" = "yes"; then
|
||||
AC_MSG_CHECKING(if db can be used as shared extension)
|
||||
AC_MSG_CHECKING(if dba can be used as shared extension)
|
||||
AC_EGREP_CPP(yes,[
|
||||
#include "$THIS_INCLUDE"
|
||||
#if DB_VERSION_MAJOR > 3 || (DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR > 2)
|
||||
|
||||
@@ -53,6 +53,10 @@ DBA_OPEN_FUNC(db2)
|
||||
struct stat check_stat;
|
||||
int s = VCWD_STAT(info->path, &check_stat);
|
||||
|
||||
if (!s && !check_stat.st_size) {
|
||||
info->mode = DBA_TRUNC; /* force truncate */
|
||||
}
|
||||
|
||||
type = info->mode == DBA_READER ? DB_UNKNOWN :
|
||||
info->mode == DBA_TRUNC ? DB_BTREE :
|
||||
s ? DB_BTREE : DB_UNKNOWN;
|
||||
|
||||
+6
-2
@@ -62,9 +62,13 @@ DBA_OPEN_FUNC(db3)
|
||||
struct stat check_stat;
|
||||
int s = VCWD_STAT(info->path, &check_stat);
|
||||
|
||||
type = info->mode == DBA_READER ? DB_UNKNOWN :
|
||||
if (!s && !check_stat.st_size) {
|
||||
info->mode = DBA_TRUNC; /* force truncate */
|
||||
}
|
||||
|
||||
type = info->mode == DBA_READER ? DB_UNKNOWN :
|
||||
info->mode == DBA_TRUNC ? DB_BTREE :
|
||||
s? DB_BTREE : DB_UNKNOWN;
|
||||
s ? DB_BTREE : DB_UNKNOWN;
|
||||
|
||||
gmode = info->mode == DBA_READER ? DB_RDONLY :
|
||||
(info->mode == DBA_CREAT && s) ? DB_CREATE :
|
||||
|
||||
+6
-2
@@ -62,9 +62,13 @@ DBA_OPEN_FUNC(db4)
|
||||
struct stat check_stat;
|
||||
int s = VCWD_STAT(info->path, &check_stat);
|
||||
|
||||
type = info->mode == DBA_READER ? DB_UNKNOWN :
|
||||
if (!s && !check_stat.st_size) {
|
||||
info->mode = DBA_TRUNC; /* force truncate */
|
||||
}
|
||||
|
||||
type = info->mode == DBA_READER ? DB_UNKNOWN :
|
||||
info->mode == DBA_TRUNC ? DB_BTREE :
|
||||
s? DB_BTREE : DB_UNKNOWN;
|
||||
s ? DB_BTREE : DB_UNKNOWN;
|
||||
|
||||
gmode = info->mode == DBA_READER ? DB_RDONLY :
|
||||
(info->mode == DBA_CREAT && s) ? DB_CREATE :
|
||||
|
||||
@@ -14,7 +14,7 @@ magic_quotes_runtime=1
|
||||
require_once('test.inc');
|
||||
echo "database handler: $handler\n";
|
||||
// print md5 checksum of test.cdb which is generated by cdb_make program
|
||||
var_dump(md5(implode('',file(dirname(__FILE__).'/test.cdb'))));
|
||||
var_dump(md5_file(dirname(__FILE__).'/test.cdb'));
|
||||
if (($db_make=dba_open($db_file, "n", $handler))!==FALSE) {
|
||||
dba_insert("1", "1", $db_make);
|
||||
dba_insert("2", "2", $db_make);
|
||||
@@ -26,7 +26,7 @@ magic_quotes_runtime=1
|
||||
// dba_replace cdb_make doesn't know replace
|
||||
dba_close($db_make);
|
||||
// write md5 checksum of generated database file
|
||||
var_dump(md5(implode('',file($db_file))));
|
||||
var_dump(md5_file($db_file));
|
||||
// no need to test created database: this is done by dba_cdb_read.phpt
|
||||
} else {
|
||||
echo "Error creating database\n";
|
||||
@@ -34,5 +34,5 @@ magic_quotes_runtime=1
|
||||
?>
|
||||
--EXPECT--
|
||||
database handler: cdb_make
|
||||
string(32) "723d19f39c1b15b3b455dd64323148d1"
|
||||
string(32) "723d19f39c1b15b3b455dd64323148d1"
|
||||
string(32) "12fc5ba2b9dcfef2480e5324eeb5f3e5"
|
||||
string(32) "12fc5ba2b9dcfef2480e5324eeb5f3e5"
|
||||
+27
-6
@@ -79,8 +79,10 @@ ZEND_GET_MODULE(dio)
|
||||
static void _dio_close_fd(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
php_fd_t *f = (php_fd_t *) rsrc->ptr;
|
||||
close(f->fd);
|
||||
free(f);
|
||||
if (f) {
|
||||
close(f->fd);
|
||||
free(f);
|
||||
}
|
||||
}
|
||||
|
||||
#define RDIOC(c) REGISTER_LONG_CONSTANT(#c, c, CONST_CS | CONST_PERSISTENT)
|
||||
@@ -142,10 +144,13 @@ PHP_MINFO_FUNCTION(dio)
|
||||
php_info_print_table_end();
|
||||
}
|
||||
|
||||
static void new_php_fd(php_fd_t **f, int fd)
|
||||
static int new_php_fd(php_fd_t **f, int fd)
|
||||
{
|
||||
*f = malloc(sizeof(php_fd_t));
|
||||
if (!(*f = malloc(sizeof(php_fd_t)))) {
|
||||
return 0;
|
||||
}
|
||||
(*f)->fd = fd;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* {{{ proto resource dio_open(string filename, int flags[, int mode])
|
||||
@@ -179,7 +184,10 @@ PHP_FUNCTION(dio_open)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
new_php_fd(&f, fd);
|
||||
|
||||
if (!new_php_fd(&f, fd)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, f, le_fd);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -199,6 +207,11 @@ PHP_FUNCTION(dio_read)
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
|
||||
|
||||
if (bytes <= 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0.");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
data = emalloc(bytes + 1);
|
||||
res = read(f->fd, data, bytes);
|
||||
if (res <= 0) {
|
||||
@@ -227,6 +240,12 @@ PHP_FUNCTION(dio_write)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &r_fd, &data, &data_len, &trunc_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (trunc_len < 0 || trunc_len > data_len) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater or equal to zero and less then the length of the specified string.");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
|
||||
|
||||
res = write(f->fd, data, trunc_len ? trunc_len : data_len);
|
||||
@@ -410,7 +429,9 @@ PHP_FUNCTION(dio_fcntl)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
new_php_fd(&new_f, fcntl(f->fd, cmd, Z_LVAL_P(arg)));
|
||||
if (!new_php_fd(&new_f, fcntl(f->fd, cmd, Z_LVAL_P(arg)))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, new_f, le_fd);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
this extension is experimental,
|
||||
its functions may change their names
|
||||
or move to extension all together
|
||||
so do not rely to much on them
|
||||
you have been warned!
|
||||
+28
-13
@@ -540,8 +540,8 @@ zend_module_entry domxml_module_entry = {
|
||||
domxml_functions,
|
||||
PHP_MINIT(domxml),
|
||||
PHP_MSHUTDOWN(domxml),
|
||||
NULL,
|
||||
NULL,
|
||||
PHP_RINIT(domxml),
|
||||
PHP_RSHUTDOWN(domxml),
|
||||
PHP_MINFO(domxml),
|
||||
DOMXML_API_VERSION, /* Extension versionnumber */
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
@@ -1510,6 +1510,24 @@ static void domxml_error_validate(void *ctx, const char *msg, ...)
|
||||
|
||||
}
|
||||
|
||||
PHP_RINIT_FUNCTION(domxml)
|
||||
{
|
||||
xmlSetGenericErrorFunc(xmlGenericErrorContext, (xmlGenericErrorFunc)domxml_error);
|
||||
#if HAVE_DOMXSLT
|
||||
xsltSetGenericErrorFunc(xsltGenericErrorContext, (xmlGenericErrorFunc)domxml_error);
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_RSHUTDOWN_FUNCTION(domxml)
|
||||
{
|
||||
xmlSetGenericErrorFunc(xmlGenericErrorContext, NULL);
|
||||
#if HAVE_DOMXSLT
|
||||
xsltSetGenericErrorFunc(xsltGenericErrorContext, NULL);
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_MSHUTDOWN_FUNCTION(domxml)
|
||||
{
|
||||
#if HAVE_DOMXSLT
|
||||
@@ -1668,15 +1686,9 @@ PHP_MINIT_FUNCTION(domxml)
|
||||
REGISTER_LONG_CONSTANT("DOMXML_LOAD_SUBSTITUTE_ENTITIES", DOMXML_LOAD_SUBSTITUTE_ENTITIES, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DOMXML_LOAD_COMPLETE_ATTRS",DOMXML_LOAD_COMPLETE_ATTRS, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DOMXML_LOAD_DONT_KEEP_BLANKS",DOMXML_LOAD_DONT_KEEP_BLANKS, CONST_CS | CONST_PERSISTENT);
|
||||
xmlSetGenericErrorFunc(xmlGenericErrorContext, (xmlGenericErrorFunc)domxml_error);
|
||||
#if (defined(LIBXML_THREAD_ENABLED) && LIBXML_VERSION >= 20511)
|
||||
xmlThrDefSetGenericErrorFunc(xmlGenericErrorContext, (xmlGenericErrorFunc)domxml_error);
|
||||
#endif
|
||||
#if HAVE_DOMXSLT
|
||||
xsltSetGenericErrorFunc(xsltGenericErrorContext, (xmlGenericErrorFunc)domxml_error);
|
||||
#if HAVE_DOMEXSLT
|
||||
|
||||
#if HAVE_DOMXSLT && HAVE_DOMEXSLT
|
||||
exsltRegisterAll();
|
||||
#endif
|
||||
#endif
|
||||
xmlInitParser();
|
||||
return SUCCESS;
|
||||
@@ -4803,15 +4815,17 @@ PHP_FUNCTION(domxml_xmltree)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, &ret);
|
||||
DOMXML_DOMOBJ_NEW(rv, (xmlNodePtr) docp, &ret);
|
||||
|
||||
/* The root itself maybe an array. Though you may not have two Elements
|
||||
as root, you may have a comment, pi and and element as root.
|
||||
Thanks to Paul DuBois for pointing me at this.
|
||||
*/
|
||||
if (node_children(&children, root TSRMLS_CC) >= 0) {
|
||||
zend_hash_update(Z_OBJPROP_P(return_value), "children",sizeof("children"), (void *) &children, sizeof(zval *), NULL);
|
||||
zend_hash_update(Z_OBJPROP_P(rv), "children",sizeof("children"), (void *) &children, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
DOMXML_RET_ZVAL(rv);
|
||||
/* xmlFreeDoc(docp); */
|
||||
}
|
||||
/* }}} */
|
||||
@@ -5358,7 +5372,8 @@ PHP_FUNCTION(domxml_xslt_process)
|
||||
xmlDocPtr xmldocp;
|
||||
xmlDocPtr docp;
|
||||
char **params = NULL;
|
||||
int ret, clone = -1;
|
||||
int ret;
|
||||
long clone = -1;
|
||||
char *filename;
|
||||
int filename_len = 0;
|
||||
FILE *f;
|
||||
|
||||
@@ -75,6 +75,8 @@ PHPAPI zval *php_domobject_new(xmlNodePtr obj, int *found, zval* in TSRMLS_DC);
|
||||
/* directory functions */
|
||||
PHP_MINIT_FUNCTION(domxml);
|
||||
PHP_MSHUTDOWN_FUNCTION(domxml);
|
||||
PHP_RINIT_FUNCTION(domxml);
|
||||
PHP_RSHUTDOWN_FUNCTION(domxml);
|
||||
PHP_MINFO_FUNCTION(domxml);
|
||||
PHP_FUNCTION(domxml_version);
|
||||
PHP_FUNCTION(xmldoc);
|
||||
|
||||
+2
-2
@@ -2712,7 +2712,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
// JPEG does not use absolute pointers instead its pointers are relative to the start
|
||||
// of the TIFF header in APP1 section.
|
||||
*/
|
||||
if (offset_val+byte_count>ImageInfo->FileSize || (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM)) {
|
||||
if (offset_val+byte_count>ImageInfo->FileSize || (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM && ImageInfo->FileType!=IMAGE_FILETYPE_JPEG)) {
|
||||
if (value_ptr < dir_entry) {
|
||||
/* we can read this if offset_val > 0 */
|
||||
/* some files have their values in other parts of the file */
|
||||
@@ -3750,7 +3750,7 @@ PHP_FUNCTION(exif_read_data)
|
||||
}
|
||||
}
|
||||
for (i=0; i<SECTION_COUNT; i++) {
|
||||
sprintf(tmp, ",%s,", exif_get_sectionname(i));
|
||||
snprintf(tmp, sizeof(tmp), ",%s,", exif_get_sectionname(i));
|
||||
if (strstr(sections_str, tmp)) {
|
||||
sections_needed |= 1<<i;
|
||||
}
|
||||
|
||||
@@ -1213,7 +1213,12 @@ PHP_FUNCTION(fbsql_database)
|
||||
if (phpLink->databaseName) free(phpLink->databaseName);
|
||||
phpLink->databaseName = strdup(Z_STRVAL_PP(dbname));
|
||||
}
|
||||
RETURN_STRING(phpLink->databaseName, 1);
|
||||
if (phpLink->databaseName) {
|
||||
RETURN_STRING(phpLink->databaseName, 1);
|
||||
}
|
||||
else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+13
-2
@@ -721,6 +721,10 @@ PHP_FUNCTION(fdf_set_file)
|
||||
return;
|
||||
}
|
||||
|
||||
if (php_check_open_basedir(filename TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(filename, "wb+", CHECKUID_CHECK_MODE_PARAM))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
|
||||
|
||||
err = FDFSetFile(fdf, filename);
|
||||
@@ -863,7 +867,10 @@ PHP_FUNCTION(fdf_save_string)
|
||||
struct stat stat;
|
||||
char *buf;
|
||||
|
||||
fstat(fileno(fp), &stat);
|
||||
if (fstat(fileno(fp), &stat) == -1) {
|
||||
RETVAL_FALSE;
|
||||
goto err;
|
||||
}
|
||||
buf = emalloc(stat.st_size +1);
|
||||
fread(buf, stat.st_size, 1, fp);
|
||||
buf[stat.st_size] = '\0';
|
||||
@@ -881,7 +888,7 @@ PHP_FUNCTION(fdf_save_string)
|
||||
if(err != FDFErcOK) {
|
||||
FDF_FAILURE(err);
|
||||
}
|
||||
|
||||
err:
|
||||
if(temp_filename) {
|
||||
unlink(temp_filename);
|
||||
efree(temp_filename);
|
||||
@@ -1481,6 +1488,10 @@ PHP_FUNCTION(fdf_get_attachment) {
|
||||
|
||||
ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
|
||||
|
||||
if (php_check_open_basedir(savepath TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(savepath, "wb+", CHECKUID_CHECK_MODE_PARAM))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
strncpy(pathbuf , savepath, MAXPATHLEN-1);
|
||||
pathbuf[MAXPATHLEN-1] = '\0';
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <fribidi/fribidi.h>
|
||||
|
||||
/* The fribidi guys dont believe in BC */
|
||||
#ifdef FRIBIDI_CHAR_SET_UTF8
|
||||
#ifndef FRIBIDI_MICRO_VERSION_STR
|
||||
#define FRIBIDI_CHARSET_UTF8 FRIBIDI_CHAR_SET_UTF8
|
||||
#define FRIBIDI_CHARSET_ISO8859_6 FRIBIDI_CHAR_SET_ISO8859_6
|
||||
#define FRIBIDI_CHARSET_ISO8859_8 FRIBIDI_CHAR_SET_ISO8859_8
|
||||
@@ -212,7 +212,11 @@ PHP_FUNCTION(fribidi_log2vis)
|
||||
|
||||
out_string = (char *) emalloc(sizeof(char)*alloc_len);
|
||||
|
||||
#if FRIBIDI_MAJOR_VERSION == 0 && FRIBIDI_MINOR_VERSION <= 10
|
||||
fribidi_log2vis(u_logical_str, len, &base_dir, u_visual_str, position_L_to_V_list, position_V_to_L_list, embedding_level_list);
|
||||
#else
|
||||
fribidi_log2vis(NULL, u_logical_str, len, &base_dir, u_visual_str, position_L_to_V_list, position_V_to_L_list, embedding_level_list);
|
||||
#endif
|
||||
|
||||
/* convert back to original char set */
|
||||
switch(Z_LVAL_PP(charset)) {
|
||||
|
||||
+5
-2
@@ -362,6 +362,9 @@ ftp_syst(ftpbuf_t *ftp)
|
||||
return NULL;
|
||||
|
||||
syst = ftp->inbuf;
|
||||
while (*syst == ' ') {
|
||||
syst++;
|
||||
}
|
||||
if ((end = strchr(syst, ' ')))
|
||||
*end = 0;
|
||||
ftp->syst = estrdup(syst);
|
||||
@@ -724,12 +727,12 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
|
||||
ptr = s;
|
||||
}
|
||||
#else
|
||||
while ((s = memchr(ptr, '\r', (e - ptr)))) {
|
||||
while (e > ptr && (s = memchr(ptr, '\r', (e - ptr)))) {
|
||||
php_stream_write(outstream, ptr, (s - ptr));
|
||||
if (*(s + 1) == '\n') {
|
||||
s++;
|
||||
php_stream_putc(outstream, '\n');
|
||||
}
|
||||
php_stream_putc(outstream, '\n');
|
||||
ptr = s + 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
+4
-1
@@ -258,6 +258,7 @@ AC_DEFUN(PHP_GD_CHECK_VERSION,[
|
||||
PHP_CHECK_LIBRARY(gd, gdImageGifCtx, [AC_DEFINE(HAVE_GD_GIF_CTX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
|
||||
PHP_CHECK_LIBRARY(gd, gdCacheCreate, [AC_DEFINE(HAVE_GD_CACHE_CREATE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
|
||||
PHP_CHECK_LIBRARY(gd, gdFontCacheShutdown, [AC_DEFINE(HAVE_GD_THREAD_SAFE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
|
||||
PHP_CHECK_LIBRARY(gd, gdNewDynamicCtxEx, [AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
|
||||
])
|
||||
|
||||
dnl
|
||||
@@ -271,7 +272,7 @@ if test "$PHP_GD" = "yes"; then
|
||||
libgd/gdxpm.c libgd/gdfontt.c libgd/gdfonts.c libgd/gdfontmb.c libgd/gdfontl.c \
|
||||
libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c libgd/gdcache.c libgd/gdkanji.c \
|
||||
libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c libgd/gd_topal.c libgd/gd_gif_in.c \
|
||||
libgd/xbm.c"
|
||||
libgd/xbm.c libgd/gd_gif_out.c "
|
||||
|
||||
dnl check for fabsf and floorf which are available since C99
|
||||
AC_CHECK_FUNCS(fabsf floorf)
|
||||
@@ -305,7 +306,9 @@ dnl These are always available with bundled library
|
||||
AC_DEFINE(HAVE_GD_XBM, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_BUNDLED, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_GIF_READ, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_GIF_CREATE, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_IMAGEELLIPSE, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX, 1, [ ])
|
||||
|
||||
dnl Make sure the libgd/ is first in the include path
|
||||
GDLIB_CFLAGS="-DHAVE_LIBPNG"
|
||||
|
||||
+20
-6
@@ -35,6 +35,7 @@
|
||||
#include "SAPI.h"
|
||||
#include "php_gd.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_open_temporary_file.h"
|
||||
|
||||
#if HAVE_SYS_WAIT_H
|
||||
# include <sys/wait.h>
|
||||
@@ -107,6 +108,10 @@ extern int gdImageColorResolve(gdImagePtr, int, int, int);
|
||||
int gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GD_DYNAMIC_CTX_EX
|
||||
#define gdNewDynamicCtxEx(len, data, val) gdNewDynamicCtx(len, data)
|
||||
#endif
|
||||
|
||||
static gdImagePtr _php_image_create_from_string (zval **Data, char *tn, gdImagePtr (*ioctx_func_p)() TSRMLS_DC);
|
||||
static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)());
|
||||
static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)());
|
||||
@@ -390,7 +395,7 @@ PHP_RSHUTDOWN_FUNCTION(gd)
|
||||
/* }}} */
|
||||
|
||||
#if HAVE_GD_BUNDLED
|
||||
#define PHP_GD_VERSION_STRING "bundled (2.0.17 compatible)"
|
||||
#define PHP_GD_VERSION_STRING "bundled (2.0.28 compatible)"
|
||||
#elif HAVE_LIBGD20
|
||||
#define PHP_GD_VERSION_STRING "2.0 or higher"
|
||||
#elif HAVE_GDIMAGECOLORRESOLVE
|
||||
@@ -648,6 +653,7 @@ PHP_FUNCTION(imageloadfont)
|
||||
if (body_size != body_size_check) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error reading font");
|
||||
efree(font);
|
||||
php_stream_close(stream);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1241,7 +1247,7 @@ static int _php_image_type (char data[8])
|
||||
#ifdef HAVE_GD_WBMP
|
||||
else {
|
||||
gdIOCtx *io_ctx;
|
||||
io_ctx = gdNewDynamicCtx (8, data);
|
||||
io_ctx = gdNewDynamicCtxEx (8, data, 0);
|
||||
if (io_ctx) {
|
||||
if (getmbi((int(*)(void*))gdGetC, io_ctx) == 0 && skipheader((int(*)(void*))gdGetC, io_ctx) == 0 ) {
|
||||
#if HAVE_LIBGD204
|
||||
@@ -1273,7 +1279,7 @@ gdImagePtr _php_image_create_from_string(zval **data, char *tn, gdImagePtr (*ioc
|
||||
gdImagePtr im;
|
||||
gdIOCtx *io_ctx;
|
||||
|
||||
io_ctx = gdNewDynamicCtx (Z_STRLEN_PP(data), Z_STRVAL_PP(data));
|
||||
io_ctx = gdNewDynamicCtxEx(Z_STRLEN_PP(data), Z_STRVAL_PP(data), 0);
|
||||
|
||||
if (!io_ctx) {
|
||||
return NULL;
|
||||
@@ -1427,7 +1433,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
io_ctx = gdNewDynamicCtx(buff_size, buff);
|
||||
io_ctx = gdNewDynamicCtxEx(buff_size, buff, 0);
|
||||
if(!io_ctx) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot allocate GD IO context");
|
||||
goto out_err;
|
||||
@@ -1616,6 +1622,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
}
|
||||
|
||||
switch(image_type) {
|
||||
#ifdef HAVE_GD_WBMP
|
||||
case PHP_GDIMG_CONVERT_WBM:
|
||||
if (q == -1) {
|
||||
q = 0;
|
||||
@@ -1625,6 +1632,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
}
|
||||
gdImageWBMP(im, q, fp);
|
||||
break;
|
||||
#endif
|
||||
case PHP_GDIMG_TYPE_JPG:
|
||||
(*func_p)(im, fp, q);
|
||||
break;
|
||||
@@ -1655,14 +1663,16 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
int b;
|
||||
FILE *tmp;
|
||||
char buf[4096];
|
||||
char *path;
|
||||
|
||||
tmp = tmpfile();
|
||||
tmp = php_open_temporary_file("", "", &path TSRMLS_CC);
|
||||
if (tmp == NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open temporary file");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
switch(image_type) {
|
||||
#ifdef HAVE_GD_WBMP
|
||||
case PHP_GDIMG_CONVERT_WBM:
|
||||
if (q == -1) {
|
||||
q = 0;
|
||||
@@ -1672,6 +1682,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
}
|
||||
gdImageWBMP(im, q, tmp);
|
||||
break;
|
||||
#endif
|
||||
case PHP_GDIMG_TYPE_JPG:
|
||||
(*func_p)(im, tmp, q);
|
||||
break;
|
||||
@@ -1707,7 +1718,8 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
}
|
||||
|
||||
fclose(tmp);
|
||||
/* the temporary file is automatically deleted */
|
||||
VCWD_UNLINK((const char *)path); /* make sure that the temporary file is removed */
|
||||
efree(path);
|
||||
}
|
||||
RETURN_TRUE;
|
||||
}
|
||||
@@ -3635,9 +3647,11 @@ static void _php_image_bw_convert( gdImagePtr im_org, gdIOCtx *out, int threshol
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAVE_LIBGD20
|
||||
if (im_org->trueColor) {
|
||||
gdImageTrueColorToPalette(im_org, 1, 256);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (y = 0; y < dest_height; y++) {
|
||||
for (x = 0; x < dest_width; x++) {
|
||||
|
||||
+8
-4
@@ -43,8 +43,8 @@ RSC=rc.exe
|
||||
# PROP Intermediate_Dir "Release_TS"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=0 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=0 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
@@ -73,8 +73,8 @@ LINK32=link.exe
|
||||
# PROP Intermediate_Dir "Debug_TS"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=1 /D "HAVE_LIBGD15" /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
|
||||
# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=1 /D "HAVE_LIBGD15" /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
@@ -231,6 +231,10 @@ SOURCE=.\libgd\gd_gif_in.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\libgd\gd_gif_out.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\libgd\gd_io.c
|
||||
|
||||
!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
|
||||
|
||||
+110
-32
@@ -1290,7 +1290,9 @@ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
|
||||
inc = (dy * 65536) / dx;
|
||||
while ((x >> 16) < x2) {
|
||||
gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (y >> 8) & 0xFF);
|
||||
gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF);
|
||||
if ((y >> 16) + 1 < im->sy) {
|
||||
gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF);
|
||||
}
|
||||
x += (1 << 16);
|
||||
y += inc;
|
||||
}
|
||||
@@ -1310,7 +1312,9 @@ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
|
||||
inc = (dx * 65536) / dy;
|
||||
while ((y>>16) < y2) {
|
||||
gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (x >> 8) & 0xFF);
|
||||
gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF);
|
||||
if ((x >> 16) + 1 < im->sx) {
|
||||
gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF);
|
||||
}
|
||||
x += inc;
|
||||
y += (1<<16);
|
||||
}
|
||||
@@ -1603,9 +1607,14 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
|
||||
int lx = 0, ly = 0;
|
||||
int fx = 0, fy = 0;
|
||||
|
||||
while (s<0) {
|
||||
s += 360;
|
||||
}
|
||||
|
||||
while (e < s) {
|
||||
e += 360;
|
||||
}
|
||||
|
||||
for (i = s; i <= e; i++) {
|
||||
int x, y;
|
||||
x = ((long) gdCosT[i % 360] * (long) w / (2 * 1024)) + cx;
|
||||
@@ -1870,20 +1879,28 @@ void gdImageFill(gdImagePtr im, int x, int y, int nc)
|
||||
int l, x1, x2, dy;
|
||||
int oc; /* old pixel value */
|
||||
int wx2,wy2;
|
||||
int alphablending_bak;
|
||||
/* stack of filled segments */
|
||||
//struct seg stack[FILL_MAX],*sp = stack;;
|
||||
/* struct seg stack[FILL_MAX],*sp = stack;; */
|
||||
struct seg *stack;
|
||||
struct seg *sp;
|
||||
|
||||
alphablending_bak = im->alphaBlendingFlag;
|
||||
im->alphaBlendingFlag = 0;
|
||||
|
||||
if (nc==gdTiled){
|
||||
_gdImageFillTiled(im,x,y,nc);
|
||||
im->alphaBlendingFlag = alphablending_bak;
|
||||
return;
|
||||
}
|
||||
|
||||
wx2=im->sx;wy2=im->sy;
|
||||
oc = gdImageGetPixel(im, x, y);
|
||||
if (oc==nc || x<0 || x>wx2 || y<0 || y>wy2) return;
|
||||
|
||||
if (oc==nc || x<0 || x>wx2 || y<0 || y>wy2) {
|
||||
im->alphaBlendingFlag = alphablending_bak;
|
||||
return;
|
||||
}
|
||||
|
||||
stack = (struct seg *)emalloc(sizeof(struct seg) * ((int)(im->sy*im->sx)/4)+1);
|
||||
sp = stack;
|
||||
|
||||
@@ -1922,6 +1939,7 @@ skip: for (x++; x<=x2 && (gdImageGetPixel(im, x, y)!=oc); x++);
|
||||
} while (x<=x2);
|
||||
}
|
||||
efree(stack);
|
||||
im->alphaBlendingFlag = alphablending_bak;
|
||||
}
|
||||
|
||||
void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc)
|
||||
@@ -2011,24 +2029,72 @@ void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
|
||||
{
|
||||
int x1h = x1, x1v = x1, y1h = y1, y1v = y1, x2h = x2, x2v = x2, y2h = y2, y2v = y2;
|
||||
int thick = im->thick;
|
||||
int half1 = 1;
|
||||
int t;
|
||||
|
||||
if (thick > 1) {
|
||||
int half = thick / 2;
|
||||
int half1 = thick - half;
|
||||
if (y2 < y1) {
|
||||
t=y1;
|
||||
y1 = y2;
|
||||
y2 = t;
|
||||
|
||||
if (y1 < y2) {
|
||||
y1v = y1h - half;
|
||||
y2v = y2h + half1 - 1;
|
||||
} else {
|
||||
y1v = y1h + half1 - 1;
|
||||
y2v = y2h - half;
|
||||
t = x1;
|
||||
x1 = x2;
|
||||
x2 = t;
|
||||
}
|
||||
|
||||
x1h = x1; x1v = x1; y1h = y1; y1v = y1; x2h = x2; x2v = x2; y2h = y2; y2v = y2;
|
||||
if (thick > 1) {
|
||||
int cx, cy, x1ul, y1ul, x2lr, y2lr;
|
||||
int half = thick >> 1;
|
||||
half1 = thick - half;
|
||||
x1ul = x1 - half;
|
||||
y1ul = y1 - half;
|
||||
|
||||
x2lr = x2 + half;
|
||||
y2lr = y2 + half;
|
||||
|
||||
cy = y1ul + thick;
|
||||
while (cy-- > y1ul) {
|
||||
cx = x1ul - 1;
|
||||
while (cx++ < x2lr) {
|
||||
gdImageSetPixel(im, cx, cy, color);
|
||||
}
|
||||
}
|
||||
|
||||
cy = y2lr - thick;
|
||||
while (cy++ < y2lr) {
|
||||
cx = x1ul - 1;
|
||||
while (cx++ < x2lr) {
|
||||
gdImageSetPixel(im, cx, cy, color);
|
||||
}
|
||||
}
|
||||
|
||||
cy = y1ul + thick - 1;
|
||||
while (cy++ < y2lr -thick) {
|
||||
cx = x1ul - 1;
|
||||
while (cx++ < x1ul + thick) {
|
||||
gdImageSetPixel(im, cx, cy, color);
|
||||
}
|
||||
}
|
||||
|
||||
cy = y1ul + thick - 1;
|
||||
while (cy++ < y2lr -thick) {
|
||||
cx = x2lr - thick - 1;
|
||||
while (cx++ < x2lr) {
|
||||
gdImageSetPixel(im, cx, cy, color);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
y1v = y1h + 1;
|
||||
y2v = y2h - 1;
|
||||
gdImageLine(im, x1h, y1h, x2h, y1h, color);
|
||||
gdImageLine(im, x1h, y2h, x2h, y2h, color);
|
||||
gdImageLine(im, x1v, y1v, x1v, y2v, color);
|
||||
gdImageLine(im, x2v, y1v, x2v, y2v, color);
|
||||
}
|
||||
|
||||
gdImageLine(im, x1h, y1h, x2h, y1h, color);
|
||||
gdImageLine(im, x1h, y2h, x2h, y2h, color);
|
||||
gdImageLine(im, x1v, y1v, x1v, y2v, color);
|
||||
gdImageLine(im, x2v, y1v, x2v, y2v, color);
|
||||
}
|
||||
|
||||
void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
|
||||
@@ -2051,6 +2117,16 @@ void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int
|
||||
if (y1 > gdImageSY(im)) {
|
||||
y1 = gdImageSY(im);
|
||||
}
|
||||
if (y2 < y1) {
|
||||
int t;
|
||||
t=y1;
|
||||
y1 = y2;
|
||||
y2 = t;
|
||||
|
||||
t = x1;
|
||||
x1 = x2;
|
||||
x2 = t;
|
||||
}
|
||||
|
||||
for (y = y1; (y <= y2); y++) {
|
||||
for (x = x1; (x <= x2); x++) {
|
||||
@@ -2292,7 +2368,8 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int
|
||||
int tmp = gdImageGetPixel (src, x, y);
|
||||
mapTo = gdImageGetTrueColorPixel (src, x, y);
|
||||
if (gdImageGetTransparent (src) == tmp) {
|
||||
tox++;
|
||||
/* 2.0.21, TK: not tox++ */
|
||||
tox += stx[x - srcX];
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
@@ -2300,7 +2377,8 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int
|
||||
mapTo = gdImageGetTrueColorPixel (src, x, y);
|
||||
/* Added 7/24/95: support transparent copies */
|
||||
if (gdImageGetTransparent (src) == mapTo) {
|
||||
tox++;
|
||||
/* 2.0.21, TK: not tox++ */
|
||||
tox += stx[x - srcX];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -2356,22 +2434,24 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int
|
||||
void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH)
|
||||
{
|
||||
int x, y;
|
||||
double sy1, sy2, sx1, sx2;
|
||||
if (!dst->trueColor) {
|
||||
gdImageCopyResized (dst, src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
|
||||
return;
|
||||
}
|
||||
for (y = dstY; (y < dstY + dstH); y++) {
|
||||
sy1 = ((double) y - (double) dstY) * (double) srcH / (double) dstH;
|
||||
sy2 = ((double) (y + 1) - (double) dstY) * (double) srcH / (double) dstH;
|
||||
for (x = dstX; (x < dstX + dstW); x++) {
|
||||
float sy1, sy2, sx1, sx2;
|
||||
float sx, sy;
|
||||
float spixels = 0.0f;
|
||||
float red = 0.0f, green = 0.0f, blue = 0.0f, alpha = 0.0f;
|
||||
float alpha_factor, alpha_sum = 0.0f, contrib_sum = 0.0f;
|
||||
sy1 = ((float)(y - dstY)) * (float)srcH / (float)dstH;
|
||||
sy2 = ((float)(y + 1 - dstY)) * (float) srcH / (float) dstH;
|
||||
double sx, sy;
|
||||
double spixels = 0;
|
||||
double red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0;
|
||||
double alpha_factor, alpha_sum = 0.0, contrib_sum = 0.0;
|
||||
sx1 = ((double) x - (double) dstX) * (double) srcW / dstW;
|
||||
sx2 = ((double) (x + 1) - (double) dstX) * (double) srcW / dstW;
|
||||
sy = sy1;
|
||||
do {
|
||||
float yportion;
|
||||
double yportion;
|
||||
if (floor_cast(sy) == floor_cast(sy1)) {
|
||||
yportion = 1.0f - (sy - floor_cast(sy));
|
||||
if (yportion > sy2 - sy1) {
|
||||
@@ -2383,12 +2463,10 @@ void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i
|
||||
} else {
|
||||
yportion = 1.0f;
|
||||
}
|
||||
sx1 = ((float)(x - dstX)) * (float) srcW / dstW;
|
||||
sx2 = ((float)(x + 1 - dstX)) * (float) srcW / dstW;
|
||||
sx = sx1;
|
||||
do {
|
||||
float xportion;
|
||||
float pcontribution;
|
||||
double xportion;
|
||||
double pcontribution;
|
||||
int p;
|
||||
if (floorf(sx) == floor_cast(sx1)) {
|
||||
xportion = 1.0f - (sx - floor_cast(sx));
|
||||
|
||||
+76
-30
@@ -11,7 +11,7 @@ extern "C" {
|
||||
#define PATHSEPARATOR ":"
|
||||
#else
|
||||
/* default fontpath for windows systems */
|
||||
#define DEFAULT_FONTPATH "c:\\winnt\\fonts;."
|
||||
#define DEFAULT_FONTPATH "c:\\winnt\\fonts;c:\\windows\\fonts;."
|
||||
#define PATHSEPARATOR ";"
|
||||
#endif
|
||||
|
||||
@@ -21,8 +21,8 @@ extern "C" {
|
||||
* that the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation. This software is provided "AS IS." Thomas Boutell and
|
||||
* Boutell.Com, Inc. disclaim all warranties, either express or implied,
|
||||
* including but not limited to implied warranties of merchantability and
|
||||
* Boutell.Com, Inc. disclaim all warranties, either express or implied,
|
||||
* including but not limited to implied warranties of merchantability and
|
||||
* fitness for a particular purpose, with respect to this code and accompanying
|
||||
* documentation. */
|
||||
|
||||
@@ -43,19 +43,19 @@ void php_gd_error(const char *format, ...);
|
||||
|
||||
/* Image type. See functions below; you will not need to change
|
||||
the elements directly. Use the provided macros to
|
||||
access sx, sy, the color table, and colorsTotal for
|
||||
access sx, sy, the color table, and colorsTotal for
|
||||
read-only purposes. */
|
||||
|
||||
/* If 'truecolor' is set true, the image is truecolor;
|
||||
/* If 'truecolor' is set true, the image is truecolor;
|
||||
pixels are represented by integers, which
|
||||
must be 32 bits wide or more.
|
||||
must be 32 bits wide or more.
|
||||
|
||||
True colors are repsented as follows:
|
||||
|
||||
ARGB
|
||||
|
||||
Where 'A' (alpha channel) occupies only the
|
||||
LOWER 7 BITS of the MSB. This very small
|
||||
LOWER 7 BITS of the MSB. This very small
|
||||
loss of alpha channel resolution allows gd 2.x
|
||||
to keep backwards compatibility by allowing
|
||||
signed integers to be used to represent colors,
|
||||
@@ -78,7 +78,7 @@ void php_gd_error(const char *format, ...);
|
||||
#define gdEffectOverlay 3
|
||||
|
||||
|
||||
/* This function accepts truecolor pixel values only. The
|
||||
/* This function accepts truecolor pixel values only. The
|
||||
source color is composited with the destination color
|
||||
based on the alpha channel value of the source color.
|
||||
The resulting color is opaque. */
|
||||
@@ -96,11 +96,11 @@ typedef struct gdImageStruct {
|
||||
int colorsTotal;
|
||||
int red[gdMaxColors];
|
||||
int green[gdMaxColors];
|
||||
int blue[gdMaxColors];
|
||||
int blue[gdMaxColors];
|
||||
int open[gdMaxColors];
|
||||
/* For backwards compatibility, this is set to the
|
||||
first palette entry with 100% transparency,
|
||||
and is also set and reset by the
|
||||
and is also set and reset by the
|
||||
gdImageColorTransparent function. Newer
|
||||
applications can allocate palette entries
|
||||
with any desired level of transparency; however,
|
||||
@@ -112,7 +112,7 @@ typedef struct gdImageStruct {
|
||||
int *polyInts;
|
||||
int polyAllocated;
|
||||
struct gdImageStruct *brush;
|
||||
struct gdImageStruct *tile;
|
||||
struct gdImageStruct *tile;
|
||||
int brushColorMap[gdMaxColors];
|
||||
int tileColorMap[gdMaxColors];
|
||||
int styleLength;
|
||||
@@ -126,10 +126,10 @@ typedef struct gdImageStruct {
|
||||
really support multiple levels of transparency in
|
||||
palettes, to my knowledge, as of 2/15/01. Most
|
||||
common browsers will display 100% opaque and
|
||||
100% transparent correctly, and do something
|
||||
100% transparent correctly, and do something
|
||||
unpredictable and/or undesirable for levels
|
||||
in between. TBB */
|
||||
int alpha[gdMaxColors];
|
||||
int alpha[gdMaxColors];
|
||||
/* Truecolor flag and pixels. New 2.0 fields appear here at the
|
||||
end to minimize breakage of existing object code. */
|
||||
int trueColor;
|
||||
@@ -137,7 +137,7 @@ typedef struct gdImageStruct {
|
||||
/* Should alpha channel be copied, or applied, each time a
|
||||
pixel is drawn? This applies to truecolor images only.
|
||||
No attempt is made to alpha-blend in palette images,
|
||||
even if semitransparent palette entries exist.
|
||||
even if semitransparent palette entries exist.
|
||||
To do that, build your image as a truecolor image,
|
||||
then quantize down to 8 bits. */
|
||||
int alphaBlendingFlag;
|
||||
@@ -147,7 +147,7 @@ typedef struct gdImageStruct {
|
||||
PNG at the moment; other future formats may also
|
||||
have that capability. JPEG doesn't. */
|
||||
int saveAlphaFlag;
|
||||
|
||||
|
||||
|
||||
/* 2.0.12: anti-aliased globals */
|
||||
int AA;
|
||||
@@ -156,7 +156,7 @@ typedef struct gdImageStruct {
|
||||
unsigned char **AA_opacity;
|
||||
int AA_polygon;
|
||||
/* Stored and pre-computed variables for determining the perpendicular
|
||||
* distance from a point to the anti-aliased line being drawn:
|
||||
* distance from a point to the anti-aliased line being drawn:
|
||||
*/
|
||||
int AAL_x1;
|
||||
int AAL_y1;
|
||||
@@ -230,7 +230,7 @@ gdImagePtr gdImageCreateTrueColor(int sx, int sy);
|
||||
gdImagePtr gdImageCreateFromPng(FILE *fd);
|
||||
gdImagePtr gdImageCreateFromPngCtx(gdIOCtxPtr in);
|
||||
gdImagePtr gdImageCreateFromWBMP(FILE *inFile);
|
||||
gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile);
|
||||
gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile);
|
||||
gdImagePtr gdImageCreateFromJpeg(FILE *infile);
|
||||
gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile);
|
||||
|
||||
@@ -256,6 +256,7 @@ gdImagePtr gdImageCreateFromGd2Part(FILE *in, int srcx, int srcy, int w, int h);
|
||||
gdImagePtr gdImageCreateFromGd2PartCtx(gdIOCtxPtr in, int srcx, int srcy, int w, int h);
|
||||
|
||||
gdImagePtr gdImageCreateFromXbm(FILE *fd);
|
||||
void gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOCtx * out);
|
||||
|
||||
gdImagePtr gdImageCreateFromXpm (char *filename);
|
||||
|
||||
@@ -263,11 +264,11 @@ void gdImageDestroy(gdImagePtr im);
|
||||
|
||||
/* Replaces or blends with the background depending on the
|
||||
most recent call to gdImageAlphaBlending and the
|
||||
alpha channel value of 'color'; default is to overwrite.
|
||||
alpha channel value of 'color'; default is to overwrite.
|
||||
Tiling and line styling are also implemented
|
||||
here. All other gd drawing functions pass through this call,
|
||||
here. All other gd drawing functions pass through this call,
|
||||
allowing for many useful effects. */
|
||||
|
||||
|
||||
void gdImageSetPixel(gdImagePtr im, int x, int y, int color);
|
||||
|
||||
int gdImageGetPixel(gdImagePtr im, int x, int y);
|
||||
@@ -295,9 +296,9 @@ void gdImageString16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s
|
||||
void gdImageStringUp16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color);
|
||||
|
||||
/* 2.0.16: for thread-safe use of gdImageStringFT and friends,
|
||||
* call this before allowing any thread to call gdImageStringFT.
|
||||
* call this before allowing any thread to call gdImageStringFT.
|
||||
* Otherwise it is invoked by the first thread to invoke
|
||||
* gdImageStringFT, with a very small but real risk of a race condition.
|
||||
* gdImageStringFT, with a very small but real risk of a race condition.
|
||||
* Return 0 on success, nonzero on failure to initialize freetype.
|
||||
*/
|
||||
int gdFontCacheSetup(void);
|
||||
@@ -320,11 +321,14 @@ typedef struct {
|
||||
gdFTEX_Shift_JIS, or gdFTEX_Big5;
|
||||
when not specified, maps are searched
|
||||
for in the above order. */
|
||||
int hdpi;
|
||||
int vdpi;
|
||||
}
|
||||
gdFTStringExtra, *gdFTStringExtraPtr;
|
||||
|
||||
#define gdFTEX_LINESPACE 1
|
||||
#define gdFTEX_CHARMAP 2
|
||||
#define gdFTEX_RESOLUTION 4
|
||||
|
||||
/* These are NOT flags; set one in 'charmap' if you set the gdFTEX_CHARMAP bit in 'flags'. */
|
||||
#define gdFTEX_Unicode 0
|
||||
@@ -346,7 +350,7 @@ typedef struct {
|
||||
void gdImagePolygon(gdImagePtr im, gdPointPtr p, int n, int c);
|
||||
void gdImageFilledPolygon(gdImagePtr im, gdPointPtr p, int n, int c);
|
||||
|
||||
/* These functions still work with truecolor images,
|
||||
/* These functions still work with truecolor images,
|
||||
for which they never return error. */
|
||||
int gdImageColorAllocate(gdImagePtr im, int r, int g, int b);
|
||||
/* gd 2.0: palette entries with non-opaque transparency are permitted. */
|
||||
@@ -403,8 +407,11 @@ void gdImageColorDeallocate(gdImagePtr im, int color);
|
||||
conversion to palette is not great (for small images
|
||||
it can be negative) and the quality loss is ugly. */
|
||||
|
||||
gdImagePtr gdImageCreatePaletteFromTrueColor (gdImagePtr im, int ditherFlag, int colorsWanted);
|
||||
|
||||
void gdImageTrueColorToPalette(gdImagePtr im, int ditherFlag, int colorsWanted);
|
||||
|
||||
|
||||
/* An attempt at getting the results of gdImageTrueColorToPalette
|
||||
to look a bit more like the original (im1 is the original
|
||||
and im2 is the palette version */
|
||||
@@ -424,10 +431,12 @@ void gdImageColorTransparent(gdImagePtr im, int color);
|
||||
void gdImagePaletteCopy(gdImagePtr dst, gdImagePtr src);
|
||||
void gdImagePng(gdImagePtr im, FILE *out);
|
||||
void gdImagePngCtx(gdImagePtr im, gdIOCtx *out);
|
||||
void gdImageGif(gdImagePtr im, FILE *out);
|
||||
void gdImageGifCtx(gdImagePtr im, gdIOCtx *out);
|
||||
/* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all,
|
||||
* 1 is FASTEST but produces larger files, 9 provides the best
|
||||
* compression (smallest files) but takes a long time to compress, and
|
||||
* -1 selects the default compiled into the zlib library.
|
||||
* -1 selects the default compiled into the zlib library.
|
||||
*/
|
||||
void gdImagePngEx(gdImagePtr im, FILE * out, int level);
|
||||
void gdImagePngCtxEx(gdImagePtr im, gdIOCtx * out, int level);
|
||||
@@ -485,7 +494,7 @@ void gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int c);
|
||||
gdArc and gdChord are mutually exclusive;
|
||||
gdChord just connects the starting and ending
|
||||
angles with a straight line, while gdArc produces
|
||||
a rounded edge. gdPie is a synonym for gdArc.
|
||||
a rounded edge. gdPie is a synonym for gdArc.
|
||||
gdNoFill indicates that the arc or chord should be
|
||||
outlined, not filled. gdEdged, used together with
|
||||
gdNoFill, indicates that the beginning and ending
|
||||
@@ -504,7 +513,7 @@ void gdImageFilledEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color
|
||||
void gdImageFillToBorder(gdImagePtr im, int x, int y, int border, int color);
|
||||
void gdImageFill(gdImagePtr im, int x, int y, int color);
|
||||
void gdImageCopy(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h);
|
||||
void gdImageCopyMerge(gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
|
||||
void gdImageCopyMerge(gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
|
||||
int srcX, int srcY, int w, int h, int pct);
|
||||
void gdImageCopyMergeGray(gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
|
||||
int srcX, int srcY, int w, int h, int pct);
|
||||
@@ -520,8 +529,8 @@ void gdImageCopyResized(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int
|
||||
destination pixel, taking into account what portion of the
|
||||
destination pixel each source pixel represents. This is a
|
||||
floating point operation, but this is not a performance issue
|
||||
on modern hardware, except for some embedded devices. If the
|
||||
destination is a palette image, gdImageCopyResized is
|
||||
on modern hardware, except for some embedded devices. If the
|
||||
destination is a palette image, gdImageCopyResized is
|
||||
substituted automatically. */
|
||||
void gdImageCopyResampled(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH);
|
||||
|
||||
@@ -536,7 +545,7 @@ void gdImageSetTile(gdImagePtr im, gdImagePtr tile);
|
||||
void gdImageSetAntiAliased(gdImagePtr im, int c);
|
||||
void gdImageSetAntiAliasedDontBlend(gdImagePtr im, int c, int dont_blend);
|
||||
void gdImageSetStyle(gdImagePtr im, int *style, int noOfPixels);
|
||||
/* Line thickness (defaults to 1). Affects lines, ellipses,
|
||||
/* Line thickness (defaults to 1). Affects lines, ellipses,
|
||||
rectangles, polygons and so forth. */
|
||||
void gdImageSetThickness(gdImagePtr im, int thickness);
|
||||
/* On or off (1 or 0) for all three of these. */
|
||||
@@ -578,10 +587,11 @@ void gdImageSaveAlpha(gdImagePtr im, int saveAlphaArg);
|
||||
|
||||
gdIOCtx* gdNewFileCtx(FILE*);
|
||||
gdIOCtx* gdNewDynamicCtx(int, void*);
|
||||
gdIOCtx *gdNewDynamicCtxEx(int size, void *data, int freeFlag);
|
||||
gdIOCtx* gdNewSSCtx(gdSourcePtr in, gdSinkPtr out);
|
||||
void* gdDPExtractData(struct gdIOCtx* ctx, int *size);
|
||||
|
||||
#define GD2_CHUNKSIZE 128
|
||||
#define GD2_CHUNKSIZE 128
|
||||
#define GD2_CHUNKSIZE_MIN 64
|
||||
#define GD2_CHUNKSIZE_MAX 4096
|
||||
|
||||
@@ -590,6 +600,42 @@ void* gdDPExtractData(struct gdIOCtx* ctx, int *size);
|
||||
#define GD2_FMT_RAW 1
|
||||
#define GD2_FMT_COMPRESSED 2
|
||||
|
||||
|
||||
/* filters section
|
||||
*
|
||||
* Negate the imag src, white becomes black,
|
||||
* The red, green, and blue intensities of an image are negated.
|
||||
* White becomes black, yellow becomes blue, etc.
|
||||
*/
|
||||
int gdImageNegate(gdImagePtr src);
|
||||
|
||||
/* Convert the image src to a grayscale image */
|
||||
int gdImageGrayScale(gdImagePtr src);
|
||||
|
||||
/* Set the brightness level <brightness> for the image src */
|
||||
int gdImageBrightness(gdImagePtr src, int brightness);
|
||||
|
||||
/* Set the contrast level <contrast> for the image <src> */
|
||||
int gdImageContrast(gdImagePtr src, double contrast);
|
||||
|
||||
/* Simply adds or substracts respectively red, green or blue to a pixel */
|
||||
int gdImageColor(gdImagePtr src, int red, int green, int blue);
|
||||
|
||||
/* Image convolution by a 3x3 custom matrix */
|
||||
int gdImageConvolution(gdImagePtr src, float ft[3][3], float filter_div, float offset);
|
||||
|
||||
int gdImageEdgeDetectQuick(gdImagePtr src);
|
||||
|
||||
int gdImageGaussianBlur(gdImagePtr im);
|
||||
|
||||
int gdImageSelectiveBlur( gdImagePtr src);
|
||||
|
||||
int gdImageEmboss(gdImagePtr im);
|
||||
|
||||
int gdImageMeanRemoval(gdImagePtr im);
|
||||
|
||||
int gdImageSmooth(gdImagePtr im, float weight);
|
||||
|
||||
/* Image comparison definitions */
|
||||
int gdImageCompare(gdImagePtr im1, gdImagePtr im2);
|
||||
|
||||
|
||||
@@ -147,6 +147,16 @@ gdImagePtr gdImageCreateFromGd (FILE * inFile)
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromGdPtr (int size, void *data)
|
||||
{
|
||||
gdImagePtr im;
|
||||
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
|
||||
im = gdImageCreateFromGdCtx(in);
|
||||
in->gd_free(in);
|
||||
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromGdCtx (gdIOCtxPtr in)
|
||||
{
|
||||
int sx, sy;
|
||||
|
||||
@@ -237,6 +237,16 @@ gdImagePtr gdImageCreateFromGd2 (FILE * inFile)
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromGd2Ptr (int size, void *data)
|
||||
{
|
||||
gdImagePtr im;
|
||||
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
|
||||
im = gdImageCreateFromGd2Ctx(in);
|
||||
in->gd_free(in);
|
||||
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
|
||||
{
|
||||
int sx, sy;
|
||||
@@ -378,6 +388,16 @@ fail2:
|
||||
return 0;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy, int w, int h)
|
||||
{
|
||||
gdImagePtr im;
|
||||
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
|
||||
im = gdImageCreateFromGd2PartCtx(in, srcx, srcy, w, h);
|
||||
in->gd_free(in);
|
||||
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromGd2Part (FILE * inFile, int srcx, int srcy, int w, int h)
|
||||
{
|
||||
gdImagePtr im;
|
||||
|
||||
@@ -0,0 +1,759 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "gd.h"
|
||||
|
||||
/* Code drawn from ppmtogif.c, from the pbmplus package
|
||||
**
|
||||
** Based on GIFENCOD by David Rowley <mgardi@watdscu.waterloo.edu>. A
|
||||
** Lempel-Zim compression based on "compress".
|
||||
**
|
||||
** Modified by Marcel Wijkstra <wijkstra@fwi.uva.nl>
|
||||
**
|
||||
** Copyright (C) 1989 by Jef Poskanzer.
|
||||
**
|
||||
** Permission to use, copy, modify, and distribute this software and its
|
||||
** documentation for any purpose and without fee is hereby granted, provided
|
||||
** that the above copyright notice appear in all copies and that both that
|
||||
** copyright notice and this permission notice appear in supporting
|
||||
** documentation. This software is provided "as is" without express or
|
||||
** implied warranty.
|
||||
**
|
||||
** The Graphics Interchange Format(c) is the Copyright property of
|
||||
** CompuServe Incorporated. GIF(sm) is a Service Mark property of
|
||||
** CompuServe Incorporated.
|
||||
*/
|
||||
|
||||
/*
|
||||
* a code_int must be able to hold 2**GIFBITS values of type int, and also -1
|
||||
*/
|
||||
typedef int code_int;
|
||||
|
||||
#ifdef SIGNED_COMPARE_SLOW
|
||||
typedef unsigned long int count_int;
|
||||
typedef unsigned short int count_short;
|
||||
#else /*SIGNED_COMPARE_SLOW*/
|
||||
typedef long int count_int;
|
||||
#endif /*SIGNED_COMPARE_SLOW*/
|
||||
|
||||
/* 2.0.28: threadsafe */
|
||||
|
||||
#define maxbits GIFBITS
|
||||
|
||||
/* should NEVER generate this code */
|
||||
#define maxmaxcode ((code_int)1 << GIFBITS)
|
||||
|
||||
#define HSIZE 5003 /* 80% occupancy */
|
||||
#define hsize HSIZE /* Apparently invariant, left over from
|
||||
compress */
|
||||
|
||||
typedef struct {
|
||||
int Width, Height;
|
||||
int curx, cury;
|
||||
long CountDown;
|
||||
int Pass;
|
||||
int Interlace;
|
||||
int n_bits; /* number of bits/code */
|
||||
code_int maxcode; /* maximum code, given n_bits */
|
||||
count_int htab [HSIZE];
|
||||
unsigned short codetab [HSIZE];
|
||||
code_int free_ent; /* first unused entry */
|
||||
/*
|
||||
* block compression parameters -- after all codes are used up,
|
||||
* and compression rate changes, start over.
|
||||
*/
|
||||
int clear_flg;
|
||||
int offset;
|
||||
long int in_count; /* length of input */
|
||||
long int out_count; /* # of codes output (for debugging) */
|
||||
|
||||
int g_init_bits;
|
||||
gdIOCtx * g_outfile;
|
||||
|
||||
int ClearCode;
|
||||
int EOFCode;
|
||||
unsigned long cur_accum;
|
||||
int cur_bits;
|
||||
/*
|
||||
* Number of characters so far in this 'packet'
|
||||
*/
|
||||
int a_count;
|
||||
/*
|
||||
* Define the storage for the packet accumulator
|
||||
*/
|
||||
char accum[ 256 ];
|
||||
} GifCtx;
|
||||
|
||||
static int gifPutWord(int w, gdIOCtx *out);
|
||||
static int colorstobpp(int colors);
|
||||
static void BumpPixel (GifCtx *ctx);
|
||||
static int GIFNextPixel (gdImagePtr im, GifCtx *ctx);
|
||||
static void GIFEncode (gdIOCtxPtr fp, int GWidth, int GHeight, int GInterlace, int Background, int Transparent, int BitsPerPixel, int *Red, int *Green, int *Blue, gdImagePtr im);
|
||||
static void compress (int init_bits, gdIOCtx *outfile, gdImagePtr im, GifCtx *ctx);
|
||||
static void output (code_int code, GifCtx *ctx);
|
||||
static void cl_block (GifCtx *ctx);
|
||||
static void cl_hash (register count_int chsize, GifCtx *ctx);
|
||||
static void char_init (GifCtx *ctx);
|
||||
static void char_out (int c, GifCtx *ctx);
|
||||
static void flush_char (GifCtx *ctx);
|
||||
void * gdImageGifPtr (gdImagePtr im, int *size)
|
||||
{
|
||||
void *rv;
|
||||
gdIOCtx *out = gdNewDynamicCtx (2048, NULL);
|
||||
gdImageGifCtx (im, out);
|
||||
rv = gdDPExtractData (out, size);
|
||||
out->gd_free (out);
|
||||
return rv;
|
||||
}
|
||||
|
||||
void gdImageGif (gdImagePtr im, FILE * outFile)
|
||||
{
|
||||
gdIOCtx *out = gdNewFileCtx (outFile);
|
||||
gdImageGifCtx (im, out);
|
||||
out->gd_free (out);
|
||||
}
|
||||
|
||||
void gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
|
||||
{
|
||||
gdImagePtr pim = 0, tim = im;
|
||||
int interlace, transparent, BitsPerPixel;
|
||||
interlace = im->interlace;
|
||||
transparent = im->transparent;
|
||||
if (im->trueColor) {
|
||||
/* Expensive, but the only way that produces an
|
||||
acceptable result: mix down to a palette
|
||||
based temporary image. */
|
||||
pim = gdImageCreatePaletteFromTrueColor(im, 1, 256);
|
||||
if (!pim) {
|
||||
return;
|
||||
}
|
||||
tim = pim;
|
||||
}
|
||||
BitsPerPixel = colorstobpp(tim->colorsTotal);
|
||||
/* All set, let's do it. */
|
||||
GIFEncode(
|
||||
out, tim->sx, tim->sy, interlace, 0, transparent, BitsPerPixel,
|
||||
tim->red, tim->green, tim->blue, tim);
|
||||
if (pim) {
|
||||
/* Destroy palette based temporary image. */
|
||||
gdImageDestroy( pim);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
colorstobpp(int colors)
|
||||
{
|
||||
int bpp = 0;
|
||||
|
||||
if ( colors <= 2 )
|
||||
bpp = 1;
|
||||
else if ( colors <= 4 )
|
||||
bpp = 2;
|
||||
else if ( colors <= 8 )
|
||||
bpp = 3;
|
||||
else if ( colors <= 16 )
|
||||
bpp = 4;
|
||||
else if ( colors <= 32 )
|
||||
bpp = 5;
|
||||
else if ( colors <= 64 )
|
||||
bpp = 6;
|
||||
else if ( colors <= 128 )
|
||||
bpp = 7;
|
||||
else if ( colors <= 256 )
|
||||
bpp = 8;
|
||||
return bpp;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* GIFENCODE.C - GIF Image compression interface
|
||||
*
|
||||
* GIFEncode( FName, GHeight, GWidth, GInterlace, Background, Transparent,
|
||||
* BitsPerPixel, Red, Green, Blue, gdImagePtr )
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
/*
|
||||
* Bump the 'curx' and 'cury' to point to the next pixel
|
||||
*/
|
||||
static void
|
||||
BumpPixel(GifCtx *ctx)
|
||||
{
|
||||
/*
|
||||
* Bump the current X position
|
||||
*/
|
||||
++(ctx->curx);
|
||||
|
||||
/*
|
||||
* If we are at the end of a scan line, set curx back to the beginning
|
||||
* If we are interlaced, bump the cury to the appropriate spot,
|
||||
* otherwise, just increment it.
|
||||
*/
|
||||
if( ctx->curx == ctx->Width ) {
|
||||
ctx->curx = 0;
|
||||
|
||||
if( !ctx->Interlace )
|
||||
++(ctx->cury);
|
||||
else {
|
||||
switch( ctx->Pass ) {
|
||||
|
||||
case 0:
|
||||
ctx->cury += 8;
|
||||
if( ctx->cury >= ctx->Height ) {
|
||||
++(ctx->Pass);
|
||||
ctx->cury = 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ctx->cury += 8;
|
||||
if( ctx->cury >= ctx->Height ) {
|
||||
++(ctx->Pass);
|
||||
ctx->cury = 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ctx->cury += 4;
|
||||
if( ctx->cury >= ctx->Height ) {
|
||||
++(ctx->Pass);
|
||||
ctx->cury = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ctx->cury += 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the next pixel from the image
|
||||
*/
|
||||
static int
|
||||
GIFNextPixel(gdImagePtr im, GifCtx *ctx)
|
||||
{
|
||||
int r;
|
||||
|
||||
if( ctx->CountDown == 0 )
|
||||
return EOF;
|
||||
|
||||
--(ctx->CountDown);
|
||||
|
||||
r = gdImageGetPixel(im, ctx->curx, ctx->cury);
|
||||
|
||||
BumpPixel(ctx);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* public */
|
||||
|
||||
static void
|
||||
GIFEncode(gdIOCtxPtr fp, int GWidth, int GHeight, int GInterlace, int Background, int Transparent, int BitsPerPixel, int *Red, int *Green, int *Blue, gdImagePtr im)
|
||||
{
|
||||
int B;
|
||||
int RWidth, RHeight;
|
||||
int LeftOfs, TopOfs;
|
||||
int Resolution;
|
||||
int ColorMapSize;
|
||||
int InitCodeSize;
|
||||
int i;
|
||||
GifCtx ctx;
|
||||
ctx.Interlace = GInterlace;
|
||||
ctx.in_count = 1;
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
ColorMapSize = 1 << BitsPerPixel;
|
||||
|
||||
RWidth = ctx.Width = GWidth;
|
||||
RHeight = ctx.Height = GHeight;
|
||||
LeftOfs = TopOfs = 0;
|
||||
|
||||
Resolution = BitsPerPixel;
|
||||
|
||||
/*
|
||||
* Calculate number of bits we are expecting
|
||||
*/
|
||||
ctx.CountDown = (long)ctx.Width * (long)ctx.Height;
|
||||
|
||||
/*
|
||||
* Indicate which pass we are on (if interlace)
|
||||
*/
|
||||
ctx.Pass = 0;
|
||||
|
||||
/*
|
||||
* The initial code size
|
||||
*/
|
||||
if( BitsPerPixel <= 1 )
|
||||
InitCodeSize = 2;
|
||||
else
|
||||
InitCodeSize = BitsPerPixel;
|
||||
|
||||
/*
|
||||
* Set up the current x and y position
|
||||
*/
|
||||
ctx.curx = ctx.cury = 0;
|
||||
|
||||
/*
|
||||
* Write the Magic header
|
||||
*/
|
||||
gdPutBuf(Transparent < 0 ? "GIF87a" : "GIF89a", 6, fp );
|
||||
|
||||
/*
|
||||
* Write out the screen width and height
|
||||
*/
|
||||
gifPutWord( RWidth, fp );
|
||||
gifPutWord( RHeight, fp );
|
||||
|
||||
/*
|
||||
* Indicate that there is a global colour map
|
||||
*/
|
||||
B = 0x80; /* Yes, there is a color map */
|
||||
|
||||
/*
|
||||
* OR in the resolution
|
||||
*/
|
||||
B |= (Resolution - 1) << 5;
|
||||
|
||||
/*
|
||||
* OR in the Bits per Pixel
|
||||
*/
|
||||
B |= (BitsPerPixel - 1);
|
||||
|
||||
/*
|
||||
* Write it out
|
||||
*/
|
||||
gdPutC( B, fp );
|
||||
|
||||
/*
|
||||
* Write out the Background colour
|
||||
*/
|
||||
gdPutC( Background, fp );
|
||||
|
||||
/*
|
||||
* Byte of 0's (future expansion)
|
||||
*/
|
||||
gdPutC( 0, fp );
|
||||
|
||||
/*
|
||||
* Write out the Global Colour Map
|
||||
*/
|
||||
for( i=0; i<ColorMapSize; ++i ) {
|
||||
gdPutC( Red[i], fp );
|
||||
gdPutC( Green[i], fp );
|
||||
gdPutC( Blue[i], fp );
|
||||
}
|
||||
|
||||
/*
|
||||
* Write out extension for transparent colour index, if necessary.
|
||||
*/
|
||||
if ( Transparent >= 0 ) {
|
||||
gdPutC( '!', fp );
|
||||
gdPutC( 0xf9, fp );
|
||||
gdPutC( 4, fp );
|
||||
gdPutC( 1, fp );
|
||||
gdPutC( 0, fp );
|
||||
gdPutC( 0, fp );
|
||||
gdPutC( (unsigned char) Transparent, fp );
|
||||
gdPutC( 0, fp );
|
||||
}
|
||||
|
||||
/*
|
||||
* Write an Image separator
|
||||
*/
|
||||
gdPutC( ',', fp );
|
||||
|
||||
/*
|
||||
* Write the Image header
|
||||
*/
|
||||
|
||||
gifPutWord( LeftOfs, fp );
|
||||
gifPutWord( TopOfs, fp );
|
||||
gifPutWord( ctx.Width, fp );
|
||||
gifPutWord( ctx.Height, fp );
|
||||
|
||||
/*
|
||||
* Write out whether or not the image is interlaced
|
||||
*/
|
||||
if( ctx.Interlace )
|
||||
gdPutC( 0x40, fp );
|
||||
else
|
||||
gdPutC( 0x00, fp );
|
||||
|
||||
/*
|
||||
* Write out the initial code size
|
||||
*/
|
||||
gdPutC( InitCodeSize, fp );
|
||||
|
||||
/*
|
||||
* Go and actually compress the data
|
||||
*/
|
||||
compress( InitCodeSize+1, fp, im, &ctx );
|
||||
|
||||
/*
|
||||
* Write out a Zero-length packet (to end the series)
|
||||
*/
|
||||
gdPutC( 0, fp );
|
||||
|
||||
/*
|
||||
* Write the GIF file terminator
|
||||
*/
|
||||
gdPutC( ';', fp );
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* GIFCOMPR.C - GIF Image compression routines
|
||||
*
|
||||
* Lempel-Ziv compression based on 'compress'. GIF modifications by
|
||||
* David Rowley (mgardi@watdcsu.waterloo.edu)
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* General DEFINEs
|
||||
*/
|
||||
|
||||
#define GIFBITS 12
|
||||
|
||||
#ifdef NO_UCHAR
|
||||
typedef char char_type;
|
||||
#else /*NO_UCHAR*/
|
||||
typedef unsigned char char_type;
|
||||
#endif /*NO_UCHAR*/
|
||||
|
||||
/*
|
||||
*
|
||||
* GIF Image compression - modified 'compress'
|
||||
*
|
||||
* Based on: compress.c - File compression ala IEEE Computer, June 1984.
|
||||
*
|
||||
* By Authors: Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas)
|
||||
* Jim McKie (decvax!mcvax!jim)
|
||||
* Steve Davies (decvax!vax135!petsd!peora!srd)
|
||||
* Ken Turkowski (decvax!decwrl!turtlevax!ken)
|
||||
* James A. Woods (decvax!ihnp4!ames!jaw)
|
||||
* Joe Orost (decvax!vax135!petsd!joe)
|
||||
*
|
||||
*/
|
||||
#include <ctype.h>
|
||||
|
||||
#define ARGVAL() (*++(*argv) || (--argc && *++argv))
|
||||
|
||||
#ifdef COMPATIBLE /* But wrong! */
|
||||
# define MAXCODE(n_bits) ((code_int) 1 << (n_bits) - 1)
|
||||
#else /*COMPATIBLE*/
|
||||
# define MAXCODE(n_bits) (((code_int) 1 << (n_bits)) - 1)
|
||||
#endif /*COMPATIBLE*/
|
||||
|
||||
#define HashTabOf(i) ctx->htab[i]
|
||||
#define CodeTabOf(i) ctx->codetab[i]
|
||||
|
||||
|
||||
/*
|
||||
* To save much memory, we overlay the table used by compress() with those
|
||||
* used by decompress(). The tab_prefix table is the same size and type
|
||||
* as the codetab. The tab_suffix table needs 2**GIFBITS characters. We
|
||||
* get this from the beginning of htab. The output stack uses the rest
|
||||
* of htab, and contains characters. There is plenty of room for any
|
||||
* possible stack (stack used to be 8000 characters).
|
||||
*/
|
||||
|
||||
#define tab_prefixof(i) CodeTabOf(i)
|
||||
#define tab_suffixof(i) ((char_type*)(htab))[i]
|
||||
#define de_stack ((char_type*)&tab_suffixof((code_int)1<<GIFBITS))
|
||||
|
||||
/*
|
||||
* compress stdin to stdout
|
||||
*
|
||||
* Algorithm: use open addressing double hashing (no chaining) on the
|
||||
* prefix code / next character combination. We do a variant of Knuth's
|
||||
* algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime
|
||||
* secondary probe. Here, the modular division first probe is gives way
|
||||
* to a faster exclusive-or manipulation. Also do block compression with
|
||||
* an adaptive reset, whereby the code table is cleared when the compression
|
||||
* ratio decreases, but after the table fills. The variable-length output
|
||||
* codes are re-sized at this point, and a special CLEAR code is generated
|
||||
* for the decompressor. Late addition: construct the table according to
|
||||
* file size for noticeable speed improvement on small files. Please direct
|
||||
* questions about this implementation to ames!jaw.
|
||||
*/
|
||||
|
||||
static void
|
||||
output(code_int code, GifCtx *ctx);
|
||||
|
||||
static void
|
||||
compress(int init_bits, gdIOCtxPtr outfile, gdImagePtr im, GifCtx *ctx)
|
||||
{
|
||||
register long fcode;
|
||||
register code_int i /* = 0 */;
|
||||
register int c;
|
||||
register code_int ent;
|
||||
register code_int disp;
|
||||
register code_int hsize_reg;
|
||||
register int hshift;
|
||||
|
||||
/*
|
||||
* Set up the globals: g_init_bits - initial number of bits
|
||||
* g_outfile - pointer to output file
|
||||
*/
|
||||
ctx->g_init_bits = init_bits;
|
||||
ctx->g_outfile = outfile;
|
||||
|
||||
/*
|
||||
* Set up the necessary values
|
||||
*/
|
||||
ctx->offset = 0;
|
||||
ctx->out_count = 0;
|
||||
ctx->clear_flg = 0;
|
||||
ctx->in_count = 1;
|
||||
ctx->maxcode = MAXCODE(ctx->n_bits = ctx->g_init_bits);
|
||||
|
||||
ctx->ClearCode = (1 << (init_bits - 1));
|
||||
ctx->EOFCode = ctx->ClearCode + 1;
|
||||
ctx->free_ent = ctx->ClearCode + 2;
|
||||
|
||||
char_init(ctx);
|
||||
|
||||
ent = GIFNextPixel( im, ctx );
|
||||
|
||||
hshift = 0;
|
||||
for ( fcode = (long) hsize; fcode < 65536L; fcode *= 2L )
|
||||
++hshift;
|
||||
hshift = 8 - hshift; /* set hash code range bound */
|
||||
|
||||
hsize_reg = hsize;
|
||||
cl_hash( (count_int) hsize_reg, ctx ); /* clear hash table */
|
||||
|
||||
output( (code_int)ctx->ClearCode, ctx );
|
||||
|
||||
#ifdef SIGNED_COMPARE_SLOW
|
||||
while ( (c = GIFNextPixel( im )) != (unsigned) EOF ) {
|
||||
#else /*SIGNED_COMPARE_SLOW*/
|
||||
while ( (c = GIFNextPixel( im, ctx )) != EOF ) { /* } */
|
||||
#endif /*SIGNED_COMPARE_SLOW*/
|
||||
|
||||
++(ctx->in_count);
|
||||
|
||||
fcode = (long) (((long) c << maxbits) + ent);
|
||||
i = (((code_int)c << hshift) ^ ent); /* xor hashing */
|
||||
|
||||
if ( HashTabOf (i) == fcode ) {
|
||||
ent = CodeTabOf (i);
|
||||
continue;
|
||||
} else if ( (long)HashTabOf (i) < 0 ) /* empty slot */
|
||||
goto nomatch;
|
||||
disp = hsize_reg - i; /* secondary hash (after G. Knott) */
|
||||
if ( i == 0 )
|
||||
disp = 1;
|
||||
probe:
|
||||
if ( (i -= disp) < 0 )
|
||||
i += hsize_reg;
|
||||
|
||||
if ( HashTabOf (i) == fcode ) {
|
||||
ent = CodeTabOf (i);
|
||||
continue;
|
||||
}
|
||||
if ( (long)HashTabOf (i) > 0 )
|
||||
goto probe;
|
||||
nomatch:
|
||||
output ( (code_int) ent, ctx );
|
||||
++(ctx->out_count);
|
||||
ent = c;
|
||||
#ifdef SIGNED_COMPARE_SLOW
|
||||
if ( (unsigned) ctx->free_ent < (unsigned) maxmaxcode) {
|
||||
#else /*SIGNED_COMPARE_SLOW*/
|
||||
if ( ctx->free_ent < maxmaxcode ) { /* } */
|
||||
#endif /*SIGNED_COMPARE_SLOW*/
|
||||
CodeTabOf (i) = ctx->free_ent++; /* code -> hashtable */
|
||||
HashTabOf (i) = fcode;
|
||||
} else
|
||||
cl_block(ctx);
|
||||
}
|
||||
/*
|
||||
* Put out the final code.
|
||||
*/
|
||||
output( (code_int)ent, ctx );
|
||||
++(ctx->out_count);
|
||||
output( (code_int) ctx->EOFCode, ctx );
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* TAG( output )
|
||||
*
|
||||
* Output the given code.
|
||||
* Inputs:
|
||||
* code: A n_bits-bit integer. If == -1, then EOF. This assumes
|
||||
* that n_bits =< (long)wordsize - 1.
|
||||
* Outputs:
|
||||
* Outputs code to the file.
|
||||
* Assumptions:
|
||||
* Chars are 8 bits long.
|
||||
* Algorithm:
|
||||
* Maintain a GIFBITS character long buffer (so that 8 codes will
|
||||
* fit in it exactly). Use the VAX insv instruction to insert each
|
||||
* code in turn. When the buffer fills up empty it and start over.
|
||||
*/
|
||||
|
||||
static unsigned long masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F,
|
||||
0x001F, 0x003F, 0x007F, 0x00FF,
|
||||
0x01FF, 0x03FF, 0x07FF, 0x0FFF,
|
||||
0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
|
||||
|
||||
static void
|
||||
output(code_int code, GifCtx *ctx)
|
||||
{
|
||||
ctx->cur_accum &= masks[ ctx->cur_bits ];
|
||||
|
||||
if( ctx->cur_bits > 0 )
|
||||
ctx->cur_accum |= ((long)code << ctx->cur_bits);
|
||||
else
|
||||
ctx->cur_accum = code;
|
||||
|
||||
ctx->cur_bits += ctx->n_bits;
|
||||
|
||||
while( ctx->cur_bits >= 8 ) {
|
||||
char_out( (unsigned int)(ctx->cur_accum & 0xff), ctx );
|
||||
ctx->cur_accum >>= 8;
|
||||
ctx->cur_bits -= 8;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the next entry is going to be too big for the code size,
|
||||
* then increase it, if possible.
|
||||
*/
|
||||
if ( ctx->free_ent > ctx->maxcode || ctx->clear_flg ) {
|
||||
|
||||
if( ctx->clear_flg ) {
|
||||
|
||||
ctx->maxcode = MAXCODE (ctx->n_bits = ctx->g_init_bits);
|
||||
ctx->clear_flg = 0;
|
||||
|
||||
} else {
|
||||
|
||||
++(ctx->n_bits);
|
||||
if ( ctx->n_bits == maxbits )
|
||||
ctx->maxcode = maxmaxcode;
|
||||
else
|
||||
ctx->maxcode = MAXCODE(ctx->n_bits);
|
||||
}
|
||||
}
|
||||
|
||||
if( code == ctx->EOFCode ) {
|
||||
/*
|
||||
* At EOF, write the rest of the buffer.
|
||||
*/
|
||||
while( ctx->cur_bits > 0 ) {
|
||||
char_out( (unsigned int)(ctx->cur_accum & 0xff), ctx);
|
||||
ctx->cur_accum >>= 8;
|
||||
ctx->cur_bits -= 8;
|
||||
}
|
||||
|
||||
flush_char(ctx);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear out the hash table
|
||||
*/
|
||||
static void
|
||||
cl_block (GifCtx *ctx) /* table clear for block compress */
|
||||
{
|
||||
|
||||
cl_hash ( (count_int) hsize, ctx );
|
||||
ctx->free_ent = ctx->ClearCode + 2;
|
||||
ctx->clear_flg = 1;
|
||||
|
||||
output( (code_int)ctx->ClearCode, ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
cl_hash(register count_int chsize, GifCtx *ctx) /* reset code table */
|
||||
|
||||
{
|
||||
|
||||
register count_int *htab_p = ctx->htab+chsize;
|
||||
|
||||
register long i;
|
||||
register long m1 = -1;
|
||||
|
||||
i = chsize - 16;
|
||||
do { /* might use Sys V memset(3) here */
|
||||
*(htab_p-16) = m1;
|
||||
*(htab_p-15) = m1;
|
||||
*(htab_p-14) = m1;
|
||||
*(htab_p-13) = m1;
|
||||
*(htab_p-12) = m1;
|
||||
*(htab_p-11) = m1;
|
||||
*(htab_p-10) = m1;
|
||||
*(htab_p-9) = m1;
|
||||
*(htab_p-8) = m1;
|
||||
*(htab_p-7) = m1;
|
||||
*(htab_p-6) = m1;
|
||||
*(htab_p-5) = m1;
|
||||
*(htab_p-4) = m1;
|
||||
*(htab_p-3) = m1;
|
||||
*(htab_p-2) = m1;
|
||||
*(htab_p-1) = m1;
|
||||
htab_p -= 16;
|
||||
} while ((i -= 16) >= 0);
|
||||
|
||||
for ( i += 16; i > 0; --i )
|
||||
*--htab_p = m1;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* GIF Specific routines
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Set up the 'byte output' routine
|
||||
*/
|
||||
static void
|
||||
char_init(GifCtx *ctx)
|
||||
{
|
||||
ctx->a_count = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a character to the end of the current packet, and if it is 254
|
||||
* characters, flush the packet to disk.
|
||||
*/
|
||||
static void
|
||||
char_out(int c, GifCtx *ctx)
|
||||
{
|
||||
ctx->accum[ ctx->a_count++ ] = c;
|
||||
if( ctx->a_count >= 254 )
|
||||
flush_char(ctx);
|
||||
}
|
||||
|
||||
/*
|
||||
* Flush the packet to disk, and reset the accumulator
|
||||
*/
|
||||
static void
|
||||
flush_char(GifCtx *ctx)
|
||||
{
|
||||
if( ctx->a_count > 0 ) {
|
||||
gdPutC( ctx->a_count, ctx->g_outfile );
|
||||
gdPutBuf( ctx->accum, ctx->a_count, ctx->g_outfile );
|
||||
ctx->a_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int gifPutWord(int w, gdIOCtx *out)
|
||||
{
|
||||
/* Byte order is little-endian */
|
||||
gdPutC(w & 0xFF, out);
|
||||
gdPutC((w >> 8) & 0xFF, out);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+24
-6
@@ -33,6 +33,7 @@ typedef struct dpStruct
|
||||
int realSize;
|
||||
int dataGood;
|
||||
int pos;
|
||||
int freeOK;
|
||||
}
|
||||
dynamicPtr;
|
||||
|
||||
@@ -52,7 +53,7 @@ static int appendDynamic (dynamicPtr * dp, const void *src, int size);
|
||||
static int gdReallocDynamic (dynamicPtr * dp, int required);
|
||||
static int trimDynamic (dynamicPtr * dp);
|
||||
static void gdFreeDynamicCtx (struct gdIOCtx *ctx);
|
||||
static dynamicPtr *newDynamic (int initialSize, void *data);
|
||||
static dynamicPtr *newDynamic (int initialSize, void *data, int freeOKFlag);
|
||||
|
||||
static int dynamicPutbuf (struct gdIOCtx *, const void *, int);
|
||||
static void dynamicPutchar (struct gdIOCtx *, int a);
|
||||
@@ -66,6 +67,11 @@ static long dynamicTell (struct gdIOCtx *);
|
||||
/* return data as a dynamic pointer */
|
||||
gdIOCtx *
|
||||
gdNewDynamicCtx (int initialSize, void *data)
|
||||
{
|
||||
return gdNewDynamicCtxEx(initialSize, data, 1);
|
||||
}
|
||||
|
||||
gdIOCtx * gdNewDynamicCtxEx (int initialSize, void *data, int freeOKFlag)
|
||||
{
|
||||
dpIOCtx *ctx;
|
||||
dynamicPtr *dp;
|
||||
@@ -76,7 +82,7 @@ gdNewDynamicCtx (int initialSize, void *data)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dp = newDynamic (initialSize, data);
|
||||
dp = newDynamic (initialSize, data, freeOKFlag);
|
||||
if (!dp)
|
||||
{
|
||||
gdFree (ctx);
|
||||
@@ -120,7 +126,7 @@ gdDPExtractData (struct gdIOCtx *ctx, int *size)
|
||||
{
|
||||
*size = 0;
|
||||
data = NULL;
|
||||
if (dp->data != NULL)
|
||||
if (dp->data != NULL && dp->freeOK)
|
||||
{
|
||||
gdFree (dp->data);
|
||||
}
|
||||
@@ -177,6 +183,10 @@ dynamicSeek (struct gdIOCtx *ctx, const int pos)
|
||||
bytesNeeded = pos;
|
||||
if (bytesNeeded > dp->realSize)
|
||||
{
|
||||
/* 2.0.21 */
|
||||
if (!dp->freeOK) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!gdReallocDynamic (dp, dp->realSize * 2))
|
||||
{
|
||||
dp->dataGood = FALSE;
|
||||
@@ -199,8 +209,7 @@ dynamicSeek (struct gdIOCtx *ctx, const int pos)
|
||||
}
|
||||
|
||||
/* return data as a dynamic pointer */
|
||||
static dynamicPtr *
|
||||
newDynamic (int initialSize, void *data)
|
||||
static dynamicPtr * newDynamic (int initialSize, void *data, int freeOKFlag)
|
||||
{
|
||||
dynamicPtr *dp;
|
||||
dp = (dynamicPtr *) gdMalloc (sizeof (dynamicPtr));
|
||||
@@ -213,6 +222,7 @@ newDynamic (int initialSize, void *data)
|
||||
return NULL;
|
||||
|
||||
dp->pos = 0;
|
||||
dp->freeOK = freeOKFlag;
|
||||
|
||||
return dp;
|
||||
}
|
||||
@@ -348,6 +358,10 @@ appendDynamic (dynamicPtr * dp, const void *src, int size)
|
||||
|
||||
if (bytesNeeded > dp->realSize)
|
||||
{
|
||||
/* 2.0.21 */
|
||||
if (!dp->freeOK) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!gdReallocDynamic (dp, bytesNeeded * 2))
|
||||
{
|
||||
dp->dataGood = FALSE;
|
||||
@@ -407,5 +421,9 @@ gdReallocDynamic (dynamicPtr * dp, int required)
|
||||
static int
|
||||
trimDynamic (dynamicPtr * dp)
|
||||
{
|
||||
return gdReallocDynamic (dp, dp->logicalSize);
|
||||
/* 2.0.21: we don't reallocate memory we don't own */
|
||||
if (!dp->freeOK) {
|
||||
return FALSE;
|
||||
}
|
||||
return gdReallocDynamic (dp, dp->logicalSize);
|
||||
}
|
||||
+87
-17
@@ -221,8 +221,20 @@ gdImagePtr gdImageCreateFromJpeg (FILE * inFile)
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromJpegPtr (int size, void *data)
|
||||
{
|
||||
gdImagePtr im;
|
||||
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
|
||||
im = gdImageCreateFromJpegCtx(in);
|
||||
in->gd_free(in);
|
||||
|
||||
return im;
|
||||
}
|
||||
|
||||
void jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile);
|
||||
|
||||
static int CMYKToRGB(int c, int m, int y, int k, int inverted);
|
||||
|
||||
/*
|
||||
* Create a gd-format image from the JPEG-format INFILE. Returns the
|
||||
* image, or NULL upon error.
|
||||
@@ -239,6 +251,8 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
|
||||
unsigned int i, j;
|
||||
int retval;
|
||||
JDIMENSION nrows;
|
||||
int channels = 3;
|
||||
int inverted = 0;
|
||||
|
||||
memset (&cinfo, 0, sizeof (cinfo));
|
||||
memset (&jerr, 0, sizeof (jerr));
|
||||
@@ -262,6 +276,9 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
|
||||
|
||||
jpeg_gdIOCtx_src (&cinfo, infile);
|
||||
|
||||
/* 2.0.22: save the APP14 marker to check for Adobe Photoshop CMYK files with inverted components. */
|
||||
jpeg_save_markers(&cinfo, JPEG_APP0 + 14, 256);
|
||||
|
||||
retval = jpeg_read_header (&cinfo, TRUE);
|
||||
if (retval != JPEG_HEADER_OK) {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: warning: jpeg_read_header returned %d, expected %d", retval, JPEG_HEADER_OK);
|
||||
@@ -281,8 +298,14 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Force the image into RGB colorspace, but don't reduce the number of colors anymore (GD 2.0) */
|
||||
cinfo.out_color_space = JCS_RGB;
|
||||
/* 2.0.22: very basic support for reading CMYK colorspace files. Nice for
|
||||
* thumbnails but there's no support for fussy adjustment of the
|
||||
* assumed properties of inks and paper. */
|
||||
if ((cinfo.jpeg_color_space == JCS_CMYK) || (cinfo.jpeg_color_space == JCS_YCCK)) {
|
||||
cinfo.out_color_space = JCS_CMYK;
|
||||
} else {
|
||||
cinfo.out_color_space = JCS_RGB;
|
||||
}
|
||||
|
||||
if (jpeg_start_decompress (&cinfo) != TRUE) {
|
||||
php_gd_error("gd-jpeg: warning: jpeg_start_decompress reports suspended data source");
|
||||
@@ -301,8 +324,29 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
|
||||
gdImageInterlace (im, cinfo.progressive_mode != 0);
|
||||
#endif
|
||||
|
||||
if (cinfo.output_components != 3) {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: error: JPEG color quantization request resulted in output_components == %d (expected 3)", cinfo.output_components);
|
||||
if (cinfo.out_color_space == JCS_RGB) {
|
||||
if (cinfo.output_components != 3) {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: error: JPEG color quantization request resulted in output_components == %d (expected 3 for RGB)", cinfo.output_components);
|
||||
goto error;
|
||||
}
|
||||
channels = 3;
|
||||
} else if (cinfo.out_color_space == JCS_CMYK) {
|
||||
jpeg_saved_marker_ptr marker;
|
||||
if (cinfo.output_components != 4) {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: error: JPEG color quantization request resulted in output_components == %d (expected 4 for CMYK)", cinfo.output_components);
|
||||
goto error;
|
||||
}
|
||||
channels = 4;
|
||||
marker = cinfo.marker_list;
|
||||
while (marker) {
|
||||
if ((marker->marker == (JPEG_APP0 + 14)) && (marker->data_length >= 12) && (!strncmp((const char *) marker->data, "Adobe", 5))) {
|
||||
inverted = 1;
|
||||
break;
|
||||
}
|
||||
marker = marker->next;
|
||||
}
|
||||
} else {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: error: unexpected colorspace.");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -311,22 +355,37 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
|
||||
goto error;
|
||||
#endif /* BITS_IN_JSAMPLE == 12 */
|
||||
|
||||
row = safe_emalloc(cinfo.output_width * 3, sizeof(JSAMPLE), 0);
|
||||
memset(row, 0, cinfo.output_width * 3 * sizeof(JSAMPLE));
|
||||
row = safe_emalloc(cinfo.output_width * channels, sizeof(JSAMPLE), 0);
|
||||
memset(row, 0, cinfo.output_width * channels * sizeof(JSAMPLE));
|
||||
rowptr[0] = row;
|
||||
|
||||
for (i = 0; i < cinfo.output_height; i++) {
|
||||
register JSAMPROW currow = row;
|
||||
register int *tpix = im->tpixels[i];
|
||||
nrows = jpeg_read_scanlines (&cinfo, rowptr, 1);
|
||||
if (nrows != 1) {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: error: jpeg_read_scanlines returns %u, expected 1", nrows);
|
||||
goto error;
|
||||
if (cinfo.out_color_space == JCS_CMYK) {
|
||||
for (i = 0; i < cinfo.output_height; i++) {
|
||||
register JSAMPROW currow = row;
|
||||
register int *tpix = im->tpixels[i];
|
||||
nrows = jpeg_read_scanlines (&cinfo, rowptr, 1);
|
||||
if (nrows != 1) {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: error: jpeg_read_scanlines returns %u, expected 1", nrows);
|
||||
goto error;
|
||||
}
|
||||
for (j = 0; j < cinfo.output_width; j++, currow += 4, tpix++) {
|
||||
*tpix = CMYKToRGB (currow[0], currow[1], currow[2], currow[3], inverted);
|
||||
}
|
||||
}
|
||||
for (j = 0; j < cinfo.output_width; j++, currow += 3, tpix++) {
|
||||
*tpix = gdTrueColor (currow[0], currow[1], currow[2]);
|
||||
} else {
|
||||
for (i = 0; i < cinfo.output_height; i++) {
|
||||
register JSAMPROW currow = row;
|
||||
register int *tpix = im->tpixels[i];
|
||||
nrows = jpeg_read_scanlines (&cinfo, rowptr, 1);
|
||||
if (nrows != 1) {
|
||||
php_gd_error_ex(E_WARNING, "gd-jpeg: error: jpeg_read_scanlines returns %u, expected 1", nrows);
|
||||
goto error;
|
||||
}
|
||||
for (j = 0; j < cinfo.output_width; j++, currow += 3, tpix++) {
|
||||
*tpix = gdTrueColor (currow[0], currow[1], currow[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (jpeg_finish_decompress (&cinfo) != TRUE) {
|
||||
php_gd_error("gd-jpeg: warning: jpeg_finish_decompress reports suspended data source");
|
||||
@@ -353,8 +412,19 @@ error:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
/* A very basic conversion approach, TBB */
|
||||
static int CMYKToRGB(int c, int m, int y, int k, int inverted)
|
||||
{
|
||||
if (inverted) {
|
||||
c = 255 - c;
|
||||
m = 255 - m;
|
||||
y = 255 - y;
|
||||
k = 255 - k;
|
||||
}
|
||||
return gdTrueColor((255 - c) * (255 - k) / 255, (255 - m) * (255 - k) / 255, (255 - y) * (255 - k) / 255);
|
||||
}
|
||||
|
||||
/*
|
||||
* gdIOCtx JPEG data sources and sinks, T. Boutell
|
||||
* almost a simple global replace from T. Lane's stdio versions.
|
||||
*
|
||||
|
||||
@@ -93,6 +93,14 @@ gdImagePtr gdImageCreateFromPng (FILE * inFile)
|
||||
return im;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromPngPtr (int size, void *data)
|
||||
{
|
||||
gdImagePtr im;
|
||||
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
|
||||
im = gdImageCreateFromPngCtx(in);
|
||||
in->gd_free(in);
|
||||
return im;
|
||||
}
|
||||
|
||||
/* This routine is based in part on the Chapter 13 demo code in "PNG: The
|
||||
* Definitive Guide" (http://www.cdrom.com/pub/png/pngbook.html).
|
||||
|
||||
+1333
-1137
File diff suppressed because it is too large.
Load diff
@@ -192,6 +192,15 @@ gdImageCreateFromWBMP (FILE * inFile)
|
||||
return (im);
|
||||
}
|
||||
|
||||
gdImagePtr gdImageCreateFromWBMPPtr (int size, void *data)
|
||||
{
|
||||
gdImagePtr im;
|
||||
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
|
||||
im = gdImageCreateFromWBMPCtx(in);
|
||||
in->gd_free(in);
|
||||
return im;
|
||||
}
|
||||
|
||||
/* gdImageWBMP
|
||||
** -----------
|
||||
*/
|
||||
|
||||
@@ -4381,4 +4381,9 @@ gdFont gdFontGiantRep =
|
||||
|
||||
gdFontPtr gdFontGiant = &gdFontGiantRep;
|
||||
|
||||
gdFontPtr gdFontGetGiant(void)
|
||||
{
|
||||
return gdFontGiant;
|
||||
}
|
||||
|
||||
/* This file has not been truncated. */
|
||||
@@ -20,6 +20,7 @@ extern "C" {
|
||||
#include "gd.h"
|
||||
|
||||
extern gdFontPtr gdFontGiant;
|
||||
extern gdFontPtr gdFontGetGiant(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -4638,4 +4638,9 @@ gdFont gdFontLargeRep =
|
||||
|
||||
gdFontPtr gdFontLarge = &gdFontLargeRep;
|
||||
|
||||
gdFontPtr gdFontGetLarge(void)
|
||||
{
|
||||
return gdFontLarge;
|
||||
}
|
||||
|
||||
/* This file has not been truncated. */
|
||||
@@ -21,6 +21,7 @@ extern "C" {
|
||||
#include "gd.h"
|
||||
|
||||
extern gdFontPtr gdFontLarge;
|
||||
extern gdFontPtr gdFontGetLarge(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -3868,4 +3868,9 @@ gdFont gdFontMediumBoldRep =
|
||||
|
||||
gdFontPtr gdFontMediumBold = &gdFontMediumBoldRep;
|
||||
|
||||
gdFontPtr gdFontGetMediumBold(void)
|
||||
{
|
||||
return gdFontMediumBold;
|
||||
}
|
||||
|
||||
/* This file has not been truncated. */
|
||||
@@ -19,6 +19,7 @@ extern "C" {
|
||||
#include "gd.h"
|
||||
|
||||
extern gdFontPtr gdFontMediumBold;
|
||||
extern gdFontPtr gdFontGetMediumBold(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -3868,4 +3868,9 @@ gdFont gdFontSmallRep =
|
||||
|
||||
gdFontPtr gdFontSmall = &gdFontSmallRep;
|
||||
|
||||
gdFontPtr gdFontGetSmall(void)
|
||||
{
|
||||
return gdFontSmall;
|
||||
}
|
||||
|
||||
/* This file has not been truncated. */
|
||||
@@ -19,6 +19,7 @@ extern "C" {
|
||||
#include "gd.h"
|
||||
|
||||
extern gdFontPtr gdFontSmall;
|
||||
extern gdFontPtr gdFontGetSmall(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -2589,4 +2589,9 @@ gdFont gdFontTinyRep =
|
||||
|
||||
gdFontPtr gdFontTiny = &gdFontTinyRep;
|
||||
|
||||
gdFontPtr gdFontGetTiny(void)
|
||||
{
|
||||
return gdFontTiny;
|
||||
}
|
||||
|
||||
/* This file has not been truncated. */
|
||||
@@ -20,6 +20,7 @@ extern "C" {
|
||||
#include "gd.h"
|
||||
|
||||
extern gdFontPtr gdFontTiny;
|
||||
extern gdFontPtr gdFontGetTiny(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+29
-10
@@ -79,9 +79,9 @@ gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
|
||||
|
||||
/*
|
||||
* The character (space) used to separate alternate fonts in the
|
||||
* fontlist parameter to gdImageStringFT.
|
||||
* fontlist parameter to gdImageStringFT. 2.0.18: space was a oor choice for this.
|
||||
*/
|
||||
#define LISTSEPARATOR " "
|
||||
#define LISTSEPARATOR ";"
|
||||
|
||||
/*
|
||||
* DEFAULT_FONTPATH and PATHSEPARATOR are host type dependent and
|
||||
@@ -473,7 +473,7 @@ static void *fontFetch (char **error, void *key)
|
||||
encoding = charmap->encoding_id;
|
||||
|
||||
/* EAM DEBUG - Newer versions of libfree2 make it easier by defining encodings */
|
||||
#ifdef FT_ENCODING_MS_SYMBOL
|
||||
#if (defined(FREETYPE_MAJOR) && ((FREETYPE_MAJOR == 2 && ((FREETYPE_MINOR == 1 && FREETYPE_PATCH >= 3) || FREETYPE_MINOR > 1) || FREETYPE_MAJOR > 2)))
|
||||
if (charmap->encoding == FT_ENCODING_MS_SYMBOL
|
||||
|| charmap->encoding == FT_ENCODING_ADOBE_CUSTOM
|
||||
|| charmap->encoding == FT_ENCODING_ADOBE_STANDARD) {
|
||||
@@ -482,7 +482,7 @@ static void *fontFetch (char **error, void *key)
|
||||
a->face->charmap = charmap;
|
||||
return (void *)a;
|
||||
}
|
||||
#endif /* FT_ENCODING_MS_SYMBOL */
|
||||
#endif /* Freetype 2.1.3 or better */
|
||||
/* EAM DEBUG */
|
||||
|
||||
if ((platform == 3 && encoding == 1) /* Windows Unicode */
|
||||
@@ -777,6 +777,11 @@ void gdFontCacheShutdown()
|
||||
FT_Done_FreeType(library);
|
||||
}
|
||||
}
|
||||
|
||||
void gdFreeFontCache()
|
||||
{
|
||||
gdFontCacheShutdown();
|
||||
}
|
||||
|
||||
int gdFontCacheSetup(void)
|
||||
{
|
||||
@@ -838,6 +843,8 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
* colorindexes. -- 27.06.2001 <krisku@arrak.fi>
|
||||
*/
|
||||
gdCache_head_t *tc_cache;
|
||||
/* Tuneable horizontal and vertical resolution in dots per inch */
|
||||
int hdpi, vdpi;
|
||||
|
||||
if (strex && ((strex->flags & gdFTEX_LINESPACE) == gdFTEX_LINESPACE)) {
|
||||
linespace = strex->linespacing;
|
||||
@@ -867,7 +874,19 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
face = font->face; /* shortcut */
|
||||
slot = face->glyph; /* shortcut */
|
||||
|
||||
if (FT_Set_Char_Size (face, 0, (FT_F26Dot6) (ptsize * 64), GD_RESOLUTION, GD_RESOLUTION)) {
|
||||
/*
|
||||
* Added hdpi and vdpi to support images at non-screen resolutions, i.e. 300 dpi TIFF,
|
||||
* or 100h x 50v dpi FAX format. 2.0.23.
|
||||
* 2004/02/27 Mark Shackelford, mark.shackelford@acs-inc.com
|
||||
*/
|
||||
hdpi = GD_RESOLUTION;
|
||||
vdpi = GD_RESOLUTION;
|
||||
if (strex && (strex->flags & gdFTEX_RESOLUTION)) {
|
||||
hdpi = strex->hdpi;
|
||||
vdpi = strex->vdpi;
|
||||
}
|
||||
|
||||
if (FT_Set_Char_Size(face, 0, (FT_F26Dot6) (ptsize * 64), hdpi, vdpi)) {
|
||||
gdCacheDelete(tc_cache);
|
||||
gdMutexUnlock(gdFontCacheMutex);
|
||||
return "Could not set character size";
|
||||
@@ -939,7 +958,6 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
|
||||
while (*next) {
|
||||
ch = *next;
|
||||
|
||||
/* carriage returns */
|
||||
if (ch == '\r') {
|
||||
penf.x = 0;
|
||||
@@ -965,17 +983,18 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
}
|
||||
|
||||
/* EAM DEBUG */
|
||||
#ifdef FT_ENCODING_MS_SYMBOL
|
||||
if (font->face->charmap->encoding == FT_ENCODING_MS_SYMBOL) {
|
||||
#if (defined(FREETYPE_MAJOR) && ((FREETYPE_MAJOR == 2 && ((FREETYPE_MINOR == 1 && FREETYPE_PATCH >= 3) || FREETYPE_MINOR > 1) || FREETYPE_MAJOR > 2)))
|
||||
if (font->face->charmap->encoding == FT_ENCODING_MS_SYMBOL && strcmp(font->face->family_name, "Symbol") == 0) {
|
||||
/* I do not know the significance of the constant 0xf000.
|
||||
* It was determined by inspection of the character codes
|
||||
* stored in Microsoft font symbol.
|
||||
*/
|
||||
/* Convert to the Symbol glyph range only for a Symbol family member */
|
||||
len = gdTcl_UtfToUniChar (next, &ch);
|
||||
ch |= 0xf000;
|
||||
next += len;
|
||||
} else
|
||||
#endif /* FT_ENCODING_MS_SYMBOL */
|
||||
#endif /* Freetype 2.1 or better */
|
||||
/* EAM DEBUG */
|
||||
|
||||
switch (m) {
|
||||
@@ -1041,7 +1060,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
FT_Set_Transform(face, &matrix, NULL);
|
||||
/* Convert character code to glyph index */
|
||||
glyph_index = FT_Get_Char_Index(face, ch);
|
||||
|
||||
|
||||
/* retrieve kerning distance and move pen position */
|
||||
if (use_kerning && previous && glyph_index) {
|
||||
FT_Get_Kerning(face, previous, glyph_index, ft_kerning_default, &delta);
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
--TEST--
|
||||
Bug #24594 (Filling an area using tiles).
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) {
|
||||
die("skip gd extension not available\n");
|
||||
}
|
||||
if (!GD_BUNDLED) {
|
||||
die('skip external GD libraries may fail');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* $id */
|
||||
/*
|
||||
* This test segfaults with the current imagefilltoborder
|
||||
* implementation. A rewrite of this function is required
|
||||
* to fix it. The algorithm used in gdImageFill (and the
|
||||
* privat function for tiled fill) may help here. pierre.
|
||||
*/
|
||||
$tile = imagecreate(36,36);
|
||||
$base = imagecreate(150,150);
|
||||
$white = imagecolorallocate($tile,255,255,255);
|
||||
$black = imagecolorallocate($tile,0,0,0);
|
||||
$white = imagecolorallocate($base,255,255,255);
|
||||
$black = imagecolorallocate($base,0,0,0);
|
||||
|
||||
/* create the dots pattern */
|
||||
for ($x=0;$x<36;$x+=2) {
|
||||
for ($y=0;$y<36;$y+=2) {
|
||||
imagesetpixel($tile,$x,$y,$black);
|
||||
}
|
||||
}
|
||||
|
||||
imagesettile($base,$tile);
|
||||
imagerectangle($base, 9,9,139,139,$black);
|
||||
imageline($base, 9,9,139,139,$black);
|
||||
imagefill($base,11,12,IMG_COLOR_TILED);
|
||||
|
||||
$res = imagecolorat($base,0,10)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,20)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,30)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,40)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,50)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,60)==$black?'1':'0';
|
||||
|
||||
$res .= imagecolorat($base,11,12)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,12,13)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,13,14)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,14,15)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,15,16)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,16,17)==$white?'1':'0';
|
||||
|
||||
$res .= imagecolorat($base,10,12)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,11,13)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,12,14)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,13,15)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,14,16)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,15,17)==$black?'1':'0';
|
||||
echo "$res\n";
|
||||
|
||||
imagefilledrectangle($base,0,0,149,149,$white);
|
||||
imagerectangle($base, 9,9,139,139,$black);
|
||||
imageline($base, 9,9,139,139,$black);
|
||||
imagefilltoborder($base,0,0,$black,IMG_COLOR_TILED);
|
||||
|
||||
$res = imagecolorat($base,0,10)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,20)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,30)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,40)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,50)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,60)==$black?'1':'0';
|
||||
|
||||
$res .= imagecolorat($base,11,12)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,12,13)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,13,14)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,14,15)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,15,16)==$white?'1':'0';
|
||||
$res .= imagecolorat($base,16,17)==$white?'1':'0';
|
||||
|
||||
$res .= imagecolorat($base,0,16)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,2,42)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,4,44)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,146,146)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,148,146)==$black?'1':'0';
|
||||
$res .= imagecolorat($base,0,0)==$black?'1':'0';
|
||||
|
||||
echo "$res\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
000000111111101010
|
||||
111111111111111111
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #28147 (Crash with anti-aliased line)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available\n");
|
||||
if (!GD_BUNDLED) die('skip external GD libraries always fail');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
//
|
||||
// This script will generate a Seg Fault on Linux
|
||||
//
|
||||
$im = imagecreatetruecolor(300, 300);
|
||||
$w = imagecolorallocate($im, 255, 255, 255);
|
||||
$red = imagecolorallocate($im, 255, 0, 0);
|
||||
|
||||
imagefilledrectangle($im,0,0,299,299,$w);
|
||||
|
||||
imageantialias($im,true);
|
||||
imageline($im, 299, 299, 0, 299, $red);
|
||||
|
||||
imagedestroy($im);
|
||||
|
||||
echo "Alive\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Alive
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #28984 (imagefill segfault using a transparent color).
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) {
|
||||
die("skip gd extension not available\n");
|
||||
}
|
||||
if (!GD_BUNDLED) {
|
||||
die('skip external GD libraries may fail');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatetruecolor(100,100);
|
||||
imagealphablending($im, false);
|
||||
#$alpha = imagecolorallocatealpha($im, 255, 0, 255,0);
|
||||
$alpha = imagecolorallocate($im, 255, 0, 0);
|
||||
imagefill($im, 2, 2, $alpha);
|
||||
#imagesavealpha($im, true);
|
||||
imagepng($im, '1.png');
|
||||
imagedestroy($im);
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Done
|
||||
@@ -54,7 +54,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gettext.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
|
||||
# ADD LINK32 php4ts.lib libintl.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 /dll /machine:I386 /out:"..\..\Release_TS/php_gettext.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
|
||||
# ADD LINK32 php4ts.lib libintl.lib iconv.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 /dll /machine:I386 /out:"..\..\Release_TS/php_gettext.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
|
||||
|
||||
!ELSEIF "$(CFG)" == "gettext - Win32 Debug_TS"
|
||||
|
||||
@@ -81,7 +81,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"../../Debug_TS/php_gettext.dll" /libpath:"..\..\Debug_TS"
|
||||
# ADD LINK32 php4ts_debug.lib libintl.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 /dll /incremental:yes /debug /machine:I386 /out:"../../Debug_TS/php_gettext.dll" /libpath:"..\..\Debug_TS"
|
||||
# ADD LINK32 php4ts_debug.lib libintl.lib iconv.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 /dll /incremental:yes /debug /machine:I386 /out:"../../Debug_TS/php_gettext.dll" /libpath:"..\..\Debug_TS"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
--TEST--
|
||||
Gettext basic test
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gettext")) print "skip"; ?>
|
||||
<?php
|
||||
if (!extension_loaded("gettext")) {
|
||||
die("skip\n");
|
||||
}
|
||||
if (!setlocale(LC_ALL, 'fi_FI')) {
|
||||
die("skip fi_FI locale not supported.");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php // $Id$
|
||||
|
||||
|
||||
+1
-2
@@ -830,8 +830,7 @@ ZEND_FUNCTION(gmp_powm)
|
||||
}
|
||||
FETCH_GMP_ZVAL(gmpnum_mod, mod_arg);
|
||||
|
||||
convert_to_long_ex(mod_arg);
|
||||
if (!Z_LVAL_PP(mod_arg)) {
|
||||
if (!mpz_cmp_ui(*gmpnum_mod, 0)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
+11
-8
@@ -65,23 +65,26 @@ if test "$PHP_ICONV" != "no"; then
|
||||
esac
|
||||
fi
|
||||
|
||||
echo > ext/iconv/php_have_bsd_iconv.h
|
||||
echo > ext/iconv/php_have_glibc_iconv.h
|
||||
|
||||
case "$iconv_impl_name" in
|
||||
gnu_libiconv [)]
|
||||
PHP_DEFINE([PHP_ICONV_IMPL],[\"libiconv\"])
|
||||
PHP_DEFINE([PHP_ICONV_IMPL],[\"libiconv\"],[ext/iconv])
|
||||
AC_DEFINE([PHP_ICONV_IMPL],["libiconv"],[Which iconv implementation to use])
|
||||
;;
|
||||
|
||||
bsd [)]
|
||||
PHP_DEFINE([HAVE_BSD_ICONV],1)
|
||||
PHP_DEFINE([HAVE_BSD_ICONV],1,[ext/iconv])
|
||||
AC_DEFINE([HAVE_BSD_ICONV],1,[Konstantin Chugeuv's iconv implementation])
|
||||
PHP_DEFINE([PHP_ICONV_IMPL],[\"BSD iconv\"])
|
||||
PHP_DEFINE([PHP_ICONV_IMPL],[\"BSD iconv\"],[ext/iconv])
|
||||
AC_DEFINE([PHP_ICONV_IMPL],["BSD iconv"],[Which iconv implementation to use])
|
||||
;;
|
||||
|
||||
glibc [)]
|
||||
PHP_DEFINE([HAVE_GLIBC_ICONV],1)
|
||||
PHP_DEFINE([HAVE_GLIBC_ICONV],1,[ext/iconv])
|
||||
AC_DEFINE([HAVE_GLIBC_ICONV],1,[glibc's iconv implementation])
|
||||
PHP_DEFINE([PHP_ICONV_IMPL],[\"glibc\"])
|
||||
PHP_DEFINE([PHP_ICONV_IMPL],[\"glibc\"],[ext/iconv])
|
||||
AC_DEFINE([PHP_ICONV_IMPL],["glibc"],[Which iconv implementation to use])
|
||||
;;
|
||||
esac
|
||||
@@ -106,11 +109,11 @@ int main() {
|
||||
}
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
PHP_DEFINE([ICONV_SUPPORTS_ERRNO],1)
|
||||
PHP_DEFINE([ICONV_SUPPORTS_ERRNO],1,[ext/iconv])
|
||||
AC_DEFINE([ICONV_SUPPORTS_ERRNO],1,[Whether iconv supports error no or not])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
PHP_DEFINE([ICONV_SUPPORTS_ERRNO],0)
|
||||
PHP_DEFINE([ICONV_SUPPORTS_ERRNO],0,[ext/iconv])
|
||||
AC_DEFINE([ICONV_SUPPORTS_ERRNO],0,[Whether iconv supports error no or not])
|
||||
])
|
||||
|
||||
@@ -120,7 +123,7 @@ int main() {
|
||||
#include FOO
|
||||
], [], [
|
||||
AC_MSG_RESULT([yes])
|
||||
PHP_DEFINE([PHP_ICONV_H_PATH], [<$PHP_ICONV_H_PATH>])
|
||||
PHP_DEFINE([PHP_ICONV_H_PATH], [<$PHP_ICONV_H_PATH>],[ext/iconv])
|
||||
AC_DEFINE_UNQUOTED([PHP_ICONV_H_PATH], [<$PHP_ICONV_H_PATH>], [Path to iconv.h])
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
|
||||
+1
-14
@@ -83,24 +83,11 @@ ZEND_DECLARE_MODULE_GLOBALS(iconv)
|
||||
ZEND_GET_MODULE(iconv)
|
||||
#endif
|
||||
|
||||
/* {{{ typedef enum php_iconv_err_t */
|
||||
typedef enum _php_iconv_err_t {
|
||||
PHP_ICONV_ERR_SUCCESS = SUCCESS,
|
||||
PHP_ICONV_ERR_CONVERTER = 1,
|
||||
PHP_ICONV_ERR_WRONG_CHARSET = 2,
|
||||
PHP_ICONV_ERR_TOO_BIG = 3,
|
||||
PHP_ICONV_ERR_ILLEGAL_SEQ = 4,
|
||||
PHP_ICONV_ERR_ILLEGAL_CHAR = 5,
|
||||
PHP_ICONV_ERR_UNKNOWN = 6
|
||||
} php_iconv_err_t;
|
||||
/* }}} */
|
||||
|
||||
#ifdef HAVE_LIBICONV
|
||||
#define iconv libiconv
|
||||
#endif
|
||||
|
||||
/* {{{ prototypes */
|
||||
static php_iconv_err_t php_iconv_string(const char * in_p, size_t in_len, char **out, size_t *out_len, const char *in_charset, const char *out_charset);
|
||||
static void _php_iconv_show_error(php_iconv_err_t err, const char *in_charset, const char *out_charset TSRMLS_DC);
|
||||
/* }}} */
|
||||
|
||||
@@ -185,7 +172,7 @@ PHP_MINFO_FUNCTION(miconv)
|
||||
|
||||
/* {{{ php_iconv_string
|
||||
*/
|
||||
php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
|
||||
PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
|
||||
char **out, size_t *out_len,
|
||||
const char *in_charset, const char *out_charset)
|
||||
{
|
||||
|
||||
+4
-4
@@ -43,7 +43,7 @@ RSC=rc.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ICONV_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /I "..\..\..\php_build\iconv\include" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_ICONV" /D "HAVE_ICONV" /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZTS=1 /D "ICONV_SUPPORTS_ERRNO" /D "HAVE_LIBICONV" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /I "..\..\..\php_build\iconv\include" /D ZEND_DEBUG=0 /D "ICONV_SUPPORTS_ERRNO" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_ICONV" /D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_ICONV" /D ZTS=1 /D "HAVE_LIBICONV" /D "PHP_ICONV_EXPORTS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x407 /d "NDEBUG"
|
||||
@@ -53,7 +53,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 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 /dll /machine:I386
|
||||
# ADD LINK32 php4ts.lib iconv-1.3.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 /dll /machine:I386 /out:"..\..\Release_TS/php_iconv.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\iconv\lib"
|
||||
# ADD LINK32 php4ts.lib iconv.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 /dll /machine:I386 /out:"..\..\Release_TS/php_iconv.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\iconv\lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "iconv - Win32 Debug_TS"
|
||||
|
||||
@@ -69,7 +69,7 @@ LINK32=link.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ICONV_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /I "..\..\..\php_build\iconv\include" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_ICONV" /D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_ICONV" /D ZTS=1 /D "HAVE_LIBICONV" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /I "..\..\..\php_build\iconv\include" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_ICONV" /D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_ICONV" /D ZTS=1 /D "HAVE_LIBICONV" /D "PHP_ICONV_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
@@ -79,7 +79,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 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 /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 php4ts_debug.lib iconv-1.3.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 /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_iconv.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\iconv\lib"
|
||||
# ADD LINK32 php4ts_debug.lib iconv.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 /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_iconv.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\iconv\lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
+25
-7
@@ -23,19 +23,23 @@
|
||||
#define PHP_ICONV_H
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#ifdef PHP_ICONV_EXPORTS
|
||||
#define PHP_ICONV_API __declspec(dllexport)
|
||||
#else
|
||||
#define PHP_ICONV_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define PHP_ICONV_API
|
||||
#endif
|
||||
|
||||
#ifdef PHP_ATOM_INC
|
||||
#include "php_have_iconv.h"
|
||||
#include "php_have_libiconv.h"
|
||||
#include "php_have_glibc_iconv.h"
|
||||
#include "php_have_bsd_iconv.h"
|
||||
#include "php_iconv_supports_errno.h"
|
||||
#include "php_php_iconv_impl.h"
|
||||
#include "php_php_iconv_h_path.h"
|
||||
#include "ext/iconv/php_have_iconv.h"
|
||||
#include "ext/iconv/php_have_libiconv.h"
|
||||
#include "ext/iconv/php_have_glibc_iconv.h"
|
||||
#include "ext/iconv/php_have_bsd_iconv.h"
|
||||
#include "ext/iconv/php_iconv_supports_errno.h"
|
||||
#include "ext/iconv/php_php_iconv_impl.h"
|
||||
#include "ext/iconv/php_php_iconv_h_path.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -68,6 +72,20 @@ ZEND_END_MODULE_GLOBALS(iconv)
|
||||
#define ICONV_OUTPUT_ENCODING "ISO-8859-1"
|
||||
#define ICONV_INTERNAL_ENCODING "ISO-8859-1"
|
||||
|
||||
/* {{{ typedef enum php_iconv_err_t */
|
||||
typedef enum _php_iconv_err_t {
|
||||
PHP_ICONV_ERR_SUCCESS = SUCCESS,
|
||||
PHP_ICONV_ERR_CONVERTER = 1,
|
||||
PHP_ICONV_ERR_WRONG_CHARSET = 2,
|
||||
PHP_ICONV_ERR_TOO_BIG = 3,
|
||||
PHP_ICONV_ERR_ILLEGAL_SEQ = 4,
|
||||
PHP_ICONV_ERR_ILLEGAL_CHAR = 5,
|
||||
PHP_ICONV_ERR_UNKNOWN = 6
|
||||
} php_iconv_err_t;
|
||||
/* }}} */
|
||||
|
||||
PHP_ICONV_API php_iconv_err_t php_iconv_string(const char * in_p, size_t in_len, char **out, size_t *out_len, const char *in_charset, const char *out_charset);
|
||||
|
||||
#else
|
||||
|
||||
#define iconv_module_ptr NULL
|
||||
|
||||
+41
-44
@@ -112,7 +112,7 @@ function_entry imap_functions[] = {
|
||||
PHP_FE(imap_qprint, NULL)
|
||||
PHP_FE(imap_8bit, NULL)
|
||||
PHP_FE(imap_binary, NULL)
|
||||
PHP_FE(imap_utf8, NULL)
|
||||
PHP_FE(imap_utf8, NULL)
|
||||
PHP_FE(imap_status, NULL)
|
||||
PHP_FE(imap_mailboxmsginfo, NULL)
|
||||
PHP_FE(imap_setflag_full, NULL)
|
||||
@@ -131,7 +131,7 @@ function_entry imap_functions[] = {
|
||||
PHP_FE(imap_utf7_encode, NULL)
|
||||
PHP_FE(imap_mime_header_decode, NULL)
|
||||
PHP_FE(imap_thread, NULL)
|
||||
PHP_FE(imap_timeout, NULL)
|
||||
PHP_FE(imap_timeout, NULL)
|
||||
|
||||
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
|
||||
PHP_FE(imap_get_quota, NULL)
|
||||
@@ -142,12 +142,12 @@ function_entry imap_functions[] = {
|
||||
|
||||
PHP_FE(imap_mail, NULL)
|
||||
|
||||
PHP_FALIAS(imap_header, imap_headerinfo, NULL)
|
||||
PHP_FALIAS(imap_listmailbox, imap_list, NULL)
|
||||
PHP_FALIAS(imap_getmailboxes, imap_list_full, NULL)
|
||||
PHP_FALIAS(imap_scanmailbox, imap_listscan, NULL)
|
||||
PHP_FALIAS(imap_listsubscribed, imap_lsub, NULL)
|
||||
PHP_FALIAS(imap_getsubscribed, imap_lsub_full, NULL)
|
||||
PHP_FALIAS(imap_header, imap_headerinfo, NULL)
|
||||
PHP_FALIAS(imap_listmailbox, imap_list, NULL)
|
||||
PHP_FALIAS(imap_getmailboxes, imap_list_full, NULL)
|
||||
PHP_FALIAS(imap_scanmailbox, imap_listscan, NULL)
|
||||
PHP_FALIAS(imap_listsubscribed, imap_lsub, NULL)
|
||||
PHP_FALIAS(imap_getsubscribed, imap_lsub_full, NULL)
|
||||
PHP_FALIAS(imap_fetchtext, imap_body, NULL)
|
||||
PHP_FALIAS(imap_scan, imap_listscan, NULL)
|
||||
PHP_FALIAS(imap_create, imap_createmailbox, NULL)
|
||||
@@ -181,6 +181,12 @@ ZEND_GET_MODULE(imap)
|
||||
/* True globals, no need for thread safety */
|
||||
static int le_imap;
|
||||
|
||||
#define PHP_IMAP_CHECK_MSGNO(msgindex) \
|
||||
if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) { \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message number"); \
|
||||
RETURN_FALSE; \
|
||||
} \
|
||||
|
||||
/* {{{ mail_close_it
|
||||
*/
|
||||
static void mail_close_it(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
@@ -1314,7 +1320,7 @@ PHP_FUNCTION(imap_list_full)
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
delim = emalloc(2 * sizeof(char));
|
||||
delim = safe_emalloc(2, sizeof(char), 0);
|
||||
cur=IMAPG(imap_folder_objects);
|
||||
while (cur != NIL) {
|
||||
MAKE_STD_ZVAL(mboxob);
|
||||
@@ -1485,10 +1491,7 @@ PHP_FUNCTION(imap_headerinfo)
|
||||
convert_to_string_ex(defaulthost);
|
||||
}
|
||||
|
||||
if (!Z_LVAL_PP(msgno) || Z_LVAL_PP(msgno) < 1 || (unsigned) Z_LVAL_PP(msgno) > imap_le_struct->imap_stream->nmsgs) {
|
||||
php_error(E_WARNING, "%s(): Bad message number", get_active_function_name(TSRMLS_C));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
PHP_IMAP_CHECK_MSGNO(Z_LVAL_PP(msgno));
|
||||
|
||||
if (mail_fetchstructure(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL)) {
|
||||
cache = mail_elt(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
|
||||
@@ -1635,6 +1638,7 @@ PHP_FUNCTION(imap_lsub_full)
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
delim = safe_emalloc(2, sizeof(char), 0);
|
||||
cur=IMAPG(imap_sfolder_objects);
|
||||
while (cur != NIL) {
|
||||
MAKE_STD_ZVAL(mboxob);
|
||||
@@ -1736,10 +1740,8 @@ PHP_FUNCTION(imap_fetchstructure)
|
||||
} else {
|
||||
msgindex = Z_LVAL_PP(msgno);
|
||||
}
|
||||
if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) {
|
||||
php_error(E_WARNING, "%s(): Bad message number", get_active_function_name(TSRMLS_C));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_IMAP_CHECK_MSGNO(msgindex);
|
||||
|
||||
mail_fetchstructure_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), &body , myargc == 3 ? Z_LVAL_PP(flags) : NIL);
|
||||
|
||||
@@ -1773,7 +1775,12 @@ PHP_FUNCTION(imap_fetchbody)
|
||||
if (myargc == 4) {
|
||||
convert_to_long_ex(flags);
|
||||
}
|
||||
|
||||
|
||||
if (myargc < 4 || !(Z_LVAL_PP(flags) & FT_UID)) {
|
||||
/* only perform the check if the msgno is a message number and not a UID */
|
||||
PHP_IMAP_CHECK_MSGNO(Z_LVAL_PP(msgno));
|
||||
}
|
||||
|
||||
body = mail_fetchbody_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), Z_STRVAL_PP(sec), &len, myargc==4 ? Z_LVAL_PP(flags) : NIL);
|
||||
|
||||
if (!body) {
|
||||
@@ -2477,10 +2484,7 @@ PHP_FUNCTION(imap_fetchheader)
|
||||
msgindex = Z_LVAL_PP(msgno);
|
||||
}
|
||||
|
||||
if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) {
|
||||
php_error(E_WARNING, "%s(): Bad message number", get_active_function_name(TSRMLS_C));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
PHP_IMAP_CHECK_MSGNO(msgindex);
|
||||
|
||||
RETVAL_STRING(mail_fetchheader_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, NIL, (myargc == 3 ? Z_LVAL_PP(flags) : NIL)), 1);
|
||||
}
|
||||
@@ -3190,6 +3194,9 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
|
||||
bufferLen += strlen(cc) + 6;
|
||||
}
|
||||
|
||||
#define PHP_IMAP_CLEAN if (bufferTo) efree(bufferTo); if (bufferCc) efree(bufferCc); if (bufferBcc) efree(bufferBcc); if (bufferHeader) efree(bufferHeader);
|
||||
#define PHP_IMAP_BAD_DEST PHP_IMAP_CLEAN; efree(tempMailTo); return (BAD_MSG_DESTINATION);
|
||||
|
||||
bufferHeader = (char *)emalloc(bufferLen);
|
||||
memset(bufferHeader, 0, bufferLen);
|
||||
if (to && *to) {
|
||||
@@ -3202,9 +3209,9 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
|
||||
addr = NULL;
|
||||
rfc822_parse_adrlist(&addr, tempMailTo, NULL);
|
||||
while (addr) {
|
||||
if (strcmp(addr->host, ERRHOST) == 0)
|
||||
return (BAD_MSG_DESTINATION);
|
||||
else {
|
||||
if (strcmp(addr->host, ERRHOST) == 0) {
|
||||
PHP_IMAP_BAD_DEST;
|
||||
} else {
|
||||
offset += sprintf(bufferTo + offset, "%s@%s,", addr->mailbox, addr->host);
|
||||
}
|
||||
addr = addr->next;
|
||||
@@ -3225,9 +3232,9 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
|
||||
addr = NULL;
|
||||
rfc822_parse_adrlist(&addr, tempMailTo, NULL);
|
||||
while (addr) {
|
||||
if (strcmp(addr->host, ERRHOST) == 0)
|
||||
return (BAD_MSG_DESTINATION);
|
||||
else {
|
||||
if (strcmp(addr->host, ERRHOST) == 0) {
|
||||
PHP_IMAP_BAD_DEST;
|
||||
} else {
|
||||
offset += sprintf(bufferCc + offset, "%s@%s,", addr->mailbox, addr->host);
|
||||
}
|
||||
addr = addr->next;
|
||||
@@ -3245,9 +3252,9 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
|
||||
addr = NULL;
|
||||
rfc822_parse_adrlist(&addr, tempMailTo, NULL);
|
||||
while (addr) {
|
||||
if (strcmp(addr->host, ERRHOST) == 0)
|
||||
return (BAD_MSG_DESTINATION);
|
||||
else {
|
||||
if (strcmp(addr->host, ERRHOST) == 0) {
|
||||
PHP_IMAP_BAD_DEST;
|
||||
} else {
|
||||
offset += sprintf(bufferBcc + offset, "%s@%s,", addr->mailbox, addr->host);
|
||||
}
|
||||
addr = addr->next;
|
||||
@@ -3269,20 +3276,10 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
|
||||
} else {
|
||||
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), GetSMErrorText(tsm_err));
|
||||
}
|
||||
PHP_IMAP_CLEAN;
|
||||
return 0;
|
||||
}
|
||||
if (bufferTo) {
|
||||
efree(bufferTo);
|
||||
}
|
||||
if (bufferCc) {
|
||||
efree(bufferCc);
|
||||
}
|
||||
if (bufferBcc) {
|
||||
efree(bufferBcc);
|
||||
}
|
||||
if (bufferHeader) {
|
||||
efree(bufferHeader);
|
||||
}
|
||||
PHP_IMAP_CLEAN;
|
||||
#else
|
||||
if (!INI_STR("sendmail_path")) {
|
||||
return 0;
|
||||
@@ -3689,7 +3686,7 @@ static void _php_imap_parse_address (ADDRESS *addresslist, char **fulladdress, z
|
||||
addresstmp = addresslist;
|
||||
|
||||
if ((len = _php_imap_address_size(addresstmp))) {
|
||||
tmpstr = (char *) malloc (len);
|
||||
tmpstr = (char *) malloc(len + 1);
|
||||
tmpstr[0] = '\0';
|
||||
rfc822_write_address(tmpstr, addresstmp);
|
||||
*fulladdress = tmpstr;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
OVERALL_TARGET += $(srcdir)/ifx.c
|
||||
|
||||
$(srcdir)/ifx.c: $(srcdir)/ifx.ec $(builddir)/libphpifx.a
|
||||
(if test -d $(INFORMIXDIR); then \
|
||||
THREADLIB=POSIX $(INFORMIXDIR)/bin/esql -e $(IFX_ESQL_FLAGS) $(srcdir)/ifx.ec; mv ifx.c $@; \
|
||||
THREADLIB=POSIX $(INFORMIXDIR)/bin/esql -e $(IFX_ESQL_FLAGS) $(srcdir)/ifx.ec; \
|
||||
mv ifx.c $@ || true; \
|
||||
else \
|
||||
touch $@; \
|
||||
fi)
|
||||
|
||||
+125
-45
@@ -37,6 +37,10 @@
|
||||
/* prevent mod_ssl.h's header file from being included. */
|
||||
#define AP_HOOK_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
#include "php_globals.h"
|
||||
#include "ext/standard/php_standard.h"
|
||||
@@ -50,6 +54,12 @@
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
#define IFX_THRD_ID tsrm_thread_id()
|
||||
#else
|
||||
#define IFX_THRD_ID 0
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
@@ -122,8 +132,10 @@ typedef char IFX[128];
|
||||
#define PHP_IFX_CHECK_CONNECTION(ifx) \
|
||||
{ \
|
||||
if (ifx_check() < 0) { \
|
||||
char *ifx_err = ifx_error(ifx); \
|
||||
IFXG(sv_sqlcode) = SQLCODE; \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Set connection %s fails (%s)", ifx, ifx_error(ifx)); \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Set connection %s fails (%s)", ifx, ifx_err); \
|
||||
efree(ifx_err); \
|
||||
RETURN_FALSE; \
|
||||
} \
|
||||
}
|
||||
@@ -283,6 +295,7 @@ EXEC SQL BEGIN DECLARE SECTION;
|
||||
PARAMETER char *link;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
{
|
||||
char *ifx_err = NULL;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
EXEC SQL SET CONNECTION :link;
|
||||
@@ -299,7 +312,7 @@ EXEC SQL END DECLARE SECTION;
|
||||
EXEC SQL DISCONNECT :link;
|
||||
if (ifx_check() < 0) {
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Disconnect link %s after Automatic Rollback fails (%s)", link, ifx_error(link));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Disconnect link %s after Automatic Rollback fails (%s)", link, (ifx_err = ifx_error(link)));
|
||||
}
|
||||
}
|
||||
if (ifx_check() < 0) {
|
||||
@@ -307,20 +320,23 @@ EXEC SQL END DECLARE SECTION;
|
||||
EXEC SQL CLOSE DATABASE;
|
||||
if (ifx_check() < 0) {
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Close database fails %s (%s)", link, ifx_error(link));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Close database fails %s (%s)", link, (ifx_err = ifx_error(link)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (SQLCODE < 0) {
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Disconnect link %s fails (%s)", link, ifx_error(link));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Disconnect link %s fails (%s)", link, (ifx_err = ifx_error(link)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Set connection %s fails (%s)", link, ifx_error(link));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Set connection %s fails (%s)", link, (ifx_err = ifx_error(link)));
|
||||
}
|
||||
|
||||
if (ifx_err) {
|
||||
efree(ifx_err);
|
||||
}
|
||||
}
|
||||
|
||||
static void _close_ifx_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
@@ -532,13 +548,15 @@ EXEC SQL END DECLARE SECTION;
|
||||
/* create the link */
|
||||
ifx = (char *) malloc(sizeof(IFX));
|
||||
IFXG(connectionid)++;
|
||||
sprintf(ifx, "%s%x", SAFE_STRING(user), IFXG(connectionid));
|
||||
sprintf(ifx, "%s%x_%x", SAFE_STRING(user), IFX_THRD_ID,IFXG(connectionid));
|
||||
|
||||
EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION;
|
||||
|
||||
if (ifx_check() == IFX_ERROR) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ifx_err);
|
||||
efree(ifx_err);
|
||||
free(ifx);
|
||||
efree(hashed_details);
|
||||
RETURN_FALSE;
|
||||
@@ -566,9 +584,11 @@ EXEC SQL END DECLARE SECTION;
|
||||
EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION;
|
||||
|
||||
if (ifx_check() == IFX_ERROR) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Link to server lost, unable to reconnect (%s)", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Link to server lost, unable to reconnect (%s)", ifx_err);
|
||||
zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length + 1);
|
||||
efree(ifx_err);
|
||||
efree(hashed_details);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -604,10 +624,12 @@ EXEC SQL END DECLARE SECTION;
|
||||
EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION;
|
||||
|
||||
if (ifx_check() == IFX_ERROR) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect (%s)", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect (%s)", ifx_err);
|
||||
zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length + 1);
|
||||
efree(hashed_details);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -629,13 +651,15 @@ EXEC SQL END DECLARE SECTION;
|
||||
|
||||
ifx = (char *) emalloc(sizeof(IFX));
|
||||
IFXG(connectionid)++;
|
||||
sprintf(ifx, "connec%x", IFXG(connectionid));
|
||||
sprintf(ifx, "connec%x_%x", IFX_THRD_ID, IFXG(connectionid));
|
||||
|
||||
EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION;
|
||||
|
||||
if (ifx_check() == IFX_ERROR) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ifx_err);
|
||||
efree(ifx_err);
|
||||
efree(hashed_details);
|
||||
efree(ifx);
|
||||
RETURN_FALSE;
|
||||
@@ -800,18 +824,20 @@ EXEC SQL END DECLARE SECTION;
|
||||
statement = Z_STRVAL_PP(query);
|
||||
|
||||
IFXG(cursorid)++;
|
||||
sprintf(statemid, "statem%x", IFXG(cursorid));
|
||||
sprintf(cursorid, "cursor%x", IFXG(cursorid));
|
||||
sprintf(descrpid, "descrp%x", IFXG(cursorid));
|
||||
sprintf(i_descrpid, "i_descrp%x", IFXG(cursorid));
|
||||
sprintf(statemid, "statem%x_%x", IFX_THRD_ID, IFXG(cursorid));
|
||||
sprintf(cursorid, "cursor%x_%x", IFX_THRD_ID, IFXG(cursorid));
|
||||
sprintf(descrpid, "descrp%x_%x", IFX_THRD_ID, IFXG(cursorid));
|
||||
sprintf(i_descrpid, "i_descrp%x_%x", IFX_THRD_ID,IFXG(cursorid));
|
||||
|
||||
EXEC SQL set connection :ifx;
|
||||
PHP_IFX_CHECK_CONNECTION(ifx);
|
||||
|
||||
EXEC SQL PREPARE :statemid FROM :statement;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Prepare fails (%s)", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Prepare fails (%s)", ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -842,10 +868,12 @@ EXEC SQL END DECLARE SECTION;
|
||||
}
|
||||
|
||||
if (!php_intifx_alloc_ibind(Ifx_Result, num_params TSRMLS_CC)) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate i_desciptor <%s> fails (%s)", i_descrpid, ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate i_desciptor <%s> fails (%s)", i_descrpid, ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -856,18 +884,22 @@ EXEC SQL END DECLARE SECTION;
|
||||
|
||||
EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX :desc_count;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate desciptor <%s> fails (%s)", descrpid, ifx_err);
|
||||
EXEC SQL free :statemid;
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Describe fails (%s)", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Describe fails (%s)", ifx_err);
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -967,11 +999,13 @@ EXEC SQL END DECLARE SECTION;
|
||||
}
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails : %s", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails : %s", ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -992,13 +1026,15 @@ EXEC SQL END DECLARE SECTION;
|
||||
}
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
if (Ifx_Result->numicols > 0) {
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
|
||||
}
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails : %s", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails : %s", ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
|
||||
@@ -1035,11 +1071,13 @@ EXEC SQL END DECLARE SECTION;
|
||||
|
||||
EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not get descriptor %s (%s)", descrpid, ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not get descriptor %s (%s)", descrpid, ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1072,22 +1110,26 @@ EXEC SQL END DECLARE SECTION;
|
||||
}
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Declare cursor fails (%s)", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Declare cursor fails (%s)", ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
EXEC SQL OPEN :cursorid;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
EXEC SQL free :cursorid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Open cursor fails (%s)", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Open cursor fails (%s)", ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1206,10 +1248,10 @@ EXEC SQL END DECLARE SECTION;
|
||||
statement = Z_STRVAL_PP(query);
|
||||
|
||||
IFXG(cursorid)++;
|
||||
sprintf(statemid, "statem%x", IFXG(cursorid));
|
||||
sprintf(cursorid, "cursor%x", IFXG(cursorid));
|
||||
sprintf(descrpid, "descrp%x", IFXG(cursorid));
|
||||
sprintf(i_descrpid, "i_descrp%x", IFXG(cursorid));
|
||||
sprintf(statemid, "statem%x_%x", IFX_THRD_ID, IFXG(cursorid));
|
||||
sprintf(cursorid, "cursor%x_%x", IFX_THRD_ID, IFXG(cursorid));
|
||||
sprintf(descrpid, "descrp%x_%x", IFX_THRD_ID, IFXG(cursorid));
|
||||
sprintf(i_descrpid, "i_descrp%x_%x", IFX_THRD_ID,IFXG(cursorid));
|
||||
|
||||
EXEC SQL set connection :ifx;
|
||||
PHP_IFX_CHECK_CONNECTION(ifx);
|
||||
@@ -1250,10 +1292,12 @@ EXEC SQL END DECLARE SECTION;
|
||||
}
|
||||
|
||||
if (!php_intifx_alloc_ibind(Ifx_Result, num_params TSRMLS_CC)) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate i_desciptor <%s> fails (%s)", i_descrpid, ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate i_desciptor <%s> fails (%s)", i_descrpid, ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1264,18 +1308,22 @@ EXEC SQL END DECLARE SECTION;
|
||||
|
||||
EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX :desc_count;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Allocate desciptor <%s> fails (%s)", descrpid, ifx_err);
|
||||
EXEC SQL free :statemid;
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Describe fails (%s)", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Describe fails (%s)", ifx_err);
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1377,11 +1425,13 @@ EXEC SQL END DECLARE SECTION;
|
||||
}
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :i_descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Prepare fails : %s", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Prepare fails : %s", ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1434,11 +1484,13 @@ EXEC SQL END DECLARE SECTION;
|
||||
|
||||
EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err;
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
|
||||
EXEC SQL free :statemid;
|
||||
efree(Ifx_Result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not get descriptor %s (%s)", descrpid, ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not get descriptor %s (%s)", descrpid, (ifx_err = ifx_error(ifx)));
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
Ifx_Result->numcols = fieldcount;
|
||||
@@ -1524,8 +1576,10 @@ EXEC SQL END DECLARE SECTION;
|
||||
EXEC SQL EXECUTE :statemid;
|
||||
}
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails: %s", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Execute immediate fails: %s", ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
|
||||
@@ -1548,15 +1602,19 @@ EXEC SQL END DECLARE SECTION;
|
||||
}
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Declare cursor fails (%s)", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Declare cursor fails (%s)", ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
EXEC SQL OPEN :cursorid;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Open cursor fails (%s)", ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Open cursor fails (%s)", ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1893,8 +1951,12 @@ EXEC SQL END DECLARE SECTION;
|
||||
switch (ifx_check()) {
|
||||
case IFX_ERROR:
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch row on cursor %s (%s)", ifx_error(ifx), cursorid);
|
||||
RETURN_FALSE;
|
||||
{
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch row on cursor %s (%s)", ifx_err, cursorid);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
break;
|
||||
case IFX_NODATA:
|
||||
RETURN_FALSE;
|
||||
@@ -1917,8 +1979,10 @@ EXEC SQL END DECLARE SECTION;
|
||||
:indicator = INDICATOR;
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2243,7 +2307,11 @@ EXEC SQL END DECLARE SECTION;
|
||||
switch (ifx_check()) {
|
||||
case IFX_ERROR:
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_error(ifx), cursorid);
|
||||
{
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_err, cursorid);
|
||||
efree(ifx_err);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
break;
|
||||
case IFX_NODATA:
|
||||
@@ -2272,8 +2340,10 @@ EXEC SQL END DECLARE SECTION;
|
||||
for (i = 1; i <= num_fields; i++) {
|
||||
EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2299,8 +2369,10 @@ EXEC SQL END DECLARE SECTION;
|
||||
:indicator = INDICATOR;
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2471,7 +2543,11 @@ $endif;
|
||||
switch (ifx_check()) {
|
||||
case IFX_ERROR:
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_error(ifx), cursorid);
|
||||
{
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_err, cursorid);
|
||||
efree(ifx_err);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
break;
|
||||
case IFX_NODATA:
|
||||
@@ -2545,8 +2621,10 @@ EXEC SQL END DECLARE SECTION;
|
||||
for (i = 1; i <= num_fields; i++) {
|
||||
EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME, :fieldtype = TYPE;
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2708,8 +2786,10 @@ EXEC SQL END DECLARE SECTION;
|
||||
:isnullable = NULLABLE;
|
||||
|
||||
if (ifx_check() < 0) {
|
||||
char *ifx_err = ifx_error(ifx);
|
||||
IFXG(sv_sqlcode) = SQLCODE;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Get descriptor (field # %d) fails (%s)", i, ifx_err);
|
||||
efree(ifx_err);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -541,6 +541,7 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
} else { /* already open persistent connection */
|
||||
|
||||
if (Z_TYPE_P(le) != le_ii_plink) {
|
||||
efree(hashed_details);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* here we should ensure that the link did not die */
|
||||
|
||||
+11
-11
@@ -1201,7 +1201,7 @@ static int _php_ibase_blob_add(zval **string_arg, ibase_blob_handle *ib_blob TSR
|
||||
|
||||
/* {{{ _php_ibase_bind()
|
||||
Bind parameter placeholders in a previously prepared query */
|
||||
static int _php_ibase_bind(XSQLDA *sqlda, zval **b_vars, BIND_BUF *buf, ibase_query *ib_query TSRMLS_DC)
|
||||
static int _php_ibase_bind(XSQLDA *sqlda, zval ***b_vars, BIND_BUF *buf, ibase_query *ib_query TSRMLS_DC)
|
||||
{
|
||||
|
||||
int i , rv = SUCCESS;
|
||||
@@ -1209,7 +1209,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval **b_vars, BIND_BUF *buf, ibase_qu
|
||||
|
||||
for (i = 0; i < sqlda->sqld; ++var, ++i) { /* bound vars */
|
||||
|
||||
zval *b_var = b_vars[i];
|
||||
zval *b_var = *b_vars[i];
|
||||
|
||||
var->sqlind = &buf[i].sqlind;
|
||||
|
||||
@@ -1425,17 +1425,17 @@ static void _php_ibase_alloc_xsqlda(XSQLDA *sqlda)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ _php_ibase_exec() */
|
||||
static int _php_ibase_exec(ibase_result **ib_resultp, ibase_query *ib_query, int argc, zval **args TSRMLS_DC)
|
||||
static int _php_ibase_exec(ibase_result **ib_resultp, ibase_query *ib_query, int argc, zval ***args TSRMLS_DC)
|
||||
{
|
||||
#define IB_RESULT (*ib_resultp)
|
||||
XSQLDA *in_sqlda = NULL, *out_sqlda = NULL;
|
||||
BIND_BUF *bind_buf = NULL;
|
||||
int rv = FAILURE;
|
||||
int i, rv = FAILURE;
|
||||
|
||||
IB_RESULT = NULL;
|
||||
|
||||
if (argc > 0 && args != NULL) {
|
||||
SEPARATE_ZVAL(args);
|
||||
for (i = 0; i < argc; ++i) {
|
||||
SEPARATE_ZVAL(args[i]);
|
||||
}
|
||||
|
||||
/* allocate sqlda and output buffers */
|
||||
@@ -1699,7 +1699,7 @@ PHP_FUNCTION(ibase_rollback)
|
||||
Execute a query */
|
||||
PHP_FUNCTION(ibase_query)
|
||||
{
|
||||
zval ***args, **bind_args = NULL, **dummy = NULL;
|
||||
zval ***args, ***bind_args = NULL, **dummy = NULL;
|
||||
int i, link_id = 0, trans_n = 0, bind_n = 0, trans_id = 0;
|
||||
char *query;
|
||||
ibase_db_link *ib_link;
|
||||
@@ -1742,7 +1742,7 @@ PHP_FUNCTION(ibase_query)
|
||||
absolutely no sense if not using a prepared SQL statement.
|
||||
*/
|
||||
bind_n = ZEND_NUM_ARGS() - i;
|
||||
bind_args = args[i];
|
||||
bind_args = &args[i];
|
||||
}
|
||||
|
||||
/* open default transaction */
|
||||
@@ -1856,7 +1856,7 @@ static int _php_ibase_var_zval(zval *val, void *data, int type, int len, int sca
|
||||
if (n >= 0) {
|
||||
Z_STRLEN_P(val) = sprintf (string_data,
|
||||
"%" ISC_INT64_FORMAT "d.%0*" ISC_INT64_FORMAT "d", n / f, -scale, n % f);
|
||||
} else if (n < -f) {
|
||||
} else if (n <= -f) {
|
||||
Z_STRLEN_P(val) = sprintf (string_data,
|
||||
"%" ISC_INT64_FORMAT "d.%0*" ISC_INT64_FORMAT "d", n / f, -scale, -n % f);
|
||||
} else {
|
||||
@@ -2323,7 +2323,7 @@ PHP_FUNCTION(ibase_prepare)
|
||||
Execute a previously prepared query */
|
||||
PHP_FUNCTION(ibase_execute)
|
||||
{
|
||||
zval ***args, **bind_args = NULL;
|
||||
zval ***args, ***bind_args = NULL;
|
||||
ibase_query *ib_query;
|
||||
ibase_result *ib_result;
|
||||
|
||||
@@ -2342,7 +2342,7 @@ PHP_FUNCTION(ibase_execute)
|
||||
ZEND_FETCH_RESOURCE(ib_query, ibase_query *, args[0], -1, "InterBase query", le_query);
|
||||
|
||||
if (ZEND_NUM_ARGS() > 1) { /* have variables to bind */
|
||||
bind_args = args[1];
|
||||
bind_args = &args[1];
|
||||
}
|
||||
|
||||
/* Have we used this cursor before and it's still open? */
|
||||
|
||||
@@ -293,12 +293,10 @@ PHP_MINFO_FUNCTION(ldap)
|
||||
} else {
|
||||
snprintf(tmp, 31, "%ld/%ld", LDAPG(num_links), LDAPG(max_links));
|
||||
}
|
||||
tmp[31] = '\0';
|
||||
php_info_print_table_row(2, "Total Links", tmp);
|
||||
|
||||
#ifdef LDAP_API_VERSION
|
||||
snprintf(tmp, 31, "%d", LDAP_API_VERSION);
|
||||
tmp[31] = '\0';
|
||||
php_info_print_table_row(2, "API Version", tmp);
|
||||
#endif
|
||||
|
||||
@@ -308,27 +306,22 @@ PHP_MINFO_FUNCTION(ldap)
|
||||
|
||||
#ifdef LDAP_VENDOR_VERSION
|
||||
snprintf(tmp, 31, "%d", LDAP_VENDOR_VERSION);
|
||||
tmp[31] = '\0';
|
||||
php_info_print_table_row(2, "Vendor Version", tmp);
|
||||
#endif
|
||||
|
||||
#if HAVE_NSLDAP
|
||||
SDKVersion = ldap_version( &ver );
|
||||
snprintf(tmp, 31, "%f", SDKVersion/100.0 );
|
||||
tmp[31] = '\0';
|
||||
php_info_print_table_row(2, "SDK Version", tmp );
|
||||
|
||||
snprintf(tmp, 31, "%f", ver.protocol_version/100.0 );
|
||||
tmp[31] = '\0';
|
||||
php_info_print_table_row(2, "Highest LDAP Protocol Supported", tmp );
|
||||
|
||||
snprintf(tmp, 31, "%f", ver.SSL_version/100.0 );
|
||||
tmp[31] = '\0';
|
||||
php_info_print_table_row(2, "SSL Level Supported", tmp );
|
||||
|
||||
if ( ver.security_level != LDAP_SECURITY_NONE ) {
|
||||
snprintf(tmp, 31, "%d", ver.security_level );
|
||||
tmp[31] = '\0';
|
||||
} else {
|
||||
strcpy(tmp, "SSL not enabled" );
|
||||
}
|
||||
|
||||
@@ -34,10 +34,14 @@ AC_DEFUN([PHP_MBSTRING_EXTENSION], [
|
||||
PHP_ADD_BUILD_DIR([$ext_builddir/$dir])
|
||||
done
|
||||
|
||||
if test "$ext_shared" = "no" || ! test -e "$ext_builddir/config.h.in"; then
|
||||
if test "$ext_shared" = "no"; then
|
||||
out="php_config.h"
|
||||
else
|
||||
out="$abs_builddir/config.h"
|
||||
if test -f "$ext_builddir/config.h.in"; then
|
||||
out="$abs_builddir/config.h"
|
||||
else
|
||||
out="php_config.h"
|
||||
fi
|
||||
fi
|
||||
|
||||
for cfg in $PHP_MBSTRING_EXTRA_CONFIG_HEADERS; do
|
||||
|
||||
@@ -3273,6 +3273,7 @@ detect_end:
|
||||
stack[stack_level] = var;
|
||||
stack_level++;
|
||||
var = hash_entry;
|
||||
SEPARATE_ZVAL(hash_entry);
|
||||
target_hash = HASH_OF(*var);
|
||||
if (target_hash != NULL) {
|
||||
zend_hash_internal_pointer_reset(target_hash);
|
||||
|
||||
@@ -33,7 +33,7 @@ unset($c);
|
||||
$a = "あいうえお";
|
||||
$b = array(&$a);
|
||||
$c = $b;
|
||||
mb_convert_variables("euc-jp", "shift_jis", $c);
|
||||
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
|
||||
debug_zval_dump($b);
|
||||
debug_zval_dump($c);
|
||||
unset($a);
|
||||
@@ -43,7 +43,7 @@ unset($c);
|
||||
$a = "あいうえお";
|
||||
$b = array($a);
|
||||
$c = &$b;
|
||||
mb_convert_variables("euc-jp", "shift_jis", $c);
|
||||
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
|
||||
debug_zval_dump($b);
|
||||
debug_zval_dump($c);
|
||||
unset($a);
|
||||
@@ -53,7 +53,17 @@ unset($c);
|
||||
$a = "あいうえお";
|
||||
$b = array(&$a);
|
||||
$c = &$b;
|
||||
mb_convert_variables("euc-jp", "shift_jis", $c);
|
||||
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
|
||||
debug_zval_dump($b);
|
||||
debug_zval_dump($c);
|
||||
unset($a);
|
||||
unset($b);
|
||||
unset($c);
|
||||
|
||||
$a = array(array("�����"));
|
||||
$b = $a;
|
||||
$c = $b;
|
||||
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
|
||||
debug_zval_dump($b);
|
||||
debug_zval_dump($c);
|
||||
unset($a);
|
||||
@@ -97,4 +107,17 @@ array(1) refcount(1){
|
||||
[0]=>
|
||||
string(10) "、「、、、ヲ、ィ、ェ" refcount(2)
|
||||
}
|
||||
|
||||
array(1) refcount(3){
|
||||
[0]=>
|
||||
array(1) refcount(1){
|
||||
[0]=>
|
||||
string(10) "�����" refcount(1)
|
||||
}
|
||||
}
|
||||
array(1) refcount(2){
|
||||
[0]=>
|
||||
array(1) refcount(1){
|
||||
[0]=>
|
||||
string(10) "丐中丹尹云" refcount(1)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -459,7 +459,7 @@ PHP_FUNCTION(mcal_fetch_event)
|
||||
CALEVENT *myevent;
|
||||
int myargcount=ZEND_NUM_ARGS();
|
||||
|
||||
if (myargcount < 1 || myargcount > 3 || zend_get_parameters_ex(myargcount, &streamind, &eventid, &options) == FAILURE) {
|
||||
if (myargcount < 2 || myargcount > 3 || zend_get_parameters_ex(myargcount, &streamind, &eventid, &options) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_long_ex(streamind);
|
||||
|
||||
+47
-5
@@ -1,16 +1,19 @@
|
||||
dnl config.m4 for PHP4 MCVE Extension
|
||||
|
||||
PHP_ARG_WITH(mcve, for MCVE support,
|
||||
[ --with-mcve[=DIR] Include MCVE support. libmcve >= 3.2.2 required])
|
||||
[ --with-mcve[=DIR] Include MCVE support. libmcve >= 3.2.2 or libmonetra >= 4.0 required])
|
||||
|
||||
PHP_ARG_WITH(openssl-dir,OpenSSL dir for MCVE,
|
||||
[ --with-openssl-dir[=DIR] MCVE: openssl install prefix.], no, no)
|
||||
|
||||
if test "$PHP_MCVE" != "no"; then
|
||||
dnl properly set EGREP for AC_EGREP_CPP later on
|
||||
AC_CHECK_PROG(EGREP, egrep, grep -E)
|
||||
AC_SUBST(EGREP)
|
||||
|
||||
if test "$PHP_OPENSSL_DIR" != "no"; then
|
||||
PHP_OPENSSL=$PHP_OPENSSL_DIR
|
||||
PHP_SETUP_OPENSSL(SNMP_SHARED_LIBADD, [], [
|
||||
PHP_SETUP_OPENSSL(MCVE_SHARED_LIBADD, [], [
|
||||
AC_MSG_ERROR([MCVE: OpenSSL check failed. Please check config.log for more information.])
|
||||
])
|
||||
else
|
||||
@@ -48,21 +51,60 @@ yes
|
||||
],[
|
||||
AC_MSG_ERROR([libmcve 3.2.2 or greater required.])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for correct libmonetra 4.2 or higher])
|
||||
AC_EGREP_CPP(yes,[
|
||||
#include "$MCVE_DIR/include/mcve.h"
|
||||
#ifdef MCVE_SetSSL_CAfile
|
||||
yes
|
||||
#endif
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
],[
|
||||
AC_DEFINE([LIBMONETRA_BELOW_4_2], 1, [Whether or not we're using libmonetra 4.2 or higher ])
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
|
||||
CPPFLAGS=$saved_CPPFLAGS
|
||||
|
||||
PHP_ADD_INCLUDE($MCVE_DIR/include)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(mcve, $MCVE_DIR/lib, MCVE_SHARED_LIBADD)
|
||||
|
||||
dnl Build test
|
||||
dnl Build test. Check for libmcve or libmonetra
|
||||
dnl libmonetra_compat.h handle's MCVE_ -> M_ conversion
|
||||
dnl so it is API compatible
|
||||
|
||||
has_mcve=0
|
||||
dnl check for libmcve
|
||||
PHP_CHECK_LIBRARY(mcve, MCVE_DestroyEngine,
|
||||
[
|
||||
AC_DEFINE(HAVE_MCVE, 1, [ ])
|
||||
has_mcve=1
|
||||
], [
|
||||
AC_MSG_ERROR([MCVE: Sanity check failed. Please check config.log for more information.])
|
||||
has_mcve=0
|
||||
], [
|
||||
$MCVE_SHARED_LIBADD
|
||||
])
|
||||
|
||||
dnl check for libmonetra if no proper libmcve
|
||||
dnl symlink named libmcve is created to libmonetra
|
||||
dnl during libmonetra install, so this is valid
|
||||
if test "$has_mcve" = "0" ; then
|
||||
PHP_CHECK_LIBRARY(mcve, M_DestroyEngine,
|
||||
[
|
||||
has_mcve=1
|
||||
], [
|
||||
has_mcve=0
|
||||
], [
|
||||
$MCVE_SHARED_LIBADD
|
||||
])
|
||||
fi
|
||||
|
||||
if test "$has_mcve" = "1" ; then
|
||||
AC_DEFINE(HAVE_MCVE, 1, [ ])
|
||||
else
|
||||
AC_MSG_ERROR([MCVE: Sanity check failed. Please check config.log for more information.])
|
||||
fi
|
||||
|
||||
PHP_NEW_EXTENSION(mcve, mcve.c, $ext_shared)
|
||||
PHP_SUBST(MCVE_SHARED_LIBADD)
|
||||
fi
|
||||
+401
-184
File diff suppressed because it is too large.
Load diff
+86
-1
@@ -26,13 +26,96 @@ extern zend_module_entry mcve_module_entry;
|
||||
#define mcve_module_ptr &mcve_module_entry
|
||||
#define phpext_mcve_ptr mcve_module_ptr
|
||||
|
||||
#define PHP_MCVE_VERSION "3.2"
|
||||
#define PHP_MCVE_VERSION "4.0"
|
||||
|
||||
#define MCVE_CONST (CONST_CS | CONST_PERSISTENT)
|
||||
|
||||
#define M_map_function(newname, oldname) \
|
||||
PHP_FUNCTION(oldname) { \
|
||||
PHP_FN(newname)(INTERNAL_FUNCTION_PARAM_PASSTHRU); \
|
||||
}
|
||||
|
||||
PHP_MINIT_FUNCTION(mcve);
|
||||
PHP_MINFO_FUNCTION(mcve);
|
||||
|
||||
PHP_FUNCTION(m_initengine);
|
||||
PHP_FUNCTION(m_initconn);
|
||||
PHP_FUNCTION(m_deleteresponse);
|
||||
PHP_FUNCTION(m_destroyconn);
|
||||
PHP_FUNCTION(m_setdropfile);
|
||||
PHP_FUNCTION(m_setip);
|
||||
PHP_FUNCTION(m_setssl);
|
||||
PHP_FUNCTION(m_setssl_files);
|
||||
PHP_FUNCTION(m_setblocking);
|
||||
PHP_FUNCTION(m_settimeout);
|
||||
PHP_FUNCTION(m_verifyconnection);
|
||||
PHP_FUNCTION(m_verifysslcert);
|
||||
PHP_FUNCTION(m_maxconntimeout);
|
||||
PHP_FUNCTION(m_connectionerror);
|
||||
PHP_FUNCTION(m_deletetrans);
|
||||
PHP_FUNCTION(m_connect);
|
||||
PHP_FUNCTION(m_transnew);
|
||||
PHP_FUNCTION(m_transparam);
|
||||
PHP_FUNCTION(m_transsend);
|
||||
PHP_FUNCTION(m_ping);
|
||||
PHP_FUNCTION(m_responseparam);
|
||||
PHP_FUNCTION(m_returnstatus);
|
||||
PHP_FUNCTION(m_returncode);
|
||||
PHP_FUNCTION(m_transactionssent);
|
||||
PHP_FUNCTION(m_transactionitem);
|
||||
PHP_FUNCTION(m_transactionbatch);
|
||||
PHP_FUNCTION(m_transactionid);
|
||||
PHP_FUNCTION(m_transactionauth);
|
||||
PHP_FUNCTION(m_transactionavs);
|
||||
PHP_FUNCTION(m_transactioncv);
|
||||
PHP_FUNCTION(m_transactiontext);
|
||||
PHP_FUNCTION(m_getuserparam);
|
||||
PHP_FUNCTION(m_monitor);
|
||||
PHP_FUNCTION(m_transinqueue);
|
||||
PHP_FUNCTION(m_checkstatus);
|
||||
PHP_FUNCTION(m_completeauthorizations);
|
||||
PHP_FUNCTION(m_sale);
|
||||
PHP_FUNCTION(m_preauth);
|
||||
PHP_FUNCTION(m_override);
|
||||
PHP_FUNCTION(m_void);
|
||||
PHP_FUNCTION(m_preauthcompletion);
|
||||
PHP_FUNCTION(m_force);
|
||||
PHP_FUNCTION(m_return);
|
||||
PHP_FUNCTION(m_iscommadelimited);
|
||||
PHP_FUNCTION(m_parsecommadelimited);
|
||||
PHP_FUNCTION(m_getcommadelimited);
|
||||
PHP_FUNCTION(m_getcell);
|
||||
PHP_FUNCTION(m_getcellbynum);
|
||||
PHP_FUNCTION(m_numcolumns);
|
||||
PHP_FUNCTION(m_numrows);
|
||||
PHP_FUNCTION(m_getheader);
|
||||
PHP_FUNCTION(m_destroyengine);
|
||||
PHP_FUNCTION(m_settle);
|
||||
PHP_FUNCTION(m_qc);
|
||||
PHP_FUNCTION(m_gut);
|
||||
PHP_FUNCTION(m_gft);
|
||||
PHP_FUNCTION(m_ub);
|
||||
PHP_FUNCTION(m_gl);
|
||||
PHP_FUNCTION(m_chkpwd);
|
||||
PHP_FUNCTION(m_bt);
|
||||
PHP_FUNCTION(m_uwait);
|
||||
PHP_FUNCTION(m_text_code);
|
||||
PHP_FUNCTION(m_text_avs);
|
||||
PHP_FUNCTION(m_text_cv);
|
||||
PHP_FUNCTION(m_chngpwd);
|
||||
PHP_FUNCTION(m_listusers);
|
||||
PHP_FUNCTION(m_adduser);
|
||||
PHP_FUNCTION(m_enableuser);
|
||||
PHP_FUNCTION(m_disableuser);
|
||||
PHP_FUNCTION(m_getuserarg);
|
||||
PHP_FUNCTION(m_adduserarg);
|
||||
PHP_FUNCTION(m_deleteusersetup);
|
||||
PHP_FUNCTION(m_initusersetup);
|
||||
PHP_FUNCTION(m_deluser);
|
||||
PHP_FUNCTION(m_edituser);
|
||||
PHP_FUNCTION(m_liststats);
|
||||
|
||||
/* prototypes for compatability functions */
|
||||
PHP_FUNCTION(mcve_initengine);
|
||||
PHP_FUNCTION(mcve_initconn);
|
||||
PHP_FUNCTION(mcve_deleteresponse);
|
||||
@@ -109,6 +192,8 @@ PHP_FUNCTION(mcve_initusersetup);
|
||||
PHP_FUNCTION(mcve_deluser);
|
||||
PHP_FUNCTION(mcve_edituser);
|
||||
PHP_FUNCTION(mcve_liststats);
|
||||
|
||||
|
||||
#endif /* _PHP_MCVE_H */
|
||||
|
||||
/*
|
||||
|
||||
+13
-8
@@ -1444,17 +1444,22 @@ PHP_FUNCTION(swfmovie_output)
|
||||
#ifdef HAVE_MING_ZLIB
|
||||
zval **zlimit = NULL;
|
||||
int limit = -1;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
|
||||
if (zend_get_parameters_ex(1, &zlimit) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
if(argc==0) {
|
||||
limit = 6;
|
||||
} else {
|
||||
if (zend_get_parameters_ex(1, &zlimit) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_long_ex(zlimit);
|
||||
limit = Z_LVAL_PP(zlimit);
|
||||
convert_to_long_ex(zlimit);
|
||||
limit = Z_LVAL_PP(zlimit);
|
||||
|
||||
if ((limit < 0) || (limit > 9)) {
|
||||
php_error(E_WARNING,"compression level must be within 0..9");
|
||||
RETURN_FALSE;
|
||||
if ((limit < 0) || (limit > 9)) {
|
||||
php_error(E_WARNING,"compression level must be within 0..9");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ PHP_ARG_WITH(mnogosearch,for mnoGoSearch support,
|
||||
|
||||
AC_DEFINE(HAVE_MNOGOSEARCH,1,[ ])
|
||||
|
||||
PHP_SUBST(MNOGOSEARCH_SHARED_LIBADD)
|
||||
PHP_NEW_EXTENSION(mnogosearch, php_mnogo.c, $ext_shared)
|
||||
PHP_SUBST(MNOGOSEARCH_SHARED_LIBADD)
|
||||
|
||||
fi
|
||||
@@ -1266,7 +1266,7 @@ PS_OPEN_FUNC(msession)
|
||||
{
|
||||
int port;
|
||||
int len = strlen(save_path)+1;
|
||||
char * path = alloca(len);
|
||||
char * path = emalloc(len);
|
||||
char * szport;
|
||||
|
||||
strcpy(path, save_path);
|
||||
@@ -1285,7 +1285,13 @@ PS_OPEN_FUNC(msession)
|
||||
|
||||
ELOG( "ps_open_msession");
|
||||
PS_SET_MOD_DATA((void *)1); /* session.c needs a non-zero here! */
|
||||
return PHPMsessionConnect(path, port) ? SUCCESS : FAILURE;
|
||||
if (PHPMsessionConnect(path, port)) {
|
||||
efree(path);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
efree(path);
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
PS_CLOSE_FUNC(msession)
|
||||
|
||||
+2
-2
@@ -32,8 +32,8 @@ if test "$PHP_MSSQL" != "no"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if test ! -r "$FREETDS_INSTALLATION_DIR/lib/libtds.a"; then
|
||||
AC_MSG_ERROR(Could not find $FREETDS_INSTALLATION_DIR/lib/libtds.a)
|
||||
if test ! -r "$FREETDS_INSTALLATION_DIR/lib/libtds.a" && test ! -r "$FREETDS_INSTALLATION_DIR/lib/libtds.so"; then
|
||||
AC_MSG_ERROR(Could not find $FREETDS_INSTALLATION_DIR/lib/libtds.[a|so])
|
||||
fi
|
||||
|
||||
MSSQL_INCDIR=$FREETDS_INSTALLATION_DIR/include
|
||||
|
||||
+59
-23
@@ -270,14 +270,11 @@ static void php_mssql_init_globals(zend_mssql_globals *mssql_globals)
|
||||
long compatability_mode;
|
||||
|
||||
mssql_globals->num_persistent = 0;
|
||||
mssql_globals->get_column_content = php_mssql_get_column_content_with_type;
|
||||
if (cfg_get_long("mssql.compatability_mode", &compatability_mode) == SUCCESS) {
|
||||
if (compatability_mode) {
|
||||
mssql_globals->get_column_content = php_mssql_get_column_content_without_type;
|
||||
} else {
|
||||
mssql_globals->get_column_content = php_mssql_get_column_content_with_type;
|
||||
}
|
||||
} else {
|
||||
mssql_globals->get_column_content = php_mssql_get_column_content_with_type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +333,7 @@ PHP_RINIT_FUNCTION(mssql)
|
||||
dbsetlogintime(MS_SQL_G(connect_timeout));
|
||||
if (MS_SQL_G(timeout) < 0) MS_SQL_G(timeout) = 60;
|
||||
dbsettime(MS_SQL_G(timeout));
|
||||
dbsetmaxprocs((SHORT)MS_SQL_G(max_procs));
|
||||
dbsetmaxprocs((TDS_SHORT)MS_SQL_G(max_procs));
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -344,6 +341,7 @@ PHP_RINIT_FUNCTION(mssql)
|
||||
PHP_RSHUTDOWN_FUNCTION(mssql)
|
||||
{
|
||||
STR_FREE(MS_SQL_G(appname));
|
||||
MS_SQL_G(appname) = NULL;
|
||||
if (MS_SQL_G(server_message)) {
|
||||
STR_FREE(MS_SQL_G(server_message));
|
||||
MS_SQL_G(server_message) = NULL;
|
||||
@@ -516,6 +514,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
if (DBSETOPT(mssql.link, DBTEXTLIMIT, buffer)==FAIL) {
|
||||
efree(hashed_details);
|
||||
dbfreelogin(mssql.login);
|
||||
dbclose(mssql.link);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -535,6 +534,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
free(mssql_ptr);
|
||||
efree(hashed_details);
|
||||
dbfreelogin(mssql.login);
|
||||
dbclose(mssql.link);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
MS_SQL_G(num_persistent)++;
|
||||
@@ -545,22 +545,25 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
log_error("PHP/MS SQL: Hashed persistent link is not a MS SQL link!",php_rqst->server);
|
||||
#endif
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Hashed persistent link is not a MS SQL link!");
|
||||
efree(hashed_details);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
mssql_ptr = (mssql_link *) le->ptr;
|
||||
/* test that the link hasn't died */
|
||||
if (DBDEAD(mssql_ptr->link) == TRUE) {
|
||||
dbclose(mssql_ptr->link);
|
||||
#if BROKEN_MSSQL_PCONNECTS
|
||||
log_error("PHP/MS SQL: Persistent link died, trying to reconnect...",php_rqst->server);
|
||||
#endif
|
||||
if ((mssql_ptr->link=dbopen(mssql_ptr->login,host))==FAIL) {
|
||||
if ((mssql_ptr->link=dbopen(mssql_ptr->login,host))==NULL) {
|
||||
#if BROKEN_MSSQL_PCONNECTS
|
||||
log_error("PHP/MS SQL: Unable to reconnect!",php_rqst->server);
|
||||
#endif
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Link to server lost, unable to reconnect");
|
||||
zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
|
||||
efree(hashed_details);
|
||||
dbfreelogin(mssql_ptr->login);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#if BROKEN_MSSQL_PCONNECTS
|
||||
@@ -572,6 +575,8 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
#endif
|
||||
zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length + 1);
|
||||
efree(hashed_details);
|
||||
dbfreelogin(mssql_ptr->login);
|
||||
dbclose(mssql_ptr->link);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -590,6 +595,8 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
void *ptr;
|
||||
|
||||
if (Z_TYPE_P(index_ptr) != le_index_ptr) {
|
||||
efree(hashed_details);
|
||||
dbfreelogin(mssql.login);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
link = (int) index_ptr->ptr;
|
||||
@@ -599,6 +606,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
Z_LVAL_P(return_value) = link;
|
||||
php_mssql_set_default_link(link TSRMLS_CC);
|
||||
Z_TYPE_P(return_value) = IS_RESOURCE;
|
||||
dbfreelogin(mssql.login);
|
||||
efree(hashed_details);
|
||||
return;
|
||||
} else {
|
||||
@@ -608,12 +616,14 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
if (MS_SQL_G(max_links) != -1 && MS_SQL_G(num_links) >= MS_SQL_G(max_links)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%ld)", MS_SQL_G(num_links));
|
||||
efree(hashed_details);
|
||||
dbfreelogin(mssql.login);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if ((mssql.link=dbopen(mssql.login, host))==NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect to server: %s", host);
|
||||
efree(hashed_details);
|
||||
dbfreelogin(mssql.login);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -629,6 +639,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
if (DBSETOPT(mssql.link, DBTEXTLIMIT, buffer)==FAIL) {
|
||||
efree(hashed_details);
|
||||
dbfreelogin(mssql.login);
|
||||
dbclose(mssql.link);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -796,13 +807,19 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off
|
||||
Z_TYPE_P(result) = IS_STRING;
|
||||
break;
|
||||
}
|
||||
case SQLMONEY4:
|
||||
case SQLFLT4:
|
||||
Z_DVAL_P(result) = (double) floatcol4(offset);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
break;
|
||||
case SQLMONEY:
|
||||
case SQLMONEYN:
|
||||
case SQLMONEY4:
|
||||
case SQLMONEYN: {
|
||||
DBFLT8 res_buf;
|
||||
dbconvert(NULL, column_type, dbdata(mssql_ptr->link,offset), 8, SQLFLT8, (LPBYTE)&res_buf, -1);
|
||||
Z_DVAL_P(result) = res_buf;
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
}
|
||||
break;
|
||||
case SQLFLT8:
|
||||
Z_DVAL_P(result) = (double) floatcol8(offset);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
@@ -841,11 +858,25 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off
|
||||
|
||||
if ((column_type != SQLDATETIME && column_type != SQLDATETIM4) || MS_SQL_G(datetimeconvert)) {
|
||||
|
||||
if (column_type == SQLDATETIM4) res_length += 14;
|
||||
if (column_type == SQLDATETIME) res_length += 10;
|
||||
switch (column_type) {
|
||||
case SQLDATETIM4 :
|
||||
res_length += 14;
|
||||
break;
|
||||
case SQLDATETIME :
|
||||
res_length += 10;
|
||||
break;
|
||||
case SQLMONEY :
|
||||
case SQLMONEY4 :
|
||||
case SQLMONEYN :
|
||||
case SQLDECIMAL :
|
||||
case SQLNUMERIC :
|
||||
res_length += 5;
|
||||
break;
|
||||
}
|
||||
|
||||
res_buf = (unsigned char *) emalloc(res_length+1);
|
||||
res_length = dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR,res_buf,-1);
|
||||
res_buf[res_length] = '\0';
|
||||
} else {
|
||||
if (column_type == SQLDATETIM4) {
|
||||
DBDATETIME temp;
|
||||
@@ -911,13 +942,15 @@ static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int
|
||||
case SQLMONEY :
|
||||
case SQLMONEY4 :
|
||||
case SQLMONEYN :
|
||||
case SQLDECIMAL :
|
||||
case SQLNUMERIC :
|
||||
res_length += 5;
|
||||
break;
|
||||
}
|
||||
|
||||
res_buf = (unsigned char *) emalloc(res_length+1);
|
||||
res_length = dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR, res_buf, -1);
|
||||
|
||||
res_buf[res_length] = '\0';
|
||||
} else {
|
||||
if (column_type == SQLDATETIM4) {
|
||||
DBDATETIME temp;
|
||||
@@ -964,6 +997,7 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme
|
||||
case SQLINT2:
|
||||
case SQLINT4:
|
||||
convert_to_long_ex(&bind->zval);
|
||||
/* FIXME this works only on little endian machine !!! */
|
||||
Z_LVAL_P(bind->zval) = *((int *)(dbretdata(mssql_ptr->link,i)));
|
||||
break;
|
||||
|
||||
@@ -984,6 +1018,7 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme
|
||||
Z_STRLEN_P(bind->zval) = dbretlen(mssql_ptr->link,i);
|
||||
Z_STRVAL_P(bind->zval) = estrndup(dbretdata(mssql_ptr->link,i),Z_STRLEN_P(bind->zval));
|
||||
break;
|
||||
/* TODO binary */
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1084,7 +1119,7 @@ static int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int r
|
||||
result->lastresult = retvalue;
|
||||
}
|
||||
efree(column_types);
|
||||
if (result->statement) {
|
||||
if (result->statement && (retvalue == NO_MORE_RESULTS || retvalue == NO_MORE_RPC_RESULTS)) {
|
||||
_mssql_get_sp_result(mssql_ptr, result->statement TSRMLS_CC);
|
||||
}
|
||||
return i;
|
||||
@@ -1171,6 +1206,9 @@ PHP_FUNCTION(mssql_query)
|
||||
while ((num_fields = dbnumcols(mssql_ptr->link)) <= 0 && retvalue == SUCCEED) {
|
||||
retvalue = dbresults(mssql_ptr->link);
|
||||
}
|
||||
if (retvalue != SUCCEED) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if ((num_fields = dbnumcols(mssql_ptr->link)) <= 0) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
@@ -1191,12 +1229,8 @@ PHP_FUNCTION(mssql_query)
|
||||
result->mssql_ptr = mssql_ptr;
|
||||
result->cur_field=result->cur_row=result->num_rows=0;
|
||||
|
||||
if (num_fields > 0) {
|
||||
result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*result->num_fields);
|
||||
result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC);
|
||||
}
|
||||
else
|
||||
result->fields = NULL;
|
||||
result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*result->num_fields);
|
||||
result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC);
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, result, le_result);
|
||||
}
|
||||
@@ -1789,7 +1823,7 @@ PHP_FUNCTION(mssql_result)
|
||||
}
|
||||
|
||||
*return_value = result->data[Z_LVAL_PP(row)][field_offset];
|
||||
ZVAL_COPY_CTOR(return_value);
|
||||
zval_copy_ctor(return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1814,6 +1848,9 @@ PHP_FUNCTION(mssql_next_result)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
else if (retvalue == NO_MORE_RESULTS || retvalue == NO_MORE_RPC_RESULTS) {
|
||||
if (result->statement) {
|
||||
_mssql_get_sp_result(mssql_ptr, result->statement TSRMLS_CC);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
else {
|
||||
@@ -2124,8 +2161,6 @@ PHP_FUNCTION(mssql_execute)
|
||||
dbcanquery(mssql_ptr->link);
|
||||
retval_results = dbresults(mssql_ptr->link);
|
||||
} while (retval_results == SUCCEED);
|
||||
|
||||
_mssql_get_sp_result(mssql_ptr, statement TSRMLS_CC);
|
||||
}
|
||||
else {
|
||||
/* Skip results not returning any columns */
|
||||
@@ -2148,7 +2183,7 @@ PHP_FUNCTION(mssql_execute)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (retval_results == NO_MORE_RESULTS || retval_results == NO_MORE_RPC_RESULTS) {
|
||||
if (retval_results == NO_MORE_RESULTS || retval_results == NO_MORE_RPC_RESULTS) {
|
||||
_mssql_get_sp_result(mssql_ptr, statement TSRMLS_CC);
|
||||
}
|
||||
|
||||
@@ -2219,7 +2254,7 @@ PHP_FUNCTION(mssql_guid_string)
|
||||
break;
|
||||
}
|
||||
|
||||
dbconvert(NULL, SQLBINARY, (BYTE*)Z_STRVAL_PP(binary), 16, SQLCHAR, buffer, -1);
|
||||
dbconvert(NULL, SQLBINARY, (BYTE*)Z_STRVAL_PP(binary), MIN(16, Z_STRLEN_PP(binary)), SQLCHAR, buffer, -1);
|
||||
|
||||
if (sf) {
|
||||
php_strtoupper(buffer, 32);
|
||||
@@ -2227,6 +2262,7 @@ PHP_FUNCTION(mssql_guid_string)
|
||||
}
|
||||
else {
|
||||
int i;
|
||||
/* FIXME this works only on little endian machine */
|
||||
for (i=0; i<4; i++) {
|
||||
buffer2[2*i] = buffer[6-2*i];
|
||||
buffer2[2*i+1] = buffer[7-2*i];
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "sqlfront.h"
|
||||
#include "sqldb.h"
|
||||
|
||||
typedef short TDS_SHORT;
|
||||
#if HAVE_FREETDS
|
||||
#define SQLTEXT SYBTEXT
|
||||
#define SQLCHAR SYBCHAR
|
||||
|
||||
@@ -259,6 +259,9 @@ static void _free_mysql_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
*/
|
||||
static void php_mysql_set_default_link(int id TSRMLS_DC)
|
||||
{
|
||||
if (MySG(default_link) != -1) {
|
||||
zend_list_delete(MySG(default_link));
|
||||
}
|
||||
MySG(default_link) = id;
|
||||
zend_list_addref(id);
|
||||
}
|
||||
@@ -425,7 +428,6 @@ PHP_RINIT_FUNCTION(mysql)
|
||||
/* Reset connect error/errno on every request */
|
||||
MySG(connect_error) = NULL;
|
||||
MySG(connect_errno) =0;
|
||||
MySG(trace_mode) = 0;
|
||||
MySG(result_allocated) = 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -591,7 +593,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
break;
|
||||
}
|
||||
/* disable local infile option for open_basedir */
|
||||
if (PG(open_basedir) && strlen(PG(open_basedir))) {
|
||||
if (PG(open_basedir) && strlen(PG(open_basedir)) && (client_flags & CLIENT_LOCAL_FILES)) {
|
||||
client_flags ^= CLIENT_LOCAL_FILES;
|
||||
}
|
||||
|
||||
|
||||
@@ -1421,7 +1421,7 @@ PHP_FUNCTION(ncurses_mvdelch)
|
||||
{
|
||||
long y,x;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls",&y,&x)==FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll",&y,&x)==FAILURE) {
|
||||
return;
|
||||
}
|
||||
IS_NCURSES_INITIALIZED();
|
||||
@@ -1436,7 +1436,7 @@ PHP_FUNCTION(ncurses_mvgetch)
|
||||
{
|
||||
long y,x;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls",&y,&x)==FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll",&y,&x)==FAILURE) {
|
||||
return;
|
||||
}
|
||||
IS_NCURSES_INITIALIZED();
|
||||
@@ -1450,7 +1450,7 @@ PHP_FUNCTION(ncurses_mvinch)
|
||||
{
|
||||
long y,x;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls",&y,&x)==FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll",&y,&x)==FAILURE) {
|
||||
return;
|
||||
}
|
||||
IS_NCURSES_INITIALIZED();
|
||||
|
||||
@@ -1912,14 +1912,14 @@ PHP_FUNCTION(notes_search)
|
||||
pNoteID = (NOTEID *) (((char *) pSearchResults)
|
||||
+ sizeof(FT_SEARCH_RESULTS));
|
||||
|
||||
//pSearchResults->NumHits
|
||||
/* pSearchResults->NumHits */
|
||||
array_init(return_value);
|
||||
|
||||
pScores = (BYTE *) (pNoteID + pSearchResults->NumHits);
|
||||
for (i = 0; i < pSearchResults->NumHits; i++, pNoteID++, pScores++){
|
||||
|
||||
add_next_index_long(return_value, (long) *pNoteID );
|
||||
//RETVAL_LONG( (long) *pNoteID );
|
||||
/* RETVAL_LONG( (long) *pNoteID ); */
|
||||
}
|
||||
|
||||
OSUnlockObject (SearchResults_handle);
|
||||
|
||||
+10
-3
@@ -2467,9 +2467,16 @@ _oci_close_session(oci_session *session)
|
||||
(ub4) OCI_HTYPE_SESSION));
|
||||
}
|
||||
|
||||
#ifdef HAVE_OCI_9_2
|
||||
/* free environment handle (and fix bug #29652 with growing .msb FD number under weirdie Solarises) */
|
||||
CALL_OCI(OCIHandleFree(
|
||||
(dvoid *) session->pEnv,
|
||||
OCI_HTYPE_ENV));
|
||||
#endif
|
||||
|
||||
hashed_details = session->hashed_details;
|
||||
|
||||
if (! OCI(shutdown)) {
|
||||
if (! OCI(shutdown) && !session->exclusive) {
|
||||
zend_hash_del(OCI(user), hashed_details, strlen(hashed_details)+1);
|
||||
}
|
||||
|
||||
@@ -2591,7 +2598,7 @@ static int _oci_session_cleanup(void *data TSRMLS_DC)
|
||||
list_entry *le = (list_entry *) data;
|
||||
if (Z_TYPE_P(le) == le_session) {
|
||||
oci_server *server = ((oci_session*) le->ptr)->server;
|
||||
if (server->is_open == 2)
|
||||
if (server && server->is_open == 2)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -2982,7 +2989,7 @@ break;
|
||||
}
|
||||
|
||||
memset((void*)&bind,0,sizeof(oci_bind));
|
||||
zend_hash_next_index_insert(statement->binds,&bind,sizeof(oci_bind),(void **)&bindp);
|
||||
zend_hash_update(statement->binds, Z_STRVAL_PP(name), Z_STRLEN_PP(name) + 1, &bind, sizeof(oci_bind), (void **)&bindp);
|
||||
|
||||
bindp->descr = mydescr;
|
||||
bindp->pStmt = mystmt;
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "oci8"=.\oci8.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
+6
-2
@@ -1008,11 +1008,15 @@ PHP_FUNCTION(odbc_execute)
|
||||
|
||||
/* Check for safe mode. */
|
||||
if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
efree(filename);
|
||||
efree(params);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* Check the basedir */
|
||||
if (php_check_open_basedir(filename TSRMLS_CC)) {
|
||||
efree(filename);
|
||||
efree(params);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ zend_module_entry openssl_module_entry = {
|
||||
"openssl",
|
||||
openssl_functions,
|
||||
PHP_MINIT(openssl),
|
||||
NULL,
|
||||
PHP_MSHUTDOWN(openssl),
|
||||
NULL,
|
||||
NULL,
|
||||
PHP_MINFO(openssl),
|
||||
@@ -1611,11 +1611,18 @@ PHP_FUNCTION(openssl_csr_new)
|
||||
if (we_made_the_key) {
|
||||
/* and a resource for the private key */
|
||||
ZVAL_RESOURCE(out_pkey, zend_list_insert(req.priv_key, le_key));
|
||||
req.priv_key = NULL; /* make sure the cleanup code doesn't zap it! */
|
||||
}
|
||||
else if (key_resource != -1)
|
||||
req.priv_key = NULL; /* make sure the cleanup code doesn't zap it! */
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!we_made_the_key) {
|
||||
/* if we have not made the key we are not supposed to zap it by calling dispose! */
|
||||
req.priv_key = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -386,7 +386,7 @@ PHP_FUNCTION(pcntl_exec)
|
||||
args_hash = HASH_OF(args);
|
||||
argc = zend_hash_num_elements(args_hash);
|
||||
|
||||
argv = alloca((argc+2) * sizeof(char *));
|
||||
argv = safe_emalloc((argc + 2), sizeof(char *), 0);
|
||||
*argv = path;
|
||||
for ( zend_hash_internal_pointer_reset(args_hash), current_arg = argv+1;
|
||||
(argi < argc && (zend_hash_get_current_data(args_hash, (void **) &element) == SUCCESS));
|
||||
@@ -397,7 +397,7 @@ PHP_FUNCTION(pcntl_exec)
|
||||
}
|
||||
*(current_arg) = NULL;
|
||||
} else {
|
||||
argv = alloca(2 * sizeof(char *));
|
||||
argv = emalloc(2 * sizeof(char *));
|
||||
*argv = path;
|
||||
*(argv+1) = NULL;
|
||||
}
|
||||
@@ -407,13 +407,13 @@ PHP_FUNCTION(pcntl_exec)
|
||||
envs_hash = HASH_OF(envs);
|
||||
envc = zend_hash_num_elements(envs_hash);
|
||||
|
||||
envp = alloca((envc+1) * sizeof(char *));
|
||||
envp = safe_emalloc((envc + 1), sizeof(char *), 0);
|
||||
for ( zend_hash_internal_pointer_reset(envs_hash), pair = envp;
|
||||
(envi < envc && (zend_hash_get_current_data(envs_hash, (void **) &element) == SUCCESS));
|
||||
(envi++, pair++, zend_hash_move_forward(envs_hash)) ) {
|
||||
switch (return_val = zend_hash_get_current_key_ex(envs_hash, &key, &key_length, &key_num, 0, NULL)) {
|
||||
case HASH_KEY_IS_LONG:
|
||||
key = alloca(101);
|
||||
key = emalloc(101);
|
||||
snprintf(key, 100, "%ld", key_num);
|
||||
key_length = strlen(key);
|
||||
break;
|
||||
@@ -432,7 +432,7 @@ PHP_FUNCTION(pcntl_exec)
|
||||
strlcat(*pair, Z_STRVAL_PP(element), pair_length);
|
||||
|
||||
/* Cleanup */
|
||||
if (return_val == HASH_KEY_IS_LONG) free_alloca(key);
|
||||
if (return_val == HASH_KEY_IS_LONG) efree(key);
|
||||
}
|
||||
*(pair) = NULL;
|
||||
}
|
||||
@@ -445,10 +445,10 @@ PHP_FUNCTION(pcntl_exec)
|
||||
/* Cleanup */
|
||||
if (envp != NULL) {
|
||||
for (pair = envp; *pair != NULL; pair++) efree(*pair);
|
||||
free_alloca(envp);
|
||||
efree(envp);
|
||||
}
|
||||
|
||||
free_alloca(argv);
|
||||
efree(argv);
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
+73
-31
@@ -47,20 +47,6 @@
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(pcre)
|
||||
|
||||
|
||||
static void *php_pcre_malloc(size_t size)
|
||||
{
|
||||
return pemalloc(size, 1);
|
||||
}
|
||||
|
||||
|
||||
static void php_pcre_free(void *ptr)
|
||||
{
|
||||
if (ptr)
|
||||
pefree(ptr, 1);
|
||||
}
|
||||
|
||||
|
||||
static void php_free_pcre_cache(void *data)
|
||||
{
|
||||
pcre_cache_entry *pce = (pcre_cache_entry *) data;
|
||||
@@ -107,14 +93,6 @@ static PHP_MINIT_FUNCTION(pcre)
|
||||
REGISTER_LONG_CONSTANT("PREG_SPLIT_OFFSET_CAPTURE", PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PREG_GREP_INVERT", PREG_GREP_INVERT, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
pcre_malloc = php_pcre_malloc;
|
||||
pcre_free = php_pcre_free;
|
||||
|
||||
#ifdef NO_RECURSE
|
||||
pcre_stack_malloc = php_pcre_malloc;
|
||||
pcre_stack_free = php_pcre_free;
|
||||
#endif
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -130,6 +108,22 @@ static PHP_MSHUTDOWN_FUNCTION(pcre)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#define PCRE_CACHE_SIZE 4096
|
||||
|
||||
/* {{{ static pcre_clean_cache */
|
||||
static int pcre_clean_cache(void *data, void *arg TSRMLS_DC)
|
||||
{
|
||||
int *num_clean = (int *)arg;
|
||||
|
||||
if (*num_clean > 0) {
|
||||
(*num_clean)--;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ pcre_get_compiled_regex
|
||||
*/
|
||||
PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_options) {
|
||||
@@ -301,6 +295,16 @@ PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_
|
||||
|
||||
efree(pattern);
|
||||
|
||||
/*
|
||||
* If we reached cache limit, clean out the items from the head of the list;
|
||||
* these are supposedly the oldest ones (but not necessarily the least used
|
||||
* ones).
|
||||
*/
|
||||
if (zend_hash_num_elements(&PCRE_G(pcre_cache)) == PCRE_CACHE_SIZE) {
|
||||
int num_clean = PCRE_CACHE_SIZE / 8;
|
||||
zend_hash_apply_with_argument(&PCRE_G(pcre_cache), pcre_clean_cache, &num_clean TSRMLS_CC);
|
||||
}
|
||||
|
||||
/* Store the compiled pattern and extra info in the cache. */
|
||||
new_entry.re = re;
|
||||
new_entry.extra = *extra;
|
||||
@@ -369,7 +373,7 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
|
||||
const char **stringlist; /* Holds list of subpatterns */
|
||||
char *match; /* The current match */
|
||||
char **subpat_names = NULL;/* Array for named subpatterns */
|
||||
int i;
|
||||
int i, rc;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ((global) ? "ssz|ll" : "ss|zll"), ®ex, ®ex_len,
|
||||
&subject, &subject_len, &subpats, &flags, &start_offset) == FAILURE) {
|
||||
@@ -415,7 +419,12 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
|
||||
}
|
||||
|
||||
/* Calculate the size of the offsets array, and allocate memory for it. */
|
||||
pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &num_subpats);
|
||||
rc = pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &num_subpats);
|
||||
if (rc < 0) {
|
||||
php_error(E_WARNING, "%s: internal pcre_fullinfo() error %d",
|
||||
get_active_function_name(TSRMLS_C), rc);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
num_subpats++;
|
||||
size_offsets = num_subpats * 3;
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
@@ -432,10 +441,22 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
|
||||
char *name_table;
|
||||
unsigned short name_idx;
|
||||
|
||||
pcre_fullinfo(re, extra, PCRE_INFO_NAMECOUNT, &name_cnt);
|
||||
rc = pcre_fullinfo(re, extra, PCRE_INFO_NAMECOUNT, &name_cnt);
|
||||
if (rc < 0) {
|
||||
php_error(E_WARNING, "%s: internal pcre_fullinfo() error %d",
|
||||
get_active_function_name(TSRMLS_C), rc);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (name_cnt > 0) {
|
||||
pcre_fullinfo(re, extra, PCRE_INFO_NAMETABLE, &name_table);
|
||||
pcre_fullinfo(re, extra, PCRE_INFO_NAMEENTRYSIZE, &name_size);
|
||||
int rc1, rc2;
|
||||
rc1 = pcre_fullinfo(re, extra, PCRE_INFO_NAMETABLE, &name_table);
|
||||
rc2 = pcre_fullinfo(re, extra, PCRE_INFO_NAMEENTRYSIZE, &name_size);
|
||||
rc = rc2 ? rc2 : rc1;
|
||||
if (rc < 0) {
|
||||
php_error(E_WARNING, "%s: internal pcre_fullinfo() error %d",
|
||||
get_active_function_name(TSRMLS_C), rc);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
while (ni++ < name_cnt) {
|
||||
name_idx = 0xff * name_table[0] + name_table[1];
|
||||
@@ -548,7 +569,7 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
|
||||
}
|
||||
}
|
||||
|
||||
php_pcre_free((void *) stringlist);
|
||||
pcre_free((void *) stringlist);
|
||||
}
|
||||
}
|
||||
else { /* Failed to match */
|
||||
@@ -804,6 +825,7 @@ PHPAPI char *php_pcre_replace(char *regex, int regex_len,
|
||||
*replace_end=NULL, /* End of replacement string */
|
||||
*eval_result, /* Result of eval or custom function */
|
||||
walk_last; /* Last walked character */
|
||||
int rc;
|
||||
|
||||
/* Compile regex or get it from cache. */
|
||||
if ((re = pcre_get_compiled_regex(regex, &extra, &preg_options)) == NULL) {
|
||||
@@ -823,7 +845,13 @@ PHPAPI char *php_pcre_replace(char *regex, int regex_len,
|
||||
}
|
||||
|
||||
/* Calculate the size of the offsets array, and allocate memory for it. */
|
||||
size_offsets = (pcre_info(re, NULL, NULL) + 1) * 3;
|
||||
rc = pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &size_offsets);
|
||||
if (rc < 0) {
|
||||
php_error(E_WARNING, "%s: internal pcre_fullinfo() error %d",
|
||||
get_active_function_name(TSRMLS_C), rc);
|
||||
return NULL;
|
||||
}
|
||||
size_offsets = (size_offsets + 1) * 3;
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
|
||||
alloc_len = 2 * subject_len + 1;
|
||||
@@ -1187,6 +1215,7 @@ PHP_FUNCTION(preg_split)
|
||||
int g_notempty = 0; /* If the match should not be empty */
|
||||
char *match, /* The current match */
|
||||
*last_match; /* Location of last match */
|
||||
int rc;
|
||||
|
||||
/* Get function parameters and do error checking */
|
||||
argc = ZEND_NUM_ARGS();
|
||||
@@ -1221,7 +1250,13 @@ PHP_FUNCTION(preg_split)
|
||||
array_init(return_value);
|
||||
|
||||
/* Calculate the size of the offsets array, and allocate memory for it. */
|
||||
size_offsets = (pcre_info(re, NULL, NULL) + 1) * 3;
|
||||
rc = pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &size_offsets);
|
||||
if (rc < 0) {
|
||||
php_error(E_WARNING, "%s: internal pcre_fullinfo() error %d",
|
||||
get_active_function_name(TSRMLS_C), rc);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
size_offsets = (size_offsets + 1) * 3;
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
|
||||
/* Start at the beginning of the string */
|
||||
@@ -1428,6 +1463,7 @@ PHP_FUNCTION(preg_grep)
|
||||
ulong num_key;
|
||||
zend_bool invert = 0; /* Whether to return non-matching
|
||||
entries */
|
||||
int rc;
|
||||
|
||||
/* Get arguments and do error checking */
|
||||
|
||||
@@ -1457,7 +1493,13 @@ PHP_FUNCTION(preg_grep)
|
||||
}
|
||||
|
||||
/* Calculate the size of the offsets array, and allocate memory for it. */
|
||||
size_offsets = (pcre_info(re, NULL, NULL) + 1) * 3;
|
||||
rc = pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &size_offsets);
|
||||
if (rc < 0) {
|
||||
php_error(E_WARNING, "%s: internal pcre_fullinfo() error %d",
|
||||
get_active_function_name(TSRMLS_C), rc);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
size_offsets = (size_offsets + 1) * 3;
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
|
||||
/* Initialize return array */
|
||||
|
||||
+4
-4
@@ -328,14 +328,14 @@ PHP_FUNCTION(pfpro_process)
|
||||
args = (zval ***) emalloc(sizeof(zval **) * ZEND_NUM_ARGS());
|
||||
|
||||
if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
|
||||
efree(args);
|
||||
php_error(E_ERROR, "Unable to read parameters in pfpro_process()");
|
||||
efree(args);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (Z_TYPE_PP(args[0]) != IS_ARRAY) {
|
||||
efree(args);
|
||||
php_error(E_ERROR, "First parameter to pfpro_process() must be an array");
|
||||
efree(args);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -418,11 +418,11 @@ PHP_FUNCTION(pfpro_process)
|
||||
break;
|
||||
|
||||
default:
|
||||
php_error(E_ERROR, "pfpro_process() array keys must be strings or integers");
|
||||
if (parmlist) {
|
||||
efree(parmlist);
|
||||
}
|
||||
efree(args);
|
||||
php_error(E_ERROR, "pfpro_process() array keys must be strings or integers");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -464,11 +464,11 @@ PHP_FUNCTION(pfpro_process)
|
||||
break;
|
||||
|
||||
default:
|
||||
php_error(E_ERROR, "pfpro_process() array values must be strings, ints or floats");
|
||||
if (parmlist) {
|
||||
efree(parmlist);
|
||||
}
|
||||
efree(args);
|
||||
php_error(E_ERROR, "pfpro_process() array values must be strings, ints or floats");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
zend_hash_move_forward(target_hash);
|
||||
|
||||
+5
-5
@@ -222,7 +222,7 @@ static char * _php_pgsql_trim_message(const char *message, int *len)
|
||||
if (i>1 && (message[i-1] == '\r' || message[i-1] == '\n') && message[i] == '.') {
|
||||
--i;
|
||||
}
|
||||
while (i && (message[i] == '\r' || message[i] == '\n')) {
|
||||
while (i>0 && (message[i] == '\r' || message[i] == '\n')) {
|
||||
--i;
|
||||
}
|
||||
++i;
|
||||
@@ -2515,8 +2515,8 @@ PHP_FUNCTION(pg_copy_to)
|
||||
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
|
||||
|
||||
query = (char *)emalloc(strlen(query_template) + strlen(table_name) + strlen(pg_null_as) + 1);
|
||||
sprintf(query, "COPY \"%s\" TO STDOUT DELIMITERS '%s' WITH NULL AS '%s'",
|
||||
table_name, pg_delim, pg_null_as);
|
||||
sprintf(query, "COPY \"%s\" TO STDOUT DELIMITERS '%c' WITH NULL AS '%s'",
|
||||
table_name, *pg_delim, pg_null_as);
|
||||
|
||||
while ((pgsql_result = PQgetResult(pgsql))) {
|
||||
PQclear(pgsql_result);
|
||||
@@ -2625,8 +2625,8 @@ PHP_FUNCTION(pg_copy_from)
|
||||
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
|
||||
|
||||
query = (char *)emalloc(strlen(query_template) + strlen(table_name) + strlen(pg_null_as) + 1);
|
||||
sprintf(query, "COPY \"%s\" FROM STDIN DELIMITERS '%s' WITH NULL AS '%s'",
|
||||
table_name, pg_delim, pg_null_as);
|
||||
sprintf(query, "COPY \"%s\" FROM STDIN DELIMITERS '%c' WITH NULL AS '%s'",
|
||||
table_name, *pg_delim, pg_null_as);
|
||||
while ((pgsql_result = PQgetResult(pgsql))) {
|
||||
PQclear(pgsql_result);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "php_session.h"
|
||||
#include "mod_files.h"
|
||||
#include "ext/standard/flock_compat.h"
|
||||
#include "php_open_temporary_file.h"
|
||||
|
||||
#define FILE_PREFIX "sess_"
|
||||
|
||||
@@ -234,6 +235,10 @@ PS_OPEN_FUNC(files)
|
||||
data = ecalloc(sizeof(*data), 1);
|
||||
PS_SET_MOD_DATA(data);
|
||||
|
||||
if (*save_path == '\0') {
|
||||
save_path = php_get_temporary_directory();
|
||||
}
|
||||
|
||||
data->fd = -1;
|
||||
if ((p = strchr(save_path, ';'))) {
|
||||
errno = 0;
|
||||
|
||||
@@ -264,7 +264,7 @@ PHP_MINIT_FUNCTION(ps_mm)
|
||||
return FAILURE;
|
||||
|
||||
/* Directory + '/' + File + Module Name + Effective UID + \0 */
|
||||
ps_mm_path = do_alloca(save_path_len+1+sizeof(PS_MM_FILE)+mod_name_len+strlen(euid)+1);
|
||||
ps_mm_path = emalloc(save_path_len+1+sizeof(PS_MM_FILE)+mod_name_len+strlen(euid)+1);
|
||||
|
||||
memcpy(ps_mm_path, PS(save_path), save_path_len + 1);
|
||||
if (save_path_len > 0 && ps_mm_path[save_path_len - 1] != DEFAULT_SLASH) {
|
||||
@@ -277,7 +277,7 @@ PHP_MINIT_FUNCTION(ps_mm)
|
||||
|
||||
ret = ps_mm_initialize(ps_mm_instance, ps_mm_path);
|
||||
|
||||
free_alloca(ps_mm_path);
|
||||
efree(ps_mm_path);
|
||||
|
||||
if (ret != SUCCESS) {
|
||||
free(ps_mm_instance);
|
||||
|
||||
+73
-26
@@ -120,7 +120,11 @@ static PHP_INI_MH(OnUpdateSerializer)
|
||||
PHP_INI_BEGIN()
|
||||
STD_PHP_INI_BOOLEAN("session.bug_compat_42", "1", PHP_INI_ALL, OnUpdateBool, bug_compat, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_BOOLEAN("session.bug_compat_warn", "1", PHP_INI_ALL, OnUpdateBool, bug_compat_warn, php_ps_globals, ps_globals)
|
||||
#ifdef PHP_WIN32
|
||||
STD_PHP_INI_ENTRY("session.save_path", "", PHP_INI_ALL, OnUpdateString, save_path, php_ps_globals, ps_globals)
|
||||
#else
|
||||
STD_PHP_INI_ENTRY("session.save_path", "/tmp", PHP_INI_ALL, OnUpdateString, save_path, php_ps_globals, ps_globals)
|
||||
#endif
|
||||
STD_PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, OnUpdateString, session_name, php_ps_globals, ps_globals)
|
||||
PHP_INI_ENTRY("session.save_handler", "files", PHP_INI_ALL, OnUpdateSaveHandler)
|
||||
STD_PHP_INI_BOOLEAN("session.auto_start", "0", PHP_INI_ALL, OnUpdateBool, auto_start, php_ps_globals, ps_globals)
|
||||
@@ -405,7 +409,7 @@ PS_SERIALIZER_DECODE_FUNC(php_binary)
|
||||
|
||||
if (has_value) {
|
||||
MAKE_STD_ZVAL(current);
|
||||
if (php_var_unserialize(¤t, &p, endptr, &var_hash TSRMLS_CC)) {
|
||||
if (php_var_unserialize(¤t, (const unsigned char **)&p, endptr, &var_hash TSRMLS_CC)) {
|
||||
php_set_session_var(name, namelen, current, &var_hash TSRMLS_CC);
|
||||
}
|
||||
zval_ptr_dtor(¤t);
|
||||
@@ -432,6 +436,11 @@ PS_SERIALIZER_ENCODE_FUNC(php)
|
||||
|
||||
PS_ENCODE_LOOP(
|
||||
smart_str_appendl(&buf, key, (unsigned char) key_length);
|
||||
if (memchr(key, PS_DELIMITER, key_length)) {
|
||||
PHP_VAR_SERIALIZE_DESTROY(var_hash);
|
||||
smart_str_free(&buf);
|
||||
return FAILURE;
|
||||
}
|
||||
smart_str_appendc(&buf, PS_DELIMITER);
|
||||
|
||||
php_var_serialize(&buf, struc, &var_hash TSRMLS_CC);
|
||||
@@ -480,7 +489,7 @@ PS_SERIALIZER_DECODE_FUNC(php)
|
||||
|
||||
if (has_value) {
|
||||
MAKE_STD_ZVAL(current);
|
||||
if (php_var_unserialize(¤t, &q, endptr, &var_hash TSRMLS_CC)) {
|
||||
if (php_var_unserialize(¤t, (const unsigned char **)&q, endptr, &var_hash TSRMLS_CC)) {
|
||||
php_set_session_var(name, namelen, current, &var_hash TSRMLS_CC);
|
||||
}
|
||||
zval_ptr_dtor(¤t);
|
||||
@@ -499,13 +508,16 @@ break_outer_loop:
|
||||
|
||||
static void php_session_track_init(TSRMLS_D)
|
||||
{
|
||||
zval *session_vars = NULL;
|
||||
|
||||
/* Unconditionally destroy existing arrays -- possible dirty data */
|
||||
zend_hash_del(&EG(symbol_table), "HTTP_SESSION_VARS",
|
||||
sizeof("HTTP_SESSION_VARS"));
|
||||
zend_hash_del(&EG(symbol_table), "_SESSION", sizeof("_SESSION"));
|
||||
|
||||
MAKE_STD_ZVAL(PS(http_session_vars));
|
||||
array_init(PS(http_session_vars));
|
||||
MAKE_STD_ZVAL(session_vars);
|
||||
array_init(session_vars);
|
||||
PS(http_session_vars) = session_vars;
|
||||
|
||||
ZEND_SET_GLOBAL_VAR_WITH_LENGTH("HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS"), PS(http_session_vars), 2, 1);
|
||||
ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 2, 1);
|
||||
@@ -516,7 +528,11 @@ static char *php_session_encode(int *newlen TSRMLS_DC)
|
||||
char *ret = NULL;
|
||||
|
||||
IF_SESSION_VARS() {
|
||||
if (PS(serializer)->encode(&ret, newlen TSRMLS_CC) == FAILURE)
|
||||
if (!PS(serializer)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown session.serialize_handler. Failed to encode session object.");
|
||||
ret = NULL;
|
||||
}
|
||||
else if (PS(serializer)->encode(&ret, newlen TSRMLS_CC) == FAILURE)
|
||||
ret = NULL;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot encode non-existent session.");
|
||||
@@ -527,6 +543,10 @@ static char *php_session_encode(int *newlen TSRMLS_DC)
|
||||
|
||||
static void php_session_decode(const char *val, int vallen TSRMLS_DC)
|
||||
{
|
||||
if (!PS(serializer)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown session.serialize_handler. Failed to decode session object.");
|
||||
return;
|
||||
}
|
||||
if (PS(serializer)->decode(val, vallen TSRMLS_CC) == FAILURE) {
|
||||
php_session_destroy(TSRMLS_C);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to decode session object. Session has been destroyed.");
|
||||
@@ -863,7 +883,7 @@ static void php_session_send_cookie(TSRMLS_D)
|
||||
t = tv.tv_sec + PS(cookie_lifetime);
|
||||
|
||||
if (t > 0) {
|
||||
date_fmt = php_std_date(t);
|
||||
date_fmt = php_std_date(t TSRMLS_CC);
|
||||
smart_str_appends(&ncookie, COOKIE_EXPIRES);
|
||||
smart_str_appends(&ncookie, date_fmt);
|
||||
efree(date_fmt);
|
||||
@@ -926,8 +946,9 @@ static void php_session_reset_id(TSRMLS_D)
|
||||
{
|
||||
int module_number = PS(module_number);
|
||||
|
||||
if (PS(use_cookies)) {
|
||||
if (PS(use_cookies) && PS(send_cookie)) {
|
||||
php_session_send_cookie(TSRMLS_C);
|
||||
PS(send_cookie) = 0;
|
||||
}
|
||||
|
||||
/* if the SID constant exists, destroy it. */
|
||||
@@ -964,6 +985,21 @@ PHPAPI void php_session_start(TSRMLS_D)
|
||||
PS(define_sid) = 1;
|
||||
PS(send_cookie) = 1;
|
||||
if (PS(session_status) != php_session_none) {
|
||||
|
||||
if (PS(session_status) == php_session_disabled) {
|
||||
char *value;
|
||||
|
||||
value = zend_ini_string("session.save_handler", sizeof("session.save_handler"), 0);
|
||||
|
||||
if (value) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot find save handler %s", value);
|
||||
}
|
||||
else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot find unknown save handler");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
php_error(E_NOTICE, "A session had already been started - ignoring session_start()");
|
||||
return;
|
||||
}
|
||||
@@ -1106,8 +1142,8 @@ PHP_FUNCTION(session_set_cookie_params)
|
||||
zend_get_parameters_ex(ZEND_NUM_ARGS(), &lifetime, &path, &domain, &secure) == FAILURE)
|
||||
WRONG_PARAM_COUNT;
|
||||
|
||||
convert_to_long_ex(lifetime);
|
||||
PS(cookie_lifetime) = Z_LVAL_PP(lifetime);
|
||||
convert_to_string_ex(lifetime);
|
||||
zend_alter_ini_entry("session.cookie_lifetime", sizeof("session.cookie_lifetime"), Z_STRVAL_PP(lifetime), Z_STRLEN_PP(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
|
||||
if (ZEND_NUM_ARGS() > 1) {
|
||||
convert_to_string_ex(path);
|
||||
@@ -1170,32 +1206,36 @@ PHP_FUNCTION(session_module_name)
|
||||
{
|
||||
zval **p_name;
|
||||
int ac = ZEND_NUM_ARGS();
|
||||
char *old;
|
||||
|
||||
if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
|
||||
WRONG_PARAM_COUNT;
|
||||
|
||||
old = safe_estrdup(PS(mod)->s_name);
|
||||
|
||||
if (ac == 1) {
|
||||
ps_module *tempmod;
|
||||
|
||||
convert_to_string_ex(p_name);
|
||||
tempmod = _php_find_ps_module(Z_STRVAL_PP(p_name) TSRMLS_CC);
|
||||
if (tempmod) {
|
||||
if (PS(mod_data))
|
||||
PS(mod)->s_close(&PS(mod_data) TSRMLS_CC);
|
||||
PS(mod) = tempmod;
|
||||
PS(mod_data) = NULL;
|
||||
} else {
|
||||
efree(old);
|
||||
if (!_php_find_ps_module(Z_STRVAL_PP(p_name) TSRMLS_CC)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot find named PHP session module (%s)",
|
||||
Z_STRVAL_PP(p_name));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
if (PS(mod_data)) {
|
||||
PS(mod)->s_close(&PS(mod_data) TSRMLS_CC);
|
||||
}
|
||||
PS(mod_data) = NULL;
|
||||
|
||||
RETVAL_STRING(old, 0);
|
||||
if (PS(mod) && PS(mod)->s_name) {
|
||||
RETVAL_STRING(safe_estrdup(PS(mod)->s_name), 0);
|
||||
} else {
|
||||
RETVAL_EMPTY_STRING();
|
||||
}
|
||||
|
||||
zend_alter_ini_entry("session.save_handler", sizeof("session.save_handler"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
} else {
|
||||
if (PS(mod) && PS(mod)->s_name) {
|
||||
RETURN_STRING(safe_estrdup(PS(mod)->s_name), 0);
|
||||
} else {
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1283,6 +1323,7 @@ PHP_FUNCTION(session_regenerate_id)
|
||||
|
||||
PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC);
|
||||
|
||||
PS(send_cookie) = 1;
|
||||
php_session_reset_id(TSRMLS_C);
|
||||
|
||||
RETURN_TRUE;
|
||||
@@ -1350,7 +1391,7 @@ static void php_register_var(zval** entry TSRMLS_DC)
|
||||
} else {
|
||||
convert_to_string_ex(entry);
|
||||
|
||||
if ((strcmp(Z_STRVAL_PP(entry), "HTTP_SESSION_VARS") != 0) ||
|
||||
if ((strcmp(Z_STRVAL_PP(entry), "HTTP_SESSION_VARS") != 0) &&
|
||||
(strcmp(Z_STRVAL_PP(entry), "_SESSION") != 0)) {
|
||||
PS_ADD_VARL(Z_STRVAL_PP(entry), Z_STRLEN_PP(entry));
|
||||
}
|
||||
@@ -1376,9 +1417,15 @@ PHP_FUNCTION(session_register)
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
if (PS(session_status) == php_session_none)
|
||||
if (PS(session_status) == php_session_none || PS(session_status) == php_session_disabled) {
|
||||
php_session_start(TSRMLS_C);
|
||||
}
|
||||
|
||||
if (PS(session_status) == php_session_disabled) {
|
||||
efree(args);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (Z_TYPE_PP(args[i]) == IS_ARRAY)
|
||||
SEPARATE_ZVAL(args[i]);
|
||||
|
||||
@@ -5,6 +5,7 @@ Bug #26862 (ob_flush() before output_reset_rewrite_vars() results in data loss)
|
||||
--INI--
|
||||
register_globals=0
|
||||
html_errors=0
|
||||
session.use_trans_sid=0
|
||||
--FILE--
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
Loaded 100 of 268 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user